Skip to content

Commit

Permalink
MdeModulePkg/PciBus: Add the framework to init PCIE features
Browse files Browse the repository at this point in the history
REF:
  https://bugzilla.tianocore.org/show_bug.cgi?id=1954
  https://bugzilla.tianocore.org/show_bug.cgi?id=2194
  https://bugzilla.tianocore.org/show_bug.cgi?id=2313
  https://bugzilla.tianocore.org/show_bug.cgi?id=2499
  https://bugzilla.tianocore.org/show_bug.cgi?id=2500

The framework introduces two phases for PCIE feature initialization.

The "Scan" phase is optional and only needed by those features that
requires alignment in the entire hierarchy under the root port, such
as MaxPayloadSize. "Scan" phase only reads the device capability and
calculate the aligned setting with the consideration of the device
specific policy returned from platform.

The "Program" phase is mandatory and is to program the settings to
the PCIE configuration.

The first and last features are fake ones. First is to call
PciePlatform::GetDevicePolicy() for each device. Last is to call
PciePlatform::NotifyDeviceState() for each device.

Signed-off-by: Ashraf Javeed <ashraf.javeed@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Ashraf Javeed <ashraf.javeed@intel.com>
  • Loading branch information
Ashraf Javeed authored and niruiyu committed Mar 5, 2020
1 parent 967960f commit 9fb9a3d
Show file tree
Hide file tree
Showing 4 changed files with 501 additions and 1 deletion.
1 change: 1 addition & 0 deletions MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ struct _PCI_IO_DEVICE {
// This field is used to support this case.
//
UINT16 BridgeIoAlignment;
EFI_PCI_EXPRESS_DEVICE_POLICY DeviceState;
};

#define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \
Expand Down
11 changes: 11 additions & 0 deletions MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,17 @@ StartPciDevicesOnBridge (
);

if (!EFI_ERROR (Status)) {
//
// the late configuration of PCI Express features
// the platform is required to indicate its requirement for the initialization
// of PCI Express features by publishing its protocol
//
if (gFullEnumeration && (mPciePlatformProtocol != NULL)) {
Status = PcieGetPolicy ();
if (!EFI_ERROR (Status)) {
Status = EnumerateRootBridgePcieFeatures (RootBridge);
}
}
//
// finally enable those PCI bridges
//
Expand Down

0 comments on commit 9fb9a3d

Please sign in to comment.