4 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 - ACPI 6.2 Specification - Errata A, September 2017
17 #include <IndustryStandard/Acpi.h>
18 #include <Library/PrintLib.h>
19 #include <Library/UefiLib.h>
20 #include "AcpiParser.h"
21 #include "AcpiTableParser.h"
24 STATIC CONST UINT64
* SlitSystemLocalityCount
;
25 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
;
28 An ACPI_PARSER array describing the ACPI SLIT table.
30 STATIC CONST ACPI_PARSER SlitParser
[] = {
31 PARSE_ACPI_HEADER (&AcpiHdrInfo
),
32 {L
"Number of System Localities", 8, 36, L
"0x%lx", NULL
,
33 (VOID
**)&SlitSystemLocalityCount
, NULL
, NULL
}
37 Macro to get the value of a System Locality
39 #define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
42 This function parses the ACPI SLIT table.
43 When trace is enabled this function parses the SLIT table and
44 traces the ACPI table fields.
46 This function also validates System Localities for the following:
47 - Diagonal elements have a normalized value of 10
48 - Relative distance from System Locality at i*N+j is same as
51 @param [in] Trace If TRUE, trace the ACPI fields.
52 @param [in] Ptr Pointer to the start of the buffer.
53 @param [in] AcpiTableLength Length of the ACPI table.
54 @param [in] AcpiTableRevision Revision of the ACPI table.
61 IN UINT32 AcpiTableLength
,
62 IN UINT8 AcpiTableRevision
70 CHAR16 Buffer
[80]; // Used for AsciiName param of ParseAcpi
82 PARSER_PARAMS (SlitParser
)
84 LocalityPtr
= Ptr
+ Offset
;
86 LocalityCount
= *SlitSystemLocalityCount
;
87 // We only print the Localities if the count is less than 16
88 // If the locality count is more than 16 then refer to the
90 if (LocalityCount
< 16) {
94 L
"Entry[0x%lx][0x%lx]",
98 PrintFieldName (0, Buffer
);
101 for (j
= 0; j
< LocalityCount
; j
++) {
102 Print (L
" (%3d) ", j
);
105 for (i
= 0; i
< LocalityCount
; i
++) {
106 Print (L
" (%3d) ", i
);
107 for (j
= 0; j
< LocalityCount
; j
++) {
108 Print (L
" %3d ", SLIT_ELEMENT (LocalityPtr
, i
, j
));
115 for (i
= 0; i
< LocalityCount
; i
++) {
116 for (j
= 0; j
< LocalityCount
; j
++) {
117 // Element[x][x] must be equal to 10
118 if ((i
== j
) && (SLIT_ELEMENT (LocalityPtr
, i
, j
) != 10)) {
119 IncrementErrorCount ();
121 L
"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
122 " Normalized Value is not 10\n",
125 SLIT_ELEMENT (LocalityPtr
, i
, j
)
128 // Element[i][j] must be equal to Element[j][i]
129 if (SLIT_ELEMENT (LocalityPtr
, i
, j
) !=
130 SLIT_ELEMENT (LocalityPtr
, j
, i
)) {
131 IncrementErrorCount ();
133 L
"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
134 "Element[0x%lx][0x%lx] (%3d) do not match.\n",
137 SLIT_ELEMENT (LocalityPtr
, i
, j
),
140 SLIT_ELEMENT (LocalityPtr
, j
, i
)