diff options
Diffstat (limited to 'OvmfPkg/Library')
4 files changed, 20 insertions, 21 deletions
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
|