4 Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #define AML_UTILITY_H_
12 #include <AmlNodeDefines.h>
14 /** This function computes and updates the ACPI table checksum.
16 @param [in] AcpiTable Pointer to an Acpi table.
18 @retval EFI_SUCCESS The function completed successfully.
19 @retval EFI_INVALID_PARAMETER Invalid parameter.
23 AcpiPlatformChecksum (
24 IN EFI_ACPI_DESCRIPTION_HEADER
* AcpiTable
27 /** Compute the size of a tree/sub-tree.
29 @param [in] Node Node to compute the size.
30 @param [in, out] Size Pointer holding the computed size.
32 @retval EFI_SUCCESS The function completed successfully.
33 @retval EFI_INVALID_PARAMETER Invalid parameter.
38 IN CONST AML_NODE_HEADER
* Node
,
42 /** Set the value contained in an integer node.
44 The OpCode is updated accordingly to the new value
45 (e.g.: If the original value was a UINT8 value, then the OpCode
46 would be AML_BYTE_PREFIX. If it the new value is a UINT16
47 value then the OpCode will be updated to AML_WORD_PREFIX).
49 @param [in] Node Pointer to an integer node.
50 Must be an object node.
51 @param [in] NewValue New value to write in the integer node.
52 @param [out] ValueWidthDiff Difference in number of bytes used to store
56 @retval EFI_SUCCESS The function completed successfully.
57 @retval EFI_INVALID_PARAMETER Invalid parameter.
58 @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
62 AmlNodeSetIntegerValue (
63 IN AML_OBJECT_NODE
* Node
,
65 OUT INT8
* ValueWidthDiff
68 /** Propagate information up the tree.
70 The information can be a new size, a new number of arguments.
72 @param [in] Node Pointer to a node.
73 Must be a root node or an object node.
74 @param [in] IsIncrement Choose the operation to do:
75 - TRUE: Increment the Node's size and
77 - FALSE: Decrement the Node's size and
79 @param [in] Diff Value to add/subtract to the Node's size.
80 @param [in] NodeCount Number of nodes added/removed.
82 @retval EFI_SUCCESS The function completed successfully.
83 @retval EFI_INVALID_PARAMETER Invalid parameter.
87 AmlPropagateInformation (
88 IN AML_NODE_HEADER
* Node
,
89 IN BOOLEAN IsIncrement
,
94 /** Find and set the EndTag's Checksum of a list of Resource Data elements.
96 Lists of Resource Data elements end with an EndTag (most of the time). This
97 function finds the EndTag (if present) in a list of Resource Data elements
98 and sets the checksum.
100 ACPI 6.4, s6.4.2.9 "End Tag":
101 "This checksum is generated such that adding it to the sum of all the data
102 bytes will produce a zero sum."
103 "If the checksum field is zero, the resource data is treated as if the
104 checksum operation succeeded. Configuration proceeds normally."
106 To avoid re-computing checksums, if a new resource data elements is
107 added/removed/modified in a list of resource data elements, the AmlLib
108 resets the checksum to 0.
110 @param [in] BufferOpNode Node having a list of Resource Data elements.
111 @param [in] CheckSum CheckSum to store in the EndTag.
112 To ignore/avoid computing the checksum,
115 @retval EFI_SUCCESS The function completed successfully.
116 @retval EFI_INVALID_PARAMETER Invalid parameter.
117 @retval EFI_NOT_FOUND No EndTag found.
121 AmlSetRdListCheckSum (
122 IN AML_OBJECT_NODE
* BufferOpNode
,
126 #endif // AML_UTILITY_H_