Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generating ACPI ThermalZones #30

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,37 @@ AmlCodeGenNameResourceTemplate (
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);

/** AML code generation for a Name object node, containing a String.

AmlCodeGenNameUnicodeString ("_STR", L"String", ParentNode, NewObjectNode) is
equivalent of the following ASL code:
Name(_STR, Unicode ("String"))

@ingroup CodeGenApis

@param [in] NameString The new variable name.
Must be a NULL-terminated ASL NameString
e.g.: "DEV0", "DV15.DEV0", etc.
The input string is copied.
@param [in] String NULL terminated Unicode String to associate to the
NameString.
@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
AmlCodeGenNameUnicodeString (
IN CONST CHAR8 *NameString,
IN CHAR16 *String,
IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);

/** Add a _PRT entry.

AmlCodeGenPrtEntry (0x0FFFF, 0, "LNKA", 0, PrtNameNode) is
Expand Down Expand Up @@ -1038,6 +1069,34 @@ AmlCodeGenDevice (
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);

/** AML code generation for a ThermalZone object node.

AmlCodeGenThermalZone ("TZ00", ParentNode, NewObjectNode) is
equivalent of the following ASL code:
ThermalZone(TZ00) {}

@ingroup CodeGenApis

@param [in] NameString The new ThermalZone's name.
Must be a NULL-terminated ASL NameString
e.g.: "DEV0", "DV15.DEV0", etc.
The input string is copied.
@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
AmlCodeGenThermalZone (
IN CONST CHAR8 *NameString,
IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);

/** AML code generation for a Scope object node.

AmlCodeGenScope ("_SB", ParentNode, NewObjectNode) is
Expand Down Expand Up @@ -1166,6 +1225,60 @@ AmlCodeGenMethodRetInteger (
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);

/** AML code generation for a method returning a NameString that takes an
integer argument.

AmlCodeGenMethodRetNameStringIntegerArgument (
"MET0", "MET1", 1, TRUE, 3, 5, ParentNode, NewObjectNode
);
is equivalent of the following ASL code:
Method(MET0, 1, Serialized, 3) {
Return (MET1 (5))
}

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] ReturnedNameString The name of the object returned by the
method. Optional parameter, can be:
- NULL (ignored).
- A NULL-terminated ASL NameString.
e.g.: "MET0", "_SB.MET0", etc.
The input string is copied.
@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] IntegerArgument Argument to pass to the NameString.
@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
AmlCodeGenMethodRetNameStringIntegerArgument (
IN CONST CHAR8 *MethodNameString,
IN CONST CHAR8 *ReturnedNameString OPTIONAL,
IN UINT8 NumArgs,
IN BOOLEAN IsSerialized,
IN UINT8 SyncLevel,
IN UINT64 IntegerArgument,
IN AML_NODE_HANDLE ParentNode OPTIONAL,
OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL
);

/** Create a _LPI name.

AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is
Expand Down Expand Up @@ -1390,4 +1503,21 @@ AmlCreateCpcNode (
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_
Loading