On 05/30/17 20:32, Laszlo Ersek wrote: > On 05/30/17 18:23, Vladimir Olovyannikov wrote: >> Hi, >> >> I've started PCIe stack implementation design for an armv8 aarch64 >> platform. >> The platform's PCIe represents several host bridges, and each hostbridge >> has one rootbridge. >> They do not share any resources between each other. >> Looking into the PciHostBridgeDxe implementation I can see that it >> supports only one hostbridge, and there is a comment: >> // Most systems in the world including complex servers have only one Host >> Bridge. >> >> So in my case should I create my own PciHostBridgeDxe driver supporting >> multiple hostbridges and do not use the Industry standard driver? >> I am very new to it, and will appreciate any help or idea. > > I think you can use PciHostBridgeDxe on this platform: > > - Implement a PciHostBridgeLib instance (see > <MdeModulePkg/Include/Library/PciHostBridgeLib.h>) that returns > PCI_ROOT_BRIDGE objects with different Segment fields, from > PciHostBridgeGetRootBridges(). > > - Implement a PciSegmentLib instance (see > <MdePkg/Include/Library/PciSegmentLib.h>) that routes the config space > addresses, encoded by the PCI_SEGMENT_LIB_ADDRESS() macro, according to > your platform. > > PciHostBridgeDxe and PciBusDxe should "just work" atop. To my > understanding, PciBusDxe delegates all config space accesses to > PciHostBridgeDxe, via EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. And > PciHostBridgeDxe delegates all config space accesses to the platform's > PciSegmentLib.
A small addition. Assuming the general case, i.e. when you have a different number of root bridges on each of several host bridges, you still have to number all those root bridges incrementally, in a curious, flat address space. And that address space is the PcieRoot(N) device path node that is supposed to start the "DevicePath" member of each PCI_ROOT_BRIDGE object that you return from PciHostBridgeGetRootBridges(). You can read about the PcieRoot() devpath node in the UEFI 2.6 spec. Basically, you have ACPI_HID_DEVICE_PATH.Header = <fill in as usual>; ACPI_HID_DEVICE_PATH.HID = EFI_PNP_ID (0x0a08); ACPI_HID_DEVICE_PATH.UID = <fill in incrementally across host bridges>; The UID values used in these devpath nodes should preferably match the UID values of the corresponding PCI Express Root Bridge objects (=PNP0A08) that you expose in your ACPI tables (DSDT and/or SSDT). Thanks Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel