Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36493 )
Change subject: [WIP] Documentation: PCI resource allocations ......................................................................
[WIP] Documentation: PCI resource allocations
Change-Id: I5479c4a60c3d8c7545759c0f48aa9f5d628d65f3 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- A Documentation/device/pci_resource.md 1 file changed, 26 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/36493/1
diff --git a/Documentation/device/pci_resource.md b/Documentation/device/pci_resource.md new file mode 100644 index 0000000..0fa2a51 --- /dev/null +++ b/Documentation/device/pci_resource.md @@ -0,0 +1,26 @@ +PCI resource allocation rules +============================= + +Definition: To opt-out from PCI resource allocation for a specific PCI device is to enter payload with the *PCI COMMAND* register having a defined state where *IO* and *MEMORY* spaces and *BUS_MASTER* bits are cleared, while all the *PCI standard BARs* are in an undefined state. + +1. #### Rule A +PCI devices that do not bind to PCI drivers can always implicitly opt-out, because PCI subsystem code itself will not address register banks or buffers behind standard BARs. + +1. Most external/add-on PCIe devices located behind PCIe bridges will hit `Rule A`. This includes the troublesome PCIe graphics with large *PREFMEM* resources. + +1. With the recursive nature of how *.read_resources* already works, upstream PCIe bridges will implicitly opt-out in the case all the secondary side devices have opted-out. + +1. Within PCI drivers, *.init* is the only callback where resource assignment may be required. + +1. #### Rule B +For cases where *.init* is not implemented at all, we can implicitly opt-out. + +1. #### Rule C +If .init does not call any *find_resource()*, we can explicitly opt-out by using alternative *.read_resources()* implementation with a conditional *MINIMAL_PCI_RESOURCES* check in it. + +1. #### Rule D +If *.init* does call *find_resource()*, it's likely for the reason that it does configurations that are dependent of either some *KConfig* option or *devicetree.cb*. Or it could be a static chipset configuration that is not easy to delay to payload. These devices can rarely opt-out, but it could be done explicitly using custom *.read_resources* like *Rule C*. + +1. Platforms with blobbed chipset initialisation would currently likely hit *Rule C*, but it might be possible to have them hit *Rule B* instead. + +1. If choice of payload is capable of completing the resource allocation, possibly extending to 64-bit MMIO space, it may be desirable to leave as many resources as possible unallocated and potentially even unallocate the ones that had been assigned.