Rename intr log to apic, remove debug defaults
This commit is contained in:
@@ -42,7 +42,7 @@ lapic::lapic(uint32_t *base, isr spurious) :
|
|||||||
apic(base)
|
apic(base)
|
||||||
{
|
{
|
||||||
apic_write(m_base, 0xf0, static_cast<uint32_t>(spurious));
|
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
|
void
|
||||||
@@ -68,7 +68,7 @@ lapic::enable_timer(isr vector, uint8_t divisor, uint32_t count, bool repeat)
|
|||||||
if (repeat)
|
if (repeat)
|
||||||
lvte |= 0x20000;
|
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);
|
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);
|
lvte |= (1 << 15);
|
||||||
|
|
||||||
apic_write(m_base, off, lvte);
|
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,
|
num, nmi ? "NMI" : "ISR", vector,
|
||||||
polarity == 3 ? "level" : "edge",
|
polarity == 3 ? "level" : "edge",
|
||||||
trigger == 3 ? "low" : "high");
|
trigger == 3 ? "low" : "high");
|
||||||
@@ -100,7 +100,7 @@ lapic::enable()
|
|||||||
{
|
{
|
||||||
apic_write(m_base, 0xf0,
|
apic_write(m_base, 0xf0,
|
||||||
apic_read(m_base, 0xf0) | 0x100);
|
apic_read(m_base, 0xf0) | 0x100);
|
||||||
log::debug(logs::interrupt, "LAPIC enabled!");
|
log::debug(logs::apic, "LAPIC enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -108,7 +108,7 @@ lapic::disable()
|
|||||||
{
|
{
|
||||||
apic_write(m_base, 0xf0,
|
apic_write(m_base, 0xf0,
|
||||||
apic_read(m_base, 0xf0) & ~0x100);
|
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_id = (id >> 24) & 0xff;
|
||||||
m_version = version & 0xff;
|
m_version = version & 0xff;
|
||||||
m_num_gsi = (version >> 16) & 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));
|
m_id, m_version, base_gsi, base_gsi + (m_num_gsi - 1));
|
||||||
|
|
||||||
for (uint8_t i = 0; i < m_num_gsi; ++i) {
|
for (uint8_t i = 0; i < m_num_gsi; ++i) {
|
||||||
@@ -167,7 +167,7 @@ ioapic::mask(uint8_t irq, bool masked)
|
|||||||
void
|
void
|
||||||
ioapic::dump_redirs() const
|
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) {
|
for (uint8_t i = 0; i < m_num_gsi; ++i) {
|
||||||
uint64_t low = ioapic_read(m_base, 0x10 + (2 *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 mask = (redir >> 16) & 0x1;
|
||||||
uint8_t dest = (redir >> 56) & 0xff;
|
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,
|
m_base_gsi + i, vector,
|
||||||
polarity ? "low" : "high",
|
polarity ? "low" : "high",
|
||||||
trigger ? "level" : "edge",
|
trigger ? "level" : "edge",
|
||||||
|
|||||||
@@ -99,17 +99,17 @@ device_manager::load_xsdt(const acpi_xsdt *xsdt)
|
|||||||
kassert(xsdt && acpi_validate(xsdt), "Invalid ACPI XSDT.");
|
kassert(xsdt && acpi_validate(xsdt), "Invalid ACPI XSDT.");
|
||||||
|
|
||||||
char sig[5] = {0,0,0,0,0};
|
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);
|
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*));
|
size_t num_tables = acpi_table_entries(xsdt, sizeof(void*));
|
||||||
for (size_t i = 0; i < num_tables; ++i) {
|
for (size_t i = 0; i < num_tables; ++i) {
|
||||||
const acpi_table_header *header = xsdt->headers[i];
|
const acpi_table_header *header = xsdt->headers[i];
|
||||||
|
|
||||||
put_sig(sig, header->type);
|
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.");
|
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);
|
isr gsi = isr::irq0 + kutil::read_from<uint32_t>(p+4);
|
||||||
uint16_t flags = kutil::read_from<uint16_t>(p+8);
|
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));
|
source, gsi, (flags & 0x3), ((flags >> 2) & 0x3));
|
||||||
|
|
||||||
// TODO: in a multiple-IOAPIC system this might be elsewhere
|
// 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);
|
uint8_t num = kutil::read_from<uint8_t>(p + 5);
|
||||||
uint16_t flags = kutil::read_from<uint16_t>(p + 3);
|
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+2),
|
||||||
kutil::read_from<uint8_t>(p+5),
|
kutil::read_from<uint8_t>(p+5),
|
||||||
kutil::read_from<uint16_t>(p+3) & 0x3,
|
kutil::read_from<uint16_t>(p+3) & 0x3,
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ interrupts_init()
|
|||||||
disable_legacy_pic();
|
disable_legacy_pic();
|
||||||
enable_serial_interrupts();
|
enable_serial_interrupts();
|
||||||
|
|
||||||
log::info(logs::interrupt, "Interrupts enabled.");
|
log::info(logs::boot, "Interrupts enabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct registers
|
struct registers
|
||||||
@@ -333,7 +333,7 @@ irq_handler(registers regs)
|
|||||||
void
|
void
|
||||||
gdt_dump(const table_ptr &table)
|
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);
|
int count = (table.limit + 1) / sizeof(gdt_descriptor);
|
||||||
const gdt_descriptor *gdt =
|
const gdt_descriptor *gdt =
|
||||||
@@ -350,7 +350,7 @@ gdt_dump(const table_ptr &table)
|
|||||||
gdt[i].limit_low;
|
gdt[i].limit_low;
|
||||||
|
|
||||||
if (gdt[i].flags & 0x80) {
|
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",
|
" Entry %3d: Base %x limit %x privs %d flags %s%s%s%s%s%s",
|
||||||
i, base, limit, ((gdt[i].flags >> 5) & 0x03),
|
i, base, limit, ((gdt[i].flags >> 5) & 0x03),
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ gdt_dump(const table_ptr &table)
|
|||||||
void
|
void
|
||||||
idt_dump(const table_ptr &table)
|
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);
|
int count = (table.limit + 1) / sizeof(idt_descriptor);
|
||||||
const idt_descriptor *idt =
|
const idt_descriptor *idt =
|
||||||
@@ -393,7 +393,7 @@ idt_dump(const table_ptr &table)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (idt[i].flags & 0x80) {
|
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,
|
" Entry %3d: Base:%lx Sel(rpl %d, ti %d, %3d) IST:%d %s DPL:%d", i, base,
|
||||||
(idt[i].selector & 0x3),
|
(idt[i].selector & 0x3),
|
||||||
((idt[i].selector & 0x4) >> 2),
|
((idt[i].selector & 0x4) >> 2),
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
#include "log.h"
|
#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 uint8_t level_colors[] = {0x07, 0x0f, 0x0b, 0x09};
|
||||||
|
|
||||||
static const char *levels[] = {"debug", " info", " warn", "error", "fatal"};
|
static const char *levels[] = {"debug", " info", " warn", "error", "fatal"};
|
||||||
static const char *areas[] = {
|
static const char *areas[] = {
|
||||||
"boot",
|
"boot",
|
||||||
"mem ",
|
"mem ",
|
||||||
"intr",
|
"apic",
|
||||||
"dev ",
|
"dev ",
|
||||||
|
|
||||||
nullptr
|
nullptr
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ enum class logs
|
|||||||
{
|
{
|
||||||
boot,
|
boot,
|
||||||
memory,
|
memory,
|
||||||
interrupt,
|
apic,
|
||||||
devices,
|
devices,
|
||||||
|
|
||||||
max
|
max
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ init_console(const popcorn_data *header)
|
|||||||
cons->puts(GIT_VERSION " booting...\n");
|
cons->puts(GIT_VERSION " booting...\n");
|
||||||
|
|
||||||
log::init(cons);
|
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
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user