Rename intr log to apic, remove debug defaults

This commit is contained in:
Justin C. Miller
2018-05-05 11:02:41 -07:00
parent 3a86e89116
commit d7506b6aaf
6 changed files with 23 additions and 22 deletions

View File

@@ -42,7 +42,7 @@ lapic::lapic(uint32_t *base, isr spurious) :
apic(base)
{
apic_write(m_base, 0xf0, static_cast<uint32_t>(spurious));
log::info(logs::interrupt, "LAPIC created, base %lx", m_base);
log::info(logs::apic, "LAPIC created, base %lx", m_base);
}
void
@@ -68,7 +68,7 @@ lapic::enable_timer(isr vector, uint8_t divisor, uint32_t count, bool repeat)
if (repeat)
lvte |= 0x20000;
log::debug(logs::interrupt, "Enabling APIC timer with isr %d.", vector);
log::debug(logs::apic, "Enabling APIC timer with isr %d.", vector);
apic_write(m_base, 0x320, lvte);
}
@@ -89,7 +89,7 @@ lapic::enable_lint(uint8_t num, isr vector, bool nmi, uint16_t flags)
lvte |= (1 << 15);
apic_write(m_base, off, lvte);
log::debug(logs::interrupt, "APIC LINT%d enabled as %s %d %s-triggered, active %s.",
log::debug(logs::apic, "APIC LINT%d enabled as %s %d %s-triggered, active %s.",
num, nmi ? "NMI" : "ISR", vector,
polarity == 3 ? "level" : "edge",
trigger == 3 ? "low" : "high");
@@ -100,7 +100,7 @@ lapic::enable()
{
apic_write(m_base, 0xf0,
apic_read(m_base, 0xf0) | 0x100);
log::debug(logs::interrupt, "LAPIC enabled!");
log::debug(logs::apic, "LAPIC enabled!");
}
void
@@ -108,7 +108,7 @@ lapic::disable()
{
apic_write(m_base, 0xf0,
apic_read(m_base, 0xf0) & ~0x100);
log::debug(logs::interrupt, "LAPIC disabled.");
log::debug(logs::apic, "LAPIC disabled.");
}
@@ -122,7 +122,7 @@ ioapic::ioapic(uint32_t *base, uint32_t base_gsi) :
m_id = (id >> 24) & 0xff;
m_version = version & 0xff;
m_num_gsi = (version >> 16) & 0xff;
log::debug(logs::interrupt, "IOAPIC %d loaded, version %d, GSIs %d-%d",
log::debug(logs::apic, "IOAPIC %d loaded, version %d, GSIs %d-%d",
m_id, m_version, base_gsi, base_gsi + (m_num_gsi - 1));
for (uint8_t i = 0; i < m_num_gsi; ++i) {
@@ -167,7 +167,7 @@ ioapic::mask(uint8_t irq, bool masked)
void
ioapic::dump_redirs() const
{
log::debug(logs::interrupt, "IOAPIC %d redirections:", m_id);
log::debug(logs::apic, "IOAPIC %d redirections:", m_id);
for (uint8_t i = 0; i < m_num_gsi; ++i) {
uint64_t low = ioapic_read(m_base, 0x10 + (2 *i));
@@ -183,7 +183,7 @@ ioapic::dump_redirs() const
uint8_t mask = (redir >> 16) & 0x1;
uint8_t dest = (redir >> 56) & 0xff;
log::debug(logs::interrupt, " %2d: vec %3d %s active, %s-triggered %s dest %d: %x",
log::debug(logs::apic, " %2d: vec %3d %s active, %s-triggered %s dest %d: %x",
m_base_gsi + i, vector,
polarity ? "low" : "high",
trigger ? "level" : "edge",

View File

@@ -99,17 +99,17 @@ device_manager::load_xsdt(const acpi_xsdt *xsdt)
kassert(xsdt && acpi_validate(xsdt), "Invalid ACPI XSDT.");
char sig[5] = {0,0,0,0,0};
log::info(logs::devices, "ACPI 2.0 tables loading:");
log::info(logs::devices, "ACPI 2.0 tables loading");
put_sig(sig, xsdt->header.type);
log::info(logs::devices, " Found table %s", sig);
log::debug(logs::devices, " Found table %s", sig);
size_t num_tables = acpi_table_entries(xsdt, sizeof(void*));
for (size_t i = 0; i < num_tables; ++i) {
const acpi_table_header *header = xsdt->headers[i];
put_sig(sig, header->type);
log::info(logs::devices, " Found table %s", sig);
log::debug(logs::devices, " Found table %s", sig);
kassert(header->validate(), "Table failed validation.");
@@ -163,7 +163,7 @@ device_manager::load_apic(const acpi_apic *apic)
isr gsi = isr::irq0 + kutil::read_from<uint32_t>(p+4);
uint16_t flags = kutil::read_from<uint16_t>(p+8);
log::info(logs::devices, " Intr source override IRQ %d -> %d Pol %d Tri %d",
log::debug(logs::devices, " Intr source override IRQ %d -> %d Pol %d Tri %d",
source, gsi, (flags & 0x3), ((flags >> 2) & 0x3));
// TODO: in a multiple-IOAPIC system this might be elsewhere
@@ -176,7 +176,7 @@ device_manager::load_apic(const acpi_apic *apic)
uint8_t num = kutil::read_from<uint8_t>(p + 5);
uint16_t flags = kutil::read_from<uint16_t>(p + 3);
log::info(logs::devices, " LAPIC NMI Proc %d LINT%d Pol %d Tri %d",
log::debug(logs::devices, " LAPIC NMI Proc %d LINT%d Pol %d Tri %d",
kutil::read_from<uint8_t>(p+2),
kutil::read_from<uint8_t>(p+5),
kutil::read_from<uint16_t>(p+3) & 0x3,

View File

@@ -195,7 +195,7 @@ interrupts_init()
disable_legacy_pic();
enable_serial_interrupts();
log::info(logs::interrupt, "Interrupts enabled.");
log::info(logs::boot, "Interrupts enabled.");
}
struct registers
@@ -333,7 +333,7 @@ irq_handler(registers regs)
void
gdt_dump(const table_ptr &table)
{
log::info(logs::interrupt, "Loaded GDT at: %lx size: %d bytes", table.base, table.limit+1);
log::info(logs::boot, "Loaded GDT at: %lx size: %d bytes", table.base, table.limit+1);
int count = (table.limit + 1) / sizeof(gdt_descriptor);
const gdt_descriptor *gdt =
@@ -350,7 +350,7 @@ gdt_dump(const table_ptr &table)
gdt[i].limit_low;
if (gdt[i].flags & 0x80) {
log::debug(logs::interrupt,
log::debug(logs::boot,
" Entry %3d: Base %x limit %x privs %d flags %s%s%s%s%s%s",
i, base, limit, ((gdt[i].flags >> 5) & 0x03),
@@ -370,7 +370,7 @@ gdt_dump(const table_ptr &table)
void
idt_dump(const table_ptr &table)
{
log::info(logs::interrupt, "Loaded IDT at: %lx size: %d bytes", table.base, table.limit+1);
log::info(logs::boot, "Loaded IDT at: %lx size: %d bytes", table.base, table.limit+1);
int count = (table.limit + 1) / sizeof(idt_descriptor);
const idt_descriptor *idt =
@@ -393,7 +393,7 @@ idt_dump(const table_ptr &table)
}
if (idt[i].flags & 0x80) {
log::debug(logs::interrupt,
log::debug(logs::boot,
" Entry %3d: Base:%lx Sel(rpl %d, ti %d, %3d) IST:%d %s DPL:%d", i, base,
(idt[i].selector & 0x3),
((idt[i].selector & 0x4) >> 2),

View File

@@ -4,14 +4,14 @@
#include "log.h"
static const uint64_t default_enabled[] = {0x09, 0x0f, 0x0f, 0x0f};
static const uint64_t default_enabled[] = {0x00, 0x0f, 0x0f, 0x0f};
static const uint8_t level_colors[] = {0x07, 0x0f, 0x0b, 0x09};
static const char *levels[] = {"debug", " info", " warn", "error", "fatal"};
static const char *areas[] = {
"boot",
"mem ",
"intr",
"apic",
"dev ",
nullptr

View File

@@ -9,7 +9,7 @@ enum class logs
{
boot,
memory,
interrupt,
apic,
devices,
max

View File

@@ -46,7 +46,8 @@ init_console(const popcorn_data *header)
cons->puts(GIT_VERSION " booting...\n");
log::init(cons);
log::enable(logs::interrupt, log::level::debug);
//log::enable(logs::apic, log::level::debug);
log::enable(logs::devices, log::level::debug);
}
void