TianoCore EDK2 master
Loading...
Searching...
No Matches
SbbrValidator.c
Go to the documentation of this file.
1
18#include <Library/DebugLib.h>
19#include <Library/UefiLib.h>
20#include "AcpiParser.h"
21#include "Arm/SbbrValidator.h"
22
26STATIC CONST CHAR8 *ArmSbbrVersions[ArmSbbrVersionMax] = {
27 "1.0", // ArmSbbrVersion_1_0
28 "1.1", // ArmSbbrVersion_1_1
29 "1.2" // ArmSbbrVersion_1_2
30};
31
43};
44
57};
58
72};
73
77STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax] = {
81};
82
97};
98
102VOID
103EFIAPI
105 VOID
106 )
107{
108 UINT32 Table;
109
110 for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
111 ArmSbbrTableCounts[Table].Count = 0;
112 }
113}
114
124BOOLEAN
125EFIAPI
127 UINT32 Signature
128 )
129{
130 UINT32 Table;
131
132 for (Table = 0; Table < ARRAY_SIZE (ArmSbbrTableCounts); Table++) {
133 if (Signature == ArmSbbrTableCounts[Table].Signature) {
134 ArmSbbrTableCounts[Table].Count++;
135 return TRUE;
136 }
137 }
138
139 return FALSE;
140}
141
155EFIAPI
157 ARM_SBBR_VERSION Version
158 )
159{
160 UINT32 Table;
161 UINT32 Index;
162 UINT32 MandatoryTable;
163 CONST UINT8 *SignaturePtr;
164 BOOLEAN IsArmSbbrViolated;
165
166 if (Version >= ArmSbbrVersionMax) {
167 return EFI_INVALID_PARAMETER;
168 }
169
170 IsArmSbbrViolated = FALSE;
171
172 // Go through the list of mandatory tables for the input SBBR version
173 for (Table = 0; Table < ArmSbbrReqs[Version].TableCount; Table++) {
174 MandatoryTable = ArmSbbrReqs[Version].Tables[Table];
175 SignaturePtr = (CONST UINT8 *)(UINTN)&MandatoryTable;
176
177 // Locate the instance count for the table with the given signature
178 Index = 0;
179 while ((Index < ARRAY_SIZE (ArmSbbrTableCounts)) &&
180 (ArmSbbrTableCounts[Index].Signature != MandatoryTable))
181 {
182 Index++;
183 }
184
185 if (Index >= ARRAY_SIZE (ArmSbbrTableCounts)) {
187 Print (
188 L"\nERROR: SBBR v%a: Mandatory %c%c%c%c table's instance count not " \
189 L"found\n",
190 ArmSbbrVersions[Version],
191 SignaturePtr[0],
192 SignaturePtr[1],
193 SignaturePtr[2],
194 SignaturePtr[3]
195 );
196 return EFI_UNSUPPORTED;
197 }
198
199 if (ArmSbbrTableCounts[Index].Count == 0) {
200 IsArmSbbrViolated = TRUE;
202 Print (
203 L"\nERROR: SBBR v%a: Mandatory %c%c%c%c table is missing",
204 ArmSbbrVersions[Version],
205 SignaturePtr[0],
206 SignaturePtr[1],
207 SignaturePtr[2],
208 SignaturePtr[3]
209 );
210 }
211 }
212
213 if (!IsArmSbbrViolated) {
214 Print (
215 L"\nINFO: SBBR v%a: All mandatory ACPI tables are installed",
216 ArmSbbrVersions[Version]
217 );
218 }
219
220 Print (L"\n");
221
222 return IsArmSbbrViolated ? EFI_NOT_FOUND : EFI_SUCCESS;
223}
UINT64 UINTN
#define EFI_ACPI_6_3_EXTENDED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
Definition: Acpi63.h:2836
#define EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
Definition: Acpi63.h:2716
#define EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE
Definition: Acpi63.h:2936
#define EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE
Definition: Acpi63.h:2736
#define EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE
Definition: Acpi63.h:2851
#define EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE
Definition: Acpi63.h:2751
#define EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE
Definition: Acpi63.h:2791
#define EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE
Definition: Acpi63.h:2906
#define EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE
Definition: Acpi63.h:2686
VOID EFIAPI IncrementErrorCount(VOID)
Definition: AcpiParser.c:83
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
STATIC CONST UINT32 ArmSbbr11Mandatory[]
Definition: SbbrValidator.c:48
STATIC CONST ACPI_SBBR_REQ ArmSbbrReqs[ArmSbbrVersionMax]
Definition: SbbrValidator.c:77
BOOLEAN EFIAPI ArmSbbrIncrementTableCount(UINT32 Signature)
EFI_STATUS EFIAPI ArmSbbrReqsValidate(ARM_SBBR_VERSION Version)
STATIC CONST CHAR8 * ArmSbbrVersions[ArmSbbrVersionMax]
Definition: SbbrValidator.c:26
STATIC ACPI_TABLE_COUNTER ArmSbbrTableCounts[]
Definition: SbbrValidator.c:87
STATIC CONST UINT32 ArmSbbr10Mandatory[]
Definition: SbbrValidator.c:35
STATIC CONST UINT32 ArmSbbr12Mandatory[]
Definition: SbbrValidator.c:62
VOID EFIAPI ArmSbbrResetTableCounts(VOID)
ARM_SBBR_VERSION
Definition: SbbrValidator.h:26
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113
CONST UINT32 TableCount
List of required tables.
Definition: SbbrValidator.h:46
UINT32 Count
ACPI table signature.
Definition: SbbrValidator.h:38