]>
Commit | Line | Data |
---|---|---|
e18ac66d TP |
1 | /** @file\r |
2 | State and accessors for 'acpiview' configuration.\r | |
3 | \r | |
4 | Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | **/\r | |
7 | \r | |
8 | #include <Library/BaseMemoryLib.h>\r | |
9 | #include <Library/DebugLib.h>\r | |
10 | \r | |
11 | #include "AcpiViewConfig.h"\r | |
12 | \r | |
13 | // Report variables\r | |
14 | STATIC BOOLEAN mConsistencyCheck;\r | |
15 | STATIC BOOLEAN mColourHighlighting;\r | |
16 | STATIC EREPORT_OPTION mReportType;\r | |
17 | STATIC BOOLEAN mMandatoryTableValidate;\r | |
18 | STATIC UINTN mMandatoryTableSpec;\r | |
19 | \r | |
20 | // User selection of which ACPI table should be checked\r | |
21 | SELECTED_ACPI_TABLE mSelectedAcpiTable;\r | |
22 | \r | |
23 | /**\r | |
24 | Reset the AcpiView user configuration to defaults\r | |
25 | **/\r | |
26 | VOID\r | |
27 | EFIAPI\r | |
28 | AcpiConfigSetDefaults (\r | |
29 | VOID\r | |
30 | )\r | |
31 | {\r | |
32 | mReportType = ReportAll;\r | |
33 | mSelectedAcpiTable.Type = 0;\r | |
34 | mSelectedAcpiTable.Name = NULL;\r | |
35 | mSelectedAcpiTable.Found = FALSE;\r | |
36 | mConsistencyCheck = TRUE;\r | |
37 | mMandatoryTableValidate = FALSE;\r | |
38 | mMandatoryTableSpec = 0;\r | |
39 | }\r | |
40 | \r | |
41 | /**\r | |
42 | This function converts a string to ACPI table signature.\r | |
43 | \r | |
44 | @param [in] Str Pointer to the string to be converted to the\r | |
45 | ACPI table signature.\r | |
46 | \r | |
47 | @retval The ACPI table signature.\r | |
48 | **/\r | |
49 | STATIC\r | |
50 | UINT32\r | |
51 | ConvertStrToAcpiSignature (\r | |
52 | IN CONST CHAR16 *Str\r | |
53 | )\r | |
54 | {\r | |
55 | UINT8 Index;\r | |
56 | CHAR8 Ptr[4];\r | |
57 | \r | |
58 | ZeroMem (Ptr, sizeof (Ptr));\r | |
59 | Index = 0;\r | |
60 | \r | |
61 | // Convert to Upper case and convert to ASCII\r | |
62 | while ((Index < 4) && (Str[Index] != 0)) {\r | |
63 | if (Str[Index] >= L'a' && Str[Index] <= L'z') {\r | |
64 | Ptr[Index] = (CHAR8)(Str[Index] - (L'a' - L'A'));\r | |
65 | } else {\r | |
66 | Ptr[Index] = (CHAR8)Str[Index];\r | |
67 | }\r | |
68 | Index++;\r | |
69 | }\r | |
70 | return *(UINT32 *) Ptr;\r | |
71 | }\r | |
72 | \r | |
73 | /**\r | |
74 | This function selects an ACPI table in current context.\r | |
75 | The string name of the table is converted into UINT32\r | |
76 | table signature.\r | |
77 | \r | |
78 | @param [in] TableName The name of the ACPI table to select.\r | |
79 | **/\r | |
80 | VOID\r | |
81 | EFIAPI\r | |
82 | SelectAcpiTable (\r | |
83 | IN CONST CHAR16 *TableName\r | |
84 | )\r | |
85 | {\r | |
86 | ASSERT (TableName != NULL);\r | |
87 | \r | |
88 | mSelectedAcpiTable.Name = TableName;\r | |
89 | mSelectedAcpiTable.Type = ConvertStrToAcpiSignature (mSelectedAcpiTable.Name);\r | |
90 | }\r | |
91 | \r | |
92 | /**\r | |
93 | This function returns the selected ACPI table.\r | |
94 | \r | |
95 | @param [out] SelectedAcpiTable Pointer that will contain the returned struct.\r | |
96 | **/\r | |
97 | VOID\r | |
98 | EFIAPI\r | |
99 | GetSelectedAcpiTable (\r | |
100 | OUT SELECTED_ACPI_TABLE **SelectedAcpiTable\r | |
101 | )\r | |
102 | {\r | |
103 | *SelectedAcpiTable = &mSelectedAcpiTable;\r | |
104 | }\r | |
105 | \r | |
106 | /**\r | |
107 | This function returns the colour highlighting status.\r | |
108 | \r | |
109 | @retval TRUE Colour highlighting is enabled.\r | |
110 | **/\r | |
111 | BOOLEAN\r | |
112 | EFIAPI\r | |
113 | GetColourHighlighting (\r | |
114 | VOID\r | |
115 | )\r | |
116 | {\r | |
117 | return mColourHighlighting;\r | |
118 | }\r | |
119 | \r | |
120 | /**\r | |
121 | This function sets the colour highlighting status.\r | |
122 | \r | |
123 | @param [in] Highlight The highlight status.\r | |
124 | **/\r | |
125 | VOID\r | |
126 | EFIAPI\r | |
127 | SetColourHighlighting (\r | |
128 | BOOLEAN Highlight\r | |
129 | )\r | |
130 | {\r | |
131 | mColourHighlighting = Highlight;\r | |
132 | }\r | |
133 | \r | |
134 | /**\r | |
135 | This function returns the consistency checking status.\r | |
136 | \r | |
137 | @retval TRUE Consistency checking is enabled.\r | |
138 | **/\r | |
139 | BOOLEAN\r | |
140 | EFIAPI\r | |
141 | GetConsistencyChecking (\r | |
142 | VOID\r | |
143 | )\r | |
144 | {\r | |
145 | return mConsistencyCheck;\r | |
146 | }\r | |
147 | \r | |
148 | /**\r | |
149 | This function sets the consistency checking status.\r | |
150 | \r | |
151 | @param [in] ConsistencyChecking The consistency checking status.\r | |
152 | **/\r | |
153 | VOID\r | |
154 | EFIAPI\r | |
155 | SetConsistencyChecking (\r | |
156 | BOOLEAN ConsistencyChecking\r | |
157 | )\r | |
158 | {\r | |
159 | mConsistencyCheck = ConsistencyChecking;\r | |
160 | }\r | |
161 | \r | |
162 | /**\r | |
163 | This function returns the report options.\r | |
164 | \r | |
165 | @return The current report option.\r | |
166 | **/\r | |
167 | EREPORT_OPTION\r | |
168 | EFIAPI\r | |
169 | GetReportOption (\r | |
170 | VOID\r | |
171 | )\r | |
172 | {\r | |
173 | return mReportType;\r | |
174 | }\r | |
175 | \r | |
176 | /**\r | |
177 | This function sets the report options.\r | |
178 | \r | |
179 | @param [in] ReportType The report option to set.\r | |
180 | **/\r | |
181 | VOID\r | |
182 | EFIAPI\r | |
183 | SetReportOption (\r | |
184 | EREPORT_OPTION ReportType\r | |
185 | )\r | |
186 | {\r | |
187 | mReportType = ReportType;\r | |
188 | }\r | |
189 | \r | |
190 | /**\r | |
191 | This function returns the ACPI table requirements validation flag.\r | |
192 | \r | |
193 | @retval TRUE Check for mandatory table presence should be performed.\r | |
194 | **/\r | |
195 | BOOLEAN\r | |
196 | EFIAPI\r | |
197 | GetMandatoryTableValidate (\r | |
198 | VOID\r | |
199 | )\r | |
200 | {\r | |
201 | return mMandatoryTableValidate;\r | |
202 | }\r | |
203 | \r | |
204 | /**\r | |
205 | This function sets the ACPI table requirements validation flag.\r | |
206 | \r | |
207 | @param [in] Validate Enable/Disable ACPI table requirements validation.\r | |
208 | **/\r | |
209 | VOID\r | |
210 | EFIAPI\r | |
211 | SetMandatoryTableValidate (\r | |
212 | BOOLEAN Validate\r | |
213 | )\r | |
214 | {\r | |
215 | mMandatoryTableValidate = Validate;\r | |
216 | }\r | |
217 | \r | |
218 | /**\r | |
219 | This function returns the identifier of specification to validate ACPI table\r | |
220 | requirements against.\r | |
221 | \r | |
222 | @return ID of specification listing mandatory tables.\r | |
223 | **/\r | |
224 | UINTN\r | |
225 | EFIAPI\r | |
226 | GetMandatoryTableSpec (\r | |
227 | VOID\r | |
228 | )\r | |
229 | {\r | |
230 | return mMandatoryTableSpec;\r | |
231 | }\r | |
232 | \r | |
233 | /**\r | |
234 | This function sets the identifier of specification to validate ACPI table\r | |
235 | requirements against.\r | |
236 | \r | |
237 | @param [in] Spec ID of specification listing mandatory tables.\r | |
238 | **/\r | |
239 | VOID\r | |
240 | EFIAPI\r | |
241 | SetMandatoryTableSpec (\r | |
242 | UINTN Spec\r | |
243 | )\r | |
244 | {\r | |
245 | mMandatoryTableSpec = Spec;\r | |
246 | }\r |