FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf\r
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf\r
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
- PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf\r
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf\r
PciHostBridgeUtilityLib|ArmVirtPkg/Library/ArmVirtPciHostBridgeUtilityLib/ArmVirtPciHostBridgeUtilityLib.inf\r
#\r
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf\r
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf\r
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf\r
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf\r
ArmVirtPkg/CloudHvAcpiPlatformDxe/CloudHvAcpiPlatformDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
\r
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
\r
- PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf\r
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf\r
PciHostBridgeUtilityLib|ArmVirtPkg/Library/ArmVirtPciHostBridgeUtilityLib/ArmVirtPciHostBridgeUtilityLib.inf\r
#\r
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf\r
}\r
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf\r
}\r
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
NULL|ArmVirtPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf\r
}\r
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf\r
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf\r
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf\r
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
- PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf\r
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf\r
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf\r
#\r
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf\r
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf\r
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf\r
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf\r
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf\r
QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf\r
FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
- PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf\r
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf\r
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf\r
#\r
ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf\r
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf\r
OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf\r
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf\r
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf {\r
<LibraryClasses>\r
- NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
+ NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf\r
}\r
+++ /dev/null
-/** @file\r
- FDT client library for consumers of PCI related dynamic PCDs\r
-\r
- Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
-\r
- SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <Uefi.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-\r
-#include <Protocol/FdtClient.h>\r
-\r
-//\r
-// We expect the "ranges" property of "pci-host-ecam-generic" to consist of\r
-// records like this.\r
-//\r
-#pragma pack (1)\r
-typedef struct {\r
- UINT32 Type;\r
- UINT64 ChildBase;\r
- UINT64 CpuBase;\r
- UINT64 Size;\r
-} DTB_PCI_HOST_RANGE_RECORD;\r
-#pragma pack ()\r
-\r
-#define DTB_PCI_HOST_RANGE_RELOCATABLE BIT31\r
-#define DTB_PCI_HOST_RANGE_PREFETCHABLE BIT30\r
-#define DTB_PCI_HOST_RANGE_ALIASED BIT29\r
-#define DTB_PCI_HOST_RANGE_MMIO32 BIT25\r
-#define DTB_PCI_HOST_RANGE_MMIO64 (BIT25 | BIT24)\r
-#define DTB_PCI_HOST_RANGE_IO BIT24\r
-#define DTB_PCI_HOST_RANGE_TYPEMASK (BIT31 | BIT30 | BIT29 | BIT25 | BIT24)\r
-\r
-STATIC\r
-RETURN_STATUS\r
-GetPciIoTranslation (\r
- IN FDT_CLIENT_PROTOCOL *FdtClient,\r
- IN INT32 Node,\r
- OUT UINT64 *IoTranslation\r
- )\r
-{\r
- UINT32 RecordIdx;\r
- CONST VOID *Prop;\r
- UINT32 Len;\r
- EFI_STATUS Status;\r
- UINT64 IoBase;\r
-\r
- //\r
- // Iterate over "ranges".\r
- //\r
- Status = FdtClient->GetNodeProperty (FdtClient, Node, "ranges", &Prop, &Len);\r
- if (EFI_ERROR (Status) || Len == 0 ||\r
- Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0) {\r
- DEBUG ((EFI_D_ERROR, "%a: 'ranges' not found or invalid\n", __FUNCTION__));\r
- return RETURN_PROTOCOL_ERROR;\r
- }\r
-\r
- for (RecordIdx = 0; RecordIdx < Len / sizeof (DTB_PCI_HOST_RANGE_RECORD);\r
- ++RecordIdx) {\r
- CONST DTB_PCI_HOST_RANGE_RECORD *Record;\r
- UINT32 Type;\r
-\r
- Record = (CONST DTB_PCI_HOST_RANGE_RECORD *)Prop + RecordIdx;\r
- Type = SwapBytes32 (Record->Type) & DTB_PCI_HOST_RANGE_TYPEMASK;\r
- if (Type == DTB_PCI_HOST_RANGE_IO) {\r
- IoBase = SwapBytes64 (Record->ChildBase);\r
- *IoTranslation = SwapBytes64 (Record->CpuBase) - IoBase;\r
-\r
- return RETURN_SUCCESS;\r
- }\r
- }\r
- return RETURN_NOT_FOUND;\r
-}\r
-\r
-RETURN_STATUS\r
-EFIAPI\r
-FdtPciPcdProducerLibConstructor (\r
- VOID\r
- )\r
-{\r
- UINT64 PciExpressBaseAddress;\r
- FDT_CLIENT_PROTOCOL *FdtClient;\r
- CONST UINT64 *Reg;\r
- UINT32 RegSize;\r
- EFI_STATUS Status;\r
- INT32 Node;\r
- RETURN_STATUS RetStatus;\r
- UINT64 IoTranslation;\r
- RETURN_STATUS PcdStatus;\r
-\r
- PciExpressBaseAddress = PcdGet64 (PcdPciExpressBaseAddress);\r
- if (PciExpressBaseAddress != MAX_UINT64) {\r
- //\r
- // Assume that the fact that PciExpressBaseAddress has been changed from\r
- // its default value of MAX_UINT64 implies that this code has been\r
- // executed already, in the context of another module. That means we can\r
- // assume that PcdPciIoTranslation has been discovered from the DT node\r
- // as well.\r
- //\r
- return EFI_SUCCESS;\r
- }\r
-\r
- Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
- (VOID **)&FdtClient);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- PciExpressBaseAddress = 0;\r
- Status = FdtClient->FindCompatibleNode (FdtClient, "pci-host-ecam-generic",\r
- &Node);\r
-\r
- if (!EFI_ERROR (Status)) {\r
- Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",\r
- (CONST VOID **)&Reg, &RegSize);\r
-\r
- if (!EFI_ERROR (Status) && RegSize == 2 * sizeof (UINT64)) {\r
- PciExpressBaseAddress = SwapBytes64 (*Reg);\r
-\r
- PcdStatus = PcdSetBoolS (PcdPciDisableBusEnumeration, FALSE);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
-\r
- IoTranslation = 0;\r
- RetStatus = GetPciIoTranslation (FdtClient, Node, &IoTranslation);\r
- if (!RETURN_ERROR (RetStatus)) {\r
- PcdStatus = PcdSet64S (PcdPciIoTranslation, IoTranslation);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
- } else {\r
- //\r
- // Support for I/O BARs is not mandatory, and so it does not make sense\r
- // to abort in the general case. So leave it up to the actual driver to\r
- // complain about this if it wants to, and just issue a warning here.\r
- //\r
- DEBUG ((EFI_D_WARN,\r
- "%a: 'pci-host-ecam-generic' device encountered with no I/O range\n",\r
- __FUNCTION__));\r
- }\r
- }\r
- }\r
-\r
- PcdStatus = PcdSet64S (PcdPciExpressBaseAddress, PciExpressBaseAddress);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
-\r
- return RETURN_SUCCESS;\r
-}\r
+++ /dev/null
-#/** @file\r
-# FDT client library for consumers of PCI related dynamic PCDs\r
-#\r
-# Copyright (c) 2016, Linaro Ltd. All rights reserved.\r
-#\r
-# SPDX-License-Identifier: BSD-2-Clause-Patent\r
-#\r
-#**/\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = FdtPciPcdProducerLib\r
- FILE_GUID = D584275B-BF1E-4DF8-A53D-980F5645C5E7\r
- MODULE_TYPE = BASE\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = PciPcdProducerLib|DXE_DRIVER UEFI_DRIVER\r
- CONSTRUCTOR = FdtPciPcdProducerLibConstructor\r
-\r
-[Sources]\r
- FdtPciPcdProducerLib.c\r
-\r
-[Packages]\r
- ArmPkg/ArmPkg.dec\r
- ArmVirtPkg/ArmVirtPkg.dec\r
- EmbeddedPkg/EmbeddedPkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
- MdePkg/MdePkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- DebugLib\r
- PcdLib\r
- UefiBootServicesTableLib\r
-\r
-[Protocols]\r
- gFdtClientProtocolGuid ## CONSUMES\r
-\r
-[Pcd]\r
- gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation ## PRODUCES\r
- gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## PRODUCES\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration ## PRODUCES\r
-\r
-[Depex]\r
- gFdtClientProtocolGuid\r
R: Min Xu <min.m.xu@intel.com> [mxu9]\r
R: Tom Lendacky <thomas.lendacky@amd.com> [tlendacky]\r
\r
+OvmfPkg: FDT related modules\r
+F: OvmfPkg/Fdt\r
+R: Leif Lindholm <leif@nuviainc.com>\r
+R: Gerd Hoffmann <kraxel@redhat.com>\r
+R: Abner Chang <abner.chang@hpe.com>\r
+\r
OvmfPkg: LsiScsi driver\r
F: OvmfPkg/LsiScsiDxe/\r
R: Gary Lin <glin@suse.com>\r
--- /dev/null
+/** @file\r
+ FDT client library for consumers of PCI related dynamic PCDs\r
+\r
+ Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Uefi.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+\r
+#include <Protocol/FdtClient.h>\r
+\r
+//\r
+// We expect the "ranges" property of "pci-host-ecam-generic" to consist of\r
+// records like this.\r
+//\r
+#pragma pack (1)\r
+typedef struct {\r
+ UINT32 Type;\r
+ UINT64 ChildBase;\r
+ UINT64 CpuBase;\r
+ UINT64 Size;\r
+} DTB_PCI_HOST_RANGE_RECORD;\r
+#pragma pack ()\r
+\r
+#define DTB_PCI_HOST_RANGE_RELOCATABLE BIT31\r
+#define DTB_PCI_HOST_RANGE_PREFETCHABLE BIT30\r
+#define DTB_PCI_HOST_RANGE_ALIASED BIT29\r
+#define DTB_PCI_HOST_RANGE_MMIO32 BIT25\r
+#define DTB_PCI_HOST_RANGE_MMIO64 (BIT25 | BIT24)\r
+#define DTB_PCI_HOST_RANGE_IO BIT24\r
+#define DTB_PCI_HOST_RANGE_TYPEMASK (BIT31 | BIT30 | BIT29 | BIT25 | BIT24)\r
+\r
+STATIC\r
+RETURN_STATUS\r
+GetPciIoTranslation (\r
+ IN FDT_CLIENT_PROTOCOL *FdtClient,\r
+ IN INT32 Node,\r
+ OUT UINT64 *IoTranslation\r
+ )\r
+{\r
+ UINT32 RecordIdx;\r
+ CONST VOID *Prop;\r
+ UINT32 Len;\r
+ EFI_STATUS Status;\r
+ UINT64 IoBase;\r
+\r
+ //\r
+ // Iterate over "ranges".\r
+ //\r
+ Status = FdtClient->GetNodeProperty (FdtClient, Node, "ranges", &Prop, &Len);\r
+ if (EFI_ERROR (Status) || Len == 0 ||\r
+ Len % sizeof (DTB_PCI_HOST_RANGE_RECORD) != 0) {\r
+ DEBUG ((EFI_D_ERROR, "%a: 'ranges' not found or invalid\n", __FUNCTION__));\r
+ return RETURN_PROTOCOL_ERROR;\r
+ }\r
+\r
+ for (RecordIdx = 0; RecordIdx < Len / sizeof (DTB_PCI_HOST_RANGE_RECORD);\r
+ ++RecordIdx) {\r
+ CONST DTB_PCI_HOST_RANGE_RECORD *Record;\r
+ UINT32 Type;\r
+\r
+ Record = (CONST DTB_PCI_HOST_RANGE_RECORD *)Prop + RecordIdx;\r
+ Type = SwapBytes32 (Record->Type) & DTB_PCI_HOST_RANGE_TYPEMASK;\r
+ if (Type == DTB_PCI_HOST_RANGE_IO) {\r
+ IoBase = SwapBytes64 (Record->ChildBase);\r
+ *IoTranslation = SwapBytes64 (Record->CpuBase) - IoBase;\r
+\r
+ return RETURN_SUCCESS;\r
+ }\r
+ }\r
+ return RETURN_NOT_FOUND;\r
+}\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+FdtPciPcdProducerLibConstructor (\r
+ VOID\r
+ )\r
+{\r
+ UINT64 PciExpressBaseAddress;\r
+ FDT_CLIENT_PROTOCOL *FdtClient;\r
+ CONST UINT64 *Reg;\r
+ UINT32 RegSize;\r
+ EFI_STATUS Status;\r
+ INT32 Node;\r
+ RETURN_STATUS RetStatus;\r
+ UINT64 IoTranslation;\r
+ RETURN_STATUS PcdStatus;\r
+\r
+ PciExpressBaseAddress = PcdGet64 (PcdPciExpressBaseAddress);\r
+ if (PciExpressBaseAddress != MAX_UINT64) {\r
+ //\r
+ // Assume that the fact that PciExpressBaseAddress has been changed from\r
+ // its default value of MAX_UINT64 implies that this code has been\r
+ // executed already, in the context of another module. That means we can\r
+ // assume that PcdPciIoTranslation has been discovered from the DT node\r
+ // as well.\r
+ //\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ Status = gBS->LocateProtocol (&gFdtClientProtocolGuid, NULL,\r
+ (VOID **)&FdtClient);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ PciExpressBaseAddress = 0;\r
+ Status = FdtClient->FindCompatibleNode (FdtClient, "pci-host-ecam-generic",\r
+ &Node);\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = FdtClient->GetNodeProperty (FdtClient, Node, "reg",\r
+ (CONST VOID **)&Reg, &RegSize);\r
+\r
+ if (!EFI_ERROR (Status) && RegSize == 2 * sizeof (UINT64)) {\r
+ PciExpressBaseAddress = SwapBytes64 (*Reg);\r
+\r
+ PcdStatus = PcdSetBoolS (PcdPciDisableBusEnumeration, FALSE);\r
+ ASSERT_RETURN_ERROR (PcdStatus);\r
+\r
+ IoTranslation = 0;\r
+ RetStatus = GetPciIoTranslation (FdtClient, Node, &IoTranslation);\r
+ if (!RETURN_ERROR (RetStatus)) {\r
+ PcdStatus = PcdSet64S (PcdPciIoTranslation, IoTranslation);\r
+ ASSERT_RETURN_ERROR (PcdStatus);\r
+ } else {\r
+ //\r
+ // Support for I/O BARs is not mandatory, and so it does not make sense\r
+ // to abort in the general case. So leave it up to the actual driver to\r
+ // complain about this if it wants to, and just issue a warning here.\r
+ //\r
+ DEBUG ((EFI_D_WARN,\r
+ "%a: 'pci-host-ecam-generic' device encountered with no I/O range\n",\r
+ __FUNCTION__));\r
+ }\r
+ }\r
+ }\r
+\r
+ PcdStatus = PcdSet64S (PcdPciExpressBaseAddress, PciExpressBaseAddress);\r
+ ASSERT_RETURN_ERROR (PcdStatus);\r
+\r
+ return RETURN_SUCCESS;\r
+}\r
--- /dev/null
+#/** @file\r
+# FDT client library for consumers of PCI related dynamic PCDs\r
+#\r
+# Copyright (c) 2016, Linaro Ltd. All rights reserved.\r
+#\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+#**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = FdtPciPcdProducerLib\r
+ FILE_GUID = D584275B-BF1E-4DF8-A53D-980F5645C5E7\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = PciPcdProducerLib|DXE_DRIVER UEFI_DRIVER\r
+ CONSTRUCTOR = FdtPciPcdProducerLibConstructor\r
+\r
+[Sources]\r
+ FdtPciPcdProducerLib.c\r
+\r
+[Packages]\r
+ EmbeddedPkg/EmbeddedPkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
+ DebugLib\r
+ PcdLib\r
+ UefiBootServicesTableLib\r
+\r
+[Protocols]\r
+ gFdtClientProtocolGuid ## CONSUMES\r
+\r
+[Pcd]\r
+ gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation ## PRODUCES\r
+ gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress ## PRODUCES\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration ## PRODUCES\r
+\r
+[Depex]\r
+ gFdtClientProtocolGuid\r