DynamicTablesPkg: Add AmlCodeGenMethodRetInteger function

Add AmlCodeGenMethodRetInteger function to generate AML code for
a Method returning an Integer.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
Rebecca Cran
2022-01-13 09:40:52 -07:00
committed by mergify[bot]
parent 007a95055b
commit 33189f0527
2 changed files with 206 additions and 0 deletions

View File

@@ -1118,6 +1118,53 @@ AmlCodeGenMethodRetNameString (
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);
/** AML code generation for a method returning an Integer.
AmlCodeGenMethodRetInteger (
"_CBA", 0, 1, TRUE, 3, ParentNode, NewObjectNode
);
is equivalent of the following ASL code:
Method(_CBA, 1, Serialized, 3) {
Return (0)
}
The ASL parameters "ReturnType" and "ParameterTypes" are not asked
in this function. They are optional parameters in ASL.
@param [in] MethodNameString The new Method's name.
Must be a NULL-terminated ASL NameString
e.g.: "MET0", "_SB.MET0", etc.
The input string is copied.
@param [in] ReturnedInteger The value of the integer returned by the
method.
@param [in] NumArgs Number of arguments.
Must be 0 <= NumArgs <= 6.
@param [in] IsSerialized TRUE is equivalent to Serialized.
FALSE is equivalent to NotSerialized.
Default is NotSerialized in ASL spec.
@param [in] SyncLevel Synchronization level for the method.
Must be 0 <= SyncLevel <= 15.
Default is 0 in ASL.
@param [in] ParentNode If provided, set ParentNode as the parent
of the node created.
@param [out] NewObjectNode If success, contains the created node.
@retval EFI_SUCCESS Success.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
**/
EFI_STATUS
EFIAPI
AmlCodeGenMethodRetInteger (
IN CONST CHAR8 *MethodNameString,
IN UINT64 ReturnedInteger,
IN UINT8 NumArgs,
IN BOOLEAN IsSerialized,
IN UINT8 SyncLevel,
IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);
/** Create a _LPI name.
AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is