2021-07-23 13:25:41 +00:00
|
|
|
From 06623392351dfea54bd69507b6672c933a5e3fd2 Mon Sep 17 00:00:00 2001
|
2020-10-31 11:18:15 +00:00
|
|
|
From: Al Stone <ahs3@redhat.com>
|
|
|
|
Date: Sat, 19 Sep 2020 15:22:00 -0600
|
2021-07-23 13:25:41 +00:00
|
|
|
Subject: [PATCH 12/45] Support DMAR in a big-endian world
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
Signed-off-by: Al Stone <ahs3@redhat.com>
|
|
|
|
---
|
|
|
|
source/common/dmtable.c | 4 ++--
|
|
|
|
source/common/dmtbdump1.c | 26 +++++++++++++++-----------
|
|
|
|
source/compiler/dttable1.c | 12 +++++++-----
|
|
|
|
3 files changed, 24 insertions(+), 18 deletions(-)
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
Index: acpica-unix2-20210604/source/common/dmtable.c
|
2020-10-31 11:18:15 +00:00
|
|
|
===================================================================
|
2021-07-23 13:25:41 +00:00
|
|
|
--- acpica-unix2-20210604.orig/source/common/dmtable.c
|
|
|
|
+++ acpica-unix2-20210604/source/common/dmtable.c
|
|
|
|
@@ -1341,13 +1341,13 @@ AcpiDmDumpTable (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
/* DMAR subtable types */
|
|
|
|
|
|
|
|
- Temp16 = ACPI_GET16 (Target);
|
|
|
|
+ Temp16 = AcpiUtReadUint16 (Target);
|
|
|
|
if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
|
|
|
|
{
|
|
|
|
Temp16 = ACPI_DMAR_TYPE_RESERVED;
|
|
|
|
}
|
|
|
|
|
|
|
|
- AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
|
|
|
|
+ AcpiOsPrintf (UINT16_FORMAT, Temp16,
|
|
|
|
AcpiDmDmarSubnames[Temp16]);
|
|
|
|
break;
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
Index: acpica-unix2-20210604/source/common/dmtbdump1.c
|
2020-10-31 11:18:15 +00:00
|
|
|
===================================================================
|
2021-07-23 13:25:41 +00:00
|
|
|
--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c
|
|
|
|
+++ acpica-unix2-20210604/source/common/dmtbdump1.c
|
|
|
|
@@ -604,13 +604,15 @@ AcpiDmDumpDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
{
|
|
|
|
ACPI_STATUS Status;
|
|
|
|
ACPI_DMAR_HEADER *Subtable;
|
|
|
|
- UINT32 Length = Table->Length;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ UINT32 Length = AcpiUtReadUint32 (&Table->Length);
|
2020-10-31 11:18:15 +00:00
|
|
|
UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
|
|
|
|
ACPI_DMTABLE_INFO *InfoTable;
|
|
|
|
ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
|
|
|
|
UINT32 ScopeOffset;
|
|
|
|
UINT8 *PciPath;
|
|
|
|
UINT32 PathOffset;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ UINT16 SubtableType;
|
|
|
|
+ UINT16 SubtableLength;
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Main table */
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -624,13 +626,14 @@ AcpiDmDumpDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
/* Subtables */
|
|
|
|
|
|
|
|
Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
|
|
|
|
- while (Offset < Table->Length)
|
|
|
|
+ while (Offset < Length)
|
|
|
|
{
|
|
|
|
/* Common subtable header */
|
|
|
|
|
|
|
|
AcpiOsPrintf ("\n");
|
2021-07-23 13:25:41 +00:00
|
|
|
+ SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
|
2020-10-31 11:18:15 +00:00
|
|
|
Status = AcpiDmDumpTable (Length, Offset, Subtable,
|
|
|
|
- Subtable->Length, AcpiDmTableInfoDmarHdr);
|
|
|
|
+ SubtableLength, AcpiDmTableInfoDmarHdr);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return;
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -638,7 +641,8 @@ AcpiDmDumpDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
AcpiOsPrintf ("\n");
|
|
|
|
|
|
|
|
- switch (Subtable->Type)
|
2021-07-23 13:25:41 +00:00
|
|
|
+ SubtableType = AcpiUtReadUint16 (&Subtable->Type);
|
2020-10-31 11:18:15 +00:00
|
|
|
+ switch (SubtableType)
|
|
|
|
{
|
|
|
|
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -673,12 +677,12 @@ AcpiDmDumpDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
default:
|
|
|
|
|
|
|
|
AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
|
|
|
|
- Subtable->Type);
|
|
|
|
+ SubtableType);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Status = AcpiDmDumpTable (Length, Offset, Subtable,
|
|
|
|
- Subtable->Length, InfoTable);
|
|
|
|
+ SubtableLength, InfoTable);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return;
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -687,8 +691,8 @@ AcpiDmDumpDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
/*
|
|
|
|
* Dump the optional device scope entries
|
|
|
|
*/
|
|
|
|
- if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
|
|
|
|
- (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
|
|
|
|
+ if ((SubtableType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
|
|
|
|
+ (SubtableType == ACPI_DMAR_TYPE_NAMESPACE))
|
|
|
|
{
|
|
|
|
/* These types do not support device scopes */
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -696,7 +700,7 @@ AcpiDmDumpDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
|
|
|
|
- while (ScopeOffset < Subtable->Length)
|
|
|
|
+ while (ScopeOffset < SubtableLength)
|
|
|
|
{
|
|
|
|
AcpiOsPrintf ("\n");
|
|
|
|
Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -737,9 +741,9 @@ AcpiDmDumpDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
NextSubtable:
|
|
|
|
/* Point to next subtable */
|
|
|
|
|
|
|
|
- Offset += Subtable->Length;
|
|
|
|
+ Offset += SubtableLength;
|
|
|
|
Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
|
|
|
|
- Subtable->Length);
|
|
|
|
+ SubtableLength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
Index: acpica-unix2-20210604/source/compiler/dttable1.c
|
2020-10-31 11:18:15 +00:00
|
|
|
===================================================================
|
2021-07-23 13:25:41 +00:00
|
|
|
--- acpica-unix2-20210604.orig/source/compiler/dttable1.c
|
|
|
|
+++ acpica-unix2-20210604/source/compiler/dttable1.c
|
|
|
|
@@ -634,6 +634,7 @@ DtCompileDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
|
|
|
|
UINT32 DeviceScopeLength;
|
|
|
|
UINT32 PciPathLength;
|
|
|
|
+ UINT16 DmarHeaderType;
|
|
|
|
|
|
|
|
|
|
|
|
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -664,7 +665,8 @@ DtCompileDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
|
|
|
|
DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
|
|
|
|
|
|
|
|
- switch (DmarHeader->Type)
|
2021-07-23 13:25:41 +00:00
|
|
|
+ DmarHeaderType = AcpiUtReadUint16 (&DmarHeader->Type);
|
2020-10-31 11:18:15 +00:00
|
|
|
+ switch (DmarHeaderType)
|
|
|
|
{
|
|
|
|
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -711,8 +713,8 @@ DtCompileDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
/*
|
|
|
|
* Optional Device Scope subtables
|
|
|
|
*/
|
|
|
|
- if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
|
|
|
|
- (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
|
|
|
|
+ if ((DmarHeaderType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
|
|
|
|
+ (DmarHeaderType == ACPI_DMAR_TYPE_NAMESPACE))
|
|
|
|
{
|
|
|
|
/* These types do not support device scopes */
|
|
|
|
|
2021-07-23 13:25:41 +00:00
|
|
|
@@ -721,8 +723,8 @@ DtCompileDmar (
|
2020-10-31 11:18:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
- DeviceScopeLength = DmarHeader->Length - Subtable->Length -
|
|
|
|
- ParentTable->Length;
|
2021-07-23 13:25:41 +00:00
|
|
|
+ DeviceScopeLength = AcpiUtReadUint16 (&DmarHeader->Length) -
|
|
|
|
+ Subtable->Length - ParentTable->Length;
|
2020-10-31 11:18:15 +00:00
|
|
|
while (DeviceScopeLength)
|
|
|
|
{
|
|
|
|
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
|