]>
Commit | Line | Data |
---|---|---|
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 | \r | |
69 | Index++;\r | |
70 | }\r | |
71 | \r | |
72 | return *(UINT32 *)Ptr;\r | |
73 | }\r | |
74 | \r | |
75 | /**\r | |
76 | This function selects an ACPI table in current context.\r | |
77 | The string name of the table is converted into UINT32\r | |
78 | table signature.\r | |
79 | \r | |
80 | @param [in] TableName The name of the ACPI table to select.\r | |
81 | **/\r | |
82 | VOID\r | |
83 | EFIAPI\r | |
84 | SelectAcpiTable (\r | |
85 | IN CONST CHAR16 *TableName\r | |
86 | )\r | |
87 | {\r | |
88 | ASSERT (TableName != NULL);\r | |
89 | \r | |
90 | mSelectedAcpiTable.Name = TableName;\r | |
91 | mSelectedAcpiTable.Type = ConvertStrToAcpiSignature (mSelectedAcpiTable.Name);\r | |
92 | }\r | |
93 | \r | |
94 | /**\r | |
95 | This function returns the selected ACPI table.\r | |
96 | \r | |
97 | @param [out] SelectedAcpiTable Pointer that will contain the returned struct.\r | |
98 | **/\r | |
99 | VOID\r | |
100 | EFIAPI\r | |
101 | GetSelectedAcpiTable (\r | |
102 | OUT SELECTED_ACPI_TABLE **SelectedAcpiTable\r | |
103 | )\r | |
104 | {\r | |
105 | *SelectedAcpiTable = &mSelectedAcpiTable;\r | |
106 | }\r | |
107 | \r | |
108 | /**\r | |
109 | This function returns the colour highlighting status.\r | |
110 | \r | |
111 | @retval TRUE Colour highlighting is enabled.\r | |
112 | **/\r | |
113 | BOOLEAN\r | |
114 | EFIAPI\r | |
115 | GetColourHighlighting (\r | |
116 | VOID\r | |
117 | )\r | |
118 | {\r | |
119 | return mColourHighlighting;\r | |
120 | }\r | |
121 | \r | |
122 | /**\r | |
123 | This function sets the colour highlighting status.\r | |
124 | \r | |
125 | @param [in] Highlight The highlight status.\r | |
126 | **/\r | |
127 | VOID\r | |
128 | EFIAPI\r | |
129 | SetColourHighlighting (\r | |
130 | BOOLEAN Highlight\r | |
131 | )\r | |
132 | {\r | |
133 | mColourHighlighting = Highlight;\r | |
134 | }\r | |
135 | \r | |
136 | /**\r | |
137 | This function returns the consistency checking status.\r | |
138 | \r | |
139 | @retval TRUE Consistency checking is enabled.\r | |
140 | **/\r | |
141 | BOOLEAN\r | |
142 | EFIAPI\r | |
143 | GetConsistencyChecking (\r | |
144 | VOID\r | |
145 | )\r | |
146 | {\r | |
147 | return mConsistencyCheck;\r | |
148 | }\r | |
149 | \r | |
150 | /**\r | |
151 | This function sets the consistency checking status.\r | |
152 | \r | |
153 | @param [in] ConsistencyChecking The consistency checking status.\r | |
154 | **/\r | |
155 | VOID\r | |
156 | EFIAPI\r | |
157 | SetConsistencyChecking (\r | |
158 | BOOLEAN ConsistencyChecking\r | |
159 | )\r | |
160 | {\r | |
161 | mConsistencyCheck = ConsistencyChecking;\r | |
162 | }\r | |
163 | \r | |
164 | /**\r | |
165 | This function returns the report options.\r | |
166 | \r | |
167 | @return The current report option.\r | |
168 | **/\r | |
169 | EREPORT_OPTION\r | |
170 | EFIAPI\r | |
171 | GetReportOption (\r | |
172 | VOID\r | |
173 | )\r | |
174 | {\r | |
175 | return mReportType;\r | |
176 | }\r | |
177 | \r | |
178 | /**\r | |
179 | This function sets the report options.\r | |
180 | \r | |
181 | @param [in] ReportType The report option to set.\r | |
182 | **/\r | |
183 | VOID\r | |
184 | EFIAPI\r | |
185 | SetReportOption (\r | |
186 | EREPORT_OPTION ReportType\r | |
187 | )\r | |
188 | {\r | |
189 | mReportType = ReportType;\r | |
190 | }\r | |
191 | \r | |
192 | /**\r | |
193 | This function returns the ACPI table requirements validation flag.\r | |
194 | \r | |
195 | @retval TRUE Check for mandatory table presence should be performed.\r | |
196 | **/\r | |
197 | BOOLEAN\r | |
198 | EFIAPI\r | |
199 | GetMandatoryTableValidate (\r | |
200 | VOID\r | |
201 | )\r | |
202 | {\r | |
203 | return mMandatoryTableValidate;\r | |
204 | }\r | |
205 | \r | |
206 | /**\r | |
207 | This function sets the ACPI table requirements validation flag.\r | |
208 | \r | |
209 | @param [in] Validate Enable/Disable ACPI table requirements validation.\r | |
210 | **/\r | |
211 | VOID\r | |
212 | EFIAPI\r | |
213 | SetMandatoryTableValidate (\r | |
214 | BOOLEAN Validate\r | |
215 | )\r | |
216 | {\r | |
217 | mMandatoryTableValidate = Validate;\r | |
218 | }\r | |
219 | \r | |
220 | /**\r | |
221 | This function returns the identifier of specification to validate ACPI table\r | |
222 | requirements against.\r | |
223 | \r | |
224 | @return ID of specification listing mandatory tables.\r | |
225 | **/\r | |
226 | UINTN\r | |
227 | EFIAPI\r | |
228 | GetMandatoryTableSpec (\r | |
229 | VOID\r | |
230 | )\r | |
231 | {\r | |
232 | return mMandatoryTableSpec;\r | |
233 | }\r | |
234 | \r | |
235 | /**\r | |
236 | This function sets the identifier of specification to validate ACPI table\r | |
237 | requirements against.\r | |
238 | \r | |
239 | @param [in] Spec ID of specification listing mandatory tables.\r | |
240 | **/\r | |
241 | VOID\r | |
242 | EFIAPI\r | |
243 | SetMandatoryTableSpec (\r | |
244 | UINTN Spec\r | |
245 | )\r | |
246 | {\r | |
247 | mMandatoryTableSpec = Spec;\r | |
248 | }\r |