pci-config) and the CMOS real-time clock driver (cmos-rtc). The PCI driver scans the configuration space to enumerate every device on the bus and exposes the results via the lspci shell command. The RTC driver reads the hardware clock from CMOS and makes it available through the date command. Both drivers are active at boot and registered with the device manager.
PCI Configuration Space Driver
Thepci-config driver enumerates PCI devices by probing configuration space through the standard indirect I/O mechanism — writing a configuration address to port 0xCF8 and reading data from port 0xCFC. It scans every bus, slot, and function combination and returns a list of pci_device_t records for all devices that respond with a valid vendor ID.
Shell Command
lspci command prints a formatted table of every discovered PCI device, showing bus/slot/function address, vendor ID, device ID, and the human-readable class name.
API Reference
pci_scan() with a pre-allocated array of pci_device_t and its capacity. The function returns the number of devices written. If the bus contains more devices than capacity, only the first capacity entries are written.
pci_device_t Struct
pci_class_name(device.class_code) to convert the class code byte to a human-readable string such as "Display Controller" or "Mass Storage Controller".
Example: Scanning PCI Devices
Driver ID
The device manager registers this driver under the IDpci-config. Run devices in the shell to confirm it is online.
CMOS Real-Time Clock Driver
Thecmos-rtc driver reads the current date and time from the CMOS RTC chip by issuing indexed reads to I/O ports 0x70 (index) and 0x71 (data). It waits for the RTC update cycle to complete before reading to avoid torn values, then converts BCD-encoded registers to binary and stores the result in an rtc_time_t.
Shell Command
date command calls rtc_read() and prints the current date and time in a human-readable format.
API Reference
rtc_time_t Struct
Example: Reading the Current Time
The CMOS RTC reflects the hardware clock set in your system firmware (or QEMU’s emulated clock). It does not perform timezone conversion — the value returned is whatever the RTC hardware stores, typically UTC on most systems.
Driver ID
The device manager registers this driver under the IDcmos-rtc. Run devices in the shell to confirm it is online.