Drivers & buses
Polled hardware, one vtable per bus.
Most NebOS drivers are polled rather than interrupt-driven: storage, USB and every NIC are serviced from process context. That trades latency and CPU time for simple, single-owner state and a kernel that stays easy to reason about on old hardware.
Driver inventory
Every driver in the tree is small enough to read in one sitting. The table below is the quickest way to find the one responsible for a device.
| Subsystem | Driver | Bus / access | Service model |
|---|---|---|---|
| Floppy | disk.c | ISA FDC + DMA channel 2 | IRQ 6; FAT operations set sys_fs_busy |
| PATA | ata.c | Legacy ports or PCI native BARs | Polled PIO, DRQ wait per sector |
| SATA | ahci.c | PCI AHCI MMIO | Polled, READ/WRITE DMA EXT |
| eMMC | sdhci.c | Intel Braswell SDHCI, PCI 00:10.0 (8086:2294) | Polled PIO, 1-bit/25 MHz; no DMA/IRQ |
| USB | usb.c + uhci.c ohci.c ehci.c xhci.c | PCI I/O ports or MMIO | Polled; hotplug watcher in the WM loop |
| Network | e1000e.c r8168.c ne2000.c asix.c rndis.c | PCI or USB | Polled, one active receiver; r8168 covers the RTL8111E/8168 family (970A-DS3P) as well as the AT3IONT-I's RTL8112L. |
| WiFi | iwl_trans.c iwl_mvm.c iwl_dvm.c wifi.c | PCIe, Intel 7265D/3165 (8086:095a/095b/3165/3166) and 6200/6300 (8086:4239/422c, 4238/422b) | Polled RX ring; firmware from /ramfs/firmware, loaded on first use |
| USB WiFi | rtl8821au.c wifi.c | USB 2.0 high speed, Realtek RTL8821AU/8811AU (TP-Link Archer T2U Nano 2357:011f and the other Linux rtw88_8821au IDs) | Vendor control requests for registers, one bulk-IN/one bulk-OUT endpoint; firmware + register tables from /ramfs/firmware |
| Panel backlight | backlight.c | Intel Braswell/Cherryview graphics MMIO, PCI 00:02.0 (8086:22b0/22b1) | Polled register writes; F6/F7 and E0 14/E0 15 step 10%; SYS_BACKLIGHT drives the control-panel slider |
| PS/2 | mouse.c, io.c | i8042 | IRQ 1 keyboard, IRQ 12 mouse; polling fallback |
| Touchpad | i2c.c, touchpad.c, touchpad_gesture.c | LPSS DesignWare I2C, slave 0x15 | Polled input register every 25 ms; software tap and two-finger scroll gestures; no GPIO interrupt driver |
| Serial | serial.c | 16550 UART, COM1 | IRQ 4 ring buffer + polled transmitter |
| Thermal | thermal.c | Intel DTS MSR | Sampled once a second from the scheduler tick |
| Board sensors / EC | it87.c, tpec.c, ec.c, cros_ec.c | Super I/O, ThinkPad H8 EC, Chrome OS EC (temps, fans, battery, AC, switches) | Polled; EC battery-index/FIFO/page-selector writes only |
| Wall clock | rtc.c | CMOS RTC ports 0x70/0x71 | Read/write under the BKL; update-cycle retries and a 1970–2069 two-digit year window |
PCI & discovery
pci.c walks bus/device/function and exposes BAR and capability access. The USB scan checks all functions: real PIIX3/PIIX4/VIA layouts put the USB function at 0:07.2 or 0:01.2, not 0:07.0. Controllers with unassigned BARs are ignored rather than driven at address zero.
MMIO regions are mapped through ioremap(), which returns
a kernel address in the shared window at 0xC0000000
(see Memory → Paging); drivers keep
the physical BAR only for logging. PCI
interrupts are disabled before touching MMIO, so every driver polls
its own status registers. lspci lists every function;
with a filter it prints BAR type, size and address details.
Storage
blkdev.c is a small registry of block
devices. Each device exposes sector read/write plus geometry; FAT,
the format command and the installer sit above that interface and
never talk to a controller directly. Devices are named
floppy0, ide0, sata0,
mmc0, usb0 and so on; partitions append
p1, p2.
struct blk_dev. The floppy still needs IRQ 6, but ATA,
AHCI, SDHCI and USB MSC are polled; a FAT operation takes a
non-preemptible section and format_busy keeps a
destructive format/install exclusive. The installer clones the
MBR and every used sector of the source image.
Floppy
disk.c drives the 8272-compatible FDC
through ISA DMA channel 2, with the single-sector DMA buffer at
0x4000. Retries handle the usual real-hardware flakiness.
The second floppy slot can hold root.img.
PATA
ata.c uses the legacy command block or the PCI IDE interface's native BARs. Multi-sector PIO waits for DRQ before every sector because drives drop it between sectors; it polls the command-block status rather than the alternate-status BAR, and falls back to single-sector commands when a bridge leaves DRQ pending.
SATA/AHCI
ahci.c drives the first AHCI controller
only, with no IRQs and no NCQ. It does COMRESET, IDENTIFY through the
shared ata_identify_parse(), and READ/WRITE DMA EXT
through a page-allocated bounce buffer. A disk added after boot needs
a rescan; there is no COMRESET hotplug.
eMMC/SDHCI
sdhci.c drives the Intel Braswell MMC
function at PCI 00:10.0 (8086:2294, class
0805), the HP Chromebook's eMMC. It resets the SDHCI
host, selects the 1.8 V rail and Host Control 2's 1.8 V signalling,
runs a 400 kHz initialization clock, then CMD0/1/2/3/7/16 and CMD8
to read EXT_CSD (SEC_COUNT at 212,
CACHE_SIZE at 249), and switches to a 25 MHz data clock.
Sector I/O is CMD17/CMD24 through the polled PIO buffer port at
1-bit/25 MHz; there is no DMA, IRQ, bus-width/high-speed switch or
hotplug. The read/write loops yield every 32 sectors so a long
format does not starve the window manager. The eMMC appears as
mmc0, and format mmc0 writes an MBR + FAT
partition exactly like an IDE/SATA disk. The write path flushes the
card cache with CMD6 FLUSH_CACHE when EXT_CSD reports
one.
USB stack
usb.c is controller-agnostic. It handles
enumeration, descriptor parsing, hub recursion, bus scans, per-controller
addresses, the hotplug watcher and interrupt-IN consumers. Each host
controller implements the usb_hcd_ops vtable in
usb_hcd.h.
| Controller | Transport | Instances | Implementation notes |
|---|---|---|---|
| UHCI | PCI I/O ports | 1 | Frame list at 0x3000; control QH plus one QH per interrupt slot. |
| OHCI | PCI MMIO | up to 4 | HCCA from the page allocator, static ED/TD sets in the uncacheable ohci_dma_page, TDs start at CC = NotAccessed. Before reset it requests SMM ownership (HcCommandStatus.OCR, clear HcControl.IR) and disables the AMD southbridge USB SMI on 1002:4385. |
| EHCI | PCI MMIO | up to 4 | Async QH/qTD schedule, page-allocated descriptors, polling only, no periodic list. The async-advance doorbell (IAAD) is rung after an idle gap and before cancelling a stuck transfer; the MCP79 can otherwise keep a halted QH's old qTD cached and never fetch a USB disk's first read after enumeration. |
| xHCI | PCI MMIO | — | USB2 and USB3 root ports; direct SuperSpeed devices use a 512-byte EP0 and the port speed in the slot context (USB3 hubs are not decoded). Halts and waits for HCH around HCRST; EP0 max packet is the speed's fixed value (8/64/512), and a full-speed EP0 is corrected with Evaluate Context after the first descriptor read (the VIA VL805 on the 970A-DS3P babbled on a high-speed stick otherwise); a SuperSpeed port is not PED-disabled before its reset; failed control transfers are always logged with their completion code; EP0 stages are encoded as one TD per stage (EDK2 style) because chained control TDs stall on Braswell. |
AMD SB600/SB700/SB800/SB950 firmware can leave the OHCI controllers
owned by the SMM and keep the southbridge USB SMI enabled. The
driver requests ownership and clears the SMI enable before scanning
(ohci.c), so USB2 ports on the 970A-DS3P's SB950 work
after the firmware handoff. The SB950's legacy OHCI DMA does not
snoop dirty CPU cache lines, so the EDs, TDs, setup packet and
interrupt buffers live in one page that paging_init
maps uncacheable (PDE 0 is split before paging is enabled). Without
it the controller occasionally read an empty ED, skipped the
transfer and never re-armed the interrupt endpoint; the cursor
froze with no error. Control transfers still flush their
write-back data buffers around the transfer.
Enumeration starts every device on the USB default 8-byte EP0 and
adopts the descriptor's real bMaxPacketSize0
afterwards. A failed port attempt is retried three times with a
fresh port reset and a 20 ms settle, and OHCI gets a second boot
pass 60 ms after the EHCI-first walk so a companion handback
cannot leave a low-speed device unseen. HID detach is debounced
(three consecutive disconnected reads, 50 TD errors) and a detach
forces a clean full rescan, because a false port-loss leaves no
connect-change bit to wake the per-port path.
Hubs are class-9 devices: usb.c sets their configuration,
powers every downstream port (honouring bPwrOn2PwrGood),
resets and waits for PORT_ENABLE, then enumerates
recursively. This is what makes the X201's internal PCH hubs work.
Hotplug watches root ports; a device behind a hub is only found when a
full scan runs (lsusb also bumps the USB generation so
usbhid re-attaches). A scan and every mass-storage
command claim the controllers for the calling process
(usb_bus_claim()/usb_bus_release(), nesting).
Every HCD delay and the ASIX/RNDIS/usbmsc probe delays go through
usb_delay_ms(), and every HCD completion and port-reset
poll loop calls usb_poll_relax(t0) outside its spinlock.
When the claim belongs to a sleepable scan (lsusb, the
kworker's HID rescan/hotplug, or the storage rescan
reading a USB disk), the delay sleeps and the poll yields once a wait
passes 2 ms, both dropping the BKL, so port resets, NAKing
devices and settle times no longer freeze the WM; everywhere else
they busy-wait as before. The poll yields instead of sleeping
because a 1 ms sleep on an idle CPU wakes on the 100 Hz idle
tick. While another context owns the bus, the
usb.c wrappers refuse controller access
(usb_scan_foreign(): control and bulk transfers fail,
interrupt polls return no data, ports read as connected),
usb_hotplug_poll skips its pass and
usbhid_poll skips its tick. A USB NIC, the RTL8821AU or
a USB disk therefore sees a transient error during a bus scan; the
scan re-enumerates those devices anyway.
Mass storage
usbmsc.c is a device-level probe alongside
the ASIX Ethernet driver. It claims an interface with class 8,
subclass 6 and protocol 0x50, parses its bulk IN/OUT endpoints and
identifies the disk with SCSI INQUIRY + READ CAPACITY. Commands use
Bulk-Only Transport with LUN 0 and 512-byte blocks: READ(10),
WRITE(10), SYNCHRONIZE CACHE and a BOT reset/endpoint-halt recovery.
Short bulk-IN chunks are accumulated within a BOT data stage; a
READ(10) that completed with a non-zero CSW status gets REQUEST
SENSE, retries and a 1-sector fallback, while a transport timeout
goes straight to the reset. A timed-out bulk-IN transfer is
cancelled through the HCD's bulk_reset (EHCI disarms
the qTD and clears the data toggle; xHCI stops the endpoint before
dropping its ring), and the BOT reset clears both host-side toggles
after the CLEAR_FEATURE requests to match the device's DATA0 state
— QEMU tolerates the mismatch, real EHCI hardware does not. After
the first failed attempt the driver re-applies SET_CONFIGURATION
once, resetting the device's endpoints and toggles without a port
reset. The boot background scan sets usbmsc_set_probe_only:
one 5 s first read without the reset/retry chain, so a stuck device
cannot hold the boot's disk scan; a storage rescan uses
the full path. Present devices are registered as usb0..
(BLK_USB) by blk_scan(), so
storage, the VFS, format and
install can use them.
Bulk transfers exist on EHCI and xHCI only; a mass-storage device on
a UHCI/OHCI companion is left unclaimed. The xHCI driver drives
direct USB3 root-port devices (USB3 hubs are not decoded), so a
SuperSpeed stick on the Chromebook works. This is what makes the
installer's usb0 source possible: it reads the whole
live image into RAM first and then writes the target, so slow eMMC
writes cannot leave the USB source idle between chunks.
USB tethering
rndis.c is another device-level probe. It
scans every configuration for an RNDIS control function
(02/02/FF, E0/01/03 or an EF
variant) and a data interface with bulk endpoints, selects that
configuration, then sends RNDIS INIT/QUERY/packet-filter messages
over the control interface. Ethernet frames travel in 44-byte RNDIS
packet headers on the bulk pair, so the existing IPv4 stack sees a
normal netdev named rndis. This is Android USB
tethering, not WiFi; QEMU's full-speed usb-net device is
the test target (make run-rndis). CDC-ECM/NCM and the
RNDIS interrupt notification endpoint are not implemented.
WiFi (Intel 7265D/3165, 6200/6300, RTL8821AU)
Two Intel generations share one PCIe transport. The HP Chromebook's
Wireless-AC 7265 rev D or 3165 runs the newer MVM firmware
(iwl_mvm.c); the ThinkPad X201's Centrino
Advanced-N 6200 (or Ultimate-N 6300) runs the older DVM
firmware (iwl_dvm.c).
A Realtek RTL8821AU USB stick is the third backend
(rtl8821au.c, below).
wifi_fw.c picks the backend when the radio
comes up — a plugged-in stick wins over the built-in card, otherwise
the PCI probe decides — so wifi.c and the
wifi command are the same for all three. Everything is
polled; every ring and buffer is page-allocated so nothing big lands
in the kernel BSS.
- Transport. iwl_trans.c follows Linux iwlwifi for the 7000 family: APM init, one legacy RX queue of 256 × 4 KB RBDs, gen1 128-byte TFDs, byte-count tables in dwords, and the FH service channel loading firmware sections through a 128 KB bounce buffer. The NIC is kept awake (MAC access request held) and interrupts stay masked; PCI INTx is disabled. Host commands use the wide 8-byte header (legacy commands go out as group 1).
- Firmware.
iwlwifi-7265D-29.ucodeships in the command pack asfirmware/iwlwifi-7265D-29.ucode(1,036,312 bytes). It is a single-CPU image with LMAC scan, DQA queues and the old station API. iwl_mvm.c runs the INIT image (NVM read for the MAC address, calibration, PHY-DB collection), then the runtime image (PHY-DB replay, DQA, aux station, PHY context, CAM power, MCCZZ, station MAC context). - Queues. Command queue 0 (FIFO 7), aux queue 1 (scan probes), BSS queue 4 for the AP station (management and data, BE FIFO).
- Station. wifi.c builds open-system authentication and the association request itself, without WMM or HT IEs, so data frames are plain non-QoS 802.11 + LLC/SNAP. Management frames go at 1 Mb/s CCK (6 Mb/s on 5 GHz), data at a fixed 12 Mb/s OFDM (no rate scaling table yet).
- Security. WPA2-PSK with CCMP only. The 4-way and group handshakes run in ring 3 (wpa.c); the kernel queues EAPOL frames and installs the TK/GTK with
ADD_STA_KEY. TX uses the firmware's CCMP engine with the key embedded inTX_CMD; the host builds the 8-byte CCMP header and its packet number. On the tested 7265D-29 the firmware does not use the installed keys for RX and reportsSEC_ENC_ERR, so RX CCMP is decrypted in software by ccmp.c (AES-CCM, RFC 3610) with the same TK/GTK. There is no software replay window yet. - Bring-up on first use. The boot probe only finds the PCI function. The firmware is loaded by the first
wificommand, so boot time and RAM do not change when WiFi is unused. The netdev reportslink_up() = 0until it is connected, so the boot DHCP is skipped. - kexec.
netdev_shutdown()always stops the card throughwifi_shutdown(), even when it is not the active netdev, because its RX ring would keep writing into pages the next kernel reuses.
6200/6300: the DVM firmware
The transport differences live in one per-family descriptor
(fam_7000/fam_6000 in
iwl_trans.c):
| Parameter | 7265D/3165 (MVM) | 6200/6300 (DVM) |
|---|---|---|
| Firmware | iwlwifi-7265D-29.ucode (TLV) | iwlwifi-6000-4.ucode (v2 header: inst/data sections at 0x0/0x800000) |
| Scheduler queues | 31 | 20 |
| Command queue / FIFO | 0 / 7 | 4 / 7 |
| Data queues | aux 1, BSS 4 (configured by firmware, SCD_QUEUE_CFG) | VO 0 (management), VI 1, BE 2 (data), BK 3 (configured by the transport) |
| Command header | 8-byte wide (group 1) | 4-byte |
| Byte-count table | dwords | bytes |
| MAC address | NVM via NVM_ACCESS_CMD | OTP read by the host through CSR_EEPROM_REG |
- Bring-up. The host reads the 2 KB OTP (MAC at word 0x15, radio config at 0x48, crystal calibration through the calibration link), writes the radio SKU bits during NIC init, then runs the INIT image:
CALIBRATION_CFG_CMDand everyCALIBRATION_RES_NOTIFICATIONstored by op code untilCALIBRATION_COMPLETE. The runtime image gets the stored results back asREPLY_PHY_CALIBRATION_CMD, DC calibration, TX antennas, an RXON, TX power and a CAM power table. - RXON. DVM has no MAC/PHY contexts: one
REPLY_RXONcarries channel, BSSID, filters and association. A full RXON first clears the association, which wipes the firmware's station table, so the broadcast station (15) and the AP station (0) are re-added with their fixed-rateLINK_QUALITYtables, and a new TX power command follows every retune. - Scan. One
REPLY_SCAN_CMDper band: 2.4 GHz, then 5 GHz afterSCAN_COMPLETE_NOTIFICATION. Only channels the EEPROM regulatory tables mark valid are scanned, and probes are only sent where they are marked active and not radar. A firmware assert makes the next scan or connect reload the firmware instead of failing until reboot. - Keys.
REPLY_ADD_STAin modify mode on the AP station (pairwise offset 0, group offset 1). RX frames are the sameRX_PHY+RX_MPDUpair as on the 7265D, so the software CCMP fallback in wifi.c covers both cards. The 6200 transmits on antenna B (itsANT_BCconfiguration).
RTL8821AU USB stick
rtl8821au.c ports the Linux
rtw88 8821A/USB bring-up (rtw88xxa_power_on()
and the helpers it calls) and implements the same entry points as
the Intel layers. Registers are USB vendor requests
(bRequest 5, wValue = address, 1/2/4 bytes);
the 8051 firmware is written in 196-byte requests to
0x1000 page by page. The USB probe only matches the
VID/PID, parses the bulk endpoints and sets the configuration; the
chip is powered on by the first wifi command, which
takes a few seconds of control transfers.
| Step | What | Linux source |
|---|---|---|
| eFuse | Card-enable power sequence, 512-byte physical map → logical map; MAC at 0x107, crystal cap, BB swing, RFE (external LNA/PA) flags, TX power bases | rtw_parse_efuse_map, rtw88xxa_read_efuse |
| MAC | Power sequence, LLT (256 pages, boundary 248), firmware download + FW_READY, MAC table, page reservation, queue map, EDCA/beacon/USB burst setup | rtw88xxa_power_on, __rtw_download_firmware_legacy |
| PHY | BB + AGC tables, crystal cap, RF-A table, 2.4 GHz band switch; the tables' if/elif/else branches use the 8821A cut/RFE rules | rtw_parse_tbl_phy_cond, rtw88xxa_switch_band |
| Channel | Band switch (RFE pin mux, CCK on/off, basic rates), RF 0x18 channel/band, 20 MHz bandwidth, TX AGC from the eFuse base index | rtw88xxa_set_channel |
- Tables outside the kernel. The MAC/BB/AGC/RF-A register tables and the power sequences (~11 KB) are taken unchanged from Linux into
third_party/rtw88/rtw8821a_table.inc(BSD-3-Clause). The host tool mkrtwtbl.c turns them intofirmware/rtl8821a.tbl(layout in rtl8821a_tbl.h), which ships in the full pack next tofirmware/rtw8821a_fw.bin(31,898 bytes from linux-firmware). Only the driver code is in the kernel image (~12 KB). - One TX endpoint. The xHCI driver keeps a single bulk-OUT ring and reconfigures it when the endpoint changes, so every TX queue (management and data) is mapped to one DMA queue — LOW with 3–4 bulk-OUT endpoints, NORMAL with 2 — and therefore one endpoint. A TX transfer that would be an exact multiple of 512 bytes is shifted by 8 bytes (
PKT_OFFSET1) instead of needing a zero-length packet. - RX. RX aggregation is off, so a bulk-IN transfer (8 KB buffer) normally holds one packet; the parser still walks several. RSSI comes from the PHY status (CCK LNA/VGA table, OFDM gain − 110 dBm).
rtl8821au_poll()drains up to 64 transfers per call. - Scan. A software channel hop driven by the poll: 2.4 GHz 1–13 and 5 GHz 36–48 active (wildcard probe request, 70 ms), 52–64/100–140/149–165 passive (120 ms).
- Crypto in software. The chip's security engine is not used: wifi.c decrypts CCMP RX with ccmp.c, and the driver encrypts CCMP TX with
ccmp_tx_encrypt()(802.11 and RFC 3610 vectors inmake test-ccmp). TX uses fixed rates with fallback disabled: 1 Mb/s (2.4 GHz) / 6 Mb/s (5 GHz) management, 12 Mb/s data, hardware sequence numbers. - Delays.
SYS_WIFIruns with interrupts off, so the millisecond tick does not advance inside a call: all bring-up delays are busy waits; only the scan dwell uses the tick (between polls). - Unplug. Repeated USB errors, a disconnected root port or a re-enumeration mark the device dead; wifi.c drops to DOWN and the next
wificommand brings it up again.
Input
usbhid.c gives every HID class-3 interface with an interrupt-IN endpoint one of the six USB interrupt slots. Boot interfaces (subclass 1, protocol 1/2) are used as-is; other class-3 interfaces are classified by reading their HID report descriptor. Composite receivers and several devices can coexist; mouse reports from all slots are merged.
- Mouse. Three-byte boot reports: buttons in
b0 & 7, signeddx/dy. HID's +y is flipped to the PS/2 convention. - Keyboard. Eight-byte boot reports (modifier + six keycodes). Reports are diffed and decoded through a HID-usage → scancode-set-1 table, then injected with
io_inject_scancode(). - Repeat. A boot keyboard only reports changes, so
io.cadds software typematic repeat (500 ms delay, 33 ms rate). - PS/2. The i8042 path shares the cursor and keyboard code; the BIOS legacy USB emulation is disabled because the kernel owns the devices.
mouseinfo shows the active backend and whether a USB
keyboard is attached. Headless regression tests inject mouse motion
and keys through QMP and verify the result with screen dumps.
I2C touchpad
The HP Chromebook 11 G5 EE has no PS/2 port: its Elan touchpad is a
HID-over-I2C device on LPSS I2C6. The LPSS I2C functions are hidden
from PCI in ACPI mode, so touchpad.c scans
the two firmware BAR windows for a DesignWare component (only on an
Airmont CPU, family 6 model 0x4C: elsewhere the scan
would reset-cycle 32 fixed MMIO windows for ~64 ms of boot) and
i2c.c drives that controller in fast mode,
polled and without interrupts.
- Probe. Slave address
0x15: reset (0x0100), consume the 2-byte acknowledgement, read the HID descriptor, select absolute mode (0x0300 = 1) and wake the device (0x0800). Resetting last leaves it silent until the next power cycle. - Reports. The Elan vendor report
0x5Dcarries a finger bitmask and five packed bytes per active finger (X/Y high bits, X low, Y low, size, pressure). The decoder feeds the device-independent touchpad_gesture.c engine; a future PS/2 or USB touchpad backend only has to produce the same two-contact frame. The native max-X/Y commands (0x0106/0x0107) give the corner zone a physical coordinate frame. - Tap gestures. A short stationary contact is
turned into a synthetic button press: two fingers is a right click,
one finger starting in the bottom-right zone (right 25% x bottom
25% of the pad) is a right click, and one finger elsewhere is a
left click. The press is held for 120 ms so applications polling
SYS_WIN_POINTERsample it. Taps shorter than two 25 ms samples, longer than 300 ms, moved more than 60 coordinate units, or accompanied by a physical clickpad press are ignored. - Physical clickpad. The single clickpad button is latched at its leading edge: a press whose finger starts in the bottom-right zone reports the right button, anywhere else reports the left button, and the choice holds until the button is released (so a corner drag stays a right drag).
- Two-finger scroll. With exactly two contacts,
the pointer freezes and the centroid movement accumulates. After
about 30 device units it becomes a scroll and emits movement / 2
in pixels; natural direction (two fingers up = later content) is
the default, and the two-finger right tap is suppressed once the
gesture has scrolled. The pointer re-anchors when one finger
remains. The
scroll on|off|natural|traditionaloption tunes it. - Polling. The report GPIO has no driver yet, so the input register is read every 25 ms. Back-to-back reads stall the device, which is why the poll is throttled rather than run flat out.
- Discovery and tuning.
touchpadprints the probe result, max coordinates, last report and synthesized click counters, and takesrightclick off|tap|corner|both,tapclick on|offorscroll on|off|natural|traditional;mouseinfolists the Elan vendor/product ID next to the PS/2 and USB backends.
Serial
serial.c drives the 16550 at COM1, 115200
8N1, with an IRQ-driven receive ring buffer. It is used for the boot
trace, the netlog mirror source, the dbg monitor and the
KXE2 kexec receiver.
The transmitter is polled, so a machine without a serial port still
boots normally. serial_puthex and
serial_putdec are the structured dump helpers used by
drivers.
Sensors, power & thermals
- DTS / AMD Tctl. thermal.c reads
IA32_THERM_STATUSon an allowlist of Core/Core 2, Nehalem/Westmere, Bonnell and Airmont/Braswell models. TjMax comes fromIA32_TEMPERATURE_TARGETon Nehalem/Westmere; Airmont uses coretemp's 90 °C table (the kernel does not read the MSR before the IDT exists), and Bonnell uses the table. AMD family 15h models below0x60(Bulldozer/Piledriver) readD18F3xA4at PCI0:18.3; the package value is sampled from the kworker under the BKL and copied to every CPU. - IT87xx. it87.c reads the Super I/O temperatures and fan tachometers on the ASUS AT3IONT-I and the Gigabyte 970A-DS3P (IT8728F). Nothing is written to fan control.
- ThinkPad EC. tpec.c is gated on an SMBIOS Lenovo/IBM match and reads temperatures and fan mode through the shared ACPI EC protocol in ec.c (ports
0x62/0x66, command0x80read /0x81write, OBF/IBF waits, stale-byte drain, bounded polls). Battery/AC state comes from0x38/0x39(present, charging, discharging),0x46bit 4 (AC online), and the page-selected 16-byte window at0xA0..0xAF;0x81selects the battery and page (0 dynamic, 1 mode, 2 design, 5 manufacturer, 6 model). That page selector is the only EC write, and it is restored when it changed. - Chrome EC. cros_ec.c probes the Chrome OS EC, gated on the ACPI memory version, the
'E','C'memmap id and the device feature bits; it skips the probe when the ThinkPad EC is present. Its ACPI window0x20..0xFFmirrors memmap0x00..0xDF: temperature sensors0x00..0x0f/0x18..0x1f(raw − 73 °C), fans0x10..0x17(0xffffabsent), switches0x30(lid/power button), and the battery block0x40..0x7f(AC/present/charging flags at0x4c, voltage/rate/remaining/design/last-full/cycle count, and the 8-byte strings).EC_ACPI_MEM_BATTERY_INDEX0x12selects the battery and waits forBATT_INDEX0x4e;EC_ACPI_MEM_STRINGS_FIFO0x16returns longer strings when supported. The Cyan full-charge workaround is applied, and the units are mAh/mA. power_src.c picks the ThinkPad backend first, then the Chrome EC;SYS_CROS_EC_SENSORS(107) exposes the EC temperature/fan/switch snapshot. - MTRRs. mtrr.c manages write-combining ranges for the framebuffer and reports the effective mapping.
sensors prints supported CPU temperatures (and the
Intel 90/100/125 °C delta scales when there is no published TjMax),
board sensors and both EC types; powerinfo prints the
source (thinkpad or chrome ec), the AC
adapter, battery model/manufacturer/serial, capacities, voltage,
rate and cycle count through SYS_POWER_INFO;
power prints ratios, effective MHz and C-state hints.
The WM top bar shows the CPU temperature and, on both ThinkPads
and Chromebooks, a status icon at the far right for the first
present battery: a plug while the AC adapter is online and a
level-filled battery on battery. Machines without an EC show
neither.
Wall clock (RTC)
rtc.c talks to the MC146818-compatible
CMOS clock through ports 0x70/0x71. Reads honour the
register-B BCD/binary and 12/24-hour modes, retry when the
update-in-progress bit is set, and decode the hour's PM flag. The
RTC only stores a two-digit year, so the kernel expands it over a
1970–2069 window (70–99 → 1900s, 00–69 → 2000s); a board whose
dead battery left 1980 or 1990 therefore reads correctly instead of
being pushed a century forward. Writes validate the calendar (leap
years included), raise the register-B SET bit, preserve the mode
bits and write the computed weekday. On ACPI machines the FADT
century register (offset 108, normally CMOS 0x32) is
written as well, so the firmware and other operating systems see
the intended century; boards without ACPI get no arbitrary NVRAM
write.
SYS_RTC_GET/SYS_RTC_SET (104/105) expose
the full struct sys_datetime; the older
SYS_RTC_HMS/SYS_RTC_DATETIME calls remain
the small read-only views. The WM’s top-bar date/time opens the
control panel, whose Date & Time tile reveals an inline
editor; its Sync NTP button fetches UTC through
SYS_NTP_SYNC (106), backed
by the SNTP client in ntp.c, and writes
it with SYS_RTC_SET. The date command
prints the same clock in the classic Linux format.
Panic screen
On a ring-0 fault, panic.c draws straight into the framebuffer — bypassing the shadow buffer and the WM — and mirrors the same data to COM1 before halting. The banner includes the vector and error code, GPRs, control registers, current pid/name, uptime, instruction bytes and stack return-address candidates in the kernel image.
Faults from ring 3 do not halt: the process is killed with a short
message in its terminal and serial log. There is no interactive
debugger on screen; the dbg kernel command drives a
serial monitor instead.
Limits
- Polling. USB, storage and network drivers consume CPU time while waiting; there is no IRQ-driven data path outside PS/2, serial and the PIT.
- EHCI. High-speed root ports only; no split transactions for low/full-speed devices behind a high-speed hub.
- xHCI. USB2 and USB3 root ports; direct SuperSpeed devices work, but USB3 hub port-status decoding is not implemented.
- HID. Report IDs are not handled, absolute pointers/tablets are ignored, and there is no wheel support.
- AHCI. First controller only, no hotplug after boot, disks above 2 TB are clamped to 32-bit LBA.
- eMMC. Polled 1-bit/25 MHz PIO; no DMA, IRQ, CMD6 bus-width/high-speed/DDR switch or hotplug. Only the eMMC function is driven; the SDIO/SD functions and SD card reader are not.
- Storage serialization. A FAT/floppy operation sets
sys_fs_busyand stalls process switching for its duration; the PIT keeps ticking. - EC. The Chrome EC path uses the ACPI v2 memmap only: no MEC host-command interface, EC SCI events, charger current/voltage, charging limit or EC firmware version. The ThinkPad H8 path is limited to its page-selected battery window and has no SCI handler. Battery/AC is polled by the WM once a second.
- WiFi. Intel 7265 rev D/3165 (7265D firmware) and 6200/6300 (6000 firmware, written without hardware in the loop); WPA2-PSK/CCMP and open networks, no WPA3/SAE, 802.1X, TKIP or WEP. No roaming, power save, background scan, HT/VHT, aggregation or rate scaling. Group rekeys need the background
wifi __keephelper running. RX CCMP falls back to the byte-oriented software AES-CCM path when the firmware rejects the installed keys, so it has no replay window and is CPU-bound at high RX rates. - RTL8821AU. High-speed EHCI/xHCI only (no UHCI/OHCI bulk). No IQ calibration, thermal power tracking, DIG, BT coexistence or by-rate/regulatory TX power tables (the eFuse base index is used for every rate); 20 MHz legacy rates only. Only one bulk device can stream on xHCI at a time (single bulk ring), so it does not mix with an ASIX dongle or a USB stick transfer.
- Suspend. There is no S0ix/suspend path; package C-states and the EC sleep handshake remain firmware-managed.
Source map
kernel/pci.h— enumerationkernel/blkdev.c— block registrykernel/sdhci.c,kernel/sdhci.h— Intel Braswell eMMCkernel/disk.c— floppy / DMAkernel/ata.c,kernel/ahci.c— PATA/SATAkernel/usb.c,kernel/usb_hcd.h— USB corekernel/uhci.c,kernel/ohci.c,kernel/ehci.c,kernel/xhci.ckernel/usbmsc.c,kernel/usbmsc.h— USB BOT/SCSI mass storagekernel/rndis.c,kernel/rndis.h— USB RNDIS tetheringkernel/iwl_trans.c,kernel/iwl_trans.h— Intel WiFi PCIe transport (7000 and 6000 families)kernel/iwl_mvm.c,kernel/iwl_mvm.h— 7265D/3165 firmware commands (MVM)kernel/iwl_dvm.c,kernel/iwl_dvm.h— 6200/6300 firmware commands (DVM)kernel/wifi_fw.c,kernel/wifi_fw.h— WiFi backend dispatch (Intel MVM/DVM, RTL8821AU)kernel/rtl8821au.c,kernel/rtl8821au.h— Realtek RTL8821AU USB WiFitools/mkrtwtbl.c,include/rtl8821a_tbl.h,third_party/rtw88/— RTL8821A register tables →firmware/rtl8821a.tblkernel/wifi.c,kernel/wifi.h— 802.11 station,wifinetdev,SYS_WIFIkernel/ccmp.c,kernel/ccmp.h— software CCMP (AES-CCM): RX fallback, RTL8821AU TXkernel/install.c— live-image clone installerkernel/backlight.c,kernel/backlight.h— Cherryview/Braswell panel PWMkernel/usbhid.c,kernel/mouse.c,kernel/io.c— inputkernel/i2c.c,kernel/i2c.h— DesignWare/LPSS I2C masterkernel/touchpad.c,kernel/touchpad.h— Elan HID-over-I2C touchpadkernel/touchpad_gesture.c,kernel/touchpad_gesture.h— device-independent contact gestures (tap, right-click zones, scroll)kernel/touchpad_gesture_test.c— host test (make test-touchpad)kernel/serial.c,kernel/serial_ring_buf.ckernel/thermal.c,kernel/it87.c,kernel/tpec.c,kernel/ec.c,kernel/cros_ec.c,kernel/power_src.c,kernel/mtrr.ckernel/rtc.c— CMOS wall clock read/writekernel/panic.c,kernel/timer.S— fatal exceptions