1 From 8923211d8bc1b0e4d3af6ff31ed6479057f612f6 Mon Sep 17 00:00:00 2001
2 From: Al Stone <ahs3@redhat.com>
3 Date: Fri, 25 Sep 2020 17:16:12 -0600
4 Subject: [PATCH 30/45] Support PPTT in a big-endian world
6 Signed-off-by: Al Stone <ahs3@redhat.com>
8 source/common/dmtbdump2.c | 17 ++++++++++-------
9 source/compiler/dttable2.c | 7 +++++--
10 2 files changed, 15 insertions(+), 9 deletions(-)
12 Index: acpica-unix2-20220331/source/common/dmtbdump2.c
13 ===================================================================
14 --- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
15 +++ acpica-unix2-20220331/source/common/dmtbdump2.c
16 @@ -2241,6 +2241,8 @@ AcpiDmDumpPptt (
17 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
18 ACPI_DMTABLE_INFO *InfoTable;
20 + UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
24 /* There is no main table (other than the standard ACPI header) */
25 @@ -2248,7 +2250,7 @@ AcpiDmDumpPptt (
28 Offset = sizeof (ACPI_TABLE_HEADER);
29 - while (Offset < Table->Length)
30 + while (Offset < TableLength)
34 @@ -2260,7 +2262,7 @@ AcpiDmDumpPptt (
35 AcpiOsPrintf ("Invalid subtable length\n");
38 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
39 + Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
40 Subtable->Length, AcpiDmTableInfoPpttHdr);
41 if (ACPI_FAILURE (Status))
43 @@ -2302,7 +2304,7 @@ AcpiDmDumpPptt (
44 AcpiOsPrintf ("Invalid subtable length\n");
47 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
48 + Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
49 Subtable->Length, InfoTable);
50 if (ACPI_FAILURE (Status))
52 @@ -2318,15 +2320,16 @@ AcpiDmDumpPptt (
54 /* Dump SMBIOS handles */
56 - if ((UINT8)(Subtable->Length - SubtableOffset) <
57 - (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
58 + NumPrivRes = AcpiUtReadUint32 (&PpttProcessor->NumberOfPrivResources);
59 + if ((UINT8) (Subtable->Length - SubtableOffset) <
60 + (UINT8) (NumPrivRes * 4))
62 AcpiOsPrintf ("Invalid private resource number\n");
65 - for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
66 + for (i = 0; i < NumPrivRes; i++)
68 - Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
69 + Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
70 ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
71 4, AcpiDmTableInfoPptt0a);
72 if (ACPI_FAILURE (Status))
73 Index: acpica-unix2-20220331/source/compiler/dttable2.c
74 ===================================================================
75 --- acpica-unix2-20220331.orig/source/compiler/dttable2.c
76 +++ acpica-unix2-20220331/source/compiler/dttable2.c
77 @@ -1520,6 +1520,7 @@ DtCompilePptt (
78 DT_FIELD **PFieldList = (DT_FIELD **) List;
79 DT_FIELD *SubtableStart;
80 ACPI_TABLE_HEADER *PpttAcpiHeader;
84 ParentTable = DtPeekSubtable ();
85 @@ -1584,7 +1585,7 @@ DtCompilePptt (
87 /* Compile initiator proximity domain list */
89 - PpttProcessor->NumberOfPrivResources = 0;
93 Status = DtCompileTable (PFieldList,
94 @@ -1600,8 +1601,10 @@ DtCompilePptt (
96 DtInsertSubtable (ParentTable, Subtable);
97 PpttHeader->Length += (UINT8)(Subtable->Length);
98 - PpttProcessor->NumberOfPrivResources++;
101 + PpttProcessor->NumberOfPrivResources =
102 + AcpiUtReadUint32 (&NumPrivRes);