boot: driver chatter goes to the log; the console clears its margins

ACPI, DMI, SMP, xHCI, USB, I2C, NVMe, r8169 and ramdisk progress lines are
kinfo now: in dmesg and on a verbose boot, off the screen of a working
machine. Failures stay cprintf.

vt_repaint also paints the strip right of the last column and below the
last row, which kept the bottom of the X desktop after Ctrl+Alt+F-key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-25 01:53:46 +02:00
commit c65bfa3fa3
16 changed files with 57 additions and 42 deletions

View file

@ -1062,7 +1062,7 @@ attach_device(struct xhci *x, const struct usb_dev *proto, int parent,
// cprintf does not pad: "%04x" prints like "%x". It used to be worse -- an
// unknown directive consumed no argument and every one after it landed in
// the wrong place, which is what once turned this line into rubbish.
cprintf("usb: port %d%s slot %d %x:%x %s, %s speed, %d configuration%s\n",
kinfo("usb: port %d%s slot %d %x:%x %s, %s speed, %d configuration%s\n",
proto->port, proto->route ? " (via hub)" : "", slot,
desc->idVendor, desc->idProduct,
class_name(desc->bDeviceClass), speed_name(speed),
@ -1192,7 +1192,7 @@ xhci_detach(struct usb_dev *hub, int hub_port)
for(i = 1; i <= MAX_SLOTS; i++)
if(x->slot[i].used && x->slot[i].parent == hub->slot &&
x->slot[i].pport == hub_port){
cprintf("usb: slot %d unplugged from hub slot %d port %d\n",
kinfo("usb: slot %d unplugged from hub slot %d port %d\n",
i, hub->slot, hub_port);
free_slot(x, i);
}
@ -1492,7 +1492,7 @@ bios_handoff(struct xhci *x)
for(i = 0; i < 1000 && (rd32(x->cap, off) & LEGSUP_BIOS_OWNED); i++)
microdelay(1000);
if(rd32(x->cap, off) & LEGSUP_BIOS_OWNED){
cprintf("xhci: firmware would not hand over; taking it anyway\n");
kinfo("xhci: firmware would not hand over; taking it anyway\n");
wr32(x->cap, off,
(rd32(x->cap, off) & ~LEGSUP_BIOS_OWNED) | LEGSUP_OS_OWNED);
} else
@ -1583,7 +1583,7 @@ xhci_probe(struct pci_dev *d)
// dword and take the top half.
{
uint32 v = rd32(x->cap, 0) >> 16;
cprintf("xhci: version %d.%d%d, %d ports, %d slots, %d-byte contexts\n",
kinfo("xhci: version %d.%d%d, %d ports, %d slots, %d-byte contexts\n",
(v >> 8) & 0xFF, (v >> 4) & 0xF, v & 0xF,
x->maxports, x->maxslots, x->ctxsize);
}
@ -1670,7 +1670,7 @@ xhci_probe(struct pci_dev *d)
}
if(x->ndevices == 0)
cprintf("xhci: no devices attached\n");
kinfo("xhci: no devices attached\n");
// Now, and only now, turn interrupts on. The order is: claim the line
@ -1689,7 +1689,7 @@ xhci_probe(struct pci_dev *d)
// can sleep rather than spin -- but only if something will wake it. With
// no interrupt at all, transfers go on spinning as they did during probe.
if(pci_irq_attach(d, xhci_irq, x, "xhci", PCI_IRQF_MSIX) < 0){
cprintf("xhci: no interrupt; transfers will be polled\n");
kinfo("xhci: no interrupt; transfers will be polled\n");
} else {
x->can_sleep = 1;
x->running = 1;
@ -1754,13 +1754,13 @@ scan_ports(struct xhci *x)
if(!(sc & PORT_CCS)){
x->port_failed[port] = 0;
if(slot){
cprintf("usb: port %d: unplugged\n", port);
kinfo("usb: port %d: unplugged\n", port);
free_slot(x, slot);
}
continue;
}
if(slot && (chg & PORT_CSC)){
cprintf("usb: port %d: replugged\n", port);
kinfo("usb: port %d: replugged\n", port);
free_slot(x, slot);
slot = 0;
}
@ -1772,7 +1772,7 @@ scan_ports(struct xhci *x)
sleep_ticks(100 / MSEC_PER_TICK);
if(!(rd32(x->op, XHCI_PORTSC(port)) & PORT_CCS))
continue;
cprintf("usb: port %d: plugged in\n", port);
kinfo("usb: port %d: plugged in\n", port);
if(enumerate_port(x, port) < 0)
x->port_failed[port] = 1;
}

View file

@ -187,7 +187,7 @@ vga_disp_acquire(struct device *d, uint32 *stride_out)
return 0;
}
memset(back, 0, back_bytes);
cprintf("display: %d KB back buffer, double buffered\n",
kinfo("display: %d KB back buffer, double buffered\n",
(int)(back_bytes / 1024));
return back;
}

View file

@ -79,7 +79,7 @@ vga_pci_probe(struct pci_dev *d)
// displayed, which is the thing vga.c is writing into. The BAR is the
// card's whole aperture and the mode may sit at an offset within it. Say
// so rather than silently preferring one.
cprintf("vga: framebuffer disagreement -- VBE says %x, BAR says %x\n",
kinfo("vga: framebuffer disagreement -- VBE says %x, BAR says %x\n",
(uint32)vbe, (uint32)bar->base);
}

View file

@ -471,7 +471,7 @@ r8169_probe(struct pci_dev *d)
// MSI first: every 8111 has it, and on the boards these are soldered to it
// is the only interrupt that is sure to arrive. See pci_irq_attach().
if (pci_irq_attach(d, r8169_intr, r, "r8169", 0) < 0)
cprintf("r8169: no usable interrupt line; the link will be polled\n");
kinfo("r8169: no usable interrupt line; the link will be polled\n");
r->ready = 1;
@ -487,7 +487,7 @@ r8169_probe(struct pci_dev *d)
uint32 xid = (rd32(r, R_TCR) >> 20) & 0xFCF;
int bmsr = mii_read(r, 1);
cprintf("r8169: xid %x, %x:%x:%x:%x:%x:%x, irq %d (%s), %s (bmsr %x)\n",
kinfo("r8169: xid %x, %x:%x:%x:%x:%x:%x, irq %d (%s), %s (bmsr %x)\n",
xid,
r->mac[0], r->mac[1], r->mac[2], r->mac[3], r->mac[4], r->mac[5],
d->irq_line, pci_irq_kind(d),

View file

@ -330,13 +330,13 @@ add_namespace(struct nvme *c, uint32 nsid)
uint32 lbaf = *(uint32 *)(id + 128 + 4 * (id[26] & 0xF));
uint32 lbads = (lbaf >> 16) & 0xFF;
if (lbads < 9 || lbads > 12) {
cprintf("nvme%d: namespace %d has %d-byte sectors; not used\n",
kinfo("nvme%d: namespace %d has %d-byte sectors; not used\n",
c->index, nsid, 1 << lbads);
return;
}
if (lbaf & 0xFFFF) {
// Metadata interleaved with the data would land in our bounce buffer.
cprintf("nvme%d: namespace %d carries metadata; not used\n",
kinfo("nvme%d: namespace %d carries metadata; not used\n",
c->index, nsid);
return;
}
@ -357,7 +357,7 @@ add_namespace(struct nvme *c, uint32 nsid)
*p++ = '0' + nsid % 10;
*p = 0;
cprintf("nvme: %s: %d MB, %d-byte sectors\n", ns->name,
kinfo("nvme: %s: %d MB, %d-byte sectors\n", ns->name,
(int)((nsze << lbads) >> 20), ns->secsize);
blkdev_register(ns->name, &nvme_ops, ns, ns->nsectors, ns->secsize);
}

View file

@ -341,7 +341,7 @@ usb_attach(struct usb_dev *dev)
break;
}
cprintf("usb: interface %d: class %d.%d protocol %d, %d endpoint%s%s%s%s\n",
kinfo("usb: interface %d: class %d.%d protocol %d, %d endpoint%s%s%s%s\n",
d->iface.bInterfaceNumber,
d->iface.bInterfaceClass, d->iface.bInterfaceSubClass,
d->iface.bInterfaceProtocol, d->iface.bNumEndpoints,
@ -353,7 +353,7 @@ usb_attach(struct usb_dev *dev)
usb_bind_all(d);
if(d->driver == 0){
cprintf("usb: no driver for this interface\n");
kinfo("usb: no driver for this interface\n");
if(n > 0)
d->in_use = 0; // nothing will ever use it; give it back
}

View file

@ -732,7 +732,7 @@ hid_attach(const uchar *desc, int n, const char *what)
h->proto = !h->x.ok ? USB_HID_PROTO_KEYBOARD :
h->x.rel ? USB_HID_PROTO_MOUSE : USB_HID_PROTO_TABLET;
h->in_use = 1;
cprintf("%s: %s%s\n", what,
kinfo("%s: %s%s\n", what,
h->proto == USB_HID_PROTO_KEYBOARD ? "keyboard" :
h->proto == USB_HID_PROTO_MOUSE ? "pointer" : "absolute pointer",
h->rkbd && h->x.ok ? " and keyboard" : "");
@ -853,7 +853,7 @@ hid_probe(struct usb_dev *dev)
} else {
// A consumer-control interface (volume keys), a game pad, a UPS: HID,
// and not something this driver has a use for.
cprintf("usb-hid: interface %d is neither a keyboard nor a pointer\n",
kinfo("usb-hid: interface %d is neither a keyboard nor a pointer\n",
dev->iface.bInterfaceNumber);
return -1;
}
@ -878,7 +878,7 @@ hid_probe(struct usb_dev *dev)
return -1;
}
cprintf("usb-hid: %s%s on slot %d, endpoint 0x%x every %d ms\n",
kinfo("usb-hid: %s%s on slot %d, endpoint 0x%x every %d ms\n",
h->proto == USB_HID_PROTO_KEYBOARD ? "keyboard" :
h->proto == USB_HID_PROTO_MOUSE ? "mouse" : "absolute pointer",
h->proto == USB_HID_PROTO_KEYBOARD ?
@ -906,7 +906,7 @@ hid_disconnect(struct usb_dev *dev)
krep.c = 0;
release(&kqlock);
}
cprintf("usb-hid: %s on slot %d unplugged\n",
kinfo("usb-hid: %s on slot %d unplugged\n",
h->proto == USB_HID_PROTO_KEYBOARD ? "keyboard" : "pointer",
dev->slot);
h->in_use = 0;

View file

@ -194,7 +194,7 @@ hub_probe(struct usb_dev *dev)
}
mtt = (hd->wHubCharacteristics & HUB_CHAR_TT_MASK) != 0;
cprintf("usb-hub: %d ports on slot %d\n", nports, dev->slot);
kinfo("usb-hub: %d ports on slot %d\n", nports, dev->slot);
// Tell the controller *before* powering anything on. Addressing a device
// behind a slot the controller does not know is a hub fails, and it fails
@ -291,7 +291,7 @@ usb_hub_poll(void)
h->dev->ops->detach(h->dev, port);
if(st & PORTSTAT_CONNECTION){
microdelay(100000); // debounce, as on a root port
cprintf("usb-hub: slot %d port %d: plugged in\n", h->dev->slot, port);
kinfo("usb-hub: slot %d port %d: plugged in\n", h->dev->slot, port);
hub_port(h->dev, port, h->scratch);
}
// The hub may have been unplugged by what was just done; stop if so.

View file

@ -349,12 +349,12 @@ usb_storage_dump(void)
return;
}
cprintf("usb-storage: %d sectors of %d bytes\n", u->nsectors,
kinfo("usb-storage: %d sectors of %d bytes\n", u->nsectors,
u->sector_size);
b = bread(USBDISK_DEV, 1);
sb = (struct superblock*)b->data;
cprintf("usb-storage: block 1 magic %x size %d nblocks %d ninodes %d\n",
kinfo("usb-storage: block 1 magic %x size %d nblocks %d ninodes %d\n",
sb->magic, sb->size, sb->nblocks, sb->ninodes);
brelse(b);
}
@ -480,7 +480,7 @@ storage_probe(struct usb_dev *dev)
}
u->present = 1;
cprintf("usb-storage: %s: %s %s, %d sectors (%d MB)\n", u->name,
kinfo("usb-storage: %s: %s %s, %d sectors (%d MB)\n", u->name,
vendor, product, u->nsectors,
(int)((uint64)u->nsectors * SECTOR_SIZE / (1024 * 1024)));
u->blkdev = blkdev_register(u->name, &ums_blk_ops, u, u->nsectors,
@ -517,7 +517,7 @@ storage_disconnect(struct usb_dev *dev)
u->gone = 1;
releasesleep(&u->lock);
cprintf("usb-storage: %s unplugged\n", u->name);
kinfo("usb-storage: %s unplugged\n", u->name);
if(u->blkdev >= 0)
blkdev_unregister(u->blkdev);
// USBDISK_DEV may have been this stick; nothing it cached is true now.