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
];
72 return *(UINT32
*)Ptr
;
76 This function selects an ACPI table in current context.
77 The string name of the table is converted into UINT32
80 @param [in] TableName The name of the ACPI table to select.
85 IN CONST CHAR16
*TableName
88 ASSERT (TableName
!= NULL
);
90 mSelectedAcpiTable
.Name
= TableName
;
91 mSelectedAcpiTable
.Type
= ConvertStrToAcpiSignature (mSelectedAcpiTable
.Name
);
95 This function returns the selected ACPI table.
97 @param [out] SelectedAcpiTable Pointer that will contain the returned struct.
101 GetSelectedAcpiTable (
102 OUT SELECTED_ACPI_TABLE
**SelectedAcpiTable
105 *SelectedAcpiTable
= &mSelectedAcpiTable
;
109 This function returns the colour highlighting status.
111 @retval TRUE Colour highlighting is enabled.
115 GetColourHighlighting (
119 return mColourHighlighting
;
123 This function sets the colour highlighting status.
125 @param [in] Highlight The highlight status.
129 SetColourHighlighting (
133 mColourHighlighting
= Highlight
;
137 This function returns the consistency checking status.
139 @retval TRUE Consistency checking is enabled.
143 GetConsistencyChecking (
147 return mConsistencyCheck
;
151 This function sets the consistency checking status.
153 @param [in] ConsistencyChecking The consistency checking status.
157 SetConsistencyChecking (
158 BOOLEAN ConsistencyChecking
161 mConsistencyCheck
= ConsistencyChecking
;
165 This function returns the report options.
167 @return The current report option.
179 This function sets the report options.
181 @param [in] ReportType The report option to set.
186 EREPORT_OPTION ReportType
189 mReportType
= ReportType
;
193 This function returns the ACPI table requirements validation flag.
195 @retval TRUE Check for mandatory table presence should be performed.
199 GetMandatoryTableValidate (
203 return mMandatoryTableValidate
;
207 This function sets the ACPI table requirements validation flag.
209 @param [in] Validate Enable/Disable ACPI table requirements validation.
213 SetMandatoryTableValidate (
217 mMandatoryTableValidate
= Validate
;
221 This function returns the identifier of specification to validate ACPI table
222 requirements against.
224 @return ID of specification listing mandatory tables.
228 GetMandatoryTableSpec (
232 return mMandatoryTableSpec
;
236 This function sets the identifier of specification to validate ACPI table
237 requirements against.
239 @param [in] Spec ID of specification listing mandatory tables.
243 SetMandatoryTableSpec (
247 mMandatoryTableSpec
= Spec
;