From d7e2dc844666cf3f488fd69409640f1f8a9844d4 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 21 Feb 2025 13:15:10 -0500 Subject: kernel: Update kernel log style Kernel logs must now all be lowercase for consistency. A new style called Peripheral Description Notation (PDN) has also been introduced to describe devices. Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/acpi_machdep.c | 9 +++------ sys/arch/amd64/amd64/hpet.c | 4 ++-- sys/arch/amd64/amd64/ioapic.c | 12 ++++++------ sys/arch/amd64/amd64/lapic.c | 13 ++++++++----- sys/arch/amd64/amd64/mp.c | 4 ++-- sys/arch/amd64/amd64/trap.c | 8 ++++---- sys/arch/amd64/amd64/tss.c | 4 ++-- sys/arch/amd64/pci/pci_resource.c | 2 +- sys/dev/acpi/acpi_init.c | 8 ++++---- sys/dev/ic/ahci.c | 10 +++++----- sys/dev/ic/nvme.c | 20 ++++++++++---------- sys/dev/pci/pci.c | 5 +++-- sys/dev/usb/xhci.c | 20 ++++++++++---------- sys/fs/initramfs.c | 4 ++-- sys/include/arch/amd64/ioapic.h | 3 ++- sys/include/lib/assert.h | 2 +- sys/kern/init_main.c | 2 +- sys/kern/kern_exit.c | 2 +- sys/kern/kern_sched.c | 2 +- sys/vm/vm_init.c | 2 +- 20 files changed, 69 insertions(+), 67 deletions(-) (limited to 'sys') diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index 49f70ac..7533621 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -46,7 +46,7 @@ acpi_init_madt(void) uint8_t *cur, *end; if (madt == NULL) { - panic("Could not find MADT!\n"); + panic("could not find MADT!\n"); } cur = (uint8_t *)(madt + 1); @@ -60,15 +60,12 @@ acpi_init_madt(void) * TODO: Figure out how to use multiple I/O APICs */ if (ioapic != NULL) { - pr_trace("Skipping I/O APIC with ID %d\n", ioapic->ioapic_id); + pr_trace("skipping I/O APIC with ID %d\n", ioapic->ioapic_id); break; } ioapic = (struct ioapic *)cur; - pr_trace("Detected I/O APIC (id=%d, gsi_base=%d)\n", - ioapic->ioapic_id, ioapic->gsi_base); - - ioapic_init((void *)(uintptr_t)ioapic->ioapic_addr); + ioapic_init(ioapic); } cur += apichdr->length; diff --git a/sys/arch/amd64/amd64/hpet.c b/sys/arch/amd64/amd64/hpet.c index 28baa35..1670546 100644 --- a/sys/arch/amd64/amd64/hpet.c +++ b/sys/arch/amd64/amd64/hpet.c @@ -157,7 +157,7 @@ hpet_init(void) /* Ensure caps aren't bogus */ caps = hpet_read(HPET_REG_CAPS); if (CAP_REV_ID(caps) == 0) { - pr_error("Found bogus revision, assuming faulty\n"); + pr_error("found bogus revision, assuming faulty\n"); return -1; } if (CAP_CLK_PERIOD(caps) > 0x05F5E100) { @@ -166,7 +166,7 @@ hpet_init(void) * be <= 0x05F5E100. So we'll consider it as bogus * if it exceeds this value */ - pr_error("Found bogus COUNTER_CLK_PERIOD, assuming faulty\n"); + pr_error("found bogus COUNTER_CLK_PERIOD, assuming faulty\n"); return 1; } diff --git a/sys/arch/amd64/amd64/ioapic.c b/sys/arch/amd64/amd64/ioapic.c index 8c92b95..943839f 100644 --- a/sys/arch/amd64/amd64/ioapic.c +++ b/sys/arch/amd64/amd64/ioapic.c @@ -59,7 +59,7 @@ irq_to_gsi(uint8_t irq) if (madt == NULL) madt = acpi_query("APIC"); if (madt == NULL) - panic("Failed to fetch MADT\n"); + panic("failed to fetch MADT\n"); cur = (uint8_t *)(madt + 1); end = (uint8_t *)madt + madt->hdr.length; @@ -211,20 +211,20 @@ ioapic_set_vec(uint8_t irq, uint8_t vector) } void -ioapic_init(void *base) +ioapic_init(struct ioapic *p) { size_t tmp; uint8_t redir_ent_cnt, ver; - ioapic_base = base; + ioapic_base = (void *)((uintptr_t)p->ioapic_addr); tmp = ioapic_readl(IOAPICVER); ver = tmp & 0xFF; redir_ent_cnt = ((tmp >> 16) & 0xFF) + 1; - pr_trace("version=%d, address=0x%x\n", ver, base); - pr_trace("Masking %d GSIs...\n", redir_ent_cnt); - for (uint8_t i = 0; i < redir_ent_cnt; ++i) { ioapic_gsi_mask(i); } + + pr_trace("ioapic0 at mainbus0: ver %d, addr %p\n", ver, ioapic_base); + pr_trace("%d GSIs masked\n", redir_ent_cnt); } diff --git a/sys/arch/amd64/amd64/lapic.c b/sys/arch/amd64/amd64/lapic.c index f74aea4..70d36a5 100644 --- a/sys/arch/amd64/amd64/lapic.c +++ b/sys/arch/amd64/amd64/lapic.c @@ -321,18 +321,19 @@ lapic_init(void) { struct cpu_info *ci = this_cpu(); union tss_stack tmr_stack; + char *modestr; /* * Hyra currently depends on the existance * of a Local APIC. */ if (!lapic_supported()) { - panic("This machine does not support LAPIC!\n"); + panic("this machine does not support LAPIC!\n"); } /* Try to allocate LAPIC timer interrupt stack */ if (tss_alloc_stack(&tmr_stack, DEFAULT_PAGESIZE) != 0) { - panic("Failed to allocate LAPIC TMR stack!\n"); + panic("failed to allocate LAPIC TMR stack!\n"); } tss_update_ist(ci, tmr_stack, IST_SCHED); @@ -346,7 +347,7 @@ lapic_init(void) /* Ensure the LAPIC base is valid */ if (g_lapic_base == 0) { - panic("Invalid LAPIC base\n"); + panic("invalid LAPIC base\n"); } ci->has_x2apic = lapic_has_x2apic(); @@ -354,8 +355,10 @@ lapic_init(void) ci->apicid = lapic_read_id(ci); ci->lapic_tmr_freq = lapic_timer_init(); - bsp_trace("BSP LAPIC enabled in %s mode (id=%d)\n", - ci->has_x2apic ? "x2APIC" : "xAPIC", ci->apicid); + modestr = ci->has_x2apic ? "x2apic" : "xapic"; + + bsp_trace("lapic0 at cpu0: apicid %d\n"); + bsp_trace("lapic0 in %s mode\n", modestr); /* Try to register the timer */ lapic_timer.name = "LAPIC_INTEGRATED_TIMER"; diff --git a/sys/arch/amd64/amd64/mp.c b/sys/arch/amd64/amd64/mp.c index 501f7e8..a8a36c7 100644 --- a/sys/arch/amd64/amd64/mp.c +++ b/sys/arch/amd64/amd64/mp.c @@ -81,10 +81,10 @@ mp_bootstrap_aps(struct cpu_info *ci) return; } - pr_trace("Bootstrapping %d cores...\n", cpu_init_counter); + pr_trace("bootstrapping %d cores...\n", cpu_init_counter); for (size_t i = 0; i < resp->cpu_count; ++i) { if (ci->apicid == cpus[i]->lapic_id) { - pr_trace("Skip %d (BSP)... continue\n", ci->apicid); + pr_trace("skip %d (BSP)... continue\n", ci->apicid); continue; } diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index 6705e1a..29056b0 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -105,7 +105,7 @@ trap_user(struct trapframe *tf) sigaddset(&sigset, SIGFPE); break; default: - kprintf("Got unknown user trap %d\n", tf->trapno); + kprintf("got unknown user trap %d\n", tf->trapno); sigaddset(&sigset, SIGKILL); break; } @@ -142,10 +142,10 @@ trap_handler(struct trapframe *tf) splraise(IPL_HIGH); if (tf->trapno >= NELEM(trap_type)) { - panic("Got unknown trap %d\n", tf->trapno); + panic("got unknown trap %d\n", tf->trapno); } - pr_error("Got %s\n", trap_type[tf->trapno]); + pr_error("got %s\n", trap_type[tf->trapno]); /* Handle traps from userland */ if (ISSET(tf->cs, 3)) { @@ -154,5 +154,5 @@ trap_handler(struct trapframe *tf) } regdump(tf); - panic("Fatal trap - halting\n"); + panic("fatal trap - halting\n"); } diff --git a/sys/arch/amd64/amd64/tss.c b/sys/arch/amd64/amd64/tss.c index bfda31c..b82a230 100644 --- a/sys/arch/amd64/amd64/tss.c +++ b/sys/arch/amd64/amd64/tss.c @@ -57,14 +57,14 @@ alloc_resources(struct cpu_info *ci) tss = dynalloc(sizeof(*tss)); if (tss == NULL) { - panic("Failed to alloc TSS\n"); + panic("failed to alloc TSS\n"); } memset(tss, 0, sizeof(*tss)); rsp0_base = vm_alloc_frame(1) + VM_HIGHER_HALF; if (rsp0_base == 0) { - panic("Could not allocate RSP0 base\n"); + panic("could not allocate RSP0 base\n"); } rsp0 = rsp0_base + STACK_SIZE; diff --git a/sys/arch/amd64/pci/pci_resource.c b/sys/arch/amd64/pci/pci_resource.c index 5ca597b..92d8a5f 100644 --- a/sys/arch/amd64/pci/pci_resource.c +++ b/sys/arch/amd64/pci/pci_resource.c @@ -73,7 +73,7 @@ pcir_enable_dma(struct bus_resource *brp, void *devp) * is disabled. */ if (!ISSET(brp->sem, BUS_DMA)) { - pr_trace("Bus marked non DMA capable, DMA not enabled\n"); + pr_trace("bus marked non DMA capable, DMA not enabled\n"); return -EACCES; } diff --git a/sys/dev/acpi/acpi_init.c b/sys/dev/acpi/acpi_init.c index f3de87d..bc8be77 100644 --- a/sys/dev/acpi/acpi_init.c +++ b/sys/dev/acpi/acpi_init.c @@ -54,7 +54,7 @@ acpi_init_hpet(void) { #if defined(__x86_64__) if (hpet_init() != 0) { - panic("Could not init HPET\n"); + panic("could not init HPET\n"); } #endif } @@ -107,14 +107,14 @@ acpi_init(void) /* Fetch the root SDT */ if (rsdp->revision >= 2) { root_sdt = PHYS_TO_VIRT(rsdp->xsdt_addr); - pr_trace("Using XSDT as root SDT\n"); + pr_trace("using XSDT as root SDT\n"); } else { root_sdt = PHYS_TO_VIRT(rsdp->rsdt_addr); - pr_trace("Using RSDT as root SDT\n"); + pr_trace("using RSDT as root SDT\n"); } if (acpi_checksum(&root_sdt->hdr) != 0) { - panic("Root SDT checksum is invalid!\n"); + panic("root SDT checksum is invalid!\n"); } root_sdt_entries = (root_sdt->hdr.length - sizeof(root_sdt->hdr)) / 4; diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index ec7e68a..5c85013 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -131,7 +131,7 @@ ahci_hba_init(struct ahci_hba *hba) return error; } - pr_trace("Successfully performed a hard reset.\n"); + pr_trace("successfully performed a hard reset\n"); /* * The HBA provides backwards compatibility with @@ -166,25 +166,25 @@ ahci_init(void) * devices to the PCI bus, acting as an interface * between them. */ - pr_trace("Detected AHCI HBA (%x:%x.%x, slot=%d)\n", + pr_trace("IDE storage ctrl \n", ahci_dev->bus, ahci_dev->device_id, ahci_dev->func, ahci_dev->slot); /* Try to request a general purpose timer */ if (req_timer(TIMER_GP, &tmr) != TMRR_SUCCESS) { - pr_error("Failed to fetch general purpose timer\n"); + pr_error("failed to fetch general purpose timer\n"); return -ENODEV; } /* Ensure it has get_time_usec() */ if (tmr.get_time_usec == NULL) { - pr_error("General purpose timer has no get_time_usec()\n"); + pr_error("general purpose timer has no get_time_usec()\n"); return -ENODEV; } /* We also need msleep() */ if (tmr.msleep == NULL) { - pr_error("General purpose timer has no msleep()\n"); + pr_error("general purpose timer has no msleep()\n"); return -ENODEV; } diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index 4e1a487..749ac93 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -219,7 +219,7 @@ nvme_stop_ctrl(struct nvme_bar *bar) mmio_write32(&bar->config, config); if (nvme_poll_reg(bar, &bar->status, STATUS_RDY, false) < 0) { - pr_error("Controller reset timeout\n"); + pr_error("controller reset timeout\n"); return -ETIME; } @@ -246,7 +246,7 @@ nvme_start_ctrl(struct nvme_bar *bar) mmio_write32(&bar->config, config); if (nvme_poll_reg(bar, &bar->status, STATUS_RDY, true) < 0) { - pr_error("Controller startup timeout\n"); + pr_error("controller startup timeout\n"); return -ETIME; } @@ -292,7 +292,7 @@ nvme_poll_submit_cmd(struct nvme_queue *q, struct nvme_cmd cmd) /* Check for timeout */ if (spins > 5) { - pr_error("Hang while polling phase bit, giving up\n"); + pr_error("hang while polling phase bit, giving up\n"); return -ETIME; } @@ -350,9 +350,9 @@ nvme_log_ctrl_id(struct nvme_id *id) sn[i] = id->sn[i]; } - pr_trace("Model number: %s\n", mn); - pr_trace("Serial number: %s\n", sn); - pr_trace("Firmware revision: %s\n", fr); + pr_trace("model number: %s\n", mn); + pr_trace("serial number: %s\n", sn); + pr_trace("firmware revision: %s\n", fr); } /* @@ -601,7 +601,7 @@ nvme_init_ctrl(struct nvme_bar *bar) } if (nvme_init_ns(&ctrl, nsids[i]) != 0) { - pr_error("Failed to initialize NSID %d\n", nsids[i]); + pr_error("failed to initialize NSID %d\n", nsids[i]); } } @@ -627,19 +627,19 @@ nvme_init(void) /* Try to request a general purpose timer */ if (req_timer(TIMER_GP, &tmr) != TMRR_SUCCESS) { - pr_error("Failed to fetch general purpose timer\n"); + pr_error("failed to fetch general purpose timer\n"); return -ENODEV; } /* Ensure it has get_time_usec() */ if (tmr.get_time_usec == NULL) { - pr_error("General purpose timer has no get_time_usec()\n"); + pr_error("general purpose timer has no get_time_usec()\n"); return -ENODEV; } /* We also need msleep() */ if (tmr.msleep == NULL) { - pr_error("General purpose timer has no msleep()\n"); + pr_error("general purpose timer has no msleep()\n"); return -ENODEV; } diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 585480f..8328ffc 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -265,11 +265,12 @@ pci_get_device(struct pci_lookup lookup, uint16_t lookup_type) int pci_init(void) { + size_t ndev; TAILQ_INIT(&device_list); - pr_trace("Scanning each bus...\n"); /* Recursively scan bus 0 */ pci_scan_bus(0); - + ndev = TAILQ_NELEM(&device_list); + pr_trace("detected %d devices at pci*\n", ndev); return 0; } diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 550d9b4..67a1e4e 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -58,7 +58,7 @@ static struct timer tmr; __attribute__((__interrupt__)) static void xhci_common_isr(void *sf) { - pr_trace("Received xHCI interrupt (via PCI MSI-X)\n"); + pr_trace("received xHCI interrupt (via PCI MSI-X)\n"); } /* @@ -145,7 +145,7 @@ xhci_parse_ecp(struct xhci_hc *hc) break; case XHCI_ECAP_USBLEGSUP: /* Begin xHC BIOS handoff to us */ - pr_trace("Establishing xHC ownership...\n"); + pr_trace("establishing xHC ownership...\n"); val |= XHCI_OS_SEM; mmio_write32(p, val); @@ -184,10 +184,10 @@ xhci_init_scratchpads(struct xhci_hc *hc) return 0; } - pr_trace("Using %d pages for xHC scratchpads\n"); + pr_trace("using %d pages for xHC scratchpads\n"); bufarr = dynalloc_memalign(sizeof(uintptr_t)*max_bufs, 0x1000); if (bufarr == NULL) { - pr_error("Failed to allocate scratchpad buffer array\n"); + pr_error("failed to allocate scratchpad buffer array\n"); return -1; } @@ -196,7 +196,7 @@ xhci_init_scratchpads(struct xhci_hc *hc) memset(PHYS_TO_VIRT(tmp), 0, 0x1000); if (tmp == 0) { /* TODO: Shutdown, free memory */ - pr_error("Failed to fill scratchpad buffer array\n"); + pr_error("failed to fill scratchpad buffer array\n"); return -1; } bufarr[i] = tmp; @@ -392,8 +392,8 @@ xhci_init_ports(struct xhci_hc *hc) devtype = (ISSET(portsc, XHCI_PORTSC_DR)) ? "removable" : "non-removable"; - pr_trace("Detected %s USB device on port %d\n", devtype, i); - pr_trace("Resetting port %d...\n", i); + pr_trace("detected %s USB device on port %d\n", devtype, i); + pr_trace("resetting port %d...\n", i); portsc |= XHCI_PORTSC_PR; mmio_write32(portsc_p, portsc); } @@ -432,7 +432,7 @@ xhci_init_hc(struct xhci_hc *hc) return -1; } - pr_trace("Resetting xHC chip...\n"); + pr_trace("resetting xHC chip...\n"); if ((error = xhci_reset(hc)) != 0) { return error; } @@ -492,13 +492,13 @@ xhci_init(void) /* Try to request a general purpose timer */ if (req_timer(TIMER_GP, &tmr) != TMRR_SUCCESS) { - pr_error("Failed to fetch general purpose timer\n"); + pr_error("failed to fetch general purpose timer\n"); return -ENODEV; } /* Ensure it has get_time_usec() */ if (tmr.get_time_usec == NULL) { - pr_error("General purpose timer has no get_time_usec()\n"); + pr_error("general purpose timer has no get_time_usec()\n"); return -ENODEV; } diff --git a/sys/fs/initramfs.c b/sys/fs/initramfs.c index 7b2f748..acef462 100644 --- a/sys/fs/initramfs.c +++ b/sys/fs/initramfs.c @@ -258,12 +258,12 @@ initramfs_init(struct fs_info *fip) initramfs = get_module("/boot/ramfs.cpio", &initramfs_size); if (initramfs == NULL) { - panic("Failed to open initramfs cpio image\n"); + panic("failed to open initramfs cpio image\n"); } status = vfs_alloc_vnode(&g_root_vnode, VDIR); if (__unlikely(status != 0)) { - panic("Failed to create root vnode for ramfs\n"); + panic("failed to create root vnode for ramfs\n"); } g_root_vnode->vops = &g_initramfs_vops; diff --git a/sys/include/arch/amd64/ioapic.h b/sys/include/arch/amd64/ioapic.h index beac473..c11a85c 100644 --- a/sys/include/arch/amd64/ioapic.h +++ b/sys/include/arch/amd64/ioapic.h @@ -31,8 +31,9 @@ #define _MACHINE_IOAPIC_H_ #include +#include -void ioapic_init(void *base); +void ioapic_init(struct ioapic *p); void ioapic_gsi_mask(uint8_t gsi); void ioapic_gsi_unmask(uint8_t gsi); diff --git a/sys/include/lib/assert.h b/sys/include/lib/assert.h index d35cf09..a34a14f 100644 --- a/sys/include/lib/assert.h +++ b/sys/include/lib/assert.h @@ -35,7 +35,7 @@ #define __assert(condition) \ if ((uintptr_t)(condition) == 0) { \ - panic("Assert \"%s\" failed (%s() at %s:%d)\n", #condition, \ + panic("assert \"%s\" failed (%s() at %s:%d)\n", #condition, \ __func__, __FILE__, __LINE__); \ } diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index fe41453..1fb3418 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -55,7 +55,7 @@ start_init(void) execve_args.argv = argv; execve_args.envp = envp; if (execve(td, &execve_args) != 0) - panic("Failed to load init\n"); + panic("failed to load init\n"); } int diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index f60ba93..75ab0e9 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -63,7 +63,7 @@ unload_td(struct proc *td) /* Attempt to unmap the range */ if (vm_unmap(pcbp->addrsp, range->vbase, len) != 0) { - pr_error("Failed to unmap %p - %p (pid=%d)\n", + pr_error("failed to unmap %p - %p (pid=%d)\n", range->start, range->end, td->pid); } diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 2b66ebf..16daae2 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -262,6 +262,6 @@ sched_init(void) TAILQ_INIT(&qlist[i].q); } - pr_trace("Prepared %d queues (policy=0x%x)\n", + pr_trace("prepared %d queues (policy=0x%x)\n", SCHED_NQUEUE, policy); } diff --git a/sys/vm/vm_init.c b/sys/vm/vm_init.c index 8f40e9d..2846a69 100644 --- a/sys/vm/vm_init.c +++ b/sys/vm/vm_init.c @@ -61,7 +61,7 @@ vm_init(void) vm_ctx.dynalloc_pool_sz = DYNALLOC_POOL_SZ; vm_ctx.dynalloc_pool_pa = vm_alloc_frame(DYNALLOC_POOL_PAGES); if (vm_ctx.dynalloc_pool_pa == 0) { - panic("Failed to allocate dynamic pool\n"); + panic("failed to allocate dynamic pool\n"); } pool = PHYS_TO_VIRT(vm_ctx.dynalloc_pool_pa); -- cgit v1.2.3