Skip to content

Conversation

@seijikun
Copy link
Contributor

@seijikun seijikun commented Nov 22, 2025

Initial implementation for device path generation of discovered pci devices in a PciTree instance.
Unfortunately, it's a bit clunky to use, since you have to query the DevicePath corresponding to your PciRootBridgeIo instance yourself and pass that in:

let mut pci_proto = get_open_protocol::<PciRootBridgeIo>(pci_handle);
let root_device_path = get_open_protocol::<DevicePath>(pci_handle);

let pci_tree = pci_proto.enumerate().unwrap();
for addr in pci_tree {
    // v Would be nicer, if I didn't have to pass root DevicePath in manually here v
    let device_path = pci_tree.device_path(&root_device_path, addr).unwrap();
}

I tried getting the DevicePath of the PciRootBridgeIo instance within PciRootBridgeIo::enumerate() and pass that on to the PciTree, but I couldn't find a way to get the DevicePath instance - other than ugly workarounds.

Best consumed Commit-By-Commit. Contains #1830..

Steps to Undraft

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

…ation

- Refactored return type from standard BTreeSet to custom PciTree struct
- Removed special FullPciIoAddress type, since segment number is PciRoot dependent
- During enumeration, skip branches we have already seen
- During enumeration, collect tree topology information (which child bus linked from where)
- Add complicated pci structure in integration test vm
- Print child busses for every device entry in integration test
@seijikun seijikun force-pushed the mr-pci-device_paths branch from ab46f2d to 582714a Compare November 22, 2025 02:34
@phip1611 phip1611 marked this pull request as draft November 22, 2025 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant