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
;
27 /** An ACPI_PARSER array describing the ACPI SLIT table.
29 STATIC CONST ACPI_PARSER SlitParser
[] = {
30 PARSE_ACPI_HEADER (&AcpiHdrInfo
),
31 {L
"Number of System Localities", 8, 36, L
"0x%lx", NULL
,
32 (VOID
**)&SlitSystemLocalityCount
, NULL
, NULL
}
35 /** Macro to get the value of a System Locality
37 #define SLIT_ELEMENT(Ptr, i, j) *(Ptr + (i * LocalityCount) + j)
39 /** This function parses the ACPI SLIT table.
40 When trace is enabled this function parses the SLIT table and
41 traces the ACPI table fields.
43 This function also validates System Localities for the following:
44 - Diagonal elements have a normalized value of 10
45 - Relative distance from System Locality at i*N+j is same as
48 @param [in] Trace If TRUE, trace the ACPI fields.
49 @param [in] Ptr Pointer to the start of the buffer.
50 @param [in] AcpiTableLength Length of the ACPI table.
51 @param [in] AcpiTableRevision Revision of the ACPI table.
58 IN UINT32 AcpiTableLength
,
59 IN UINT8 AcpiTableRevision
67 CHAR16 Buffer
[80]; // Used for AsciiName param of ParseAcpi
79 PARSER_PARAMS (SlitParser
)
81 LocalityPtr
= Ptr
+ Offset
;
83 LocalityCount
= *SlitSystemLocalityCount
;
84 // We only print the Localities if the count is less than 16
85 // If the locality count is more than 16 then refer to the
87 if (LocalityCount
< 16) {
91 L
"Entry[0x%lx][0x%lx]",
95 PrintFieldName (0, Buffer
);
98 for (j
= 0; j
< LocalityCount
; j
++) {
99 Print (L
" (%3d) ", j
);
102 for (i
= 0; i
< LocalityCount
; i
++) {
103 Print (L
" (%3d) ", i
);
104 for (j
= 0; j
< LocalityCount
; j
++) {
105 Print (L
" %3d ", SLIT_ELEMENT (LocalityPtr
, i
, j
));
112 for (i
= 0; i
< LocalityCount
; i
++) {
113 for (j
= 0; j
< LocalityCount
; j
++) {
114 // Element[x][x] must be equal to 10
115 if ((i
== j
) && (SLIT_ELEMENT (LocalityPtr
, i
, j
) != 10)) {
116 IncrementErrorCount ();
118 L
"ERROR: Diagonal Element[0x%lx][0x%lx] (%3d)."
119 " Normalized Value is not 10\n",
122 SLIT_ELEMENT (LocalityPtr
, i
, j
)
125 // Element[i][j] must be equal to Element[j][i]
126 if (SLIT_ELEMENT (LocalityPtr
, i
, j
) !=
127 SLIT_ELEMENT (LocalityPtr
, j
, i
)) {
128 IncrementErrorCount ();
130 L
"ERROR: Relative distances for Element[0x%lx][0x%lx] (%3d) and \n"
131 "Element[0x%lx][0x%lx] (%3d) do not match.\n",
134 SLIT_ELEMENT (LocalityPtr
, i
, j
),
137 SLIT_ELEMENT (LocalityPtr
, j
, i
)