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