2 State and accessors for 'acpiview' configuration.
4 Copyright (c) 2016 - 2020, ARM Limited. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 #include <Library/BaseMemoryLib.h>
9 #include <Library/DebugLib.h>
11 #include "AcpiViewConfig.h"
14 STATIC BOOLEAN mConsistencyCheck
;
15 STATIC BOOLEAN mColourHighlighting
;
16 STATIC EREPORT_OPTION mReportType
;
17 STATIC BOOLEAN mMandatoryTableValidate
;
18 STATIC UINTN mMandatoryTableSpec
;
20 // User selection of which ACPI table should be checked
21 SELECTED_ACPI_TABLE mSelectedAcpiTable
;
24 Reset the AcpiView user configuration to defaults
28 AcpiConfigSetDefaults (
32 mReportType
= ReportAll
;
33 mSelectedAcpiTable
.Type
= 0;
34 mSelectedAcpiTable
.Name
= NULL
;
35 mSelectedAcpiTable
.Found
= FALSE
;
36 mConsistencyCheck
= TRUE
;
37 mMandatoryTableValidate
= FALSE
;
38 mMandatoryTableSpec
= 0;
42 This function converts a string to ACPI table signature.
44 @param [in] Str Pointer to the string to be converted to the
47 @retval The ACPI table signature.
51 ConvertStrToAcpiSignature (
58 ZeroMem (Ptr
, sizeof (Ptr
));
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'));
66 Ptr
[Index
] = (CHAR8
)Str
[Index
];
70 return *(UINT32
*) Ptr
;
74 This function selects an ACPI table in current context.
75 The string name of the table is converted into UINT32
78 @param [in] TableName The name of the ACPI table to select.
83 IN CONST CHAR16
*TableName
86 ASSERT (TableName
!= NULL
);
88 mSelectedAcpiTable
.Name
= TableName
;
89 mSelectedAcpiTable
.Type
= ConvertStrToAcpiSignature (mSelectedAcpiTable
.Name
);
93 This function returns the selected ACPI table.
95 @param [out] SelectedAcpiTable Pointer that will contain the returned struct.
99 GetSelectedAcpiTable (
100 OUT SELECTED_ACPI_TABLE
**SelectedAcpiTable
103 *SelectedAcpiTable
= &mSelectedAcpiTable
;
107 This function returns the colour highlighting status.
109 @retval TRUE Colour highlighting is enabled.
113 GetColourHighlighting (
117 return mColourHighlighting
;
121 This function sets the colour highlighting status.
123 @param [in] Highlight The highlight status.
127 SetColourHighlighting (
131 mColourHighlighting
= Highlight
;
135 This function returns the consistency checking status.
137 @retval TRUE Consistency checking is enabled.
141 GetConsistencyChecking (
145 return mConsistencyCheck
;
149 This function sets the consistency checking status.
151 @param [in] ConsistencyChecking The consistency checking status.
155 SetConsistencyChecking (
156 BOOLEAN ConsistencyChecking
159 mConsistencyCheck
= ConsistencyChecking
;
163 This function returns the report options.
165 @return The current report option.
177 This function sets the report options.
179 @param [in] ReportType The report option to set.
184 EREPORT_OPTION ReportType
187 mReportType
= ReportType
;
191 This function returns the ACPI table requirements validation flag.
193 @retval TRUE Check for mandatory table presence should be performed.
197 GetMandatoryTableValidate (
201 return mMandatoryTableValidate
;
205 This function sets the ACPI table requirements validation flag.
207 @param [in] Validate Enable/Disable ACPI table requirements validation.
211 SetMandatoryTableValidate (
215 mMandatoryTableValidate
= Validate
;
219 This function returns the identifier of specification to validate ACPI table
220 requirements against.
222 @return ID of specification listing mandatory tables.
226 GetMandatoryTableSpec (
230 return mMandatoryTableSpec
;
234 This function sets the identifier of specification to validate ACPI table
235 requirements against.
237 @param [in] Spec ID of specification listing mandatory tables.
241 SetMandatoryTableSpec (
245 mMandatoryTableSpec
= Spec
;