Skip to content

Conversation

@seijikun
Copy link
Contributor

@seijikun seijikun commented Nov 5, 2025

I finally gave up on trying to achieve the PCI bus device enumeration without allocation - that's not gonna happen.
I therefore accepted my fate and transformed my version with allocations into an upstreamable state.

This implementation uses the RootBridge's configuration() method to query ACPI information about the bridge. This contains ranges of valid bus addresses (setup & configured by the UEFI firmware), which are then used as starting points for the recursive bus/device/function scan.
The result of this recursive scan is written into a BTreeSet - which now has the ordering you'd expect and are used to from tools like lspci.

Best consumed commit-by-commit :P

Checklist

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

@seijikun seijikun changed the title Mr pci enumerate uefi: Implement PciRootBridgeIo bus device enumeration logic Nov 5, 2025
@seijikun seijikun marked this pull request as draft November 5, 2025 20:11
@seijikun seijikun force-pushed the mr-pci-enumerate branch 9 times, most recently from 50999b8 to 3920b72 Compare November 5, 2025 20:59
@seijikun seijikun marked this pull request as ready for review November 5, 2025 21:08
Copy link
Member

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! And yes, I can imagine that using this nicely without alloc is a pain.


#[cfg(feature = "alloc")]
pub mod configuration;
#[cfg(feature = "alloc")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is plenty of functionality in that module not needing alloc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the rest only consists of private helper functions that aren't that useful outside. Do you want to expose them?

@seijikun seijikun force-pushed the mr-pci-enumerate branch 2 times, most recently from d4d9839 to 16b9553 Compare November 9, 2025 18:50
This sorting now actually makes sense from a logical point of view.
This is now also the ordering you get by using typical tools like lspci.
@seijikun seijikun force-pushed the mr-pci-enumerate branch 7 times, most recently from 85ea4b1 to 08ce762 Compare November 9, 2025 19:20
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.

2 participants