(acpi_sdthdr_t*)((acpi_apic_t**)&(rsdt->entry))[i];
switch (sdthdr->signature) {
case ACPI_MADT_SIG:
+ kprintf(KINFO "MADT: %p\n", sdthdr);
madt_parse((acpi_madt_t*)sdthdr, ctx);
break;
case ACPI_FADT_SIG:
// FADT just a plain structure, no need to parse.
+ kprintf(KINFO "FADT: %p\n", sdthdr);
ctx->fadt = *(acpi_fadt_t*)sdthdr;
break;
case ACPI_MCFG_SIG:
+ kprintf(KINFO "MCFG: %p\n", sdthdr);
mcfg_parse(sdthdr, ctx);
break;
default:
}
struct hba_device* hbadev = port->device;
- kprintf(KINFO "sata%d: %s, sector_size=%dB, sector=%d\n",
+ kprintf(KINFO "sata%d: %s, blk_size=%d, blk=0..%d\n",
i,
hbadev->model,
hbadev->block_size,
.device_info = reg1,
.intr_info = intr };
+ kprintf("dev.%d:%d:%d %x:%x\n",
+ bus,
+ dev,
+ funct,
+ PCI_DEV_VENDOR(reg1),
+ PCI_DEV_DEVID(reg1));
+
pci_probe_msi_info(device);
pci_probe_bar_info(device);
#include <lunaix/block.h>
#include <lunaix/mm/valloc.h>
#include <lunaix/status.h>
+#include <lunaix/syslog.h>
#include <lib/crc.h>
static u8_t NULL_GUID[16] = { 0 };
+LOG_MODULE("GPT")
+
int
blkpart_parse(struct device* master, struct gpt_header* header)
{
u64_t slba_local = (ent->start_lba * GPT_BLKSIZE) / bdev->blk_size;
u64_t elba_local = (ent->end_lba * GPT_BLKSIZE) / (u64_t)bdev->blk_size;
+ kprintf("%s: guid part#%d: %d..%d\n",
+ bdev->bdev_id,
+ i,
+ (u32_t)slba_local,
+ (u32_t)elba_local);
// we ignore the partition name, as it rarely used.
blk_mount_part(bdev, NULL, i, slba_local, elba_local);
}
u32_t crc = gpt_hdr->hdr_cksum;
gpt_hdr->hdr_cksum = 0;
if (crc32b((void*)gpt_hdr, sizeof(*gpt_hdr)) != crc) {
+ kprintf(KWARN "checksum failed\n");
// FUTURE check the backup header
return EINVAL;
}
errno = blkpart_probegpt(bdev->dev);
if (errno < 0) {
- kprintf(KERROR "Corrupted partition table. (%d)", errno);
+ kprintf(KERROR "Fail to parse partition table (%d)\n", errno);
} else if (!errno) {
// TODO try other PT parser...
}
}
switch (log_level) {
- case '0':
- ksnprintf(expanded_fmt,
- MAX_XFMT_SIZE,
- "[%s] (%s) %s",
- "INFO",
- component,
- fmt);
- break;
case '1':
// tty_set_theme(VGA_COLOR_BROWN, current_theme >> 12);
ksnprintf(expanded_fmt,
MAX_XFMT_SIZE,
- "\033[6;0m[%s] (%s) %s\033[39;49m",
- "WARN",
+ "\033[6;0mW %s: %s\033[39;49m",
component,
fmt);
break;
// tty_set_theme(VGA_COLOR_LIGHT_RED, current_theme >> 12);
ksnprintf(expanded_fmt,
MAX_XFMT_SIZE,
- "\033[12;0m[%s] (%s) %s\033[39;49m",
- "EROR",
+ "\033[12;0mE %s: %s\033[39;49m",
component,
fmt);
break;
// tty_set_theme(VGA_COLOR_LIGHT_BLUE, current_theme >> 12);
ksnprintf(expanded_fmt,
MAX_XFMT_SIZE,
- "\033[9;0m[%s] (%s) %s\033[39;49m",
- "DEBG",
+ "\033[9;0mD %s: %s\033[39;49m",
component,
fmt);
break;
default:
- ksnprintf(expanded_fmt,
- MAX_XFMT_SIZE,
- "[%s] (%s) %s",
- "LOG",
- component,
- fmt);
+ ksnprintf(expanded_fmt, MAX_XFMT_SIZE, "- %s: %s", component, fmt);
break;
}
#define PS2_DEV_CMD_MAX_ATTEMPTS 5
-LOG_MODULE("PS2KBD");
+LOG_MODULE("i8042");
static struct ps2_cmd_queue cmd_q;
static struct ps2_kbd_state kbd_state;
* https://bochs.sourceforge.io/cgi-bin/lxr/source/bios/rombios32.c#L1314
*/
if (!(acpi_ctx->fadt.boot_arch & IAPC_ARCH_8042)) {
- kprintf(KERROR "i8042: not found\n");
+ kprintf(KERROR "not found\n");
// FUTURE: Some alternative fallback on this? Check PCI bus for USB
// controller instead?
return;
}
} else {
- kprintf(KWARN "i8042: outdated FADT used, assuming exists.\n");
+ kprintf(KWARN "outdated FADT used, assuming exists.\n");
}
char result;
// 4、控制器自检
result = ps2_issue_cmd_wretry(PS2_CMD_SELFTEST, PS2_NO_ARG);
if (result != PS2_RESULT_TEST_OK) {
- kprintf(KWARN "Controller self-test failed. (%x)\n", result);
+ kprintf(KWARN "controller self-test failed. (%x)\n", result);
// goto done;
}
// 5、设备自检(端口1自检,通常是我们的键盘)
result = ps2_issue_cmd_wretry(PS2_CMD_SELFTEST_PORT1, PS2_NO_ARG);
if (result != 0) {
- kprintf(KERROR "Interface test on port 1 failed. (%x)\n", result);
+ kprintf(KERROR "interface test on port 1 failed. (%x)\n", result);
// goto done;
}
c++;
}
if (c >= 5) {
- kprintf(KWARN "Max attempt reached.\n");
+ kprintf(KWARN "max attempt reached.\n");
}
return r;
}
#include <lunaix/peripheral/serial.h>
#include <lunaix/syslog.h>
-LOG_MODULE("COM")
+LOG_MODULE("UART")
void
serial_init_port(uintptr_t port)
io_outb(COM_RRXTX(port), 0xaa);
if (io_inb(COM_RRXTX(port)) != 0xaa) {
- kprintf(KWARN "Port (%p) is faulty, use other instead.\n", port);
+ kprintf(KWARN "port.%p: faulty\n", port);
return;
}
io_outb(COM_RCMODEM(port), 0xf);
io_outb(COM_RIE(port), 0x1);
- kprintf("Port (%p) ok\n", port);
+ kprintf("port.%p: ok\n", port);
}
void
void
init_platform()
{
+ kprintf(KINFO "\033[11;0mLunaixOS \033[39;49m\n");
+
// 锁定所有系统预留页(内存映射IO,ACPI之类的),并且进行1:1映射
lock_reserved_memory();
size_t pg_num = CEIL(mmap.len_low, PG_SIZE_BITS);
size_t j = 0;
if (!unlock) {
+ kprintf("mem: freeze: %p..%p type=%x\n",
+ pa,
+ pa + pg_num * PG_SIZE,
+ mmap.type);
for (; j < pg_num; j++) {
uintptr_t _pa = pa + (j << PG_SIZE_BITS);
if (_pa >= KERNEL_MM_BASE) {
// Save the progress for later unmapping.
mmaps[i].len_low = j * PG_SIZE;
} else {
+ kprintf("mem: reclaim: %p..%p type=%x\n",
+ pa,
+ pa + pg_num * PG_SIZE,
+ mmap.type);
for (; j < pg_num; j++) {
uintptr_t _pa = pa + (j << PG_SIZE_BITS);
vmm_del_mapping(PD_REFERENCED, _pa);
assert_msg(timer_ctx->base_frequency, "Fail to initialize timer (NOFREQ)");
- kprintf(KINFO "Base frequency: %u Hz\n", timer_ctx->base_frequency);
+ kprintf(
+ KINFO "hw: %u Hz; os: %u Hz\n", timer_ctx->base_frequency, frequency);
timer_ctx->running_frequency = frequency;
timer_ctx->tphz = timer_ctx->base_frequency / frequency;
console->wnd_start = rd_ptr;
fbuf->flags |= FIFO_DIRTY;
mutex_unlock(&fbuf->lock);
+
+ if (!lx_console.flush_timer) {
+ console_flush();
+ }
}
void