2021-07-12 03:22:10 +00:00
|
|
|
From 0a25688f36df62579f4dd0444ceba33a0f8d4dcc Mon Sep 17 00:00:00 2001
|
2020-10-19 18:24:09 +00:00
|
|
|
From: Al Stone <ahs3@redhat.com>
|
|
|
|
Date: Wed, 23 Sep 2020 16:08:24 -0600
|
2021-07-12 03:22:10 +00:00
|
|
|
Subject: [PATCH 25/45] Support MPST in a big-endian world
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
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(-)
|
|
|
|
|
2022-04-03 21:18:02 +00:00
|
|
|
Index: acpica-unix2-20220331/source/common/dmtbdump2.c
|
2020-10-19 18:24:09 +00:00
|
|
|
===================================================================
|
2022-04-03 21:18:02 +00:00
|
|
|
--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
|
|
|
|
+++ acpica-unix2-20220331/source/common/dmtbdump2.c
|
|
|
|
@@ -1047,11 +1047,13 @@ AcpiDmDumpMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
UINT16 SubtableCount;
|
|
|
|
UINT32 PowerStateCount;
|
|
|
|
UINT32 ComponentCount;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
|
2020-10-19 18:24:09 +00:00
|
|
|
+ UINT16 Tmp16;
|
|
|
|
|
|
|
|
|
|
|
|
/* Main table */
|
|
|
|
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMpst);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return;
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -1059,13 +1061,14 @@ AcpiDmDumpMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
/* Subtable: Memory Power Node(s) */
|
|
|
|
|
|
|
|
- SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
|
|
|
|
+ Tmp16 = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ SubtableCount = AcpiUtReadUint16 (&Tmp16);
|
2020-10-19 18:24:09 +00:00
|
|
|
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))
|
|
|
|
{
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -1074,8 +1077,8 @@ AcpiDmDumpMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
/* Extract the sub-subtable counts */
|
|
|
|
|
|
|
|
- PowerStateCount = Subtable0->NumPowerStates;
|
|
|
|
- ComponentCount = Subtable0->NumPhysicalComponents;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ PowerStateCount = AcpiUtReadUint16 (&Subtable0->NumPowerStates);
|
|
|
|
+ ComponentCount = AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents);
|
2020-10-19 18:24:09 +00:00
|
|
|
Offset += sizeof (ACPI_MPST_POWER_NODE);
|
|
|
|
|
|
|
|
/* Sub-subtables - Memory Power State Structure(s) */
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -1086,7 +1089,7 @@ AcpiDmDumpMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
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))
|
|
|
|
{
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -1109,7 +1112,7 @@ AcpiDmDumpMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
while (ComponentCount)
|
|
|
|
{
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable0B,
|
|
|
|
sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -1126,22 +1129,24 @@ AcpiDmDumpMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
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));
|
2021-07-12 03:22:10 +00:00
|
|
|
+ (sizeof (ACPI_MPST_POWER_STATE) *
|
|
|
|
+ AcpiUtReadUint16 (&Subtable0->NumPowerStates)) +
|
|
|
|
+ (sizeof (ACPI_MPST_COMPONENT) *
|
|
|
|
+ AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents)));
|
2020-10-19 18:24:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ SubtableCount = AcpiUtReadUint16 (&Subtable1->CharacteristicsCount);
|
2020-10-19 18:24:09 +00:00
|
|
|
Offset += sizeof (ACPI_MPST_DATA_HDR);
|
|
|
|
|
|
|
|
/* Subtable: Memory Power State Characteristics structure(s) */
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -1149,10 +1154,10 @@ AcpiDmDumpMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
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))
|
|
|
|
{
|
2022-04-03 21:18:02 +00:00
|
|
|
Index: acpica-unix2-20220331/source/compiler/dttable2.c
|
2020-10-19 18:24:09 +00:00
|
|
|
===================================================================
|
2022-04-03 21:18:02 +00:00
|
|
|
--- acpica-unix2-20220331.orig/source/compiler/dttable2.c
|
|
|
|
+++ acpica-unix2-20220331/source/compiler/dttable2.c
|
|
|
|
@@ -359,7 +359,7 @@ DtCompileMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
|
|
|
|
MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
|
|
|
|
- SubtableCount = MpstChannelInfo->PowerNodeCount;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ SubtableCount = AcpiUtReadUint16 (&MpstChannelInfo->PowerNodeCount);
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
while (*PFieldList && SubtableCount)
|
|
|
|
{
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -377,8 +377,8 @@ DtCompileMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
|
|
|
|
MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
|
|
|
|
- PowerStateCount = MpstPowerNode->NumPowerStates;
|
|
|
|
- ComponentCount = MpstPowerNode->NumPhysicalComponents;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ PowerStateCount = AcpiUtReadUint16 (&MpstPowerNode->NumPowerStates);
|
|
|
|
+ ComponentCount = AcpiUtReadUint16 (&MpstPowerNode->NumPhysicalComponents);
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
ParentTable = DtPeekSubtable ();
|
|
|
|
|
2022-04-03 21:18:02 +00:00
|
|
|
@@ -431,7 +431,7 @@ DtCompileMpst (
|
2020-10-19 18:24:09 +00:00
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
|
|
|
|
MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
|
|
|
|
- SubtableCount = MpstDataHeader->CharacteristicsCount;
|
|
|
|
+ SubtableCount = AcpiUtReadUint16(&MpstDataHeader->CharacteristicsCount);
|
|
|
|
|
|
|
|
ParentTable = DtPeekSubtable ();
|
|
|
|
|