MdePkg: export additional Property functions from BaseFdtLib

- FdtSetPropU64
- FdtAppendProp
- FdtDelProp

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
This commit is contained in:
Leif Lindholm 2024-10-01 16:01:00 +01:00 committed by mergify[bot]
parent 5bad560935
commit 450a001c09
2 changed files with 137 additions and 0 deletions

View File

@ -588,6 +588,68 @@ FdtSetProperty (
IN UINT32 Length
);
/**
Set a property to a 64-bit integer.
@param[in] Fdt The pointer to FDT blob.
@param[in] NodeOffset The offset to the node offset which want to add in.
@param[in] Name The name to name the property.
@param[in] Value The value (big-endian) to the property value.
@return Zero for successfully, otherwise failed.
**/
INT32
EFIAPI
FdtSetPropU64 (
IN VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name,
IN UINT64 Value
);
/**
Append or create a property in the given node.
@param[in] Fdt The pointer to FDT blob.
@param[in] NodeOffset The offset to the node offset which want to add in.
@param[in] Name The name to name the property.
@param[in] Value The value (big-endian) to the property value.
@param[in] Length The length to the size of the property.
@return Zero for successfully, otherwise failed.
**/
INT32
EFIAPI
FdtAppendProp (
IN VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name,
IN CONST VOID *Value,
IN UINT32 Length
);
/**
Delete a property.
This function will delete data from the blob, and will therefore
change the offsets of some existing nodes.
@param[in][out] Fdt Pointer to the device tree blob.
@param[in] NodeOffset Offset of the node whose property to nop.
@param[in] Name Name of the property to nop.
@return Zero for successfully, otherwise failed.
**/
INT32
FdtDelProp (
IN OUT VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name
);
/**
Returns the name of a given node.

View File

@ -482,6 +482,81 @@ FdtSetProperty (
return fdt_setprop (Fdt, NodeOffset, Name, Value, (int)Length);
}
/**
Set a property to a 64-bit integer.
@param[in] Fdt The pointer to FDT blob.
@param[in] NodeOffset The offset to the node offset which want to add in.
@param[in] Name The name to name the property.
@param[in] Value The value (big-endian) to the property value.
@return Zero for successfully, otherwise failed.
**/
INT32
EFIAPI
FdtSetPropU64 (
IN VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name,
IN UINT64 Value
)
{
UINT64 Tmp;
Tmp = cpu_to_fdt64 (Value);
return fdt_setprop (Fdt, NodeOffset, Name, &Tmp, sizeof (Tmp));
}
/**
Append or create a property in the given node.
@param[in] Fdt The pointer to FDT blob.
@param[in] NodeOffset The offset to the node offset which want to add in.
@param[in] Name The name to name the property.
@param[in] Value The value (big-endian) to the property value.
@param[in] Length The length to the size of the property.
@return Zero for successfully, otherwise failed.
**/
INT32
EFIAPI
FdtAppendProp (
IN VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name,
IN CONST VOID *Value,
IN UINT32 Length
)
{
return fdt_appendprop (Fdt, NodeOffset, Name, Value, (int)Length);
}
/**
Delete a property.
This function will delete data from the blob, and will therefore
change the offsets of some existing nodes.
@param[in][out] Fdt Pointer to the device tree blob.
@param[in] NodeOffset Offset of the node whose property to nop.
@param[in] Name Name of the property to nop.
@return Zero for successfully, otherwise failed.
**/
INT32
FdtDelProp (
IN OUT VOID *Fdt,
IN INT32 NodeOffset,
IN CONST CHAR8 *Name
)
{
return fdt_delprop (Fdt, NodeOffset, Name);
}
/**
Returns the name of a given node.