summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ArmVirtPkg/ArmVirt.dsc.inc2
-rw-r--r--ArmVirtPkg/ArmVirtCloudHv.dsc1
-rw-r--r--ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c14
-rw-r--r--ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf1
-rw-r--r--ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c8
-rw-r--r--ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c26
-rw-r--r--ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c14
-rwxr-xr-xArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf1
-rw-r--r--ArmVirtPkg/PrePi/FdtParser.c29
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c3
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c7
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c3
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c5
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c49
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c7
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c3
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c7
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c7
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c15
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c3
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h1
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c33
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c43
-rw-r--r--DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c33
-rw-r--r--EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c8
-rw-r--r--EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c22
-rw-r--r--EmbeddedPkg/EmbeddedPkg.dsc2
-rw-r--r--EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c32
-rw-r--r--MdeModulePkg/Bus/Spi/SpiBus/SpiBus.c13
-rw-r--r--MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c2
-rw-r--r--MdePkg/Include/Library/FdtLib.h63
-rw-r--r--MdePkg/Library/BaseFdtLib/FdtLib.c53
-rw-r--r--OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c28
-rw-r--r--OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf1
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c11
-rw-r--r--OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf1
-rw-r--r--OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc2
-rw-r--r--OvmfPkg/LoongArchVirt/PlatformPei/Platform.c14
-rw-r--r--OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf1
-rw-r--r--OvmfPkg/Microvm/MicrovmX64.dsc2
-rw-r--r--OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc2
-rw-r--r--OvmfPkg/RiscVVirt/Sec/Memory.c36
-rw-r--r--OvmfPkg/RiscVVirt/Sec/Platform.c14
-rw-r--r--UefiPayloadPkg/Library/BuildFdtLib/X86_BuildFdtLib.c116
-rw-r--r--UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c4
45 files changed, 439 insertions, 303 deletions
diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index d3c2bb35e8..1f428a8a64 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -132,7 +132,7 @@
DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
# Flattened Device Tree (FDT) access library
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+ FdtLib|MdePkg/Library/BaseFdtLib/BaseFdtLib.inf
# PCI Libraries
PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
diff --git a/ArmVirtPkg/ArmVirtCloudHv.dsc b/ArmVirtPkg/ArmVirtCloudHv.dsc
index 8b475e23e5..4ebaf1efcb 100644
--- a/ArmVirtPkg/ArmVirtCloudHv.dsc
+++ b/ArmVirtPkg/ArmVirtCloudHv.dsc
@@ -61,6 +61,7 @@
!include MdePkg/MdeLibs.dsc.inc
[LibraryClasses.common.PEIM]
+ PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
ArmVirtMemInfoLib|ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
[LibraryClasses.common.DXE_DRIVER]
diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
index 98cc138705..9c3672ba82 100644
--- a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoLib.c
@@ -9,10 +9,10 @@
#include <PiPei.h>
#include <Base.h>
-#include <libfdt.h>
#include <Library/ArmLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
@@ -68,7 +68,7 @@ CloudHvVirtMemInfoPeiLibConstructor (
//
// Make sure we have a valid device tree blob
//
- if (fdt_check_header (DeviceTreeBase) != 0) {
+ if (FdtCheckHeader (DeviceTreeBase) != 0) {
return EFI_NOT_FOUND;
}
@@ -76,7 +76,7 @@ CloudHvVirtMemInfoPeiLibConstructor (
// Look for the lowest memory node
//
for (Prev = 0; ; Prev = Node) {
- Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
+ Node = FdtNextNode (DeviceTreeBase, Prev, NULL);
if (Node < 0) {
break;
}
@@ -84,16 +84,16 @@ CloudHvVirtMemInfoPeiLibConstructor (
//
// Check for memory node
//
- Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
+ Type = FdtGetProp (DeviceTreeBase, Node, "device_type", &Len);
if ((Type != 0) && (AsciiStrnCmp (Type, "memory", Len) == 0)) {
//
// Get the 'reg' property of this node. For now, we will assume
// two 8 byte quantities for base and size, respectively.
//
- RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
+ RegProp = FdtGetProp (DeviceTreeBase, Node, "reg", &Len);
if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) {
- CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
- CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
+ CurBase = Fdt64ToCpu (ReadUnaligned64 (RegProp));
+ CurSize = Fdt64ToCpu (ReadUnaligned64 (RegProp + 1));
DEBUG ((
DEBUG_INFO,
diff --git a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
index 6df26ccd64..3646ed3aee 100644
--- a/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
+++ b/ArmVirtPkg/Library/CloudHvVirtMemInfoLib/CloudHvVirtMemInfoPeiLib.inf
@@ -35,6 +35,7 @@
FdtLib
MemoryAllocationLib
PcdLib
+ PrePiLib
[Pcd]
gArmTokenSpaceGuid.PcdFdBaseAddress
diff --git a/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c
index 30e43beb9a..07a760678f 100644
--- a/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c
+++ b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c
@@ -14,10 +14,10 @@
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/HobLib.h>
#include <Library/PcdLib.h>
#include <Library/PeiServicesLib.h>
-#include <libfdt.h>
/** Initialise Platform HOBs
@@ -39,12 +39,12 @@ PlatformPeim (
UINT64 *UartHobData;
Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
- if ((Base == NULL) || (fdt_check_header (Base) != 0)) {
+ if ((Base == NULL) || (FdtCheckHeader (Base) != 0)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
- FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
+ FdtSize = FdtTotalSize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
NewBase = AllocatePages (FdtPages);
if (NewBase == NULL) {
@@ -52,7 +52,7 @@ PlatformPeim (
return EFI_OUT_OF_RESOURCES;
}
- fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
+ FdtOpenInto (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData));
if (FdtHobData == NULL) {
diff --git a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
index 7ab4aa2d6b..7d3f8c4c86 100644
--- a/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
+++ b/ArmVirtPkg/Library/PlatformPeiLib/PlatformPeiLib.c
@@ -12,11 +12,11 @@
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/HobLib.h>
#include <Library/PcdLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/FdtSerialPortAddressLib.h>
-#include <libfdt.h>
#include <Guid/EarlyPL011BaseAddress.h>
#include <Guid/FdtHob.h>
@@ -59,13 +59,13 @@ PlatformPeim (
Base = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);
ASSERT (Base != NULL);
- ASSERT (fdt_check_header (Base) == 0);
+ ASSERT (FdtCheckHeader (Base) == 0);
- FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
+ FdtSize = FdtTotalSize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
NewBase = AllocatePages (FdtPages);
ASSERT (NewBase != NULL);
- fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
+ FdtOpenInto (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof *FdtHobData);
ASSERT (FdtHobData != NULL);
@@ -132,7 +132,7 @@ PlatformPeim (
Parent = 0;
for (Prev = Depth = 0; ; Prev = Node) {
- Node = fdt_next_node (Base, Prev, &Depth);
+ Node = FdtNextNode (Base, Prev, &Depth);
if (Node < 0) {
break;
}
@@ -141,7 +141,7 @@ PlatformPeim (
Parent = Node;
}
- Compatible = fdt_getprop (Base, Node, "compatible", &Len);
+ Compatible = FdtGetProp (Base, Node, "compatible", &Len);
//
// Iterate over the NULL-separated items in the compatible string
@@ -152,12 +152,12 @@ PlatformPeim (
if (FeaturePcdGet (PcdTpm2SupportEnabled) &&
(AsciiStrCmp (CompItem, "tcg,tpm-tis-mmio") == 0))
{
- RegProp = fdt_getprop (Base, Node, "reg", &Len);
+ RegProp = FdtGetProp (Base, Node, "reg", &Len);
ASSERT (Len == 8 || Len == 16);
if (Len == 8) {
- TpmBase = fdt32_to_cpu (RegProp[0]);
+ TpmBase = Fdt32ToCpu (RegProp[0]);
} else if (Len == 16) {
- TpmBase = fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RegProp));
+ TpmBase = Fdt64ToCpu (ReadUnaligned64 ((UINT64 *)RegProp));
}
if (Depth > 1) {
@@ -168,7 +168,7 @@ PlatformPeim (
// tuple, where the child base and the size use the same number of
// cells as the 'reg' property above, and the parent base uses 2 cells
//
- RangesProp = fdt_getprop (Base, Parent, "ranges", &RangesLen);
+ RangesProp = FdtGetProp (Base, Parent, "ranges", &RangesLen);
ASSERT (RangesProp != NULL);
//
@@ -189,16 +189,16 @@ PlatformPeim (
}
if (Len == 8) {
- TpmBase -= fdt32_to_cpu (RangesProp[0]);
+ TpmBase -= Fdt32ToCpu (RangesProp[0]);
} else {
- TpmBase -= fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RangesProp));
+ TpmBase -= Fdt64ToCpu (ReadUnaligned64 ((UINT64 *)RangesProp));
}
//
// advance RangesProp to the parent bus address
//
RangesProp = (UINT32 *)((UINT8 *)RangesProp + Len / 2);
- TpmBase += fdt64_to_cpu (ReadUnaligned64 ((UINT64 *)RangesProp));
+ TpmBase += Fdt64ToCpu (ReadUnaligned64 ((UINT64 *)RangesProp));
}
}
diff --git a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c
index f39df852d8..b0948ef627 100644
--- a/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c
+++ b/ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLibConstructor.c
@@ -10,8 +10,8 @@
#include <Pi/PiMultiPhase.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/HobLib.h>
-#include <libfdt.h>
RETURN_STATUS
EFIAPI
@@ -37,13 +37,13 @@ QemuVirtMemInfoPeiLibConstructor (
//
// Make sure we have a valid device tree blob
//
- ASSERT (fdt_check_header (DeviceTreeBase) == 0);
+ ASSERT (FdtCheckHeader (DeviceTreeBase) == 0);
//
// Look for the lowest memory node
//
for (Prev = 0; ; Prev = Node) {
- Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
+ Node = FdtNextNode (DeviceTreeBase, Prev, NULL);
if (Node < 0) {
break;
}
@@ -51,16 +51,16 @@ QemuVirtMemInfoPeiLibConstructor (
//
// Check for memory node
//
- Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);
+ Type = FdtGetProp (DeviceTreeBase, Node, "device_type", &Len);
if (Type && (AsciiStrnCmp (Type, "memory", Len) == 0)) {
//
// Get the 'reg' property of this node. For now, we will assume
// two 8 byte quantities for base and size, respectively.
//
- RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
+ RegProp = FdtGetProp (DeviceTreeBase, Node, "reg", &Len);
if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) {
- CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
- CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
+ CurBase = Fdt64ToCpu (ReadUnaligned64 (RegProp));
+ CurSize = Fdt64ToCpu (ReadUnaligned64 (RegProp + 1));
DEBUG ((
DEBUG_INFO,
diff --git a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
index 635b7c1b35..b1b9dcd0e4 100755
--- a/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
+++ b/ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf
@@ -39,6 +39,7 @@
[LibraryClasses]
BaseLib
+ BaseMemoryLib
DebugLib
FdtLib
ArmLib
diff --git a/ArmVirtPkg/PrePi/FdtParser.c b/ArmVirtPkg/PrePi/FdtParser.c
index 5a91f7e62d..3f443b7f0d 100644
--- a/ArmVirtPkg/PrePi/FdtParser.c
+++ b/ArmVirtPkg/PrePi/FdtParser.c
@@ -5,7 +5,8 @@
*/
#include <Uefi.h>
-#include <Include/libfdt.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
BOOLEAN
FindMemnode (
@@ -20,14 +21,14 @@ FindMemnode (
INT32 Length;
CONST INT32 *Prop;
- if (fdt_check_header (DeviceTreeBlob) != 0) {
+ if (FdtCheckHeader (DeviceTreeBlob) != 0) {
return FALSE;
}
//
// Look for a node called "memory" at the lowest level of the tree
//
- MemoryNode = fdt_path_offset (DeviceTreeBlob, "/memory");
+ MemoryNode = FdtPathOffset (DeviceTreeBlob, "/memory");
if (MemoryNode <= 0) {
return FALSE;
}
@@ -39,36 +40,36 @@ FindMemnode (
AddressCells = 1;
SizeCells = 1;
- Prop = fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length);
+ Prop = FdtGetProp (DeviceTreeBlob, 0, "#address-cells", &Length);
if (Length == 4) {
- AddressCells = fdt32_to_cpu (*Prop);
+ AddressCells = Fdt32ToCpu (*Prop);
}
- Prop = fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length);
+ Prop = FdtGetProp (DeviceTreeBlob, 0, "#size-cells", &Length);
if (Length == 4) {
- SizeCells = fdt32_to_cpu (*Prop);
+ SizeCells = Fdt32ToCpu (*Prop);
}
//
// Now find the 'reg' property of the /memory node, and read the first
// range listed.
//
- Prop = fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length);
+ Prop = FdtGetProp (DeviceTreeBlob, MemoryNode, "reg", &Length);
if (Length < (AddressCells + SizeCells) * sizeof (INT32)) {
return FALSE;
}
- *SystemMemoryBase = fdt32_to_cpu (Prop[0]);
+ *SystemMemoryBase = Fdt32ToCpu (Prop[0]);
if (AddressCells > 1) {
- *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]);
+ *SystemMemoryBase = (*SystemMemoryBase << 32) | Fdt32ToCpu (Prop[1]);
}
Prop += AddressCells;
- *SystemMemorySize = fdt32_to_cpu (Prop[0]);
+ *SystemMemorySize = Fdt32ToCpu (Prop[0]);
if (SizeCells > 1) {
- *SystemMemorySize = (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1]);
+ *SystemMemorySize = (*SystemMemorySize << 32) | Fdt32ToCpu (Prop[1]);
}
return TRUE;
@@ -80,6 +81,6 @@ CopyFdt (
IN VOID *FdtSource
)
{
- fdt_pack (FdtSource);
- CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource));
+ FdtPack (FdtSource);
+ CopyMem (FdtDest, FdtSource, FdtTotalSize (FdtSource));
}
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c
index 2c9105ed10..2aa09e99ad 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtHwInfoParser.c
@@ -5,6 +5,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
+#include <Library/FdtLib.h>
#include "FdtHwInfoParser.h"
#include "Arm/BootArch/ArmBootArchParser.h"
#include "Arm/GenericTimer/ArmGenericTimerParser.h"
@@ -59,7 +60,7 @@ ArchFdtHwInfoMainDispatcher (
EFI_STATUS Status;
UINT32 Index;
- if (fdt_check_header (FdtParserHandle->Fdt) < 0) {
+ if (FdtCheckHeader (FdtParserHandle->Fdt) < 0) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
index 71774fae71..71a396de78 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/ArmFdtInterrupt.c
@@ -10,6 +10,7 @@
- linux//Documentation/devicetree/bindings/interrupt-controller/arm%2Cgic.yaml
**/
+#include <Library/FdtLib.h>
#include <FdtHwInfoParserInclude.h>
#include "FdtUtility.h"
@@ -34,8 +35,8 @@ FdtGetInterruptId (
ASSERT (Data != NULL);
- IrqType = fdt32_to_cpu (Data[IRQ_TYPE_OFFSET]);
- IrqId = fdt32_to_cpu (Data[IRQ_NUMBER_OFFSET]);
+ IrqType = Fdt32ToCpu (Data[IRQ_TYPE_OFFSET]);
+ IrqId = Fdt32ToCpu (Data[IRQ_NUMBER_OFFSET]);
switch (IrqType) {
case DT_SPI_IRQ:
@@ -76,7 +77,7 @@ FdtGetInterruptFlags (
ASSERT (Data != NULL);
- IrqFlags = fdt32_to_cpu (Data[IRQ_FLAGS_OFFSET]);
+ IrqFlags = Fdt32ToCpu (Data[IRQ_FLAGS_OFFSET]);
AcpiIrqFlags = DT_IRQ_IS_EDGE_TRIGGERED (IrqFlags) ? BIT0 : 0;
AcpiIrqFlags |= DT_IRQ_IS_ACTIVE_LOW (IrqFlags) ? BIT1 : 0;
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c
index b5c42d88fc..35f4c6dbdc 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/BootArch/ArmBootArchParser.c
@@ -10,6 +10,7 @@
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include "FdtHwInfoParser.h"
#include "CmObjectDescUtility.h"
#include "Arm/BootArch/ArmBootArchParser.h"
@@ -69,7 +70,7 @@ PsciNodeParser (
// Default to parking protocol
BootArchInfo->BootArchFlags = 0;
- Data = fdt_getprop (Fdt, PsciNode, "method", &DataSize);
+ Data = FdtGetProp (Fdt, PsciNode, "method", &DataSize);
if ((Data == NULL) || (DataSize < 0)) {
ASSERT (0);
return EFI_ABORTED;
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c
index c79ad9213a..a14ed3a98a 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/GenericTimer/ArmGenericTimerParser.c
@@ -9,6 +9,7 @@
**/
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include "FdtHwInfoParser.h"
#include "CmObjectDescUtility.h"
#include "Arm/GenericTimer/ArmGenericTimerParser.h"
@@ -64,7 +65,7 @@ TimerNodeParser (
return EFI_INVALID_PARAMETER;
}
- Data = fdt_getprop (Fdt, TimerNode, "always-on", &DataSize);
+ Data = FdtGetProp (Fdt, TimerNode, "always-on", &DataSize);
if ((Data == NULL) || (DataSize < 0)) {
AlwaysOnTimer = FALSE;
} else {
@@ -97,7 +98,7 @@ TimerNodeParser (
return Status;
}
- Data = fdt_getprop (Fdt, TimerNode, "interrupts", &DataSize);
+ Data = FdtGetProp (Fdt, TimerNode, "interrupts", &DataSize);
if ((Data == NULL) ||
(DataSize != (FdtMaxTimerItem * IntCells * sizeof (UINT32))))
{
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c
index f74e5d5fef..4bbe7e0d50 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicCParser.c
@@ -12,6 +12,7 @@
**/
#include <Library/ArmLib.h>
+#include <Library/FdtLib.h>
#include "FdtHwInfoParser.h"
#include "CmObjectDescUtility.h"
#include "Arm/Gic/ArmGicCParser.h"
@@ -91,7 +92,7 @@ CpuNodeParser (
return EFI_INVALID_PARAMETER;
}
- Data = fdt_getprop (Fdt, CpuNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, CpuNode, "reg", &DataSize);
if ((Data == NULL) ||
((DataSize != sizeof (UINT32)) &&
(DataSize != sizeof (UINT64))))
@@ -107,10 +108,10 @@ CpuNodeParser (
bits [23:0] of MPIDR_EL1.
*/
if (AddressCells == 2) {
- MpIdr = fdt64_to_cpu (*((UINT64 *)Data));
+ MpIdr = Fdt64ToCpu (*((UINT64 *)Data));
CheckAffMask |= ARM_CORE_AFF3;
} else {
- MpIdr = fdt32_to_cpu (*((UINT32 *)Data));
+ MpIdr = Fdt32ToCpu (*((UINT32 *)Data));
}
if ((MpIdr & ~CheckAffMask) != 0) {
@@ -185,7 +186,7 @@ CpusNodeParser (
return EFI_INVALID_PARAMETER;
}
- AddressCells = fdt_address_cells (Fdt, CpusNode);
+ AddressCells = FdtAddressCells (Fdt, CpusNode);
if (AddressCells < 0) {
ASSERT (0);
return EFI_ABORTED;
@@ -312,11 +313,11 @@ GicCIntcNodeParser (
// According to the DT bindings, this could be the:
// "Interrupt source of the parent interrupt controller on secondary GICs"
// but it is assumed that only one Gic is available.
- Data = fdt_getprop (Fdt, GicIntcNode, "interrupts", &DataSize);
+ Data = FdtGetProp (Fdt, GicIntcNode, "interrupts", &DataSize);
if ((Data != NULL) && (DataSize == (IntCells * sizeof (UINT32)))) {
MaintenanceInterrupt = FdtGetInterruptId ((CONST UINT32 *)Data);
Flags = DT_IRQ_IS_EDGE_TRIGGERED (
- fdt32_to_cpu (((UINT32 *)Data)[IRQ_FLAGS_OFFSET])
+ Fdt32ToCpu (((UINT32 *)Data)[IRQ_FLAGS_OFFSET])
) ?
EFI_ACPI_6_3_VGIC_MAINTENANCE_INTERRUPT_MODE_FLAGS :
0;
@@ -411,7 +412,7 @@ GicCv2IntcNodeParser (
RegSize = (AddressCells + SizeCells) * sizeof (UINT32);
- Data = fdt_getprop (Fdt, Gicv2IntcNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, Gicv2IntcNode, "reg", &DataSize);
if ((Data == NULL) ||
(DataSize < 0) ||
((DataSize % RegSize) != 0))
@@ -456,17 +457,17 @@ GicCv2IntcNodeParser (
// Patch the relevant fields of the CM_ARM_GICC_INFO objects.
for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
if (AddressCells == 2) {
- GicCInfo[Index].PhysicalBaseAddress = fdt64_to_cpu (*(UINT64 *)GicCValue);
+ GicCInfo[Index].PhysicalBaseAddress = Fdt64ToCpu (*(UINT64 *)GicCValue);
GicCInfo[Index].GICH = (GicHValue == NULL) ? 0 :
- fdt64_to_cpu (*(UINT64 *)GicHValue);
+ Fdt64ToCpu (*(UINT64 *)GicHValue);
GicCInfo[Index].GICV = (GicVValue == NULL) ? 0 :
- fdt64_to_cpu (*(UINT64 *)GicVValue);
+ Fdt64ToCpu (*(UINT64 *)GicVValue);
} else {
- GicCInfo[Index].PhysicalBaseAddress = fdt32_to_cpu (*(UINT32 *)GicCValue);
+ GicCInfo[Index].PhysicalBaseAddress = Fdt32ToCpu (*(UINT32 *)GicCValue);
GicCInfo[Index].GICH = (GicHValue == NULL) ? 0 :
- fdt32_to_cpu (*(UINT32 *)GicHValue);
+ Fdt32ToCpu (*(UINT32 *)GicHValue);
GicCInfo[Index].GICV = (GicVValue == NULL) ? 0 :
- fdt32_to_cpu (*(UINT32 *)GicVValue);
+ Fdt32ToCpu (*(UINT32 *)GicVValue);
}
} // for
@@ -549,10 +550,10 @@ GicCv3IntcNodeParser (
}
// The "#redistributor-regions" property is optional.
- Data = fdt_getprop (Fdt, Gicv3IntcNode, "#redistributor-regions", &DataSize);
+ Data = FdtGetProp (Fdt, Gicv3IntcNode, "#redistributor-regions", &DataSize);
if ((Data != NULL) && (DataSize == sizeof (UINT32))) {
- ASSERT (fdt32_to_cpu (*(UINT32 *)Data) > 1);
- AdditionalRedistReg = fdt32_to_cpu (*(UINT32 *)Data) - 1;
+ ASSERT (Fdt32ToCpu (*(UINT32 *)Data) > 1);
+ AdditionalRedistReg = Fdt32ToCpu (*(UINT32 *)Data) - 1;
} else {
AdditionalRedistReg = 0;
}
@@ -576,7 +577,7 @@ GicCv3IntcNodeParser (
minItems: 2
maxItems: 4096
*/
- Data = fdt_getprop (Fdt, Gicv3IntcNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, Gicv3IntcNode, "reg", &DataSize);
if ((Data == NULL) ||
(DataSize < 0) ||
((DataSize % RegSize) != 0))
@@ -644,22 +645,22 @@ GicCv3IntcNodeParser (
// GicR is discribed by the CM_ARM_GIC_REDIST_INFO object.
GicCInfo[Index].GICRBaseAddress = 0;
GicCInfo[Index].PhysicalBaseAddress = (GicCValue == NULL) ? 0 :
- fdt64_to_cpu (*(UINT64 *)GicCValue);
+ Fdt64ToCpu (*(UINT64 *)GicCValue);
GicCInfo[Index].GICH = (GicHValue == NULL) ? 0 :
- fdt64_to_cpu (*(UINT64 *)GicHValue);
+ Fdt64ToCpu (*(UINT64 *)GicHValue);
GicCInfo[Index].GICV = (GicVValue == NULL) ? 0 :
- fdt64_to_cpu (*(UINT64 *)GicVValue);
+ Fdt64ToCpu (*(UINT64 *)GicVValue);
}
} else {
for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
// GicR is discribed by the CM_ARM_GIC_REDIST_INFO object.
GicCInfo[Index].GICRBaseAddress = 0;
GicCInfo[Index].PhysicalBaseAddress = (GicCValue == NULL) ? 0 :
- fdt32_to_cpu (*(UINT32 *)GicCValue);
+ Fdt32ToCpu (*(UINT32 *)GicCValue);
GicCInfo[Index].GICH = (GicHValue == NULL) ? 0 :
- fdt32_to_cpu (*(UINT32 *)GicHValue);
+ Fdt32ToCpu (*(UINT32 *)GicHValue);
GicCInfo[Index].GICV = (GicVValue == NULL) ? 0 :
- fdt32_to_cpu (*(UINT32 *)GicVValue);
+ Fdt32ToCpu (*(UINT32 *)GicVValue);
}
}
@@ -745,7 +746,7 @@ GicCPmuNodeParser (
return Status;
}
- Data = fdt_getprop (Fdt, PmuNode, "interrupts", &DataSize);
+ Data = FdtGetProp (Fdt, PmuNode, "interrupts", &DataSize);
if ((Data == NULL) || (DataSize != (IntCells * sizeof (UINT32)))) {
// If error or not 1 interrupt.
ASSERT (Data != NULL);
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c
index d59219f375..8788dc82a3 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDParser.c
@@ -10,6 +10,7 @@
**/
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
#include "Arm/Gic/ArmGicDispatcher.h"
@@ -64,7 +65,7 @@ GicDIntcNodeParser (
return EFI_ABORTED;
}
- Data = fdt_getprop (Fdt, GicIntcNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, GicIntcNode, "reg", &DataSize);
if ((Data == NULL) || (DataSize < (INT32)(AddressCells * sizeof (UINT32)))) {
// If error or not enough space.
ASSERT (0);
@@ -72,9 +73,9 @@ GicDIntcNodeParser (
}
if (AddressCells == 2) {
- GicDInfo->PhysicalBaseAddress = fdt64_to_cpu (*(UINT64 *)Data);
+ GicDInfo->PhysicalBaseAddress = Fdt64ToCpu (*(UINT64 *)Data);
} else {
- GicDInfo->PhysicalBaseAddress = fdt32_to_cpu (*(UINT32 *)Data);
+ GicDInfo->PhysicalBaseAddress = Fdt32ToCpu (*(UINT32 *)Data);
}
return Status;
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c
index ca34d24a78..d289a2e79c 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicDispatcher.c
@@ -9,6 +9,7 @@
- linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
**/
+#include <Library/FdtLib.h>
#include "FdtHwInfoParser.h"
#include "Arm/Gic/ArmGicCParser.h"
#include "Arm/Gic/ArmGicDispatcher.h"
@@ -131,7 +132,7 @@ ArmGicDispatcher (
Fdt = FdtParserHandle->Fdt;
// The "cpus" node resides at the root of the DT. Fetch it.
- CpusNode = fdt_path_offset (Fdt, "/cpus");
+ CpusNode = FdtPathOffset (Fdt, "/cpus");
if (CpusNode < 0) {
return EFI_NOT_FOUND;
}
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c
index 253c22105e..606abca5a7 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicItsParser.c
@@ -9,6 +9,7 @@
**/
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
#include "Arm/Gic/ArmGicDispatcher.h"
@@ -65,7 +66,7 @@ GicItsIntcNodeParser (
return EFI_ABORTED;
}
- Data = fdt_getprop (Fdt, GicIntcNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, GicIntcNode, "reg", &DataSize);
if ((Data == NULL) || (DataSize < (INT32)(AddressCells * sizeof (UINT32)))) {
// If error or not enough space.
ASSERT (0);
@@ -73,9 +74,9 @@ GicItsIntcNodeParser (
}
if (AddressCells == 2) {
- GicItsInfo->PhysicalBaseAddress = fdt64_to_cpu (*(UINT64 *)Data);
+ GicItsInfo->PhysicalBaseAddress = Fdt64ToCpu (*(UINT64 *)Data);
} else {
- GicItsInfo->PhysicalBaseAddress = fdt32_to_cpu (*(UINT32 *)Data);
+ GicItsInfo->PhysicalBaseAddress = Fdt32ToCpu (*(UINT32 *)Data);
}
// Gic Its Id
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c
index daadcec4e0..376fdefe51 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicMsiFrameParser.c
@@ -10,6 +10,7 @@
**/
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
#include "Arm/Gic/ArmGicDispatcher.h"
@@ -77,7 +78,7 @@ MsiFrameNodeParser (
return EFI_ABORTED;
}
- Data = fdt_getprop (Fdt, MsiFrameNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, MsiFrameNode, "reg", &DataSize);
if ((Data == NULL) || (DataSize < (INT32)(AddressCells * sizeof (UINT32)))) {
// If error or not enough space.
ASSERT (0);
@@ -85,9 +86,9 @@ MsiFrameNodeParser (
}
if (AddressCells == 2) {
- MsiFrameInfo->PhysicalBaseAddress = fdt64_to_cpu (*(UINT64 *)Data);
+ MsiFrameInfo->PhysicalBaseAddress = Fdt64ToCpu (*(UINT64 *)Data);
} else {
- MsiFrameInfo->PhysicalBaseAddress = fdt32_to_cpu (*(UINT32 *)Data);
+ MsiFrameInfo->PhysicalBaseAddress = Fdt32ToCpu (*(UINT32 *)Data);
}
MsiFrameInfo->GicMsiFrameId = MsiFrameId;
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c
index 1c5bc97d98..da19fd6a03 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Arm/Gic/ArmGicRParser.c
@@ -9,6 +9,7 @@
**/
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
#include "Arm/Gic/ArmGicDispatcher.h"
@@ -76,10 +77,10 @@ GicRIntcNodeParser (
// The "#redistributor-regions" property is optional.
// It indicates the number of GicR.
- Data = fdt_getprop (Fdt, GicIntcNode, "#redistributor-regions", &DataSize);
+ Data = FdtGetProp (Fdt, GicIntcNode, "#redistributor-regions", &DataSize);
if ((Data != NULL) && (DataSize == sizeof (UINT32))) {
// If available, must be on one cell.
- RedistReg = fdt32_to_cpu (*(UINT32 *)Data);
+ RedistReg = Fdt32ToCpu (*(UINT32 *)Data);
} else {
// The DT Spec says GicR is mandatory so we will
// always have one.
@@ -124,7 +125,7 @@ GicRIntcNodeParser (
}
*/
RegSize = (AddressCells + SizeCells) * sizeof (UINT32);
- Data = fdt_getprop (Fdt, GicIntcNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, GicIntcNode, "reg", &DataSize);
if ((Data == NULL) ||
(DataSize < 0) ||
((DataSize % RegSize) != 0))
@@ -140,17 +141,17 @@ GicRIntcNodeParser (
ZeroMem (&GicRInfo, sizeof (CM_ARM_GIC_REDIST_INFO));
if (AddressCells == 2) {
- GicRInfo.DiscoveryRangeBaseAddress = fdt64_to_cpu (*(UINT64 *)Data);
+ GicRInfo.DiscoveryRangeBaseAddress = Fdt64ToCpu (*(UINT64 *)Data);
} else {
- GicRInfo.DiscoveryRangeBaseAddress = fdt32_to_cpu (*(UINT32 *)Data);
+ GicRInfo.DiscoveryRangeBaseAddress = Fdt32ToCpu (*(UINT32 *)Data);
}
Data += sizeof (UINT32) * AddressCells;
if (SizeCells == 2) {
- GicRInfo.DiscoveryRangeLength = (UINT32)fdt64_to_cpu (*(UINT64 *)Data);
+ GicRInfo.DiscoveryRangeLength = (UINT32)Fdt64ToCpu (*(UINT64 *)Data);
} else {
- GicRInfo.DiscoveryRangeLength = fdt32_to_cpu (*(UINT32 *)Data);
+ GicRInfo.DiscoveryRangeLength = Fdt32ToCpu (*(UINT32 *)Data);
}
// Add the CmObj to the Configuration Manager.
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c
index 8e980dabe3..1bff793439 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParser.c
@@ -5,6 +5,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
+#include <Library/FdtLib.h>
#include "FdtHwInfoParser.h"
/** Initialise the HwInfoParser.
@@ -40,7 +41,7 @@ HwInfoParserInit (
if ((ParserHandle == NULL) ||
(HwInfoAdd == NULL) ||
(HwDataSource == NULL) ||
- (fdt_check_header (HwDataSource) < 0))
+ (FdtCheckHeader (HwDataSource) < 0))
{
ASSERT (0);
return EFI_INVALID_PARAMETER;
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h
index 60f671eccc..80d69088c0 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserInclude.h
@@ -9,7 +9,6 @@
#define FDT_HW_INFO_PARSER_INCLUDE_H_
#include <Base.h>
-#include <libfdt.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c
index 9d8bd3e7fb..f734fbffa7 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtUtility.c
@@ -11,6 +11,7 @@
**/
#include <Library/BaseLib.h>
+#include <Library/FdtLib.h>
#include <FdtHwInfoParserInclude.h>
#include "FdtUtility.h"
@@ -47,7 +48,7 @@ FdtNodeHasName (
Length = (UINT32)AsciiStrLen (SearchName);
// Get the address of the node name.
- NodeName = fdt_offset_ptr (Fdt, Node + FDT_TAGSIZE, Length + 1);
+ NodeName = FdtOffsetPointer (Fdt, Node + FDT_TAGSIZE, Length + 1);
if (NodeName == NULL) {
return FALSE;
}
@@ -110,13 +111,13 @@ FdtNodeIsCompatible (
CompatibleTable = ((COMPATIBILITY_INFO *)CompatInfo)->CompatTable;
// Get the "compatible" property.
- Prop = fdt_getprop (Fdt, Node, "compatible", &PropLen);
+ Prop = FdtGetProp (Fdt, Node, "compatible", &PropLen);
if ((Prop == NULL) || (PropLen < 0)) {
return FALSE;
}
for (Index = 0; Index < Count; Index++) {
- if (fdt_stringlist_contains (
+ if (FdtStringListContains (
Prop,
PropLen,
CompatibleTable[Index].CompatStr
@@ -157,7 +158,7 @@ FdtNodeHasProperty (
return FALSE;
}
- Prop = fdt_getprop (Fdt, Node, PropertyName, &Size);
+ Prop = FdtGetProp (Fdt, Node, PropertyName, &Size);
if ((Prop == NULL) || (Size < 0)) {
return FALSE;
}
@@ -218,7 +219,7 @@ FdtGetNextCondNode (
CurrNode = *Node;
do {
- CurrNode = fdt_next_node (Fdt, CurrNode, Depth);
+ CurrNode = FdtNextNode (Fdt, CurrNode, Depth);
if ((CurrNode == -FDT_ERR_NOTFOUND) ||
(*Depth < 0))
{
@@ -292,9 +293,9 @@ FdtGetNextCondNodeInBranch (
// First, check the Node is in the sub-nodes of the branch.
// This allows to find the relative depth of Node in the branch.
if (CurrNode != *Node) {
- for (CurrNode = fdt_next_node (Fdt, CurrNode, &Depth);
+ for (CurrNode = FdtNextNode (Fdt, CurrNode, &Depth);
(CurrNode >= 0) && (Depth > 0);
- CurrNode = fdt_next_node (Fdt, CurrNode, &Depth))
+ CurrNode = FdtNextNode (Fdt, CurrNode, &Depth))
{
if (CurrNode == *Node) {
// Node found.
@@ -666,18 +667,18 @@ FdtGetIntcParentNode (
while (TRUE) {
// Check whether the node has the "interrupt-controller" property.
- Prop = fdt_getprop (Fdt, Node, "interrupt-controller", &Size);
+ Prop = FdtGetProp (Fdt, Node, "interrupt-controller", &Size);
if ((Prop != NULL) && (Size >= 0)) {
// The interrupt-controller has been found.
*IntcNode = Node;
return EFI_SUCCESS;
} else {
// Check whether the node has the "interrupt-parent" property.
- PHandle = fdt_getprop (Fdt, Node, "interrupt-parent", &Size);
+ PHandle = FdtGetProp (Fdt, Node, "interrupt-parent", &Size);
if ((PHandle != NULL) && (Size == sizeof (UINT32))) {
// The phandle of the interrupt-controller has been found.
// Search the node having this phandle and return it.
- Node = fdt_node_offset_by_phandle (Fdt, fdt32_to_cpu (*PHandle));
+ Node = FdtNodeOffsetByPhandle (Fdt, Fdt32ToCpu (*PHandle));
if (Node < 0) {
ASSERT (0);
return EFI_ABORTED;
@@ -697,7 +698,7 @@ FdtGetIntcParentNode (
}
// Get the parent of the node.
- Node = fdt_parent_offset (Fdt, Node);
+ Node = FdtParentOffset (Fdt, Node);
if (Node < 0) {
// An error occurred.
ASSERT (0);
@@ -739,14 +740,14 @@ FdtGetInterruptCellsInfo (
return EFI_INVALID_PARAMETER;
}
- Data = fdt_getprop (Fdt, IntcNode, "#interrupt-cells", &Size);
+ Data = FdtGetProp (Fdt, IntcNode, "#interrupt-cells", &Size);
if ((Data == NULL) || (Size != sizeof (UINT32))) {
// If error or not on one UINT32 cell.
ASSERT (0);
return EFI_ABORTED;
}
- *IntCells = fdt32_to_cpu (*Data);
+ *IntCells = Fdt32ToCpu (*Data);
return EFI_SUCCESS;
}
@@ -788,7 +789,7 @@ FdtGetAddressInfo (
}
if (AddressCells != NULL) {
- *AddressCells = fdt_address_cells (Fdt, Node);
+ *AddressCells = FdtAddressCells (Fdt, Node);
if (*AddressCells < 0) {
ASSERT (0);
return EFI_ABORTED;
@@ -796,7 +797,7 @@ FdtGetAddressInfo (
}
if (SizeCells != NULL) {
- *SizeCells = fdt_size_cells (Fdt, Node);
+ *SizeCells = FdtSizeCells (Fdt, Node);
if (*SizeCells < 0) {
ASSERT (0);
return EFI_ABORTED;
@@ -842,7 +843,7 @@ FdtGetParentAddressInfo (
return EFI_INVALID_PARAMETER;
}
- Node = fdt_parent_offset (Fdt, Node);
+ Node = FdtParentOffset (Fdt, Node);
if (Node < 0) {
// End of the tree, or an error occurred.
ASSERT (0);
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
index 466538ebc8..f7b8dc98f6 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Pci/PciConfigSpaceParser.c
@@ -15,6 +15,7 @@
#include "CmObjectDescUtility.h"
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include "FdtHwInfoParser.h"
#include "Pci/PciConfigSpaceParser.h"
@@ -72,7 +73,7 @@ GetPciSegGroup (
return EFI_INVALID_PARAMETER;
}
- Data = fdt_getprop (Fdt, HostPciNode, "linux,pci-domain", &DataSize);
+ Data = FdtGetProp (Fdt, HostPciNode, "linux,pci-domain", &DataSize);
if ((Data == NULL) || (DataSize < 0)) {
// Did not find property, assign the DomainIds ourselves.
if (LocalSegGroup < 0) {
@@ -98,7 +99,7 @@ GetPciSegGroup (
// nodes must have it.
LocalSegGroup = -1;
- *SegGroup = fdt32_to_cpu (*(UINT32 *)Data);
+ *SegGroup = Fdt32ToCpu (*(UINT32 *)Data);
return EFI_SUCCESS;
}
@@ -134,15 +135,15 @@ PopulateBusRange (
return EFI_INVALID_PARAMETER;
}
- Data = fdt_getprop (Fdt, HostPciNode, "bus-range", &DataSize);
+ Data = FdtGetProp (Fdt, HostPciNode, "bus-range", &DataSize);
if ((Data == NULL) || (DataSize < 0)) {
// No evidence this property is mandatory. Use default values.
StartBus = 0;
EndBus = 255;
} else if (DataSize == (2 * sizeof (UINT32))) {
// If available, the property is on two integers.
- StartBus = fdt32_to_cpu (((UINT32 *)Data)[0]);
- EndBus = fdt32_to_cpu (((UINT32 *)Data)[1]);
+ StartBus = Fdt32ToCpu (((UINT32 *)Data)[0]);
+ EndBus = Fdt32ToCpu (((UINT32 *)Data)[1]);
} else {
ASSERT (0);
return EFI_ABORTED;
@@ -195,7 +196,7 @@ ParseAddressMap (
AddressMapSize = (PCI_ADDRESS_CELLS + AddressCells + PCI_SIZE_CELLS) *
sizeof (UINT32);
- Data = fdt_getprop (Fdt, HostPciNode, "ranges", &DataSize);
+ Data = FdtGetProp (Fdt, HostPciNode, "ranges", &DataSize);
if ((Data == NULL) ||
(DataSize < 0) ||
((DataSize % AddressMapSize) != 0))
@@ -219,29 +220,29 @@ ParseAddressMap (
Offset = Index * AddressMapSize;
// Pci address attributes
- PciAddressAttr = fdt32_to_cpu (*(UINT32 *)&Data[Offset]);
+ PciAddressAttr = Fdt32ToCpu (*(UINT32 *)&Data[Offset]);
PciAddressMapInfo[Index].SpaceCode = READ_PCI_SS (PciAddressAttr);
Offset += sizeof (UINT32);
// Pci address
PciAddressMapInfo[Index].PciAddress =
- fdt64_to_cpu (*(UINT64 *)&Data[Offset]);
+ Fdt64ToCpu (*(UINT64 *)&Data[Offset]);
Offset += (PCI_ADDRESS_CELLS - 1) * sizeof (UINT32);
// Cpu address
if (AddressCells == 2) {
PciAddressMapInfo[Index].CpuAddress =
- fdt64_to_cpu (*(UINT64 *)&Data[Offset]);
+ Fdt64ToCpu (*(UINT64 *)&Data[Offset]);
} else {
PciAddressMapInfo[Index].CpuAddress =
- fdt32_to_cpu (*(UINT32 *)&Data[Offset]);
+ Fdt32ToCpu (*(UINT32 *)&Data[Offset]);
}
Offset += AddressCells * sizeof (UINT32);
// Address size
PciAddressMapInfo[Index].AddressSize =
- fdt64_to_cpu (*(UINT64 *)&Data[Offset]);
+ Fdt64ToCpu (*(UINT64 *)&Data[Offset]);
Offset += PCI_SIZE_CELLS * sizeof (UINT32);
} // for
@@ -313,7 +314,7 @@ ParseIrqMap (
CM_ARCH_COMMON_PCI_INTERRUPT_MAP_INFO *PciInterruptMapInfo;
UINT32 BufferSize;
- Data = fdt_getprop (Fdt, HostPciNode, "interrupt-map", &DataSize);
+ Data = FdtGetProp (Fdt, HostPciNode, "interrupt-map", &DataSize);
if ((Data == NULL) || (DataSize <= 0)) {
DEBUG ((
DEBUG_WARN,
@@ -337,7 +338,7 @@ ParseIrqMap (
return EFI_ABORTED;
}
- IrqMapMask = fdt_getprop (
+ IrqMapMask = FdtGetProp (
Fdt,
HostPciNode,
"interrupt-map-mask",
@@ -358,8 +359,8 @@ ParseIrqMap (
return EFI_ABORTED;
}
- IntcPhandle = fdt32_to_cpu (*(UINT32 *)&Data[PHandleOffset]);
- IntcNode = fdt_node_offset_by_phandle (Fdt, IntcPhandle);
+ IntcPhandle = Fdt32ToCpu (*(UINT32 *)&Data[PHandleOffset]);
+ IntcNode = FdtNodeOffsetByPhandle (Fdt, IntcPhandle);
if (IntcNode < 0) {
ASSERT (0);
return EFI_ABORTED;
@@ -394,7 +395,7 @@ ParseIrqMap (
// We assume the same interrupt-controller is used for all the mappings.
// Check this is correct.
for (Index = 0; Index < IrqMapCount; Index++) {
- if (IntcPhandle != fdt32_to_cpu (
+ if (IntcPhandle != Fdt32ToCpu (
*(UINT32 *)&Data[(Index * IrqMapSize) + PHandleOffset]
))
{
@@ -416,7 +417,7 @@ ParseIrqMap (
Offset = Index * IrqMapSize;
// Pci address attributes
- PciAddressAttr = fdt32_to_cpu (
+ PciAddressAttr = Fdt32ToCpu (
(*(UINT32 *)&Data[Offset]) &
(*(UINT32 *)&IrqMapMask[0])
);
@@ -425,7 +426,7 @@ ParseIrqMap (
Offset += PCI_ADDRESS_CELLS * sizeof (UINT32);
// Pci irq
- PciInterruptMapInfo[Index].PciInterrupt = fdt32_to_cpu (
+ PciInterruptMapInfo[Index].PciInterrupt = Fdt32ToCpu (
(*(UINT32 *)&Data[Offset]) &
(*(UINT32 *)&IrqMapMask[3 * sizeof (UINT32)])
);
@@ -527,7 +528,7 @@ PciNodeParser (
return EFI_ABORTED;
}
- Data = fdt_getprop (Fdt, HostPciNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, HostPciNode, "reg", &DataSize);
if ((Data == NULL) ||
(DataSize != ((AddressCells + SizeCells) * sizeof (UINT32))))
{
@@ -538,9 +539,9 @@ PciNodeParser (
// Base address
if (AddressCells == 2) {
- PciInfo->PciConfigSpaceInfo.BaseAddress = fdt64_to_cpu (*(UINT64 *)Data);
+ PciInfo->PciConfigSpaceInfo.BaseAddress = Fdt64ToCpu (*(UINT64 *)Data);
} else {
- PciInfo->PciConfigSpaceInfo.BaseAddress = fdt32_to_cpu (*(UINT32 *)Data);
+ PciInfo->PciConfigSpaceInfo.BaseAddress = Fdt32ToCpu (*(UINT32 *)Data);
}
// Address map
diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
index 34659001c3..8a25d5b3f9 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/SerialPortParser.c
@@ -14,6 +14,7 @@
#include <IndustryStandard/DebugPort2Table.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include "CmObjectDescUtility.h"
#include "FdtHwInfoParser.h"
@@ -129,7 +130,7 @@ SerialPortNodeParser (
return EFI_ABORTED;
}
- Data = fdt_getprop (Fdt, SerialPortNode, "reg", &DataSize);
+ Data = FdtGetProp (Fdt, SerialPortNode, "reg", &DataSize);
if ((Data == NULL) ||
(DataSize < (INT32)(sizeof (UINT32) *
GET_DT_REG_ADDRESS_OFFSET (1, AddressCells, SizeCells)) - 1))
@@ -140,17 +141,17 @@ SerialPortNodeParser (
}
if (AddressCells == 2) {
- SerialPortInfo->BaseAddress = fdt64_to_cpu (*(UINT64 *)Data);
+ SerialPortInfo->BaseAddress = Fdt64ToCpu (*(UINT64 *)Data);
} else {
- SerialPortInfo->BaseAddress = fdt32_to_cpu (*(UINT32 *)Data);
+ SerialPortInfo->BaseAddress = Fdt32ToCpu (*(UINT32 *)Data);
}
SizeValue = Data + (sizeof (UINT32) *
GET_DT_REG_SIZE_OFFSET (0, AddressCells, SizeCells));
if (SizeCells == 2) {
- SerialPortInfo->BaseAddressLength = fdt64_to_cpu (*(UINT64 *)SizeValue);
+ SerialPortInfo->BaseAddressLength = Fdt64ToCpu (*(UINT64 *)SizeValue);
} else {
- SerialPortInfo->BaseAddressLength = fdt32_to_cpu (*(UINT32 *)SizeValue);
+ SerialPortInfo->BaseAddressLength = Fdt32ToCpu (*(UINT32 *)SizeValue);
}
// Get the associated interrupt-controller.
@@ -172,7 +173,7 @@ SerialPortNodeParser (
return Status;
}
- Data = fdt_getprop (Fdt, SerialPortNode, "interrupts", &DataSize);
+ Data = FdtGetProp (Fdt, SerialPortNode, "interrupts", &DataSize);
if ((Data == NULL) || (DataSize != (IntCells * sizeof (UINT32)))) {
// If error or not 1 interrupt.
ASSERT (0);
@@ -182,20 +183,20 @@ SerialPortNodeParser (
SerialPortInfo->Interrupt = FdtGetInterruptId ((CONST UINT32 *)Data);
// Note: clock-frequency is optional for SBSA UART.
- Data = fdt_getprop (Fdt, SerialPortNode, "clock-frequency", &DataSize);
+ Data = FdtGetProp (Fdt, SerialPortNode, "clock-frequency", &DataSize);
if (Data != NULL) {
if (DataSize < sizeof (UINT32)) {
// If error or not enough space.
ASSERT (0);
return EFI_ABORTED;
- } else if (fdt_node_offset_by_phandle (Fdt, fdt32_to_cpu (*Data)) >= 0) {
+ } else if (FdtNodeOffsetByPhandle (Fdt, Fdt32ToCpu (*Data)) >= 0) {
// "clock-frequency" can be a "clocks phandle to refer to the clk used".
// This is not supported.
ASSERT (0);
return EFI_UNSUPPORTED;
}
- SerialPortInfo->Clock = fdt32_to_cpu (*(UINT32 *)Data);
+ SerialPortInfo->Clock = Fdt32ToCpu (*(UINT32 *)Data);
}
if (FdtNodeIsCompatible (Fdt, SerialPortNode, &Serial16550CompatibleInfo)) {
@@ -208,7 +209,7 @@ SerialPortNodeParser (
device. There are some systems that require 32-bit accesses to the
UART.
*/
- Data = fdt_getprop (Fdt, SerialPortNode, "reg-io-width", &DataSize);
+ Data = FdtGetProp (Fdt, SerialPortNode, "reg-io-width", &DataSize);
if (Data != NULL) {
if (DataSize < sizeof (UINT32)) {
// If error or not enough space.
@@ -216,7 +217,7 @@ SerialPortNodeParser (
return EFI_ABORTED;
}
- AccessSize = fdt32_to_cpu (*(UINT32 *)Data);
+ AccessSize = Fdt32ToCpu (*(UINT32 *)Data);
if (AccessSize > EFI_ACPI_6_3_QWORD) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
@@ -281,12 +282,12 @@ GetSerialConsoleNode (
}
// The "chosen" node resides at the root of the DT. Fetch it.
- ChosenNode = fdt_path_offset (Fdt, "/chosen");
+ ChosenNode = FdtPathOffset (Fdt, "/chosen");
if (ChosenNode < 0) {
return EFI_NOT_FOUND;
}
- Prop = fdt_getprop (Fdt, ChosenNode, "stdout-path", &PropSize);
+ Prop = FdtGetProp (Fdt, ChosenNode, "stdout-path", &PropSize);
if ((Prop == NULL) || (PropSize < 0)) {
return EFI_NOT_FOUND;
}
@@ -301,17 +302,17 @@ GetSerialConsoleNode (
// Aliases cannot start with a '/', so it must be the actual path.
if (Prop[0] == '/') {
- *SerialConsoleNode = fdt_path_offset_namelen (Fdt, Prop, PathLen);
+ *SerialConsoleNode = FdtPathOffsetNameLen (Fdt, Prop, PathLen);
return EFI_SUCCESS;
}
// Lookup the alias, as this contains the actual path.
- Path = fdt_get_alias_namelen (Fdt, Prop, PathLen);
+ Path = FdtGetAliasNameLen (Fdt, Prop, PathLen);
if (Path == NULL) {
return EFI_NOT_FOUND;
}
- *SerialConsoleNode = fdt_path_offset (Fdt, Path);
+ *SerialConsoleNode = FdtPathOffset (Fdt, Path);
return EFI_SUCCESS;
}
diff --git a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
index e846394180..f1a6f78f50 100644
--- a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
+++ b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.c
@@ -8,11 +8,11 @@
#include <Uefi.h>
#include <IndustryStandard/Acpi.h>
-#include <libfdt.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
+#include <Library/FdtLib.h>
#include <Library/HiiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
@@ -123,18 +123,18 @@ RemoveDtStdoutPath (
return;
}
- Node = fdt_path_offset (Dtb, "/chosen");
+ Node = FdtPathOffset (Dtb, "/chosen");
if (Node < 0) {
return;
}
- Error = fdt_delprop (Dtb, Node, "stdout-path");
+ Error = FdtDelProp (Dtb, Node, "stdout-path");
if (Error) {
DEBUG ((
DEBUG_INFO,
"%a: Failed to delete 'stdout-path' property: %a\n",
__func__,
- fdt_strerror (Error)
+ FdtStrerror (Error)
));
}
}
diff --git a/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c b/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
index 42d9281b29..6d2fea6c41 100644
--- a/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
+++ b/EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.c
@@ -9,10 +9,10 @@
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/HobLib.h>
-#include <libfdt.h>
#include <Guid/Fdt.h>
#include <Guid/FdtHob.h>
@@ -38,7 +38,7 @@ GetNodeProperty (
ASSERT (mDeviceTreeBase != NULL);
ASSERT (Prop != NULL);
- *Prop = fdt_getprop (mDeviceTreeBase, Node, PropertyName, &Len);
+ *Prop = FdtGetProp (mDeviceTreeBase, Node, PropertyName, &Len);
if (*Prop == NULL) {
return EFI_NOT_FOUND;
}
@@ -65,7 +65,7 @@ SetNodeProperty (
ASSERT (mDeviceTreeBase != NULL);
- Ret = fdt_setprop (mDeviceTreeBase, Node, PropertyName, Prop, PropSize);
+ Ret = FdtSetProp (mDeviceTreeBase, Node, PropertyName, Prop, PropSize);
if (Ret != 0) {
return EFI_DEVICE_ERROR;
}
@@ -87,7 +87,7 @@ IsNodeEnabled (
// may occur here. If the status property is present, check whether
// it is set to 'ok' or 'okay', anything else is treated as 'disabled'.
//
- NodeStatus = fdt_getprop (mDeviceTreeBase, Node, "status", &Len);
+ NodeStatus = FdtGetProp (mDeviceTreeBase, Node, "status", &Len);
if (NodeStatus == NULL) {
return TRUE;
}
@@ -121,7 +121,7 @@ FindNextCompatibleNode (
ASSERT (Node != NULL);
for (Prev = PrevNode; ; Prev = Next) {
- Next = fdt_next_node (mDeviceTreeBase, Prev, NULL);
+ Next = FdtNextNode (mDeviceTreeBase, Prev, NULL);
if (Next < 0) {
break;
}
@@ -130,7 +130,7 @@ FindNextCompatibleNode (
continue;
}
- Type = fdt_getprop (mDeviceTreeBase, Next, "compatible", &Len);
+ Type = FdtGetProp (mDeviceTreeBase, Next, "compatible", &Len);
if (Type == NULL) {
continue;
}
@@ -257,12 +257,12 @@ FindNextMemoryNodeReg (
ASSERT (Node != NULL);
for (Prev = PrevNode; ; Prev = Next) {
- Next = fdt_next_node (mDeviceTreeBase, Prev, NULL);
+ Next = FdtNextNode (mDeviceTreeBase, Prev, NULL);
if (Next < 0) {
break;
}
- DeviceType = fdt_getprop (mDeviceTreeBase, Next, "device_type", &Len);
+ DeviceType = FdtGetProp (mDeviceTreeBase, Next, "device_type", &Len);
if ((DeviceType == NULL) || (AsciiStrCmp (DeviceType, "memory") != 0)) {
continue;
}
@@ -342,9 +342,9 @@ GetOrInsertChosenNode (
ASSERT (mDeviceTreeBase != NULL);
ASSERT (Node != NULL);
- NewNode = fdt_path_offset (mDeviceTreeBase, "/chosen");
+ NewNode = FdtPathOffset (mDeviceTreeBase, "/chosen");
if (NewNode < 0) {
- NewNode = fdt_add_subnode (mDeviceTreeBase, 0, "/chosen");
+ NewNode = FdtAddSubnode (mDeviceTreeBase, 0, "/chosen");
}
if (NewNode < 0) {
@@ -422,7 +422,7 @@ InitializeFdtClientDxe (
DeviceTreeBase = (VOID *)(UINTN)*(UINT64 *)GET_GUID_HOB_DATA (Hob);
- if (fdt_check_header (DeviceTreeBase) != 0) {
+ if (FdtCheckHeader (DeviceTreeBase) != 0) {
DEBUG ((
DEBUG_ERROR,
"%a: No DTB found @ 0x%p\n",
diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc
index 2259c8fcec..482329127e 100644
--- a/EmbeddedPkg/EmbeddedPkg.dsc
+++ b/EmbeddedPkg/EmbeddedPkg.dsc
@@ -90,7 +90,7 @@
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+ FdtLib|MdePkg/Library/BaseFdtLib/BaseFdtLib.inf
# Shell libraries
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
diff --git a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
index 1a0c92d4de..9c1621343f 100644
--- a/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
+++ b/EmbeddedPkg/Library/AndroidBootImgLib/AndroidBootImgLib.c
@@ -7,9 +7,9 @@
**/
-#include <libfdt.h>
#include <Library/AndroidBootImgLib.h>
#include <Library/BaseMemoryLib.h>
+#include <Library/FdtLib.h>
#include <Library/PrintLib.h>
#include <Library/DevicePathLib.h>
#include <Library/UefiBootServicesTableLib.h>
@@ -434,7 +434,7 @@ AndroidBootImgLocateFdt (
return Status;
}
- Err = fdt_check_header (*FdtBase);
+ Err = FdtCheckHeader (*FdtBase);
if (Err != 0) {
DEBUG ((
DEBUG_ERROR,
@@ -454,9 +454,9 @@ AndroidBootImgGetChosenNode (
{
INTN ChosenNode;
- ChosenNode = fdt_subnode_offset ((CONST VOID *)UpdatedFdtBase, 0, "chosen");
+ ChosenNode = FdtSubnodeOffset ((CONST VOID *)UpdatedFdtBase, 0, "chosen");
if (ChosenNode < 0) {
- ChosenNode = fdt_add_subnode ((VOID *)UpdatedFdtBase, 0, "chosen");
+ ChosenNode = FdtAddSubnode ((VOID *)UpdatedFdtBase, 0, "chosen");
if (ChosenNode < 0) {
DEBUG ((DEBUG_ERROR, "Fail to find fdt node chosen!\n"));
return 0;
@@ -474,19 +474,19 @@ AndroidBootImgSetProperty64 (
IN UINT64 Val
)
{
- INTN Err;
- struct fdt_property *Property;
- int Len;
+ INTN Err;
+ CONST FDT_PROPERTY *Property;
+ int Len;
- Property = fdt_get_property_w (
+ Property = FdtGetPropertyW (
(VOID *)UpdatedFdtBase,
ChosenNode,
PropertyName,
&Len
);
if ((NULL == Property) && (Len == -FDT_ERR_NOTFOUND)) {
- Val = cpu_to_fdt64 (Val);
- Err = fdt_appendprop (
+ Val = CpuToFdt64 (Val);
+ Err = FdtAppendProp (
(VOID *)UpdatedFdtBase,
ChosenNode,
PropertyName,
@@ -494,18 +494,18 @@ AndroidBootImgSetProperty64 (
sizeof (UINT64)
);
if (Err) {
- DEBUG ((DEBUG_ERROR, "fdt_appendprop() fail: %a\n", fdt_strerror (Err)));
+ DEBUG ((DEBUG_ERROR, "FdtAppendProp() fail: %a\n", FdtStrerror (Err)));
return EFI_INVALID_PARAMETER;
}
} else if (Property != NULL) {
- Err = fdt_setprop_u64 (
+ Err = FdtSetPropU64 (
(VOID *)UpdatedFdtBase,
ChosenNode,
PropertyName,
Val
);
if (Err) {
- DEBUG ((DEBUG_ERROR, "fdt_setprop_u64() fail: %a\n", fdt_strerror (Err)));
+ DEBUG ((DEBUG_ERROR, "FdtSetpropU64() fail: %a\n", FdtStrerror (Err)));
return EFI_INVALID_PARAMETER;
}
} else {
@@ -528,7 +528,7 @@ AndroidBootImgUpdateFdt (
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS UpdatedFdtBase, NewFdtBase;
- NewFdtSize = (UINTN)fdt_totalsize (FdtBase)
+ NewFdtSize = (UINTN)FdtTotalSize (FdtBase)
+ FDT_ADDITIONAL_ENTRIES_SIZE;
Status = gBS->AllocatePages (
AllocateAnyPages,
@@ -546,9 +546,9 @@ AndroidBootImgUpdateFdt (
}
// Load the Original FDT tree into the new region
- Err = fdt_open_into (FdtBase, (VOID *)(INTN)UpdatedFdtBase, NewFdtSize);
+ Err = FdtOpenInto (FdtBase, (VOID *)(INTN)UpdatedFdtBase, NewFdtSize);
if (Err) {
- DEBUG ((DEBUG_ERROR, "fdt_open_into(): %a\n", fdt_strerror (Err)));
+ DEBUG ((DEBUG_ERROR, "FdtOpenInto(): %a\n", FdtStrerror (Err)));
Status = EFI_INVALID_PARAMETER;
goto Fdt_Exit;
}
diff --git a/MdeModulePkg/Bus/Spi/SpiBus/SpiBus.c b/MdeModulePkg/Bus/Spi/SpiBus/SpiBus.c
index b183ca182c..61ddbe5200 100644
--- a/MdeModulePkg/Bus/Spi/SpiBus/SpiBus.c
+++ b/MdeModulePkg/Bus/Spi/SpiBus/SpiBus.c
@@ -329,8 +329,17 @@ Transaction (
((SpiChip->SpiHc->Attributes & HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS) != HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS))
{
// Convert to full duplex transaction
- DummyReadBuffer = AllocateZeroPool (WriteBytes);
- DummyWriteBuffer = AllocateZeroPool (ReadBytes);
+ DummyReadBuffer = AllocateZeroPool (WriteBytes);
+ if (DummyReadBuffer == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ DummyWriteBuffer = AllocateZeroPool (ReadBytes);
+ if (DummyWriteBuffer == NULL) {
+ FreePool (DummyReadBuffer);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
SpiChip->BusTransaction.ReadBuffer = DummyReadBuffer;
SpiChip->BusTransaction.ReadBytes = WriteBytes;
diff --git a/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c b/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c
index cd0a2c99a2..a2b77e79c6 100644
--- a/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c
+++ b/MdeModulePkg/Bus/Spi/SpiBus/SpiBusDxe.c
@@ -108,7 +108,7 @@ SpiBusEntry (
// Get SpiHc from the SpiHcHandles
Status = gBS->HandleProtocol (
SpiHcHandles[HcIndex],
- &gEfiDevicePathProtocolGuid,
+ &gEfiSpiHcProtocolGuid,
(VOID **)&SpiHc
);
diff --git a/MdePkg/Include/Library/FdtLib.h b/MdePkg/Include/Library/FdtLib.h
index a7d26f765d..7bb48ad931 100644
--- a/MdePkg/Include/Library/FdtLib.h
+++ b/MdePkg/Include/Library/FdtLib.h
@@ -421,6 +421,24 @@ FdtSubnodeOffsetNameLen (
);
/**
+ Returns a offset of first node which matches the given name.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] ParentOffset The offset to the node which start find under.
+ @param[in] Name The name to search the node with the name.
+
+ @return The offset to node offset with given node name.
+
+ **/
+INT32
+EFIAPI
+FdtSubnodeOffset (
+ IN CONST VOID *Fdt,
+ IN INT32 ParentOffset,
+ IN CONST CHAR8 *Name
+ );
+
+/**
Returns the number of memory reserve map entries.
@param[in] Fdt The pointer to FDT blob.
@@ -545,6 +563,49 @@ FdtGetProperty (
);
/**
+ Returns a property with the given name from the given node.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset The offset to the given node.
+ @param[in] Name The name to the property which need be searched
+ @param[in] Length The length to the size of the property found.
+
+ @return The property to the structure of the found property. Since the data
+ come from FDT blob, it's encoding with big-endian.
+
+**/
+FDT_PROPERTY *
+EFIAPI
+FdtGetPropertyW (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN CONST CHAR8 *Name,
+ IN INT32 *Length
+ );
+
+/**
+ Returns the value of a given property.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset The offset to the given node.
+ @param[in] Name The name to the property which need be searched
+ @param[in] Length The length to the size of the property found.
+
+ @return Pointer to the value of the property.
+ Since the data comes from the FDT blob, it's encoded as big-endian.
+ NULL on error, with error-code stored at Length (if non-NULL).
+
+**/
+CONST VOID *
+EFIAPI
+FdtGetProp (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN CONST CHAR8 *Name,
+ IN INT32 *Length
+ );
+
+/**
Returns a pointer to a node mapped to an alias matching a substring.
@param[in] Fdt The pointer to FDT blob.
@@ -663,7 +724,7 @@ FdtAddSubnode (
**/
INT32
EFIAPI
-FdtSetProperty (
+FdtSetProp (
IN VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name,
diff --git a/MdePkg/Library/BaseFdtLib/FdtLib.c b/MdePkg/Library/BaseFdtLib/FdtLib.c
index ebddf4a00f..7f2dff01c8 100644
--- a/MdePkg/Library/BaseFdtLib/FdtLib.c
+++ b/MdePkg/Library/BaseFdtLib/FdtLib.c
@@ -380,7 +380,7 @@ FdtParentOffset (
**/
INT32
EFIAPI
-FdtNodeOffsetByPropertyValue (
+FdtNodeOffsetByPropValue (
IN CONST VOID *Fdt,
IN INT32 StartOffset,
IN CONST CHAR8 *PropertyName,
@@ -454,6 +454,55 @@ FdtGetProperty (
}
/**
+ Returns a property with the given name from the given node.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset The offset to the given node.
+ @param[in] Name The name to the property which need be searched
+ @param[in] Length The length to the size of the property found.
+
+ @return The property to the structure of the found property. Since the data
+ come from FDT blob, it's encoding with big-endian.
+
+**/
+FDT_PROPERTY *
+EFIAPI
+FdtGetPropertyW (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN CONST CHAR8 *Name,
+ IN INT32 *Length
+ )
+{
+ return (FDT_PROPERTY *)fdt_get_property (Fdt, NodeOffset, Name, Length);
+}
+
+/**
+ Returns the value of a given property.
+
+ @param[in] Fdt The pointer to FDT blob.
+ @param[in] NodeOffset The offset to the given node.
+ @param[in] Name The name to the property which need be searched
+ @param[in] Length The length to the size of the property found.
+
+ @return Pointer to the value of the property.
+ Since the data comes from the FDT blob, it's encoded as big-endian.
+ NULL on error, with error-code stored at Length (if non-NULL).
+
+**/
+CONST VOID *
+EFIAPI
+FdtGetProp (
+ IN CONST VOID *Fdt,
+ IN INT32 NodeOffset,
+ IN CONST CHAR8 *Name,
+ IN INT32 *Length
+ )
+{
+ return fdt_getprop (Fdt, NodeOffset, Name, Length);
+}
+
+/**
Returns a pointer to a node mapped to an alias matching a substring.
@param[in] Fdt The pointer to FDT blob.
@@ -590,7 +639,7 @@ FdtAddSubnode (
**/
INT32
EFIAPI
-FdtSetProperty (
+FdtSetProp (
IN VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name,
diff --git a/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c b/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c
index f6508e0989..a90d62627d 100644
--- a/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c
+++ b/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.c
@@ -11,8 +11,8 @@
**/
#include <Library/BaseLib.h>
+#include <Library/FdtLib.h>
#include <Library/FdtSerialPortAddressLib.h>
-#include <libfdt.h>
/**
Read the "reg" property of Node in DeviceTree as a UINT64 base address.
@@ -46,12 +46,12 @@ GetBaseAddress (
CONST VOID *RegProp;
INT32 PropSize;
- NodeStatus = fdt_getprop (DeviceTree, Node, "status", NULL);
+ NodeStatus = FdtGetProp (DeviceTree, Node, "status", NULL);
if ((NodeStatus != NULL) && (AsciiStrCmp (NodeStatus, "okay") != 0)) {
return RETURN_DEVICE_ERROR;
}
- RegProp = fdt_getprop (DeviceTree, Node, "reg", &PropSize);
+ RegProp = FdtGetProp (DeviceTree, Node, "reg", &PropSize);
if (RegProp == NULL) {
return RETURN_NOT_FOUND;
}
@@ -60,7 +60,7 @@ GetBaseAddress (
return RETURN_BAD_BUFFER_SIZE;
}
- *BaseAddress = fdt64_to_cpu (ReadUnaligned64 (RegProp));
+ *BaseAddress = Fdt64ToCpu (ReadUnaligned64 (RegProp));
return RETURN_SUCCESS;
}
@@ -99,19 +99,19 @@ FdtSerialGetPorts (
{
INT32 Node;
- if (fdt_check_header (DeviceTree) != 0) {
+ if (FdtCheckHeader (DeviceTree) != 0) {
return RETURN_INVALID_PARAMETER;
}
Ports->NumberOfPorts = 0;
- Node = fdt_next_node (DeviceTree, 0, NULL);
+ Node = FdtNextNode (DeviceTree, 0, NULL);
while ((Node > 0) &&
(Ports->NumberOfPorts < ARRAY_SIZE (Ports->BaseAddress)))
{
CONST CHAR8 *CompatProp;
INT32 PropSize;
- CompatProp = fdt_getprop (DeviceTree, Node, "compatible", &PropSize);
+ CompatProp = FdtGetProp (DeviceTree, Node, "compatible", &PropSize);
if (CompatProp != NULL) {
CONST CHAR8 *CompatItem;
@@ -133,7 +133,7 @@ FdtSerialGetPorts (
}
}
- Node = fdt_next_node (DeviceTree, Node, NULL);
+ Node = FdtNextNode (DeviceTree, Node, NULL);
}
return Ports->NumberOfPorts > 0 ? RETURN_SUCCESS : RETURN_NOT_FOUND;
@@ -178,16 +178,16 @@ FdtSerialGetConsolePort (
INT32 ConsoleNode;
RETURN_STATUS Status;
- if (fdt_check_header (DeviceTree) != 0) {
+ if (FdtCheckHeader (DeviceTree) != 0) {
return RETURN_INVALID_PARAMETER;
}
- ChosenNode = fdt_path_offset (DeviceTree, "/chosen");
+ ChosenNode = FdtPathOffset (DeviceTree, "/chosen");
if (ChosenNode < 0) {
return RETURN_NOT_FOUND;
}
- StdoutPathProp = fdt_getprop (
+ StdoutPathProp = FdtGetProp (
DeviceTree,
ChosenNode,
"stdout-path",
@@ -216,7 +216,7 @@ FdtSerialGetConsolePort (
//
// StdoutPathProp starts with an absolute node path.
//
- ConsoleNode = fdt_path_offset_namelen (
+ ConsoleNode = FdtPathOffsetNameLen (
DeviceTree,
StdoutPathProp,
(INT32)StdoutPathLength
@@ -227,7 +227,7 @@ FdtSerialGetConsolePort (
//
CONST CHAR8 *ResolvedStdoutPath;
- ResolvedStdoutPath = fdt_get_alias_namelen (
+ ResolvedStdoutPath = FdtGetAliasNameLen (
DeviceTree,
StdoutPathProp,
(INT32)StdoutPathLength
@@ -236,7 +236,7 @@ FdtSerialGetConsolePort (
return RETURN_NOT_FOUND;
}
- ConsoleNode = fdt_path_offset (DeviceTree, ResolvedStdoutPath);
+ ConsoleNode = FdtPathOffset (DeviceTree, ResolvedStdoutPath);
}
if (ConsoleNode < 0) {
diff --git a/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf b/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf
index e27742e9fa..b70ca219b7 100644
--- a/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf
+++ b/OvmfPkg/Library/FdtSerialPortAddressLib/FdtSerialPortAddressLib.inf
@@ -18,7 +18,6 @@
FdtSerialPortAddressLib.c
[Packages]
- EmbeddedPkg/EmbeddedPkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
index 6f35fb4304..0c00e7bbdc 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPei.c
@@ -14,12 +14,11 @@
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/IoLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/QemuFwCfgLib.h>
-#include <libfdt.h>
-
#include "QemuFwCfgLibMmioInternal.h"
/**
@@ -120,7 +119,7 @@ QemuFwCfgInitialize (
//
// Make sure we have a valid device tree blob
//
- ASSERT (fdt_check_header (DeviceTreeBase) == 0);
+ ASSERT (FdtCheckHeader (DeviceTreeBase) == 0);
//
// Create resouce memory
@@ -129,7 +128,7 @@ QemuFwCfgInitialize (
ASSERT (FwCfgResource != NULL);
for (Prev = 0; ; Prev = Node) {
- Node = fdt_next_node (DeviceTreeBase, Prev, NULL);
+ Node = FdtNextNode (DeviceTreeBase, Prev, NULL);
if (Node < 0) {
break;
}
@@ -137,7 +136,7 @@ QemuFwCfgInitialize (
//
// Check for memory node
//
- Type = fdt_getprop (DeviceTreeBase, Node, "compatible", &Len);
+ Type = FdtGetProp (DeviceTreeBase, Node, "compatible", &Len);
if ((Type != NULL) &&
(AsciiStrnCmp (Type, "qemu,fw-cfg-mmio", Len) == 0))
{
@@ -145,7 +144,7 @@ QemuFwCfgInitialize (
// Get the 'reg' property of this node. For now, we will assume
// two 8 byte quantities for base and size, respectively.
//
- Reg = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);
+ Reg = FdtGetProp (DeviceTreeBase, Node, "reg", &Len);
if ((Reg != 0) && (Len == (2 * sizeof (UINT64)))) {
FwCfgDataAddress = SwapBytes64 (Reg[0]);
FwCfgDataSize = 8;
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf
index b91f106c86..5d6e45b7ef 100644
--- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf
+++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgMmioPeiLib.inf
@@ -33,6 +33,7 @@
BaseLib
BaseMemoryLib
DebugLib
+ FdtLib
HobLib
IoLib
MemoryAllocationLib
diff --git a/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc b/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
index 89abdf9f77..948047e085 100644
--- a/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
+++ b/OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc
@@ -154,7 +154,7 @@
VariablePolicyLib | MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
VariablePolicyHelperLib | MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
SortLib | MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
- FdtLib | EmbeddedPkg/Library/FdtLib/FdtLib.inf
+ FdtLib | MdePkg/Library/BaseFdtLib/BaseFdtLib.inf
PciSegmentLib | MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
PciHostBridgeLib | OvmfPkg/Fdt/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
PciHostBridgeUtilityLib | OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
diff --git a/OvmfPkg/LoongArchVirt/PlatformPei/Platform.c b/OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
index cfc0cec41d..8fe0973f85 100644
--- a/OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
+++ b/OvmfPkg/LoongArchVirt/PlatformPei/Platform.c
@@ -21,6 +21,7 @@
#include <Library/BaseMemoryLib.h>
#include <Library/CpuMmuInitLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/HobLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/MpInitLib.h>
@@ -29,7 +30,6 @@
#include <Library/PeiServicesLib.h>
#include <Library/PlatformHookLib.h>
#include <Library/QemuFwCfgLib.h>
-#include <libfdt.h>
#include <Ppi/MasterBootMode.h>
#include <Register/LoongArch64/Cpucfg.h>
#include <Register/LoongArch64/Csr.h>
@@ -176,13 +176,13 @@ GetRtcAddress (
CONST UINT64 *RegProp;
EFI_STATUS Status;
- if ((Fdt == NULL) || (fdt_check_header (Fdt) != 0)) {
+ if ((Fdt == NULL) || (FdtCheckHeader (Fdt) != 0)) {
return EFI_INVALID_PARAMETER;
}
Status = EFI_NOT_FOUND;
for (Prev = 0; ; Prev = Node) {
- Node = fdt_next_node (Fdt, Prev, NULL);
+ Node = FdtNextNode (Fdt, Prev, NULL);
if (Node < 0) {
break;
}
@@ -190,13 +190,13 @@ GetRtcAddress (
//
// Check for memory node
//
- Type = fdt_getprop (Fdt, Node, "compatible", &Len);
+ Type = FdtGetProp (Fdt, Node, "compatible", &Len);
if ((Type) && (AsciiStrnCmp (Type, "loongson,ls7a-rtc", Len) == 0)) {
//
// Get the 'reg' property of this node. For now, we will assume
// two 8 byte quantities for base and size, respectively.
//
- RegProp = fdt_getprop (Fdt, Node, "reg", &Len);
+ RegProp = FdtGetProp (Fdt, Node, "reg", &Len);
if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) {
*RtcBaseAddress = SwapBytes64 (RegProp[0]);
Status = RETURN_SUCCESS;
@@ -274,11 +274,11 @@ AddFdtHob (
SaveRtcRegisterAddressHob (RtcBaseAddress);
- FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
+ FdtSize = FdtTotalSize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
NewBase = AllocatePages (FdtPages);
ASSERT (NewBase != NULL);
- fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
+ FdtOpenInto (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof *FdtHobData);
ASSERT (FdtHobData != NULL);
diff --git a/OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf b/OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
index c4f5affb15..01281a7e47 100644
--- a/OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/LoongArchVirt/PlatformPei/PlatformPei.inf
@@ -43,6 +43,7 @@
BaseMemoryLib
CpuMmuInitLib
DebugLib
+ FdtLib
HobLib
MemoryAllocationLib
MpInitLib
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index b0b21705c8..8bd8b686b5 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -244,7 +244,7 @@
CcExitLib|OvmfPkg/Library/CcExitLib/CcExitLib.inf
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+ FdtLib|MdePkg/Library/BaseFdtLib/BaseFdtLib.inf
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
TdxLib|MdePkg/Library/TdxLib/TdxLib.inf
TdxMailboxLib|OvmfPkg/Library/TdxMailboxLib/TdxMailboxLibNull.inf
diff --git a/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc b/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc
index 19a1dcc436..b855b8036d 100644
--- a/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc
+++ b/OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc
@@ -93,7 +93,7 @@
DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
# Flattened Device Tree (FDT) access library
- FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+ FdtLib|MdePkg/Library/BaseFdtLib/BaseFdtLib.inf
# PCI Libraries
PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf
diff --git a/OvmfPkg/RiscVVirt/Sec/Memory.c b/OvmfPkg/RiscVVirt/Sec/Memory.c
index 14c9569c78..4dee8d3cd3 100644
--- a/OvmfPkg/RiscVVirt/Sec/Memory.c
+++ b/OvmfPkg/RiscVVirt/Sec/Memory.c
@@ -22,6 +22,7 @@ Module Name:
//
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/HobLib.h>
#include <Library/IoLib.h>
#include <Library/PcdLib.h>
@@ -29,7 +30,6 @@ Module Name:
#include <Library/BaseRiscVSbiLib.h>
#include <Register/RiscV64/RiscVEncoding.h>
#include <Library/PrePiLib.h>
-#include <libfdt.h>
#include <Guid/FdtHob.h>
VOID
@@ -121,7 +121,7 @@ GetNumCells (
INT32 Len;
UINT32 Val;
- Prop = fdt_getprop (Fdt, Node, Name, &Len);
+ Prop = FdtGetProp (Fdt, Node, Name, &Len);
if (Prop == NULL) {
return Len;
}
@@ -130,7 +130,7 @@ GetNumCells (
return -FDT_ERR_BADNCELLS;
}
- Val = fdt32_to_cpu (*Prop);
+ Val = Fdt32ToCpu (*Prop);
if (Val > FDT_MAX_NCELLS) {
return -FDT_ERR_BADNCELLS;
}
@@ -163,11 +163,11 @@ AddReservedMemoryMap (
INTN NumRsv, i;
INT32 NumAddrCells, NumSizeCells;
- NumRsv = fdt_num_mem_rsv (FdtPointer);
+ NumRsv = FdtGetNumberOfReserveMapEntries (FdtPointer);
/* Look for an existing entry and add it to the efi mem map. */
for (i = 0; i < NumRsv; i++) {
- if (fdt_get_mem_rsv (FdtPointer, i, &Addr, &Size) != 0) {
+ if (FdtGetReserveMapEntry (FdtPointer, i, &Addr, &Size) != 0) {
continue;
}
@@ -179,7 +179,7 @@ AddReservedMemoryMap (
}
/* process reserved-memory */
- Node = fdt_subnode_offset (FdtPointer, 0, "reserved-memory");
+ Node = FdtSubnodeOffset (FdtPointer, 0, "reserved-memory");
if (Node >= 0) {
NumAddrCells = GetNumCells (FdtPointer, Node, "#address-cells");
if (NumAddrCells <= 0) {
@@ -191,21 +191,21 @@ AddReservedMemoryMap (
return;
}
- fdt_for_each_subnode (SubNode, FdtPointer, Node) {
- RegProp = fdt_getprop (FdtPointer, SubNode, "reg", &Len);
+ FdtForEachSubnode (SubNode, FdtPointer, Node) {
+ RegProp = FdtGetProp (FdtPointer, SubNode, "reg", &Len);
if ((RegProp != 0) && (Len == ((NumAddrCells + NumSizeCells) * sizeof (INT32)))) {
- Addr = fdt32_to_cpu (RegProp[0]);
+ Addr = Fdt32ToCpu (RegProp[0]);
if (NumAddrCells > 1) {
- Addr = (Addr << 32) | fdt32_to_cpu (RegProp[1]);
+ Addr = (Addr << 32) | Fdt32ToCpu (RegProp[1]);
}
RegProp += NumAddrCells;
- Size = fdt32_to_cpu (RegProp[0]);
+ Size = Fdt32ToCpu (RegProp[0]);
if (NumSizeCells > 1) {
- Size = (Size << 32) | fdt32_to_cpu (RegProp[1]);
+ Size = (Size << 32) | Fdt32ToCpu (RegProp[1]);
}
DEBUG ((
@@ -216,7 +216,7 @@ AddReservedMemoryMap (
Size
));
- if (fdt_getprop (FdtPointer, SubNode, "no-map", &Len)) {
+ if (FdtGetProp (FdtPointer, SubNode, "no-map", &Len)) {
BuildMemoryAllocationHob (
Addr,
Size,
@@ -269,20 +269,20 @@ MemoryPeimInitialization (
// Look for the lowest memory node
for (Prev = 0; ; Prev = Node) {
- Node = fdt_next_node (FdtPointer, Prev, NULL);
+ Node = FdtNextNode (FdtPointer, Prev, NULL);
if (Node < 0) {
break;
}
// Check for memory node
- Type = fdt_getprop (FdtPointer, Node, "device_type", &Len);
+ Type = FdtGetProp (FdtPointer, Node, "device_type", &Len);
if (Type && (AsciiStrnCmp (Type, "memory", Len) == 0)) {
// Get the 'reg' property of this node. For now, we will assume
// two 8 byte quantities for base and size, respectively.
- RegProp = fdt_getprop (FdtPointer, Node, "reg", &Len);
+ RegProp = FdtGetProp (FdtPointer, Node, "reg", &Len);
if ((RegProp != 0) && (Len == (2 * sizeof (UINT64)))) {
- CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));
- CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));
+ CurBase = Fdt64ToCpu (ReadUnaligned64 (RegProp));
+ CurSize = Fdt64ToCpu (ReadUnaligned64 (RegProp + 1));
DEBUG ((
DEBUG_INFO,
diff --git a/OvmfPkg/RiscVVirt/Sec/Platform.c b/OvmfPkg/RiscVVirt/Sec/Platform.c
index c664324730..18658e7e3e 100644
--- a/OvmfPkg/RiscVVirt/Sec/Platform.c
+++ b/OvmfPkg/RiscVVirt/Sec/Platform.c
@@ -13,12 +13,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <PiPei.h>
#include <Library/DebugLib.h>
+#include <Library/FdtLib.h>
#include <Library/HobLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseRiscVSbiLib.h>
#include <Library/PcdLib.h>
#include <Include/Library/PrePiLib.h>
-#include <libfdt.h>
#include <Guid/FdtHob.h>
/**
@@ -67,15 +67,15 @@ PopulateIoResources (
UINT64 *Reg;
INT32 Node, LenP;
- Node = fdt_node_offset_by_compatible (FdtBase, -1, Compatible);
+ Node = FdtNodeOffsetByCompatible (FdtBase, -1, Compatible);
while (Node != -FDT_ERR_NOTFOUND) {
- Reg = (UINT64 *)fdt_getprop (FdtBase, Node, "reg", &LenP);
+ Reg = (UINT64 *)FdtGetProp (FdtBase, Node, "reg", &LenP);
if (Reg) {
ASSERT (LenP == (2 * sizeof (UINT64)));
AddIoMemoryBaseSizeHob (SwapBytes64 (Reg[0]), SwapBytes64 (Reg[1]));
}
- Node = fdt_node_offset_by_compatible (FdtBase, Node, Compatible);
+ Node = FdtNodeOffsetByCompatible (FdtBase, Node, Compatible);
}
}
@@ -113,12 +113,12 @@ PlatformPeimInitialization (
DEBUG ((DEBUG_INFO, "%a: Build FDT HOB - FDT at address: 0x%x \n", __func__, FdtPointer));
Base = FdtPointer;
- if (fdt_check_header (Base) != 0) {
+ if (FdtCheckHeader (Base) != 0) {
DEBUG ((DEBUG_ERROR, "%a: Corrupted DTB\n", __func__));
return EFI_UNSUPPORTED;
}
- FdtSize = fdt_totalsize (Base);
+ FdtSize = FdtTotalSize (Base);
FdtPages = EFI_SIZE_TO_PAGES (FdtSize);
NewBase = AllocatePages (FdtPages);
if (NewBase == NULL) {
@@ -126,7 +126,7 @@ PlatformPeimInitialization (
return EFI_UNSUPPORTED;
}
- fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
+ FdtOpenInto (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof *FdtHobData);
if (FdtHobData == NULL) {
diff --git a/UefiPayloadPkg/Library/BuildFdtLib/X86_BuildFdtLib.c b/UefiPayloadPkg/Library/BuildFdtLib/X86_BuildFdtLib.c
index 6b21bd35c0..4b6f6e636d 100644
--- a/UefiPayloadPkg/Library/BuildFdtLib/X86_BuildFdtLib.c
+++ b/UefiPayloadPkg/Library/BuildFdtLib/X86_BuildFdtLib.c
@@ -120,10 +120,10 @@ BuildFdtForMemory (
RegTmp[0] = CpuToFdt64 (ResourceHob->PhysicalStart);
RegTmp[1] = CpuToFdt64 (ResourceHob->ResourceLength);
- Status = FdtSetProperty (Fdt, TempNode, "reg", &RegTmp, sizeof (RegTmp));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &RegTmp, sizeof (RegTmp));
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, TempNode, "device_type", "memory", (UINT32)(AsciiStrLen ("memory")+1));
+ Status = FdtSetProp (Fdt, TempNode, "device_type", "memory", (UINT32)(AsciiStrLen ("memory")+1));
ASSERT_EFI_ERROR (Status);
}
}
@@ -166,8 +166,8 @@ BuildFdtForMemAlloc (
ASSERT (ParentNode > 0);
Data32 = CpuToFdt32 (2);
- Status = FdtSetProperty (Fdt, ParentNode, "#address-cells", &Data32, sizeof (UINT32));
- Status = FdtSetProperty (Fdt, ParentNode, "#size-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, ParentNode, "#address-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, ParentNode, "#size-cells", &Data32, sizeof (UINT32));
GuidHob = NULL;
SmbiosTable = NULL;
@@ -182,9 +182,9 @@ BuildFdtForMemAlloc (
DEBUG ((DEBUG_INFO, "FdtAddSubnode %x", TempNode));
RegTmp[0] = CpuToFdt64 (SmbiosTable->SmBiosEntryPoint);
RegTmp[1] = CpuToFdt64 (SmbiosTable->Header.Length);
- FdtSetProperty (Fdt, TempNode, "reg", &RegTmp, sizeof (RegTmp));
+ FdtSetProp (Fdt, TempNode, "reg", &RegTmp, sizeof (RegTmp));
ASSERT_EFI_ERROR (Status);
- FdtSetProperty (Fdt, TempNode, "compatible", "smbios", (UINT32)(AsciiStrLen ("smbios")+1));
+ FdtSetProp (Fdt, TempNode, "compatible", "smbios", (UINT32)(AsciiStrLen ("smbios")+1));
ASSERT_EFI_ERROR (Status);
}
@@ -267,7 +267,7 @@ BuildFdtForMemAlloc (
RegTmp[0] = CpuToFdt64 (Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress);
RegTmp[1] = CpuToFdt64 (Hob.MemoryAllocation->AllocDescriptor.MemoryLength);
- Status = FdtSetProperty (Fdt, TempNode, "reg", &RegTmp, sizeof (RegTmp));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &RegTmp, sizeof (RegTmp));
ASSERT_EFI_ERROR (Status);
if ((AsciiStrCmp (mMemoryAllocType[AllocMemType], "mmio") == 0)) {
@@ -278,16 +278,16 @@ BuildFdtForMemAlloc (
DEBUG ((DEBUG_INFO, "find acpi memory hob MemoryBaseAddress:%x , AcpiTable->Rsdp :%x\n", Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress, AcpiTable->Rsdp));
if (Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress == AcpiTable->Rsdp) {
DEBUG ((DEBUG_INFO, "keep acpi memory hob \n"));
- Status = FdtSetProperty (Fdt, TempNode, "compatible", mMemoryAllocType[AllocMemType], (UINT32)(AsciiStrLen (mMemoryAllocType[AllocMemType])+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", mMemoryAllocType[AllocMemType], (UINT32)(AsciiStrLen (mMemoryAllocType[AllocMemType])+1));
ASSERT_EFI_ERROR (Status);
} else {
DEBUG ((DEBUG_INFO, "change acpi memory hob \n"));
- Status = FdtSetProperty (Fdt, TempNode, "compatible", mMemoryAllocType[4], (UINT32)(AsciiStrLen (mMemoryAllocType[4])+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", mMemoryAllocType[4], (UINT32)(AsciiStrLen (mMemoryAllocType[4])+1));
ASSERT_EFI_ERROR (Status);
}
} else {
DEBUG ((DEBUG_INFO, "other memory hob \n"));
- Status = FdtSetProperty (Fdt, TempNode, "compatible", mMemoryAllocType[AllocMemType], (UINT32)(AsciiStrLen (mMemoryAllocType[AllocMemType])+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", mMemoryAllocType[AllocMemType], (UINT32)(AsciiStrLen (mMemoryAllocType[AllocMemType])+1));
ASSERT_EFI_ERROR (Status);
}
}
@@ -329,7 +329,7 @@ BuildFdtForSerial (
ASSERT (TempNode > 0);
Data32 = CpuToFdt32 (PcdGet32 (PcdSerialBaudRate));
- Status = FdtSetProperty (Fdt, TempNode, "current-speed", &Data32, sizeof (Data32));
+ Status = FdtSetProp (Fdt, TempNode, "current-speed", &Data32, sizeof (Data32));
ASSERT_EFI_ERROR (Status);
if (PcdGetBool (PcdSerialUseMmio)) {
@@ -344,14 +344,14 @@ BuildFdtForSerial (
Data32 = (UINT32)((Data64 & 0x0FFFFFFFF));
RegData[1] = CpuToFdt32 (Data32);
RegData[2] = CpuToFdt32 (8);
- Status = FdtSetProperty (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (1);
- Status = FdtSetProperty (Fdt, TempNode, "reg-io-width", &Data32, sizeof (Data32));
+ Status = FdtSetProp (Fdt, TempNode, "reg-io-width", &Data32, sizeof (Data32));
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, TempNode, "compatible", "isa", (UINT32)(AsciiStrLen ("isa")+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", "isa", (UINT32)(AsciiStrLen ("isa")+1));
ASSERT_EFI_ERROR (Status);
return Status;
@@ -404,19 +404,19 @@ BuildFdtForSerialLpss (
ASSERT (TempNode > 0);
Data32 = CpuToFdt32 (SerialPortInfo->BaudRate);
- Status = FdtSetProperty (Fdt, TempNode, "current-speed", &Data32, sizeof (Data32));
+ Status = FdtSetProp (Fdt, TempNode, "current-speed", &Data32, sizeof (Data32));
ASSERT_EFI_ERROR (Status);
RegData[0] = CpuToFdt32 ((UINT32)SerialPortInfo->RegisterBase);
RegData[1] = CpuToFdt32 (0x80);
- Status = FdtSetProperty (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (4);
- Status = FdtSetProperty (Fdt, TempNode, "reg-io-width", &Data32, sizeof (Data32));
+ Status = FdtSetProp (Fdt, TempNode, "reg-io-width", &Data32, sizeof (Data32));
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, TempNode, "compatible", "ns16550a", (UINT32)(AsciiStrLen ("ns16550a")+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", "ns16550a", (UINT32)(AsciiStrLen ("ns16550a")+1));
ASSERT_EFI_ERROR (Status);
GuidHob = GET_NEXT_HOB (GuidHob);
@@ -633,7 +633,7 @@ BuildFdtForPciRootBridge (
RegData[20] = CpuToFdt32 (Data32);
DEBUG ((DEBUG_INFO, "PciRootBridge->Io.base size [20] %x, \n", Data32));
- Status = FdtSetProperty (Fdt, TempNode, "ranges", &RegData, sizeof (RegData));
+ Status = FdtSetProp (Fdt, TempNode, "ranges", &RegData, sizeof (RegData));
ASSERT_EFI_ERROR (Status);
// non-reloc/non-prefetch/memory, child-addr, parent-addr, length
@@ -653,7 +653,7 @@ BuildFdtForPciRootBridge (
DMARegData[6] = CpuToFdt32 (1);
DMARegData[7] = CpuToFdt32 (0);
- Status = FdtSetProperty (Fdt, TempNode, "dma-ranges", &DMARegData, sizeof (DMARegData));
+ Status = FdtSetProp (Fdt, TempNode, "dma-ranges", &DMARegData, sizeof (DMARegData));
ASSERT_EFI_ERROR (Status);
ASSERT (PciRootBridgeInfo->RootBridge[Index].Bus.Base <= 0xFF);
@@ -662,7 +662,7 @@ BuildFdtForPciRootBridge (
Reg64Data[0] = CpuToFdt64 (PciExpressBaseAddress + LShiftU64 (PciRootBridgeInfo->RootBridge[Index].Bus.Base, 20));
Reg64Data[1] = CpuToFdt64 (LShiftU64 (PciRootBridgeInfo->RootBridge[Index].Bus.Limit +1, 20));
- Status = FdtSetProperty (Fdt, TempNode, "reg", &Reg64Data, sizeof (Reg64Data));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &Reg64Data, sizeof (Reg64Data));
ASSERT_EFI_ERROR (Status);
BusNumber = PciRootBridgeInfo->RootBridge[Index].Bus.Base & 0xFF;
@@ -674,22 +674,22 @@ BuildFdtForPciRootBridge (
ASSERT (PciRootBridgeInfo->RootBridge[Index].Bus.Base <= 0xFF);
ASSERT (PciRootBridgeInfo->RootBridge[Index].Bus.Limit <= 0xFF);
- Status = FdtSetProperty (Fdt, TempNode, "bus-range", &RegTmp, sizeof (RegTmp));
+ Status = FdtSetProp (Fdt, TempNode, "bus-range", &RegTmp, sizeof (RegTmp));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (2);
- Status = FdtSetProperty (Fdt, TempNode, "#size-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, TempNode, "#size-cells", &Data32, sizeof (UINT32));
Reg64Data[0] = CpuToFdt64 (PciExpressBaseAddress + LShiftU64 (PciRootBridgeInfo->RootBridge[Index].Bus.Base, 20));
Reg64Data[1] = CpuToFdt64 (LShiftU64 (PciRootBridgeInfo->RootBridge[Index].Bus.Limit +1, 20));
- Status = FdtSetProperty (Fdt, TempNode, "reg", &Reg64Data, sizeof (Reg64Data));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &Reg64Data, sizeof (Reg64Data));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (3);
- Status = FdtSetProperty (Fdt, TempNode, "#address-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, TempNode, "#address-cells", &Data32, sizeof (UINT32));
- Status = FdtSetProperty (Fdt, TempNode, "compatible", "pci-rb", (UINT32)(AsciiStrLen ("pci-rb")+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", "pci-rb", (UINT32)(AsciiStrLen ("pci-rb")+1));
ASSERT_EFI_ERROR (Status);
if (Index == 0) {
@@ -740,19 +740,19 @@ BuildFdtForPciRootBridge (
}
Data32 = CpuToFdt32 (PciData.Device.SubsystemID);
- Status = FdtSetProperty (Fdt, GmaNode, "subsystem-id", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, GmaNode, "subsystem-id", &Data32, sizeof (UINT32));
Data32 = CpuToFdt32 (PciData.Device.SubsystemVendorID);
- Status = FdtSetProperty (Fdt, GmaNode, "subsystem-vendor-id", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, GmaNode, "subsystem-vendor-id", &Data32, sizeof (UINT32));
Data32 = CpuToFdt32 (PciData.Hdr.RevisionID);
- Status = FdtSetProperty (Fdt, GmaNode, "revision-id", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, GmaNode, "revision-id", &Data32, sizeof (UINT32));
Data32 = CpuToFdt32 (PciData.Hdr.DeviceId);
- Status = FdtSetProperty (Fdt, GmaNode, "device-id", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, GmaNode, "device-id", &Data32, sizeof (UINT32));
Data32 = CpuToFdt32 (PciData.Hdr.VendorId);
- Status = FdtSetProperty (Fdt, GmaNode, "vendor-id", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, GmaNode, "vendor-id", &Data32, sizeof (UINT32));
}
if (SerialParent != NULL) {
@@ -767,12 +767,12 @@ BuildFdtForPciRootBridge (
if (SerialParent->IsIsaCompatible) {
Status = AsciiSPrint (eSPIStr, sizeof (eSPIStr), "isa@%X,%X", DevBase, FunBase);
eSPINode = FdtAddSubnode (Fdt, TempNode, eSPIStr);
- Status = FdtSetProperty (Fdt, eSPINode, "compatible", "isa", (UINT32)(AsciiStrLen ("isa")+1));
+ Status = FdtSetProp (Fdt, eSPINode, "compatible", "isa", (UINT32)(AsciiStrLen ("isa")+1));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (1);
- Status = FdtSetProperty (Fdt, eSPINode, "#size-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, eSPINode, "#size-cells", &Data32, sizeof (UINT32));
Data32 = CpuToFdt32 (2);
- Status = FdtSetProperty (Fdt, eSPINode, "#address-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, eSPINode, "#address-cells", &Data32, sizeof (UINT32));
Status = BuildFdtForSerial (eSPINode, FdtBase);
ASSERT_EFI_ERROR (Status);
}
@@ -819,52 +819,52 @@ BuildFdtForFrameBuffer (
TempNode = FdtAddSubnode (Fdt, 0, TempStr);
ASSERT (TempNode > 0);
- Status = FdtSetProperty (Fdt, TempNode, "display", "&gma", (UINT32)(AsciiStrLen ("&gma")+1));
+ Status = FdtSetProp (Fdt, TempNode, "display", "&gma", (UINT32)(AsciiStrLen ("&gma")+1));
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, TempNode, "format", "a8r8g8b8", (UINT32)(AsciiStrLen ("a8r8g8b8")+1));
+ Status = FdtSetProp (Fdt, TempNode, "format", "a8r8g8b8", (UINT32)(AsciiStrLen ("a8r8g8b8")+1));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (GraphicsInfo->GraphicsMode.VerticalResolution);
- Status = FdtSetProperty (Fdt, TempNode, "height", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, TempNode, "height", &Data32, sizeof (UINT32));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (GraphicsInfo->GraphicsMode.HorizontalResolution);
- Status = FdtSetProperty (Fdt, TempNode, "width", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, TempNode, "width", &Data32, sizeof (UINT32));
ASSERT_EFI_ERROR (Status);
RegData[0] = CpuToFdt64 (GraphicsInfo->FrameBufferBase);
RegData[1] = CpuToFdt64 (GraphicsInfo->FrameBufferSize);
- Status = FdtSetProperty (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, TempNode, "compatible", "simple-framebuffer", (UINT32)(AsciiStrLen ("simple-framebuffer")+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", "simple-framebuffer", (UINT32)(AsciiStrLen ("simple-framebuffer")+1));
ASSERT_EFI_ERROR (Status);
} else {
Status = AsciiSPrint (TempStr, sizeof (TempStr), "framebuffer@%lX", 0xB0000000);
TempNode = FdtAddSubnode (Fdt, 0, TempStr);
ASSERT (TempNode > 0);
- Status = FdtSetProperty (Fdt, TempNode, "display", "&gma", (UINT32)(AsciiStrLen ("&gma")+1));
+ Status = FdtSetProp (Fdt, TempNode, "display", "&gma", (UINT32)(AsciiStrLen ("&gma")+1));
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, TempNode, "format", "a8r8g8b8", (UINT32)(AsciiStrLen ("a8r8g8b8")+1));
+ Status = FdtSetProp (Fdt, TempNode, "format", "a8r8g8b8", (UINT32)(AsciiStrLen ("a8r8g8b8")+1));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (1024);
- Status = FdtSetProperty (Fdt, TempNode, "height", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, TempNode, "height", &Data32, sizeof (UINT32));
ASSERT_EFI_ERROR (Status);
Data32 = CpuToFdt32 (1280);
- Status = FdtSetProperty (Fdt, TempNode, "width", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (Fdt, TempNode, "width", &Data32, sizeof (UINT32));
ASSERT_EFI_ERROR (Status);
RegData[0] = CpuToFdt64 (0xB0000000);
RegData[1] = CpuToFdt64 (0x500000);
- Status = FdtSetProperty (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
+ Status = FdtSetProp (Fdt, TempNode, "reg", &RegData, sizeof (RegData));
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, TempNode, "compatible", "simple-framebuffer", (UINT32)(AsciiStrLen ("simple-framebuffer")+1));
+ Status = FdtSetProp (Fdt, TempNode, "compatible", "simple-framebuffer", (UINT32)(AsciiStrLen ("simple-framebuffer")+1));
ASSERT_EFI_ERROR (Status);
}
@@ -917,35 +917,35 @@ BuildFdtForUplRequired (
ASSERT (CpuHob != NULL);
if (mResourceAssigned) {
- Status = FdtSetProperty (Fdt, UPLParaNode, "pci-enum-done", NULL, 0);
+ Status = FdtSetProp (Fdt, UPLParaNode, "pci-enum-done", NULL, 0);
ASSERT_EFI_ERROR (Status);
}
BootMode = GetBootModeHob ();
Data32 = CpuToFdt32 ((UINT32)CpuHob->SizeOfMemorySpace);
- Status = FdtSetProperty (Fdt, UPLParaNode, "addr-width", &Data32, sizeof (Data32));
+ Status = FdtSetProp (Fdt, UPLParaNode, "addr-width", &Data32, sizeof (Data32));
ASSERT_EFI_ERROR (Status);
if (BootMode == BOOT_WITH_FULL_CONFIGURATION) {
- Status = FdtSetProperty (Fdt, UPLParaNode, "boot-mode", "normal", (UINT32)(AsciiStrLen ("normal")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "boot-mode", "normal", (UINT32)(AsciiStrLen ("normal")+1));
} else if (BootMode == BOOT_WITH_MINIMAL_CONFIGURATION) {
- Status = FdtSetProperty (Fdt, UPLParaNode, "boot-mode", "fast", (UINT32)(AsciiStrLen ("fast")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "boot-mode", "fast", (UINT32)(AsciiStrLen ("fast")+1));
} else if (BootMode == BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS) {
- Status = FdtSetProperty (Fdt, UPLParaNode, "boot-mode", "full", (UINT32)(AsciiStrLen ("full")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "boot-mode", "full", (UINT32)(AsciiStrLen ("full")+1));
} else if (BootMode == BOOT_WITH_DEFAULT_SETTINGS) {
- Status = FdtSetProperty (Fdt, UPLParaNode, "boot-mode", "default", (UINT32)(AsciiStrLen ("default")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "boot-mode", "default", (UINT32)(AsciiStrLen ("default")+1));
} else if (BootMode == BOOT_ON_S4_RESUME) {
- Status = FdtSetProperty (Fdt, UPLParaNode, "boot-mode", "s4", (UINT32)(AsciiStrLen ("s4")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "boot-mode", "s4", (UINT32)(AsciiStrLen ("s4")+1));
} else if (BootMode == BOOT_ON_S3_RESUME) {
- Status = FdtSetProperty (Fdt, UPLParaNode, "boot-mode", "s3", (UINT32)(AsciiStrLen ("s3")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "boot-mode", "s3", (UINT32)(AsciiStrLen ("s3")+1));
} else {
- Status = FdtSetProperty (Fdt, UPLParaNode, "boot-mode", "na", (UINT32)(AsciiStrLen ("na")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "boot-mode", "na", (UINT32)(AsciiStrLen ("na")+1));
}
ASSERT_EFI_ERROR (Status);
- Status = FdtSetProperty (Fdt, UPLParaNode, "compatible", "upl", (UINT32)(AsciiStrLen ("upl")+1));
+ Status = FdtSetProp (Fdt, UPLParaNode, "compatible", "upl", (UINT32)(AsciiStrLen ("upl")+1));
ASSERT_EFI_ERROR (Status);
GuidHob = GetFirstGuidHob (&gUniversalPayloadBaseGuid);
@@ -958,7 +958,7 @@ BuildFdtForUplRequired (
UPLImageNode = FdtAddSubnode (Fdt, ParentNode, TempStr);
Data64 = CpuToFdt64 ((UINTN)Fit);
- Status = FdtSetProperty (FdtBase, UPLImageNode, "addr", &Data64, sizeof (Data64));
+ Status = FdtSetProp (FdtBase, UPLImageNode, "addr", &Data64, sizeof (Data64));
}
CustomNode = FdtAddSubnode (Fdt, ParentNode, "upl-custom");
@@ -966,7 +966,7 @@ BuildFdtForUplRequired (
HobPtr = GetHobList ();
Data64 = CpuToFdt64 ((UINT64)(EFI_PHYSICAL_ADDRESS)HobPtr);
- Status = FdtSetProperty (Fdt, CustomNode, "hoblistptr", &Data64, sizeof (Data64));
+ Status = FdtSetProp (Fdt, CustomNode, "hoblistptr", &Data64, sizeof (Data64));
ASSERT_EFI_ERROR (Status);
return Status;
diff --git a/UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c b/UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
index 7885a52fed..0910eeb4c3 100644
--- a/UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
+++ b/UefiPayloadPkg/PayloadLoaderPeim/FitPayloadLoaderPeim.c
@@ -340,8 +340,8 @@ FdtPpiNotifyCallback (
// Set cell property of root node
Data32 = CpuToFdt32 (2);
- Status = FdtSetProperty (FdtBase, 0, "#address-cells", &Data32, sizeof (UINT32));
- Status = FdtSetProperty (FdtBase, 0, "#size-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (FdtBase, 0, "#address-cells", &Data32, sizeof (UINT32));
+ Status = FdtSetProp (FdtBase, 0, "#size-cells", &Data32, sizeof (UINT32));
Status = BuildFdtForUPL (FdtBase);
ASSERT_EFI_ERROR (Status);