From 249abc074a65613c3303687151979a4b4065dd1f Mon Sep 17 00:00:00 2001 From: Al Stone Date: Oct 23 2020 19:04:26 +0000 Subject: Add big-endian support for three additional tables: MTMR, VRTC and S3PT Signed-off-by: Al Stone --- diff --git a/0041-Support-MTMR-in-a-big-endian-world.patch b/0041-Support-MTMR-in-a-big-endian-world.patch new file mode 100644 index 0000000..dc4ad0b --- /dev/null +++ b/0041-Support-MTMR-in-a-big-endian-world.patch @@ -0,0 +1,46 @@ +From 902266037614bc0b3ff31c1dfeb350c80e517d90 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Fri, 16 Oct 2020 20:52:43 -0400 +Subject: [PATCH 1/4] Support MTMR in a big-endian world + +Signed-off-by: Al Stone +--- + source/common/dmtbdump2.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c +index 285fd30d7..7450ca3f7 100644 +--- a/source/common/dmtbdump2.c ++++ b/source/common/dmtbdump2.c +@@ -1156,11 +1156,12 @@ AcpiDmDumpMtmr ( + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_MTMR); + ACPI_MTMR_ENTRY *Subtable; ++ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); + + + /* Main table */ + +- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr); ++ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMtmr); + if (ACPI_FAILURE (Status)) + { + return; +@@ -1169,12 +1170,12 @@ AcpiDmDumpMtmr ( + /* Subtables */ + + Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); +- while (Offset < Table->Length) ++ while (Offset < TableLength) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, ++ Status = AcpiDmDumpTable (TableLength, Offset, Subtable, + sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); + if (ACPI_FAILURE (Status)) + { +-- +2.28.0 + diff --git a/0042-Support-VRTC-in-a-big-endian-world.patch b/0042-Support-VRTC-in-a-big-endian-world.patch new file mode 100644 index 0000000..24e50c2 --- /dev/null +++ b/0042-Support-VRTC-in-a-big-endian-world.patch @@ -0,0 +1,45 @@ +From b8d25df79205c128057dba4112b34a7b714a7c43 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Mon, 19 Oct 2020 17:17:40 -0400 +Subject: [PATCH 2/4] Support VRTC in a big-endian world + +--- + source/common/dmtbdump3.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/source/common/dmtbdump3.c b/source/common/dmtbdump3.c +index da9b81c92..db2f54ffb 100644 +--- a/source/common/dmtbdump3.c ++++ b/source/common/dmtbdump3.c +@@ -629,11 +629,12 @@ AcpiDmDumpVrtc ( + ACPI_STATUS Status; + UINT32 Offset = sizeof (ACPI_TABLE_VRTC); + ACPI_VRTC_ENTRY *Subtable; ++ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); + + + /* Main table */ + +- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc); ++ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoVrtc); + if (ACPI_FAILURE (Status)) + { + return; +@@ -642,12 +643,12 @@ AcpiDmDumpVrtc ( + /* Subtables */ + + Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset); +- while (Offset < Table->Length) ++ while (Offset < TableLength) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, ++ Status = AcpiDmDumpTable (TableLength, Offset, Subtable, + sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0); + if (ACPI_FAILURE (Status)) + { +-- +2.28.0 + diff --git a/0043-Support-S3PT-in-a-big-endian-world.patch b/0043-Support-S3PT-in-a-big-endian-world.patch new file mode 100644 index 0000000..bf1be6f --- /dev/null +++ b/0043-Support-S3PT-in-a-big-endian-world.patch @@ -0,0 +1,99 @@ +From 1652084e864a8048b44486548d9df40eb64cd8de Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Mon, 19 Oct 2020 17:30:30 -0400 +Subject: [PATCH 3/4] Support S3PT in a big-endian world + +--- + source/common/dmtbdump2.c | 15 +++++++++------ + source/compiler/dttable2.c | 4 +++- + 2 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c +index 7450ca3f7..ada564cd5 100644 +--- a/source/common/dmtbdump2.c ++++ b/source/common/dmtbdump2.c +@@ -1917,6 +1917,8 @@ AcpiDmDumpS3pt ( + ACPI_FPDT_HEADER *Subtable; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables); ++ UINT32 S3ptTableLength = AcpiUtReadUint32(&S3ptTable->Length); ++ UINT16 SubtableType; + + + /* Main table */ +@@ -1928,19 +1930,20 @@ AcpiDmDumpS3pt ( + } + + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset); +- while (Offset < S3ptTable->Length) ++ while (Offset < S3ptTableLength) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, ++ Status = AcpiDmDumpTable (S3ptTableLength, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoS3ptHdr); + if (ACPI_FAILURE (Status)) + { + return 0; + } + +- switch (Subtable->Type) ++ SubtableType = AcpiUtReadUint16(&Subtable->Type); ++ switch (SubtableType) + { + case ACPI_S3PT_TYPE_RESUME: + +@@ -1955,7 +1958,7 @@ AcpiDmDumpS3pt ( + default: + + AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", +- Subtable->Type); ++ SubtableType); + + /* Attempt to continue */ + +@@ -1968,7 +1971,7 @@ AcpiDmDumpS3pt ( + } + + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, ++ Status = AcpiDmDumpTable (S3ptTableLength, Offset, Subtable, + Subtable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { +@@ -1982,7 +1985,7 @@ NextSubtable: + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length); + } + +- return (S3ptTable->Length); ++ return (S3ptTableLength); + } + + +diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c +index 48729b48f..1ac063795 100644 +--- a/source/compiler/dttable2.c ++++ b/source/compiler/dttable2.c +@@ -1296,6 +1296,7 @@ DtCompileS3pt ( + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD *SubtableStart; ++ UINT16 S3ptHeaderType; + + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt, +@@ -1323,7 +1324,8 @@ DtCompileS3pt ( + + S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer); + +- switch (S3ptHeader->Type) ++ S3ptHeaderType = AcpiUtReadUint16(&S3ptHeader->Type); ++ switch (S3ptHeaderType) + { + case ACPI_S3PT_TYPE_RESUME: + +-- +2.28.0 + diff --git a/acpica-tools.spec b/acpica-tools.spec index 2a6d3e5..5409cda 100644 --- a/acpica-tools.spec +++ b/acpica-tools.spec @@ -64,6 +64,9 @@ Patch36: 0037-Support-IVRS-in-a-big-endian-world.patch Patch37: 0038-Support-TPM2-in-a-big-endian-world.patch Patch38: 0039-Add-partial-big-endian-support-for-WPBT-tables.patch Patch39: 0040-Support-DSDT-SSDT-in-a-big-endian-world.patch +Patch40: 0041-Support-MTMR-in-a-big-endian-world.patch +Patch41: 0042-Support-VRTC-in-a-big-endian-world.patch +Patch42: 0043-Support-S3PT-in-a-big-endian-world.patch # other miscellaneous patches Patch100: unaligned.patch @@ -172,6 +175,9 @@ gzip -dc %{SOURCE1} | tar -x --strip-components=1 -f - %patch37 -p1 %patch38 -p1 %patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 # apply the remaining patches %patch100 -p1