#include <Library/PciHostBridgeLib.h>\r
#include <Library/DebugLib.h>\r
#include <Library/DevicePathLib.h>\r
+#include <Library/DxeServicesTableLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
#include <Library/PcdLib.h>\r
#include <Library/UefiBootServicesTableLib.h>\r
#define DTB_PCI_HOST_RANGE_IO BIT24\r
#define DTB_PCI_HOST_RANGE_TYPEMASK (BIT31 | BIT30 | BIT29 | BIT25 | BIT24)\r
\r
+STATIC\r
+EFI_STATUS\r
+MapGcdMmioSpace (\r
+ IN UINT64 Base,\r
+ IN UINT64 Size\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = gDS->AddMemorySpace (EfiGcdMemoryTypeMemoryMappedIo, Base, Size,\r
+ EFI_MEMORY_UC);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR,\r
+ "%a: failed to add GCD memory space for region [0x%Lx+0x%Lx)\n",\r
+ __FUNCTION__, Base, Size));\r
+ return Status;\r
+ }\r
+\r
+ Status = gDS->SetMemorySpaceAttributes (Base, Size, EFI_MEMORY_UC);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR,\r
+ "%a: failed to set memory space attributes for region [0x%Lx+0x%Lx)\n",\r
+ __FUNCTION__, Base, Size));\r
+ }\r
+ return Status;\r
+}\r
+\r
STATIC\r
EFI_STATUS\r
ProcessPciHost (\r
"Io[0x%Lx+0x%Lx)@0x%Lx Mem32[0x%Lx+0x%Lx)@0x0 Mem64[0x%Lx+0x%Lx)@0x0\n",\r
__FUNCTION__, ConfigBase, ConfigSize, *BusMin, *BusMax, *IoBase, *IoSize,\r
IoTranslation, *Mmio32Base, *Mmio32Size, *Mmio64Base, *Mmio64Size));\r
- return EFI_SUCCESS;\r
+\r
+ // Map the ECAM space in the GCD memory map\r
+ Status = MapGcdMmioSpace (ConfigBase, ConfigSize);\r
+ ASSERT_EFI_ERROR (Status);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ //\r
+ // Map the MMIO window that provides I/O access - the PCI host bridge code\r
+ // is not aware of this translation and so it will only map the I/O view\r
+ // in the GCD I/O map.\r
+ //\r
+ Status = MapGcdMmioSpace (*IoBase + IoTranslation, *IoSize);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return Status;\r
}\r
\r
STATIC PCI_ROOT_BRIDGE mRootBridge;\r
EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;\r
mRootBridge.Attributes = mRootBridge.Supports;\r
\r
- mRootBridge.DmaAbove4G = FALSE;\r
+ mRootBridge.DmaAbove4G = TRUE;\r
mRootBridge.NoExtendedConfigSpace = FALSE;\r
mRootBridge.ResourceAssigned = FALSE;\r
\r