VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c

Last change on this file was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette