diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-11-23 21:38:52 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-11-23 21:38:52 +0100 |
| commit | c0c6b4a536a825e996fb11f4ae26625253cc0d18 (patch) | |
| tree | 07e50f2de6d3bd37b6bedcbc515e19a879235a34 /docs/pre/arch | |
| parent | f19e0ed7f403b22c7e4845bbc3fafd84cc44be3b (diff) | |
| download | kernel-c0c6b4a536a825e996fb11f4ae26625253cc0d18.tar.xz kernel-c0c6b4a536a825e996fb11f4ae26625253cc0d18.zip | |
kernel/devices: implement depth-first PCI scan
This change introduces a new depth-first PCI scan algorithm. This new
algorithm is implemented in kernel::devices::pci::scan_segment. The scan
traverse the PCI hierarchy by following bridges before moving on to the
next device function. The result is a vector that presents the data so
that each bridge directly precedes its subordinate devices in the
vector. During the traversal, the following preconditions are checked
before descending into subordinate devices.
- The bridge has a non-zero secondary bus number.
- The segment contains the bridge's secondary bus number.
- The secondary bus number is greater than the primary bus number.
- The subordinate bus range is greater or equal to the secondary bus
number.
If any of these preconditions are not met, the scan will does not
descend down the detected bridge, and a kernel warning is issued. If a
bus on a segment has already been scanned, it will not be scanned again
and a kernel warning is issued.
Additionally, this change transitions the PCI initialization to use the
new depth-first scan algorithm, ensuring that the PCI hierarchy is
traversed in a consistent and predictable manner.
The change adds a set of tests to verify the contract established for
scan_segment, including ensuring the correct kernel warnings are issued
when preconditions are not met. To support the testing of error
messages, the ecam_fixture clears the kernel log buffer before each
leaf. A new function, kernel::tests::require_log_message, is introduced
to assert the presence of specific log messages in the kernel log
buffer.
Diffstat (limited to 'docs/pre/arch')
0 files changed, 0 insertions, 0 deletions
