]> git.proxmox.com Git - mirror_edk2.git/blame - DynamicTablesPkg/Include/Library/TableHelperLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / DynamicTablesPkg / Include / Library / TableHelperLib.h
CommitLineData
7130bcef
SM
1/** @file\r
2\r
16136f21 3 Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>\r
7130bcef 4\r
9cd9bdc6 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7130bcef 6\r
c1b53091
KK
7 @par Glossary:\r
8 - PFN - Pointer to a Function\r
9\r
7130bcef
SM
10**/\r
11\r
12#ifndef TABLE_HELPER_LIB_H_\r
13#define TABLE_HELPER_LIB_H_\r
14\r
bfaf7c8b
PG
15#include <Library/AmlLib/AmlLib.h>\r
16\r
7130bcef
SM
17/** The GetCgfMgrInfo function gets the CM_STD_OBJ_CONFIGURATION_MANAGER_INFO\r
18 object from the Configuration Manager.\r
19\r
20 @param [in] CfgMgrProtocol Pointer to the Configuration Manager protocol\r
21 interface.\r
22 @param [out] CfgMfrInfo Pointer to the Configuration Manager Info\r
23 object structure.\r
24\r
25 @retval EFI_SUCCESS The object is returned.\r
26 @retval EFI_INVALID_PARAMETER The Object ID is invalid.\r
27 @retval EFI_NOT_FOUND The requested Object is not found.\r
28 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration\r
29 Manager is less than the Object size.\r
30**/\r
31EFI_STATUS\r
32EFIAPI\r
33GetCgfMgrInfo (\r
731c67e1
MK
34 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,\r
35 OUT CM_STD_OBJ_CONFIGURATION_MANAGER_INFO **CfgMfrInfo\r
7130bcef
SM
36 );\r
37\r
38/** The AddAcpiHeader function updates the ACPI header structure. It uses the\r
39 ACPI table Generator and the Configuration Manager protocol to obtain the\r
40 information required for constructing the header.\r
41\r
42 @param [in] CfgMgrProtocol Pointer to the Configuration Manager\r
43 protocol interface.\r
44 @param [in] Generator Pointer to the ACPI table Generator.\r
45 @param [in,out] AcpiHeader Pointer to the ACPI table header to be\r
46 updated.\r
e12bdeb1 47 @param [in] AcpiTableInfo Pointer to the ACPI table info structure.\r
7130bcef
SM
48 @param [in] Length Length of the ACPI table.\r
49\r
50 @retval EFI_SUCCESS The ACPI table is updated successfully.\r
51 @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
52 @retval EFI_NOT_FOUND The required object information is not found.\r
53 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration\r
54 Manager is less than the Object size for the\r
55 requested object.\r
56**/\r
57EFI_STATUS\r
58EFIAPI\r
59AddAcpiHeader (\r
731c67e1
MK
60 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,\r
61 IN CONST ACPI_TABLE_GENERATOR *CONST Generator,\r
62 IN OUT EFI_ACPI_DESCRIPTION_HEADER *CONST AcpiHeader,\r
63 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,\r
7130bcef
SM
64 IN CONST UINT32 Length\r
65 );\r
66\r
bfaf7c8b
PG
67/** Build a RootNode containing SSDT ACPI header information using the AmlLib.\r
68\r
69 The function utilizes the ACPI table Generator and the Configuration\r
70 Manager protocol to obtain any information required for constructing the\r
71 header. It then creates a RootNode. The SSDT ACPI header is part of the\r
72 RootNode.\r
73\r
74 This is essentially a wrapper around AmlCodeGenDefinitionBlock ()\r
75 from the AmlLib.\r
76\r
77 @param [in] CfgMgrProtocol Pointer to the Configuration Manager\r
78 protocol interface.\r
79 @param [in] Generator Pointer to the ACPI table Generator.\r
80 @param [in] AcpiTableInfo Pointer to the ACPI table info structure.\r
81 @param [out] RootNode If success, contains the created RootNode.\r
82 The SSDT ACPI header is part of the RootNode.\r
83\r
84 @retval EFI_SUCCESS Success.\r
85 @retval EFI_INVALID_PARAMETER A parameter is invalid.\r
86 @retval EFI_NOT_FOUND The required object information is not found.\r
87 @retval EFI_BAD_BUFFER_SIZE The size returned by the Configuration\r
88 Manager is less than the Object size for the\r
89 requested object.\r
90**/\r
91EFI_STATUS\r
92EFIAPI\r
93AddSsdtAcpiHeader (\r
731c67e1
MK
94 IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol,\r
95 IN CONST ACPI_TABLE_GENERATOR *CONST Generator,\r
96 IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo,\r
97 OUT AML_ROOT_NODE_HANDLE *RootNode\r
bfaf7c8b
PG
98 );\r
99\r
c1b53091
KK
100/**\r
101 Function prototype for testing if two arbitrary objects are equal.\r
102\r
103 @param [in] Object1 Pointer to the first object to compare.\r
104 @param [in] Object2 Pointer to the second object to compare.\r
105 @param [in] Index1 Index of Object1. This value is optional and\r
106 can be ignored by the specified implementation.\r
107 @param [in] Index2 Index of Object2. This value is optional and\r
108 can be ignored by the specified implementation.\r
109\r
110 @retval TRUE Object1 and Object2 are equal.\r
111 @retval FALSE Object1 and Object2 are NOT equal.\r
112**/\r
113typedef\r
114BOOLEAN\r
115(EFIAPI *PFN_IS_EQUAL)(\r
731c67e1
MK
116 IN CONST VOID *Object1,\r
117 IN CONST VOID *Object2,\r
c1b53091
KK
118 IN UINTN Index1 OPTIONAL,\r
119 IN UINTN Index2 OPTIONAL\r
120 );\r
121\r
122/**\r
123 Test and report if a duplicate entry exists in the given array of comparable\r
124 elements.\r
125\r
126 @param [in] Array Array of elements to test for duplicates.\r
127 @param [in] Count Number of elements in Array.\r
128 @param [in] ElementSize Size of an element in bytes\r
129 @param [in] EqualTestFunction The function to call to check if any two\r
130 elements are equal.\r
131\r
132 @retval TRUE A duplicate element was found or one of\r
133 the input arguments is invalid.\r
134 @retval FALSE Every element in Array is unique.\r
135**/\r
136BOOLEAN\r
137EFIAPI\r
138FindDuplicateValue (\r
731c67e1
MK
139 IN CONST VOID *Array,\r
140 IN CONST UINTN Count,\r
141 IN CONST UINTN ElementSize,\r
142 IN PFN_IS_EQUAL EqualTestFunction\r
c1b53091
KK
143 );\r
144\r
96e006b3
SM
145/** Parse and print a CmObjDesc.\r
146\r
147 @param [in] CmObjDesc The CmObjDesc to parse and print.\r
148**/\r
149VOID\r
150EFIAPI\r
151ParseCmObjDesc (\r
731c67e1 152 IN CONST CM_OBJ_DESCRIPTOR *CmObjDesc\r
96e006b3
SM
153 );\r
154\r
7130bcef 155#endif // TABLE_HELPER_LIB_H_\r