acpica-tools/0025-Support-MPST-in-a-big-endian-world.patch
Al Stone fc3eef63e8 Update to 20220331 upstream sources
This includes new source tarballs, updated patches, and updated
expected results for test cases.  In addition, three new tables
(PRMT, RGRT and SVKL) now have big-endian support.

Signed-off-by: Al Stone <ahs3@redhat.com>
2022-04-03 15:18:02 -06:00

153 lines
6.2 KiB
Diff

From 0a25688f36df62579f4dd0444ceba33a0f8d4dcc Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 16:08:24 -0600
Subject: [PATCH 25/45] Support MPST in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 33 +++++++++++++++++++--------------
source/compiler/dttable2.c | 8 ++++----
2 files changed, 23 insertions(+), 18 deletions(-)
Index: acpica-unix2-20220331/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20220331/source/common/dmtbdump2.c
@@ -1047,11 +1047,13 @@ AcpiDmDumpMpst (
UINT16 SubtableCount;
UINT32 PowerStateCount;
UINT32 ComponentCount;
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
+ UINT16 Tmp16;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMpst);
if (ACPI_FAILURE (Status))
{
return;
@@ -1059,13 +1061,14 @@ AcpiDmDumpMpst (
/* Subtable: Memory Power Node(s) */
- SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
+ Tmp16 = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
+ SubtableCount = AcpiUtReadUint16 (&Tmp16);
Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
- while ((Offset < Table->Length) && SubtableCount)
+ while ((Offset < TableLength) && SubtableCount)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable0,
sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
if (ACPI_FAILURE (Status))
{
@@ -1074,8 +1077,8 @@ AcpiDmDumpMpst (
/* Extract the sub-subtable counts */
- PowerStateCount = Subtable0->NumPowerStates;
- ComponentCount = Subtable0->NumPhysicalComponents;
+ PowerStateCount = AcpiUtReadUint16 (&Subtable0->NumPowerStates);
+ ComponentCount = AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents);
Offset += sizeof (ACPI_MPST_POWER_NODE);
/* Sub-subtables - Memory Power State Structure(s) */
@@ -1086,7 +1089,7 @@ AcpiDmDumpMpst (
while (PowerStateCount)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable0A,
sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
if (ACPI_FAILURE (Status))
{
@@ -1109,7 +1112,7 @@ AcpiDmDumpMpst (
while (ComponentCount)
{
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable0B,
sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
if (ACPI_FAILURE (Status))
{
@@ -1126,22 +1129,24 @@ AcpiDmDumpMpst (
SubtableCount--;
Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
sizeof (ACPI_MPST_POWER_NODE) +
- (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
- (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
+ (sizeof (ACPI_MPST_POWER_STATE) *
+ AcpiUtReadUint16 (&Subtable0->NumPowerStates)) +
+ (sizeof (ACPI_MPST_COMPONENT) *
+ AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents)));
}
/* Subtable: Count of Memory Power State Characteristic structures */
AcpiOsPrintf ("\n");
Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable1,
sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
if (ACPI_FAILURE (Status))
{
return;
}
- SubtableCount = Subtable1->CharacteristicsCount;
+ SubtableCount = AcpiUtReadUint16 (&Subtable1->CharacteristicsCount);
Offset += sizeof (ACPI_MPST_DATA_HDR);
/* Subtable: Memory Power State Characteristics structure(s) */
@@ -1149,10 +1154,10 @@ AcpiDmDumpMpst (
Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
sizeof (ACPI_MPST_DATA_HDR));
- while ((Offset < Table->Length) && SubtableCount)
+ while ((Offset < TableLength) && SubtableCount)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable2,
sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
if (ACPI_FAILURE (Status))
{
Index: acpica-unix2-20220331/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20220331.orig/source/compiler/dttable2.c
+++ acpica-unix2-20220331/source/compiler/dttable2.c
@@ -359,7 +359,7 @@ DtCompileMpst (
DtPushSubtable (Subtable);
MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
- SubtableCount = MpstChannelInfo->PowerNodeCount;
+ SubtableCount = AcpiUtReadUint16 (&MpstChannelInfo->PowerNodeCount);
while (*PFieldList && SubtableCount)
{
@@ -377,8 +377,8 @@ DtCompileMpst (
DtPushSubtable (Subtable);
MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
- PowerStateCount = MpstPowerNode->NumPowerStates;
- ComponentCount = MpstPowerNode->NumPhysicalComponents;
+ PowerStateCount = AcpiUtReadUint16 (&MpstPowerNode->NumPowerStates);
+ ComponentCount = AcpiUtReadUint16 (&MpstPowerNode->NumPhysicalComponents);
ParentTable = DtPeekSubtable ();
@@ -431,7 +431,7 @@ DtCompileMpst (
DtPushSubtable (Subtable);
MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
- SubtableCount = MpstDataHeader->CharacteristicsCount;
+ SubtableCount = AcpiUtReadUint16(&MpstDataHeader->CharacteristicsCount);
ParentTable = DtPeekSubtable ();