Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes critical bugs in the PCI enumeration code and adds comprehensive unit tests achieving 97.8% code coverage.
Changes:
- Fixed 64-bit BAR size detection by ensuring both upper and lower BAR registers are written with probe mask before reading size
- Corrected PCI bridge I/O window register offsets from incorrect 0x30/0x32 to spec-compliant 0x1C/0x1D
- Fixed I/O config space read/write functions to use offset values instead of full encoded addresses
- Added proper error path state restoration in bridge programming
- Fixed BAR restore to use correct offset (bar_off instead of bar_idx)
- Added extensive unit test infrastructure with mock PCI topology
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tools/unit-tests/unit-pci.c | Complete rewrite with mock PCI topology infrastructure and 25+ comprehensive test cases covering all major code paths including error handling |
| src/pci.c | Multiple critical bug fixes: 64-bit BAR sizing, I/O window offsets, I/O config read/write offset handling, error path restoration, BAR restore offset fix, and debug output cleanup |
| include/pci.h | Corrected I/O base/limit register offsets and changed pci_enum_bus return type from uint32_t to int |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR address several problems in PCI code:
It also add unit testi to pci.c, to a coverage of 97.8%