audk/MdeModulePkg
Ruiyu Ni 0176af142e MdeModulePkg/PciBus: Shadow option ROM after BARs are programmed
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1376

Today's implementation reuses the 32bit MMIO resource requested by
all PCI devices MMIO BARs when shadowing the option ROM.
Take a simple example, a system has only one PCI device. It requires
8MB 32bit MMIO and contains a 4MB option ROM. Today's implementation
only requests 8MB (max of 4M and 8M) 32bit MMIO from
PciHostBridgeResourceAllocation protocol. Let's assume the MMIO range
[3GB, 3GB+8MB) is allocated. The 3GB base address is firstly
programmed to the option ROM BAR for option ROM shadow. Then the
option ROM decoding is turned off and 3GB base address is programmed
to the 32bit MMIO BAR.

It doesn't cause issues when the device doesn't request too much
MMIO.
But when the device contains a 64bit MMIO BAR which requests 4GB MMIO
and a 4MB option ROM. Let's assume [3GB, 3GB+8MB) 32bit MMIO range is
allocated for the option ROM. When the option ROM is being shadowed,
64bit MMIO BAR is programmed to value 0, which means [0, 4GB) MMIO is
given to the 64bit BAR.
The range overlaps with the option ROM range which may cause the
device malfunction (e.g.: option ROM cannot be read out) when the
device has two separate decoders: one for MMIO BAR, the other for
option ROM.

The patch requests dedicated MEM32 resource for Option ROMs and
moves the Option ROM shadow logic after all MMIO BARs are programmed.
The MMIO BAR setting to 0 when shadowing Option ROM is also skipped
because the MMIO BAR already contains the correct value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-12-10 10:30:13 +08:00
..
Application MdeModulePkg CapsuleApp:Remove two redundant Guids 2018-09-21 11:34:42 +08:00
Bus MdeModulePkg/PciBus: Shadow option ROM after BARs are programmed 2018-12-10 10:30:13 +08:00
Core MdeModulePkg/Core: fix ineffective guard page issue 2018-11-07 23:08:27 +08:00
Include MdeModulePkg/SdMmcPciHcDxe: Allow overriding base clock frequency 2018-11-20 13:46:57 +08:00
Library MdeModulePkg/BaseSortLib: Enable for all module types 2018-11-29 08:35:54 +08:00
Logo MdeModulePkg: Removing ipf which is no longer supported from edk2. 2018-09-06 15:25:16 +08:00
Universal MdeModulePkg PCD: Add DynamicEx PcdVpdBaseAddress64 for non SPI platform 2018-11-27 11:29:21 +08:00
MdeModulePkg.dec MdeModulePkg PCD: Add DynamicEx PcdVpdBaseAddress64 for non SPI platform 2018-11-27 11:29:21 +08:00
MdeModulePkg.dsc MdeModulePkg BrotliCustomDecompressLib: Don't build it for EBC arch 2018-10-15 15:55:55 +08:00
MdeModulePkg.uni MdeModulePkg: Correct PCD name in MdeModulePkg.uni 2018-12-03 08:29:26 +08:00
MdeModulePkgExtra.uni MdeModulePkg: Clean up source files 2018-06-28 11:19:45 +08:00