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