]> git.proxmox.com Git - mirror_edk2.git/blame - DynamicTablesPkg/Library/Common/AmlLib/Utils/AmlUtility.h
DynamicTablesPkg: Add AmlSetRdListCheckSum()
[mirror_edk2.git] / DynamicTablesPkg / Library / Common / AmlLib / Utils / AmlUtility.h
CommitLineData
667aa7cc
PG
1/** @file\r
2 AML Utility.\r
3\r
4 Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>\r
5\r
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7**/\r
8\r
9#ifndef AML_UTILITY_H_\r
10#define AML_UTILITY_H_\r
11\r
12#include <AmlNodeDefines.h>\r
13\r
14/** This function computes and updates the ACPI table checksum.\r
15\r
16 @param [in] AcpiTable Pointer to an Acpi table.\r
17\r
18 @retval EFI_SUCCESS The function completed successfully.\r
19 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
20**/\r
21EFI_STATUS\r
22EFIAPI\r
23AcpiPlatformChecksum (\r
24 IN EFI_ACPI_DESCRIPTION_HEADER * AcpiTable\r
25 );\r
26\r
27/** Compute the size of a tree/sub-tree.\r
28\r
29 @param [in] Node Node to compute the size.\r
30 @param [in, out] Size Pointer holding the computed size.\r
31\r
32 @retval EFI_SUCCESS The function completed successfully.\r
33 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
34**/\r
35EFI_STATUS\r
36EFIAPI\r
37AmlComputeSize (\r
38 IN CONST AML_NODE_HEADER * Node,\r
39 IN OUT UINT32 * Size\r
40 );\r
41\r
42/** Set the value contained in an integer node.\r
43\r
44 The OpCode is updated accordingly to the new value\r
45 (e.g.: If the original value was a UINT8 value, then the OpCode\r
46 would be AML_BYTE_PREFIX. If it the new value is a UINT16\r
47 value then the OpCode will be updated to AML_WORD_PREFIX).\r
48\r
49 @param [in] Node Pointer to an integer node.\r
50 Must be an object node.\r
51 @param [in] NewValue New value to write in the integer node.\r
52 @param [out] ValueWidthDiff Difference in number of bytes used to store\r
53 the new value.\r
54 Can be negative.\r
55\r
56 @retval EFI_SUCCESS The function completed successfully.\r
57 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
58 @retval EFI_OUT_OF_RESOURCES Could not allocate memory.\r
59**/\r
60EFI_STATUS\r
61EFIAPI\r
62AmlNodeSetIntegerValue (\r
63 IN AML_OBJECT_NODE * Node,\r
64 IN UINT64 NewValue,\r
65 OUT INT8 * ValueWidthDiff\r
66 );\r
67\r
68/** Propagate information up the tree.\r
69\r
70 The information can be a new size, a new number of arguments.\r
71\r
72 @param [in] Node Pointer to a node.\r
73 Must be a root node or an object node.\r
74 @param [in] IsIncrement Choose the operation to do:\r
75 - TRUE: Increment the Node's size and\r
76 the Node's count;\r
77 - FALSE: Decrement the Node's size and\r
78 the Node's count.\r
79 @param [in] Diff Value to add/subtract to the Node's size.\r
80 @param [in] NodeCount Number of nodes added/removed.\r
81\r
82 @retval EFI_SUCCESS The function completed successfully.\r
83 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87AmlPropagateInformation (\r
88 IN AML_NODE_HEADER * Node,\r
89 IN BOOLEAN IsIncrement,\r
90 IN UINT32 Diff,\r
91 IN UINT8 NodeCount\r
92 );\r
93\r
74addfea
PG
94/** Find and set the EndTag's Checksum of a list of Resource Data elements.\r
95\r
96 Lists of Resource Data elements end with an EndTag (most of the time). This\r
97 function finds the EndTag (if present) in a list of Resource Data elements\r
98 and sets the checksum.\r
99\r
100 ACPI 6.4, s6.4.2.9 "End Tag":\r
101 "This checksum is generated such that adding it to the sum of all the data\r
102 bytes will produce a zero sum."\r
103 "If the checksum field is zero, the resource data is treated as if the\r
104 checksum operation succeeded. Configuration proceeds normally."\r
105\r
106 To avoid re-computing checksums, if a new resource data elements is\r
107 added/removed/modified in a list of resource data elements, the AmlLib\r
108 resets the checksum to 0.\r
109\r
110 @param [in] BufferOpNode Node having a list of Resource Data elements.\r
111 @param [in] CheckSum CheckSum to store in the EndTag.\r
112 To ignore/avoid computing the checksum,\r
113 give 0.\r
114\r
115 @retval EFI_SUCCESS The function completed successfully.\r
116 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
117 @retval EFI_NOT_FOUND No EndTag found.\r
118**/\r
119EFI_STATUS\r
120EFIAPI\r
121AmlSetRdListCheckSum (\r
122 IN AML_OBJECT_NODE * BufferOpNode,\r
123 IN UINT8 CheckSum\r
124 );\r
125\r
667aa7cc
PG
126#endif // AML_UTILITY_H_\r
127\r