80dc240519
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/acpica-tools.git#defe2b64332fc44bf9915c8f57d2614c529cdb43
255 lines
9.8 KiB
Diff
255 lines
9.8 KiB
Diff
From 2d7396fe2b270b0bed6a6436f9e3d15cfbb9abfc Mon Sep 17 00:00:00 2001
|
|
From: Al Stone <ahs3@redhat.com>
|
|
Date: Sat, 19 Sep 2020 13:37:38 -0600
|
|
Subject: [PATCH 08/40] Support DBG2 table in a big-endian world
|
|
|
|
Signed-off-by: Al Stone <ahs3@redhat.com>
|
|
---
|
|
source/common/dmtbdump1.c | 35 +++++++++++++++++--------------
|
|
source/compiler/dttable1.c | 43 ++++++++++++++++++++++++--------------
|
|
2 files changed, 46 insertions(+), 32 deletions(-)
|
|
|
|
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
|
|
===================================================================
|
|
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
|
|
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
|
|
@@ -298,7 +298,7 @@ AcpiDmDumpCsrt (
|
|
ACPI_CSRT_GROUP *Subtable;
|
|
ACPI_CSRT_SHARED_INFO *SharedInfoTable;
|
|
ACPI_CSRT_DESCRIPTOR *SubSubtable;
|
|
- UINT32 Length = Table->Length;
|
|
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
|
|
UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
|
|
UINT32 SubOffset;
|
|
UINT32 SubSubOffset;
|
|
@@ -310,7 +310,7 @@ AcpiDmDumpCsrt (
|
|
/* Subtables (Resource Groups) */
|
|
|
|
Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
|
|
- while (Offset < Table->Length)
|
|
+ while (Offset < Length)
|
|
{
|
|
/* Resource group subtable */
|
|
|
|
@@ -344,7 +344,7 @@ AcpiDmDumpCsrt (
|
|
Offset + SubOffset);
|
|
|
|
while ((SubOffset < Subtable->Length) &&
|
|
- ((Offset + SubOffset) < Table->Length))
|
|
+ ((Offset + SubOffset) < Length))
|
|
{
|
|
AcpiOsPrintf ("\n");
|
|
Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
|
|
@@ -405,12 +405,13 @@ AcpiDmDumpDbg2 (
|
|
{
|
|
ACPI_STATUS Status;
|
|
ACPI_DBG2_DEVICE *Subtable;
|
|
- UINT32 Length = Table->Length;
|
|
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
|
|
UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
|
|
UINT32 i;
|
|
UINT32 ArrayOffset;
|
|
UINT32 AbsoluteOffset;
|
|
UINT8 *Array;
|
|
+ UINT16 SubtableLength;
|
|
|
|
|
|
/* Main table */
|
|
@@ -424,11 +425,12 @@ AcpiDmDumpDbg2 (
|
|
/* Subtables */
|
|
|
|
Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
|
|
- while (Offset < Table->Length)
|
|
+ while (Offset < Length)
|
|
{
|
|
AcpiOsPrintf ("\n");
|
|
+ SubtableLength = AcpiUtReadUint16(&Subtable->Length);
|
|
Status = AcpiDmDumpTable (Length, Offset, Subtable,
|
|
- Subtable->Length, AcpiDmTableInfoDbg2Device);
|
|
+ SubtableLength, AcpiDmTableInfoDbg2Device);
|
|
if (ACPI_FAILURE (Status))
|
|
{
|
|
return;
|
|
@@ -438,13 +440,13 @@ AcpiDmDumpDbg2 (
|
|
|
|
for (i = 0; i < Subtable->RegisterCount; i++)
|
|
{
|
|
- ArrayOffset = Subtable->BaseAddressOffset +
|
|
+ ArrayOffset = AcpiUtReadUint16(&Subtable->BaseAddressOffset) +
|
|
(sizeof (ACPI_GENERIC_ADDRESS) * i);
|
|
AbsoluteOffset = Offset + ArrayOffset;
|
|
Array = (UINT8 *) Subtable + ArrayOffset;
|
|
|
|
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
|
|
- Subtable->Length, AcpiDmTableInfoDbg2Addr);
|
|
+ SubtableLength, AcpiDmTableInfoDbg2Addr);
|
|
if (ACPI_FAILURE (Status))
|
|
{
|
|
return;
|
|
@@ -455,13 +457,13 @@ AcpiDmDumpDbg2 (
|
|
|
|
for (i = 0; i < Subtable->RegisterCount; i++)
|
|
{
|
|
- ArrayOffset = Subtable->AddressSizeOffset +
|
|
+ ArrayOffset = AcpiUtReadUint16(&Subtable->AddressSizeOffset) +
|
|
(sizeof (UINT32) * i);
|
|
AbsoluteOffset = Offset + ArrayOffset;
|
|
Array = (UINT8 *) Subtable + ArrayOffset;
|
|
|
|
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
|
|
- Subtable->Length, AcpiDmTableInfoDbg2Size);
|
|
+ SubtableLength, AcpiDmTableInfoDbg2Size);
|
|
if (ACPI_FAILURE (Status))
|
|
{
|
|
return;
|
|
@@ -471,12 +473,12 @@ AcpiDmDumpDbg2 (
|
|
/* Dump the Namestring (required) */
|
|
|
|
AcpiOsPrintf ("\n");
|
|
- ArrayOffset = Subtable->NamepathOffset;
|
|
+ ArrayOffset = AcpiUtReadUint16(&Subtable->NamepathOffset);
|
|
AbsoluteOffset = Offset + ArrayOffset;
|
|
Array = (UINT8 *) Subtable + ArrayOffset;
|
|
|
|
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
|
|
- Subtable->Length, AcpiDmTableInfoDbg2Name);
|
|
+ SubtableLength, AcpiDmTableInfoDbg2Name);
|
|
if (ACPI_FAILURE (Status))
|
|
{
|
|
return;
|
|
@@ -486,8 +488,9 @@ AcpiDmDumpDbg2 (
|
|
|
|
if (Subtable->OemDataOffset)
|
|
{
|
|
- Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset,
|
|
- Table, Subtable->OemDataLength,
|
|
+ Status = AcpiDmDumpTable (Length,
|
|
+ Offset + AcpiUtReadUint16(&Subtable->OemDataOffset),
|
|
+ Table, AcpiUtReadUint16(&Subtable->OemDataLength),
|
|
AcpiDmTableInfoDbg2OemData);
|
|
if (ACPI_FAILURE (Status))
|
|
{
|
|
@@ -497,9 +500,9 @@ AcpiDmDumpDbg2 (
|
|
|
|
/* Point to next subtable */
|
|
|
|
- Offset += Subtable->Length;
|
|
+ Offset += SubtableLength;
|
|
Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
|
|
- Subtable->Length);
|
|
+ SubtableLength);
|
|
}
|
|
}
|
|
|
|
Index: acpica-unix2-20200925/source/compiler/dttable1.c
|
|
===================================================================
|
|
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
|
|
+++ acpica-unix2-20200925/source/compiler/dttable1.c
|
|
@@ -281,6 +281,7 @@ DtCompileCsrt (
|
|
DT_FIELD **PFieldList = (DT_FIELD **) List;
|
|
UINT32 DescriptorCount;
|
|
UINT32 GroupLength;
|
|
+ UINT32 Tmp;
|
|
|
|
|
|
/* Subtables (Resource Groups) */
|
|
@@ -299,12 +300,13 @@ DtCompileCsrt (
|
|
|
|
/* Compute the number of resource descriptors */
|
|
|
|
- GroupLength =
|
|
- (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
|
|
- Subtable->Buffer))->Length -
|
|
- (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
|
|
- Subtable->Buffer))->SharedInfoLength -
|
|
- sizeof (ACPI_CSRT_GROUP);
|
|
+ Tmp = AcpiUtReadUint32(&(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
|
|
+ Subtable->Buffer))->Length);
|
|
+ GroupLength = Tmp;
|
|
+ Tmp = AcpiUtReadUint32(&(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
|
|
+ Subtable->Buffer))->SharedInfoLength);
|
|
+ GroupLength -= Tmp;
|
|
+ GroupLength -= sizeof (ACPI_CSRT_GROUP);
|
|
|
|
DescriptorCount = (GroupLength /
|
|
sizeof (ACPI_CSRT_DESCRIPTOR));
|
|
@@ -392,6 +394,7 @@ DtCompileDbg2 (
|
|
ACPI_DBG2_DEVICE *DeviceInfo;
|
|
UINT16 CurrentOffset;
|
|
UINT32 i;
|
|
+ UINT32 Tmp;
|
|
|
|
|
|
/* Main table */
|
|
@@ -408,10 +411,12 @@ DtCompileDbg2 (
|
|
/* Main table fields */
|
|
|
|
Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
|
|
- Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
|
|
- ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
|
|
+ Tmp = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
|
|
+ ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
|
|
+ AcpiUtWriteUint(&Dbg2Header->InfoOffset, sizeof(UINT32),
|
|
+ &Tmp, sizeof(UINT32));
|
|
|
|
- SubtableCount = Dbg2Header->InfoCount;
|
|
+ SubtableCount = Tmp;
|
|
DtPushSubtable (Subtable);
|
|
|
|
/* Process all Device Information subtables (Count = InfoCount) */
|
|
@@ -438,7 +443,8 @@ DtCompileDbg2 (
|
|
|
|
/* BaseAddressRegister GAS array (Required, size is RegisterCount) */
|
|
|
|
- DeviceInfo->BaseAddressOffset = CurrentOffset;
|
|
+ AcpiUtWriteUint(&DeviceInfo->BaseAddressOffset, sizeof(UINT16),
|
|
+ &CurrentOffset, sizeof(UINT16));
|
|
for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
|
|
{
|
|
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
|
|
@@ -454,7 +460,8 @@ DtCompileDbg2 (
|
|
|
|
/* AddressSize array (Required, size = RegisterCount) */
|
|
|
|
- DeviceInfo->AddressSizeOffset = CurrentOffset;
|
|
+ AcpiUtWriteUint(&DeviceInfo->AddressSizeOffset, sizeof(UINT16),
|
|
+ &CurrentOffset, sizeof(UINT16));
|
|
for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
|
|
{
|
|
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
|
|
@@ -470,7 +477,8 @@ DtCompileDbg2 (
|
|
|
|
/* NamespaceString device identifier (Required, size = NamePathLength) */
|
|
|
|
- DeviceInfo->NamepathOffset = CurrentOffset;
|
|
+ AcpiUtWriteUint(&DeviceInfo->NamepathOffset, sizeof(UINT16),
|
|
+ &CurrentOffset, sizeof(UINT16));
|
|
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
|
|
&Subtable);
|
|
if (ACPI_FAILURE (Status))
|
|
@@ -480,8 +488,9 @@ DtCompileDbg2 (
|
|
|
|
/* Update the device info header */
|
|
|
|
- DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
|
|
- CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
|
|
+ AcpiUtWriteUint(&DeviceInfo->NamepathLength, sizeof(UINT16),
|
|
+ &Subtable->Length, sizeof(UINT32));
|
|
+ CurrentOffset += AcpiUtReadUint16(&DeviceInfo->NamepathLength);
|
|
DtInsertSubtable (ParentTable, Subtable);
|
|
|
|
/* OemData - Variable-length data (Optional, size = OemDataLength) */
|
|
@@ -508,8 +517,10 @@ DtCompileDbg2 (
|
|
|
|
if (Subtable && Subtable->Length)
|
|
{
|
|
- DeviceInfo->OemDataOffset = CurrentOffset;
|
|
- DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
|
|
+ AcpiUtWriteUint(&DeviceInfo->OemDataOffset, sizeof(UINT16),
|
|
+ &CurrentOffset, sizeof(UINT16));
|
|
+ AcpiUtWriteUint(&DeviceInfo->OemDataLength, sizeof(UINT16),
|
|
+ &Subtable->Length, sizeof(UINT32));
|
|
|
|
DtInsertSubtable (ParentTable, Subtable);
|
|
}
|