32#define DTB_PCI_HOST_RANGE_RELOCATABLE BIT31
33#define DTB_PCI_HOST_RANGE_PREFETCHABLE BIT30
34#define DTB_PCI_HOST_RANGE_ALIASED BIT29
35#define DTB_PCI_HOST_RANGE_MMIO32 BIT25
36#define DTB_PCI_HOST_RANGE_MMIO64 (BIT25 | BIT24)
37#define DTB_PCI_HOST_RANGE_IO BIT24
38#define DTB_PCI_HOST_RANGE_TYPEMASK (BIT31 | BIT30 | BIT29 | BIT25 | BIT24)
45 OUT UINT64 *IoTranslation
57 Status = FdtClient->GetNodeProperty (FdtClient, Node,
"ranges", &Prop, &Len);
58 if (EFI_ERROR (Status) || (Len == 0) ||
61 DEBUG ((DEBUG_ERROR,
"%a: 'ranges' not found or invalid\n", __func__));
72 Type =
SwapBytes32 (Record->Type) & DTB_PCI_HOST_RANGE_TYPEMASK;
73 if (Type == DTB_PCI_HOST_RANGE_IO) {
75 *IoTranslation =
SwapBytes64 (Record->CpuBase) - IoBase;
86FdtPciPcdProducerLibConstructor (
90 UINT64 PciExpressBaseAddress;
96 RETURN_STATUS RetStatus;
98 RETURN_STATUS PcdStatus;
100 PciExpressBaseAddress =
PcdGet64 (PcdPciExpressBaseAddress);
101 if (PciExpressBaseAddress != MAX_UINT64) {
112 Status =
gBS->LocateProtocol (
113 &gFdtClientProtocolGuid,
119 PciExpressBaseAddress = 0;
120 Status = FdtClient->FindCompatibleNode (
122 "pci-host-ecam-generic",
126 if (!EFI_ERROR (Status)) {
127 Status = FdtClient->GetNodeProperty (
135 if (!EFI_ERROR (Status) && (RegSize == 2 *
sizeof (UINT64))) {
142 RetStatus = GetPciIoTranslation (FdtClient, Node, &IoTranslation);
144 PcdStatus =
PcdSet64S (PcdPciIoTranslation, IoTranslation);
154 "%a: 'pci-host-ecam-generic' device encountered with no I/O range\n",
161 PcdStatus =
PcdSet64S (PcdPciExpressBaseAddress, PciExpressBaseAddress);
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
UINT64 EFIAPI SwapBytes64(IN UINT64 Value)
#define RETURN_PROTOCOL_ERROR
#define RETURN_ERROR(StatusCode)
#define ASSERT_EFI_ERROR(StatusParameter)
#define ASSERT_RETURN_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdGet64(TokenName)
#define PcdSetBoolS(TokenName, Value)
#define PcdSet64S(TokenName, Value)