2021-07-12 03:22:10 +00:00
|
|
|
From 06623392351dfea54bd69507b6672c933a5e3fd2 Mon Sep 17 00:00:00 2001
|
2020-10-19 18:24:09 +00:00
|
|
|
From: Al Stone <ahs3@redhat.com>
|
|
|
|
Date: Sat, 19 Sep 2020 15:22:00 -0600
|
2021-07-12 03:22:10 +00:00
|
|
|
Subject: [PATCH 12/45] Support DMAR in a big-endian world
|
2020-10-19 18:24:09 +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(-)
|
|
|
|
|
2022-03-18 22:08:40 +00:00
|
|
|
Index: acpica-unix2-20211217/source/common/dmtable.c
|
2020-10-19 18:24:09 +00:00
|
|
|
===================================================================
|
2022-03-18 22:08:40 +00:00
|
|
|
--- acpica-unix2-20211217.orig/source/common/dmtable.c
|
|
|
|
+++ acpica-unix2-20211217/source/common/dmtable.c
|
|
|
|
@@ -1570,13 +1570,13 @@ AcpiDmDumpTable (
|
2020-10-19 18:24:09 +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;
|
|
|
|
|
2022-03-18 22:08:40 +00:00
|
|
|
Index: acpica-unix2-20211217/source/common/dmtbdump1.c
|
2020-10-19 18:24:09 +00:00
|
|
|
===================================================================
|
2022-03-18 22:08:40 +00:00
|
|
|
--- acpica-unix2-20211217.orig/source/common/dmtbdump1.c
|
|
|
|
+++ acpica-unix2-20211217/source/common/dmtbdump1.c
|
|
|
|
@@ -821,13 +821,15 @@ AcpiDmDumpDmar (
|
2020-10-19 18:24:09 +00:00
|
|
|
{
|
|
|
|
ACPI_STATUS Status;
|
|
|
|
ACPI_DMAR_HEADER *Subtable;
|
|
|
|
- UINT32 Length = Table->Length;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ UINT32 Length = AcpiUtReadUint32 (&Table->Length);
|
2020-10-19 18:24:09 +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-12 03:22:10 +00:00
|
|
|
+ UINT16 SubtableType;
|
|
|
|
+ UINT16 SubtableLength;
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Main table */
|
2022-03-18 22:08:40 +00:00
|
|
|
@@ -841,13 +843,14 @@ AcpiDmDumpDmar (
|
2020-10-19 18:24:09 +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-12 03:22:10 +00:00
|
|
|
+ SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
|
2020-10-19 18:24:09 +00:00
|
|
|
Status = AcpiDmDumpTable (Length, Offset, Subtable,
|
|
|
|
- Subtable->Length, AcpiDmTableInfoDmarHdr);
|
|
|
|
+ SubtableLength, AcpiDmTableInfoDmarHdr);
|
|
|
|
if (ACPI_FAILURE (Status))
|
|
|
|
{
|
|
|
|
return;
|
2022-03-18 22:08:40 +00:00
|
|
|
@@ -855,7 +858,8 @@ AcpiDmDumpDmar (
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
AcpiOsPrintf ("\n");
|
|
|
|
|
|
|
|
- switch (Subtable->Type)
|
2021-07-12 03:22:10 +00:00
|
|
|
+ SubtableType = AcpiUtReadUint16 (&Subtable->Type);
|
2020-10-19 18:24:09 +00:00
|
|
|
+ switch (SubtableType)
|
|
|
|
{
|
|
|
|
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
|
|
|
|
|
2022-03-18 22:08:40 +00:00
|
|
|
@@ -890,12 +894,12 @@ AcpiDmDumpDmar (
|
2020-10-19 18:24:09 +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;
|
2022-03-18 22:08:40 +00:00
|
|
|
@@ -904,8 +908,8 @@ AcpiDmDumpDmar (
|
2020-10-19 18:24:09 +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 */
|
|
|
|
|
2022-03-18 22:08:40 +00:00
|
|
|
@@ -913,7 +917,7 @@ AcpiDmDumpDmar (
|
2020-10-19 18:24:09 +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,
|
2022-03-18 22:08:40 +00:00
|
|
|
@@ -954,9 +958,9 @@ AcpiDmDumpDmar (
|
2020-10-19 18:24:09 +00:00
|
|
|
NextSubtable:
|
|
|
|
/* Point to next subtable */
|
|
|
|
|
|
|
|
- Offset += Subtable->Length;
|
|
|
|
+ Offset += SubtableLength;
|
|
|
|
Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
|
|
|
|
- Subtable->Length);
|
|
|
|
+ SubtableLength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-18 22:08:40 +00:00
|
|
|
Index: acpica-unix2-20211217/source/compiler/dttable1.c
|
2020-10-19 18:24:09 +00:00
|
|
|
===================================================================
|
2022-03-18 22:08:40 +00:00
|
|
|
--- acpica-unix2-20211217.orig/source/compiler/dttable1.c
|
|
|
|
+++ acpica-unix2-20211217/source/compiler/dttable1.c
|
2022-03-10 02:45:13 +00:00
|
|
|
@@ -851,6 +851,7 @@ DtCompileDmar (
|
2020-10-19 18:24:09 +00:00
|
|
|
ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
|
|
|
|
UINT32 DeviceScopeLength;
|
|
|
|
UINT32 PciPathLength;
|
|
|
|
+ UINT16 DmarHeaderType;
|
|
|
|
|
|
|
|
|
|
|
|
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
|
2022-03-10 02:45:13 +00:00
|
|
|
@@ -881,7 +882,8 @@ DtCompileDmar (
|
2020-10-19 18:24:09 +00:00
|
|
|
|
|
|
|
DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
|
|
|
|
|
|
|
|
- switch (DmarHeader->Type)
|
2021-07-12 03:22:10 +00:00
|
|
|
+ DmarHeaderType = AcpiUtReadUint16 (&DmarHeader->Type);
|
2020-10-19 18:24:09 +00:00
|
|
|
+ switch (DmarHeaderType)
|
|
|
|
{
|
|
|
|
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
|
|
|
|
|
2022-03-10 02:45:13 +00:00
|
|
|
@@ -928,8 +930,8 @@ DtCompileDmar (
|
2020-10-19 18:24:09 +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 */
|
|
|
|
|
2022-03-10 02:45:13 +00:00
|
|
|
@@ -938,8 +940,8 @@ DtCompileDmar (
|
2020-10-19 18:24:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DtPushSubtable (Subtable);
|
|
|
|
- DeviceScopeLength = DmarHeader->Length - Subtable->Length -
|
|
|
|
- ParentTable->Length;
|
2021-07-12 03:22:10 +00:00
|
|
|
+ DeviceScopeLength = AcpiUtReadUint16 (&DmarHeader->Length) -
|
|
|
|
+ Subtable->Length - ParentTable->Length;
|
2020-10-19 18:24:09 +00:00
|
|
|
while (DeviceScopeLength)
|
|
|
|
{
|
|
|
|
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
|