audk/MdeModulePkg/Bus/Pci
Laszlo Ersek ffdd337630 MdeModulePkg/PciBusDxe: recognize hotplug-capable PCIe ports
Section 7.8.2 of the PCI Express specification (r4.0 v0.3), entitled "PCI
Express Capabilities Register (Offset 02h)", and section 7.8.9 "Slot
Capabilities Register (Offset 14h)" of the same, describe the conditions
when a PCIe port should be considered "supporting hotplug":

- it should be a root complex port or a switch downstream port, and

- it should have the "Slot Implemented" bit set in the Express
  Capabilities Register, and

- it should have the "Hot-Plug Capable" bit set in the Slot Capabilities
  Register.

The first two sub-conditions are already implemented in at least two open
source projects I could find:

- in SeaBIOS by Marcel Apfelbaum: "hw/pci: reserve IO and mem for pci
  express downstream ports with no devices attached"
  <https://code.coreboot.org/p/seabios/source/commit/3aa31d7d6375>,

- in edk2 itself, in the implementation of the "PCI" UEFI Shell command:
  see the "PcieExplainTypeSlot" case label in function
  PciExplainPciExpress(), file
  "ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c".

PciBusDxe recognizes such PCIe ports as bridges, but it doesn't realize
they support hotplug. In turn PciBusDxe omits getting any resource padding
information from the platform's EFI_PCI_HOT_PLUG_INIT_PROTOCOL for these
bridges:

  GatherPpbInfo()                [PciEnumeratorSupport.c]
    GetResourcePaddingPpb()      [PciResourceSupport.c]
      GetResourcePaddingForHpb() [PciHotPlugSupport.c]
        IsPciHotPlugBus()        [PciHotPlugSupport.c]
          //
          // returns FALSE
          //
        //
        // the following is not reached:
        //
        gPciHotPlugInit->GetResourcePadding()

Implement a function called SupportsPcieHotplug() for identifying such
ports, and call it from IsPciHotPlugBus() (after the call to IsSHPC()).

Cc: "Johnson, Brian J." <bjohnson@sgi.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>
2016-07-13 08:39:29 +02:00
..
EhciDxe MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
EhciPei MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
IdeBusPei MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
IncompatiblePciDeviceSupportDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
NvmExpressDxe MdeModulePkg NvmExpressDxe: Fix invalid queue size when creating IO queues 2016-06-02 16:40:17 +08:00
PciBusDxe MdeModulePkg/PciBusDxe: recognize hotplug-capable PCIe ports 2016-07-13 08:39:29 +02:00
PciHostBridgeDxe MdeModulePkg/PciHostBridgeDxe: Fix VS tool chain build failure 2016-05-24 13:42:01 +08:00
PciSioSerialDxe MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
SdMmcPciHcDxe MdeModulePkg/SdMmc: update TPL to notify to fix UEFI SCT hang 2016-07-01 14:44:47 +08:00
SdMmcPciHcPei MdeModulePkg/SdMmc: Add EDKII SD/MMC stack 2016-03-30 11:27:41 +08:00
UfsPciHcDxe MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
UfsPciHcPei MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
UhciDxe MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
UhciPei MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
XhciDxe MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
XhciPei MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00