Fix big-endian related CEDT table errors

Bugzilla: https://bugzilla.redhat.com/2123131

Running 'iasl -T cedt ; iasl cedt.asl' results in the compilation aborting due
to parser-detected syntax errors, which are big-endian related. This only
occurs on s390x systems.

Resolves: rhbz#2123131

Signed-off-by: Dean Nelson <dnelson@redhat.com>
This commit is contained in:
Dean Nelson 2022-10-07 08:57:11 -05:00
parent ede2ebacb1
commit c33c154c6c
2 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,91 @@
Signed-off-by: Dean Nelson <dnelson@redhat.com>
---
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);
}
}

View File

@ -97,6 +97,7 @@ Patch118: CEDT-support_08.patch
Patch119: CEDT-support_09.patch Patch119: CEDT-support_09.patch
Patch120: CEDT-support_10.patch Patch120: CEDT-support_10.patch
Patch121: CEDT-support_11.patch Patch121: CEDT-support_11.patch
Patch122: 0050-Support-CEDT-in-a-big-endian-world.patch
BuildRequires: make BuildRequires: make
BuildRequires: bison patchutils flex gcc BuildRequires: bison patchutils flex gcc
@ -267,6 +268,7 @@ fi
- Backport d9798f5275bb ("Fix Compile issue with CEDT and add template"). - Backport d9798f5275bb ("Fix Compile issue with CEDT and add template").
- Backport 0914618b553d ("Automated cleanup; No functional changes"). - Backport 0914618b553d ("Automated cleanup; No functional changes").
- Backport 7021087eedb0 ("Remove a duplicate of ACPI_SIG_CEDT"). - Backport 7021087eedb0 ("Remove a duplicate of ACPI_SIG_CEDT").
- Add in big-endian patch for CEDT tble.
* Mon Oct 03 2022 Dean Nelson <dnelson@redhat.com> - 20210604-4 * Mon Oct 03 2022 Dean Nelson <dnelson@redhat.com> - 20210604-4
- Add in big-endian patches for PRMT, RGRT and SVKL tables. - Add in big-endian patches for PRMT, RGRT and SVKL tables.