acpica-tools/SOURCES/0038-Support-PMTT-in-a-big-endian-world.patch
2022-05-17 15:07:28 +00:00

86 lines
2.9 KiB
Diff

From bd19995fa268ed3e93c071162d0e9c2d35ada0d4 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Tue, 29 Jun 2021 16:23:30 -0600
Subject: [PATCH 38/45] Support PMTT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
Index: acpica-unix2-20210604/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20210604/source/common/dmtbdump2.c
@@ -1686,8 +1686,9 @@ AcpiDmDumpPmtt (
{
ACPI_STATUS Status;
ACPI_PMTT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32 (&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
+ UINT16 SubtableLength;
/* Main table */
@@ -1701,17 +1702,18 @@ AcpiDmDumpPmtt (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Each of the types below contain the common subtable header */
AcpiOsPrintf ("\n");
+ SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
switch (Subtable->Type)
{
case ACPI_PMTT_TYPE_SOCKET:
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmtt0);
+ SubtableLength, AcpiDmTableInfoPmtt0);
if (ACPI_FAILURE (Status))
{
return;
@@ -1720,7 +1722,7 @@ AcpiDmDumpPmtt (
case ACPI_PMTT_TYPE_CONTROLLER:
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmtt1);
+ SubtableLength, AcpiDmTableInfoPmtt1);
if (ACPI_FAILURE (Status))
{
return;
@@ -1729,7 +1731,7 @@ AcpiDmDumpPmtt (
case ACPI_PMTT_TYPE_DIMM:
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmtt2);
+ SubtableLength, AcpiDmTableInfoPmtt2);
if (ACPI_FAILURE (Status))
{
return;
@@ -1738,7 +1740,7 @@ AcpiDmDumpPmtt (
case ACPI_PMTT_TYPE_VENDOR:
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmttVendor);
+ SubtableLength, AcpiDmTableInfoPmttVendor);
if (ACPI_FAILURE (Status))
{
return;
@@ -1754,9 +1756,9 @@ AcpiDmDumpPmtt (
/* Point to next subtable */
- Offset += Subtable->Length;
+ Offset += SubtableLength;
Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
- Subtable, Subtable->Length);
+ Subtable, SubtableLength);
}
}