2021-07-23 13:25:41 +00:00
|
|
|
From 5aec8511fc433a71cb8b6d26be464355d0c3f5cc Mon Sep 17 00:00:00 2001
|
2020-10-31 11:18:15 +00:00
|
|
|
From: Al Stone <ahs3@redhat.com>
|
|
|
|
Date: Thu, 24 Sep 2020 15:25:53 -0600
|
2021-07-23 13:25:41 +00:00
|
|
|
Subject: [PATCH 26/45] Support NFIT in a big-endian world
|
|
|
|
|
|
|
|
NB: this required correcting the starting pointer for the NFIT
|
|
|
|
SMBIOS subtable; otherwise, disassembly did not work properly.
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
Signed-off-by: Al Stone <ahs3@redhat.com>
|
|
|
|
---
|
|
|
|
source/common/dmtable.c | 4 ++--
|
2021-07-23 13:25:41 +00:00
|
|
|
source/common/dmtbdump2.c | 49 ++++++++++++++++++++++----------------
|
2020-10-31 11:18:15 +00:00
|
|
|
source/compiler/dttable2.c | 11 ++++++---
|
2021-07-23 13:25:41 +00:00
|
|
|
3 files changed, 39 insertions(+), 25 deletions(-)
|
2020-10-31 11:18:15 +00:00
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
Index: acpica-unix2-20210604/source/common/dmtable.c
|
2020-10-31 11:18:15 +00:00
|
|
|
===================================================================
|
2021-07-23 13:25:41 +00:00
|
|
|
--- acpica-unix2-20210604.orig/source/common/dmtable.c
|
|
|
|
+++ acpica-unix2-20210604/source/common/dmtable.c
|
|
|
|
@@ -1526,13 +1526,13 @@ AcpiDmDumpTable (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
/* NFIT subtable types */
|
|
|
|
|
|
|
|
- Temp16 = ACPI_GET16 (Target);
|
2021-07-23 13:25:41 +00:00
|
|
|
+ Temp16 = AcpiUtReadUint16 (Target);
|
2020-10-31 11:18:15 +00:00
|
|
|
if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
|
|
|
|
{
|
|
|
|
Temp16 = ACPI_NFIT_TYPE_RESERVED;
|
|
|
|
}
|
|
|
|
|
|
|
|
- AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
|
|
|
|
+ AcpiOsPrintf (UINT16_FORMAT, Temp16,
|
|
|
|
AcpiDmNfitSubnames[Temp16]);
|
|
|
|
break;
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
Index: acpica-unix2-20210604/source/common/dmtbdump2.c
|
2020-10-31 11:18:15 +00:00
|
|
|
===================================================================
|
2021-07-23 13:25:41 +00:00
|
|
|
--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c
|
|
|
|
+++ acpica-unix2-20210604/source/common/dmtbdump2.c
|
|
|
|
@@ -1192,18 +1192,23 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
ACPI_STATUS Status;
|
|
|
|
UINT32 Offset = sizeof (ACPI_TABLE_NFIT);
|
|
|
|
UINT32 FieldOffset = 0;
|
|
|
|
- UINT32 Length;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
|
2020-10-31 11:18:15 +00:00
|
|
|
ACPI_NFIT_HEADER *Subtable;
|
|
|
|
ACPI_DMTABLE_INFO *InfoTable;
|
|
|
|
ACPI_NFIT_INTERLEAVE *Interleave = NULL;
|
|
|
|
ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
|
|
|
|
ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
|
|
|
|
UINT32 i;
|
|
|
|
+ UINT32 Length;
|
|
|
|
+ UINT32 LineCount;
|
|
|
|
+ UINT16 SubtableLength;
|
|
|
|
+ UINT16 SubtableType;
|
|
|
|
+ UINT16 HintCount;
|
|
|
|
|
|
|
|
|
|
|
|
/* Main table */
|
|
|
|
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNfit);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return;
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1212,19 +1217,21 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
/* Subtables */
|
|
|
|
|
|
|
|
Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
|
|
|
|
- while (Offset < Table->Length)
|
|
|
|
+ while (Offset < TableLength)
|
|
|
|
{
|
|
|
|
/* NFIT subtable header */
|
|
|
|
|
|
|
|
AcpiOsPrintf ("\n");
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
|
|
|
|
- Subtable->Length, AcpiDmTableInfoNfitHdr);
|
2021-07-23 13:25:41 +00:00
|
|
|
+ SubtableType = AcpiUtReadUint16 (&Subtable->Type);
|
|
|
|
+ SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
|
2020-10-31 11:18:15 +00:00
|
|
|
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
|
|
|
|
+ SubtableLength, AcpiDmTableInfoNfitHdr);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- switch (Subtable->Type)
|
|
|
|
+ switch (SubtableType)
|
|
|
|
{
|
|
|
|
case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1275,11 +1282,11 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
|
|
|
|
- Subtable->Type);
|
|
|
|
+ SubtableType);
|
|
|
|
|
|
|
|
/* Attempt to continue */
|
|
|
|
|
|
|
|
- if (!Subtable->Length)
|
|
|
|
+ if (!SubtableLength)
|
|
|
|
{
|
|
|
|
AcpiOsPrintf ("Invalid zero length subtable\n");
|
|
|
|
return;
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1288,8 +1295,8 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AcpiOsPrintf ("\n");
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
|
|
|
|
- Subtable->Length, InfoTable);
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
|
|
|
|
+ SubtableLength, InfoTable);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return;
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1297,14 +1304,15 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
/* Per-subtable variable-length fields */
|
|
|
|
|
|
|
|
- switch (Subtable->Type)
|
|
|
|
+ switch (SubtableType)
|
|
|
|
{
|
|
|
|
case ACPI_NFIT_TYPE_INTERLEAVE:
|
|
|
|
|
|
|
|
Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
|
|
|
|
- for (i = 0; i < Interleave->LineCount; i++)
|
2021-07-23 13:25:41 +00:00
|
|
|
+ LineCount = AcpiUtReadUint32 (&Interleave->LineCount);
|
2020-10-31 11:18:15 +00:00
|
|
|
+ for (i = 0; i < LineCount; i++)
|
|
|
|
{
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
|
|
|
|
&Interleave->LineOffset[i],
|
|
|
|
sizeof (UINT32), AcpiDmTableInfoNfit2a);
|
|
|
|
if (ACPI_FAILURE (Status))
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1318,14 +1326,14 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
case ACPI_NFIT_TYPE_SMBIOS:
|
|
|
|
|
|
|
|
- Length = Subtable->Length -
|
|
|
|
+ Length = SubtableLength -
|
|
|
|
sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
|
|
|
|
|
|
|
|
if (Length)
|
|
|
|
{
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length,
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength,
|
|
|
|
sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
|
2021-07-23 13:25:41 +00:00
|
|
|
- SmbiosInfo,
|
|
|
|
+ SmbiosInfo + Offset,
|
2020-10-31 11:18:15 +00:00
|
|
|
Length, AcpiDmTableInfoNfit3a);
|
2021-07-23 13:25:41 +00:00
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
@@ -1338,9 +1346,10 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
|
|
|
|
|
|
|
|
Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
|
|
|
|
- for (i = 0; i < Hint->HintCount; i++)
|
2021-07-23 13:25:41 +00:00
|
|
|
+ HintCount = AcpiUtReadUint16 (&Hint->HintCount);
|
2020-10-31 11:18:15 +00:00
|
|
|
+ for (i = 0; i < HintCount; i++)
|
|
|
|
{
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
|
|
|
|
&Hint->HintAddress[i],
|
|
|
|
sizeof (UINT64), AcpiDmTableInfoNfit6a);
|
|
|
|
if (ACPI_FAILURE (Status))
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1359,8 +1368,8 @@ AcpiDmDumpNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
NextSubtable:
|
|
|
|
/* Point to next subtable */
|
|
|
|
|
|
|
|
- Offset += Subtable->Length;
|
|
|
|
- Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
|
|
|
|
+ Offset += SubtableLength;
|
|
|
|
+ Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, SubtableLength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
Index: acpica-unix2-20210604/source/compiler/dttable2.c
|
2020-10-31 11:18:15 +00:00
|
|
|
===================================================================
|
2021-07-23 13:25:41 +00:00
|
|
|
--- acpica-unix2-20210604.orig/source/compiler/dttable2.c
|
|
|
|
+++ acpica-unix2-20210604/source/compiler/dttable2.c
|
|
|
|
@@ -497,6 +497,7 @@ DtCompileNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
UINT32 Count;
|
|
|
|
ACPI_NFIT_INTERLEAVE *Interleave = NULL;
|
|
|
|
ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
|
|
|
|
+ UINT16 NfitHeaderType;
|
|
|
|
|
|
|
|
|
|
|
|
/* Main table */
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -530,7 +531,8 @@ DtCompileNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
|
|
|
|
|
|
|
|
- switch (NfitHeader->Type)
|
2021-07-23 13:25:41 +00:00
|
|
|
+ NfitHeaderType = AcpiUtReadUint16 (&NfitHeader->Type);
|
2020-10-31 11:18:15 +00:00
|
|
|
+ switch (NfitHeaderType)
|
|
|
|
{
|
|
|
|
case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -590,7 +592,7 @@ DtCompileNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
DtInsertSubtable (ParentTable, Subtable);
|
|
|
|
DtPopSubtable ();
|
|
|
|
|
|
|
|
- switch (NfitHeader->Type)
|
|
|
|
+ switch (NfitHeaderType)
|
|
|
|
{
|
|
|
|
case ACPI_NFIT_TYPE_INTERLEAVE:
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -616,7 +618,8 @@ DtCompileNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
Count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
- Interleave->LineCount = Count;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ AcpiUtWriteUint (&Interleave->LineCount, sizeof (UINT32),
|
|
|
|
+ &Count, sizeof (UINT32));
|
2020-10-31 11:18:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ACPI_NFIT_TYPE_SMBIOS:
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -662,6 +665,8 @@ DtCompileNfit (
|
2020-10-31 11:18:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Hint->HintCount = (UINT16) Count;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ AcpiUtWriteUint (&Hint->HintCount, sizeof (UINT16),
|
|
|
|
+ &Count, sizeof (UINT32));
|
2020-10-31 11:18:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|