From b11d50752feb9f1b52db076d1fb4753b30a53642 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 12:49:52 -0600 Subject: [PATCH 23/45] Support SLIT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump3.c | 8 +++++--- source/compiler/dttable2.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) Index: acpica-unix2-20220331/source/common/dmtbdump3.c =================================================================== --- acpica-unix2-20220331.orig/source/common/dmtbdump3.c +++ acpica-unix2-20220331/source/common/dmtbdump3.c @@ -96,11 +96,12 @@ AcpiDmDumpSlit ( UINT32 Localities; UINT32 i; UINT32 j; + UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit); + Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSlit); if (ACPI_FAILURE (Status)) { return; @@ -108,7 +109,8 @@ AcpiDmDumpSlit ( /* Display the Locality NxN Matrix */ - Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount; + Localities = (UINT32) + AcpiUtReadUint64 (&ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount); Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]); Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry; @@ -121,7 +123,7 @@ AcpiDmDumpSlit ( { /* Check for beyond EOT */ - if (Offset >= Table->Length) + if (Offset >= TableLength) { AcpiOsPrintf ( "\n**** Not enough room in table for all localities\n"); Index: acpica-unix2-20220331/source/compiler/dttable2.c =================================================================== --- acpica-unix2-20220331.orig/source/compiler/dttable2.c +++ acpica-unix2-20220331/source/compiler/dttable2.c @@ -2234,7 +2234,7 @@ DtCompileSlit ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); - Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); + Localities = (UINT32) AcpiUtReadUint64 (Subtable->Buffer); LocalityBuffer = UtLocalCalloc (Localities); LocalityListLength = 0;