From 31e6d9194b223ee33f1189a0667fc10e93c1295d Mon Sep 17 00:00:00 2001 From: Dean Nelson Date: Fri, 7 Oct 2022 08:57:11 -0500 Subject: [PATCH] Fix big-endian related CEDT table errors --- .acpica-tools.metadata | 2 + 0050-Support-CEDT-in-a-big-endian-world.patch | 91 +++++++++++++++++++ acpica-tools.spec | 2 + 3 files changed, 95 insertions(+) create mode 100644 .acpica-tools.metadata create mode 100644 0050-Support-CEDT-in-a-big-endian-world.patch diff --git a/.acpica-tools.metadata b/.acpica-tools.metadata new file mode 100644 index 0000000..f39d8ad --- /dev/null +++ b/.acpica-tools.metadata @@ -0,0 +1,2 @@ +5b87f09fecda40cb089bdeb83e3a01d7615617dd acpica-unix2-20210604.tar_0.gz +1085e6c2a793cb2e3aca94c420e8300afe9eae59 acpitests-unix-20210604.tar.gz diff --git a/0050-Support-CEDT-in-a-big-endian-world.patch b/0050-Support-CEDT-in-a-big-endian-world.patch new file mode 100644 index 0000000..72f6cbf --- /dev/null +++ b/0050-Support-CEDT-in-a-big-endian-world.patch @@ -0,0 +1,91 @@ +Signed-off-by: Dean Nelson +--- + source/common/dmtbdump1.c | 29 ++++++++++++++++------------- + 1 file changed, 16 insertions(+), 13 deletions(-) + +Index: acpica-unix2-20210604/source/common/dmtbdump1.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -242,20 +242,23 @@ AcpiDmDumpCedt ( + { + ACPI_STATUS Status; + ACPI_CEDT_HEADER *Subtable; +- UINT32 Length = Table->Length; ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT32 Offset = sizeof (ACPI_TABLE_CEDT); ++ UINT16 SubtableLength; + + + /* There is no main table (other than the standard ACPI header) */ + + Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Table, Offset); +- while (Offset < Table->Length) ++ while (Offset < TableLength) + { + /* Common subtable header */ + ++ SubtableLength = AcpiUtReadUint16 (&Subtable->Length); ++ + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoCedtHdr); ++ Status = AcpiDmDumpTable (TableLength, Offset, Subtable, ++ SubtableLength, AcpiDmTableInfoCedtHdr); + if (ACPI_FAILURE (Status)) + { + return; +@@ -264,8 +267,8 @@ AcpiDmDumpCedt ( + switch (Subtable->Type) + { + case ACPI_CEDT_TYPE_CHBS: +- Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoCedt0); ++ Status = AcpiDmDumpTable (TableLength, Offset, Subtable, ++ SubtableLength, AcpiDmTableInfoCedt0); + if (ACPI_FAILURE (Status)) { + return; + } +@@ -277,8 +280,8 @@ AcpiDmDumpCedt ( + + /* print out table with first "Interleave target" */ + +- Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoCedt1); ++ Status = AcpiDmDumpTable (TableLength, Offset, Subtable, ++ SubtableLength, AcpiDmTableInfoCedt1); + if (ACPI_FAILURE (Status)) { + return; + } +@@ -288,8 +291,8 @@ AcpiDmDumpCedt ( + for (i = 1; i < max; i++) { + unsigned int loc_offset = Offset + (i * 4) + ACPI_OFFSET(ACPI_CEDT_CFMWS, InterleaveTargets); + unsigned int *trg = &(ptr->InterleaveTargets[i]); +- Status = AcpiDmDumpTable (Length, loc_offset, trg, +- Subtable->Length, AcpiDmTableInfoCedt1_te); ++ Status = AcpiDmDumpTable (TableLength, loc_offset, trg, ++ SubtableLength, AcpiDmTableInfoCedt1_te); + if (ACPI_FAILURE (Status)) { + return; + } +@@ -302,7 +305,7 @@ AcpiDmDumpCedt ( + Subtable->Type); + + /* Attempt to continue */ +- if (!Subtable->Length) ++ if (!SubtableLength) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; +@@ -310,9 +313,9 @@ AcpiDmDumpCedt ( + } + + /* Point to next subtable */ +- Offset += Subtable->Length; ++ Offset += SubtableLength; + Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable, +- Subtable->Length); ++ SubtableLength); + } + } + diff --git a/acpica-tools.spec b/acpica-tools.spec index 2829aee..e24c93e 100644 --- a/acpica-tools.spec +++ b/acpica-tools.spec @@ -97,6 +97,7 @@ Patch118: CEDT-support_08.patch Patch119: CEDT-support_09.patch Patch120: CEDT-support_10.patch Patch121: CEDT-support_11.patch +Patch122: 0050-Support-CEDT-in-a-big-endian-world.patch BuildRequires: make BuildRequires: bison patchutils flex gcc @@ -267,6 +268,7 @@ fi - Backport d9798f5275bb ("Fix Compile issue with CEDT and add template"). - Backport 0914618b553d ("Automated cleanup; No functional changes"). - Backport 7021087eedb0 ("Remove a duplicate of ACPI_SIG_CEDT"). +- Add in big-endian patch for CEDT tble. * Mon Oct 03 2022 Dean Nelson - 20210604-4 - Add in big-endian patches for PRMT, RGRT and SVKL tables.