VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiViewConfig.c@ 89989

Last change on this file since 89989 was 89983, checked in by vboxsync, 4 years ago

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

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