1 From 9fc0e46189feb926b13713422ea2722e273a31b5 Mon Sep 17 00:00:00 2001
2 From: Al Stone <ahs3@redhat.com>
3 Date: Mon, 19 Oct 2020 17:30:30 -0400
4 Subject: [PATCH 40/45] Support S3PT in a big-endian world
7 source/common/dmtbdump2.c | 15 +++++++++------
8 source/compiler/dttable2.c | 4 +++-
9 2 files changed, 12 insertions(+), 7 deletions(-)
11 Index: acpica-unix2-20220331/source/common/dmtbdump2.c
12 ===================================================================
13 --- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
14 +++ acpica-unix2-20220331/source/common/dmtbdump2.c
15 @@ -2495,6 +2495,8 @@ AcpiDmDumpS3pt (
16 ACPI_FPDT_HEADER *Subtable;
17 ACPI_DMTABLE_INFO *InfoTable;
18 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
19 + UINT32 S3ptTableLength = AcpiUtReadUint32 (&S3ptTable->Length);
20 + UINT16 SubtableType;
24 @@ -2506,19 +2508,20 @@ AcpiDmDumpS3pt (
27 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
28 - while (Offset < S3ptTable->Length)
29 + while (Offset < S3ptTableLength)
31 /* Common subtable header */
34 - Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
35 + Status = AcpiDmDumpTable (S3ptTableLength, Offset, Subtable,
36 Subtable->Length, AcpiDmTableInfoS3ptHdr);
37 if (ACPI_FAILURE (Status))
42 - switch (Subtable->Type)
43 + SubtableType = AcpiUtReadUint16 (&Subtable->Type);
44 + switch (SubtableType)
46 case ACPI_S3PT_TYPE_RESUME:
48 @@ -2533,7 +2536,7 @@ AcpiDmDumpS3pt (
51 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
55 /* Attempt to continue */
57 @@ -2546,7 +2549,7 @@ AcpiDmDumpS3pt (
61 - Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
62 + Status = AcpiDmDumpTable (S3ptTableLength, Offset, Subtable,
63 Subtable->Length, InfoTable);
64 if (ACPI_FAILURE (Status))
66 @@ -2560,7 +2563,7 @@ NextSubtable:
67 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
70 - return (S3ptTable->Length);
71 + return (S3ptTableLength);
75 Index: acpica-unix2-20220331/source/compiler/dttable2.c
76 ===================================================================
77 --- acpica-unix2-20220331.orig/source/compiler/dttable2.c
78 +++ acpica-unix2-20220331/source/compiler/dttable2.c
79 @@ -1803,6 +1803,7 @@ DtCompileS3pt (
80 DT_SUBTABLE *ParentTable;
81 ACPI_DMTABLE_INFO *InfoTable;
82 DT_FIELD *SubtableStart;
83 + UINT16 S3ptHeaderType;
86 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
87 @@ -1830,7 +1831,8 @@ DtCompileS3pt (
89 S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
91 - switch (S3ptHeader->Type)
92 + S3ptHeaderType = AcpiUtReadUint16 (&S3ptHeader->Type);
93 + switch (S3ptHeaderType)
95 case ACPI_S3PT_TYPE_RESUME: