audk/MdeModulePkg/Bus/Pci/PciBusDxe
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
..
ComponentName.c Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is valid/invalid. 2011-07-06 03:55:36 +00:00
ComponentName.h Fix the comments to follow UEFI Spec regarding how to check an EFI_HANDLE is valid/invalid. 2011-07-06 03:55:36 +00:00
PciBus.c MdeModulePkg/PciBus: Use shorter global variable name 2016-05-23 13:49:41 +08:00
PciBus.h MdeModulePkg/PciBus: do not improperly degrade resource 2016-05-23 13:49:41 +08:00
PciBusDxe.inf MdeModulePkg: list ARM and AARCH64 as valid architectures for some modules 2015-02-23 16:05:50 +00:00
PciBusDxe.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PciBusDxeExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
PciCommand.c MdeModulePkg: Enhance PCI capability looking up logic to avoid hang 2015-09-15 08:38:16 +00:00
PciCommand.h Update the copyright notice format 2010-04-24 09:49:11 +00:00
PciDeviceSupport.c Dispatch the UEFI option rom returned from PciPlatform/PciOverride protocol. 2015-01-20 06:45:01 +00:00
PciDeviceSupport.h Update the copyright notice format 2010-04-24 09:49:11 +00:00
PciDriverOverride.c Update the copyright notice format 2010-04-24 09:49:11 +00:00
PciDriverOverride.h Update the copyright notice format 2010-04-24 09:49:11 +00:00
PciEnumerator.c MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
PciEnumerator.h MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
PciEnumeratorSupport.c MdeModulePkg/PciBus: do not improperly degrade resource 2016-05-23 13:49:41 +08:00
PciEnumeratorSupport.h MdeModulePkg: Fix a PCI resource dumping bug in PciBusDxe driver 2015-11-03 02:33:41 +00:00
PciHotPlugSupport.c MdeModulePkg/PciBusDxe: recognize hotplug-capable PCIe ports 2016-07-13 08:39:29 +02:00
PciHotPlugSupport.h MdeModulePkg/PciBusDxe: recognize hotplug-capable PCIe ports 2016-07-13 08:39:29 +02:00
PciIo.c MdeModuelPkg/PciBus: Return AddrTranslationOffset in GetBarAttributes 2016-02-29 10:19:57 +08:00
PciIo.h Update the copyright notice format 2010-04-24 09:49:11 +00:00
PciLib.c MdeModulePkg: Fix typos in comments and variables 2016-07-11 10:29:48 +08:00
PciLib.h MdeModulePkg PciBusDxe: The PCI Bus Driver is updated to support multiple PCI bus ranges for a PCI root bridge. 2011-10-28 09:59:40 +00:00
PciOptionRomSupport.c Dispatch the UEFI option rom returned from PciPlatform/PciOverride protocol. 2015-01-20 06:45:01 +00:00
PciOptionRomSupport.h Dispatch the UEFI option rom returned from PciPlatform/PciOverride protocol. 2015-01-20 06:45:01 +00:00
PciPowerManagement.c MdeModulePkg PciBusDxe and DuetPkg PciBusNoEnumerationDxe: Update ResetPowerManagementFeature() to clear 4 related R/W bits in the PMCSR register, leaving other bits preserved. 2012-04-12 01:49:27 +00:00
PciPowerManagement.h Update the copyright notice format 2010-04-24 09:49:11 +00:00
PciResourceSupport.c MdeModulePkg/PciBus: do not improperly degrade resource 2016-05-23 13:49:41 +08:00
PciResourceSupport.h Print resource allocation/bar programming when PciBus driver does PCI BUS enumeration. 2011-08-04 09:08:09 +00:00
PciRomTable.c Update the copyright notice format 2010-04-24 09:49:11 +00:00
PciRomTable.h Update the copyright notice format 2010-04-24 09:49:11 +00:00