Repository navigation
PCI fixes - #165
Merged
Merged
PCI fixes#165
Conversation
A PCI_Config region was always attached to the bus returned by _BBN of the PCI root, with the device & function taken from _ADR of the device it was declared in. This is only correct for devices that sit directly on the root bus: anything below a PCI-to-PCI bridge lives on the secondary bus of that bridge. Figure out which device a region belongs to the same way the NT ACPI driver does it, as observed on Windows 11 with a set of probe tables: - A device is only a PCI device if it has an _ADR and its direct parent is either the PCI root or a PCI device that is a bridge, in which case it is on the secondary bus of that bridge. Whether something is a bridge is decided by its header type, both PCI & CardBus ones count. - The region belongs to the closest PCI device at or above the device it was declared in. In particular, anything below a non-bridge, like a port of a USB controller, uses the config space of that non-bridge no matter what its own _ADR is, and so does a device without an _ADR. - The bus numbers are re-read every time as they're host writable and not known to AML. The handles of the bridges & of the device itself are kept open, and are only reopened if the address they were opened at changes. While at it, don't treat the handle as valid if opening the device failed with something other than UACPI_STATUS_NOT_FOUND. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Make the test runner provide a small fake PCI topology on segment 0xCAFE that has a few bridges in it, with writable secondary bus numbers, and a bus that nothing can be opened on. Use it to check that PCI_Config regions are attached to the correct device, and that they follow the bridges above them as those get configured, moved to a different bus & deconfigured. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Exact same protection list that ships with Windows 11's ACPI driver. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Exact same protection list that ships with Windows 11's ACPI driver. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
NT doesn't assume that no _ADR implies 00:00.0, so we shouldn't either. Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.