mirror of https://github.com/acidanthera/audk.git
DynamicTablesPkg: Add support to add Strings to package
Add API to add a String to a package created with NamedPackage API. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
parent
b2df3ee17f
commit
fd0ccccb42
|
@ -1472,4 +1472,21 @@ AmlCreateCpcNode (
|
||||||
OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL
|
OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/** AML code generation to add a NameString to the package in a named node.
|
||||||
|
|
||||||
|
|
||||||
|
@param [in] NameString NameString to add
|
||||||
|
@param [in] NamedNode Node to add the string to the included package.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Success.
|
||||||
|
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
AmlAddNameStringToNamedPackage (
|
||||||
|
IN CHAR8 *NameString,
|
||||||
|
IN AML_OBJECT_NODE_HANDLE NamedNode
|
||||||
|
);
|
||||||
|
|
||||||
#endif // AML_LIB_H_
|
#endif // AML_LIB_H_
|
||||||
|
|
|
@ -3679,3 +3679,87 @@ error_handler:
|
||||||
AmlDeleteTree ((AML_NODE_HANDLE)CpcNode);
|
AmlDeleteTree ((AML_NODE_HANDLE)CpcNode);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** AML code generation to add a NameString to the package in a named node.
|
||||||
|
|
||||||
|
|
||||||
|
@param [in] NameString NameString to add
|
||||||
|
@param [in] NamedNode Node to add the string to the included package.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Success.
|
||||||
|
@retval EFI_INVALID_PARAMETER Invalid parameter.
|
||||||
|
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
AmlAddNameStringToNamedPackage (
|
||||||
|
IN CHAR8 *NameString,
|
||||||
|
IN AML_OBJECT_NODE_HANDLE NamedNode
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
AML_DATA_NODE *DataNode;
|
||||||
|
CHAR8 *AmlNameString;
|
||||||
|
UINT32 AmlNameStringSize;
|
||||||
|
AML_OBJECT_NODE_HANDLE PackageNode;
|
||||||
|
|
||||||
|
DataNode = NULL;
|
||||||
|
|
||||||
|
if ((NamedNode == NULL) ||
|
||||||
|
(AmlGetNodeType ((AML_NODE_HANDLE)NamedNode) != EAmlNodeObject) ||
|
||||||
|
(!AmlNodeHasOpCode (NamedNode, AML_NAME_OP, 0)))
|
||||||
|
{
|
||||||
|
ASSERT (0);
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
PackageNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
|
||||||
|
NamedNode,
|
||||||
|
EAmlParseIndexTerm1
|
||||||
|
);
|
||||||
|
if ((PackageNode == NULL) ||
|
||||||
|
(AmlGetNodeType ((AML_NODE_HANDLE)PackageNode) != EAmlNodeObject) ||
|
||||||
|
(!AmlNodeHasOpCode (PackageNode, AML_PACKAGE_OP, 0)))
|
||||||
|
{
|
||||||
|
ASSERT (0);
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ConvertAslNameToAmlName (NameString, &AmlNameString);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ASSERT (0);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ASSERT (0);
|
||||||
|
goto exit_handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = AmlCreateDataNode (
|
||||||
|
EAmlNodeDataTypeNameString,
|
||||||
|
(UINT8 *)AmlNameString,
|
||||||
|
AmlNameStringSize,
|
||||||
|
&DataNode
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ASSERT (0);
|
||||||
|
goto exit_handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = AmlVarListAddTail (
|
||||||
|
(AML_NODE_HANDLE)PackageNode,
|
||||||
|
(AML_NODE_HANDLE)DataNode
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
AmlDeleteTree ((AML_NODE_HANDLE)DataNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit_handler:
|
||||||
|
if (AmlNameString != NULL) {
|
||||||
|
FreePool (AmlNameString);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue