Update to upstream 20200925 version

This update also means a major update for all of the big-endian patching
that has been done.  The older mechanism was getting to unwieldy to keep
maintained, and too sensitive to upstream changes.  Hence, redid all of
the old patches, and took the opportunity to make them more amenable to
change over time.  Ultimately, the goal is to have upstream accept these
in some form.

Signed-off-by: Al Stone <ahs3@redhat.com>
This commit is contained in:
Al Stone 2020-10-19 12:24:09 -06:00
parent f9e9c6154d
commit edb6c78416
70 changed files with 7249 additions and 7122 deletions

View File

@ -0,0 +1,372 @@
From bb45113bc9aed952a499cd1c53988dc81f597582 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Thu, 15 Oct 2020 11:53:33 -0600
Subject: [PATCH 01/40] Add in basic infrastructure for big-endian support
This adds in some basic functions -- AcpiUtReadUint32(), for example,
to read a UINT32 value in little-endian form and return it in host-native
format -- along with AcpiUtWriteUint() that writes out an integer in
host-native format as a little-endian value.
But, to do that, I'm adding the functions in a new file: utendian.c. So,
the header files need fixing, and the makefiles need to be sure to compile
the new code.
However, this sets things up for the future, where endian-aware code can
be added as the need is uncovered. For now, these functions cover all of
the cases I know about.
Signed-off-by: Al Stone <ahs3@redhat.com>
---
generate/unix/acpibin/Makefile | 1 +
generate/unix/acpidump/Makefile | 1 +
generate/unix/acpiexamples/Makefile | 1 +
generate/unix/acpiexec/Makefile | 1 +
generate/unix/acpihelp/Makefile | 1 +
generate/unix/iasl/Makefile | 1 +
source/components/utilities/utendian.c | 205 +++++++++++++++++++++++++
source/include/acutils.h | 26 ++++
source/include/platform/aclinux.h | 5 +
9 files changed, 242 insertions(+)
create mode 100644 source/components/utilities/utendian.c
Index: acpica-unix2-20200925/generate/unix/acpibin/Makefile
===================================================================
--- acpica-unix2-20200925.orig/generate/unix/acpibin/Makefile
+++ acpica-unix2-20200925/generate/unix/acpibin/Makefile
@@ -37,6 +37,7 @@ OBJECTS = \
$(OBJDIR)/utcache.o\
$(OBJDIR)/utdebug.o\
$(OBJDIR)/utdecode.o\
+ $(OBJDIR)/utendian.o\
$(OBJDIR)/utexcep.o\
$(OBJDIR)/utglobal.o\
$(OBJDIR)/utlock.o\
Index: acpica-unix2-20200925/generate/unix/acpidump/Makefile
===================================================================
--- acpica-unix2-20200925.orig/generate/unix/acpidump/Makefile
+++ acpica-unix2-20200925/generate/unix/acpidump/Makefile
@@ -36,6 +36,7 @@ OBJECTS = \
$(OBJDIR)/osunixdir.o\
$(OBJDIR)/osunixmap.o\
$(OBJDIR)/osunixxf.o\
+ $(OBJDIR)/utendian.o\
$(OBJDIR)/tbprint.o\
$(OBJDIR)/tbxfroot.o\
$(OBJDIR)/utascii.o\
Index: acpica-unix2-20200925/generate/unix/acpiexamples/Makefile
===================================================================
--- acpica-unix2-20200925.orig/generate/unix/acpiexamples/Makefile
+++ acpica-unix2-20200925/generate/unix/acpiexamples/Makefile
@@ -139,6 +139,7 @@ OBJECTS = \
$(OBJDIR)/utdebug.o\
$(OBJDIR)/utdecode.o\
$(OBJDIR)/utdelete.o\
+ $(OBJDIR)/utendian.o\
$(OBJDIR)/uterror.o\
$(OBJDIR)/uteval.o\
$(OBJDIR)/utexcep.o\
Index: acpica-unix2-20200925/generate/unix/acpiexec/Makefile
===================================================================
--- acpica-unix2-20200925.orig/generate/unix/acpiexec/Makefile
+++ acpica-unix2-20200925/generate/unix/acpiexec/Makefile
@@ -214,6 +214,7 @@ OBJECTS = \
$(OBJDIR)/utdebug.o\
$(OBJDIR)/utdecode.o\
$(OBJDIR)/utdelete.o\
+ $(OBJDIR)/utendian.o\
$(OBJDIR)/uterror.o\
$(OBJDIR)/uteval.o\
$(OBJDIR)/utexcep.o\
Index: acpica-unix2-20200925/generate/unix/acpihelp/Makefile
===================================================================
--- acpica-unix2-20200925.orig/generate/unix/acpihelp/Makefile
+++ acpica-unix2-20200925/generate/unix/acpihelp/Makefile
@@ -43,6 +43,7 @@ OBJECTS = \
$(OBJDIR)/getopt.o\
$(OBJDIR)/osunixxf.o\
$(OBJDIR)/utdebug.o\
+ $(OBJDIR)/utendian.o\
$(OBJDIR)/utexcep.o\
$(OBJDIR)/utglobal.o\
$(OBJDIR)/uthex.o\
Index: acpica-unix2-20200925/generate/unix/iasl/Makefile
===================================================================
--- acpica-unix2-20200925.orig/generate/unix/iasl/Makefile
+++ acpica-unix2-20200925/generate/unix/iasl/Makefile
@@ -225,6 +225,7 @@ OBJECTS = \
$(OBJDIR)/utdebug.o\
$(OBJDIR)/utdecode.o\
$(OBJDIR)/utdelete.o\
+ $(OBJDIR)/utendian.o\
$(OBJDIR)/uterror.o\
$(OBJDIR)/utexcep.o\
$(OBJDIR)/utglobal.o\
Index: acpica-unix2-20200925/source/components/utilities/utendian.c
===================================================================
--- /dev/null
+++ acpica-unix2-20200925/source/components/utilities/utendian.c
@@ -0,0 +1,205 @@
+/******************************************************************************
+ *
+ * Module Name: utendian -- byte swapping support for other-endianness
+ *
+ *****************************************************************************/
+
+/*****************************************************************************
+ *
+ * Copyright (c) 2020, Al Stone <ahs3@redhat.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Alternatively, you may choose to be licensed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("utendian")
+
+
+/*
+ * Endianness support functions.
+ *
+ * Ultimately, everything in ACPI tables or AML must be in little-endian
+ * format. However, we sometimes find it necessary to run on a big-endian
+ * machine and create or read those little-endian values. This is a small
+ * libary of functions to make that easier, and more visible.
+ *
+ */
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReadUint16
+ *
+ * PARAMETERS: Src - location containing the little-endian
+ * value
+ *
+ * RETURN: UINT16 value in host-native form
+ *
+ * DESCRIPTION: Read a UINT16 little-endian value from a given location
+ * and return it in host-native form
+ *
+ ******************************************************************************/
+
+#if defined(ACPI_BIG_ENDIAN)
+UINT16 AcpiUtReadUint16 (void *SrcPtr)
+{
+ UINT16 Result = 0;
+ UINT8 *Dst = (UINT8 *)&Result;
+ UINT8 *Src = (UINT8 *)SrcPtr;
+
+ Dst[0] = Src[1];
+ Dst[1] = Src[0];
+
+ return Result;
+}
+#else
+UINT16 AcpiUtReadUint16 (void *SrcPtr) { return *(UINT16 *)SrcPtr; }
+#endif
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReadUint32
+ *
+ * PARAMETERS: Src - location containing the little-endian
+ * value
+ *
+ * RETURN: UINT32 value in host-native form
+ *
+ * DESCRIPTION: Read a UINT32 little-endian value from a given location
+ * and return it in host-native form
+ *
+ ******************************************************************************/
+
+#if defined(ACPI_BIG_ENDIAN)
+UINT32 AcpiUtReadUint32 (void *SrcPtr)
+{
+ UINT32 Result = 0;
+ UINT8 *Dst = (UINT8 *)&Result;
+ UINT8 *Src = (UINT8 *)SrcPtr;
+
+ Dst[0] = Src[3];
+ Dst[1] = Src[2];
+ Dst[2] = Src[1];
+ Dst[3] = Src[0];
+
+ return Result;
+}
+#else
+UINT32 AcpiUtReadUint32 (void *SrcPtr) { return *(UINT32 *)SrcPtr; }
+#endif
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReadUint64
+ *
+ * PARAMETERS: Src - location containing the little-endian
+ * value
+ *
+ * RETURN: UINT64 value in host-native form
+ *
+ * DESCRIPTION: Read a UINT64 little-endian value from a given location
+ * and return it in host-native form
+ *
+ ******************************************************************************/
+
+#if defined(ACPI_BIG_ENDIAN)
+UINT64 AcpiUtReadUint64 (void *SrcPtr)
+{
+ UINT64 Result = 0;
+ UINT8 *Dst = (UINT8 *)&Result;
+ UINT8 *Src = (UINT8 *)SrcPtr;
+
+ Dst[0] = Src[7];
+ Dst[1] = Src[6];
+ Dst[2] = Src[5];
+ Dst[3] = Src[4];
+ Dst[4] = Src[3];
+ Dst[5] = Src[2];
+ Dst[6] = Src[1];
+ Dst[7] = Src[0];
+
+ return Result;
+}
+#else
+UINT64 AcpiUtReadUint64 (void *SrcPtr) { return *(UINT64 *)SrcPtr; }
+#endif
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtWriteUint
+ *
+ * PARAMETERS: DstPtr - where to place the retrieved value
+ * DstLength - space in bytes for this int type
+ * SrcPtr - where the little-endian value lives
+ * SrcLength - space in bytes for this int type
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Write a host-native integer value of the given size, and
+ * store it in the location specified in little-endian form.
+ * Given the amount of integer type casting done, this general
+ * version seems the most useful (vs 32->32, 32->16, 16->32,
+ * ad infinitum)
+ *
+ ******************************************************************************/
+
+#if defined(ACPI_BIG_ENDIAN)
+void AcpiUtWriteUint (void *DstPtr, int DstLength,
+ const void *SrcPtr, const int SrcLength)
+{
+ UINT8 *Dst = (UINT8 *)DstPtr;
+ UINT8 *Src = (UINT8 *)SrcPtr;
+ int Length;
+ int ii;
+
+ Length = SrcLength >= DstLength ? DstLength : SrcLength;
+ for (ii = 0; ii < Length; ii++)
+ Dst[ii] = Src[SrcLength - ii - 1];
+
+}
+#else
+void AcpiUtWriteUint (void *DstPtr, int DstLength,
+ const void *SrcPtr, const int SrcLength)
+{
+ UINT8 *Dst = (UINT8 *)DstPtr;
+ UINT8 *Src = (UINT8 *)SrcPtr;
+ uint Length;
+
+ Length = SrcLength > DstLength ? DstLength : SrcLength;
+ memcpy(Dst, Src, Length);
+}
+#endif
+
Index: acpica-unix2-20200925/source/include/acutils.h
===================================================================
--- acpica-unix2-20200925.orig/source/include/acutils.h
+++ acpica-unix2-20200925/source/include/acutils.h
@@ -1161,4 +1161,30 @@ AcpiUtConvertStringToUuid (
UINT8 *UuidBuffer);
#endif
+/*
+ * utendian -- byte-swapping for big-endian support
+ */
+#if defined(ACPI_ASL_COMPILER) || defined(ACPI_EXEC_APP) || \
+ defined(ACPI_HELP_APP) || defined(ACPI_DUMP_APP) || \
+ defined(ACPI_EXAMPLE_APP) || defined(ACPI_BIN_APP)
+UINT32
+AcpiUtReadUint32 (
+ void *SrcPtr);
+
+UINT16
+AcpiUtReadUint16 (
+ void *SrcPtr);
+
+UINT64
+AcpiUtReadUint64 (
+ void *SrcPtr);
+
+void
+AcpiUtWriteUint (
+ void *DstPtr,
+ int DstLength,
+ const void *SrcPtr,
+ const int SrcLength);
+#endif
+
#endif /* _ACUTILS_H */
Index: acpica-unix2-20200925/source/include/platform/aclinux.h
===================================================================
--- acpica-unix2-20200925.orig/source/include/platform/aclinux.h
+++ acpica-unix2-20200925/source/include/platform/aclinux.h
@@ -198,6 +198,7 @@
#ifdef ACPI_USE_STANDARD_HEADERS
#include <unistd.h>
+#include <endian.h>
#endif
/* Define/disable kernel-specific declarators */
@@ -233,6 +234,10 @@
#define __cdecl
#endif
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define ACPI_BIG_ENDIAN
+#endif
+
#endif /* __KERNEL__ */
#endif /* __ACLINUX_H__ */

View File

@ -0,0 +1,200 @@
From d0c879747147c24c47bae363359127d62cd0cae1 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 18 Sep 2020 15:14:30 -0600
Subject: [PATCH 02/40] Modify utility functions to be endian-agnostic
All of the modifications here use the big-endian code previously added
(see utendian.c) to make themselves endian-agnostic; i.e., that the code
does not need to change further to work on both big- and little-endian
machines.
These particular files were changed to handle the reading and writing
of files (the length is often embedded in the binary stream), and to
handle the reading and writing of integer values. The common cases are
to "read" a 32-bit unsigned int in little-endian format, but convert it
to host-native, and to write a byte, word, double word or quad word value
as little-endian, regardless of host-native format.
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/acfileio.c | 16 ++++++++++------
source/common/dmtable.c | 8 ++++----
source/compiler/dtfield.c | 2 +-
source/compiler/dtsubtable.c | 4 ++--
source/components/tables/tbprint.c | 13 +++++++++----
5 files changed, 26 insertions(+), 17 deletions(-)
Index: acpica-unix2-20200925/source/common/acfileio.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/acfileio.c
+++ acpica-unix2-20200925/source/common/acfileio.c
@@ -280,6 +280,7 @@ AcGetOneTableFromFile (
ACPI_TABLE_HEADER *Table;
INT32 Count;
long TableOffset;
+ UINT32 Length;
*ReturnTable = NULL;
@@ -319,7 +320,8 @@ AcGetOneTableFromFile (
/* Allocate a buffer for the entire table */
- Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
+ Length = AcpiUtReadUint32(&TableHeader.Length);
+ Table = AcpiOsAllocate ((ACPI_SIZE) Length);
if (!Table)
{
return (AE_NO_MEMORY);
@@ -329,13 +331,13 @@ AcGetOneTableFromFile (
fseek (File, TableOffset, SEEK_SET);
- Count = fread (Table, 1, TableHeader.Length, File);
+ Count = fread (Table, 1, Length, File);
/*
* Checks for data table headers happen later in the execution. Only verify
* for Aml tables at this point in the code.
*/
- if (GetOnlyAmlTables && Count != (INT32) TableHeader.Length)
+ if (GetOnlyAmlTables && Count != (INT32) Length)
{
Status = AE_ERROR;
goto ErrorExit;
@@ -343,7 +345,7 @@ AcGetOneTableFromFile (
/* Validate the checksum (just issue a warning) */
- Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
+ Status = AcpiTbVerifyChecksum (Table, Length);
if (ACPI_FAILURE (Status))
{
Status = AcCheckTextModeCorruption (Table);
@@ -436,6 +438,7 @@ AcValidateTableHeader (
long OriginalOffset;
UINT32 FileSize;
UINT32 i;
+ UINT32 Length;
ACPI_FUNCTION_TRACE (AcValidateTableHeader);
@@ -464,11 +467,12 @@ AcValidateTableHeader (
/* Validate table length against bytes remaining in the file */
FileSize = CmGetFileSize (File);
- if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
+ Length = AcpiUtReadUint32(&TableHeader.Length);
+ if (Length > (UINT32) (FileSize - TableOffset))
{
fprintf (stderr, "Table [%4.4s] is too long for file - "
"needs: 0x%.2X, remaining in file: 0x%.2X\n",
- TableHeader.Signature, TableHeader.Length,
+ TableHeader.Signature, Length,
(UINT32) (FileSize - TableOffset));
return (AE_BAD_HEADER);
}
Index: acpica-unix2-20200925/source/common/dmtable.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtable.c
+++ acpica-unix2-20200925/source/common/dmtable.c
@@ -534,7 +534,7 @@ AcpiDmDumpDataTable (
{
/* Dump the raw table data */
- Length = Table->Length;
+ Length = AcpiUtReadUint32(&Table->Length);
AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
@@ -551,7 +551,7 @@ AcpiDmDumpDataTable (
*/
if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
{
- Length = Table->Length;
+ Length = AcpiUtReadUint32(&Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
if (ACPI_FAILURE (Status))
{
@@ -571,7 +571,7 @@ AcpiDmDumpDataTable (
/*
* All other tables must use the common ACPI table header, dump it now
*/
- Length = Table->Length;
+ Length = AcpiUtReadUint32(&Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
if (ACPI_FAILURE (Status))
{
@@ -1179,7 +1179,7 @@ AcpiDmDumpTable (
AcpiOsPrintf ("%2.2X", *Target);
Temp8 = AcpiDmGenerateChecksum (Table,
- ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
+ AcpiUtReadUint32(&(ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length)),
ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
Index: acpica-unix2-20200925/source/compiler/dtfield.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dtfield.c
+++ acpica-unix2-20200925/source/compiler/dtfield.c
@@ -361,7 +361,7 @@ DtCompileInteger (
DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, AslGbl_MsgBuffer);
}
- memcpy (Buffer, &Value, ByteLength);
+ AcpiUtWriteUint(Buffer, ByteLength, &Value, sizeof(UINT64));
return;
}
Index: acpica-unix2-20200925/source/compiler/dtsubtable.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dtsubtable.c
+++ acpica-unix2-20200925/source/compiler/dtsubtable.c
@@ -378,6 +378,6 @@ DtSetSubtableLength (
return;
}
- memcpy (Subtable->LengthField, &Subtable->TotalLength,
- Subtable->SizeOfLengthField);
+ AcpiUtWriteUint(Subtable->LengthField, Subtable->SizeOfLengthField,
+ &Subtable->TotalLength, sizeof(Subtable->TotalLength));
}
Index: acpica-unix2-20200925/source/components/tables/tbprint.c
===================================================================
--- acpica-unix2-20200925.orig/source/components/tables/tbprint.c
+++ acpica-unix2-20200925/source/components/tables/tbprint.c
@@ -44,6 +44,8 @@
#include "acpi.h"
#include "accommon.h"
#include "actables.h"
+#include "platform/acenv.h"
+#include "acutils.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbprint")
@@ -151,7 +153,7 @@ AcpiTbPrintTableHeader (
ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
Header->Signature, ACPI_FORMAT_UINT64 (Address),
- Header->Length));
+ AcpiUtReadUint32(&Header->Length)));
}
else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
{
@@ -178,9 +180,12 @@ AcpiTbPrintTableHeader (
"%-4.4s 0x%8.8X%8.8X"
" %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
- LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
- LocalHeader.OemTableId, LocalHeader.OemRevision,
- LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
+ AcpiUtReadUint32(&LocalHeader.Length),
+ LocalHeader.Revision, LocalHeader.OemId,
+ LocalHeader.OemTableId,
+ AcpiUtReadUint32(&LocalHeader.OemRevision),
+ LocalHeader.AslCompilerId,
+ AcpiUtReadUint32(&LocalHeader.AslCompilerRevision)));
}
}

View File

@ -0,0 +1,51 @@
From 08862d9a4be8262c045549c287adf1e6c320cbec Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 18 Sep 2020 15:20:37 -0600
Subject: [PATCH 03/40] Always display table header content in human-readable
form
When comparing two binary data tables, little-endian values are read
from each table header and printed out. Make sure they show up in a
form that makes sense to humans.
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/tools/acpibin/abcompare.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
Index: acpica-unix2-20200925/source/tools/acpibin/abcompare.c
===================================================================
--- acpica-unix2-20200925.orig/source/tools/acpibin/abcompare.c
+++ acpica-unix2-20200925/source/tools/acpibin/abcompare.c
@@ -42,6 +42,7 @@
*/
#include "acpibin.h"
+#include "acutils.h"
ACPI_TABLE_HEADER Header1;
@@ -179,14 +180,20 @@ AbPrintHeadersInfo (
/* Display header information for both headers */
printf ("Signature %8.4s : %4.4s\n", Header->Signature, Header2->Signature);
- printf ("Length %8.8X : %8.8X\n", Header->Length, Header2->Length);
+ printf ("Length %8.8X : %8.8X\n",
+ AcpiUtReadUint32(&Header->Length),
+ AcpiUtReadUint32(&Header2->Length));
printf ("Revision %8.2X : %2.2X\n", Header->Revision, Header2->Revision);
printf ("Checksum %8.2X : %2.2X\n", Header->Checksum, Header2->Checksum);
printf ("OEM ID %8.6s : %.6s\n", Header->OemId, Header2->OemId);
printf ("OEM Table ID %8.8s : %.8s\n", Header->OemTableId, Header2->OemTableId);
- printf ("OEM Revision %8.8X : %8.8X\n", Header->OemRevision, Header2->OemRevision);
+ printf ("OEM Revision %8.8X : %8.8X\n",
+ AcpiUtReadUint32(&Header->OemRevision),
+ AcpiUtReadUint32(&Header2->OemRevision));
printf ("ASL Compiler ID %8.4s : %.4s\n", Header->AslCompilerId, Header2->AslCompilerId);
- printf ("Compiler Revision %8.8X : %8.8X\n", Header->AslCompilerRevision, Header2->AslCompilerRevision);
+ printf ("Compiler Revision %8.8X : %8.8X\n",
+ AcpiUtReadUint32(&Header->AslCompilerRevision),
+ AcpiUtReadUint32(&Header2->AslCompilerRevision));
printf ("\n");
}

View File

@ -0,0 +1,78 @@
From 16c399a7e2a2c7bd8fb8f38fed202f23c3a786a9 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 16 Sep 2020 16:27:06 -0600
Subject: [PATCH 04/40] Re-enable support for big-endian machines
First, disable the big-endian check and fail. Then, make sure the
namespace gets initialized properly (NB: needed even if we are only
compiling/disassembling data tables).
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/compiler/aslmain.c | 12 ------------
source/components/namespace/nsutils.c | 7 +++++--
2 files changed, 5 insertions(+), 14 deletions(-)
Index: acpica-unix2-20200925/source/compiler/aslmain.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/aslmain.c
+++ acpica-unix2-20200925/source/compiler/aslmain.c
@@ -101,18 +101,6 @@ main (
signal (SIGINT, AslSignalHandler);
- /*
- * Big-endian machines are not currently supported. ACPI tables must
- * be little-endian, and support for big-endian machines needs to
- * be implemented.
- */
- if (UtIsBigEndianMachine ())
- {
- fprintf (stderr,
- "iASL is not currently supported on big-endian machines.\n");
- return (-1);
- }
-
AcpiOsInitialize ();
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
Index: acpica-unix2-20200925/source/components/namespace/nsutils.c
===================================================================
--- acpica-unix2-20200925.orig/source/components/namespace/nsutils.c
+++ acpica-unix2-20200925/source/components/namespace/nsutils.c
@@ -272,6 +272,7 @@ AcpiNsBuildInternalName (
const char *ExternalName = Info->NextExternalChar;
char *Result = NULL;
UINT32 i;
+ char TmpSeg[ACPI_NAMESEG_SIZE+1];
ACPI_FUNCTION_TRACE (NsBuildInternalName);
@@ -335,6 +336,7 @@ AcpiNsBuildInternalName (
for (; NumSegments; NumSegments--)
{
+ memset(TmpSeg, 0, ACPI_NAMESEG_SIZE+1);
for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
{
if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
@@ -342,16 +344,17 @@ AcpiNsBuildInternalName (
{
/* Pad the segment with underscore(s) if segment is short */
- Result[i] = '_';
+ TmpSeg[i] = '_';
}
else
{
/* Convert the character to uppercase and save it */
- Result[i] = (char) toupper ((int) *ExternalName);
+ TmpSeg[i] = (char) toupper ((int) *ExternalName);
ExternalName++;
}
}
+ AcpiUtWriteUint(Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE);
/* Now we must have a path separator, or the pathname is bad */

View File

@ -0,0 +1,32 @@
From f11fb1c691174eb7d236d60ad48da19e56291fef Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Thu, 15 Oct 2020 12:12:11 -0600
Subject: [PATCH 05/40] Support MADT (aka APIC) in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -607,7 +607,7 @@ AcpiDmDumpMadt (
{
ACPI_STATUS Status;
ACPI_SUBTABLE_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_MADT);
ACPI_DMTABLE_INFO *InfoTable;
@@ -623,7 +623,7 @@ AcpiDmDumpMadt (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */

View File

@ -0,0 +1,55 @@
From 5ac8e9cca71eacd4f18dba2eb89e9b65a805f712 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 18 Sep 2020 16:41:02 -0600
Subject: [PATCH 06/40] Support ASF! tables in a big-endian world
Read the table length properly and it all works right for big-endian.
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -79,16 +79,18 @@ AcpiDmDumpAsf (
UINT32 DataOffset = 0;
UINT32 i;
UINT8 Type;
+ UINT32 TableLength;
/* No main table, only subtables */
Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
- while (Offset < Table->Length)
+ TableLength = AcpiUtReadUint32(&Table->Length);
+ while (Offset < TableLength)
{
/* Common subtable header */
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
if (ACPI_FAILURE (Status))
{
@@ -146,7 +148,7 @@ AcpiDmDumpAsf (
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Header.Length, InfoTable);
if (ACPI_FAILURE (Status))
{
@@ -163,7 +165,7 @@ AcpiDmDumpAsf (
for (i = 0; i < DataCount; i++)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, DataOffset,
+ Status = AcpiDmDumpTable (TableLength, DataOffset,
DataTable, DataLength, DataInfoTable);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,32 @@
From d66af65b4cd0a2719e5a06b77f8eda5e892bfc63 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 18 Sep 2020 16:54:13 -0600
Subject: [PATCH 07/40] Support CPEP tables in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -243,7 +243,7 @@ AcpiDmDumpCpep (
{
ACPI_STATUS Status;
ACPI_CPEP_POLLING *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
@@ -258,7 +258,7 @@ AcpiDmDumpCpep (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,

View File

@ -0,0 +1,254 @@
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);
}

View File

@ -0,0 +1,171 @@
From 01aad41e59efd615ac075fcedbaab0c60f9e1e11 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Sat, 19 Sep 2020 15:22:00 -0600
Subject: [PATCH 09/40] Support DMAR in a big-endian world
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(-)
Index: acpica-unix2-20200925/source/common/dmtable.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtable.c
+++ acpica-unix2-20200925/source/common/dmtable.c
@@ -1244,13 +1244,13 @@ AcpiDmDumpTable (
/* 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;
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -526,13 +526,15 @@ AcpiDmDumpDmar (
{
ACPI_STATUS Status;
ACPI_DMAR_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
ACPI_DMTABLE_INFO *InfoTable;
ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
UINT32 ScopeOffset;
UINT8 *PciPath;
UINT32 PathOffset;
+ UINT16 SubtableType;
+ UINT16 SubtableLength;
/* Main table */
@@ -546,13 +548,14 @@ AcpiDmDumpDmar (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
+ SubtableLength = AcpiUtReadUint16(&Subtable->Length);
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoDmarHdr);
+ SubtableLength, AcpiDmTableInfoDmarHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -560,7 +563,8 @@ AcpiDmDumpDmar (
AcpiOsPrintf ("\n");
- switch (Subtable->Type)
+ SubtableType = AcpiUtReadUint16(&Subtable->Type);
+ switch (SubtableType)
{
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
@@ -595,12 +599,12 @@ AcpiDmDumpDmar (
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;
@@ -609,8 +613,8 @@ AcpiDmDumpDmar (
/*
* 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 */
@@ -618,7 +622,7 @@ AcpiDmDumpDmar (
}
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,
@@ -659,9 +663,9 @@ AcpiDmDumpDmar (
NextSubtable:
/* Point to next subtable */
- Offset += Subtable->Length;
+ Offset += SubtableLength;
Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, 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
@@ -560,6 +560,7 @@ DtCompileDmar (
ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
UINT32 DeviceScopeLength;
UINT32 PciPathLength;
+ UINT16 DmarHeaderType;
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
@@ -590,7 +591,8 @@ DtCompileDmar (
DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
- switch (DmarHeader->Type)
+ DmarHeaderType = AcpiUtReadUint16(&DmarHeader->Type);
+ switch (DmarHeaderType)
{
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
@@ -637,8 +639,8 @@ DtCompileDmar (
/*
* 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 */
@@ -647,8 +649,8 @@ DtCompileDmar (
}
DtPushSubtable (Subtable);
- DeviceScopeLength = DmarHeader->Length - Subtable->Length -
- ParentTable->Length;
+ DeviceScopeLength = AcpiUtReadUint16(&DmarHeader->Length) -
+ Subtable->Length - ParentTable->Length;
while (DeviceScopeLength)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,

View File

@ -0,0 +1,112 @@
From 9583e760908d4b7d2dabec82137d16f2492d2773 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Sat, 19 Sep 2020 15:44:06 -0600
Subject: [PATCH 10/40] Support DRTM in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 25 +++++++++++++++----------
source/compiler/dttable1.c | 6 ++++--
2 files changed, 19 insertions(+), 12 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -692,11 +692,14 @@ AcpiDmDumpDrtm (
ACPI_DRTM_RESOURCE_LIST *DrtmRl;
ACPI_DRTM_DPS_ID *DrtmDps;
UINT32 Count;
+ UINT32 ResourceCount;
+ UINT32 ValidatedTableCount;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
AcpiDmTableInfoDrtm);
if (ACPI_FAILURE (Status))
{
@@ -711,7 +714,7 @@ AcpiDmDumpDrtm (
DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (TableLength, Offset,
DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
AcpiDmTableInfoDrtm0);
if (ACPI_FAILURE (Status))
@@ -724,10 +727,11 @@ AcpiDmDumpDrtm (
/* Dump Validated table addresses */
Count = 0;
- while ((Offset < Table->Length) &&
- (DrtmVtl->ValidatedTableCount > Count))
+ ValidatedTableCount = AcpiUtReadUint32(&DrtmVtl->ValidatedTableCount);
+ while ((Offset < TableLength) &&
+ (ValidatedTableCount > Count))
{
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (TableLength, Offset,
ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
AcpiDmTableInfoDrtm0a);
if (ACPI_FAILURE (Status))
@@ -743,7 +747,7 @@ AcpiDmDumpDrtm (
DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (TableLength, Offset,
DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
AcpiDmTableInfoDrtm1);
if (ACPI_FAILURE (Status))
@@ -756,10 +760,11 @@ AcpiDmDumpDrtm (
/* Dump the Resource List */
Count = 0;
- while ((Offset < Table->Length) &&
- (DrtmRl->ResourceCount > Count))
+ ResourceCount = AcpiUtReadUint32(&DrtmRl->ResourceCount);
+ while ((Offset < TableLength) &&
+ (ResourceCount > Count))
{
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (TableLength, Offset,
ACPI_ADD_PTR (void, Table, Offset),
sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
if (ACPI_FAILURE (Status))
@@ -775,7 +780,7 @@ AcpiDmDumpDrtm (
DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
AcpiOsPrintf ("\n");
- (void) AcpiDmDumpTable (Table->Length, Offset,
+ (void) AcpiDmDumpTable (TableLength, Offset,
DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
}
Index: acpica-unix2-20200925/source/compiler/dttable1.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
+++ acpica-unix2-20200925/source/compiler/dttable1.c
@@ -775,7 +775,8 @@ DtCompileDrtm (
Count++;
}
- DrtmVtl->ValidatedTableCount = Count;
+ AcpiUtWriteUint(&DrtmVtl->ValidatedTableCount, sizeof(UINT32),
+ &Count, sizeof(UINT32));
DtPopSubtable ();
ParentTable = DtPeekSubtable ();
@@ -813,7 +814,8 @@ DtCompileDrtm (
Count++;
}
- DrtmRl->ResourceCount = Count;
+ AcpiUtWriteUint(&DrtmRl->ResourceCount, sizeof(UINT32),
+ &Count, sizeof(UINT32));
DtPopSubtable ();
ParentTable = DtPeekSubtable ();

View File

@ -0,0 +1,32 @@
From b264cb9a07faa05e6d8e5e6c2381270c218d88c4 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Sat, 19 Sep 2020 15:50:19 -0600
Subject: [PATCH 11/40] Support EINJ in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -804,7 +804,7 @@ AcpiDmDumpEinj (
{
ACPI_STATUS Status;
ACPI_WHEA_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
@@ -819,7 +819,7 @@ AcpiDmDumpEinj (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,

View File

@ -0,0 +1,32 @@
From 99f27aa1a38868a716aefd9408a8cd3788644d13 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Sat, 19 Sep 2020 15:54:56 -0600
Subject: [PATCH 12/40] Support ERST in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -857,7 +857,7 @@ AcpiDmDumpErst (
{
ACPI_STATUS Status;
ACPI_WHEA_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_ERST);
@@ -872,7 +872,7 @@ AcpiDmDumpErst (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,

View File

@ -0,0 +1,189 @@
From 3288b60b3ddc2df4656842d424bfc1e6a51b2ad2 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Sun, 20 Sep 2020 11:42:21 -0600
Subject: [PATCH 13/40] Support FADT (aka, FACP) in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump.c | 25 ++++++++++++-----------
source/components/tables/tbfadt.c | 34 +++++++++++++++++++++++--------
2 files changed, 38 insertions(+), 21 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump.c
+++ acpica-unix2-20200925/source/common/dmtbdump.c
@@ -358,11 +358,12 @@ AcpiDmDumpFadt (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
AcpiDmTableInfoFadt1);
if (ACPI_FAILURE (Status))
{
@@ -371,10 +372,10 @@ AcpiDmDumpFadt (
/* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
- if ((Table->Length > ACPI_FADT_V1_SIZE) &&
- (Table->Length <= ACPI_FADT_V2_SIZE))
+ if ((TableLength > ACPI_FADT_V1_SIZE) &&
+ (TableLength <= ACPI_FADT_V2_SIZE))
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
AcpiDmTableInfoFadt2);
if (ACPI_FAILURE (Status))
{
@@ -384,9 +385,9 @@ AcpiDmDumpFadt (
/* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
- else if (Table->Length > ACPI_FADT_V2_SIZE)
+ else if (TableLength > ACPI_FADT_V2_SIZE)
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
AcpiDmTableInfoFadt3);
if (ACPI_FAILURE (Status))
{
@@ -395,9 +396,9 @@ AcpiDmDumpFadt (
/* Check for FADT revision 5 fields and up (ACPI 5.0+) */
- if (Table->Length > ACPI_FADT_V3_SIZE)
+ if (TableLength > ACPI_FADT_V3_SIZE)
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
AcpiDmTableInfoFadt5);
if (ACPI_FAILURE (Status))
{
@@ -407,9 +408,9 @@ AcpiDmDumpFadt (
/* Check for FADT revision 6 fields and up (ACPI 6.0+) */
- if (Table->Length > ACPI_FADT_V3_SIZE)
+ if (TableLength > ACPI_FADT_V3_SIZE)
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
AcpiDmTableInfoFadt6);
if (ACPI_FAILURE (Status))
{
@@ -420,11 +421,11 @@ AcpiDmDumpFadt (
/* Validate various fields in the FADT, including length */
- AcpiTbCreateLocalFadt (Table, Table->Length);
+ AcpiTbCreateLocalFadt (Table, TableLength);
/* Validate FADT length against the revision */
- AcpiDmValidateFadtLength (Table->Revision, Table->Length);
+ AcpiDmValidateFadtLength (Table->Revision, TableLength);
}
Index: acpica-unix2-20200925/source/components/tables/tbfadt.c
===================================================================
--- acpica-unix2-20200925.orig/source/components/tables/tbfadt.c
+++ acpica-unix2-20200925/source/components/tables/tbfadt.c
@@ -289,7 +289,6 @@ AcpiTbSelectAddress (
UINT32 Address32,
UINT64 Address64)
{
-
if (!Address64)
{
/* 64-bit address is zero, use 32-bit address */
@@ -520,6 +519,9 @@ AcpiTbConvertFadt (
UINT8 Length;
UINT8 Flags;
UINT32 i;
+ UINT32 Tmp;
+ UINT32 Value32;
+ UINT64 Value64;
/*
@@ -533,7 +535,7 @@ AcpiTbConvertFadt (
* Note: The FADT revision value is unreliable. Only the length can be
* trusted.
*/
- if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
+ if (AcpiUtReadUint32(&AcpiGbl_FADT.Header.Length) <= ACPI_FADT_V2_SIZE)
{
AcpiGbl_FADT.PreferredProfile = 0;
AcpiGbl_FADT.PstateControl = 0;
@@ -546,14 +548,19 @@ AcpiTbConvertFadt (
* current FADT version as defined by the ACPI specification.
* Thus, we will have a common FADT internally.
*/
- AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
+ Tmp = sizeof (ACPI_TABLE_FADT);
+ AcpiUtWriteUint(&AcpiGbl_FADT.Header.Length, sizeof(UINT32),
+ &Tmp, sizeof(UINT32));
/*
* Expand the 32-bit DSDT addresses to 64-bit as necessary.
* Later ACPICA code will always use the X 64-bit field.
*/
- AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
- AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
+ Value32 = AcpiUtReadUint32(&AcpiGbl_FADT.Dsdt);
+ Value64 = AcpiUtReadUint64(&AcpiGbl_FADT.XDsdt);
+ Value64 = AcpiTbSelectAddress ("DSDT", Value32, Value64);
+ AcpiUtWriteUint(&AcpiGbl_FADT.XDsdt, sizeof(UINT64),
+ &Value64, sizeof(UINT64));
/* If Hardware Reduced flag is set, we are all done */
@@ -614,7 +621,11 @@ AcpiTbConvertFadt (
{
if (Address64->Address)
{
- if (Address64->Address != (UINT64) Address32)
+ Value32 = AcpiUtReadUint32(&Address32);
+ Value64 = AcpiUtReadUint64(&Address64->Address);
+
+ /* if (Address64->Address != (UINT64) Address32) */
+ if (Value64 != (UINT64) Value32)
{
/* Address mismatch */
@@ -655,9 +666,10 @@ AcpiTbConvertFadt (
*/
if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
{
+ Value32 = AcpiUtReadUint32(&Address32);
AcpiTbInitGenericAddress (Address64,
ACPI_ADR_SPACE_SYSTEM_IO, Length,
- (UINT64) Address32, Name, Flags);
+ (UINT64) Value32, Name, Flags);
}
}
@@ -780,10 +792,14 @@ AcpiTbSetupFadtRegisters (
if (Source64->Address)
{
+ UINT64 Address64;
+
+ Address64 = AcpiUtReadUint64(&Source64->Address);
+ Address64 +=
+ (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth);
AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
Source64->SpaceId, Pm1RegisterByteWidth,
- Source64->Address +
- (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
+ Address64,
"PmRegisters", 0);
}
}

View File

@ -0,0 +1,85 @@
From f0cba59f1ce62095cb0a0cecdf8d661b77bf2baf Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Tue, 22 Sep 2020 17:51:45 -0600
Subject: [PATCH 14/40] Support most FPDTs in a big-endian world
NB: there is no support for vendor specific records even in
the little-endian version.
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 12 +++++++-----
source/compiler/dttable1.c | 4 +++-
2 files changed, 10 insertions(+), 6 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -910,9 +910,10 @@ AcpiDmDumpFpdt (
{
ACPI_STATUS Status;
ACPI_FPDT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
ACPI_DMTABLE_INFO *InfoTable;
+ UINT16 SubtableType;
/* There is no main table (other than the standard ACPI header) */
@@ -920,19 +921,20 @@ AcpiDmDumpFpdt (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoFpdtHdr);
if (ACPI_FAILURE (Status))
{
return;
}
- switch (Subtable->Type)
+ SubtableType = AcpiUtReadUint16(&Subtable->Type);
+ switch (SubtableType)
{
case ACPI_FPDT_TYPE_BOOT:
@@ -959,7 +961,7 @@ AcpiDmDumpFpdt (
goto NextSubtable;
}
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
Index: acpica-unix2-20200925/source/compiler/dttable1.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
+++ acpica-unix2-20200925/source/compiler/dttable1.c
@@ -1051,6 +1051,7 @@ DtCompileFpdt (
ACPI_DMTABLE_INFO *InfoTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *SubtableStart;
+ UINT16 SubtableType;
while (*PFieldList)
@@ -1069,7 +1070,8 @@ DtCompileFpdt (
FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
- switch (FpdtHeader->Type)
+ SubtableType = AcpiUtReadUint16(&FpdtHeader->Type);
+ switch (SubtableType)
{
case ACPI_FPDT_TYPE_BOOT:

View File

@ -0,0 +1,69 @@
From faba93b1dd7ce4aa8983880e917d108496cd173f Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Tue, 22 Sep 2020 18:12:01 -0600
Subject: [PATCH 15/40] Support GTDT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 13 +++++++++----
source/compiler/dttable1.c | 9 +++++++--
2 files changed, 16 insertions(+), 6 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -997,7 +997,7 @@ AcpiDmDumpGtdt (
{
ACPI_STATUS Status;
ACPI_GTDT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_GTDT);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubtableLength;
@@ -1033,7 +1033,7 @@ AcpiDmDumpGtdt (
/* Subtables */
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
@@ -1051,8 +1051,13 @@ AcpiDmDumpGtdt (
case ACPI_GTDT_TYPE_TIMER_BLOCK:
SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
- GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
- Subtable))->TimerCount;
+ {
+ UINT32 Tmp32;
+
+ Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
+ Subtable))->TimerCount;
+ GtCount = AcpiUtReadUint32(&Tmp32);
+ }
InfoTable = AcpiDmTableInfoGtdt0;
break;
Index: acpica-unix2-20200925/source/compiler/dttable1.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
+++ acpica-unix2-20200925/source/compiler/dttable1.c
@@ -997,8 +997,13 @@ DtCompileGtdt (
DtPushSubtable (Subtable);
ParentTable = DtPeekSubtable ();
- GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
- Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
+ {
+ UINT32 Tmp32;
+
+ Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
+ Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
+ GtCount = AcpiUtReadUint32(&Tmp32);
+ }
while (GtCount)
{

View File

@ -0,0 +1,75 @@
From 1104928443b11ff1c0446ed1604882c0e6ae4dc1 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 11:54:49 -0600
Subject: [PATCH 16/40] Support HEST in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 10 ++++++----
source/compiler/dttable1.c | 4 +++-
2 files changed, 9 insertions(+), 5 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -1138,12 +1138,13 @@ AcpiDmDumpHest (
{
ACPI_STATUS Status;
ACPI_HEST_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_HEST);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubtableLength;
UINT32 BankCount;
ACPI_HEST_IA_ERROR_BANK *BankTable;
+ UINT16 SubtableType;
/* Main table */
@@ -1157,10 +1158,11 @@ AcpiDmDumpHest (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
BankCount = 0;
- switch (Subtable->Type)
+ SubtableType = Subtable->Type;
+ switch (SubtableType)
{
case ACPI_HEST_TYPE_IA32_CHECK:
@@ -1227,7 +1229,7 @@ AcpiDmDumpHest (
/* Cannot continue on unknown type - no length */
AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
- Subtable->Type);
+ SubtableType);
return;
}
Index: acpica-unix2-20200925/source/compiler/dttable1.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
+++ acpica-unix2-20200925/source/compiler/dttable1.c
@@ -1133,6 +1133,7 @@ DtCompileHest (
DT_FIELD *SubtableStart;
ACPI_DMTABLE_INFO *InfoTable;
UINT16 Type;
+ UINT16 Tmp16;
UINT32 BankCount;
@@ -1151,7 +1152,8 @@ DtCompileHest (
/* Get subtable type */
SubtableStart = *PFieldList;
- DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
+ DtCompileInteger ((UINT8 *) &Tmp16, *PFieldList, 2, 0);
+ Type = AcpiUtReadUint32(&Tmp16);
switch (Type)
{

View File

@ -0,0 +1,37 @@
From 6565935b43c4795387aa4814d171dcd3c02bee33 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 12:11:46 -0600
Subject: [PATCH 17/40] Support RSDT ('RSD PTR') in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump.c
+++ acpica-unix2-20200925/source/common/dmtbdump.c
@@ -277,6 +277,7 @@ AcpiDmDumpRsdt (
UINT32 Entries;
UINT32 Offset;
UINT32 i;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Point to start of table pointer array */
@@ -286,12 +287,12 @@ AcpiDmDumpRsdt (
/* RSDT uses 32-bit pointers */
- Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
+ Entries = (TableLength - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
for (i = 0; i < Entries; i++)
{
AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
- AcpiOsPrintf ("%8.8X\n", Array[i]);
+ AcpiOsPrintf ("%8.8X\n", AcpiUtReadUint32(&Array[i]));
Offset += sizeof (UINT32);
}
}

View File

@ -0,0 +1,38 @@
From 8d0ea4932cebc5d13cc811eb4f78b66a5e3cfd2c Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 12:16:37 -0600
Subject: [PATCH 18/40] Support XSDT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump.c
+++ acpica-unix2-20200925/source/common/dmtbdump.c
@@ -318,6 +318,7 @@ AcpiDmDumpXsdt (
UINT32 Entries;
UINT32 Offset;
UINT32 i;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Point to start of table pointer array */
@@ -327,12 +328,13 @@ AcpiDmDumpXsdt (
/* XSDT uses 64-bit pointers */
- Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
+ Entries = (TableLength - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
for (i = 0; i < Entries; i++)
{
AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
- AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
+ AcpiOsPrintf ("%8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (AcpiUtReadUint64(&Array[i])));
Offset += sizeof (UINT64);
}
}

View File

@ -0,0 +1,52 @@
From 82421dd7d534f78edf85b862b196bae256cf8f87 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 12:25:38 -0600
Subject: [PATCH 19/40] Support SRAT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -173,11 +173,12 @@ AcpiDmDumpSrat (
UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
ACPI_SUBTABLE_HEADER *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSrat);
if (ACPI_FAILURE (Status))
{
return;
@@ -186,12 +187,12 @@ AcpiDmDumpSrat (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoSratHdr);
if (ACPI_FAILURE (Status))
{
@@ -245,7 +246,7 @@ AcpiDmDumpSrat (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,61 @@
From 4e76aa1a5556f250f51a3802734fd6cb77718299 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 12:49:52 -0600
Subject: [PATCH 20/40] Support SLIT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 8 +++++---
source/compiler/dttable2.c | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -96,11 +96,12 @@ AcpiDmDumpSlit (
UINT32 Localities;
UINT32 i;
UINT32 j;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSlit);
if (ACPI_FAILURE (Status))
{
return;
@@ -108,7 +109,8 @@ AcpiDmDumpSlit (
/* Display the Locality NxN Matrix */
- Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ Localities = (UINT32)
+ AcpiUtReadUint64(&ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount);
Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
@@ -121,7 +123,7 @@ AcpiDmDumpSlit (
{
/* Check for beyond EOT */
- if (Offset >= Table->Length)
+ if (Offset >= TableLength)
{
AcpiOsPrintf (
"\n**** Not enough room in table for all localities\n");
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -1529,7 +1529,7 @@ DtCompileSlit (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
- Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
+ Localities = (UINT32) AcpiUtReadUint64(Subtable->Buffer);
LocalityBuffer = UtLocalCalloc (Localities);
LocalityListLength = 0;

View File

@ -0,0 +1,43 @@
From 4ca38d182bb40ba750d8f5ac6ff8560c40f06625 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 15:44:21 -0600
Subject: [PATCH 21/40] Support MSCT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -972,11 +972,12 @@ AcpiDmDumpMsct (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
ACPI_MSCT_PROXIMITY *Subtable;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMsct);
if (ACPI_FAILURE (Status))
{
return;
@@ -985,12 +986,12 @@ AcpiDmDumpMsct (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,152 @@
From dfe414b053fb9feb905271785b319afa7ba72932 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 23 Sep 2020 16:08:24 -0600
Subject: [PATCH 22/40] Support MPST in a big-endian world
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(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -834,11 +834,13 @@ AcpiDmDumpMpst (
UINT16 SubtableCount;
UINT32 PowerStateCount;
UINT32 ComponentCount;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
+ UINT16 Tmp16;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMpst);
if (ACPI_FAILURE (Status))
{
return;
@@ -846,13 +848,14 @@ AcpiDmDumpMpst (
/* Subtable: Memory Power Node(s) */
- SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
+ Tmp16 = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
+ SubtableCount = AcpiUtReadUint16(&Tmp16);
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))
{
@@ -861,8 +864,8 @@ AcpiDmDumpMpst (
/* Extract the sub-subtable counts */
- PowerStateCount = Subtable0->NumPowerStates;
- ComponentCount = Subtable0->NumPhysicalComponents;
+ PowerStateCount = AcpiUtReadUint16(&Subtable0->NumPowerStates);
+ ComponentCount = AcpiUtReadUint16(&Subtable0->NumPhysicalComponents);
Offset += sizeof (ACPI_MPST_POWER_NODE);
/* Sub-subtables - Memory Power State Structure(s) */
@@ -873,7 +876,7 @@ AcpiDmDumpMpst (
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))
{
@@ -896,7 +899,7 @@ AcpiDmDumpMpst (
while (ComponentCount)
{
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable0B,
sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
if (ACPI_FAILURE (Status))
{
@@ -913,22 +916,24 @@ AcpiDmDumpMpst (
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));
+ (sizeof (ACPI_MPST_POWER_STATE) *
+ AcpiUtReadUint16(&Subtable0->NumPowerStates)) +
+ (sizeof (ACPI_MPST_COMPONENT) *
+ AcpiUtReadUint16(&Subtable0->NumPhysicalComponents)));
}
/* 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;
+ SubtableCount = AcpiUtReadUint16(&Subtable1->CharacteristicsCount);
Offset += sizeof (ACPI_MPST_DATA_HDR);
/* Subtable: Memory Power State Characteristics structure(s) */
@@ -936,10 +941,10 @@ AcpiDmDumpMpst (
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))
{
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -345,7 +345,7 @@ DtCompileMpst (
DtPushSubtable (Subtable);
MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
- SubtableCount = MpstChannelInfo->PowerNodeCount;
+ SubtableCount = AcpiUtReadUint16(&MpstChannelInfo->PowerNodeCount);
while (*PFieldList && SubtableCount)
{
@@ -363,8 +363,8 @@ DtCompileMpst (
DtPushSubtable (Subtable);
MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
- PowerStateCount = MpstPowerNode->NumPowerStates;
- ComponentCount = MpstPowerNode->NumPhysicalComponents;
+ PowerStateCount = AcpiUtReadUint16(&MpstPowerNode->NumPowerStates);
+ ComponentCount = AcpiUtReadUint16(&MpstPowerNode->NumPhysicalComponents);
ParentTable = DtPeekSubtable ();
@@ -417,7 +417,7 @@ DtCompileMpst (
DtPushSubtable (Subtable);
MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
- SubtableCount = MpstDataHeader->CharacteristicsCount;
+ SubtableCount = AcpiUtReadUint16(&MpstDataHeader->CharacteristicsCount);
ParentTable = DtPeekSubtable ();

View File

@ -0,0 +1,221 @@
From 2a1f049c35736ddba45300bc5aba4db9c9df3be7 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Thu, 24 Sep 2020 15:25:53 -0600
Subject: [PATCH 23/40] Support NFIT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtable.c | 4 ++--
source/common/dmtbdump2.c | 47 +++++++++++++++++++++++---------------
source/compiler/dttable2.c | 11 ++++++---
3 files changed, 38 insertions(+), 24 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtable.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtable.c
+++ acpica-unix2-20200925/source/common/dmtable.c
@@ -1429,13 +1429,13 @@ AcpiDmDumpTable (
/* NFIT subtable types */
- Temp16 = ACPI_GET16 (Target);
+ Temp16 = AcpiUtReadUint16(Target);
if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
{
Temp16 = ACPI_NFIT_TYPE_RESERVED;
}
- AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
+ AcpiOsPrintf (UINT16_FORMAT, Temp16,
AcpiDmNfitSubnames[Temp16]);
break;
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -1084,18 +1084,23 @@ AcpiDmDumpNfit (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_NFIT);
UINT32 FieldOffset = 0;
- UINT32 Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
ACPI_NFIT_HEADER *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
ACPI_NFIT_INTERLEAVE *Interleave = NULL;
ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
UINT32 i;
+ UINT32 Length;
+ UINT32 LineCount;
+ UINT16 SubtableLength;
+ UINT16 SubtableType;
+ UINT16 HintCount;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNfit);
if (ACPI_FAILURE (Status))
{
return;
@@ -1104,19 +1109,21 @@ AcpiDmDumpNfit (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* NFIT subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoNfitHdr);
+ SubtableType = AcpiUtReadUint16(&Subtable->Type);
+ SubtableLength = AcpiUtReadUint16(&Subtable->Length);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, AcpiDmTableInfoNfitHdr);
if (ACPI_FAILURE (Status))
{
return;
}
- switch (Subtable->Type)
+ switch (SubtableType)
{
case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
@@ -1167,11 +1174,11 @@ AcpiDmDumpNfit (
default:
AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
- Subtable->Type);
+ SubtableType);
/* Attempt to continue */
- if (!Subtable->Length)
+ if (!SubtableLength)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
@@ -1180,8 +1187,8 @@ AcpiDmDumpNfit (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, InfoTable);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -1189,14 +1196,15 @@ AcpiDmDumpNfit (
/* Per-subtable variable-length fields */
- switch (Subtable->Type)
+ switch (SubtableType)
{
case ACPI_NFIT_TYPE_INTERLEAVE:
Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
- for (i = 0; i < Interleave->LineCount; i++)
+ LineCount = AcpiUtReadUint32(&Interleave->LineCount);
+ for (i = 0; i < LineCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
&Interleave->LineOffset[i],
sizeof (UINT32), AcpiDmTableInfoNfit2a);
if (ACPI_FAILURE (Status))
@@ -1210,12 +1218,12 @@ AcpiDmDumpNfit (
case ACPI_NFIT_TYPE_SMBIOS:
- Length = Subtable->Length -
+ Length = SubtableLength -
sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
if (Length)
{
- Status = AcpiDmDumpTable (Table->Length,
+ Status = AcpiDmDumpTable (TableLength,
sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
SmbiosInfo,
Length, AcpiDmTableInfoNfit3a);
@@ -1230,9 +1238,10 @@ AcpiDmDumpNfit (
case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
- for (i = 0; i < Hint->HintCount; i++)
+ HintCount = AcpiUtReadUint16(&Hint->HintCount);
+ for (i = 0; i < HintCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
&Hint->HintAddress[i],
sizeof (UINT64), AcpiDmTableInfoNfit6a);
if (ACPI_FAILURE (Status))
@@ -1251,8 +1260,8 @@ AcpiDmDumpNfit (
NextSubtable:
/* Point to next subtable */
- Offset += Subtable->Length;
- Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
+ Offset += SubtableLength;
+ Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, SubtableLength);
}
}
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -517,6 +517,7 @@ DtCompileNfit (
UINT32 Count;
ACPI_NFIT_INTERLEAVE *Interleave = NULL;
ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
+ UINT16 NfitHeaderType;
/* Main table */
@@ -550,7 +551,8 @@ DtCompileNfit (
NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
- switch (NfitHeader->Type)
+ NfitHeaderType = AcpiUtReadUint16(&NfitHeader->Type);
+ switch (NfitHeaderType)
{
case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
@@ -610,7 +612,7 @@ DtCompileNfit (
DtInsertSubtable (ParentTable, Subtable);
DtPopSubtable ();
- switch (NfitHeader->Type)
+ switch (NfitHeaderType)
{
case ACPI_NFIT_TYPE_INTERLEAVE:
@@ -636,7 +638,8 @@ DtCompileNfit (
Count++;
}
- Interleave->LineCount = Count;
+ AcpiUtWriteUint(&Interleave->LineCount, sizeof(UINT32),
+ &Count, sizeof(UINT32));
break;
case ACPI_NFIT_TYPE_SMBIOS:
@@ -682,6 +685,8 @@ DtCompileNfit (
}
Hint->HintCount = (UINT16) Count;
+ AcpiUtWriteUint(&Hint->HintCount, sizeof(UINT16),
+ &Count, sizeof(UINT32));
break;
default:

View File

@ -0,0 +1,256 @@
From af44bec6c062a26034a43809d81af2a0ea17343e Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 25 Sep 2020 16:05:59 -0600
Subject: [PATCH 24/40] Support SDEV in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 50 +++++++++++++++++++-----------------
source/compiler/dttable2.c | 52 ++++++++++++++++++++++++++++----------
2 files changed, 65 insertions(+), 37 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -1871,17 +1871,18 @@ AcpiDmDumpSdev (
ACPI_SDEV_PCIE *Pcie;
ACPI_SDEV_NAMESPACE *Namesp;
ACPI_DMTABLE_INFO *InfoTable;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_SDEV);
UINT16 PathOffset;
UINT16 PathLength;
UINT16 VendorDataOffset;
UINT16 VendorDataLength;
+ UINT16 SubtableLength;
/* Main table */
- Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSdev);
if (ACPI_FAILURE (Status))
{
return;
@@ -1890,13 +1891,14 @@ AcpiDmDumpSdev (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoSdevHdr);
+ SubtableLength = AcpiUtReadUint16(&Subtable->Length);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, AcpiDmTableInfoSdevHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1919,8 +1921,8 @@ AcpiDmDumpSdev (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, InfoTable);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -1933,12 +1935,12 @@ AcpiDmDumpSdev (
/* Dump the PCIe device ID(s) */
Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable);
- PathOffset = Namesp->DeviceIdOffset;
- PathLength = Namesp->DeviceIdLength;
+ PathOffset = AcpiUtReadUint16(&Namesp->DeviceIdOffset);
+ PathLength = AcpiUtReadUint16(&Namesp->DeviceIdLength);
if (PathLength)
{
- Status = AcpiDmDumpTable (Table->Length, 0,
+ Status = AcpiDmDumpTable (TableLength, 0,
ACPI_ADD_PTR (UINT8, Namesp, PathOffset),
PathLength, AcpiDmTableInfoSdev0a);
if (ACPI_FAILURE (Status))
@@ -1949,14 +1951,14 @@ AcpiDmDumpSdev (
/* Dump the vendor-specific data */
- VendorDataLength =
- Namesp->VendorDataLength;
- VendorDataOffset =
- Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
+ VendorDataLength = AcpiUtReadUint16(&Namesp->VendorDataLength);
+ VendorDataOffset =
+ AcpiUtReadUint16(&Namesp->DeviceIdOffset) +
+ AcpiUtReadUint16(&Namesp->DeviceIdLength);
if (VendorDataLength)
{
- Status = AcpiDmDumpTable (Table->Length, 0,
+ Status = AcpiDmDumpTable (TableLength, 0,
ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset),
VendorDataLength, AcpiDmTableInfoSdev1b);
if (ACPI_FAILURE (Status))
@@ -1971,12 +1973,12 @@ AcpiDmDumpSdev (
/* PCI path substructures */
Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable);
- PathOffset = Pcie->PathOffset;
- PathLength = Pcie->PathLength;
+ PathOffset = AcpiUtReadUint16(&Pcie->PathOffset);
+ PathLength = AcpiUtReadUint16(&Pcie->PathLength);
while (PathLength)
{
- Status = AcpiDmDumpTable (Table->Length,
+ Status = AcpiDmDumpTable (TableLength,
PathOffset + Offset,
ACPI_ADD_PTR (UINT8, Pcie, PathOffset),
sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a);
@@ -1991,12 +1993,14 @@ AcpiDmDumpSdev (
/* VendorData */
- VendorDataLength = Pcie->VendorDataLength;
- VendorDataOffset = Pcie->PathOffset + Pcie->PathLength;
+ VendorDataLength = AcpiUtReadUint16(&Pcie->VendorDataLength);
+ VendorDataOffset =
+ AcpiUtReadUint16(&Pcie->PathOffset) +
+ AcpiUtReadUint16(&Pcie->PathLength);
if (VendorDataLength)
{
- Status = AcpiDmDumpTable (Table->Length, 0,
+ Status = AcpiDmDumpTable (TableLength, 0,
ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset),
VendorDataLength, AcpiDmTableInfoSdev1b);
if (ACPI_FAILURE (Status))
@@ -2013,8 +2017,8 @@ AcpiDmDumpSdev (
NextSubtable:
/* Point to next subtable */
- Offset += Subtable->Length;
+ Offset += SubtableLength;
Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable,
- Subtable->Length);
+ SubtableLength);
}
}
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -1268,6 +1268,7 @@ DtCompileSdev (
ACPI_SDEV_PCIE *Pcie = NULL;
ACPI_SDEV_NAMESPACE *Namesp = NULL;
UINT32 EntryCount;
+ UINT16 Tmp16;
/* Subtables */
@@ -1289,7 +1290,7 @@ DtCompileSdev (
DtPushSubtable (Subtable);
SdevHeader = ACPI_CAST_PTR (ACPI_SDEV_HEADER, Subtable->Buffer);
- SdevHeader->Length = (UINT8)(sizeof (ACPI_SDEV_HEADER));
+ SdevHeader->Length = (UINT16) (sizeof (ACPI_SDEV_HEADER));
switch (SdevHeader->Type)
{
@@ -1345,7 +1346,7 @@ DtCompileSdev (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
- Namesp->DeviceIdOffset = sizeof (ACPI_SDEV_NAMESPACE);
+ Namesp->DeviceIdOffset = (UINT16) sizeof (ACPI_SDEV_NAMESPACE);
Namesp->DeviceIdLength = (UINT16) Subtable->Length;
/* Append Vendor data */
@@ -1367,18 +1368,32 @@ DtCompileSdev (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
- Namesp->VendorDataOffset =
- Namesp->DeviceIdOffset + Namesp->DeviceIdLength;
- Namesp->VendorDataLength =
- (UINT16) Subtable->Length;
+ Namesp->VendorDataOffset =
+ Namesp->DeviceIdOffset +
+ Namesp->DeviceIdLength;
+ Namesp->VendorDataLength = (UINT16) Subtable->Length;
/* Final size of entire namespace structure */
- SdevHeader->Length = (UINT16)(sizeof(ACPI_SDEV_NAMESPACE) +
- Subtable->Length + Namesp->DeviceIdLength);
+ SdevHeader->Length = (UINT16)
+ (sizeof(ACPI_SDEV_NAMESPACE) +
+ Subtable->Length +
+ Namesp->DeviceIdLength);
}
}
+ /* Make sure everything is now little-endian */
+ Tmp16 = AcpiUtReadUint16(&SdevHeader->Length);
+ SdevHeader->Length = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Namesp->DeviceIdOffset);
+ Namesp->DeviceIdOffset = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Namesp->DeviceIdLength);
+ Namesp->DeviceIdLength = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Namesp->VendorDataOffset);
+ Namesp->VendorDataOffset = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Namesp->VendorDataLength);
+ Namesp->VendorDataLength = Tmp16;
+
break;
case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE:
@@ -1408,9 +1423,9 @@ DtCompileSdev (
/* Path offset will point immediately after the main subtable */
- Pcie->PathOffset = sizeof (ACPI_SDEV_PCIE);
+ Pcie->PathOffset = sizeof (ACPI_SDEV_PCIE);
Pcie->PathLength = (UINT16)
- (EntryCount * sizeof (ACPI_SDEV_PCIE_PATH));
+ (EntryCount * sizeof (ACPI_SDEV_PCIE_PATH));
/* Append the Vendor Data last */
@@ -1432,15 +1447,24 @@ DtCompileSdev (
DtInsertSubtable (ParentTable, Subtable);
Pcie->VendorDataOffset =
- Pcie->PathOffset + Pcie->PathLength;
- Pcie->VendorDataLength = (UINT16)
- Subtable->Length;
+ Pcie->PathOffset + Pcie->PathLength;
+ Pcie->VendorDataLength = (UINT16) Subtable->Length;
}
}
SdevHeader->Length =
- sizeof (ACPI_SDEV_PCIE) +
+ sizeof (ACPI_SDEV_PCIE) +
Pcie->PathLength + Pcie->VendorDataLength;
+ Tmp16 = AcpiUtReadUint16(&SdevHeader->Length);
+ SdevHeader->Length = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Pcie->PathOffset);
+ Pcie->PathOffset = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Pcie->PathLength);
+ Pcie->PathLength = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Pcie->VendorDataOffset);
+ Pcie->VendorDataOffset = Tmp16;
+ Tmp16 = AcpiUtReadUint16(&Pcie->VendorDataLength);
+ Pcie->VendorDataLength = Tmp16;
break;
default:

View File

@ -0,0 +1,278 @@
From 03425774d2c19874ad4483ec6b7e13c0146e81f7 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 25 Sep 2020 16:56:55 -0600
Subject: [PATCH 25/40] Support HMAT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 70 ++++++++++++++++++++++----------------
source/compiler/dttable1.c | 24 ++++++++++---
2 files changed, 59 insertions(+), 35 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -1301,37 +1301,45 @@ AcpiDmDumpHmat (
UINT32 Length;
ACPI_DMTABLE_INFO *InfoTable;
UINT32 i, j;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
+ UINT16 HmatStructType;
+ UINT32 HmatStructLength;
+ UINT32 InitPDs;
+ UINT32 TgtPDs;
+ UINT16 SMBIOSHandles;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoHmat);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoHmat);
if (ACPI_FAILURE (Status))
{
return;
}
Offset = sizeof (ACPI_TABLE_HMAT);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
AcpiOsPrintf ("\n");
/* Dump HMAT structure header */
HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset);
- if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE))
+ HmatStructLength = AcpiUtReadUint32(&HmatStruct->Length);
+ if (HmatStructLength < sizeof (ACPI_HMAT_STRUCTURE))
{
AcpiOsPrintf ("Invalid HMAT structure length\n");
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
- HmatStruct->Length, AcpiDmTableInfoHmatHdr);
+ Status = AcpiDmDumpTable (TableLength, Offset, HmatStruct,
+ HmatStructLength, AcpiDmTableInfoHmatHdr);
if (ACPI_FAILURE (Status))
{
return;
}
- switch (HmatStruct->Type)
+ HmatStructType = AcpiUtReadUint16(&HmatStruct->Type);
+ switch (HmatStructType)
{
case ACPI_HMAT_TYPE_ADDRESS_RANGE:
@@ -1354,7 +1362,7 @@ AcpiDmDumpHmat (
default:
AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n",
- HmatStruct->Type);
+ HmatStructType);
/* Attempt to continue */
@@ -1363,13 +1371,13 @@ AcpiDmDumpHmat (
/* Dump HMAT structure body */
- if (HmatStruct->Length < Length)
+ if (HmatStructLength < Length)
{
AcpiOsPrintf ("Invalid HMAT structure length\n");
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
- HmatStruct->Length, InfoTable);
+ Status = AcpiDmDumpTable (TableLength, Offset, HmatStruct,
+ HmatStructLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -1377,7 +1385,7 @@ AcpiDmDumpHmat (
/* Dump HMAT structure additionals */
- switch (HmatStruct->Type)
+ switch (HmatStructType)
{
case ACPI_HMAT_TYPE_LOCALITY:
@@ -1386,15 +1394,16 @@ AcpiDmDumpHmat (
/* Dump initiator proximity domains */
- if ((UINT32)(HmatStruct->Length - SubtableOffset) <
- (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4))
+ InitPDs = AcpiUtReadUint32(&HmatLocality->NumberOfInitiatorPDs);
+ if ((UINT32)(HmatStructLength - SubtableOffset) <
+ (UINT32)(InitPDs * 4))
{
AcpiOsPrintf ("Invalid initiator proximity domain number\n");
return;
}
- for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
+ for (i = 0; i < InitPDs; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
4, AcpiDmTableInfoHmat1a);
if (ACPI_FAILURE (Status))
@@ -1407,15 +1416,16 @@ AcpiDmDumpHmat (
/* Dump target proximity domains */
- if ((UINT32)(HmatStruct->Length - SubtableOffset) <
- (UINT32)(HmatLocality->NumberOfTargetPDs * 4))
+ TgtPDs = AcpiUtReadUint32(&HmatLocality->NumberOfTargetPDs);
+ if ((UINT32)(HmatStructLength - SubtableOffset) <
+ (UINT32)(TgtPDs * 4))
{
AcpiOsPrintf ("Invalid target proximity domain number\n");
return;
}
- for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++)
+ for (i = 0; i < TgtPDs; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
4, AcpiDmTableInfoHmat1b);
if (ACPI_FAILURE (Status))
@@ -1428,18 +1438,17 @@ AcpiDmDumpHmat (
/* Dump latency/bandwidth entris */
- if ((UINT32)(HmatStruct->Length - SubtableOffset) <
- (UINT32)(HmatLocality->NumberOfInitiatorPDs *
- HmatLocality->NumberOfTargetPDs * 2))
+ if ((UINT32)(HmatStructLength - SubtableOffset) <
+ (UINT32)(InitPDs * TgtPDs * 2))
{
AcpiOsPrintf ("Invalid latency/bandwidth entry number\n");
return;
}
- for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
+ for (i = 0; i < InitPDs; i++)
{
- for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++)
+ for (j = 0; j < TgtPDs; j++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
2, AcpiDmTableInfoHmat1c);
if (ACPI_FAILURE(Status))
@@ -1459,15 +1468,16 @@ AcpiDmDumpHmat (
/* Dump SMBIOS handles */
- if ((UINT32)(HmatStruct->Length - SubtableOffset) <
- (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2))
+ SMBIOSHandles = AcpiUtReadUint16(&HmatCache->NumberOfSMBIOSHandles);
+ if ((UINT32)(HmatStructLength - SubtableOffset) <
+ (UINT32)(SMBIOSHandles * 2))
{
AcpiOsPrintf ("Invalid SMBIOS handle number\n");
return;
}
- for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++)
+ for (i = 0; i < SMBIOSHandles; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
2, AcpiDmTableInfoHmat2a);
if (ACPI_FAILURE (Status))
@@ -1487,6 +1497,6 @@ AcpiDmDumpHmat (
NextSubtable:
/* Point to next HMAT structure subtable */
- Offset += (HmatStruct->Length);
+ Offset += (HmatStructLength);
}
}
Index: acpica-unix2-20200925/source/compiler/dttable1.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
+++ acpica-unix2-20200925/source/compiler/dttable1.c
@@ -1295,6 +1295,8 @@ DtCompileHmat (
UINT32 TgtPDNumber;
UINT64 EntryNumber;
UINT16 SMBIOSHandleNumber;
+ UINT16 HmatStructType;
+ UINT32 Length;
ParentTable = DtPeekSubtable ();
@@ -1325,7 +1327,8 @@ DtCompileHmat (
/* Compile HMAT structure body */
- switch (HmatStruct->Type)
+ HmatStructType = AcpiUtReadUint16(&HmatStruct->Type);
+ switch (HmatStructType)
{
case ACPI_HMAT_TYPE_ADDRESS_RANGE:
@@ -1358,7 +1361,7 @@ DtCompileHmat (
/* Compile HMAT structure additionals */
- switch (HmatStruct->Type)
+ switch (HmatStructType)
{
case ACPI_HMAT_TYPE_LOCALITY:
@@ -1384,7 +1387,7 @@ DtCompileHmat (
HmatStruct->Length += Subtable->Length;
IntPDNumber++;
}
- HmatLocality->NumberOfInitiatorPDs = IntPDNumber;
+ HmatLocality->NumberOfInitiatorPDs = AcpiUtReadUint32(&IntPDNumber);
/* Compile target proximity domain list */
@@ -1405,7 +1408,7 @@ DtCompileHmat (
HmatStruct->Length += Subtable->Length;
TgtPDNumber++;
}
- HmatLocality->NumberOfTargetPDs = TgtPDNumber;
+ HmatLocality->NumberOfTargetPDs = AcpiUtReadUint32(&TgtPDNumber);
/* Save start of the entries for reporting errors */
@@ -1430,6 +1433,9 @@ DtCompileHmat (
HmatStruct->Length += Subtable->Length;
EntryNumber++;
}
+
+ Length = AcpiUtReadUint32(&HmatStruct->Length);
+ HmatStruct->Length = Length;
/* Validate number of entries */
@@ -1464,11 +1470,19 @@ DtCompileHmat (
HmatStruct->Length += Subtable->Length;
SMBIOSHandleNumber++;
}
- HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber;
+ HmatCache->NumberOfSMBIOSHandles =
+ AcpiUtReadUint16(&SMBIOSHandleNumber);
+
+ Length = AcpiUtReadUint32(&HmatStruct->Length);
+ HmatStruct->Length = Length;
+
break;
default:
+ Length = AcpiUtReadUint32(&HmatStruct->Length);
+ HmatStruct->Length = Length;
+
break;
}
}

View File

@ -0,0 +1,43 @@
From afaa9043357a3b8adbaa1ea389a62da48f561896 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 25 Sep 2020 17:03:05 -0600
Subject: [PATCH 26/40] Support PDTT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -1385,13 +1385,13 @@ AcpiDmDumpPdtt (
{
ACPI_STATUS Status;
ACPI_PDTT_CHANNEL *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_PDTT);
/* Main table */
- Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoPdtt);
if (ACPI_FAILURE (Status))
{
return;
@@ -1400,10 +1400,10 @@ AcpiDmDumpPdtt (
/* Subtables. Currently there is only one type, but can be multiples */
Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,104 @@
From c5d7294c6deb7fe87eac981234d4c484313d5e40 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 25 Sep 2020 17:16:12 -0600
Subject: [PATCH 27/40] Support PPTT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 15 +++++++++------
source/compiler/dttable2.c | 7 +++++--
2 files changed, 14 insertions(+), 8 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -1649,6 +1649,8 @@ AcpiDmDumpPptt (
UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 i;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
+ UINT32 NumPrivRes;
/* There is no main table (other than the standard ACPI header) */
@@ -1656,7 +1658,7 @@ AcpiDmDumpPptt (
/* Subtables */
Offset = sizeof (ACPI_TABLE_HEADER);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
AcpiOsPrintf ("\n");
@@ -1668,7 +1670,7 @@ AcpiDmDumpPptt (
AcpiOsPrintf ("Invalid subtable length\n");
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoPpttHdr);
if (ACPI_FAILURE (Status))
{
@@ -1710,7 +1712,7 @@ AcpiDmDumpPptt (
AcpiOsPrintf ("Invalid subtable length\n");
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
@@ -1726,15 +1728,16 @@ AcpiDmDumpPptt (
/* Dump SMBIOS handles */
+ NumPrivRes = AcpiUtReadUint32(&PpttProcessor->NumberOfPrivResources);
if ((UINT8)(Subtable->Length - SubtableOffset) <
- (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
+ (UINT8)(NumPrivRes * 4))
{
AcpiOsPrintf ("Invalid private resource number\n");
return;
}
- for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
+ for (i = 0; i < NumPrivRes; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
4, AcpiDmTableInfoPptt0a);
if (ACPI_FAILURE (Status))
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -1028,6 +1028,7 @@ DtCompilePptt (
ACPI_DMTABLE_INFO *InfoTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *SubtableStart;
+ UINT32 NumPrivRes;
ParentTable = DtPeekSubtable ();
@@ -1092,7 +1093,7 @@ DtCompilePptt (
{
/* Compile initiator proximity domain list */
- PpttProcessor->NumberOfPrivResources = 0;
+ NumPrivRes = 0;
while (*PFieldList)
{
Status = DtCompileTable (PFieldList,
@@ -1108,8 +1109,10 @@ DtCompilePptt (
DtInsertSubtable (ParentTable, Subtable);
PpttHeader->Length += (UINT8)(Subtable->Length);
- PpttProcessor->NumberOfPrivResources++;
+ NumPrivRes++;
}
+ PpttProcessor->NumberOfPrivResources =
+ AcpiUtReadUint32(&NumPrivRes);
}
break;

View File

@ -0,0 +1,54 @@
From 661f59c00e991553fb3f5fe7786eb0e2f640805c Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 25 Sep 2020 17:39:34 -0600
Subject: [PATCH 28/40] Support PCCT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -1286,13 +1286,13 @@ AcpiDmDumpPcct (
ACPI_STATUS Status;
ACPI_PCCT_SUBSPACE *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
/* Main table */
- Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoPcct);
if (ACPI_FAILURE (Status))
{
return;
@@ -1301,12 +1301,12 @@ AcpiDmDumpPcct (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
if (ACPI_FAILURE (Status))
{
@@ -1349,7 +1349,7 @@ AcpiDmDumpPcct (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Header.Length, InfoTable);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,43 @@
From 520e143b2bacb39032c06a33f61ae05583be6b2a Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Fri, 25 Sep 2020 18:13:20 -0600
Subject: [PATCH 29/40] Support WDAT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -568,11 +568,12 @@ AcpiDmDumpWdat (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
ACPI_WDAT_ENTRY *Subtable;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoWdat);
if (ACPI_FAILURE (Status))
{
return;
@@ -581,12 +582,12 @@ AcpiDmDumpWdat (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,76 @@
From b2e9a4397077ad56fea5a8b3f9f63ce3be65ae48 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Sun, 27 Sep 2020 12:09:28 -0600
Subject: [PATCH 30/40] Support TCPA in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 13 ++++++++-----
source/compiler/dttable2.c | 4 +++-
2 files changed, 11 insertions(+), 6 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -342,11 +342,13 @@ AcpiDmDumpTcpa (
ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR (
ACPI_TABLE_TCPA_HDR, Table, Offset);
ACPI_STATUS Status;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
+ UINT16 PlatformClass;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table,
+ Status = AcpiDmDumpTable (TableLength, 0, Table,
0, AcpiDmTableInfoTcpaHdr);
if (ACPI_FAILURE (Status))
{
@@ -357,18 +359,19 @@ AcpiDmDumpTcpa (
* Examine the PlatformClass field to determine the table type.
* Either a client or server table. Only one.
*/
- switch (CommonHeader->PlatformClass)
+ PlatformClass = AcpiUtReadUint16(&CommonHeader->PlatformClass);
+ switch (PlatformClass)
{
case ACPI_TCPA_CLIENT_TABLE:
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Table->Length - Offset, AcpiDmTableInfoTcpaClient);
break;
case ACPI_TCPA_SERVER_TABLE:
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTcpaServer);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ TableLength - Offset, AcpiDmTableInfoTcpaServer);
break;
default:
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -1773,6 +1773,7 @@ DtCompileTcpa (
ACPI_TABLE_TCPA_HDR *TcpaHeader;
DT_SUBTABLE *ParentTable;
ACPI_STATUS Status;
+ UINT16 PlatformClass;
/* Compile the main table */
@@ -1793,7 +1794,8 @@ DtCompileTcpa (
*/
TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
- switch (TcpaHeader->PlatformClass)
+ PlatformClass = AcpiUtReadUint16(&TcpaHeader->PlatformClass);
+ switch (PlatformClass)
{
case ACPI_TCPA_CLIENT_TABLE:

View File

@ -0,0 +1,40 @@
From 63fc38478f12b8c8b0d263d25f72ff7538fba2ce Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Mon, 28 Sep 2020 11:49:42 -0600
Subject: [PATCH 31/40] Support STAO in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -285,14 +285,14 @@ AcpiDmDumpStao (
{
ACPI_STATUS Status;
char *Namepath;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 StringLength;
UINT32 Offset = sizeof (ACPI_TABLE_STAO);
/* Main table */
- Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoStao);
if (ACPI_FAILURE (Status))
{
return;
@@ -300,7 +300,7 @@ AcpiDmDumpStao (
/* The rest of the table consists of Namepath strings */
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
Namepath = ACPI_ADD_PTR (char, Table, Offset);
StringLength = strlen (Namepath) + 1;

View File

@ -0,0 +1,27 @@
From 0455d918688d9d208644d7f5f6f10d6199486e9c Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Mon, 28 Sep 2020 12:49:23 -0600
Subject: [PATCH 32/40] Support SLIC and MSDM in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -68,9 +68,10 @@ void
AcpiDmDumpSlic (
ACPI_TABLE_HEADER *Table)
{
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
- (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
- Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
+ (void) AcpiDmDumpTable (TableLength, sizeof (ACPI_TABLE_HEADER), Table,
+ TableLength - sizeof (*Table), AcpiDmTableInfoSlic);
}

View File

@ -0,0 +1,50 @@
From 0fecc447cd64bf9da3345b2912e41e6005eb1011 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Mon, 28 Sep 2020 13:01:18 -0600
Subject: [PATCH 33/40] Support MCFG in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -769,11 +769,12 @@ AcpiDmDumpMcfg (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
ACPI_MCFG_ALLOCATION *Subtable;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMcfg);
if (ACPI_FAILURE (Status))
{
return;
@@ -782,17 +783,17 @@ AcpiDmDumpMcfg (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
- if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
+ if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > TableLength)
{
AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
- (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
+ (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - TableLength));
return;
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,46 @@
From b521edcfceab513a900a000aa462d7f86b65a040 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Mon, 28 Sep 2020 16:49:30 -0600
Subject: [PATCH 34/40] Support LPIT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -534,7 +534,7 @@ AcpiDmDumpLpit (
{
ACPI_STATUS Status;
ACPI_LPIT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubtableLength;
@@ -543,11 +543,11 @@ AcpiDmDumpLpit (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr);
if (ACPI_FAILURE (Status))
{
@@ -571,7 +571,7 @@ AcpiDmDumpLpit (
return;
}
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
SubtableLength, InfoTable);
if (ACPI_FAILURE (Status))
{

View File

@ -0,0 +1,216 @@
From b55af37d2419fc5ea630774f49b4ed9b724451b3 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Mon, 28 Sep 2020 18:37:04 -0600
Subject: [PATCH 35/40] Support PMTT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 66 +++++++++++++++++++++-----------------
source/compiler/dttable2.c | 5 ++-
2 files changed, 41 insertions(+), 30 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -1442,17 +1442,21 @@ AcpiDmDumpPmtt (
ACPI_PMTT_HEADER *MemSubtable;
ACPI_PMTT_HEADER *DimmSubtable;
ACPI_PMTT_DOMAIN *DomainArray;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
UINT32 MemOffset;
UINT32 DimmOffset;
UINT32 DomainOffset;
UINT32 DomainCount;
+ UINT16 SubtableLength;
+ UINT16 MemSubtableLength;
+ UINT16 DimmSubtableLength;
+ UINT16 Tmp16;
/* Main table */
- Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoPmtt);
if (ACPI_FAILURE (Status))
{
return;
@@ -1461,13 +1465,14 @@ AcpiDmDumpPmtt (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmttHdr);
+ SubtableLength = AcpiUtReadUint16(&Subtable->Length);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, AcpiDmTableInfoPmttHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1485,8 +1490,8 @@ AcpiDmDumpPmtt (
/* Dump the fixed-length portion of the subtable */
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmtt0);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, AcpiDmTableInfoPmtt0);
if (ACPI_FAILURE (Status))
{
return;
@@ -1498,15 +1503,16 @@ AcpiDmDumpPmtt (
MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
sizeof (ACPI_PMTT_SOCKET));
- while (((Offset + MemOffset) < Table->Length) &&
- (MemOffset < Subtable->Length))
+ while (((Offset + MemOffset) < TableLength) &&
+ (MemOffset < SubtableLength))
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length,
+ MemSubtableLength = AcpiUtReadUint16(&MemSubtable->Length);
+ Status = AcpiDmDumpTable (TableLength,
Offset + MemOffset, MemSubtable,
- MemSubtable->Length, AcpiDmTableInfoPmttHdr);
+ MemSubtableLength, AcpiDmTableInfoPmttHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1524,9 +1530,9 @@ AcpiDmDumpPmtt (
/* Dump the fixed-length portion of the controller subtable */
- Status = AcpiDmDumpTable (Length,
+ Status = AcpiDmDumpTable (TableLength,
Offset + MemOffset, MemSubtable,
- MemSubtable->Length, AcpiDmTableInfoPmtt1);
+ MemSubtableLength, AcpiDmTableInfoPmtt1);
if (ACPI_FAILURE (Status))
{
return;
@@ -1534,16 +1540,17 @@ AcpiDmDumpPmtt (
/* Walk the variable count of proximity domains */
- DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
+ Tmp16 = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
+ DomainCount = AcpiUtReadUint16(&Tmp16);
DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
sizeof (ACPI_PMTT_CONTROLLER));
- while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
- ((MemOffset + DomainOffset) < Subtable->Length) &&
+ while (((Offset + MemOffset + DomainOffset) < TableLength) &&
+ ((MemOffset + DomainOffset) < SubtableLength) &&
DomainCount)
{
- Status = AcpiDmDumpTable (Length,
+ Status = AcpiDmDumpTable (TableLength,
Offset + MemOffset + DomainOffset, DomainArray,
sizeof (ACPI_PMTT_DOMAIN), AcpiDmTableInfoPmtt1a);
if (ACPI_FAILURE (Status))
@@ -1568,15 +1575,16 @@ AcpiDmDumpPmtt (
DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
DomainOffset);
- while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
- (DimmOffset < MemSubtable->Length))
+ while (((Offset + MemOffset + DimmOffset) < TableLength) &&
+ (DimmOffset < MemSubtableLength))
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length,
+ DimmSubtableLength = AcpiUtReadUint16(&DimmSubtable->Length);
+ Status = AcpiDmDumpTable (TableLength,
Offset + MemOffset + DimmOffset, DimmSubtable,
- DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
+ DimmSubtableLength, AcpiDmTableInfoPmttHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1594,9 +1602,9 @@ AcpiDmDumpPmtt (
/* Dump the fixed-length DIMM subtable */
- Status = AcpiDmDumpTable (Length,
+ Status = AcpiDmDumpTable (TableLength,
Offset + MemOffset + DimmOffset, DimmSubtable,
- DimmSubtable->Length, AcpiDmTableInfoPmtt2);
+ DimmSubtableLength, AcpiDmTableInfoPmtt2);
if (ACPI_FAILURE (Status))
{
return;
@@ -1604,23 +1612,23 @@ AcpiDmDumpPmtt (
/* Point to next DIMM subtable */
- DimmOffset += DimmSubtable->Length;
+ DimmOffset += DimmSubtableLength;
DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
- DimmSubtable, DimmSubtable->Length);
+ DimmSubtable, DimmSubtableLength);
}
/* Point to next Controller subtable */
- MemOffset += MemSubtable->Length;
+ MemOffset += MemSubtableLength;
MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
- MemSubtable, MemSubtable->Length);
+ MemSubtable, MemSubtableLength);
}
/* Point to next Socket subtable */
- Offset += Subtable->Length;
+ Offset += SubtableLength;
Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
- Subtable, Subtable->Length);
+ Subtable, SubtableLength);
}
}
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -885,6 +885,7 @@ DtCompilePmtt (
ACPI_PMTT_HEADER *PmttHeader;
ACPI_PMTT_CONTROLLER *PmttController;
UINT16 DomainCount;
+ UINT16 Length;
UINT8 PrevType = ACPI_PMTT_TYPE_SOCKET;
@@ -929,6 +930,8 @@ DtCompilePmtt (
DtInsertSubtable (ParentTable, Subtable);
DtPushSubtable (Subtable);
+ Length = AcpiUtReadUint16(&PmttHeader->Length);
+ PmttHeader->Length = Length;
switch (PmttHeader->Type)
{
case ACPI_PMTT_TYPE_SOCKET:
@@ -962,7 +965,7 @@ DtCompilePmtt (
PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
(Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
- DomainCount = PmttController->DomainCount;
+ DomainCount = AcpiUtReadUint16(&PmttController->DomainCount);
while (DomainCount)
{

View File

@ -0,0 +1,365 @@
From 88d16feb9d6982cc9c09f2ae9b76b26f0d9c96e0 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 30 Sep 2020 17:48:04 -0600
Subject: [PATCH 36/40] Support IORT in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 73 ++++++++++++++++++++++----------------
source/compiler/dttable1.c | 37 ++++++++++---------
2 files changed, 64 insertions(+), 46 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -75,16 +75,19 @@ AcpiDmDumpIort (
ACPI_IORT_SMMU *IortSmmu = NULL;
UINT32 Offset;
UINT32 NodeOffset;
+ UINT32 NodeLength;
UINT32 Length;
ACPI_DMTABLE_INFO *InfoTable;
char *String;
UINT32 i;
UINT32 MappingByteLength;
+ UINT32 MappingCount;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoIort);
if (ACPI_FAILURE (Status))
{
return;
@@ -95,25 +98,26 @@ AcpiDmDumpIort (
/* Dump the OptionalPadding (optional) */
- if (Iort->NodeOffset > Offset)
+ NodeOffset = AcpiUtReadUint32(&Iort->NodeOffset);
+ if (NodeOffset > Offset)
{
- Status = AcpiDmDumpTable (Table->Length, Offset, Table,
- Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
+ Status = AcpiDmDumpTable (TableLength, Offset, Table,
+ NodeOffset - Offset, AcpiDmTableInfoIortPad);
if (ACPI_FAILURE (Status))
{
return;
}
}
- Offset = Iort->NodeOffset;
- while (Offset < Table->Length)
+ Offset = AcpiUtReadUint32(&Iort->NodeOffset);
+ while (Offset < TableLength)
{
/* Common subtable header */
IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, Table, Offset);
AcpiOsPrintf ("\n");
Length = ACPI_OFFSET (ACPI_IORT_NODE, NodeData);
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (TableLength, Offset,
IortNode, Length, AcpiDmTableInfoIortHdr);
if (ACPI_FAILURE (Status))
{
@@ -142,7 +146,7 @@ AcpiDmDumpIort (
case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
InfoTable = AcpiDmTableInfoIort2;
- Length = IortNode->Length - NodeOffset;
+ Length = AcpiUtReadUint16(&IortNode->Length) - NodeOffset;
break;
case ACPI_IORT_NODE_SMMU:
@@ -155,13 +159,13 @@ AcpiDmDumpIort (
case ACPI_IORT_NODE_SMMU_V3:
InfoTable = AcpiDmTableInfoIort4;
- Length = IortNode->Length - NodeOffset;
+ Length = AcpiUtReadUint16(&IortNode->Length) - NodeOffset;
break;
case ACPI_IORT_NODE_PMCG:
InfoTable = AcpiDmTableInfoIort5;
- Length = IortNode->Length - NodeOffset;
+ Length = AcpiUtReadUint16(&IortNode->Length) - NodeOffset;
break;
default:
@@ -171,7 +175,7 @@ AcpiDmDumpIort (
/* Attempt to continue */
- if (!IortNode->Length)
+ if (!AcpiUtReadUint16(&IortNode->Length))
{
AcpiOsPrintf ("Invalid zero length IORT node\n");
return;
@@ -182,7 +186,7 @@ AcpiDmDumpIort (
/* Dump the node subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Length, InfoTable);
if (ACPI_FAILURE (Status))
@@ -202,9 +206,11 @@ AcpiDmDumpIort (
if (IortItsGroup)
{
- for (i = 0; i < IortItsGroup->ItsCount; i++)
+ UINT32 ItsCount = AcpiUtReadUint32(&IortItsGroup->ItsCount);
+
+ for (i = 0; i < ItsCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
4, AcpiDmTableInfoIort0a);
if (ACPI_FAILURE (Status))
@@ -221,12 +227,14 @@ AcpiDmDumpIort (
/* Dump the Padding (optional) */
- if (IortNode->Length > NodeOffset)
+ NodeLength = AcpiUtReadUint16(&IortNode->Length);
+ if (NodeLength > NodeOffset)
{
MappingByteLength =
- IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
- Table, IortNode->Length - NodeOffset - MappingByteLength,
+ AcpiUtReadUint32(&IortNode->MappingCount) *
+ sizeof (ACPI_IORT_ID_MAPPING);
+ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset,
+ Table, NodeLength - NodeOffset - MappingByteLength,
AcpiDmTableInfoIort1a);
if (ACPI_FAILURE (Status))
{
@@ -243,9 +251,11 @@ AcpiDmDumpIort (
if (IortSmmu)
{
+ UINT32 InterruptCount;
+
Length = 2 * sizeof (UINT64);
- NodeOffset = IortSmmu->GlobalInterruptOffset;
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ NodeOffset = AcpiUtReadUint32(&IortSmmu->GlobalInterruptOffset);
+ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Length, AcpiDmTableInfoIort3a);
if (ACPI_FAILURE (Status))
@@ -253,10 +263,11 @@ AcpiDmDumpIort (
return;
}
- NodeOffset = IortSmmu->ContextInterruptOffset;
- for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
+ NodeOffset = AcpiUtReadUint32(&IortSmmu->ContextInterruptOffset);
+ InterruptCount = AcpiUtReadUint32(&IortSmmu->ContextInterruptCount);
+ for (i = 0; i < InterruptCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
8, AcpiDmTableInfoIort3b);
if (ACPI_FAILURE (Status))
@@ -267,10 +278,11 @@ AcpiDmDumpIort (
NodeOffset += 8;
}
- NodeOffset = IortSmmu->PmuInterruptOffset;
- for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
+ NodeOffset = AcpiUtReadUint32(&IortSmmu->PmuInterruptOffset);
+ InterruptCount = AcpiUtReadUint32(&IortSmmu->PmuInterruptCount);
+ for (i = 0; i < InterruptCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
8, AcpiDmTableInfoIort3c);
if (ACPI_FAILURE (Status))
@@ -290,12 +302,13 @@ AcpiDmDumpIort (
/* Dump the ID mappings */
- NodeOffset = IortNode->MappingOffset;
- for (i = 0; i < IortNode->MappingCount; i++)
+ NodeOffset = AcpiUtReadUint32(&IortNode->MappingOffset);
+ MappingCount = AcpiUtReadUint32(&IortNode->MappingCount);
+ for (i = 0; i < MappingCount; i++)
{
AcpiOsPrintf ("\n");
Length = sizeof (ACPI_IORT_ID_MAPPING);
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Length, AcpiDmTableInfoIortMap);
if (ACPI_FAILURE (Status))
@@ -309,7 +322,7 @@ AcpiDmDumpIort (
NextSubtable:
/* Point to next node subtable */
- Offset += IortNode->Length;
+ Offset += AcpiUtReadUint16(&IortNode->Length);
}
}
Index: acpica-unix2-20200925/source/compiler/dttable1.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
+++ acpica-unix2-20200925/source/compiler/dttable1.c
@@ -1516,6 +1516,7 @@ DtCompileIort (
ACPI_IORT_NODE *IortNode;
ACPI_IORT_ITS_GROUP *IortItsGroup;
ACPI_IORT_SMMU *IortSmmu;
+ UINT32 IortNodeOffset;
UINT32 NodeNumber;
UINT32 NodeLength;
UINT32 IdMappingNumber;
@@ -1548,7 +1549,7 @@ DtCompileIort (
* Optionally allows the generic data types to be used for filling
* this field.
*/
- Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
+ IortNodeOffset = sizeof (ACPI_TABLE_IORT);
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
&Subtable);
if (ACPI_FAILURE (Status))
@@ -1558,7 +1559,7 @@ DtCompileIort (
if (Subtable)
{
DtInsertSubtable (ParentTable, Subtable);
- Iort->NodeOffset += Subtable->Length;
+ IortNodeOffset += Subtable->Length;
}
else
{
@@ -1568,8 +1569,9 @@ DtCompileIort (
{
return (Status);
}
- Iort->NodeOffset += PaddingLength;
+ IortNodeOffset += PaddingLength;
}
+ Iort->NodeOffset = AcpiUtReadUint32(&IortNodeOffset);
NodeNumber = 0;
while (*PFieldList)
@@ -1623,7 +1625,7 @@ DtCompileIort (
ItsNumber++;
}
- IortItsGroup->ItsCount = ItsNumber;
+ IortItsGroup->ItsCount = AcpiUtReadUint32(&ItsNumber);
break;
case ACPI_IORT_NODE_NAMED_COMPONENT:
@@ -1657,15 +1659,18 @@ DtCompileIort (
}
else
{
- if (NodeLength > IortNode->MappingOffset)
+ UINT32 MappingOffset;
+
+ MappingOffset = IortNode->MappingOffset;
+ if (NodeLength > MappingOffset)
{
return (AE_BAD_DATA);
}
- if (NodeLength < IortNode->MappingOffset)
+ if (NodeLength < MappingOffset)
{
Status = DtCompilePadding (
- IortNode->MappingOffset - NodeLength,
+ MappingOffset - NodeLength,
&Subtable);
if (ACPI_FAILURE (Status))
{
@@ -1673,7 +1678,7 @@ DtCompileIort (
}
DtInsertSubtable (ParentTable, Subtable);
- NodeLength = IortNode->MappingOffset;
+ NodeLength = MappingOffset;
}
}
break;
@@ -1706,7 +1711,7 @@ DtCompileIort (
/* Compile global interrupt array */
- IortSmmu->GlobalInterruptOffset = NodeLength;
+ IortSmmu->GlobalInterruptOffset = AcpiUtReadUint32(&NodeLength);
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
&Subtable);
if (ACPI_FAILURE (Status))
@@ -1720,7 +1725,7 @@ DtCompileIort (
/* Compile context interrupt array */
ContextIrptNumber = 0;
- IortSmmu->ContextInterruptOffset = NodeLength;
+ IortSmmu->ContextInterruptOffset = AcpiUtReadUint32(&NodeLength);
while (*PFieldList)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
@@ -1740,12 +1745,12 @@ DtCompileIort (
ContextIrptNumber++;
}
- IortSmmu->ContextInterruptCount = ContextIrptNumber;
+ IortSmmu->ContextInterruptCount = AcpiUtReadUint32(&ContextIrptNumber);
/* Compile PMU interrupt array */
PmuIrptNumber = 0;
- IortSmmu->PmuInterruptOffset = NodeLength;
+ IortSmmu->PmuInterruptOffset = AcpiUtReadUint32(&NodeLength);
while (*PFieldList)
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
@@ -1765,7 +1770,7 @@ DtCompileIort (
PmuIrptNumber++;
}
- IortSmmu->PmuInterruptCount = PmuIrptNumber;
+ IortSmmu->PmuInterruptCount = AcpiUtReadUint32(&PmuIrptNumber);
break;
case ACPI_IORT_NODE_SMMU_V3:
@@ -1802,7 +1807,7 @@ DtCompileIort (
/* Compile Array of ID mappings */
- IortNode->MappingOffset = NodeLength;
+ IortNode->MappingOffset = AcpiUtReadUint32(&NodeLength);
IdMappingNumber = 0;
while (*PFieldList)
{
@@ -1823,7 +1828,7 @@ DtCompileIort (
IdMappingNumber++;
}
- IortNode->MappingCount = IdMappingNumber;
+ IortNode->MappingCount = AcpiUtReadUint32(&IdMappingNumber);
if (!IdMappingNumber)
{
IortNode->MappingOffset = 0;
@@ -1838,7 +1843,7 @@ DtCompileIort (
NodeNumber++;
}
- Iort->NodeCount = NodeNumber;
+ Iort->NodeCount = AcpiUtReadUint32(&NodeNumber);
return (AE_OK);
}

View File

@ -0,0 +1,96 @@
From 49b3d77990241c7216412d78e52cf15b3aa6d1ad Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 30 Sep 2020 18:18:07 -0600
Subject: [PATCH 37/40] Support IVRS in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump2.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200925/source/common/dmtbdump2.c
@@ -353,11 +353,13 @@ AcpiDmDumpIvrs (
ACPI_IVRS_DE_HEADER *DeviceEntry;
ACPI_IVRS_HEADER *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
+ UINT16 SubtableLength;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoIvrs);
if (ACPI_FAILURE (Status))
{
return;
@@ -366,13 +368,14 @@ AcpiDmDumpIvrs (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoIvrsHdr);
+ SubtableLength = AcpiUtReadUint16(&Subtable->Length);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, AcpiDmTableInfoIvrsHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -404,7 +407,7 @@ AcpiDmDumpIvrs (
/* Attempt to continue */
- if (!Subtable->Length)
+ if (!SubtableLength)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
@@ -415,8 +418,8 @@ AcpiDmDumpIvrs (
/* Dump the subtable */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, InfoTable);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubtableLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -442,7 +445,7 @@ AcpiDmDumpIvrs (
sizeof (ACPI_IVRS_HARDWARE2));
}
- while (EntryOffset < (Offset + Subtable->Length))
+ while (EntryOffset < (Offset + SubtableLength))
{
AcpiOsPrintf ("\n");
/*
@@ -504,7 +507,7 @@ AcpiDmDumpIvrs (
/* Dump the Device Entry */
- Status = AcpiDmDumpTable (Table->Length, EntryOffset,
+ Status = AcpiDmDumpTable (TableLength, EntryOffset,
DeviceEntry, EntryLength, InfoTable);
if (ACPI_FAILURE (Status))
{
@@ -520,8 +523,8 @@ AcpiDmDumpIvrs (
NextSubtable:
/* Point to next subtable */
- Offset += Subtable->Length;
- Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
+ Offset += SubtableLength;
+ Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, SubtableLength);
}
}

View File

@ -0,0 +1,119 @@
From 1e1129d788087025cf31b0c3babdb9bca01f1c4e Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 30 Sep 2020 18:42:38 -0600
Subject: [PATCH 38/40] Support TPM2 in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 18 ++++++++++--------
source/compiler/dttable2.c | 8 +++++---
2 files changed, 15 insertions(+), 11 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -409,11 +409,12 @@ AcpiDmDumpTpm2Rev3 (
ACPI_TABLE_TPM23 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM23, Table);
ACPI_TPM23_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM23_TRAILER, Table, Offset);
ACPI_STATUS Status;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm23);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTpm23);
if (ACPI_FAILURE (Status))
{
return;
@@ -425,8 +426,8 @@ AcpiDmDumpTpm2Rev3 (
{
case ACPI_TPM23_ACPI_START_METHOD:
- (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTpm23a);
+ (void) AcpiDmDumpTable (TableLength, Offset, Subtable,
+ TableLength - Offset, AcpiDmTableInfoTpm23a);
break;
default:
@@ -456,6 +457,7 @@ AcpiDmDumpTpm2 (
ACPI_TPM2_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
ACPI_TPM2_ARM_SMC *ArmSubtable;
ACPI_STATUS Status;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
if (Table->Revision == 3)
@@ -466,7 +468,7 @@ AcpiDmDumpTpm2 (
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTpm2);
if (ACPI_FAILURE (Status))
{
@@ -474,8 +476,8 @@ AcpiDmDumpTpm2 (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTpm2a);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ TableLength - Offset, AcpiDmTableInfoTpm2a);
if (ACPI_FAILURE (Status))
{
return;
@@ -490,8 +492,8 @@ AcpiDmDumpTpm2 (
Offset += sizeof (ACPI_TPM2_TRAILER);
AcpiOsPrintf ("\n");
- (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
- Table->Length - Offset, AcpiDmTableInfoTpm211);
+ (void) AcpiDmDumpTable (TableLength, Offset, ArmSubtable,
+ TableLength - Offset, AcpiDmTableInfoTpm211);
break;
default:
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -1904,6 +1904,7 @@ DtCompileTpm2 (
DT_SUBTABLE *ParentTable;
ACPI_STATUS Status = AE_OK;
ACPI_TABLE_HEADER *Header;
+ UINT8 StartMethod;
ParentTable = DtPeekSubtable ();
@@ -1947,7 +1948,8 @@ DtCompileTpm2 (
/* Subtable type depends on the StartMethod */
- switch (Tpm2Header->StartMethod)
+ StartMethod = *(UINT8 *)&Tpm2Header->StartMethod;
+ switch (StartMethod)
{
case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
@@ -1978,7 +1980,7 @@ DtCompileTpm2 (
case ACPI_TPM2_RESERVED10:
AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n",
- Tpm2Header->StartMethod);
+ StartMethod);
Status = AE_ERROR;
break;
@@ -1986,7 +1988,7 @@ DtCompileTpm2 (
default:
AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n",
- Tpm2Header->StartMethod);
+ StartMethod);
Status = AE_ERROR;
break;
}

View File

@ -0,0 +1,61 @@
From 9d7f9c8f4ecbee2e621d471a8c4944cebe62947d Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 30 Sep 2020 18:59:57 -0600
Subject: [PATCH 39/40] Add partial big-endian support for WPBT tables
There's some weirdness here that at present does not warrant
further investigation; this is just a really low priority table.
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 8 ++++----
source/compiler/dttable2.c | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -628,13 +628,13 @@ AcpiDmDumpWpbt (
{
ACPI_STATUS Status;
ACPI_TABLE_WPBT *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT16 ArgumentsLength;
/* Dump the main table */
- Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoWpbt);
if (ACPI_FAILURE (Status))
{
return;
@@ -643,10 +643,10 @@ AcpiDmDumpWpbt (
/* Extract the arguments buffer length from the main table */
Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
- ArgumentsLength = Subtable->ArgumentsLength;
+ ArgumentsLength = AcpiUtReadUint16(&Subtable->ArgumentsLength);
/* Dump the arguments buffer */
- (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
+ (void) AcpiDmDumpTable (TableLength, 0, Table, ArgumentsLength,
AcpiDmTableInfoWpbt0);
}
Index: acpica-unix2-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -2190,7 +2190,8 @@ DtCompileWpbt (
/* Extract the length of the Arguments buffer, insert into main table */
- Length = (UINT16) Subtable->TotalLength;
+ AcpiUtWriteUint(&Length, sizeof(UINT16),
+ &Subtable->TotalLength, sizeof(UINT32));
Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
Table->ArgumentsLength = Length;

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
Index: acpica-unix2-20200528/generate/unix/Makefile.config
Index: acpica-unix2-20200925/generate/unix/Makefile.config
===================================================================
--- acpica-unix2-20200528.orig/generate/unix/Makefile.config
+++ acpica-unix2-20200528/generate/unix/Makefile.config
--- acpica-unix2-20200925.orig/generate/unix/Makefile.config
+++ acpica-unix2-20200925/generate/unix/Makefile.config
@@ -23,6 +23,9 @@
# OPT_CFLAGS can be overridden on the make command line by
# adding OPT_CFLAGS="..." to the invocation.

View File

@ -50,7 +50,7 @@ Patch22: 0023-Support-NFIT-in-a-big-endian-world.patch
Patch23: 0024-Support-SDEV-in-a-big-endian-world.patch
Patch24: 0025-Support-HMAT-in-a-big-endian-world.patch
Patch25: 0026-Support-PDTT-in-a-big-endian-world.patch
Patch25: 0027-Support-PPTT-in-a-big-endian-world.patch
Patch26: 0027-Support-PPTT-in-a-big-endian-world.patch
Patch27: 0028-Support-PCCT-in-a-big-endian-world.patch
Patch28: 0029-Support-WDAT-in-a-big-endian-world.patch
Patch29: 0030-Support-TCPA-in-a-big-endian-world.patch
@ -65,25 +65,26 @@ Patch37: 0038-Support-TPM2-in-a-big-endian-world.patch
Patch38: 0039-Add-partial-big-endian-support-for-WPBT-tables.patch
Patch39: 0040-Support-DSDT-SSDT-in-a-big-endian-world.patch
# other miscellaneous patch
Patch40: unaligned.patch
Patch41: OPT_LDFLAGS.patch
Patch42: int-format.patch
Patch43: f23-harden.patch
Patch44: template.patch
Patch45: ppc64le.patch
Patch46: arm7hl.patch
Patch47: simple-64bit.patch
Patch48: mips-be-fix.patch
Patch49: cve-2017-13693.patch
Patch50: cve-2017-13694.patch
Patch51: cve-2017-13695.patch
Patch52: str-trunc-warn.patch
Patch53: ptr-cast.patch
Patch54: aslcodegen.patch
Patch55: facp.patch
Patch56: armv7-str-fixes.patch
Patch57: dbtest.patch
# other miscellaneous patches
Patch100: unaligned.patch
Patch101: OPT_LDFLAGS.patch
Patch102: int-format.patch
Patch103: f23-harden.patch
Patch104: template.patch
Patch105: arm7hl.patch
Patch106: simple-64bit.patch
Patch107: mips-be-fix.patch
Patch108: cve-2017-13693.patch
Patch109: cve-2017-13694.patch
Patch110: cve-2017-13695.patch
Patch111: str-trunc-warn.patch
Patch112: ptr-cast.patch
Patch113: facp.patch
Patch114: armv7-str-fixes.patch
Patch115: dbtest.patch
%ifarch i686 armv7hl
Patch116: ull-32bit.patch
%endif
BuildRequires: bison patchutils flex gcc
@ -132,65 +133,68 @@ This version of the tools is being released under GPLv2 license.
%setup -q -n acpica-unix2-%{version}
gzip -dc %{SOURCE1} | tar -x --strip-components=1 -f -
# apply all the patches
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
%patch13
%patch14
%patch15
%patch16
%patch17
%patch18
%patch19
%patch20
%patch21
%patch22
%patch23
%patch24
%patch25
%patch26
%patch27
%patch28
%patch29
%patch30
%patch31
%patch32
%patch33
%patch34
%patch35
%patch36
%patch37
%patch38
%patch39
%patch40
%patch41
%patch42
%patch43
%patch44
%patch45
%patch46
%patch47
%patch48
%patch49
%patch50
%patch51
%patch52
%patch53
%patch54
%patch55
%patch56
%patch57
# apply the big-endian patches
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
# apply the remaining patches
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
%ifarch i686 armv7hl
%patch116 -p1
%endif
cp -p %{SOURCE2} README.Fedora
cp -p %{SOURCE3} iasl.1
@ -306,11 +310,13 @@ fi
%changelog
* Thu Oct 15 2020 Al Stone <ahs3@redhat.com> - 20200925-1
* Mon Oct 19 2020 Al Stone <ahs3@redhat.com> - 20200925-1
- Update to 20200925 source tree
- Completely revamp the old big-endian patches (maintainability was the goal)
- The acpinames command has been deprecated upstrean; acpiexec provides
replacement functionality
- Completely revamp the old big-endian patches (maintainability was the goal).
This results in a much larger patch set, but each patch is more clearly used
for a specific purpose.
- The acpinames command has been deprecated upstream; acpiexec provides
replacement functionality.
* Fri Jul 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 20200430-3
- Second attempt - Rebuilt for

View File

@ -1,8 +1,8 @@
Index: acpica-unix-20191018/source/include/acmacros.h
Index: acpica-unix2-20200925/source/include/acmacros.h
===================================================================
--- acpica-unix-20191018.orig/source/include/acmacros.h
+++ acpica-unix-20191018/source/include/acmacros.h
@@ -178,6 +178,8 @@
--- acpica-unix2-20200925.orig/source/include/acmacros.h
+++ acpica-unix2-20200925/source/include/acmacros.h
@@ -163,6 +163,8 @@
/* 16-bit source, 16/32/64 destination */
@ -11,7 +11,7 @@ Index: acpica-unix-20191018/source/include/acmacros.h
#define ACPI_MOVE_16_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
(( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
@@ -199,6 +201,7 @@
@@ -182,6 +184,7 @@
/* 64-bit source, 16/32/64 destination */

View File

@ -1,7 +1,8 @@
diff -Naur acpica-unix2-20200214.orig/source/include/actypes.h acpica-unix2-20200214/source/include/actypes.h
--- acpica-unix2-20200214.orig/source/include/actypes.h 2020-02-25 15:41:26.479349637 -0700
+++ acpica-unix2-20200214/source/include/actypes.h 2020-02-25 15:44:49.519082258 -0700
@@ -561,7 +561,7 @@
Index: acpica-unix2-20200925/source/include/actypes.h
===================================================================
--- acpica-unix2-20200925.orig/source/include/actypes.h
+++ acpica-unix2-20200925/source/include/actypes.h
@@ -561,7 +561,7 @@ typedef UINT64
#define ACPI_COPY_NAMESEG(dest,src) (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
#else
#define ACPI_COMPARE_NAMESEG(a,b) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAMESEG_SIZE))

View File

@ -1,29 +0,0 @@
Changes in the handling of comments caused some length fields to be used
in new ways. The new way broke the existing adaptation for big endian
support; this patch repairs that adaptation.
Signed-off-by: Al Stone <ahs3@redhat.com>
Index: acpica-unix-20191018/source/compiler/aslcodegen.c
===================================================================
--- acpica-unix-20191018.orig/source/compiler/aslcodegen.c
+++ acpica-unix-20191018/source/compiler/aslcodegen.c
@@ -497,8 +497,7 @@ CgWriteTableHeader (
/* Table length. Checksum zero for now, will rewrite later */
- DWord = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
- ACPI_MOVE_32_TO_32(&AslGbl_TableHeader.Length, &DWord);
+ AslGbl_TableHeader.Length = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
/* Calculate the comment lengths for this definition block parseOp */
@@ -544,6 +543,8 @@ CgWriteTableHeader (
CvDbgPrint (" Length: %u\n", CommentLength);
}
}
+ DWord = AslGbl_TableHeader.Length;
+ ACPI_MOVE_32_TO_32(&AslGbl_TableHeader.Length, &DWord);
AslGbl_TableHeader.Checksum = 0;
Op->Asl.FinalAmlOffset = ftell (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle);

View File

@ -1,162 +0,0 @@
Index: acpica-unix-20191018/source/common/dmtbdump.c
===================================================================
--- acpica-unix-20191018.orig/source/common/dmtbdump.c
+++ acpica-unix-20191018/source/common/dmtbdump.c
@@ -277,6 +277,8 @@ AcpiDmDumpRsdt (
UINT32 Entries;
UINT32 Offset;
UINT32 i;
+ UINT32 Length;
+ UINT32 Address;
/* Point to start of table pointer array */
@@ -286,12 +288,14 @@ AcpiDmDumpRsdt (
/* RSDT uses 32-bit pointers */
- Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
for (i = 0; i < Entries; i++)
{
AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
- AcpiOsPrintf ("%8.8X\n", Array[i]);
+ ACPI_MOVE_32_TO_32(&Address, &Array[i]);
+ AcpiOsPrintf ("%8.8X\n", Address);
Offset += sizeof (UINT32);
}
}
@@ -317,6 +321,8 @@ AcpiDmDumpXsdt (
UINT32 Entries;
UINT32 Offset;
UINT32 i;
+ UINT32 Length;
+ UINT64 Address;
/* Point to start of table pointer array */
@@ -326,12 +332,14 @@ AcpiDmDumpXsdt (
/* XSDT uses 64-bit pointers */
- Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
for (i = 0; i < Entries; i++)
{
AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
- AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
+ ACPI_MOVE_64_TO_64(&Address, &Array[i]);
+ AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Address));
Offset += sizeof (UINT64);
}
}
@@ -358,12 +366,12 @@ AcpiDmDumpFadt (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
-
+ UINT32 Length;
/* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
- AcpiDmTableInfoFadt1);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt1);
if (ACPI_FAILURE (Status))
{
return;
@@ -371,11 +379,9 @@ AcpiDmDumpFadt (
/* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
- if ((Table->Length > ACPI_FADT_V1_SIZE) &&
- (Table->Length <= ACPI_FADT_V2_SIZE))
+ if ((Length > ACPI_FADT_V1_SIZE) && (Length <= ACPI_FADT_V2_SIZE))
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
- AcpiDmTableInfoFadt2);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt2);
if (ACPI_FAILURE (Status))
{
return;
@@ -384,10 +390,9 @@ AcpiDmDumpFadt (
/* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
- else if (Table->Length > ACPI_FADT_V2_SIZE)
+ else if (Length > ACPI_FADT_V2_SIZE)
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
- AcpiDmTableInfoFadt3);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt3);
if (ACPI_FAILURE (Status))
{
return;
@@ -395,9 +400,9 @@ AcpiDmDumpFadt (
/* Check for FADT revision 5 fields and up (ACPI 5.0+) */
- if (Table->Length > ACPI_FADT_V3_SIZE)
+ if (Length > ACPI_FADT_V3_SIZE)
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (Length, 0, Table, 0,
AcpiDmTableInfoFadt5);
if (ACPI_FAILURE (Status))
{
@@ -407,9 +412,9 @@ AcpiDmDumpFadt (
/* Check for FADT revision 6 fields and up (ACPI 6.0+) */
- if (Table->Length > ACPI_FADT_V3_SIZE)
+ if (Length > ACPI_FADT_V3_SIZE)
{
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ Status = AcpiDmDumpTable (Length, 0, Table, 0,
AcpiDmTableInfoFadt6);
if (ACPI_FAILURE (Status))
{
@@ -420,11 +425,11 @@ AcpiDmDumpFadt (
/* Validate various fields in the FADT, including length */
- AcpiTbCreateLocalFadt (Table, Table->Length);
+ AcpiTbCreateLocalFadt (Table, Length);
/* Validate FADT length against the revision */
- AcpiDmValidateFadtLength (Table->Revision, Table->Length);
+ AcpiDmValidateFadtLength (Table->Revision, Length);
}
@@ -450,6 +455,7 @@ AcpiDmValidateFadtLength (
UINT32 Length)
{
UINT32 ExpectedLength;
+ UINT32 Tmp32;
switch (Revision)
@@ -485,7 +491,8 @@ AcpiDmValidateFadtLength (
return;
}
- if (Length == ExpectedLength)
+ ACPI_MOVE_32_TO_32(&Tmp32, &Length);
+ if (Tmp32 == ExpectedLength)
{
return;
}
@@ -493,5 +500,5 @@ AcpiDmValidateFadtLength (
AcpiOsPrintf (
"\n// ACPI Warning: FADT revision %X does not match length: "
"found %X expected %X\n",
- Revision, Length, ExpectedLength);
+ Revision, Tmp32, ExpectedLength);
}

View File

@ -1,637 +0,0 @@
Index: acpica-unix-20191018/source/common/dmtbdump1.c
===================================================================
--- acpica-unix-20191018.orig/source/common/dmtbdump1.c
+++ acpica-unix-20191018/source/common/dmtbdump1.c
@@ -79,17 +79,21 @@ AcpiDmDumpAsf (
UINT32 DataOffset = 0;
UINT32 i;
UINT8 Type;
+ UINT32 Len;
+ UINT16 SubLen;
/* No main table, only subtables */
+ ACPI_MOVE_32_TO_32(&Len, &Table->Length);
Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Len)
{
/* Common subtable header */
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
+ ACPI_MOVE_16_TO_16(&SubLen, &Subtable->Header.Length);
+ Status = AcpiDmDumpTable (Len, Offset, Subtable,
+ SubLen, AcpiDmTableInfoAsfHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -146,8 +150,7 @@ AcpiDmDumpAsf (
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Header.Length, InfoTable);
+ Status = AcpiDmDumpTable (Len, Offset, Subtable, SubLen, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -163,7 +166,7 @@ AcpiDmDumpAsf (
for (i = 0; i < DataCount; i++)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, DataOffset,
+ Status = AcpiDmDumpTable (Len, DataOffset,
DataTable, DataLength, DataInfoTable);
if (ACPI_FAILURE (Status))
{
@@ -209,15 +212,14 @@ AcpiDmDumpAsf (
/* Point to next subtable */
- if (!Subtable->Header.Length)
+ if (!SubLen)
{
AcpiOsPrintf ("Invalid zero subtable header length\n");
return;
}
- Offset += Subtable->Header.Length;
- Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable,
- Subtable->Header.Length);
+ Offset += SubLen;
+ Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, SubLen);
}
}
@@ -241,12 +243,13 @@ AcpiDmDumpCpep (
{
ACPI_STATUS Status;
ACPI_CPEP_POLLING *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
if (ACPI_FAILURE (Status))
{
@@ -256,7 +259,7 @@ AcpiDmDumpCpep (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,
@@ -296,7 +299,10 @@ AcpiDmDumpCsrt (
ACPI_CSRT_GROUP *Subtable;
ACPI_CSRT_SHARED_INFO *SharedInfoTable;
ACPI_CSRT_DESCRIPTOR *SubSubtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
+ UINT32 SubLength;
+ UINT32 SubSubLength;
+ UINT32 SharedInfoLength;
UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
UINT32 SubOffset;
UINT32 SubSubOffset;
@@ -307,14 +313,16 @@ AcpiDmDumpCsrt (
/* Subtables (Resource Groups) */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Resource group subtable */
AcpiOsPrintf ("\n");
+ ACPI_MOVE_32_TO_32(&SubLength, &Subtable->Length);
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoCsrt0);
+ SubLength, AcpiDmTableInfoCsrt0);
if (ACPI_FAILURE (Status))
{
return;
@@ -334,19 +342,20 @@ AcpiDmDumpCsrt (
return;
}
- SubOffset += Subtable->SharedInfoLength;
+ ACPI_MOVE_32_TO_32(&SharedInfoLength, &Subtable->SharedInfoLength);
+ SubOffset += SharedInfoLength;
/* Sub-Subtables (Resource Descriptors) */
SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
Offset + SubOffset);
- while ((SubOffset < Subtable->Length) &&
- ((Offset + SubOffset) < Table->Length))
+ while ((SubOffset < SubLength) && ((Offset + SubOffset) < Length))
{
AcpiOsPrintf ("\n");
+ ACPI_MOVE_32_TO_32(&SubSubLength, &SubSubtable->Length);
Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
- SubSubtable->Length, AcpiDmTableInfoCsrt2);
+ SubSubLength, AcpiDmTableInfoCsrt2);
if (ACPI_FAILURE (Status))
{
return;
@@ -356,7 +365,7 @@ AcpiDmDumpCsrt (
/* Resource-specific info buffer */
- InfoLength = SubSubtable->Length - SubSubOffset;
+ InfoLength = SubSubLength - SubSubOffset;
if (InfoLength)
{
Status = AcpiDmDumpTable (Length,
@@ -370,16 +379,15 @@ AcpiDmDumpCsrt (
/* Point to next sub-subtable */
- SubOffset += SubSubtable->Length;
+ SubOffset += SubSubLength;
SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable,
- SubSubtable->Length);
+ SubSubLength);
}
/* Point to next subtable */
- Offset += Subtable->Length;
- Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable,
- Subtable->Length);
+ Offset += SubLength;
+ Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, SubLength);
}
}
@@ -403,16 +411,20 @@ AcpiDmDumpDbg2 (
{
ACPI_STATUS Status;
ACPI_DBG2_DEVICE *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
+ UINT16 SubLength;
UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
UINT32 i;
UINT32 ArrayOffset;
UINT32 AbsoluteOffset;
UINT8 *Array;
+ UINT16 Tmp16;
+ UINT16 AlsoTmp16;
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
if (ACPI_FAILURE (Status))
{
@@ -422,11 +434,12 @@ AcpiDmDumpDbg2 (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
AcpiOsPrintf ("\n");
+ ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoDbg2Device);
+ SubLength, AcpiDmTableInfoDbg2Device);
if (ACPI_FAILURE (Status))
{
return;
@@ -436,13 +449,13 @@ AcpiDmDumpDbg2 (
for (i = 0; i < Subtable->RegisterCount; i++)
{
- ArrayOffset = Subtable->BaseAddressOffset +
- (sizeof (ACPI_GENERIC_ADDRESS) * i);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->BaseAddressOffset);
+ ArrayOffset = Tmp16 + (sizeof (ACPI_GENERIC_ADDRESS) * i);
AbsoluteOffset = Offset + ArrayOffset;
Array = (UINT8 *) Subtable + ArrayOffset;
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
- Subtable->Length, AcpiDmTableInfoDbg2Addr);
+ SubLength, AcpiDmTableInfoDbg2Addr);
if (ACPI_FAILURE (Status))
{
return;
@@ -453,13 +466,13 @@ AcpiDmDumpDbg2 (
for (i = 0; i < Subtable->RegisterCount; i++)
{
- ArrayOffset = Subtable->AddressSizeOffset +
- (sizeof (UINT32) * i);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->AddressSizeOffset);
+ ArrayOffset = Tmp16 + (sizeof (UINT32) * i);
AbsoluteOffset = Offset + ArrayOffset;
Array = (UINT8 *) Subtable + ArrayOffset;
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
- Subtable->Length, AcpiDmTableInfoDbg2Size);
+ SubLength, AcpiDmTableInfoDbg2Size);
if (ACPI_FAILURE (Status))
{
return;
@@ -469,12 +482,13 @@ AcpiDmDumpDbg2 (
/* Dump the Namestring (required) */
AcpiOsPrintf ("\n");
- ArrayOffset = Subtable->NamepathOffset;
+ ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->NamepathOffset);
+ ArrayOffset = Tmp16;
AbsoluteOffset = Offset + ArrayOffset;
Array = (UINT8 *) Subtable + ArrayOffset;
Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
- Subtable->Length, AcpiDmTableInfoDbg2Name);
+ SubLength, AcpiDmTableInfoDbg2Name);
if (ACPI_FAILURE (Status))
{
return;
@@ -484,9 +498,10 @@ AcpiDmDumpDbg2 (
if (Subtable->OemDataOffset)
{
- Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset,
- Table, Subtable->OemDataLength,
- AcpiDmTableInfoDbg2OemData);
+ ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->OemDataOffset);
+ ACPI_MOVE_16_TO_16(&AlsoTmp16, &Subtable->OemDataLength);
+ Status = AcpiDmDumpTable (Length, Offset + Tmp16,
+ Table, AlsoTmp16, AcpiDmTableInfoDbg2OemData);
if (ACPI_FAILURE (Status))
{
return;
@@ -495,9 +510,9 @@ AcpiDmDumpDbg2 (
/* Point to next subtable */
- Offset += Subtable->Length;
+ Offset += SubLength;
Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
- Subtable->Length);
+ SubLength);
}
}
@@ -521,17 +536,20 @@ AcpiDmDumpDmar (
{
ACPI_STATUS Status;
ACPI_DMAR_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
+ UINT16 SubLength;
UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
ACPI_DMTABLE_INFO *InfoTable;
ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
UINT32 ScopeOffset;
UINT8 *PciPath;
UINT32 PathOffset;
+ UINT16 SubType;
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
if (ACPI_FAILURE (Status))
{
@@ -541,13 +559,14 @@ AcpiDmDumpDmar (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
+ ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoDmarHdr);
+ SubLength, AcpiDmTableInfoDmarHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -555,7 +574,8 @@ AcpiDmDumpDmar (
AcpiOsPrintf ("\n");
- switch (Subtable->Type)
+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
+ switch (SubType)
{
case ACPI_DMAR_TYPE_HARDWARE_UNIT:
@@ -590,12 +610,12 @@ AcpiDmDumpDmar (
default:
AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
- Subtable->Type);
+ SubType);
return;
}
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, InfoTable);
+ SubLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -604,8 +624,8 @@ AcpiDmDumpDmar (
/*
* Dump the optional device scope entries
*/
- if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
- (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
+ if ((SubType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
+ (SubType == ACPI_DMAR_TYPE_NAMESPACE))
{
/* These types do not support device scopes */
@@ -613,7 +633,7 @@ AcpiDmDumpDmar (
}
ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
- while (ScopeOffset < Subtable->Length)
+ while (ScopeOffset < SubLength)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
@@ -654,9 +674,8 @@ AcpiDmDumpDmar (
NextSubtable:
/* Point to next subtable */
- Offset += Subtable->Length;
- Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
- Subtable->Length);
+ Offset += SubLength;
+ Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable, SubLength);
}
}
@@ -683,12 +702,15 @@ AcpiDmDumpDrtm (
ACPI_DRTM_RESOURCE_LIST *DrtmRl;
ACPI_DRTM_DPS_ID *DrtmDps;
UINT32 Count;
+ UINT32 ValidatedCount;
+ UINT32 ResourceCount;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
- AcpiDmTableInfoDrtm);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDrtm);
if (ACPI_FAILURE (Status))
{
return;
@@ -702,7 +724,7 @@ AcpiDmDumpDrtm (
DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (Length, Offset,
DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
AcpiDmTableInfoDrtm0);
if (ACPI_FAILURE (Status))
@@ -715,10 +737,11 @@ AcpiDmDumpDrtm (
/* Dump Validated table addresses */
Count = 0;
- while ((Offset < Table->Length) &&
- (DrtmVtl->ValidatedTableCount > Count))
+ ACPI_MOVE_32_TO_32(&ValidatedCount, &DrtmVtl->ValidatedTableCount);
+ while ((Offset < Length) &&
+ (ValidatedCount > Count))
{
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (Length, Offset,
ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
AcpiDmTableInfoDrtm0a);
if (ACPI_FAILURE (Status))
@@ -734,7 +757,7 @@ AcpiDmDumpDrtm (
DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (Length, Offset,
DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
AcpiDmTableInfoDrtm1);
if (ACPI_FAILURE (Status))
@@ -747,10 +770,11 @@ AcpiDmDumpDrtm (
/* Dump the Resource List */
Count = 0;
- while ((Offset < Table->Length) &&
- (DrtmRl->ResourceCount > Count))
+ ACPI_MOVE_32_TO_32(&ResourceCount, &DrtmRl->ResourceCount);
+ while ((Offset < Length) &&
+ (ResourceCount > Count))
{
- Status = AcpiDmDumpTable (Table->Length, Offset,
+ Status = AcpiDmDumpTable (Length, Offset,
ACPI_ADD_PTR (void, Table, Offset),
sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
if (ACPI_FAILURE (Status))
@@ -766,7 +790,7 @@ AcpiDmDumpDrtm (
DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
AcpiOsPrintf ("\n");
- (void) AcpiDmDumpTable (Table->Length, Offset,
+ (void) AcpiDmDumpTable (Length, Offset,
DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
}
@@ -790,12 +814,13 @@ AcpiDmDumpEinj (
{
ACPI_STATUS Status;
ACPI_WHEA_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
if (ACPI_FAILURE (Status))
{
@@ -805,7 +830,7 @@ AcpiDmDumpEinj (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,
@@ -843,12 +868,13 @@ AcpiDmDumpErst (
{
ACPI_STATUS Status;
ACPI_WHEA_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_ERST);
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
if (ACPI_FAILURE (Status))
{
@@ -858,7 +884,7 @@ AcpiDmDumpErst (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
AcpiOsPrintf ("\n");
Status = AcpiDmDumpTable (Length, Offset, Subtable,
@@ -896,17 +922,19 @@ AcpiDmDumpFpdt (
{
ACPI_STATUS Status;
ACPI_FPDT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
ACPI_DMTABLE_INFO *InfoTable;
+ UINT16 Type;
/* There is no main table (other than the standard ACPI header) */
/* Subtables */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
@@ -918,7 +946,8 @@ AcpiDmDumpFpdt (
return;
}
- switch (Subtable->Type)
+ ACPI_MOVE_16_TO_16(&Type, &Subtable->Type);
+ switch (Type)
{
case ACPI_FPDT_TYPE_BOOT:
@@ -932,8 +961,7 @@ AcpiDmDumpFpdt (
default:
- AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
- Subtable->Type);
+ AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", Type);
/* Attempt to continue */
@@ -981,16 +1009,19 @@ AcpiDmDumpGtdt (
{
ACPI_STATUS Status;
ACPI_GTDT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
+ UINT16 SubLength;
UINT32 Offset = sizeof (ACPI_TABLE_GTDT);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubtableLength;
UINT32 GtCount;
+ UINT32 Tmp32;
ACPI_GTDT_TIMER_ENTRY *GtxTable;
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
if (ACPI_FAILURE (Status))
{
@@ -1017,7 +1048,7 @@ AcpiDmDumpGtdt (
/* Subtables */
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
@@ -1035,8 +1066,9 @@ AcpiDmDumpGtdt (
case ACPI_GTDT_TYPE_TIMER_BLOCK:
SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
- GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
+ Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
Subtable))->TimerCount;
+ ACPI_MOVE_32_TO_32(&GtCount, &Tmp32);
InfoTable = AcpiDmTableInfoGtdt0;
break;
@@ -1057,8 +1089,9 @@ AcpiDmDumpGtdt (
return;
}
+ ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, InfoTable);
+ SubLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -1117,16 +1150,18 @@ AcpiDmDumpHest (
{
ACPI_STATUS Status;
ACPI_HEST_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_HEST);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubtableLength;
UINT32 BankCount;
ACPI_HEST_IA_ERROR_BANK *BankTable;
+ UINT16 SubType;
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
if (ACPI_FAILURE (Status))
{
@@ -1136,10 +1171,11 @@ AcpiDmDumpHest (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
BankCount = 0;
- switch (Subtable->Type)
+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
+ switch (SubType)
{
case ACPI_HEST_TYPE_IA32_CHECK:

View File

@ -1,887 +0,0 @@
Index: acpica-unix2-20200528/source/common/dmtbdump2.c
===================================================================
--- acpica-unix2-20200528.orig/source/common/dmtbdump2.c
+++ acpica-unix2-20200528/source/common/dmtbdump2.c
@@ -75,16 +75,23 @@ AcpiDmDumpIort (
ACPI_IORT_SMMU *IortSmmu = NULL;
UINT32 Offset;
UINT32 NodeOffset;
+ UINT16 NodeLength;
UINT32 Length;
ACPI_DMTABLE_INFO *InfoTable;
char *String;
UINT32 i;
UINT32 MappingByteLength;
+ UINT32 TableLen;
+ UINT32 ItsCount;
+ UINT32 MappingCount;
+ UINT32 CtxIntCount;
+ UINT32 PmuIntCount;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
+ ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
+ Status = AcpiDmDumpTable (TableLen, 0, Table, 0, AcpiDmTableInfoIort);
if (ACPI_FAILURE (Status))
{
return;
@@ -95,18 +102,19 @@ AcpiDmDumpIort (
/* Dump the OptionalPadding (optional) */
- if (Iort->NodeOffset > Offset)
+ ACPI_MOVE_32_TO_32(&NodeOffset, &Iort->NodeOffset);
+ if (NodeOffset > Offset)
{
- Status = AcpiDmDumpTable (Table->Length, Offset, Table,
- Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
+ Status = AcpiDmDumpTable (TableLen, Offset, Table,
+ NodeOffset - Offset, AcpiDmTableInfoIortPad);
if (ACPI_FAILURE (Status))
{
return;
}
}
- Offset = Iort->NodeOffset;
- while (Offset < Table->Length)
+ ACPI_MOVE_32_TO_32(&Offset, &Iort->NodeOffset);
+ while (Offset < TableLen)
{
/* Common subtable header */
@@ -142,7 +150,8 @@ AcpiDmDumpIort (
case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
InfoTable = AcpiDmTableInfoIort2;
- Length = IortNode->Length - NodeOffset;
+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+ Length = NodeLength - NodeOffset;
break;
case ACPI_IORT_NODE_SMMU:
@@ -155,7 +164,8 @@ AcpiDmDumpIort (
case ACPI_IORT_NODE_SMMU_V3:
InfoTable = AcpiDmTableInfoIort4;
- Length = IortNode->Length - NodeOffset;
+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+ Length = NodeLength - NodeOffset;
break;
case ACPI_IORT_NODE_PMCG:
@@ -171,7 +181,8 @@ AcpiDmDumpIort (
/* Attempt to continue */
- if (!IortNode->Length)
+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+ if (!NodeLength)
{
AcpiOsPrintf ("Invalid zero length IORT node\n");
return;
@@ -182,7 +193,7 @@ AcpiDmDumpIort (
/* Dump the node subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Length, InfoTable);
if (ACPI_FAILURE (Status))
@@ -202,9 +213,10 @@ AcpiDmDumpIort (
if (IortItsGroup)
{
- for (i = 0; i < IortItsGroup->ItsCount; i++)
+ ACPI_MOVE_32_TO_32(&ItsCount, &IortItsGroup->ItsCount);
+ for (i = 0; i < ItsCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
4, AcpiDmTableInfoIort0a);
if (ACPI_FAILURE (Status))
@@ -221,12 +233,13 @@ AcpiDmDumpIort (
/* Dump the Padding (optional) */
- if (IortNode->Length > NodeOffset)
+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+ if (NodeLength > NodeOffset)
{
MappingByteLength =
IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
- Table, IortNode->Length - NodeOffset - MappingByteLength,
+ Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
+ Table, NodeLength - NodeOffset - MappingByteLength,
AcpiDmTableInfoIort1a);
if (ACPI_FAILURE (Status))
{
@@ -244,8 +257,8 @@ AcpiDmDumpIort (
if (IortSmmu)
{
Length = 2 * sizeof (UINT64);
- NodeOffset = IortSmmu->GlobalInterruptOffset;
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->GlobalInterruptOffset);
+ Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Length, AcpiDmTableInfoIort3a);
if (ACPI_FAILURE (Status))
@@ -253,10 +266,11 @@ AcpiDmDumpIort (
return;
}
- NodeOffset = IortSmmu->ContextInterruptOffset;
- for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
+ ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->ContextInterruptOffset);
+ ACPI_MOVE_32_TO_32(&CtxIntCount, &IortSmmu->ContextInterruptCount);
+ for (i = 0; i < CtxIntCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
8, AcpiDmTableInfoIort3b);
if (ACPI_FAILURE (Status))
@@ -267,10 +281,11 @@ AcpiDmDumpIort (
NodeOffset += 8;
}
- NodeOffset = IortSmmu->PmuInterruptOffset;
- for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
+ ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->PmuInterruptOffset);
+ ACPI_MOVE_32_TO_32(&PmuIntCount, &IortSmmu->PmuInterruptCount);
+ for (i = 0; i < PmuIntCount; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
8, AcpiDmTableInfoIort3c);
if (ACPI_FAILURE (Status))
@@ -290,12 +305,13 @@ AcpiDmDumpIort (
/* Dump the ID mappings */
- NodeOffset = IortNode->MappingOffset;
- for (i = 0; i < IortNode->MappingCount; i++)
+ ACPI_MOVE_32_TO_32(&NodeOffset, &IortNode->MappingOffset);
+ ACPI_MOVE_32_TO_32(&MappingCount, &IortNode->MappingCount);
+ for (i = 0; i < MappingCount; i++)
{
AcpiOsPrintf ("\n");
Length = sizeof (ACPI_IORT_ID_MAPPING);
- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
+ Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Length, AcpiDmTableInfoIortMap);
if (ACPI_FAILURE (Status))
@@ -309,7 +325,8 @@ AcpiDmDumpIort (
NextSubtable:
/* Point to next node subtable */
- Offset += IortNode->Length;
+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
+ Offset += NodeLength;
}
}
@@ -340,11 +357,14 @@ AcpiDmDumpIvrs (
ACPI_IVRS_DE_HEADER *DeviceEntry;
ACPI_IVRS_HEADER *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
+ UINT32 Length;
+ UINT16 SubLength;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoIvrs);
if (ACPI_FAILURE (Status))
{
return;
@@ -353,13 +373,14 @@ AcpiDmDumpIvrs (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoIvrsHdr);
+ ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ SubLength, AcpiDmTableInfoIvrsHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -391,7 +412,7 @@ AcpiDmDumpIvrs (
/* Attempt to continue */
- if (!Subtable->Length)
+ if (!SubLength)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
@@ -402,8 +423,8 @@ AcpiDmDumpIvrs (
/* Dump the subtable */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, InfoTable);
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ SubLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -429,7 +450,7 @@ AcpiDmDumpIvrs (
sizeof (ACPI_IVRS_HARDWARE2));
}
- while (EntryOffset < (Offset + Subtable->Length))
+ while (EntryOffset < (Offset + SubLength))
{
AcpiOsPrintf ("\n");
/*
@@ -491,7 +512,7 @@ AcpiDmDumpIvrs (
/* Dump the Device Entry */
- Status = AcpiDmDumpTable (Table->Length, EntryOffset,
+ Status = AcpiDmDumpTable (Length, EntryOffset,
DeviceEntry, EntryLength, InfoTable);
if (ACPI_FAILURE (Status))
{
@@ -507,8 +528,8 @@ AcpiDmDumpIvrs (
NextSubtable:
/* Point to next subtable */
- Offset += Subtable->Length;
- Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
+ Offset += SubLength;
+ Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, SubLength);
}
}
@@ -534,7 +555,7 @@ AcpiDmDumpLpit (
{
ACPI_STATUS Status;
ACPI_LPIT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 SubtableLength;
@@ -542,8 +563,9 @@ AcpiDmDumpLpit (
/* Subtables */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
@@ -607,13 +629,14 @@ AcpiDmDumpMadt (
{
ACPI_STATUS Status;
ACPI_SUBTABLE_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_MADT);
ACPI_DMTABLE_INFO *InfoTable;
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
if (ACPI_FAILURE (Status))
{
@@ -623,7 +646,7 @@ AcpiDmDumpMadt (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
@@ -769,11 +792,13 @@ AcpiDmDumpMcfg (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
ACPI_MCFG_ALLOCATION *Subtable;
+ UINT32 Len;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
+ ACPI_MOVE_32_TO_32(&Len, &Table->Length);
+ Status = AcpiDmDumpTable (Len, 0, Table, 0, AcpiDmTableInfoMcfg);
if (ACPI_FAILURE (Status))
{
return;
@@ -782,17 +807,17 @@ AcpiDmDumpMcfg (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Len)
{
- if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
+ if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Len)
{
AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
- (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
+ (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Len));
return;
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Len, Offset, Subtable,
sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
if (ACPI_FAILURE (Status))
{
@@ -826,6 +851,7 @@ AcpiDmDumpMpst (
{
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MPST);
+ ACPI_TABLE_MPST *Mpst;
ACPI_MPST_POWER_NODE *Subtable0;
ACPI_MPST_POWER_STATE *Subtable0A;
ACPI_MPST_COMPONENT *Subtable0B;
@@ -834,11 +860,13 @@ AcpiDmDumpMpst (
UINT16 SubtableCount;
UINT32 PowerStateCount;
UINT32 ComponentCount;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMpst);
if (ACPI_FAILURE (Status))
{
return;
@@ -846,13 +874,14 @@ AcpiDmDumpMpst (
/* Subtable: Memory Power Node(s) */
- SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
+ Mpst = ACPI_CAST_PTR (ACPI_TABLE_MPST, Table);
+ ACPI_MOVE_16_TO_16(&SubtableCount, &Mpst->PowerNodeCount);
Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
- while ((Offset < Table->Length) && SubtableCount)
+ while ((Offset < Length) && SubtableCount)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable0,
sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
if (ACPI_FAILURE (Status))
{
@@ -861,8 +890,8 @@ AcpiDmDumpMpst (
/* Extract the sub-subtable counts */
- PowerStateCount = Subtable0->NumPowerStates;
- ComponentCount = Subtable0->NumPhysicalComponents;
+ ACPI_MOVE_32_TO_32(&PowerStateCount, &Subtable0->NumPowerStates);
+ ACPI_MOVE_32_TO_32(&ComponentCount, &Subtable0->NumPhysicalComponents);
Offset += sizeof (ACPI_MPST_POWER_NODE);
/* Sub-subtables - Memory Power State Structure(s) */
@@ -873,7 +902,7 @@ AcpiDmDumpMpst (
while (PowerStateCount)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable0A,
sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
if (ACPI_FAILURE (Status))
{
@@ -883,7 +912,7 @@ AcpiDmDumpMpst (
Subtable0A++;
PowerStateCount--;
Offset += sizeof (ACPI_MPST_POWER_STATE);
- }
+ }
/* Sub-subtables - Physical Component ID Structure(s) */
@@ -896,7 +925,7 @@ AcpiDmDumpMpst (
while (ComponentCount)
{
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable0B,
sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
if (ACPI_FAILURE (Status))
{
@@ -911,17 +940,19 @@ AcpiDmDumpMpst (
/* Point to next Memory Power Node subtable */
SubtableCount--;
+ ACPI_MOVE_32_TO_32(&PowerStateCount, &Subtable0->NumPowerStates);
+ ACPI_MOVE_32_TO_32(&ComponentCount, &Subtable0->NumPhysicalComponents);
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));
+ (sizeof (ACPI_MPST_POWER_STATE) * PowerStateCount) +
+ (sizeof (ACPI_MPST_COMPONENT) * ComponentCount));
}
/* 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 (Length, Offset, Subtable1,
sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
if (ACPI_FAILURE (Status))
{
@@ -936,10 +967,10 @@ AcpiDmDumpMpst (
Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
sizeof (ACPI_MPST_DATA_HDR));
- while ((Offset < Table->Length) && SubtableCount)
+ while ((Offset < Length) && SubtableCount)
{
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable2,
sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
if (ACPI_FAILURE (Status))
{
@@ -972,11 +1003,13 @@ AcpiDmDumpMsct (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
ACPI_MSCT_PROXIMITY *Subtable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMsct);
if (ACPI_FAILURE (Status))
{
return;
@@ -985,12 +1018,12 @@ AcpiDmDumpMsct (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
if (ACPI_FAILURE (Status))
{
@@ -1025,11 +1058,13 @@ AcpiDmDumpMtmr (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
ACPI_MTMR_ENTRY *Subtable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMtmr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1038,12 +1073,12 @@ AcpiDmDumpMtmr (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
if (ACPI_FAILURE (Status))
{
@@ -1085,11 +1120,17 @@ AcpiDmDumpNfit (
ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
UINT32 i;
+ UINT32 TableLength;
+ UINT16 SubLength;
+ UINT16 SubType;
+ UINT32 Count;
+ UINT16 Count16;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
+ ACPI_MOVE_32_TO_32(&TableLength, &Table->Length);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNfit);
if (ACPI_FAILURE (Status))
{
return;
@@ -1098,19 +1139,21 @@ AcpiDmDumpNfit (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* NFIT subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoNfitHdr);
+ ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubLength, AcpiDmTableInfoNfitHdr);
if (ACPI_FAILURE (Status))
{
return;
}
- switch (Subtable->Type)
+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
+ switch (SubType)
{
case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
@@ -1165,7 +1208,7 @@ AcpiDmDumpNfit (
/* Attempt to continue */
- if (!Subtable->Length)
+ if (!SubLength)
{
AcpiOsPrintf ("Invalid zero length subtable\n");
return;
@@ -1174,8 +1217,8 @@ AcpiDmDumpNfit (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Subtable->Length, InfoTable);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ SubLength, InfoTable);
if (ACPI_FAILURE (Status))
{
return;
@@ -1183,14 +1226,15 @@ AcpiDmDumpNfit (
/* Per-subtable variable-length fields */
- switch (Subtable->Type)
+ switch (SubType)
{
case ACPI_NFIT_TYPE_INTERLEAVE:
Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
- for (i = 0; i < Interleave->LineCount; i++)
+ ACPI_MOVE_32_TO_32(&Count, &Interleave->LineCount);
+ for (i = 0; i < Count; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
&Interleave->LineOffset[i],
sizeof (UINT32), AcpiDmTableInfoNfit2a);
if (ACPI_FAILURE (Status))
@@ -1204,12 +1248,11 @@ AcpiDmDumpNfit (
case ACPI_NFIT_TYPE_SMBIOS:
- Length = Subtable->Length -
- sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
+ Length = SubLength - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
if (Length)
{
- Status = AcpiDmDumpTable (Table->Length,
+ Status = AcpiDmDumpTable (TableLength,
sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
SmbiosInfo,
Length, AcpiDmTableInfoNfit3a);
@@ -1224,9 +1267,10 @@ AcpiDmDumpNfit (
case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
- for (i = 0; i < Hint->HintCount; i++)
+ ACPI_MOVE_16_TO_16(&Count16, &Hint->HintCount);
+ for (i = 0; i < Count16; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
+ Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
&Hint->HintAddress[i],
sizeof (UINT64), AcpiDmTableInfoNfit6a);
if (ACPI_FAILURE (Status))
@@ -1245,8 +1289,8 @@ AcpiDmDumpNfit (
NextSubtable:
/* Point to next subtable */
- Offset += Subtable->Length;
- Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
+ Offset += SubLength;
+ Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, SubLength);
}
}
@@ -1271,12 +1315,13 @@ AcpiDmDumpPcct (
ACPI_STATUS Status;
ACPI_PCCT_SUBSPACE *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
if (ACPI_FAILURE (Status))
{
@@ -1286,7 +1331,7 @@ AcpiDmDumpPcct (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
@@ -1426,16 +1471,21 @@ AcpiDmDumpPmtt (
ACPI_PMTT_HEADER *MemSubtable;
ACPI_PMTT_HEADER *DimmSubtable;
ACPI_PMTT_DOMAIN *DomainArray;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
UINT32 MemOffset;
UINT32 DimmOffset;
UINT32 DomainOffset;
- UINT32 DomainCount;
+ UINT16 DomainCount;
+ UINT16 SubLength;
+ UINT16 Tmp16;
+ UINT16 MemLength;
+ UINT16 DimmLength;
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
if (ACPI_FAILURE (Status))
{
@@ -1445,13 +1495,14 @@ AcpiDmDumpPmtt (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
+ ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmttHdr);
+ SubLength, AcpiDmTableInfoPmttHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1470,7 +1521,7 @@ AcpiDmDumpPmtt (
/* Dump the fixed-length portion of the subtable */
Status = AcpiDmDumpTable (Length, Offset, Subtable,
- Subtable->Length, AcpiDmTableInfoPmtt0);
+ SubLength, AcpiDmTableInfoPmtt0);
if (ACPI_FAILURE (Status))
{
return;
@@ -1482,15 +1533,16 @@ AcpiDmDumpPmtt (
MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
sizeof (ACPI_PMTT_SOCKET));
- while (((Offset + MemOffset) < Table->Length) &&
- (MemOffset < Subtable->Length))
+ while (((Offset + MemOffset) < Length) &&
+ (MemOffset < SubLength))
{
/* Common subtable header */
AcpiOsPrintf ("\n");
+ ACPI_MOVE_16_TO_16(&MemLength, &MemSubtable->Length);
Status = AcpiDmDumpTable (Length,
Offset + MemOffset, MemSubtable,
- MemSubtable->Length, AcpiDmTableInfoPmttHdr);
+ MemLength, AcpiDmTableInfoPmttHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1510,7 +1562,7 @@ AcpiDmDumpPmtt (
Status = AcpiDmDumpTable (Length,
Offset + MemOffset, MemSubtable,
- MemSubtable->Length, AcpiDmTableInfoPmtt1);
+ MemLength, AcpiDmTableInfoPmtt1);
if (ACPI_FAILURE (Status))
{
return;
@@ -1518,13 +1570,14 @@ AcpiDmDumpPmtt (
/* Walk the variable count of proximity domains */
- DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
+ Tmp16 = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
+ ACPI_MOVE_16_TO_16(&DomainCount, &Tmp16);
DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
sizeof (ACPI_PMTT_CONTROLLER));
- while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
- ((MemOffset + DomainOffset) < Subtable->Length) &&
+ while (((Offset + MemOffset + DomainOffset) < Length) &&
+ ((MemOffset + DomainOffset) < SubLength) &&
DomainCount)
{
Status = AcpiDmDumpTable (Length,
@@ -1552,15 +1605,16 @@ AcpiDmDumpPmtt (
DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
DomainOffset);
- while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
- (DimmOffset < MemSubtable->Length))
+ while (((Offset + MemOffset + DimmOffset) < Length) &&
+ (DimmOffset < MemLength))
{
/* Common subtable header */
AcpiOsPrintf ("\n");
+ ACPI_MOVE_16_TO_16(&DimmLength, &DimmSubtable->Length);
Status = AcpiDmDumpTable (Length,
Offset + MemOffset + DimmOffset, DimmSubtable,
- DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
+ DimmLength, AcpiDmTableInfoPmttHdr);
if (ACPI_FAILURE (Status))
{
return;
@@ -1580,7 +1634,7 @@ AcpiDmDumpPmtt (
Status = AcpiDmDumpTable (Length,
Offset + MemOffset + DimmOffset, DimmSubtable,
- DimmSubtable->Length, AcpiDmTableInfoPmtt2);
+ DimmLength, AcpiDmTableInfoPmtt2);
if (ACPI_FAILURE (Status))
{
return;
@@ -1588,23 +1642,22 @@ AcpiDmDumpPmtt (
/* Point to next DIMM subtable */
- DimmOffset += DimmSubtable->Length;
+ DimmOffset += DimmLength;
DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
- DimmSubtable, DimmSubtable->Length);
+ DimmSubtable, DimmLength);
}
/* Point to next Controller subtable */
- MemOffset += MemSubtable->Length;
+ MemOffset += MemLength;
MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
- MemSubtable, MemSubtable->Length);
+ MemSubtable, MemLength);
}
/* Point to next Socket subtable */
- Offset += Subtable->Length;
- Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
- Subtable, Subtable->Length);
+ Offset += SubLength;
+ Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, SubLength);
}
}
@@ -1765,6 +1818,8 @@ AcpiDmDumpS3pt (
ACPI_FPDT_HEADER *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
+ UINT32 Length;
+ UINT16 SubType;
/* Main table */
@@ -1775,20 +1830,22 @@ AcpiDmDumpS3pt (
return 0;
}
+ ACPI_MOVE_32_TO_32(&Length, &S3ptTable->Length);
Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
- while (Offset < S3ptTable->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoS3ptHdr);
if (ACPI_FAILURE (Status))
{
return 0;
}
- switch (Subtable->Type)
+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
+ switch (SubType)
{
case ACPI_S3PT_TYPE_RESUME:
@@ -1803,7 +1860,7 @@ AcpiDmDumpS3pt (
default:
AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
- Subtable->Type);
+ SubType);
/* Attempt to continue */
@@ -1816,7 +1873,7 @@ AcpiDmDumpS3pt (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{

View File

@ -1,250 +0,0 @@
Index: acpica-unix-20191018/source/common/dmtbdump3.c
===================================================================
--- acpica-unix-20191018.orig/source/common/dmtbdump3.c
+++ acpica-unix-20191018/source/common/dmtbdump3.c
@@ -68,9 +68,11 @@ void
AcpiDmDumpSlic (
ACPI_TABLE_HEADER *Table)
{
+ UINT32 Length;
- (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
- Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ (void) AcpiDmDumpTable (Length, sizeof (ACPI_TABLE_HEADER), Table,
+ Length - sizeof (*Table), AcpiDmTableInfoSlic);
}
@@ -93,14 +95,17 @@ AcpiDmDumpSlit (
ACPI_STATUS Status;
UINT32 Offset;
UINT8 *Row;
- UINT32 Localities;
+ UINT64 Localities;
UINT32 i;
UINT32 j;
+ UINT32 Length;
+ UINT64 Tmp64;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSlit);
if (ACPI_FAILURE (Status))
{
return;
@@ -108,7 +113,8 @@ AcpiDmDumpSlit (
/* Display the Locality NxN Matrix */
- Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ Tmp64 = (UINT64) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ ACPI_MOVE_64_TO_64(&Localities, &Tmp64);
Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
@@ -121,7 +127,7 @@ AcpiDmDumpSlit (
{
/* Check for beyond EOT */
- if (Offset >= Table->Length)
+ if (Offset >= Length)
{
AcpiOsPrintf (
"\n**** Not enough room in table for all localities\n");
@@ -173,11 +179,13 @@ AcpiDmDumpSrat (
UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
ACPI_SUBTABLE_HEADER *Subtable;
ACPI_DMTABLE_INFO *InfoTable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSrat);
if (ACPI_FAILURE (Status))
{
return;
@@ -186,12 +194,12 @@ AcpiDmDumpSrat (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoSratHdr);
if (ACPI_FAILURE (Status))
{
@@ -245,7 +253,7 @@ AcpiDmDumpSrat (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
@@ -282,13 +290,14 @@ AcpiDmDumpStao (
{
ACPI_STATUS Status;
char *Namepath;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT32 StringLength;
UINT32 Offset = sizeof (ACPI_TABLE_STAO);
/* Main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
if (ACPI_FAILURE (Status))
{
@@ -297,7 +306,7 @@ AcpiDmDumpStao (
/* The rest of the table consists of Namepath strings */
- while (Offset < Table->Length)
+ while (Offset < Length)
{
Namepath = ACPI_ADD_PTR (char, Table, Offset);
StringLength = strlen (Namepath) + 1;
@@ -339,11 +348,14 @@ AcpiDmDumpTcpa (
ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR (
ACPI_TABLE_TCPA_HDR, Table, Offset);
ACPI_STATUS Status;
+ UINT32 Length;
+ UINT16 PlatformClass;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table,
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table,
0, AcpiDmTableInfoTcpaHdr);
if (ACPI_FAILURE (Status))
{
@@ -354,18 +366,19 @@ AcpiDmDumpTcpa (
* Examine the PlatformClass field to determine the table type.
* Either a client or server table. Only one.
*/
- switch (CommonHeader->PlatformClass)
+ ACPI_MOVE_16_TO_16(&PlatformClass, &CommonHeader->PlatformClass);
+ switch (PlatformClass)
{
case ACPI_TCPA_CLIENT_TABLE:
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTcpaClient);
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Length - Offset, AcpiDmTableInfoTcpaClient);
break;
case ACPI_TCPA_SERVER_TABLE:
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTcpaServer);
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Length - Offset, AcpiDmTableInfoTcpaServer);
break;
default:
@@ -512,11 +525,13 @@ AcpiDmDumpVrtc (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
ACPI_VRTC_ENTRY *Subtable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoVrtc);
if (ACPI_FAILURE (Status))
{
return;
@@ -525,12 +540,12 @@ AcpiDmDumpVrtc (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
if (ACPI_FAILURE (Status))
{
@@ -565,11 +580,13 @@ AcpiDmDumpWdat (
ACPI_STATUS Status;
UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
ACPI_WDAT_ENTRY *Subtable;
+ UINT32 Length;
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWdat);
if (ACPI_FAILURE (Status))
{
return;
@@ -578,12 +595,12 @@ AcpiDmDumpWdat (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < Length)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
if (ACPI_FAILURE (Status))
{
@@ -618,12 +635,13 @@ AcpiDmDumpWpbt (
{
ACPI_STATUS Status;
ACPI_TABLE_WPBT *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 Length;
UINT16 ArgumentsLength;
/* Dump the main table */
+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
if (ACPI_FAILURE (Status))
{
@@ -633,10 +651,10 @@ AcpiDmDumpWpbt (
/* Extract the arguments buffer length from the main table */
Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
- ArgumentsLength = Subtable->ArgumentsLength;
+ ACPI_MOVE_16_TO_16(&ArgumentsLength, &Subtable->ArgumentsLength);
/* Dump the arguments buffer */
- (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
+ (void) AcpiDmDumpTable (Length, 0, Table, ArgumentsLength,
AcpiDmTableInfoWpbt0);
}

View File

@ -1,19 +0,0 @@
Updated versions of upstream often contain fixes that were not seen
in the original big-endian patch; we try to capture those here.
Signed-off-by: Al Stone <ahs3@redhat.com>
Index: acpica-unix-20191018/source/compiler/asllookup.c
===================================================================
--- acpica-unix-20191018.orig/source/compiler/asllookup.c
+++ acpica-unix-20191018/source/compiler/asllookup.c
@@ -249,7 +249,8 @@ LkIsObjectUsed (
* ACPI names and are typically not referenced since they are meant
* to be called by the host OS.
*/
- if (Node->Name.Ascii[0] == '_')
+ ACPI_MOVE_32_TO_32(&tmp.Ascii, Node->Name.Ascii);
+ if (tmp.Ascii[0] == '_')
{
return (AE_OK);
}

View File

@ -1,140 +0,0 @@
diff -Naur acpica-unix2-20200214.orig/source/components/namespace/nsutils.c acpica-unix2-20200214/source/components/namespace/nsutils.c
--- acpica-unix2-20200214.orig/source/components/namespace/nsutils.c 2020-02-14 10:33:55.000000000 -0700
+++ acpica-unix2-20200214/source/components/namespace/nsutils.c 2020-02-26 10:25:43.477022167 -0700
@@ -363,6 +363,15 @@
/* Move on the next segment */
+ {
+ /* Make sure the name segment reflects endian-ness first */
+
+ UINT32 Tmp32 = 0;
+
+ memcpy(&Tmp32, Result, ACPI_NAMESEG_SIZE);
+ ACPI_MOVE_32_TO_32(Result, &Tmp32);
+ }
+
ExternalName++;
Result += ACPI_NAMESEG_SIZE;
}
diff -Naur acpica-unix2-20200214.orig/source/common/dmtbdump2.c acpica-unix2-20200214/source/common/dmtbdump2.c
--- acpica-unix2-20200214.orig/source/common/dmtbdump2.c 2020-02-26 11:44:13.732967820 -0700
+++ acpica-unix2-20200214/source/common/dmtbdump2.c 2020-02-26 12:38:44.286849954 -0700
@@ -1685,6 +1685,8 @@
UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
ACPI_DMTABLE_INFO *InfoTable;
UINT32 i;
+ UINT32 TableLen;
+ UINT32 NumPrivRes;
/* There is no main table (other than the standard ACPI header) */
@@ -1692,7 +1694,8 @@
/* Subtables */
Offset = sizeof (ACPI_TABLE_HEADER);
- while (Offset < Table->Length)
+ ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
+ while (Offset < TableLen)
{
AcpiOsPrintf ("\n");
@@ -1704,7 +1707,7 @@
AcpiOsPrintf ("Invalid subtable length\n");
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLen, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoPpttHdr);
if (ACPI_FAILURE (Status))
{
@@ -1746,7 +1749,7 @@
AcpiOsPrintf ("Invalid subtable length\n");
return;
}
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLen, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
@@ -1762,15 +1765,16 @@
/* Dump SMBIOS handles */
+ ACPI_MOVE_32_TO_32(&NumPrivRes, &PpttProcessor->NumberOfPrivResources);
if ((UINT8)(Subtable->Length - SubtableOffset) <
- (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
+ (UINT8)(NumPrivRes * 4))
{
AcpiOsPrintf ("Invalid private resource number\n");
return;
}
- for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
+ for (i = 0; i < NumPrivRes; i++)
{
- Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
+ Status = AcpiDmDumpTable (TableLen, Offset + SubtableOffset,
ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
4, AcpiDmTableInfoPptt0a);
if (ACPI_FAILURE (Status))
diff -Naur acpica-unix2-20200214.orig/source/compiler/dttable2.c acpica-unix2-20200214/source/compiler/dttable2.c
--- acpica-unix2-20200214.orig/source/compiler/dttable2.c 2020-02-26 11:44:13.726967769 -0700
+++ acpica-unix2-20200214/source/compiler/dttable2.c 2020-02-26 12:39:03.671014890 -0700
@@ -1087,9 +1087,11 @@
Subtable->Buffer, sizeof (ACPI_SUBTABLE_HEADER));
if (PpttProcessor)
{
+ UINT32 NumPrivRes;
+
/* Compile initiator proximity domain list */
- PpttProcessor->NumberOfPrivResources = 0;
+ NumPrivRes = 0;
while (*PFieldList)
{
Status = DtCompileTable (PFieldList,
@@ -1105,8 +1107,9 @@
DtInsertSubtable (ParentTable, Subtable);
PpttHeader->Length += (UINT8)(Subtable->Length);
- PpttProcessor->NumberOfPrivResources++;
+ NumPrivRes++;
}
+ ACPI_MOVE_32_TO_32(&PpttProcessor->NumberOfPrivResources, &NumPrivRes);
}
break;
diff -Naur acpica-unix2-20200214.orig/source/compiler/aslload.c acpica-unix2-20200214/source/compiler/aslload.c
--- acpica-unix2-20200214.orig/source/compiler/aslload.c 2020-02-14 10:33:53.000000000 -0700
+++ acpica-unix2-20200214/source/compiler/aslload.c 2020-02-27 13:25:19.308413494 -0700
@@ -175,13 +175,17 @@
ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
char *ExternalPath;
+ char TmpPath[ACPI_NAMESEG_SIZE];
SourceRegion = UtGetArg (Op, 0);
if (SourceRegion)
{
- Status = AcpiNsLookup (WalkState->ScopeInfo,
- SourceRegion->Asl.Value.String, AmlType, ACPI_IMODE_EXECUTE,
+ char TmpName[ACPI_NAMESEG_SIZE];
+
+ ACPI_MOVE_32_TO_32(TmpName, SourceRegion->Asl.Value.String);
+ Status = AcpiNsLookup (WalkState->ScopeInfo, TmpName,
+ AmlType, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
if (Status == AE_NOT_FOUND)
{
@@ -232,8 +236,9 @@
default:
+ ACPI_MOVE_32_TO_32(TmpPath, Child->Asl.Value.String);
Status = AcpiNsLookup (WalkState->ScopeInfo,
- Child->Asl.Value.String,
+ TmpPath,
ACPI_TYPE_LOCAL_REGION_FIELD,
ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,27 @@
converterSample.asl 15: Name (b, 5)
Remark 2182 - ^ At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case (B___)
converterSample.asl 16: Name(p008, Package()
Remark 2182 - ^ At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case (P008)
converterSample.asl 37: Method(MAIN) {
Remark 2120 - ^ Control Method should be made Serialized due to creation of named objects within (\MAIN)
converterSample.asl 48: Name(b,0);
Remark 2182 - ^ At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case (B___)
converterSample.asl 48: Name(b,0);
Remark 2089 - Object is not referenced ^ (Name [B___] is within a method [MAIN])
converterSample.asl 53: Name (a,
Remark 2182 - ^ At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case (A___)
converterSample.asl 65: Method(SCOP)
Remark 2120 - ^ Control Method should be made Serialized due to creation of named objects within (\SCOP)
converterSample.asl 68: Name (a1, 0x04)
Remark 2182 - ^ At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case (A1__)
converterSample.asl 68: Name (a1, 0x04)
Remark 2089 - Object is not referenced ^ (Name [A1__] is within a method [SCOP])
@ -23,4 +38,4 @@ Ignoring all errors, forcing AML file generation
ASL Input: converterSample.asl - 1968 bytes 11 keywords 85 source lines
AML Output: converterSample.aml - 182 bytes 2 opcodes 9 named objects
Compilation successful. 0 Errors, 0 Warnings, 5 Remarks, 10 Optimizations
Compilation successful. 0 Errors, 0 Warnings, 10 Remarks, 10 Optimizations

View File

@ -63,10 +63,10 @@ Github-Location: https://github.com/acpica/acpica/pull/295/commits/987a3b5cf7175
source/components/dispatcher/dsutils.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
Index: acpica-unix-20191018/source/components/dispatcher/dsutils.c
Index: acpica-unix2-20200925/source/components/dispatcher/dsutils.c
===================================================================
--- acpica-unix-20191018.orig/source/components/dispatcher/dsutils.c
+++ acpica-unix-20191018/source/components/dispatcher/dsutils.c
--- acpica-unix2-20200925.orig/source/components/dispatcher/dsutils.c
+++ acpica-unix2-20200925/source/components/dispatcher/dsutils.c
@@ -759,6 +759,8 @@ AcpiDsCreateOperands (
ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS];
UINT32 ArgCount = 0;

View File

@ -130,10 +130,10 @@ Github-Location: https://github.com/acpica/acpica/pull/278/commits/4a0243ecb4c94
source/components/parser/psobject.c | 44 ++++++++++++++-----------------------
1 file changed, 16 insertions(+), 28 deletions(-)
Index: acpica-unix-20191018/source/components/parser/psobject.c
Index: acpica-unix2-20200925/source/components/parser/psobject.c
===================================================================
--- acpica-unix-20191018.orig/source/components/parser/psobject.c
+++ acpica-unix-20191018/source/components/parser/psobject.c
--- acpica-unix2-20200925.orig/source/components/parser/psobject.c
+++ acpica-unix2-20200925/source/components/parser/psobject.c
@@ -707,7 +707,8 @@ AcpiPsCompleteFinalOp (
ACPI_PARSE_OBJECT *Op,
ACPI_STATUS Status)

View File

@ -67,10 +67,10 @@ Github-Location: https://github.com/acpica/acpica/pull/296/commits/37f2c716f2c6a
source/components/namespace/nseval.c | 10 ++++++++++
1 file changed, 10 insertions(+)
Index: acpica-unix-20191018/source/components/namespace/nseval.c
Index: acpica-unix2-20200925/source/components/namespace/nseval.c
===================================================================
--- acpica-unix-20191018.orig/source/components/namespace/nseval.c
+++ acpica-unix-20191018/source/components/namespace/nseval.c
--- acpica-unix2-20200925.orig/source/components/namespace/nseval.c
+++ acpica-unix2-20200925/source/components/namespace/nseval.c
@@ -329,6 +329,16 @@ AcpiNsEvaluate (
Info->ReturnObject = NULL;
}

View File

@ -4,10 +4,11 @@ into an ACPI_OBJECT instead of just the pointer (see the use in the call
to memcpy()). So, move the init so GCC recognizes that ValueToWrite is
only a pointer, and not a whole string that needs to be moved.
diff -Naur acpica-unix2-20200214.orig/source/components/debugger/dbtest.c acpica-unix2-20200214/source/components/debugger/dbtest.c
--- acpica-unix2-20200214.orig/source/components/debugger/dbtest.c 2020-02-14 10:33:54.000000000 -0700
+++ acpica-unix2-20200214/source/components/debugger/dbtest.c 2020-02-25 10:50:42.793372070 -0700
@@ -719,9 +719,10 @@
Index: acpica-unix2-20200925/source/components/debugger/dbtest.c
===================================================================
--- acpica-unix2-20200925.orig/source/components/debugger/dbtest.c
+++ acpica-unix2-20200925/source/components/debugger/dbtest.c
@@ -719,9 +719,10 @@ AcpiDbTestStringType (
ACPI_OBJECT *Temp1 = NULL;
ACPI_OBJECT *Temp2 = NULL;
ACPI_OBJECT *Temp3 = NULL;
@ -19,7 +20,7 @@ diff -Naur acpica-unix2-20200214.orig/source/components/debugger/dbtest.c acpica
/* Read the original value */
@@ -737,6 +738,9 @@
@@ -737,6 +738,9 @@ AcpiDbTestStringType (
/* Write a new value */
@ -29,7 +30,7 @@ diff -Naur acpica-unix2-20200214.orig/source/components/debugger/dbtest.c acpica
WriteValue.Type = ACPI_TYPE_STRING;
WriteValue.String.Length = strlen (ValueToWrite);
WriteValue.String.Pointer = ValueToWrite;
@@ -790,6 +794,7 @@
@@ -790,6 +794,7 @@ Exit:
if (Temp1) {AcpiOsFree (Temp1);}
if (Temp2) {AcpiOsFree (Temp2);}
if (Temp3) {AcpiOsFree (Temp3);}

View File

@ -8,10 +8,10 @@ From: Al Stone <ahs3@redhat.com>
generate/unix/iasl/Makefile | 13 +++++++------
2 files changed, 9 insertions(+), 6 deletions(-)
Index: acpica-unix2-20200528/generate/unix/Makefile.config
Index: acpica-unix2-20200925/generate/unix/Makefile.config
===================================================================
--- acpica-unix2-20200528.orig/generate/unix/Makefile.config
+++ acpica-unix2-20200528/generate/unix/Makefile.config
--- acpica-unix2-20200925.orig/generate/unix/Makefile.config
+++ acpica-unix2-20200925/generate/unix/Makefile.config
@@ -189,6 +189,8 @@ ifneq ($(NOFORTIFY),TRUE)
OPT_CFLAGS += -D_FORTIFY_SOURCE=2
endif
@ -21,11 +21,11 @@ Index: acpica-unix2-20200528/generate/unix/Makefile.config
CFLAGS += \
-D$(ACPI_HOST)\
-D_GNU_SOURCE\
Index: acpica-unix2-20200528/generate/unix/iasl/Makefile
Index: acpica-unix2-20200925/generate/unix/iasl/Makefile
===================================================================
--- acpica-unix2-20200528.orig/generate/unix/iasl/Makefile
+++ acpica-unix2-20200528/generate/unix/iasl/Makefile
@@ -358,34 +358,35 @@ $(OBJDIR)/prparserparse.c $(OBJDIR)/prpa
--- acpica-unix2-20200925.orig/generate/unix/iasl/Makefile
+++ acpica-unix2-20200925/generate/unix/iasl/Makefile
@@ -359,34 +359,35 @@ $(OBJDIR)/prparserparse.c $(OBJDIR)/prpa
# Cannot use the common compile warning flags since the C files are created
# by the utilities above and they are not necessarily ANSI C, etc.
#

View File

@ -13,10 +13,10 @@ Signed-off-by: Al Stone <ahs3@redhat.com>
source/common/dmtbinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: acpica-unix2-20200528/source/common/dmtbinfo.c
Index: acpica-unix2-20200925/source/common/dmtbinfo.c
===================================================================
--- acpica-unix2-20200528.orig/source/common/dmtbinfo.c
+++ acpica-unix2-20200528/source/common/dmtbinfo.c
--- acpica-unix2-20200925.orig/source/common/dmtbinfo.c
+++ acpica-unix2-20200925/source/common/dmtbinfo.c
@@ -184,7 +184,7 @@ ACPI_DMTABLE_INFO AcpiDmTableI
ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] =
{

View File

@ -1,65 +0,0 @@
diff -Naur acpica-unix2-20190108/source/common/dmrestag.c acpica-unix2-20190108-patch/source/common/dmrestag.c
--- acpica-unix2-20190108/source/common/dmrestag.c 2019-01-08 14:10:31.000000000 -0700
+++ acpica-unix2-20190108-patch/source/common/dmrestag.c 2019-05-10 13:57:10.768398838 -0600
@@ -710,10 +710,25 @@
* end up in the final compiled AML, it's just an appearance issue for the
* disassembled code.
*/
- Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0;
- strncat (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
- strcat (Pathname, ".");
- strncat (Pathname, Tag, ACPI_NAME_SIZE);
+ {
+ /*
+ * GCC9 forces some contortions when non-null-terminated char
+ * strings are being used; using strncat() might be simpler,
+ * but the assumption that the string is null-terminated gets
+ * checked and AML does not always guarantee that is true.
+ */
+ char *tmp;
+ unsigned char dot = '.';
+
+ Pathname[strlen (Pathname) - ACPI_NAME_SIZE] = 0;
+ tmp = Pathname + strlen(Pathname);
+ memcpy (tmp, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
+ tmp += ACPI_NAME_SIZE;
+ memcpy (tmp, &dot, 1);
+ tmp++;
+ memcpy (tmp, Tag, ACPI_NAME_SIZE);
+ tmp += ACPI_NAME_SIZE;
+ }
/* Internalize the namepath to AML format */
diff -Naur acpica-unix2-20190108/source/compiler/aslcodegen.c acpica-unix2-20190108-patch/source/compiler/aslcodegen.c
--- acpica-unix2-20190108/source/compiler/aslcodegen.c 2019-05-10 13:40:12.827411487 -0600
+++ acpica-unix2-20190108-patch/source/compiler/aslcodegen.c 2019-05-10 13:25:34.667850614 -0600
@@ -450,11 +450,11 @@
*/
if (AcpiGbl_CaptureComments)
{
- strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, ACPI_NAME_SIZE);
+ memcpy(AcpiGbl_TableSig, Child->Asl.Value.String, ACPI_NAME_SIZE);
Child->Asl.Value.String = ACPI_SIG_XXXX;
}
- strncpy (AslGbl_TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE);
+ memcpy (AslGbl_TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE);
/* Revision */
@@ -471,12 +471,12 @@
/* OEMID */
Child = Child->Asl.Next;
- strncpy (AslGbl_TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE);
+ memcpy (AslGbl_TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE);
/* OEM TableID */
Child = Child->Asl.Next;
- strncpy (AslGbl_TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE);
+ memcpy (AslGbl_TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE);
/* OEM Revision */

View File

@ -40,6 +40,12 @@ Warning 3055 - ^ Invalid Hex/Octal Escape - Non-
grammar.asl 523: NAME (ESC2, "abcdefg\000hijklmn")
Warning 3055 - ^ Invalid Hex/Octal Escape - Non-ASCII or NULL
grammar.asl 552: IRQNoFlags(xxxt){3,4,10,11}
Remark 2182 - ^ At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case (XXXT)
grammar.asl 566: Name(Bxxx,0xFFFFFFFF)
Remark 2182 - ^ At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case (BXXX)
grammar.asl 620: RCIV (Subtract (Arg0, 1))
Remark 2098 - ^ Recursive method call (RCIV)
@ -581,4 +587,4 @@ Ignoring all errors, forcing AML file generation
ASL Input: grammar.asl - 323653 bytes 4818 keywords 10284 source lines
AML Output: grammar.aml - 43758 bytes 4148 opcodes 670 named objects
Compilation successful. 6 Errors, 93 Warnings, 92 Remarks, 1106 Optimizations
Compilation successful. 6 Errors, 93 Warnings, 94 Remarks, 1106 Optimizations

View File

@ -21,10 +21,10 @@ From: Al Stone <ahs3@redhat.com>
source/components/utilities/utownerid.c | 2 +-
18 files changed, 28 insertions(+), 28 deletions(-)
Index: acpica-unix2-20200528/source/compiler/aslerror.c
Index: acpica-unix2-20200925/source/compiler/aslerror.c
===================================================================
--- acpica-unix2-20200528.orig/source/compiler/aslerror.c
+++ acpica-unix2-20200528/source/compiler/aslerror.c
--- acpica-unix2-20200925.orig/source/compiler/aslerror.c
+++ acpica-unix2-20200925/source/compiler/aslerror.c
@@ -917,7 +917,7 @@ AslLogNewError (
AslGbl_ExceptionCount[ModifiedLevel]++;
if (!AslGbl_IgnoreErrors && AslGbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
@ -34,10 +34,10 @@ Index: acpica-unix2-20200528/source/compiler/aslerror.c
AslGbl_SourceLine = 0;
AslGbl_NextError = AslGbl_ErrorLog;
Index: acpica-unix2-20200528/source/compiler/aslopt.c
Index: acpica-unix2-20200925/source/compiler/aslopt.c
===================================================================
--- acpica-unix2-20200528.orig/source/compiler/aslopt.c
+++ acpica-unix2-20200528/source/compiler/aslopt.c
--- acpica-unix2-20200925.orig/source/compiler/aslopt.c
+++ acpica-unix2-20200925/source/compiler/aslopt.c
@@ -583,7 +583,7 @@ OptOptimizeNamePath (
}
@ -47,11 +47,11 @@ Index: acpica-unix2-20200528/source/compiler/aslopt.c
Op->Asl.LogicalLineNumber,
AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode),
AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
Index: acpica-unix2-20200528/source/compiler/aslprepkg.c
Index: acpica-unix2-20200925/source/compiler/aslprepkg.c
===================================================================
--- acpica-unix2-20200528.orig/source/compiler/aslprepkg.c
+++ acpica-unix2-20200528/source/compiler/aslprepkg.c
@@ -309,7 +309,7 @@ ApCheckPackage (
--- acpica-unix2-20200925.orig/source/compiler/aslprepkg.c
+++ acpica-unix2-20200925/source/compiler/aslprepkg.c
@@ -320,7 +320,7 @@ ApCheckPackage (
if (Count & 1)
{
@ -60,11 +60,11 @@ Index: acpica-unix2-20200528/source/compiler/aslprepkg.c
Predefined->Info.Name, Count);
AslError (ASL_ERROR, ASL_MSG_RESERVED_PACKAGE_LENGTH,
Index: acpica-unix2-20200528/source/components/debugger/dbexec.c
Index: acpica-unix2-20200925/source/components/debugger/dbexec.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/debugger/dbexec.c
+++ acpica-unix2-20200528/source/components/debugger/dbexec.c
@@ -230,7 +230,7 @@ AcpiDbExecuteMethod (
--- acpica-unix2-20200925.orig/source/components/debugger/dbexec.c
+++ acpica-unix2-20200925/source/components/debugger/dbexec.c
@@ -231,7 +231,7 @@ AcpiDbExecuteMethod (
ACPI_ERROR ((AE_INFO,
"Possible buffer overflow within AML Debugger "
"buffer (size 0x%X needed 0x%X)",
@ -73,10 +73,10 @@ Index: acpica-unix2-20200528/source/components/debugger/dbexec.c
}
}
Index: acpica-unix2-20200528/source/components/dispatcher/dsmthdat.c
Index: acpica-unix2-20200925/source/components/dispatcher/dsmthdat.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/dispatcher/dsmthdat.c
+++ acpica-unix2-20200528/source/components/dispatcher/dsmthdat.c
--- acpica-unix2-20200925.orig/source/components/dispatcher/dsmthdat.c
+++ acpica-unix2-20200925/source/components/dispatcher/dsmthdat.c
@@ -291,7 +291,7 @@ AcpiDsMethodDataGetNode (
if (Index > ACPI_METHOD_MAX_LOCAL)
{
@ -95,10 +95,10 @@ Index: acpica-unix2-20200528/source/components/dispatcher/dsmthdat.c
Index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
Index: acpica-unix2-20200528/source/components/dispatcher/dsutils.c
Index: acpica-unix2-20200925/source/components/dispatcher/dsutils.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/dispatcher/dsutils.c
+++ acpica-unix2-20200528/source/components/dispatcher/dsutils.c
--- acpica-unix2-20200925.orig/source/components/dispatcher/dsutils.c
+++ acpica-unix2-20200925/source/components/dispatcher/dsutils.c
@@ -786,7 +786,7 @@ AcpiDsCreateOperands (
}
@ -108,10 +108,10 @@ Index: acpica-unix2-20200528/source/components/dispatcher/dsutils.c
WalkState->NumOperands, ArgCount, Index));
/* Create the interpreter arguments, in reverse order */
Index: acpica-unix2-20200528/source/components/dispatcher/dswscope.c
Index: acpica-unix2-20200925/source/components/dispatcher/dswscope.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/dispatcher/dswscope.c
+++ acpica-unix2-20200528/source/components/dispatcher/dswscope.c
--- acpica-unix2-20200925.orig/source/components/dispatcher/dswscope.c
+++ acpica-unix2-20200925/source/components/dispatcher/dswscope.c
@@ -149,7 +149,7 @@ AcpiDsScopeStackPush (
WalkState->ScopeDepth++;
@ -130,10 +130,10 @@ Index: acpica-unix2-20200528/source/components/dispatcher/dswscope.c
(UINT32) WalkState->ScopeDepth,
AcpiUtGetNodeName (ScopeInfo->Scope.Node),
AcpiUtGetTypeName (ScopeInfo->Common.Value)));
Index: acpica-unix2-20200528/source/components/events/evgpe.c
Index: acpica-unix2-20200925/source/components/events/evgpe.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/events/evgpe.c
+++ acpica-unix2-20200528/source/components/events/evgpe.c
--- acpica-unix2-20200925.orig/source/components/events/evgpe.c
+++ acpica-unix2-20200925/source/components/events/evgpe.c
@@ -488,7 +488,7 @@ AcpiEvGpeDetect (
"Ignore disabled registers for GPE %02X-%02X: "
"RunEnable=%02X, WakeEnable=%02X\n",
@ -143,10 +143,10 @@ Index: acpica-unix2-20200528/source/components/events/evgpe.c
GpeRegisterInfo->EnableForRun,
GpeRegisterInfo->EnableForWake));
continue;
Index: acpica-unix2-20200528/source/components/executer/exdump.c
Index: acpica-unix2-20200925/source/components/executer/exdump.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/executer/exdump.c
+++ acpica-unix2-20200528/source/components/executer/exdump.c
--- acpica-unix2-20200925.orig/source/components/executer/exdump.c
+++ acpica-unix2-20200925/source/components/executer/exdump.c
@@ -678,7 +678,7 @@ AcpiExDumpOperand (
if (Depth > 0)
{
@ -156,10 +156,10 @@ Index: acpica-unix2-20200528/source/components/executer/exdump.c
}
else
{
Index: acpica-unix2-20200528/source/components/executer/exfldio.c
Index: acpica-unix2-20200925/source/components/executer/exfldio.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/executer/exfldio.c
+++ acpica-unix2-20200528/source/components/executer/exfldio.c
--- acpica-unix2-20200925.orig/source/components/executer/exfldio.c
+++ acpica-unix2-20200925/source/components/executer/exfldio.c
@@ -681,8 +681,8 @@ AcpiExWriteWithUpdateRule (
ACPI_ERROR ((AE_INFO,
@ -171,10 +171,10 @@ Index: acpica-unix2-20200528/source/components/executer/exfldio.c
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
}
Index: acpica-unix2-20200528/source/components/executer/exnames.c
Index: acpica-unix2-20200925/source/components/executer/exnames.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/executer/exnames.c
+++ acpica-unix2-20200528/source/components/executer/exnames.c
--- acpica-unix2-20200925.orig/source/components/executer/exnames.c
+++ acpica-unix2-20200925/source/components/executer/exnames.c
@@ -237,7 +237,7 @@ AcpiExNameSegment (
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
@ -193,10 +193,10 @@ Index: acpica-unix2-20200528/source/components/executer/exnames.c
}
*InAmlAddress = ACPI_CAST_PTR (UINT8, AmlAddress);
Index: acpica-unix2-20200528/source/components/hardware/hwregs.c
Index: acpica-unix2-20200925/source/components/hardware/hwregs.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/hardware/hwregs.c
+++ acpica-unix2-20200528/source/components/hardware/hwregs.c
--- acpica-unix2-20200925.orig/source/components/hardware/hwregs.c
+++ acpica-unix2-20200925/source/components/hardware/hwregs.c
@@ -460,7 +460,7 @@ AcpiHwClearAcpiStatus (
@ -206,10 +206,10 @@ Index: acpica-unix2-20200528/source/components/hardware/hwregs.c
ACPI_FORMAT_UINT64 (AcpiGbl_XPm1aStatus.Address)));
LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
Index: acpica-unix2-20200528/source/components/tables/tbfadt.c
Index: acpica-unix2-20200925/source/components/tables/tbfadt.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/tables/tbfadt.c
+++ acpica-unix2-20200528/source/components/tables/tbfadt.c
--- acpica-unix2-20200925.orig/source/components/tables/tbfadt.c
+++ acpica-unix2-20200925/source/components/tables/tbfadt.c
@@ -233,7 +233,7 @@ AcpiTbInitGenericAddress (
if (!(Flags & ACPI_FADT_GPE_REGISTER))
{
@ -219,7 +219,7 @@ Index: acpica-unix2-20200528/source/components/tables/tbfadt.c
"to convert to GAS struct - 255 bits max, truncating",
RegisterName, ByteWidth, (ByteWidth * 8)));
}
@@ -304,7 +304,7 @@ AcpiTbSelectAddress (
@@ -303,7 +303,7 @@ AcpiTbSelectAddress (
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X %s address mismatch in FADT: "
@ -228,7 +228,7 @@ Index: acpica-unix2-20200528/source/components/tables/tbfadt.c
RegisterName, Address32, ACPI_FORMAT_UINT64 (Address64),
AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
@@ -628,7 +628,7 @@ AcpiTbConvertFadt (
@@ -631,7 +631,7 @@ AcpiTbConvertFadt (
ACPI_BIOS_WARNING ((AE_INFO,
"32/64X address mismatch in FADT/%s: "
@ -237,10 +237,10 @@ Index: acpica-unix2-20200528/source/components/tables/tbfadt.c
Name, Address32,
ACPI_FORMAT_UINT64 (Address64->Address),
AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
Index: acpica-unix2-20200528/source/components/tables/tbxfroot.c
Index: acpica-unix2-20200925/source/components/tables/tbxfroot.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/tables/tbxfroot.c
+++ acpica-unix2-20200528/source/components/tables/tbxfroot.c
--- acpica-unix2-20200925.orig/source/components/tables/tbxfroot.c
+++ acpica-unix2-20200925/source/components/tables/tbxfroot.c
@@ -177,7 +177,7 @@ AcpiFindRootPointer (
{
ACPI_ERROR ((AE_INFO,
@ -268,10 +268,10 @@ Index: acpica-unix2-20200528/source/components/tables/tbxfroot.c
return_ACPI_STATUS (AE_NO_MEMORY);
}
Index: acpica-unix2-20200528/source/components/utilities/utownerid.c
Index: acpica-unix2-20200925/source/components/utilities/utownerid.c
===================================================================
--- acpica-unix2-20200528.orig/source/components/utilities/utownerid.c
+++ acpica-unix2-20200528/source/components/utilities/utownerid.c
--- acpica-unix2-20200925.orig/source/components/utilities/utownerid.c
+++ acpica-unix2-20200925/source/components/utilities/utownerid.c
@@ -237,7 +237,7 @@ AcpiUtReleaseOwnerId (
else
{

View File

@ -1,8 +1,8 @@
Index: acpica-unix-20191018/source/compiler/aslparseop.c
Index: acpica-unix2-20200925/source/compiler/aslparseop.c
===================================================================
--- acpica-unix-20191018.orig/source/compiler/aslparseop.c
+++ acpica-unix-20191018/source/compiler/aslparseop.c
@@ -283,7 +283,16 @@ TrCreateValuedLeafOp (
--- acpica-unix2-20200925.orig/source/compiler/aslparseop.c
+++ acpica-unix2-20200925/source/compiler/aslparseop.c
@@ -285,7 +285,16 @@ TrCreateValuedLeafOp (
Op = TrAllocateOp (ParseOpcode);
@ -20,18 +20,3 @@ Index: acpica-unix-20191018/source/compiler/aslparseop.c
DbgPrint (ASL_PARSE_OUTPUT,
"\nCreateValuedLeafOp Ln/Col %u/%u NewOp %p "
Index: acpica-unix-20191018/source/include/platform/aclinux.h
===================================================================
--- acpica-unix-20191018.orig/source/include/platform/aclinux.h
+++ acpica-unix-20191018/source/include/platform/aclinux.h
@@ -232,10 +232,8 @@
#endif
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#if defined(__PPC64__) || defined(__s390x__)
#define ACPI_BIG_ENDIAN
#endif
-#endif
#endif /* __KERNEL__ */

View File

@ -1,16 +0,0 @@
Index: acpica-unix-20191018/source/include/platform/aclinux.h
===================================================================
--- acpica-unix-20191018.orig/source/include/platform/aclinux.h
+++ acpica-unix-20191018/source/include/platform/aclinux.h
@@ -233,9 +233,11 @@
#define __cdecl
#endif
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#if defined(__PPC64__) || defined(__s390x__)
#define ACPI_BIG_ENDIAN
#endif
+#endif
#endif /* __KERNEL__ */

View File

@ -1,12 +1,12 @@
Index: acpica-unix-20191018/source/components/tables/tbutils.c
Index: acpica-unix2-20200925/source/components/tables/tbutils.c
===================================================================
--- acpica-unix-20191018.orig/source/components/tables/tbutils.c
+++ acpica-unix-20191018/source/components/tables/tbutils.c
--- acpica-unix2-20200925.orig/source/components/tables/tbutils.c
+++ acpica-unix2-20200925/source/components/tables/tbutils.c
@@ -238,9 +238,11 @@ AcpiTbGetRootTableEntry (
* 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
* return 64-bit
*/
- Address64 = (UINT64) TableEntry;
- ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
#if ACPI_MACHINE_WIDTH == 32
+ UINT32 Tmp32 = (UINT32) TableEntry;
@ -15,7 +15,7 @@ Index: acpica-unix-20191018/source/components/tables/tbutils.c
if (Address64 > ACPI_UINT32_MAX)
{
/* Will truncate 64-bit address to 32 bits, issue warning */
@@ -250,9 +252,15 @@ AcpiTbGetRootTableEntry (
@@ -250,8 +252,14 @@ AcpiTbGetRootTableEntry (
" truncating",
ACPI_FORMAT_UINT64 (Address64)));
}
@ -26,17 +26,16 @@ Index: acpica-unix-20191018/source/components/tables/tbutils.c
+#else
+ Address64 = (UINT64) TableEntry;
+
return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
UINT64, Address64)));
return ((ACPI_PHYSICAL_ADDRESS) (Address64));
+#endif
}
}
Index: acpica-unix-20191018/source/compiler/aslparseop.c
Index: acpica-unix2-20200925/source/compiler/aslparseop.c
===================================================================
--- acpica-unix-20191018.orig/source/compiler/aslparseop.c
+++ acpica-unix-20191018/source/compiler/aslparseop.c
@@ -287,7 +287,11 @@ TrCreateValuedLeafOp (
--- acpica-unix2-20200925.orig/source/compiler/aslparseop.c
+++ acpica-unix2-20200925/source/compiler/aslparseop.c
@@ -289,7 +289,11 @@ TrCreateValuedLeafOp (
ParseOpcode == PARSEOP_NAMESEG ||
ParseOpcode == PARSEOP_STRING_LITERAL)
{

View File

@ -3,17 +3,18 @@ Description: Stop listing all 64bit architectures
64bit architectures.
Author: Adrian Bunk <bunk@debian.org>
Index: acpica-unix-20191018/source/include/platform/aclinux.h
Index: acpica-unix2-20200925/source/include/platform/aclinux.h
===================================================================
--- acpica-unix-20191018.orig/source/include/platform/aclinux.h
+++ acpica-unix-20191018/source/include/platform/aclinux.h
@@ -215,9 +215,7 @@
--- acpica-unix2-20200925.orig/source/include/platform/aclinux.h
+++ acpica-unix2-20200925/source/include/platform/aclinux.h
@@ -215,10 +215,7 @@
#define ACPI_FLUSH_CPU_CACHE()
#define ACPI_CAST_PTHREAD_T(Pthread) ((ACPI_THREAD_ID) (Pthread))
-#if defined(__ia64__) || (defined(__x86_64__) && !defined(__ILP32__)) ||\
- defined(__aarch64__) || defined(__PPC64__) ||\
- defined(__s390x__)
- defined(__s390x__) ||\
- (defined(__riscv) && (defined(__LP64__) || defined(_LP64)))
+#if defined(__LP64__)
#define ACPI_MACHINE_WIDTH 64
#define COMPILER_DEPENDENT_INT64 long

View File

@ -1,7 +1,7 @@
Index: acpica-unix-20200214/source/compiler/aslanalyze.c
Index: acpica-unix2-20200925/source/compiler/aslanalyze.c
===================================================================
--- acpica-unix-20200214.orig/source/compiler/aslanalyze.c
+++ acpica-unix-20200214/source/compiler/aslanalyze.c
--- acpica-unix2-20200925.orig/source/compiler/aslanalyze.c
+++ acpica-unix2-20200925/source/compiler/aslanalyze.c
@@ -358,11 +358,16 @@ AnCheckMethodReturnValue (
*/
if (ThisNodeBtype != 0)
@ -21,10 +21,10 @@ Index: acpica-unix-20200214/source/compiler/aslanalyze.c
}
}
Index: acpica-unix-20200214/source/compiler/aslpredef.c
Index: acpica-unix2-20200925/source/compiler/aslpredef.c
===================================================================
--- acpica-unix-20200214.orig/source/compiler/aslpredef.c
+++ acpica-unix-20200214/source/compiler/aslpredef.c
--- acpica-unix2-20200925.orig/source/compiler/aslpredef.c
+++ acpica-unix2-20200925/source/compiler/aslpredef.c
@@ -159,14 +159,19 @@ ApCheckForPredefinedMethod (
if (MethodInfo->NumReturnNoValue &&
ThisName->Info.ExpectedBtypes)
@ -84,10 +84,10 @@ Index: acpica-unix-20200214/source/compiler/aslpredef.c
return (AE_TYPE);
}
Index: acpica-unix-20200214/source/compiler/aslwalks.c
Index: acpica-unix2-20200925/source/compiler/aslwalks.c
===================================================================
--- acpica-unix-20200214.orig/source/compiler/aslwalks.c
+++ acpica-unix-20200214/source/compiler/aslwalks.c
--- acpica-unix2-20200925.orig/source/compiler/aslwalks.c
+++ acpica-unix2-20200925/source/compiler/aslwalks.c
@@ -515,15 +515,19 @@ AnOperandTypecheckWalkEnd (
else if (!CommonBtypes)
{

View File

@ -7,10 +7,10 @@ From: Al Stone <ahs3@redhat.com>
tests/templates/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: acpica-unix-20191018/tests/templates/Makefile
Index: acpica-unix2-20200925/tests/templates/Makefile
===================================================================
--- acpica-unix-20191018.orig/tests/templates/Makefile
+++ acpica-unix-20191018/tests/templates/Makefile
--- acpica-unix2-20200925.orig/tests/templates/Makefile
+++ acpica-unix2-20200925/tests/templates/Makefile
@@ -26,7 +26,7 @@ $(aml_obj): %.aml: %.asl

12
ull-32bit.patch Normal file
View File

@ -0,0 +1,12 @@
diff -Naur acpica-unix2-20200925.orig/source/common/dmtbdump.c acpica-unix2-20200925/source/common/dmtbdump.c
--- acpica-unix2-20200925.orig/source/common/dmtbdump.c 2020-10-16 18:33:41.108600489 -0600
+++ acpica-unix2-20200925/source/common/dmtbdump.c 2020-10-16 18:35:01.970316862 -0600
@@ -333,7 +333,7 @@
for (i = 0; i < Entries; i++)
{
AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
- AcpiOsPrintf ("%16.16lX\n", AcpiUtReadUint64(&Array[i]));
+ AcpiOsPrintf ("%16.16llX\n", AcpiUtReadUint64(&Array[i]));
Offset += sizeof (UINT64);
}
}

View File

@ -14,10 +14,10 @@ Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
source/include/actypes.h | 26 +++++++++++++-------------
3 files changed, 32 insertions(+), 21 deletions(-)
Index: acpica-unix-20191018/source/components/executer/exoparg2.c
Index: acpica-unix2-20200925/source/components/executer/exoparg2.c
===================================================================
--- acpica-unix-20191018.orig/source/components/executer/exoparg2.c
+++ acpica-unix-20191018/source/components/executer/exoparg2.c
--- acpica-unix2-20200925.orig/source/components/executer/exoparg2.c
+++ acpica-unix2-20200925/source/components/executer/exoparg2.c
@@ -172,6 +172,8 @@ AcpiExOpcode_2A_2T_1R (
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc1 = NULL;
@ -58,10 +58,10 @@ Index: acpica-unix-20191018/source/components/executer/exoparg2.c
break;
case AML_CONCATENATE_OP: /* Concatenate (Data1, Data2, Result) */
Index: acpica-unix-20191018/source/include/actypes.h
Index: acpica-unix2-20200925/source/include/actypes.h
===================================================================
--- acpica-unix-20191018.orig/source/include/actypes.h
+++ acpica-unix-20191018/source/include/actypes.h
--- acpica-unix2-20200925.orig/source/include/actypes.h
+++ acpica-unix2-20200925/source/include/actypes.h
@@ -143,6 +143,19 @@ typedef COMPILER_DEPENDENT_INT64
*/
#define ACPI_THREAD_ID UINT64