2021-07-23 13:25:41 +00:00
|
|
|
From 0a25688f36df62579f4dd0444ceba33a0f8d4dcc Mon Sep 17 00:00:00 2001
|
2020-10-31 11:18:15 +00:00
|
|
|
From: Al Stone <ahs3@redhat.com>
|
|
|
|
Date: Wed, 23 Sep 2020 16:08:24 -0600
|
2021-07-23 13:25:41 +00:00
|
|
|
Subject: [PATCH 25/45] Support MPST in a big-endian world
|
2020-10-31 11:18:15 +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(-)
|
|
|
|
|
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
|
|
|
|
@@ -995,11 +995,13 @@ AcpiDmDumpMpst (
|
2020-10-31 11:18:15 +00:00
|
|
|
UINT16 SubtableCount;
|
|
|
|
UINT32 PowerStateCount;
|
|
|
|
UINT32 ComponentCount;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
|
2020-10-31 11:18:15 +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;
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1007,13 +1009,14 @@ AcpiDmDumpMpst (
|
2020-10-31 11:18:15 +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-23 13:25:41 +00:00
|
|
|
+ SubtableCount = AcpiUtReadUint16 (&Tmp16);
|
2020-10-31 11:18:15 +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))
|
|
|
|
{
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1022,8 +1025,8 @@ AcpiDmDumpMpst (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
/* Extract the sub-subtable counts */
|
|
|
|
|
|
|
|
- PowerStateCount = Subtable0->NumPowerStates;
|
|
|
|
- ComponentCount = Subtable0->NumPhysicalComponents;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ PowerStateCount = AcpiUtReadUint16 (&Subtable0->NumPowerStates);
|
|
|
|
+ ComponentCount = AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents);
|
2020-10-31 11:18:15 +00:00
|
|
|
Offset += sizeof (ACPI_MPST_POWER_NODE);
|
|
|
|
|
|
|
|
/* Sub-subtables - Memory Power State Structure(s) */
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1034,7 +1037,7 @@ AcpiDmDumpMpst (
|
2020-10-31 11:18:15 +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))
|
|
|
|
{
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1057,7 +1060,7 @@ AcpiDmDumpMpst (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
while (ComponentCount)
|
|
|
|
{
|
|
|
|
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
|
|
|
|
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable0B,
|
|
|
|
sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1074,22 +1077,24 @@ AcpiDmDumpMpst (
|
2020-10-31 11:18:15 +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-23 13:25:41 +00:00
|
|
|
+ (sizeof (ACPI_MPST_POWER_STATE) *
|
|
|
|
+ AcpiUtReadUint16 (&Subtable0->NumPowerStates)) +
|
|
|
|
+ (sizeof (ACPI_MPST_COMPONENT) *
|
|
|
|
+ AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents)));
|
2020-10-31 11:18:15 +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-23 13:25:41 +00:00
|
|
|
+ SubtableCount = AcpiUtReadUint16 (&Subtable1->CharacteristicsCount);
|
2020-10-31 11:18:15 +00:00
|
|
|
Offset += sizeof (ACPI_MPST_DATA_HDR);
|
|
|
|
|
|
|
|
/* Subtable: Memory Power State Characteristics structure(s) */
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -1097,10 +1102,10 @@ AcpiDmDumpMpst (
|
2020-10-31 11:18:15 +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))
|
|
|
|
{
|
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
|
|
|
|
@@ -350,7 +350,7 @@ DtCompileMpst (
|
2020-10-31 11:18:15 +00:00
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
|
|
|
|
MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
|
|
|
|
- SubtableCount = MpstChannelInfo->PowerNodeCount;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ SubtableCount = AcpiUtReadUint16 (&MpstChannelInfo->PowerNodeCount);
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
while (*PFieldList && SubtableCount)
|
|
|
|
{
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -368,8 +368,8 @@ DtCompileMpst (
|
2020-10-31 11:18:15 +00:00
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
|
|
|
|
MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
|
|
|
|
- PowerStateCount = MpstPowerNode->NumPowerStates;
|
|
|
|
- ComponentCount = MpstPowerNode->NumPhysicalComponents;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ PowerStateCount = AcpiUtReadUint16 (&MpstPowerNode->NumPowerStates);
|
|
|
|
+ ComponentCount = AcpiUtReadUint16 (&MpstPowerNode->NumPhysicalComponents);
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
ParentTable = DtPeekSubtable ();
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -422,7 +422,7 @@ DtCompileMpst (
|
2020-10-31 11:18:15 +00:00
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
|
|
|
|
MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
|
|
|
|
- SubtableCount = MpstDataHeader->CharacteristicsCount;
|
|
|
|
+ SubtableCount = AcpiUtReadUint16(&MpstDataHeader->CharacteristicsCount);
|
|
|
|
|
|
|
|
ParentTable = DtPeekSubtable ();
|
|
|
|
|