diff --git a/0001-Add-in-basic-infrastructure-for-big-endian-support.patch b/0001-Add-in-basic-infrastructure-for-big-endian-support.patch index abd9298..3a667ea 100644 --- a/0001-Add-in-basic-infrastructure-for-big-endian-support.patch +++ b/0001-Add-in-basic-infrastructure-for-big-endian-support.patch @@ -1,7 +1,7 @@ -From bb45113bc9aed952a499cd1c53988dc81f597582 Mon Sep 17 00:00:00 2001 +From 4594630ec2e6a33efce3047a86b08fa170b75848 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Thu, 15 Oct 2020 11:53:33 -0600 -Subject: [PATCH 01/40] Add in basic infrastructure for big-endian support +Subject: [PATCH 01/45] 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 @@ -10,7 +10,9 @@ 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. +the new code. Further, UtIsBigEndianMachine() needed to be moved out of +compiler/aslutils.c so it could be used in the new functions and avoid +having to do some conditional compilation depending on endian-ness. 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 @@ -24,16 +26,19 @@ Signed-off-by: Al Stone 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(+) + source/compiler/aslcompiler.h | 4 - + source/compiler/aslutils.c | 27 --- + source/components/utilities/utendian.c | 236 +++++++++++++++++++++++++ + source/include/acmacros.h | 56 ------ + source/include/acutils.h | 32 ++++ + source/include/platform/aclinux.h | 1 + + 12 files changed, 275 insertions(+), 87 deletions(-) create mode 100644 source/components/utilities/utendian.c -Index: acpica-unix2-20200925/generate/unix/acpibin/Makefile +Index: acpica-unix2-20210604/generate/unix/acpibin/Makefile =================================================================== ---- acpica-unix2-20200925.orig/generate/unix/acpibin/Makefile -+++ acpica-unix2-20200925/generate/unix/acpibin/Makefile +--- acpica-unix2-20210604.orig/generate/unix/acpibin/Makefile ++++ acpica-unix2-20210604/generate/unix/acpibin/Makefile @@ -37,6 +37,7 @@ OBJECTS = \ $(OBJDIR)/utcache.o\ $(OBJDIR)/utdebug.o\ @@ -42,10 +47,10 @@ Index: acpica-unix2-20200925/generate/unix/acpibin/Makefile $(OBJDIR)/utexcep.o\ $(OBJDIR)/utglobal.o\ $(OBJDIR)/utlock.o\ -Index: acpica-unix2-20200925/generate/unix/acpidump/Makefile +Index: acpica-unix2-20210604/generate/unix/acpidump/Makefile =================================================================== ---- acpica-unix2-20200925.orig/generate/unix/acpidump/Makefile -+++ acpica-unix2-20200925/generate/unix/acpidump/Makefile +--- acpica-unix2-20210604.orig/generate/unix/acpidump/Makefile ++++ acpica-unix2-20210604/generate/unix/acpidump/Makefile @@ -36,6 +36,7 @@ OBJECTS = \ $(OBJDIR)/osunixdir.o\ $(OBJDIR)/osunixmap.o\ @@ -54,10 +59,10 @@ Index: acpica-unix2-20200925/generate/unix/acpidump/Makefile $(OBJDIR)/tbprint.o\ $(OBJDIR)/tbxfroot.o\ $(OBJDIR)/utascii.o\ -Index: acpica-unix2-20200925/generate/unix/acpiexamples/Makefile +Index: acpica-unix2-20210604/generate/unix/acpiexamples/Makefile =================================================================== ---- acpica-unix2-20200925.orig/generate/unix/acpiexamples/Makefile -+++ acpica-unix2-20200925/generate/unix/acpiexamples/Makefile +--- acpica-unix2-20210604.orig/generate/unix/acpiexamples/Makefile ++++ acpica-unix2-20210604/generate/unix/acpiexamples/Makefile @@ -139,6 +139,7 @@ OBJECTS = \ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utdecode.o\ @@ -66,10 +71,10 @@ Index: acpica-unix2-20200925/generate/unix/acpiexamples/Makefile $(OBJDIR)/uterror.o\ $(OBJDIR)/uteval.o\ $(OBJDIR)/utexcep.o\ -Index: acpica-unix2-20200925/generate/unix/acpiexec/Makefile +Index: acpica-unix2-20210604/generate/unix/acpiexec/Makefile =================================================================== ---- acpica-unix2-20200925.orig/generate/unix/acpiexec/Makefile -+++ acpica-unix2-20200925/generate/unix/acpiexec/Makefile +--- acpica-unix2-20210604.orig/generate/unix/acpiexec/Makefile ++++ acpica-unix2-20210604/generate/unix/acpiexec/Makefile @@ -214,6 +214,7 @@ OBJECTS = \ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utdecode.o\ @@ -78,11 +83,11 @@ Index: acpica-unix2-20200925/generate/unix/acpiexec/Makefile $(OBJDIR)/uterror.o\ $(OBJDIR)/uteval.o\ $(OBJDIR)/utexcep.o\ -Index: acpica-unix2-20200925/generate/unix/acpihelp/Makefile +Index: acpica-unix2-20210604/generate/unix/acpihelp/Makefile =================================================================== ---- acpica-unix2-20200925.orig/generate/unix/acpihelp/Makefile -+++ acpica-unix2-20200925/generate/unix/acpihelp/Makefile -@@ -43,6 +43,7 @@ OBJECTS = \ +--- acpica-unix2-20210604.orig/generate/unix/acpihelp/Makefile ++++ acpica-unix2-20210604/generate/unix/acpihelp/Makefile +@@ -45,6 +45,7 @@ OBJECTS = \ $(OBJDIR)/getopt.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/utdebug.o\ @@ -90,10 +95,10 @@ Index: acpica-unix2-20200925/generate/unix/acpihelp/Makefile $(OBJDIR)/utexcep.o\ $(OBJDIR)/utglobal.o\ $(OBJDIR)/uthex.o\ -Index: acpica-unix2-20200925/generate/unix/iasl/Makefile +Index: acpica-unix2-20210604/generate/unix/iasl/Makefile =================================================================== ---- acpica-unix2-20200925.orig/generate/unix/iasl/Makefile -+++ acpica-unix2-20200925/generate/unix/iasl/Makefile +--- acpica-unix2-20210604.orig/generate/unix/iasl/Makefile ++++ acpica-unix2-20210604/generate/unix/iasl/Makefile @@ -225,6 +225,7 @@ OBJECTS = \ $(OBJDIR)/utdebug.o\ $(OBJDIR)/utdecode.o\ @@ -102,11 +107,64 @@ Index: acpica-unix2-20200925/generate/unix/iasl/Makefile $(OBJDIR)/uterror.o\ $(OBJDIR)/utexcep.o\ $(OBJDIR)/utglobal.o\ -Index: acpica-unix2-20200925/source/components/utilities/utendian.c +Index: acpica-unix2-20210604/source/compiler/aslcompiler.h +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/aslcompiler.h ++++ acpica-unix2-20210604/source/compiler/aslcompiler.h +@@ -1120,10 +1120,6 @@ BOOLEAN + UtIsIdInteger ( + UINT8 *Target); + +-UINT8 +-UtIsBigEndianMachine ( +- void); +- + BOOLEAN + UtQueryForOverwrite ( + char *Pathname); +Index: acpica-unix2-20210604/source/compiler/aslutils.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/aslutils.c ++++ acpica-unix2-20210604/source/compiler/aslutils.c +@@ -73,33 +73,6 @@ UtDisplayErrorSummary ( + + /******************************************************************************* + * +- * FUNCTION: UtIsBigEndianMachine +- * +- * PARAMETERS: None +- * +- * RETURN: TRUE if machine is big endian +- * FALSE if machine is little endian +- * +- * DESCRIPTION: Detect whether machine is little endian or big endian. +- * +- ******************************************************************************/ +- +-UINT8 +-UtIsBigEndianMachine ( +- void) +-{ +- union { +- UINT32 Integer; +- UINT8 Bytes[4]; +- } Overlay = {0xFF000000}; +- +- +- return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */ +-} +- +- +-/******************************************************************************* +- * + * FUNCTION: UtIsIdInteger + * + * PARAMETERS: Pointer to an ACPI ID (HID, CID) string +Index: acpica-unix2-20210604/source/components/utilities/utendian.c =================================================================== --- /dev/null -+++ acpica-unix2-20200925/source/components/utilities/utendian.c -@@ -0,0 +1,205 @@ ++++ acpica-unix2-20210604/source/components/utilities/utendian.c +@@ -0,0 +1,236 @@ +/****************************************************************************** + * + * Module Name: utendian -- byte swapping support for other-endianness @@ -156,7 +214,6 @@ Index: acpica-unix2-20200925/source/components/utilities/utendian.c +#define _COMPONENT ACPI_COMPILER + ACPI_MODULE_NAME ("utendian") + -+ +/* + * Endianness support functions. + * @@ -167,12 +224,38 @@ Index: acpica-unix2-20200925/source/components/utilities/utendian.c + * + */ + ++/******************************************************************************* ++ * ++ * FUNCTION: UtIsBigEndianMachine ++ * ++ * PARAMETERS: None ++ * ++ * RETURN: TRUE if machine is big endian ++ * FALSE if machine is little endian ++ * ++ * DESCRIPTION: Detect whether machine is little endian or big endian. ++ * ++ ******************************************************************************/ ++ ++UINT8 ++UtIsBigEndianMachine ( ++ void) ++{ ++ union { ++ UINT32 Integer; ++ UINT8 Bytes[4]; ++ } Overlay = {0xFF000000}; ++ ++ ++ return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */ ++} ++ + +/******************************************************************************* + * + * FUNCTION: AcpiUtReadUint16 + * -+ * PARAMETERS: Src - location containing the little-endian ++ * PARAMETERS: Src - location containing the little-endian + * value + * + * RETURN: UINT16 value in host-native form @@ -182,27 +265,30 @@ Index: acpica-unix2-20200925/source/components/utilities/utendian.c + * + ******************************************************************************/ + -+#if defined(ACPI_BIG_ENDIAN) -+UINT16 AcpiUtReadUint16 (void *SrcPtr) ++UINT16 ++AcpiUtReadUint16 ( ++ void *SrcPtr) +{ -+ UINT16 Result = 0; -+ UINT8 *Dst = (UINT8 *)&Result; -+ UINT8 *Src = (UINT8 *)SrcPtr; ++ UINT16 Result = 0; ++ UINT8 *Dst = (UINT8 *) &Result; ++ UINT8 *Src = (UINT8 *) SrcPtr; ++ ++ if (!UtIsBigEndianMachine()) ++ { ++ return (*(UINT16 *) SrcPtr); ++ } + + Dst[0] = Src[1]; + Dst[1] = Src[0]; + -+ return Result; ++ return (Result); +} -+#else -+UINT16 AcpiUtReadUint16 (void *SrcPtr) { return *(UINT16 *)SrcPtr; } -+#endif + +/******************************************************************************* + * + * FUNCTION: AcpiUtReadUint32 + * -+ * PARAMETERS: Src - location containing the little-endian ++ * PARAMETERS: Src - location containing the little-endian + * value + * + * RETURN: UINT32 value in host-native form @@ -212,29 +298,32 @@ Index: acpica-unix2-20200925/source/components/utilities/utendian.c + * + ******************************************************************************/ + -+#if defined(ACPI_BIG_ENDIAN) -+UINT32 AcpiUtReadUint32 (void *SrcPtr) ++UINT32 ++AcpiUtReadUint32 ( ++ void *SrcPtr) +{ -+ UINT32 Result = 0; -+ UINT8 *Dst = (UINT8 *)&Result; -+ UINT8 *Src = (UINT8 *)SrcPtr; ++ UINT32 Result = 0; ++ UINT8 *Dst = (UINT8 *) &Result; ++ UINT8 *Src = (UINT8 *) SrcPtr; ++ ++ if (!UtIsBigEndianMachine()) ++ { ++ return (*(UINT32 *) SrcPtr); ++ } + + Dst[0] = Src[3]; + Dst[1] = Src[2]; + Dst[2] = Src[1]; + Dst[3] = Src[0]; + -+ return Result; ++ return (Result); +} -+#else -+UINT32 AcpiUtReadUint32 (void *SrcPtr) { return *(UINT32 *)SrcPtr; } -+#endif + +/******************************************************************************* + * + * FUNCTION: AcpiUtReadUint64 + * -+ * PARAMETERS: Src - location containing the little-endian ++ * PARAMETERS: Src - location containing the little-endian + * value + * + * RETURN: UINT64 value in host-native form @@ -244,12 +333,18 @@ Index: acpica-unix2-20200925/source/components/utilities/utendian.c + * + ******************************************************************************/ + -+#if defined(ACPI_BIG_ENDIAN) -+UINT64 AcpiUtReadUint64 (void *SrcPtr) ++UINT64 ++AcpiUtReadUint64 ( ++ void *SrcPtr) +{ -+ UINT64 Result = 0; -+ UINT8 *Dst = (UINT8 *)&Result; -+ UINT8 *Src = (UINT8 *)SrcPtr; ++ UINT64 Result = 0; ++ UINT8 *Dst = (UINT8 *) &Result; ++ UINT8 *Src = (UINT8 *) SrcPtr; ++ ++ if (!UtIsBigEndianMachine()) ++ { ++ return (*(UINT64 *) SrcPtr); ++ } + + Dst[0] = Src[7]; + Dst[1] = Src[6]; @@ -260,69 +355,143 @@ Index: acpica-unix2-20200925/source/components/utilities/utendian.c + Dst[6] = Src[1]; + Dst[7] = Src[0]; + -+ return Result; ++ 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 ++ * 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) ++ * 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) ++void ++AcpiUtWriteUint ( ++ void *DstPtr, ++ int DstLength, ++ const void *SrcPtr, ++ const int SrcLength) +{ -+ UINT8 *Dst = (UINT8 *)DstPtr; -+ UINT8 *Src = (UINT8 *)SrcPtr; -+ int Length; -+ int ii; ++ UINT8 *Dst = (UINT8 *) DstPtr; ++ UINT8 *Src = (UINT8 *) SrcPtr; ++ int Length; ++ int ii; ++ ++ if (!UtIsBigEndianMachine()) ++ { ++ Length = SrcLength > DstLength ? DstLength : SrcLength; ++ memcpy (Dst, Src, Length); ++ return; ++ } + + Length = SrcLength >= DstLength ? DstLength : SrcLength; + for (ii = 0; ii < Length; ii++) -+ Dst[ii] = Src[SrcLength - ii - 1]; ++ 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 +Index: acpica-unix2-20210604/source/include/acmacros.h =================================================================== ---- acpica-unix2-20200925.orig/source/include/acutils.h -+++ acpica-unix2-20200925/source/include/acutils.h -@@ -1161,4 +1161,30 @@ AcpiUtConvertStringToUuid ( - UINT8 *UuidBuffer); +--- acpica-unix2-20210604.orig/source/include/acmacros.h ++++ acpica-unix2-20210604/source/include/acmacros.h +@@ -76,61 +76,6 @@ + * If the hardware supports the transfer of unaligned data, just do the store. + * Otherwise, we have to move one byte at a time. + */ +-#ifdef ACPI_BIG_ENDIAN +-/* +- * Macros for big-endian machines +- */ +- +-/* These macros reverse the bytes during the move, converting little-endian to big endian */ +- +- /* Big Endian <== Little Endian */ +- /* Hi...Lo Lo...Hi */ +-/* 16-bit source, 16/32/64 destination */ +- +-#define ACPI_MOVE_16_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\ +- (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];} +- +-#define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d))=0;\ +- ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ +- ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} +- +-#define ACPI_MOVE_16_TO_64(d, s) {(*(UINT64 *)(void *)(d))=0;\ +- ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ +- ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} +- +-/* 32-bit source, 16/32/64 destination */ +- +-#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ +- +-#define ACPI_MOVE_32_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ +- (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\ +- (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\ +- (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];} +- +-#define ACPI_MOVE_32_TO_64(d, s) {(*(UINT64 *)(void *)(d))=0;\ +- ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ +- ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ +- ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ +- ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} +- +-/* 64-bit source, 16/32/64 destination */ +- +-#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ +- +-#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ +- +-#define ACPI_MOVE_64_TO_64(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ +- (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\ +- (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\ +- (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\ +- (( UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\ +- (( UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\ +- (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\ +- (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];} +-#else +-/* +- * Macros for little-endian machines +- */ + + #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED + +@@ -193,7 +138,6 @@ + (( UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\ + (( UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];} + #endif +-#endif + + + /* +Index: acpica-unix2-20210604/source/include/acutils.h +=================================================================== +--- acpica-unix2-20210604.orig/source/include/acutils.h ++++ acpica-unix2-20210604/source/include/acutils.h +@@ -1167,4 +1167,36 @@ AcpiUtConvertUuidToString ( + char *OutString); #endif ++ +/* + * utendian -- byte-swapping for big-endian support + */ ++ ++UINT8 ++UtIsBigEndianMachine ( ++ void); ++ +#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) @@ -347,10 +516,10 @@ Index: acpica-unix2-20200925/source/include/acutils.h +#endif + #endif /* _ACUTILS_H */ -Index: acpica-unix2-20200925/source/include/platform/aclinux.h +Index: acpica-unix2-20210604/source/include/platform/aclinux.h =================================================================== ---- acpica-unix2-20200925.orig/source/include/platform/aclinux.h -+++ acpica-unix2-20200925/source/include/platform/aclinux.h +--- acpica-unix2-20210604.orig/source/include/platform/aclinux.h ++++ acpica-unix2-20210604/source/include/platform/aclinux.h @@ -198,6 +198,7 @@ #ifdef ACPI_USE_STANDARD_HEADERS @@ -359,14 +528,3 @@ Index: acpica-unix2-20200925/source/include/platform/aclinux.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__ */ diff --git a/0002-Modify-utility-functions-to-be-endian-agnostic.patch b/0002-Modify-utility-functions-to-be-endian-agnostic.patch index 4b99375..2f3f51e 100644 --- a/0002-Modify-utility-functions-to-be-endian-agnostic.patch +++ b/0002-Modify-utility-functions-to-be-endian-agnostic.patch @@ -1,7 +1,7 @@ -From d0c879747147c24c47bae363359127d62cd0cae1 Mon Sep 17 00:00:00 2001 +From 51b0d06c0a6c4d4e19432ebf930299855c8fcf23 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 18 Sep 2020 15:14:30 -0600 -Subject: [PATCH 02/40] Modify utility functions to be endian-agnostic +Subject: [PATCH 02/45] 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 @@ -24,15 +24,15 @@ Signed-off-by: Al Stone source/components/tables/tbprint.c | 13 +++++++++---- 5 files changed, 26 insertions(+), 17 deletions(-) -Index: acpica-unix2-20200925/source/common/acfileio.c +Index: acpica-unix2-20210604/source/common/acfileio.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/acfileio.c -+++ acpica-unix2-20200925/source/common/acfileio.c +--- acpica-unix2-20210604.orig/source/common/acfileio.c ++++ acpica-unix2-20210604/source/common/acfileio.c @@ -280,6 +280,7 @@ AcGetOneTableFromFile ( ACPI_TABLE_HEADER *Table; INT32 Count; long TableOffset; -+ UINT32 Length; ++ UINT32 Length; *ReturnTable = NULL; @@ -41,7 +41,7 @@ Index: acpica-unix2-20200925/source/common/acfileio.c /* Allocate a buffer for the entire table */ - Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length); -+ Length = AcpiUtReadUint32(&TableHeader.Length); ++ Length = AcpiUtReadUint32 (&TableHeader.Length); + Table = AcpiOsAllocate ((ACPI_SIZE) Length); if (!Table) { @@ -75,16 +75,16 @@ Index: acpica-unix2-20200925/source/common/acfileio.c long OriginalOffset; UINT32 FileSize; UINT32 i; -+ UINT32 Length; ++ UINT32 Length; ACPI_FUNCTION_TRACE (AcValidateTableHeader); -@@ -464,11 +467,12 @@ AcValidateTableHeader ( +@@ -467,11 +470,12 @@ AcValidateTableHeader ( /* Validate table length against bytes remaining in the file */ FileSize = CmGetFileSize (File); - if (TableHeader.Length > (UINT32) (FileSize - TableOffset)) -+ Length = AcpiUtReadUint32(&TableHeader.Length); ++ Length = AcpiUtReadUint32 (&TableHeader.Length); + if (Length > (UINT32) (FileSize - TableOffset)) { fprintf (stderr, "Table [%4.4s] is too long for file - " @@ -94,29 +94,29 @@ Index: acpica-unix2-20200925/source/common/acfileio.c (UINT32) (FileSize - TableOffset)); return (AE_BAD_HEADER); } -Index: acpica-unix2-20200925/source/common/dmtable.c +Index: acpica-unix2-20210604/source/common/dmtable.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtable.c -+++ acpica-unix2-20200925/source/common/dmtable.c -@@ -534,7 +534,7 @@ AcpiDmDumpDataTable ( +--- acpica-unix2-20210604.orig/source/common/dmtable.c ++++ acpica-unix2-20210604/source/common/dmtable.c +@@ -591,7 +591,7 @@ AcpiDmDumpDataTable ( { /* Dump the raw table data */ - Length = Table->Length; -+ Length = AcpiUtReadUint32(&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 ( +@@ -608,7 +608,7 @@ AcpiDmDumpDataTable ( */ if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS)) { - Length = Table->Length; -+ Length = AcpiUtReadUint32(&Table->Length); ++ Length = AcpiUtReadUint32 (&Table->Length); Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs); if (ACPI_FAILURE (Status)) { -@@ -571,7 +571,7 @@ AcpiDmDumpDataTable ( +@@ -628,7 +628,7 @@ AcpiDmDumpDataTable ( /* * All other tables must use the common ACPI table header, dump it now */ @@ -125,45 +125,45 @@ Index: acpica-unix2-20200925/source/common/dmtable.c Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); if (ACPI_FAILURE (Status)) { -@@ -1179,7 +1179,7 @@ AcpiDmDumpTable ( +@@ -1262,7 +1262,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)), ++ 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 +Index: acpica-unix2-20210604/source/compiler/dtfield.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dtfield.c -+++ acpica-unix2-20200925/source/compiler/dtfield.c +--- acpica-unix2-20210604.orig/source/compiler/dtfield.c ++++ acpica-unix2-20210604/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)); ++ AcpiUtWriteUint (Buffer, ByteLength, &Value, sizeof (UINT64)); return; } -Index: acpica-unix2-20200925/source/compiler/dtsubtable.c +Index: acpica-unix2-20210604/source/compiler/dtsubtable.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dtsubtable.c -+++ acpica-unix2-20200925/source/compiler/dtsubtable.c +--- acpica-unix2-20210604.orig/source/compiler/dtsubtable.c ++++ acpica-unix2-20210604/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)); ++ AcpiUtWriteUint (Subtable->LengthField, Subtable->SizeOfLengthField, ++ &Subtable->TotalLength, sizeof (Subtable->TotalLength)); } -Index: acpica-unix2-20200925/source/components/tables/tbprint.c +Index: acpica-unix2-20210604/source/components/tables/tbprint.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/tables/tbprint.c -+++ acpica-unix2-20200925/source/components/tables/tbprint.c +--- acpica-unix2-20210604.orig/source/components/tables/tbprint.c ++++ acpica-unix2-20210604/source/components/tables/tbprint.c @@ -44,6 +44,8 @@ #include "acpi.h" #include "accommon.h" @@ -178,7 +178,7 @@ Index: acpica-unix2-20200925/source/components/tables/tbprint.c ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X", Header->Signature, ACPI_FORMAT_UINT64 (Address), - Header->Length)); -+ AcpiUtReadUint32(&Header->Length))); ++ AcpiUtReadUint32 (&Header->Length))); } else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature)) { @@ -189,12 +189,12 @@ Index: acpica-unix2-20200925/source/components/tables/tbprint.c - LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId, - LocalHeader.OemTableId, LocalHeader.OemRevision, - LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision)); -+ AcpiUtReadUint32(&LocalHeader.Length), ++ AcpiUtReadUint32 (&LocalHeader.Length), + LocalHeader.Revision, LocalHeader.OemId, + LocalHeader.OemTableId, -+ AcpiUtReadUint32(&LocalHeader.OemRevision), ++ AcpiUtReadUint32 (&LocalHeader.OemRevision), + LocalHeader.AslCompilerId, -+ AcpiUtReadUint32(&LocalHeader.AslCompilerRevision))); ++ AcpiUtReadUint32 (&LocalHeader.AslCompilerRevision))); } } diff --git a/0003-Always-display-table-header-content-in-human-readabl.patch b/0003-Always-display-table-header-content-in-human-readabl.patch index 4ba465b..6dddba1 100644 --- a/0003-Always-display-table-header-content-in-human-readabl.patch +++ b/0003-Always-display-table-header-content-in-human-readabl.patch @@ -1,7 +1,7 @@ -From 08862d9a4be8262c045549c287adf1e6c320cbec Mon Sep 17 00:00:00 2001 +From 62cc2f4ae212bd0fad83f643921ac216ebb9a986 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 18 Sep 2020 15:20:37 -0600 -Subject: [PATCH 03/40] Always display table header content in human-readable +Subject: [PATCH 03/45] Always display table header content in human-readable form When comparing two binary data tables, little-endian values are read @@ -10,13 +10,13 @@ form that makes sense to humans. Signed-off-by: Al Stone --- - source/tools/acpibin/abcompare.c | 13 ++++++++++--- - 1 file changed, 10 insertions(+), 3 deletions(-) + source/tools/acpibin/abcompare.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) -Index: acpica-unix2-20200925/source/tools/acpibin/abcompare.c +Index: acpica-unix2-20210604/source/tools/acpibin/abcompare.c =================================================================== ---- acpica-unix2-20200925.orig/source/tools/acpibin/abcompare.c -+++ acpica-unix2-20200925/source/tools/acpibin/abcompare.c +--- acpica-unix2-20210604.orig/source/tools/acpibin/abcompare.c ++++ acpica-unix2-20210604/source/tools/acpibin/abcompare.c @@ -42,6 +42,7 @@ */ @@ -25,27 +25,21 @@ Index: acpica-unix2-20200925/source/tools/acpibin/abcompare.c ACPI_TABLE_HEADER Header1; -@@ -179,14 +180,20 @@ AbPrintHeadersInfo ( +@@ -179,14 +180,14 @@ 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 ("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 ("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 ("Compiler Revision %8.8X : %8.8X\n", AcpiUtReadUint32 (&Header->AslCompilerRevision), AcpiUtReadUint32 (&Header2->AslCompilerRevision)); printf ("\n"); } diff --git a/0004-Re-enable-support-for-big-endian-machines.patch b/0004-Re-enable-support-for-big-endian-machines.patch index c88eee8..1422b26 100644 --- a/0004-Re-enable-support-for-big-endian-machines.patch +++ b/0004-Re-enable-support-for-big-endian-machines.patch @@ -1,7 +1,7 @@ -From 16c399a7e2a2c7bd8fb8f38fed202f23c3a786a9 Mon Sep 17 00:00:00 2001 +From 16734feab4204d6930c1ede62e527920607daace Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 16 Sep 2020 16:27:06 -0600 -Subject: [PATCH 04/40] Re-enable support for big-endian machines +Subject: [PATCH 04/45] 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 @@ -13,10 +13,10 @@ Signed-off-by: Al Stone source/components/namespace/nsutils.c | 7 +++++-- 2 files changed, 5 insertions(+), 14 deletions(-) -Index: acpica-unix2-20200925/source/compiler/aslmain.c +Index: acpica-unix2-20210604/source/compiler/aslmain.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslmain.c -+++ acpica-unix2-20200925/source/compiler/aslmain.c +--- acpica-unix2-20210604.orig/source/compiler/aslmain.c ++++ acpica-unix2-20210604/source/compiler/aslmain.c @@ -101,18 +101,6 @@ main ( signal (SIGINT, AslSignalHandler); @@ -36,15 +36,15 @@ Index: acpica-unix2-20200925/source/compiler/aslmain.c AcpiOsInitialize (); ACPI_DEBUG_INITIALIZE (); /* For debug version only */ -Index: acpica-unix2-20200925/source/components/namespace/nsutils.c +Index: acpica-unix2-20210604/source/components/namespace/nsutils.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/namespace/nsutils.c -+++ acpica-unix2-20200925/source/components/namespace/nsutils.c +--- acpica-unix2-20210604.orig/source/components/namespace/nsutils.c ++++ acpica-unix2-20210604/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]; ++ char TmpSeg[ACPI_NAMESEG_SIZE+1]; ACPI_FUNCTION_TRACE (NsBuildInternalName); @@ -52,7 +52,7 @@ Index: acpica-unix2-20200925/source/components/namespace/nsutils.c for (; NumSegments; NumSegments--) { -+ memset(TmpSeg, 0, ACPI_NAMESEG_SIZE+1); ++ memset (TmpSeg, 0, ACPI_NAMESEG_SIZE+1); for (i = 0; i < ACPI_NAMESEG_SIZE; i++) { if (ACPI_IS_PATH_SEPARATOR (*ExternalName) || @@ -72,7 +72,7 @@ Index: acpica-unix2-20200925/source/components/namespace/nsutils.c ExternalName++; } } -+ AcpiUtWriteUint(Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE); ++ AcpiUtWriteUint (Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE); /* Now we must have a path separator, or the pathname is bad */ diff --git a/0044-Correct-an-endian-ness-problem-when-converting-ASL-t.patch b/0005-Correct-an-endian-ness-problem-when-converting-ASL-t.patch similarity index 71% rename from 0044-Correct-an-endian-ness-problem-when-converting-ASL-t.patch rename to 0005-Correct-an-endian-ness-problem-when-converting-ASL-t.patch index 5d7da5b..3074e05 100644 --- a/0044-Correct-an-endian-ness-problem-when-converting-ASL-t.patch +++ b/0005-Correct-an-endian-ness-problem-when-converting-ASL-t.patch @@ -1,22 +1,23 @@ -From 9dc82e99776b18fe19314695d7d83e79c7fea934 Mon Sep 17 00:00:00 2001 +From 055fee09d8f9244b6c437ad18b98edb81a87e8bc Mon Sep 17 00:00:00 2001 From: Al Stone Date: Tue, 27 Oct 2020 17:50:52 -0600 -Subject: [PATCH] Correct an endian-ness problem when converting ASL to ASL+ +Subject: [PATCH 05/45] Correct an endian-ness problem when converting ASL to + ASL+ Signed-off-by: Al Stone --- source/compiler/cvparser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -diff --git a/source/compiler/cvparser.c b/source/compiler/cvparser.c -index 370b80361..7311e031a 100644 ---- a/source/compiler/cvparser.c -+++ b/source/compiler/cvparser.c +Index: acpica-unix2-20210604/source/compiler/cvparser.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/cvparser.c ++++ acpica-unix2-20210604/source/compiler/cvparser.c @@ -144,6 +144,7 @@ CvInitFileTree ( char *ChildFilename = NULL; UINT8 *AmlStart; UINT32 AmlLength; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); if (!AcpiGbl_CaptureComments) @@ -38,6 +39,3 @@ index 370b80361..7311e031a 100644 AcpiGbl_FileTreeRoot->Next = NULL; AcpiGbl_FileTreeRoot->Parent = NULL; AcpiGbl_FileTreeRoot->Filename = (char *)(AmlStart+2); --- -2.26.2 - diff --git a/0006-Use-more-reliable-ACPI_COPY_NAMSEG-in-GPE-name-check.patch b/0006-Use-more-reliable-ACPI_COPY_NAMSEG-in-GPE-name-check.patch new file mode 100644 index 0000000..7b7ed81 --- /dev/null +++ b/0006-Use-more-reliable-ACPI_COPY_NAMSEG-in-GPE-name-check.patch @@ -0,0 +1,32 @@ +From 790c016107e98ded2d0ae579f84dd4cd3fa06587 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Tue, 29 Jun 2021 17:48:31 -0600 +Subject: [PATCH 06/45] Use more reliable ACPI_COPY_NAMSEG in GPE name checks + +Signed-off-by: Al Stone +--- + source/compiler/aslanalyze.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +Index: acpica-unix2-20210604/source/compiler/aslanalyze.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/aslanalyze.c ++++ acpica-unix2-20210604/source/compiler/aslanalyze.c +@@ -469,7 +469,7 @@ ApCheckForGpeNameConflict ( + + /* Need a null-terminated string version of NameSeg */ + +- ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg); ++ ACPI_COPY_NAMESEG (Name, Op->Asl.NameSeg); + Name[ACPI_NAMESEG_SIZE] = 0; + + /* +@@ -496,7 +496,7 @@ ApCheckForGpeNameConflict ( + * We are now sure we have an _Lxx or _Exx. + * Create the target name that would cause collision (Flip E/L) + */ +- ACPI_MOVE_32_TO_32 (Target, Name); ++ ACPI_COPY_NAMESEG (Target, Name); + + /* Inject opposite letter ("L" versus "E") */ + diff --git a/0007-Handle-dumping-Unicode-properly-when-big-endian.patch b/0007-Handle-dumping-Unicode-properly-when-big-endian.patch new file mode 100644 index 0000000..ade4c9a --- /dev/null +++ b/0007-Handle-dumping-Unicode-properly-when-big-endian.patch @@ -0,0 +1,53 @@ +From 9a4a32c597fcdfa8a3bc33230c40a18e39c3449d Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Thu, 1 Jul 2021 17:46:19 -0600 +Subject: [PATCH 07/45] Handle dumping Unicode properly when big-endian + +Signed-off-by: Al Stone +--- + source/common/dmtbdump.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +Index: acpica-unix2-20210604/source/common/dmtbdump.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump.c ++++ acpica-unix2-20210604/source/common/dmtbdump.c +@@ -146,6 +146,8 @@ AcpiDmDumpUnicode ( + UINT8 *Buffer; + UINT32 Length; + UINT32 i; ++ UINT16 Tmp16; ++ UINT32 start; + + + Buffer = ((UINT8 *) Table) + BufferOffset; +@@ -155,7 +157,8 @@ AcpiDmDumpUnicode ( + + for (i = 0; i < Length; i += 2) + { +- if (!isprint (Buffer[i])) ++ Tmp16 = AcpiUtReadUint16 (&Buffer[i]); ++ if (!isprint (Tmp16)) + { + goto DumpRawBuffer; + } +@@ -163,7 +166,8 @@ AcpiDmDumpUnicode ( + + /* Ensure all high bytes are zero */ + +- for (i = 1; i < Length; i += 2) ++ start = UtIsBigEndianMachine() ? 0 : 1; ++ for (i = start; i < Length; i += 2) + { + if (Buffer[i]) + { +@@ -176,7 +180,8 @@ AcpiDmDumpUnicode ( + AcpiOsPrintf ("\""); + for (i = 0; i < Length; i += 2) + { +- AcpiOsPrintf ("%c", Buffer[i]); ++ Tmp16 = AcpiUtReadUint16 (&Buffer[i]); ++ AcpiOsPrintf ("%c", Tmp16); + } + + AcpiOsPrintf ("\"\n"); diff --git a/0005-Support-MADT-aka-APIC-in-a-big-endian-world.patch b/0008-Support-MADT-aka-APIC-in-a-big-endian-world.patch similarity index 62% rename from 0005-Support-MADT-aka-APIC-in-a-big-endian-world.patch rename to 0008-Support-MADT-aka-APIC-in-a-big-endian-world.patch index cc1392b..ad4214d 100644 --- a/0005-Support-MADT-aka-APIC-in-a-big-endian-world.patch +++ b/0008-Support-MADT-aka-APIC-in-a-big-endian-world.patch @@ -1,27 +1,27 @@ -From f11fb1c691174eb7d236d60ad48da19e56291fef Mon Sep 17 00:00:00 2001 +From 7b107ab7348d903108140f6033e90596b12325c4 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Thu, 15 Oct 2020 12:12:11 -0600 -Subject: [PATCH 05/40] Support MADT (aka APIC) in a big-endian world +Subject: [PATCH 08/45] Support MADT (aka APIC) in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -607,7 +607,7 @@ AcpiDmDumpMadt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -763,7 +763,7 @@ AcpiDmDumpMadt ( { ACPI_STATUS Status; ACPI_SUBTABLE_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&Table->Length); ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_MADT); ACPI_DMTABLE_INFO *InfoTable; -@@ -623,7 +623,7 @@ AcpiDmDumpMadt ( +@@ -779,7 +779,7 @@ AcpiDmDumpMadt ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); diff --git a/0006-Support-ASF-tables-in-a-big-endian-world.patch b/0009-Support-ASF-tables-in-a-big-endian-world.patch similarity index 83% rename from 0006-Support-ASF-tables-in-a-big-endian-world.patch rename to 0009-Support-ASF-tables-in-a-big-endian-world.patch index 194e5ca..5e21344 100644 --- a/0006-Support-ASF-tables-in-a-big-endian-world.patch +++ b/0009-Support-ASF-tables-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 5ac8e9cca71eacd4f18dba2eb89e9b65a805f712 Mon Sep 17 00:00:00 2001 +From ce811b4c38b9a09533ee8bafa22813f6e43c023d Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 18 Sep 2020 16:41:02 -0600 -Subject: [PATCH 06/40] Support ASF! tables in a big-endian world +Subject: [PATCH 09/45] Support ASF! tables in a big-endian world Read the table length properly and it all works right for big-endian. @@ -10,10 +10,10 @@ Signed-off-by: Al Stone source/common/dmtbdump1.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c @@ -79,16 +79,18 @@ AcpiDmDumpAsf ( UINT32 DataOffset = 0; UINT32 i; @@ -25,7 +25,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); - while (Offset < Table->Length) -+ TableLength = AcpiUtReadUint32(&Table->Length); ++ TableLength = AcpiUtReadUint32 (&Table->Length); + while (Offset < TableLength) { /* Common subtable header */ diff --git a/0007-Support-CPEP-tables-in-a-big-endian-world.patch b/0010-Support-CPEP-tables-in-a-big-endian-world.patch similarity index 62% rename from 0007-Support-CPEP-tables-in-a-big-endian-world.patch rename to 0010-Support-CPEP-tables-in-a-big-endian-world.patch index f58cf61..aa677b7 100644 --- a/0007-Support-CPEP-tables-in-a-big-endian-world.patch +++ b/0010-Support-CPEP-tables-in-a-big-endian-world.patch @@ -1,27 +1,27 @@ -From d66af65b4cd0a2719e5a06b77f8eda5e892bfc63 Mon Sep 17 00:00:00 2001 +From 0c4be57a5e0e45b4197c2d9a0b26462d3b1a9b80 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 18 Sep 2020 16:54:13 -0600 -Subject: [PATCH 07/40] Support CPEP tables in a big-endian world +Subject: [PATCH 10/45] Support CPEP tables in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -243,7 +243,7 @@ AcpiDmDumpCpep ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -319,7 +319,7 @@ AcpiDmDumpCpep ( { ACPI_STATUS Status; ACPI_CPEP_POLLING *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&Table->Length); ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_CPEP); -@@ -258,7 +258,7 @@ AcpiDmDumpCpep ( +@@ -334,7 +334,7 @@ AcpiDmDumpCpep ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); diff --git a/0008-Support-DBG2-table-in-a-big-endian-world.patch b/0011-Support-DBG2-table-in-a-big-endian-world.patch similarity index 69% rename from 0008-Support-DBG2-table-in-a-big-endian-world.patch rename to 0011-Support-DBG2-table-in-a-big-endian-world.patch index d0dac5e..cc613fc 100644 --- a/0008-Support-DBG2-table-in-a-big-endian-world.patch +++ b/0011-Support-DBG2-table-in-a-big-endian-world.patch @@ -1,28 +1,28 @@ -From 2d7396fe2b270b0bed6a6436f9e3d15cfbb9abfc Mon Sep 17 00:00:00 2001 +From 2cb0b87a15682da4f19f707fa3ffece504f94b5a Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sat, 19 Sep 2020 13:37:38 -0600 -Subject: [PATCH 08/40] Support DBG2 table in a big-endian world +Subject: [PATCH 11/45] Support DBG2 table in a big-endian world Signed-off-by: Al Stone --- - source/common/dmtbdump1.c | 35 +++++++++++++++++-------------- + source/common/dmtbdump1.c | 37 ++++++++++++++++++-------------- source/compiler/dttable1.c | 43 ++++++++++++++++++++++++-------------- - 2 files changed, 46 insertions(+), 32 deletions(-) + 2 files changed, 48 insertions(+), 32 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -298,7 +298,7 @@ AcpiDmDumpCsrt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -374,7 +374,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 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_CSRT); UINT32 SubOffset; UINT32 SubSubOffset; -@@ -310,7 +310,7 @@ AcpiDmDumpCsrt ( +@@ -386,7 +386,7 @@ AcpiDmDumpCsrt ( /* Subtables (Resource Groups) */ Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); @@ -31,7 +31,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c { /* Resource group subtable */ -@@ -344,7 +344,7 @@ AcpiDmDumpCsrt ( +@@ -420,7 +420,7 @@ AcpiDmDumpCsrt ( Offset + SubOffset); while ((SubOffset < Subtable->Length) && @@ -40,12 +40,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable, -@@ -405,12 +405,13 @@ AcpiDmDumpDbg2 ( +@@ -481,12 +481,13 @@ AcpiDmDumpDbg2 ( { ACPI_STATUS Status; ACPI_DBG2_DEVICE *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&Table->Length); ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_DBG2); UINT32 i; UINT32 ArrayOffset; @@ -55,7 +55,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c /* Main table */ -@@ -424,11 +425,12 @@ AcpiDmDumpDbg2 ( +@@ -500,11 +501,12 @@ AcpiDmDumpDbg2 ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); @@ -63,19 +63,19 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c + while (Offset < Length) { AcpiOsPrintf ("\n"); -+ SubtableLength = AcpiUtReadUint16(&Subtable->Length); ++ SubtableLength = AcpiUtReadUint16 (&Subtable->Length); Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoDbg2Device); + SubtableLength, AcpiDmTableInfoDbg2Device); if (ACPI_FAILURE (Status)) { return; -@@ -438,13 +440,13 @@ AcpiDmDumpDbg2 ( +@@ -514,13 +516,13 @@ AcpiDmDumpDbg2 ( for (i = 0; i < Subtable->RegisterCount; i++) { - ArrayOffset = Subtable->BaseAddressOffset + -+ ArrayOffset = AcpiUtReadUint16(&Subtable->BaseAddressOffset) + ++ ArrayOffset = AcpiUtReadUint16 (&Subtable->BaseAddressOffset) + (sizeof (ACPI_GENERIC_ADDRESS) * i); AbsoluteOffset = Offset + ArrayOffset; Array = (UINT8 *) Subtable + ArrayOffset; @@ -86,12 +86,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c if (ACPI_FAILURE (Status)) { return; -@@ -455,13 +457,13 @@ AcpiDmDumpDbg2 ( +@@ -531,13 +533,13 @@ AcpiDmDumpDbg2 ( for (i = 0; i < Subtable->RegisterCount; i++) { - ArrayOffset = Subtable->AddressSizeOffset + -+ ArrayOffset = AcpiUtReadUint16(&Subtable->AddressSizeOffset) + ++ ArrayOffset = AcpiUtReadUint16 (&Subtable->AddressSizeOffset) + (sizeof (UINT32) * i); AbsoluteOffset = Offset + ArrayOffset; Array = (UINT8 *) Subtable + ArrayOffset; @@ -102,12 +102,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c if (ACPI_FAILURE (Status)) { return; -@@ -471,12 +473,12 @@ AcpiDmDumpDbg2 ( +@@ -547,12 +549,12 @@ AcpiDmDumpDbg2 ( /* Dump the Namestring (required) */ AcpiOsPrintf ("\n"); - ArrayOffset = Subtable->NamepathOffset; -+ ArrayOffset = AcpiUtReadUint16(&Subtable->NamepathOffset); ++ ArrayOffset = AcpiUtReadUint16 (&Subtable->NamepathOffset); AbsoluteOffset = Offset + ArrayOffset; Array = (UINT8 *) Subtable + ArrayOffset; @@ -117,19 +117,21 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c if (ACPI_FAILURE (Status)) { return; -@@ -486,8 +488,9 @@ AcpiDmDumpDbg2 ( +@@ -562,8 +564,11 @@ AcpiDmDumpDbg2 ( if (Subtable->OemDataOffset) { - Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset, - Table, Subtable->OemDataLength, ++ Array = (UINT8 *) Subtable + AcpiUtReadUint16 (&Subtable->OemDataOffset); ++ + Status = AcpiDmDumpTable (Length, -+ Offset + AcpiUtReadUint16(&Subtable->OemDataOffset), -+ Table, AcpiUtReadUint16(&Subtable->OemDataLength), ++ Offset + AcpiUtReadUint16 (&Subtable->OemDataOffset), ++ Array, AcpiUtReadUint16 (&Subtable->OemDataLength), AcpiDmTableInfoDbg2OemData); if (ACPI_FAILURE (Status)) { -@@ -497,9 +500,9 @@ AcpiDmDumpDbg2 ( +@@ -573,9 +578,9 @@ AcpiDmDumpDbg2 ( /* Point to next subtable */ @@ -141,11 +143,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c } } -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/source/compiler/dttable1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable1.c -+++ acpica-unix2-20200925/source/compiler/dttable1.c -@@ -281,6 +281,7 @@ DtCompileCsrt ( +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -355,6 +355,7 @@ DtCompileCsrt ( DT_FIELD **PFieldList = (DT_FIELD **) List; UINT32 DescriptorCount; UINT32 GroupLength; @@ -153,7 +155,7 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c /* Subtables (Resource Groups) */ -@@ -299,12 +300,13 @@ DtCompileCsrt ( +@@ -373,12 +374,13 @@ DtCompileCsrt ( /* Compute the number of resource descriptors */ @@ -163,17 +165,17 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c - (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); ++ 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 ( +@@ -466,6 +468,7 @@ DtCompileDbg2 ( ACPI_DBG2_DEVICE *DeviceInfo; UINT16 CurrentOffset; UINT32 i; @@ -181,7 +183,7 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c /* Main table */ -@@ -408,10 +411,12 @@ DtCompileDbg2 ( +@@ -482,10 +485,12 @@ DtCompileDbg2 ( /* Main table fields */ Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer); @@ -189,66 +191,66 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c - 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)); ++ 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 ( +@@ -512,7 +517,8 @@ DtCompileDbg2 ( /* BaseAddressRegister GAS array (Required, size is RegisterCount) */ - DeviceInfo->BaseAddressOffset = CurrentOffset; -+ AcpiUtWriteUint(&DeviceInfo->BaseAddressOffset, sizeof(UINT16), -+ &CurrentOffset, sizeof(UINT16)); ++ 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 ( +@@ -528,7 +534,8 @@ DtCompileDbg2 ( /* AddressSize array (Required, size = RegisterCount) */ - DeviceInfo->AddressSizeOffset = CurrentOffset; -+ AcpiUtWriteUint(&DeviceInfo->AddressSizeOffset, sizeof(UINT16), -+ &CurrentOffset, sizeof(UINT16)); ++ 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 ( +@@ -544,7 +551,8 @@ DtCompileDbg2 ( /* NamespaceString device identifier (Required, size = NamePathLength) */ - DeviceInfo->NamepathOffset = CurrentOffset; -+ AcpiUtWriteUint(&DeviceInfo->NamepathOffset, sizeof(UINT16), -+ &CurrentOffset, sizeof(UINT16)); ++ AcpiUtWriteUint (&DeviceInfo->NamepathOffset, sizeof (UINT16), ++ &CurrentOffset, sizeof (UINT16)); Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name, &Subtable); if (ACPI_FAILURE (Status)) -@@ -480,8 +488,9 @@ DtCompileDbg2 ( +@@ -554,8 +562,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); ++ 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 ( +@@ -582,8 +591,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)); ++ AcpiUtWriteUint (&DeviceInfo->OemDataOffset, sizeof (UINT16), ++ &CurrentOffset, sizeof (UINT16)); ++ AcpiUtWriteUint (&DeviceInfo->OemDataLength, sizeof (UINT16), ++ &Subtable->Length, sizeof (UINT32)); DtInsertSubtable (ParentTable, Subtable); } diff --git a/0009-Support-DMAR-in-a-big-endian-world.patch b/0012-Support-DMAR-in-a-big-endian-world.patch similarity index 74% rename from 0009-Support-DMAR-in-a-big-endian-world.patch rename to 0012-Support-DMAR-in-a-big-endian-world.patch index d80d519..3a3f33b 100644 --- a/0009-Support-DMAR-in-a-big-endian-world.patch +++ b/0012-Support-DMAR-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 01aad41e59efd615ac075fcedbaab0c60f9e1e11 Mon Sep 17 00:00:00 2001 +From 06623392351dfea54bd69507b6672c933a5e3fd2 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sat, 19 Sep 2020 15:22:00 -0600 -Subject: [PATCH 09/40] Support DMAR in a big-endian world +Subject: [PATCH 12/45] Support DMAR in a big-endian world Signed-off-by: Al Stone --- @@ -10,11 +10,11 @@ Signed-off-by: Al Stone source/compiler/dttable1.c | 12 +++++++----- 3 files changed, 24 insertions(+), 18 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtable.c +Index: acpica-unix2-20210604/source/common/dmtable.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtable.c -+++ acpica-unix2-20200925/source/common/dmtable.c -@@ -1244,13 +1244,13 @@ AcpiDmDumpTable ( +--- acpica-unix2-20210604.orig/source/common/dmtable.c ++++ acpica-unix2-20210604/source/common/dmtable.c +@@ -1341,13 +1341,13 @@ AcpiDmDumpTable ( /* DMAR subtable types */ @@ -30,28 +30,28 @@ Index: acpica-unix2-20200925/source/common/dmtable.c AcpiDmDmarSubnames[Temp16]); break; -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -526,13 +526,15 @@ AcpiDmDumpDmar ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -604,13 +604,15 @@ AcpiDmDumpDmar ( { ACPI_STATUS Status; ACPI_DMAR_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&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; ++ UINT16 SubtableType; ++ UINT16 SubtableLength; /* Main table */ -@@ -546,13 +548,14 @@ AcpiDmDumpDmar ( +@@ -624,13 +626,14 @@ AcpiDmDumpDmar ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); @@ -61,24 +61,24 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c /* Common subtable header */ AcpiOsPrintf ("\n"); -+ SubtableLength = AcpiUtReadUint16(&Subtable->Length); ++ SubtableLength = AcpiUtReadUint16 (&Subtable->Length); Status = AcpiDmDumpTable (Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoDmarHdr); + SubtableLength, AcpiDmTableInfoDmarHdr); if (ACPI_FAILURE (Status)) { return; -@@ -560,7 +563,8 @@ AcpiDmDumpDmar ( +@@ -638,7 +641,8 @@ AcpiDmDumpDmar ( AcpiOsPrintf ("\n"); - switch (Subtable->Type) -+ SubtableType = AcpiUtReadUint16(&Subtable->Type); ++ SubtableType = AcpiUtReadUint16 (&Subtable->Type); + switch (SubtableType) { case ACPI_DMAR_TYPE_HARDWARE_UNIT: -@@ -595,12 +599,12 @@ AcpiDmDumpDmar ( +@@ -673,12 +677,12 @@ AcpiDmDumpDmar ( default: AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", @@ -93,7 +93,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c if (ACPI_FAILURE (Status)) { return; -@@ -609,8 +613,8 @@ AcpiDmDumpDmar ( +@@ -687,8 +691,8 @@ AcpiDmDumpDmar ( /* * Dump the optional device scope entries */ @@ -104,7 +104,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c { /* These types do not support device scopes */ -@@ -618,7 +622,7 @@ AcpiDmDumpDmar ( +@@ -696,7 +700,7 @@ AcpiDmDumpDmar ( } ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset); @@ -113,7 +113,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, -@@ -659,9 +663,9 @@ AcpiDmDumpDmar ( +@@ -737,9 +741,9 @@ AcpiDmDumpDmar ( NextSubtable: /* Point to next subtable */ @@ -125,11 +125,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c } } -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/source/compiler/dttable1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable1.c -+++ acpica-unix2-20200925/source/compiler/dttable1.c -@@ -560,6 +560,7 @@ DtCompileDmar ( +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -634,6 +634,7 @@ DtCompileDmar ( ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope; UINT32 DeviceScopeLength; UINT32 PciPathLength; @@ -137,17 +137,17 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable); -@@ -590,7 +591,8 @@ DtCompileDmar ( +@@ -664,7 +665,8 @@ DtCompileDmar ( DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer); - switch (DmarHeader->Type) -+ DmarHeaderType = AcpiUtReadUint16(&DmarHeader->Type); ++ DmarHeaderType = AcpiUtReadUint16 (&DmarHeader->Type); + switch (DmarHeaderType) { case ACPI_DMAR_TYPE_HARDWARE_UNIT: -@@ -637,8 +639,8 @@ DtCompileDmar ( +@@ -711,8 +713,8 @@ DtCompileDmar ( /* * Optional Device Scope subtables */ @@ -158,14 +158,14 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c { /* These types do not support device scopes */ -@@ -647,8 +649,8 @@ DtCompileDmar ( +@@ -721,8 +723,8 @@ DtCompileDmar ( } DtPushSubtable (Subtable); - DeviceScopeLength = DmarHeader->Length - Subtable->Length - - ParentTable->Length; -+ DeviceScopeLength = AcpiUtReadUint16(&DmarHeader->Length) - -+ Subtable->Length - ParentTable->Length; ++ DeviceScopeLength = AcpiUtReadUint16 (&DmarHeader->Length) - ++ Subtable->Length - ParentTable->Length; while (DeviceScopeLength) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope, diff --git a/0010-Support-DRTM-in-a-big-endian-world.patch b/0013-Support-DRTM-in-a-big-endian-world.patch similarity index 73% rename from 0010-Support-DRTM-in-a-big-endian-world.patch rename to 0013-Support-DRTM-in-a-big-endian-world.patch index d4d94af..ac21497 100644 --- a/0010-Support-DRTM-in-a-big-endian-world.patch +++ b/0013-Support-DRTM-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 9583e760908d4b7d2dabec82137d16f2492d2773 Mon Sep 17 00:00:00 2001 +From bcdec27f562b0df37546b5e8ad2eab76348062eb Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sat, 19 Sep 2020 15:44:06 -0600 -Subject: [PATCH 10/40] Support DRTM in a big-endian world +Subject: [PATCH 13/45] Support DRTM in a big-endian world Signed-off-by: Al Stone --- @@ -9,17 +9,17 @@ Signed-off-by: Al Stone source/compiler/dttable1.c | 6 ++++-- 2 files changed, 19 insertions(+), 12 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -692,11 +692,14 @@ AcpiDmDumpDrtm ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -770,11 +770,14 @@ AcpiDmDumpDrtm ( ACPI_DRTM_RESOURCE_LIST *DrtmRl; ACPI_DRTM_DPS_ID *DrtmDps; UINT32 Count; + UINT32 ResourceCount; + UINT32 ValidatedTableCount; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ @@ -29,7 +29,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c AcpiDmTableInfoDrtm); if (ACPI_FAILURE (Status)) { -@@ -711,7 +714,7 @@ AcpiDmDumpDrtm ( +@@ -789,7 +792,7 @@ AcpiDmDumpDrtm ( DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset); AcpiOsPrintf ("\n"); @@ -38,13 +38,13 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables), AcpiDmTableInfoDrtm0); if (ACPI_FAILURE (Status)) -@@ -724,10 +727,11 @@ AcpiDmDumpDrtm ( +@@ -802,10 +805,11 @@ AcpiDmDumpDrtm ( /* Dump Validated table addresses */ Count = 0; - while ((Offset < Table->Length) && - (DrtmVtl->ValidatedTableCount > Count)) -+ ValidatedTableCount = AcpiUtReadUint32(&DrtmVtl->ValidatedTableCount); ++ ValidatedTableCount = AcpiUtReadUint32 (&DrtmVtl->ValidatedTableCount); + while ((Offset < TableLength) && + (ValidatedTableCount > Count)) { @@ -53,7 +53,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64), AcpiDmTableInfoDrtm0a); if (ACPI_FAILURE (Status)) -@@ -743,7 +747,7 @@ AcpiDmDumpDrtm ( +@@ -821,7 +825,7 @@ AcpiDmDumpDrtm ( DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset); AcpiOsPrintf ("\n"); @@ -62,13 +62,13 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources), AcpiDmTableInfoDrtm1); if (ACPI_FAILURE (Status)) -@@ -756,10 +760,11 @@ AcpiDmDumpDrtm ( +@@ -834,10 +838,11 @@ AcpiDmDumpDrtm ( /* Dump the Resource List */ Count = 0; - while ((Offset < Table->Length) && - (DrtmRl->ResourceCount > Count)) -+ ResourceCount = AcpiUtReadUint32(&DrtmRl->ResourceCount); ++ ResourceCount = AcpiUtReadUint32 (&DrtmRl->ResourceCount); + while ((Offset < TableLength) && + (ResourceCount > Count)) { @@ -77,7 +77,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c ACPI_ADD_PTR (void, Table, Offset), sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a); if (ACPI_FAILURE (Status)) -@@ -775,7 +780,7 @@ AcpiDmDumpDrtm ( +@@ -853,7 +858,7 @@ AcpiDmDumpDrtm ( DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset); AcpiOsPrintf ("\n"); @@ -86,27 +86,27 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2); } -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/source/compiler/dttable1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable1.c -+++ acpica-unix2-20200925/source/compiler/dttable1.c -@@ -775,7 +775,8 @@ DtCompileDrtm ( +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -849,7 +849,8 @@ DtCompileDrtm ( Count++; } - DrtmVtl->ValidatedTableCount = Count; -+ AcpiUtWriteUint(&DrtmVtl->ValidatedTableCount, sizeof(UINT32), -+ &Count, sizeof(UINT32)); ++ AcpiUtWriteUint (&DrtmVtl->ValidatedTableCount, sizeof (UINT32), ++ &Count, sizeof (UINT32)); DtPopSubtable (); ParentTable = DtPeekSubtable (); -@@ -813,7 +814,8 @@ DtCompileDrtm ( +@@ -887,7 +888,8 @@ DtCompileDrtm ( Count++; } - DrtmRl->ResourceCount = Count; + AcpiUtWriteUint(&DrtmRl->ResourceCount, sizeof(UINT32), -+ &Count, sizeof(UINT32)); ++ &Count, sizeof(UINT32)); DtPopSubtable (); ParentTable = DtPeekSubtable (); diff --git a/0011-Support-EINJ-in-a-big-endian-world.patch b/0014-Support-EINJ-in-a-big-endian-world.patch similarity index 62% rename from 0011-Support-EINJ-in-a-big-endian-world.patch rename to 0014-Support-EINJ-in-a-big-endian-world.patch index acb64f1..b28a42e 100644 --- a/0011-Support-EINJ-in-a-big-endian-world.patch +++ b/0014-Support-EINJ-in-a-big-endian-world.patch @@ -1,27 +1,27 @@ -From b264cb9a07faa05e6d8e5e6c2381270c218d88c4 Mon Sep 17 00:00:00 2001 +From 70d1047abe010c80c2dd74f6afdc7005b91e6163 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sat, 19 Sep 2020 15:50:19 -0600 -Subject: [PATCH 11/40] Support EINJ in a big-endian world +Subject: [PATCH 14/45] Support EINJ in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -804,7 +804,7 @@ AcpiDmDumpEinj ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -882,7 +882,7 @@ AcpiDmDumpEinj ( { ACPI_STATUS Status; ACPI_WHEA_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&Table->Length); ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_EINJ); -@@ -819,7 +819,7 @@ AcpiDmDumpEinj ( +@@ -897,7 +897,7 @@ AcpiDmDumpEinj ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); diff --git a/0012-Support-ERST-in-a-big-endian-world.patch b/0015-Support-ERST-in-a-big-endian-world.patch similarity index 62% rename from 0012-Support-ERST-in-a-big-endian-world.patch rename to 0015-Support-ERST-in-a-big-endian-world.patch index 2bd176e..1438b85 100644 --- a/0012-Support-ERST-in-a-big-endian-world.patch +++ b/0015-Support-ERST-in-a-big-endian-world.patch @@ -1,27 +1,27 @@ -From 99f27aa1a38868a716aefd9408a8cd3788644d13 Mon Sep 17 00:00:00 2001 +From e588961ca36e70c24aa1c49e96bcd1997bf98f89 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sat, 19 Sep 2020 15:54:56 -0600 -Subject: [PATCH 12/40] Support ERST in a big-endian world +Subject: [PATCH 15/45] Support ERST in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -857,7 +857,7 @@ AcpiDmDumpErst ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -935,7 +935,7 @@ AcpiDmDumpErst ( { ACPI_STATUS Status; ACPI_WHEA_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&Table->Length); ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_ERST); -@@ -872,7 +872,7 @@ AcpiDmDumpErst ( +@@ -950,7 +950,7 @@ AcpiDmDumpErst ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); diff --git a/0013-Support-FADT-aka-FACP-in-a-big-endian-world.patch b/0016-Support-FADT-aka-FACP-in-a-big-endian-world.patch similarity index 76% rename from 0013-Support-FADT-aka-FACP-in-a-big-endian-world.patch rename to 0016-Support-FADT-aka-FACP-in-a-big-endian-world.patch index 9fd3120..51e4257 100644 --- a/0013-Support-FADT-aka-FACP-in-a-big-endian-world.patch +++ b/0016-Support-FADT-aka-FACP-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 3288b60b3ddc2df4656842d424bfc1e6a51b2ad2 Mon Sep 17 00:00:00 2001 +From b3051bc2bad8988f3ad81a8307de6f1d0eef4ace Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sun, 20 Sep 2020 11:42:21 -0600 -Subject: [PATCH 13/40] Support FADT (aka, FACP) in a big-endian world +Subject: [PATCH 16/45] Support FADT (aka, FACP) in a big-endian world Signed-off-by: Al Stone --- @@ -9,15 +9,15 @@ Signed-off-by: Al Stone source/components/tables/tbfadt.c | 34 +++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 21 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump.c +Index: acpica-unix2-20210604/source/common/dmtbdump.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump.c -+++ acpica-unix2-20200925/source/common/dmtbdump.c -@@ -358,11 +358,12 @@ AcpiDmDumpFadt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump.c ++++ acpica-unix2-20210604/source/common/dmtbdump.c +@@ -363,11 +363,12 @@ AcpiDmDumpFadt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */ @@ -27,7 +27,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c AcpiDmTableInfoFadt1); if (ACPI_FAILURE (Status)) { -@@ -371,10 +372,10 @@ AcpiDmDumpFadt ( +@@ -376,10 +377,10 @@ AcpiDmDumpFadt ( /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */ @@ -41,7 +41,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c AcpiDmTableInfoFadt2); if (ACPI_FAILURE (Status)) { -@@ -384,9 +385,9 @@ AcpiDmDumpFadt ( +@@ -389,9 +390,9 @@ AcpiDmDumpFadt ( /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */ @@ -53,7 +53,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c AcpiDmTableInfoFadt3); if (ACPI_FAILURE (Status)) { -@@ -395,9 +396,9 @@ AcpiDmDumpFadt ( +@@ -400,9 +401,9 @@ AcpiDmDumpFadt ( /* Check for FADT revision 5 fields and up (ACPI 5.0+) */ @@ -65,7 +65,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c AcpiDmTableInfoFadt5); if (ACPI_FAILURE (Status)) { -@@ -407,9 +408,9 @@ AcpiDmDumpFadt ( +@@ -412,9 +413,9 @@ AcpiDmDumpFadt ( /* Check for FADT revision 6 fields and up (ACPI 6.0+) */ @@ -77,7 +77,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c AcpiDmTableInfoFadt6); if (ACPI_FAILURE (Status)) { -@@ -420,11 +421,11 @@ AcpiDmDumpFadt ( +@@ -425,11 +426,11 @@ AcpiDmDumpFadt ( /* Validate various fields in the FADT, including length */ @@ -91,10 +91,10 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c } -Index: acpica-unix2-20200925/source/components/tables/tbfadt.c +Index: acpica-unix2-20210604/source/components/tables/tbfadt.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/tables/tbfadt.c -+++ acpica-unix2-20200925/source/components/tables/tbfadt.c +--- acpica-unix2-20210604.orig/source/components/tables/tbfadt.c ++++ acpica-unix2-20210604/source/components/tables/tbfadt.c @@ -289,7 +289,6 @@ AcpiTbSelectAddress ( UINT32 Address32, UINT64 Address64) @@ -118,7 +118,7 @@ Index: acpica-unix2-20200925/source/components/tables/tbfadt.c * trusted. */ - if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE) -+ if (AcpiUtReadUint32(&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; @@ -128,8 +128,8 @@ Index: acpica-unix2-20200925/source/components/tables/tbfadt.c */ - AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); + Tmp = sizeof (ACPI_TABLE_FADT); -+ AcpiUtWriteUint(&AcpiGbl_FADT.Header.Length, sizeof(UINT32), -+ &Tmp, sizeof(UINT32)); ++ AcpiUtWriteUint (&AcpiGbl_FADT.Header.Length, sizeof (UINT32), ++ &Tmp, sizeof (UINT32)); /* * Expand the 32-bit DSDT addresses to 64-bit as necessary. @@ -137,11 +137,11 @@ Index: acpica-unix2-20200925/source/components/tables/tbfadt.c */ - AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT", - AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt); -+ Value32 = AcpiUtReadUint32(&AcpiGbl_FADT.Dsdt); -+ Value64 = AcpiUtReadUint64(&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)); ++ AcpiUtWriteUint (&AcpiGbl_FADT.XDsdt, sizeof (UINT64), ++ &Value64, sizeof (UINT64)); /* If Hardware Reduced flag is set, we are all done */ @@ -150,11 +150,11 @@ Index: acpica-unix2-20200925/source/components/tables/tbfadt.c if (Address64->Address) { - if (Address64->Address != (UINT64) Address32) -+ Value32 = AcpiUtReadUint32(&Address32); -+ Value64 = AcpiUtReadUint64(&Address64->Address); ++ Value32 = AcpiUtReadUint32 (&Address32); ++ Value64 = AcpiUtReadUint64 (&Address64->Address); + + /* if (Address64->Address != (UINT64) Address32) */ -+ if (Value64 != (UINT64) Value32) ++ if (Value64 != (UINT64) Value32) { /* Address mismatch */ @@ -162,7 +162,7 @@ Index: acpica-unix2-20200925/source/components/tables/tbfadt.c */ if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses) { -+ Value32 = AcpiUtReadUint32(&Address32); ++ Value32 = AcpiUtReadUint32 (&Address32); AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO, Length, - (UINT64) Address32, Name, Flags); @@ -174,11 +174,11 @@ Index: acpica-unix2-20200925/source/components/tables/tbfadt.c if (Source64->Address) { -+ UINT64 Address64; ++ UINT64 Address64; + -+ Address64 = AcpiUtReadUint64(&Source64->Address); -+ Address64 += -+ (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth); ++ Address64 = AcpiUtReadUint64 (&Source64->Address); ++ Address64 += ++ (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth); AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target, Source64->SpaceId, Pm1RegisterByteWidth, - Source64->Address + diff --git a/0014-Support-most-FPDTs-in-a-big-endian-world.patch b/0017-Support-most-FPDTs-in-a-big-endian-world.patch similarity index 71% rename from 0014-Support-most-FPDTs-in-a-big-endian-world.patch rename to 0017-Support-most-FPDTs-in-a-big-endian-world.patch index f1f9715..abeed59 100644 --- a/0014-Support-most-FPDTs-in-a-big-endian-world.patch +++ b/0017-Support-most-FPDTs-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From f0cba59f1ce62095cb0a0cecdf8d661b77bf2baf Mon Sep 17 00:00:00 2001 +From 35f533074fb78d52e87c5a14406a136480a6fe62 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Tue, 22 Sep 2020 17:51:45 -0600 -Subject: [PATCH 14/40] Support most FPDTs in a big-endian world +Subject: [PATCH 17/45] Support most FPDTs in a big-endian world NB: there is no support for vendor specific records even in the little-endian version. @@ -12,23 +12,23 @@ Signed-off-by: Al Stone source/compiler/dttable1.c | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -910,9 +910,10 @@ AcpiDmDumpFpdt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -988,9 +988,10 @@ AcpiDmDumpFpdt ( { ACPI_STATUS Status; ACPI_FPDT_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 TableLength = AcpiUtReadUint32(&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 ( +@@ -998,19 +999,20 @@ AcpiDmDumpFpdt ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); @@ -47,12 +47,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c } - switch (Subtable->Type) -+ SubtableType = AcpiUtReadUint16(&Subtable->Type); ++ SubtableType = AcpiUtReadUint16 (&Subtable->Type); + switch (SubtableType) { case ACPI_FPDT_TYPE_BOOT: -@@ -959,7 +961,7 @@ AcpiDmDumpFpdt ( +@@ -1037,7 +1039,7 @@ AcpiDmDumpFpdt ( goto NextSubtable; } @@ -61,11 +61,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/source/compiler/dttable1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable1.c -+++ acpica-unix2-20200925/source/compiler/dttable1.c -@@ -1051,6 +1051,7 @@ DtCompileFpdt ( +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -1125,6 +1125,7 @@ DtCompileFpdt ( ACPI_DMTABLE_INFO *InfoTable; DT_FIELD **PFieldList = (DT_FIELD **) List; DT_FIELD *SubtableStart; @@ -73,12 +73,12 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c while (*PFieldList) -@@ -1069,7 +1070,8 @@ DtCompileFpdt ( +@@ -1143,7 +1144,8 @@ DtCompileFpdt ( FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer); - switch (FpdtHeader->Type) -+ SubtableType = AcpiUtReadUint16(&FpdtHeader->Type); ++ SubtableType = AcpiUtReadUint16 (&FpdtHeader->Type); + switch (SubtableType) { case ACPI_FPDT_TYPE_BOOT: diff --git a/0015-Support-GTDT-in-a-big-endian-world.patch b/0018-Support-GTDT-in-a-big-endian-world.patch similarity index 60% rename from 0015-Support-GTDT-in-a-big-endian-world.patch rename to 0018-Support-GTDT-in-a-big-endian-world.patch index 7302133..df3f181 100644 --- a/0015-Support-GTDT-in-a-big-endian-world.patch +++ b/0018-Support-GTDT-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From faba93b1dd7ce4aa8983880e917d108496cd173f Mon Sep 17 00:00:00 2001 +From 492e41a24fd088c7ab609ee8ad518f69c9cd29e3 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Tue, 22 Sep 2020 18:12:01 -0600 -Subject: [PATCH 15/40] Support GTDT in a big-endian world +Subject: [PATCH 18/45] Support GTDT in a big-endian world Signed-off-by: Al Stone --- @@ -9,20 +9,20 @@ Signed-off-by: Al Stone source/compiler/dttable1.c | 9 +++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -997,7 +997,7 @@ AcpiDmDumpGtdt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -1075,7 +1075,7 @@ AcpiDmDumpGtdt ( { ACPI_STATUS Status; ACPI_GTDT_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&Table->Length); ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_GTDT); ACPI_DMTABLE_INFO *InfoTable; UINT32 SubtableLength; -@@ -1033,7 +1033,7 @@ AcpiDmDumpGtdt ( +@@ -1111,7 +1111,7 @@ AcpiDmDumpGtdt ( /* Subtables */ @@ -31,39 +31,39 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c { /* Common subtable header */ -@@ -1051,8 +1051,13 @@ AcpiDmDumpGtdt ( +@@ -1129,8 +1129,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; ++ { ++ UINT32 Tmp32; + + Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, + Subtable))->TimerCount; -+ GtCount = AcpiUtReadUint32(&Tmp32); -+ } ++ GtCount = AcpiUtReadUint32 (&Tmp32); ++ } InfoTable = AcpiDmTableInfoGtdt0; break; -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/source/compiler/dttable1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable1.c -+++ acpica-unix2-20200925/source/compiler/dttable1.c -@@ -997,8 +997,13 @@ DtCompileGtdt ( +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -1071,8 +1071,13 @@ DtCompileGtdt ( DtPushSubtable (Subtable); ParentTable = DtPeekSubtable (); - GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, - Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount; -+ { -+ UINT32 Tmp32; ++ { ++ UINT32 Tmp32; + + Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, -+ Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount; -+ GtCount = AcpiUtReadUint32(&Tmp32); -+ } ++ Subtable->Buffer - sizeof (ACPI_GTDT_HEADER)))->TimerCount; ++ GtCount = AcpiUtReadUint32 (&Tmp32); ++ } while (GtCount) { diff --git a/0016-Support-HEST-in-a-big-endian-world.patch b/0019-Support-HEST-in-a-big-endian-world.patch similarity index 69% rename from 0016-Support-HEST-in-a-big-endian-world.patch rename to 0019-Support-HEST-in-a-big-endian-world.patch index e38456f..baad30e 100644 --- a/0016-Support-HEST-in-a-big-endian-world.patch +++ b/0019-Support-HEST-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 1104928443b11ff1c0446ed1604882c0e6ae4dc1 Mon Sep 17 00:00:00 2001 +From 6b73a4881e436bb8cf86c05c1cc4b5360efe1c7f Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 11:54:49 -0600 -Subject: [PATCH 16/40] Support HEST in a big-endian world +Subject: [PATCH 19/45] Support HEST in a big-endian world Signed-off-by: Al Stone --- @@ -9,16 +9,16 @@ Signed-off-by: Al Stone source/compiler/dttable1.c | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -1138,12 +1138,13 @@ AcpiDmDumpHest ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -1216,12 +1216,13 @@ AcpiDmDumpHest ( { ACPI_STATUS Status; ACPI_HEST_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 Length = AcpiUtReadUint32(&Table->Length); ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_HEST); ACPI_DMTABLE_INFO *InfoTable; UINT32 SubtableLength; @@ -28,7 +28,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c /* Main table */ -@@ -1157,10 +1158,11 @@ AcpiDmDumpHest ( +@@ -1235,10 +1236,11 @@ AcpiDmDumpHest ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); @@ -37,12 +37,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c { BankCount = 0; - switch (Subtable->Type) -+ SubtableType = Subtable->Type; ++ SubtableType = Subtable->Type; + switch (SubtableType) { case ACPI_HEST_TYPE_IA32_CHECK: -@@ -1227,7 +1229,7 @@ AcpiDmDumpHest ( +@@ -1305,7 +1307,7 @@ AcpiDmDumpHest ( /* Cannot continue on unknown type - no length */ AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", @@ -51,11 +51,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c return; } -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/source/compiler/dttable1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable1.c -+++ acpica-unix2-20200925/source/compiler/dttable1.c -@@ -1133,6 +1133,7 @@ DtCompileHest ( +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -1207,6 +1207,7 @@ DtCompileHest ( DT_FIELD *SubtableStart; ACPI_DMTABLE_INFO *InfoTable; UINT16 Type; @@ -63,13 +63,13 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c UINT32 BankCount; -@@ -1151,7 +1152,8 @@ DtCompileHest ( +@@ -1225,7 +1226,8 @@ DtCompileHest ( /* Get subtable type */ SubtableStart = *PFieldList; - DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0); + DtCompileInteger ((UINT8 *) &Tmp16, *PFieldList, 2, 0); -+ Type = AcpiUtReadUint32(&Tmp16); ++ Type = AcpiUtReadUint32 (&Tmp16); switch (Type) { diff --git a/0017-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch b/0020-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch similarity index 62% rename from 0017-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch rename to 0020-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch index 4925302..6c2d0f0 100644 --- a/0017-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch +++ b/0020-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch @@ -1,26 +1,26 @@ -From 6565935b43c4795387aa4814d171dcd3c02bee33 Mon Sep 17 00:00:00 2001 +From 198abe6e9fcb03676513146bf2f9b8ccc49e5827 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 12:11:46 -0600 -Subject: [PATCH 17/40] Support RSDT ('RSD PTR') in a big-endian world +Subject: [PATCH 20/45] Support RSDT ('RSD PTR') in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump.c +Index: acpica-unix2-20210604/source/common/dmtbdump.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump.c -+++ acpica-unix2-20200925/source/common/dmtbdump.c -@@ -277,6 +277,7 @@ AcpiDmDumpRsdt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump.c ++++ acpica-unix2-20210604/source/common/dmtbdump.c +@@ -282,6 +282,7 @@ AcpiDmDumpRsdt ( UINT32 Entries; UINT32 Offset; UINT32 i; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Point to start of table pointer array */ -@@ -286,12 +287,12 @@ AcpiDmDumpRsdt ( +@@ -291,12 +292,12 @@ AcpiDmDumpRsdt ( /* RSDT uses 32-bit pointers */ @@ -31,7 +31,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c { AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i); - AcpiOsPrintf ("%8.8X\n", Array[i]); -+ AcpiOsPrintf ("%8.8X\n", AcpiUtReadUint32(&Array[i])); ++ AcpiOsPrintf ("%8.8X\n", AcpiUtReadUint32 (&Array[i])); Offset += sizeof (UINT32); } } diff --git a/0018-Support-XSDT-in-a-big-endian-world.patch b/0021-Support-XSDT-in-a-big-endian-world.patch similarity index 64% rename from 0018-Support-XSDT-in-a-big-endian-world.patch rename to 0021-Support-XSDT-in-a-big-endian-world.patch index 7ae8ea1..83877c5 100644 --- a/0018-Support-XSDT-in-a-big-endian-world.patch +++ b/0021-Support-XSDT-in-a-big-endian-world.patch @@ -1,26 +1,26 @@ -From 8d0ea4932cebc5d13cc811eb4f78b66a5e3cfd2c Mon Sep 17 00:00:00 2001 +From 75d974e42fefabfd6684d62f58bff678b55f396b Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 12:16:37 -0600 -Subject: [PATCH 18/40] Support XSDT in a big-endian world +Subject: [PATCH 21/45] Support XSDT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump.c +Index: acpica-unix2-20210604/source/common/dmtbdump.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump.c -+++ acpica-unix2-20200925/source/common/dmtbdump.c -@@ -318,6 +318,7 @@ AcpiDmDumpXsdt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump.c ++++ acpica-unix2-20210604/source/common/dmtbdump.c +@@ -323,6 +323,7 @@ AcpiDmDumpXsdt ( UINT32 Entries; UINT32 Offset; UINT32 i; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Point to start of table pointer array */ -@@ -327,12 +328,13 @@ AcpiDmDumpXsdt ( +@@ -332,12 +333,13 @@ AcpiDmDumpXsdt ( /* XSDT uses 64-bit pointers */ @@ -32,7 +32,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump.c 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]))); ++ ACPI_FORMAT_UINT64 (AcpiUtReadUint64 (&Array[i]))); Offset += sizeof (UINT64); } } diff --git a/0019-Support-SRAT-in-a-big-endian-world.patch b/0022-Support-SRAT-in-a-big-endian-world.patch similarity index 80% rename from 0019-Support-SRAT-in-a-big-endian-world.patch rename to 0022-Support-SRAT-in-a-big-endian-world.patch index 6bb6215..75bcc04 100644 --- a/0019-Support-SRAT-in-a-big-endian-world.patch +++ b/0022-Support-SRAT-in-a-big-endian-world.patch @@ -1,22 +1,22 @@ -From 82421dd7d534f78edf85b862b196bae256cf8f87 Mon Sep 17 00:00:00 2001 +From 724fcc83d359e4c8abbd2a48755e96049afa06d6 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 12:25:38 -0600 -Subject: [PATCH 19/40] Support SRAT in a big-endian world +Subject: [PATCH 22/45] Support SRAT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump3.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump3.c +Index: acpica-unix2-20210604/source/common/dmtbdump3.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump3.c -+++ acpica-unix2-20200925/source/common/dmtbdump3.c +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/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); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ diff --git a/0020-Support-SLIT-in-a-big-endian-world.patch b/0023-Support-SLIT-in-a-big-endian-world.patch similarity index 68% rename from 0020-Support-SLIT-in-a-big-endian-world.patch rename to 0023-Support-SLIT-in-a-big-endian-world.patch index a0e3a5e..e0e324f 100644 --- a/0020-Support-SLIT-in-a-big-endian-world.patch +++ b/0023-Support-SLIT-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 4e76aa1a5556f250f51a3802734fd6cb77718299 Mon Sep 17 00:00:00 2001 +From b11d50752feb9f1b52db076d1fb4753b30a53642 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 12:49:52 -0600 -Subject: [PATCH 20/40] Support SLIT in a big-endian world +Subject: [PATCH 23/45] Support SLIT in a big-endian world Signed-off-by: Al Stone --- @@ -9,15 +9,15 @@ Signed-off-by: Al Stone source/compiler/dttable2.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump3.c +Index: acpica-unix2-20210604/source/common/dmtbdump3.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump3.c -+++ acpica-unix2-20200925/source/common/dmtbdump3.c +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/source/common/dmtbdump3.c @@ -96,11 +96,12 @@ AcpiDmDumpSlit ( UINT32 Localities; UINT32 i; UINT32 j; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ @@ -32,8 +32,8 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c /* 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); ++ 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; @@ -46,16 +46,16 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c { AcpiOsPrintf ( "\n**** Not enough room in table for all localities\n"); -Index: acpica-unix2-20200925/source/compiler/dttable2.c +Index: acpica-unix2-20210604/source/compiler/dttable2.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable2.c -+++ acpica-unix2-20200925/source/compiler/dttable2.c -@@ -1529,7 +1529,7 @@ DtCompileSlit ( +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -1837,7 +1837,7 @@ DtCompileSlit ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); - Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer); -+ Localities = (UINT32) AcpiUtReadUint64(Subtable->Buffer); ++ Localities = (UINT32) AcpiUtReadUint64 (Subtable->Buffer); LocalityBuffer = UtLocalCalloc (Localities); LocalityListLength = 0; diff --git a/0021-Support-MSCT-in-a-big-endian-world.patch b/0024-Support-MSCT-in-a-big-endian-world.patch similarity index 72% rename from 0021-Support-MSCT-in-a-big-endian-world.patch rename to 0024-Support-MSCT-in-a-big-endian-world.patch index 3a59eaa..bb93fe2 100644 --- a/0021-Support-MSCT-in-a-big-endian-world.patch +++ b/0024-Support-MSCT-in-a-big-endian-world.patch @@ -1,22 +1,22 @@ -From 4ca38d182bb40ba750d8f5ac6ff8560c40f06625 Mon Sep 17 00:00:00 2001 +From ae38e1578d18abf41330bb3dbaef9ea56a52f49b Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 15:44:21 -0600 -Subject: [PATCH 21/40] Support MSCT in a big-endian world +Subject: [PATCH 24/45] Support MSCT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump2.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -972,11 +972,12 @@ AcpiDmDumpMsct ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -1133,11 +1133,12 @@ AcpiDmDumpMsct ( ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MSCT); ACPI_MSCT_PROXIMITY *Subtable; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ @@ -26,7 +26,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -985,12 +986,12 @@ AcpiDmDumpMsct ( +@@ -1146,12 +1147,12 @@ AcpiDmDumpMsct ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); diff --git a/0024-Support-SDEV-in-a-big-endian-world.patch b/0024-Support-SDEV-in-a-big-endian-world.patch deleted file mode 100644 index f6d36bd..0000000 --- a/0024-Support-SDEV-in-a-big-endian-world.patch +++ /dev/null @@ -1,256 +0,0 @@ -From af44bec6c062a26034a43809d81af2a0ea17343e Mon Sep 17 00:00:00 2001 -From: Al Stone -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 ---- - 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: diff --git a/0022-Support-MPST-in-a-big-endian-world.patch b/0025-Support-MPST-in-a-big-endian-world.patch similarity index 73% rename from 0022-Support-MPST-in-a-big-endian-world.patch rename to 0025-Support-MPST-in-a-big-endian-world.patch index 2b4c2e3..600c6ec 100644 --- a/0022-Support-MPST-in-a-big-endian-world.patch +++ b/0025-Support-MPST-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From dfe414b053fb9feb905271785b319afa7ba72932 Mon Sep 17 00:00:00 2001 +From 0a25688f36df62579f4dd0444ceba33a0f8d4dcc Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 23 Sep 2020 16:08:24 -0600 -Subject: [PATCH 22/40] Support MPST in a big-endian world +Subject: [PATCH 25/45] Support MPST in a big-endian world Signed-off-by: Al Stone --- @@ -9,15 +9,15 @@ Signed-off-by: Al Stone source/compiler/dttable2.c | 8 ++++---- 2 files changed, 23 insertions(+), 18 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -834,11 +834,13 @@ AcpiDmDumpMpst ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -995,11 +995,13 @@ AcpiDmDumpMpst ( UINT16 SubtableCount; UINT32 PowerStateCount; UINT32 ComponentCount; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT16 Tmp16; @@ -28,13 +28,13 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -846,13 +848,14 @@ AcpiDmDumpMpst ( +@@ -1007,13 +1009,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); ++ SubtableCount = AcpiUtReadUint16 (&Tmp16); Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset); - while ((Offset < Table->Length) && SubtableCount) @@ -46,18 +46,18 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); if (ACPI_FAILURE (Status)) { -@@ -861,8 +864,8 @@ AcpiDmDumpMpst ( +@@ -1022,8 +1025,8 @@ AcpiDmDumpMpst ( /* Extract the sub-subtable counts */ - PowerStateCount = Subtable0->NumPowerStates; - ComponentCount = Subtable0->NumPhysicalComponents; -+ PowerStateCount = AcpiUtReadUint16(&Subtable0->NumPowerStates); -+ ComponentCount = AcpiUtReadUint16(&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 ( +@@ -1034,7 +1037,7 @@ AcpiDmDumpMpst ( while (PowerStateCount) { AcpiOsPrintf ("\n"); @@ -66,7 +66,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); if (ACPI_FAILURE (Status)) { -@@ -896,7 +899,7 @@ AcpiDmDumpMpst ( +@@ -1057,7 +1060,7 @@ AcpiDmDumpMpst ( while (ComponentCount) { @@ -75,16 +75,16 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); if (ACPI_FAILURE (Status)) { -@@ -913,22 +916,24 @@ AcpiDmDumpMpst ( +@@ -1074,22 +1077,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))); ++ (sizeof (ACPI_MPST_POWER_STATE) * ++ AcpiUtReadUint16 (&Subtable0->NumPowerStates)) + ++ (sizeof (ACPI_MPST_COMPONENT) * ++ AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents))); } /* Subtable: Count of Memory Power State Characteristic structures */ @@ -100,11 +100,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c } - SubtableCount = Subtable1->CharacteristicsCount; -+ SubtableCount = AcpiUtReadUint16(&Subtable1->CharacteristicsCount); ++ SubtableCount = AcpiUtReadUint16 (&Subtable1->CharacteristicsCount); Offset += sizeof (ACPI_MPST_DATA_HDR); /* Subtable: Memory Power State Characteristics structure(s) */ -@@ -936,10 +941,10 @@ AcpiDmDumpMpst ( +@@ -1097,10 +1102,10 @@ AcpiDmDumpMpst ( Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1, sizeof (ACPI_MPST_DATA_HDR)); @@ -117,31 +117,31 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); if (ACPI_FAILURE (Status)) { -Index: acpica-unix2-20200925/source/compiler/dttable2.c +Index: acpica-unix2-20210604/source/compiler/dttable2.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable2.c -+++ acpica-unix2-20200925/source/compiler/dttable2.c -@@ -345,7 +345,7 @@ DtCompileMpst ( +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -350,7 +350,7 @@ DtCompileMpst ( DtPushSubtable (Subtable); MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer); - SubtableCount = MpstChannelInfo->PowerNodeCount; -+ SubtableCount = AcpiUtReadUint16(&MpstChannelInfo->PowerNodeCount); ++ SubtableCount = AcpiUtReadUint16 (&MpstChannelInfo->PowerNodeCount); while (*PFieldList && SubtableCount) { -@@ -363,8 +363,8 @@ DtCompileMpst ( +@@ -368,8 +368,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); ++ PowerStateCount = AcpiUtReadUint16 (&MpstPowerNode->NumPowerStates); ++ ComponentCount = AcpiUtReadUint16 (&MpstPowerNode->NumPhysicalComponents); ParentTable = DtPeekSubtable (); -@@ -417,7 +417,7 @@ DtCompileMpst ( +@@ -422,7 +422,7 @@ DtCompileMpst ( DtPushSubtable (Subtable); MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer); diff --git a/0023-Support-NFIT-in-a-big-endian-world.patch b/0026-Support-NFIT-in-a-big-endian-world.patch similarity index 72% rename from 0023-Support-NFIT-in-a-big-endian-world.patch rename to 0026-Support-NFIT-in-a-big-endian-world.patch index 42d5a7d..cf5267d 100644 --- a/0023-Support-NFIT-in-a-big-endian-world.patch +++ b/0026-Support-NFIT-in-a-big-endian-world.patch @@ -1,25 +1,28 @@ -From 2a1f049c35736ddba45300bc5aba4db9c9df3be7 Mon Sep 17 00:00:00 2001 +From 5aec8511fc433a71cb8b6d26be464355d0c3f5cc Mon Sep 17 00:00:00 2001 From: Al Stone Date: Thu, 24 Sep 2020 15:25:53 -0600 -Subject: [PATCH 23/40] Support NFIT in a big-endian world +Subject: [PATCH 26/45] Support NFIT in a big-endian world + +NB: this required correcting the starting pointer for the NFIT +SMBIOS subtable; otherwise, disassembly did not work properly. Signed-off-by: Al Stone --- source/common/dmtable.c | 4 ++-- - source/common/dmtbdump2.c | 47 +++++++++++++++++++++++--------------- + source/common/dmtbdump2.c | 49 ++++++++++++++++++++++---------------- source/compiler/dttable2.c | 11 ++++++--- - 3 files changed, 38 insertions(+), 24 deletions(-) + 3 files changed, 39 insertions(+), 25 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtable.c +Index: acpica-unix2-20210604/source/common/dmtable.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtable.c -+++ acpica-unix2-20200925/source/common/dmtable.c -@@ -1429,13 +1429,13 @@ AcpiDmDumpTable ( +--- acpica-unix2-20210604.orig/source/common/dmtable.c ++++ acpica-unix2-20210604/source/common/dmtable.c +@@ -1526,13 +1526,13 @@ AcpiDmDumpTable ( /* NFIT subtable types */ - Temp16 = ACPI_GET16 (Target); -+ Temp16 = AcpiUtReadUint16(Target); ++ Temp16 = AcpiUtReadUint16 (Target); if (Temp16 > ACPI_NFIT_TYPE_RESERVED) { Temp16 = ACPI_NFIT_TYPE_RESERVED; @@ -30,16 +33,16 @@ Index: acpica-unix2-20200925/source/common/dmtable.c AcpiDmNfitSubnames[Temp16]); break; -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -1084,18 +1084,23 @@ AcpiDmDumpNfit ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -1192,18 +1192,23 @@ AcpiDmDumpNfit ( ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_NFIT); UINT32 FieldOffset = 0; - UINT32 Length; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); ACPI_NFIT_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; ACPI_NFIT_INTERLEAVE *Interleave = NULL; @@ -60,7 +63,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -1104,19 +1109,21 @@ AcpiDmDumpNfit ( +@@ -1212,19 +1217,21 @@ AcpiDmDumpNfit ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset); @@ -72,8 +75,8 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoNfitHdr); -+ SubtableType = AcpiUtReadUint16(&Subtable->Type); -+ SubtableLength = AcpiUtReadUint16(&Subtable->Length); ++ SubtableType = AcpiUtReadUint16 (&Subtable->Type); ++ SubtableLength = AcpiUtReadUint16 (&Subtable->Length); + Status = AcpiDmDumpTable (TableLength, Offset, Subtable, + SubtableLength, AcpiDmTableInfoNfitHdr); if (ACPI_FAILURE (Status)) @@ -86,7 +89,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c { case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: -@@ -1167,11 +1174,11 @@ AcpiDmDumpNfit ( +@@ -1275,11 +1282,11 @@ AcpiDmDumpNfit ( default: AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", @@ -100,7 +103,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c { AcpiOsPrintf ("Invalid zero length subtable\n"); return; -@@ -1180,8 +1187,8 @@ AcpiDmDumpNfit ( +@@ -1288,8 +1295,8 @@ AcpiDmDumpNfit ( } AcpiOsPrintf ("\n"); @@ -111,7 +114,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -1189,14 +1196,15 @@ AcpiDmDumpNfit ( +@@ -1297,14 +1304,15 @@ AcpiDmDumpNfit ( /* Per-subtable variable-length fields */ @@ -122,7 +125,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); - for (i = 0; i < Interleave->LineCount; i++) -+ LineCount = AcpiUtReadUint32(&Interleave->LineCount); ++ LineCount = AcpiUtReadUint32 (&Interleave->LineCount); + for (i = 0; i < LineCount; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -130,7 +133,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c &Interleave->LineOffset[i], sizeof (UINT32), AcpiDmTableInfoNfit2a); if (ACPI_FAILURE (Status)) -@@ -1210,12 +1218,12 @@ AcpiDmDumpNfit ( +@@ -1318,14 +1326,14 @@ AcpiDmDumpNfit ( case ACPI_NFIT_TYPE_SMBIOS: @@ -143,14 +146,17 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c - Status = AcpiDmDumpTable (Table->Length, + Status = AcpiDmDumpTable (TableLength, sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8), - SmbiosInfo, +- SmbiosInfo, ++ SmbiosInfo + Offset, Length, AcpiDmTableInfoNfit3a); -@@ -1230,9 +1238,10 @@ AcpiDmDumpNfit ( + if (ACPI_FAILURE (Status)) + { +@@ -1338,9 +1346,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); ++ HintCount = AcpiUtReadUint16 (&Hint->HintCount); + for (i = 0; i < HintCount; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -158,7 +164,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c &Hint->HintAddress[i], sizeof (UINT64), AcpiDmTableInfoNfit6a); if (ACPI_FAILURE (Status)) -@@ -1251,8 +1260,8 @@ AcpiDmDumpNfit ( +@@ -1359,8 +1368,8 @@ AcpiDmDumpNfit ( NextSubtable: /* Point to next subtable */ @@ -169,11 +175,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c } } -Index: acpica-unix2-20200925/source/compiler/dttable2.c +Index: acpica-unix2-20210604/source/compiler/dttable2.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable2.c -+++ acpica-unix2-20200925/source/compiler/dttable2.c -@@ -517,6 +517,7 @@ DtCompileNfit ( +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -497,6 +497,7 @@ DtCompileNfit ( UINT32 Count; ACPI_NFIT_INTERLEAVE *Interleave = NULL; ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL; @@ -181,17 +187,17 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c /* Main table */ -@@ -550,7 +551,8 @@ DtCompileNfit ( +@@ -530,7 +531,8 @@ DtCompileNfit ( NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer); - switch (NfitHeader->Type) -+ NfitHeaderType = AcpiUtReadUint16(&NfitHeader->Type); ++ NfitHeaderType = AcpiUtReadUint16 (&NfitHeader->Type); + switch (NfitHeaderType) { case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: -@@ -610,7 +612,7 @@ DtCompileNfit ( +@@ -590,7 +592,7 @@ DtCompileNfit ( DtInsertSubtable (ParentTable, Subtable); DtPopSubtable (); @@ -200,22 +206,22 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c { case ACPI_NFIT_TYPE_INTERLEAVE: -@@ -636,7 +638,8 @@ DtCompileNfit ( +@@ -616,7 +618,8 @@ DtCompileNfit ( Count++; } - Interleave->LineCount = Count; -+ AcpiUtWriteUint(&Interleave->LineCount, sizeof(UINT32), -+ &Count, sizeof(UINT32)); ++ AcpiUtWriteUint (&Interleave->LineCount, sizeof (UINT32), ++ &Count, sizeof (UINT32)); break; case ACPI_NFIT_TYPE_SMBIOS: -@@ -682,6 +685,8 @@ DtCompileNfit ( +@@ -662,6 +665,8 @@ DtCompileNfit ( } Hint->HintCount = (UINT16) Count; -+ AcpiUtWriteUint(&Hint->HintCount, sizeof(UINT16), -+ &Count, sizeof(UINT32)); ++ AcpiUtWriteUint (&Hint->HintCount, sizeof (UINT16), ++ &Count, sizeof (UINT32)); break; default: diff --git a/0027-Support-SDEV-in-a-big-endian-world.patch b/0027-Support-SDEV-in-a-big-endian-world.patch new file mode 100644 index 0000000..800098e --- /dev/null +++ b/0027-Support-SDEV-in-a-big-endian-world.patch @@ -0,0 +1,206 @@ +From 3d1ac6e76ad0c0d6454671b190ccbbfafb0cb4cc Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Tue, 29 Jun 2021 16:03:36 -0600 +Subject: [PATCH 27/45] Support SDEV in a big-endian world + +Signed-off-by: Al Stone +--- + source/common/dmtbdump2.c | 48 +++++++++++++++++++++----------------- + source/compiler/dttable2.c | 27 ++++++++++++++++++++- + 2 files changed, 52 insertions(+), 23 deletions(-) + +Index: acpica-unix2-20210604/source/common/dmtbdump2.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -2125,7 +2125,7 @@ AcpiDmDumpSdev ( + ACPI_SDEV_NAMESPACE *Namesp; + ACPI_DMTABLE_INFO *InfoTable; + ACPI_DMTABLE_INFO *SecureComponentInfoTable; +- UINT32 Length = Table->Length; ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT32 Offset = sizeof (ACPI_TABLE_SDEV); + UINT16 PathOffset; + UINT16 PathLength; +@@ -2133,11 +2133,12 @@ AcpiDmDumpSdev ( + UINT16 VendorDataLength; + ACPI_SDEV_SECURE_COMPONENT *SecureComponent = NULL; + UINT32 CurrentOffset = 0; ++ UINT16 SubtableLength; + + + /* Main table */ + +- Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev); ++ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSdev); + if (ACPI_FAILURE (Status)) + { + return; +@@ -2146,13 +2147,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; +@@ -2175,8 +2177,8 @@ AcpiDmDumpSdev ( + } + + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Table->Length, 0, Subtable, +- Subtable->Length, InfoTable); ++ Status = AcpiDmDumpTable (TableLength, 0, Subtable, ++ SubtableLength, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; +@@ -2235,12 +2237,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, CurrentOffset, ++ Status = AcpiDmDumpTable (TableLength, CurrentOffset, + ACPI_ADD_PTR (UINT8, Namesp, PathOffset), + PathLength, AcpiDmTableInfoSdev0a); + if (ACPI_FAILURE (Status)) +@@ -2252,14 +2254,14 @@ AcpiDmDumpSdev ( + + /* Dump the vendor-specific data */ + +- VendorDataLength = +- Namesp->VendorDataLength; ++ VendorDataLength = AcpiUtReadUint16 (&Namesp->VendorDataLength); + VendorDataOffset = +- Namesp->DeviceIdOffset + Namesp->DeviceIdLength; ++ 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)) +@@ -2274,12 +2276,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); +@@ -2294,12 +2296,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)) +@@ -2316,8 +2320,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-20210604/source/compiler/dttable2.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -1493,6 +1493,7 @@ DtCompileSdev ( + UINT32 EntryCount; + ACPI_SDEV_SECURE_COMPONENT *SecureComponent = NULL; + UINT16 ComponentLength = 0; ++ UINT16 Tmp16; + + + /* Subtables */ +@@ -1514,7 +1515,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) + { +@@ -1687,6 +1688,18 @@ DtCompileSdev ( + } + } + ++ /* 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: +@@ -1749,6 +1762,18 @@ DtCompileSdev ( + SdevHeader->Length = + 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: diff --git a/0025-Support-HMAT-in-a-big-endian-world.patch b/0028-Support-HMAT-in-a-big-endian-world.patch similarity index 75% rename from 0025-Support-HMAT-in-a-big-endian-world.patch rename to 0028-Support-HMAT-in-a-big-endian-world.patch index 39ebf62..eb37f70 100644 --- a/0025-Support-HMAT-in-a-big-endian-world.patch +++ b/0028-Support-HMAT-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 03425774d2c19874ad4483ec6b7e13c0146e81f7 Mon Sep 17 00:00:00 2001 +From 915b8b70726fd01befdeac0c8630db528ac40552 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 25 Sep 2020 16:56:55 -0600 -Subject: [PATCH 25/40] Support HMAT in a big-endian world +Subject: [PATCH 28/45] Support HMAT in a big-endian world Signed-off-by: Al Stone --- @@ -9,15 +9,15 @@ Signed-off-by: Al Stone source/compiler/dttable1.c | 24 ++++++++++--- 2 files changed, 59 insertions(+), 35 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump1.c +Index: acpica-unix2-20210604/source/common/dmtbdump1.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump1.c -+++ acpica-unix2-20200925/source/common/dmtbdump1.c -@@ -1301,37 +1301,45 @@ AcpiDmDumpHmat ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -1379,37 +1379,45 @@ AcpiDmDumpHmat ( UINT32 Length; ACPI_DMTABLE_INFO *InfoTable; UINT32 i, j; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT16 HmatStructType; + UINT32 HmatStructLength; + UINT32 InitPDs; @@ -44,7 +44,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset); - if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE)) -+ HmatStructLength = AcpiUtReadUint32(&HmatStruct->Length); ++ HmatStructLength = AcpiUtReadUint32 (&HmatStruct->Length); + if (HmatStructLength < sizeof (ACPI_HMAT_STRUCTURE)) { AcpiOsPrintf ("Invalid HMAT structure length\n"); @@ -60,12 +60,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c } - switch (HmatStruct->Type) -+ HmatStructType = AcpiUtReadUint16(&HmatStruct->Type); ++ HmatStructType = AcpiUtReadUint16 (&HmatStruct->Type); + switch (HmatStructType) { case ACPI_HMAT_TYPE_ADDRESS_RANGE: -@@ -1354,7 +1362,7 @@ AcpiDmDumpHmat ( +@@ -1432,7 +1440,7 @@ AcpiDmDumpHmat ( default: AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n", @@ -74,7 +74,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c /* Attempt to continue */ -@@ -1363,13 +1371,13 @@ AcpiDmDumpHmat ( +@@ -1441,13 +1449,13 @@ AcpiDmDumpHmat ( /* Dump HMAT structure body */ @@ -91,7 +91,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c if (ACPI_FAILURE (Status)) { return; -@@ -1377,7 +1385,7 @@ AcpiDmDumpHmat ( +@@ -1455,7 +1463,7 @@ AcpiDmDumpHmat ( /* Dump HMAT structure additionals */ @@ -100,15 +100,15 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c { case ACPI_HMAT_TYPE_LOCALITY: -@@ -1386,15 +1394,16 @@ AcpiDmDumpHmat ( +@@ -1464,15 +1472,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)) ++ InitPDs = AcpiUtReadUint32 (&HmatLocality->NumberOfInitiatorPDs); ++ if ((UINT32) (HmatStructLength - SubtableOffset) < ++ (UINT32) (InitPDs * 4)) { AcpiOsPrintf ("Invalid initiator proximity domain number\n"); return; @@ -121,15 +121,15 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1a); if (ACPI_FAILURE (Status)) -@@ -1407,15 +1416,16 @@ AcpiDmDumpHmat ( +@@ -1485,15 +1494,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)) ++ TgtPDs = AcpiUtReadUint32 (&HmatLocality->NumberOfTargetPDs); ++ if ((UINT32) (HmatStructLength - SubtableOffset) < ++ (UINT32) (TgtPDs * 4)) { AcpiOsPrintf ("Invalid target proximity domain number\n"); return; @@ -142,15 +142,15 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1b); if (ACPI_FAILURE (Status)) -@@ -1428,18 +1438,17 @@ AcpiDmDumpHmat ( +@@ -1506,18 +1516,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)) ++ if ((UINT32) (HmatStructLength - SubtableOffset) < ++ (UINT32) (InitPDs * TgtPDs * 2)) { AcpiOsPrintf ("Invalid latency/bandwidth entry number\n"); return; @@ -166,15 +166,15 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat1c); if (ACPI_FAILURE(Status)) -@@ -1459,15 +1468,16 @@ AcpiDmDumpHmat ( +@@ -1537,15 +1546,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)) ++ SMBIOSHandles = AcpiUtReadUint16 (&HmatCache->NumberOfSMBIOSHandles); ++ if ((UINT32) (HmatStructLength - SubtableOffset) < ++ (UINT32) (SMBIOSHandles * 2)) { AcpiOsPrintf ("Invalid SMBIOS handle number\n"); return; @@ -187,7 +187,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat2a); if (ACPI_FAILURE (Status)) -@@ -1487,6 +1497,6 @@ AcpiDmDumpHmat ( +@@ -1565,6 +1575,6 @@ AcpiDmDumpHmat ( NextSubtable: /* Point to next HMAT structure subtable */ @@ -195,11 +195,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump1.c + Offset += (HmatStructLength); } } -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/source/compiler/dttable1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable1.c -+++ acpica-unix2-20200925/source/compiler/dttable1.c -@@ -1295,6 +1295,8 @@ DtCompileHmat ( +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -1369,6 +1369,8 @@ DtCompileHmat ( UINT32 TgtPDNumber; UINT64 EntryNumber; UINT16 SMBIOSHandleNumber; @@ -208,17 +208,17 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c ParentTable = DtPeekSubtable (); -@@ -1325,7 +1327,8 @@ DtCompileHmat ( +@@ -1399,7 +1401,8 @@ DtCompileHmat ( /* Compile HMAT structure body */ - switch (HmatStruct->Type) -+ HmatStructType = AcpiUtReadUint16(&HmatStruct->Type); ++ HmatStructType = AcpiUtReadUint16 (&HmatStruct->Type); + switch (HmatStructType) { case ACPI_HMAT_TYPE_ADDRESS_RANGE: -@@ -1358,7 +1361,7 @@ DtCompileHmat ( +@@ -1432,7 +1435,7 @@ DtCompileHmat ( /* Compile HMAT structure additionals */ @@ -227,51 +227,51 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c { case ACPI_HMAT_TYPE_LOCALITY: -@@ -1384,7 +1387,7 @@ DtCompileHmat ( +@@ -1458,7 +1461,7 @@ DtCompileHmat ( HmatStruct->Length += Subtable->Length; IntPDNumber++; } - HmatLocality->NumberOfInitiatorPDs = IntPDNumber; -+ HmatLocality->NumberOfInitiatorPDs = AcpiUtReadUint32(&IntPDNumber); ++ HmatLocality->NumberOfInitiatorPDs = AcpiUtReadUint32 (&IntPDNumber); /* Compile target proximity domain list */ -@@ -1405,7 +1408,7 @@ DtCompileHmat ( +@@ -1479,7 +1482,7 @@ DtCompileHmat ( HmatStruct->Length += Subtable->Length; TgtPDNumber++; } - HmatLocality->NumberOfTargetPDs = TgtPDNumber; -+ HmatLocality->NumberOfTargetPDs = AcpiUtReadUint32(&TgtPDNumber); ++ HmatLocality->NumberOfTargetPDs = AcpiUtReadUint32 (&TgtPDNumber); /* Save start of the entries for reporting errors */ -@@ -1430,6 +1433,9 @@ DtCompileHmat ( - HmatStruct->Length += Subtable->Length; +@@ -1505,6 +1508,9 @@ DtCompileHmat ( EntryNumber++; } -+ -+ Length = AcpiUtReadUint32(&HmatStruct->Length); -+ HmatStruct->Length = Length; ++ Length = AcpiUtReadUint32 (&HmatStruct->Length); ++ HmatStruct->Length = Length; ++ /* Validate number of entries */ -@@ -1464,11 +1470,19 @@ DtCompileHmat ( + if (EntryNumber != +@@ -1538,11 +1544,19 @@ DtCompileHmat ( HmatStruct->Length += Subtable->Length; SMBIOSHandleNumber++; } - HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber; -+ HmatCache->NumberOfSMBIOSHandles = -+ AcpiUtReadUint16(&SMBIOSHandleNumber); ++ HmatCache->NumberOfSMBIOSHandles = ++ AcpiUtReadUint16 (&SMBIOSHandleNumber); + -+ Length = AcpiUtReadUint32(&HmatStruct->Length); -+ HmatStruct->Length = Length; ++ Length = AcpiUtReadUint32 (&HmatStruct->Length); ++ HmatStruct->Length = Length; + break; default: -+ Length = AcpiUtReadUint32(&HmatStruct->Length); -+ HmatStruct->Length = Length; ++ Length = AcpiUtReadUint32(&HmatStruct->Length); ++ HmatStruct->Length = Length; + break; } diff --git a/0026-Support-PDTT-in-a-big-endian-world.patch b/0029-Support-PDTT-in-a-big-endian-world.patch similarity index 73% rename from 0026-Support-PDTT-in-a-big-endian-world.patch rename to 0029-Support-PDTT-in-a-big-endian-world.patch index 5b4269f..8511288 100644 --- a/0026-Support-PDTT-in-a-big-endian-world.patch +++ b/0029-Support-PDTT-in-a-big-endian-world.patch @@ -1,23 +1,23 @@ -From afaa9043357a3b8adbaa1ea389a62da48f561896 Mon Sep 17 00:00:00 2001 +From 253fe3545e7d4eaa9cb93c771c9619f410109a02 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 25 Sep 2020 17:03:05 -0600 -Subject: [PATCH 26/40] Support PDTT in a big-endian world +Subject: [PATCH 29/45] Support PDTT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -1385,13 +1385,13 @@ AcpiDmDumpPdtt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -1498,13 +1498,13 @@ AcpiDmDumpPdtt ( { ACPI_STATUS Status; ACPI_PDTT_CHANNEL *Subtable; - UINT32 Length = Table->Length; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_PDTT); @@ -28,7 +28,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -1400,10 +1400,10 @@ AcpiDmDumpPdtt ( +@@ -1513,10 +1513,10 @@ AcpiDmDumpPdtt ( /* Subtables. Currently there is only one type, but can be multiples */ Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset); diff --git a/0027-Support-PPTT-in-a-big-endian-world.patch b/0030-Support-PPTT-in-a-big-endian-world.patch similarity index 69% rename from 0027-Support-PPTT-in-a-big-endian-world.patch rename to 0030-Support-PPTT-in-a-big-endian-world.patch index a047d45..c4d062a 100644 --- a/0027-Support-PPTT-in-a-big-endian-world.patch +++ b/0030-Support-PPTT-in-a-big-endian-world.patch @@ -1,28 +1,28 @@ -From c5d7294c6deb7fe87eac981234d4c484313d5e40 Mon Sep 17 00:00:00 2001 +From 8923211d8bc1b0e4d3af6ff31ed6479057f612f6 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 25 Sep 2020 17:16:12 -0600 -Subject: [PATCH 27/40] Support PPTT in a big-endian world +Subject: [PATCH 30/45] Support PPTT in a big-endian world Signed-off-by: Al Stone --- - source/common/dmtbdump2.c | 15 +++++++++------ + source/common/dmtbdump2.c | 17 ++++++++++------- source/compiler/dttable2.c | 7 +++++-- - 2 files changed, 14 insertions(+), 8 deletions(-) + 2 files changed, 15 insertions(+), 9 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -1649,6 +1649,8 @@ AcpiDmDumpPptt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -1785,6 +1785,8 @@ AcpiDmDumpPptt ( UINT32 Offset = sizeof (ACPI_TABLE_FPDT); ACPI_DMTABLE_INFO *InfoTable; UINT32 i; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT32 NumPrivRes; /* There is no main table (other than the standard ACPI header) */ -@@ -1656,7 +1658,7 @@ AcpiDmDumpPptt ( +@@ -1792,7 +1794,7 @@ AcpiDmDumpPptt ( /* Subtables */ Offset = sizeof (ACPI_TABLE_HEADER); @@ -31,7 +31,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c { AcpiOsPrintf ("\n"); -@@ -1668,7 +1670,7 @@ AcpiDmDumpPptt ( +@@ -1804,7 +1806,7 @@ AcpiDmDumpPptt ( AcpiOsPrintf ("Invalid subtable length\n"); return; } @@ -40,7 +40,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c Subtable->Length, AcpiDmTableInfoPpttHdr); if (ACPI_FAILURE (Status)) { -@@ -1710,7 +1712,7 @@ AcpiDmDumpPptt ( +@@ -1846,7 +1848,7 @@ AcpiDmDumpPptt ( AcpiOsPrintf ("Invalid subtable length\n"); return; } @@ -49,14 +49,15 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { -@@ -1726,15 +1728,16 @@ AcpiDmDumpPptt ( +@@ -1862,15 +1864,16 @@ AcpiDmDumpPptt ( /* Dump SMBIOS handles */ -+ NumPrivRes = AcpiUtReadUint32(&PpttProcessor->NumberOfPrivResources); - if ((UINT8)(Subtable->Length - SubtableOffset) < +- if ((UINT8)(Subtable->Length - SubtableOffset) < - (UINT8)(PpttProcessor->NumberOfPrivResources * 4)) -+ (UINT8)(NumPrivRes * 4)) ++ NumPrivRes = AcpiUtReadUint32 (&PpttProcessor->NumberOfPrivResources); ++ if ((UINT8) (Subtable->Length - SubtableOffset) < ++ (UINT8) (NumPrivRes * 4)) { AcpiOsPrintf ("Invalid private resource number\n"); return; @@ -69,19 +70,19 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 4, AcpiDmTableInfoPptt0a); if (ACPI_FAILURE (Status)) -Index: acpica-unix2-20200925/source/compiler/dttable2.c +Index: acpica-unix2-20210604/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; +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -1123,6 +1123,7 @@ DtCompilePptt ( DT_FIELD **PFieldList = (DT_FIELD **) List; DT_FIELD *SubtableStart; + ACPI_TABLE_HEADER *PpttAcpiHeader; + UINT32 NumPrivRes; ParentTable = DtPeekSubtable (); -@@ -1092,7 +1093,7 @@ DtCompilePptt ( +@@ -1187,7 +1188,7 @@ DtCompilePptt ( { /* Compile initiator proximity domain list */ @@ -90,7 +91,7 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c while (*PFieldList) { Status = DtCompileTable (PFieldList, -@@ -1108,8 +1109,10 @@ DtCompilePptt ( +@@ -1203,8 +1204,10 @@ DtCompilePptt ( DtInsertSubtable (ParentTable, Subtable); PpttHeader->Length += (UINT8)(Subtable->Length); @@ -98,7 +99,7 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c + NumPrivRes++; } + PpttProcessor->NumberOfPrivResources = -+ AcpiUtReadUint32(&NumPrivRes); ++ AcpiUtReadUint32 (&NumPrivRes); } break; diff --git a/0028-Support-PCCT-in-a-big-endian-world.patch b/0031-Support-PCCT-in-a-big-endian-world.patch similarity index 75% rename from 0028-Support-PCCT-in-a-big-endian-world.patch rename to 0031-Support-PCCT-in-a-big-endian-world.patch index 49607ea..00d908e 100644 --- a/0028-Support-PCCT-in-a-big-endian-world.patch +++ b/0031-Support-PCCT-in-a-big-endian-world.patch @@ -1,23 +1,23 @@ -From 661f59c00e991553fb3f5fe7786eb0e2f640805c Mon Sep 17 00:00:00 2001 +From a58ff76fc6e68488d93b55016a7aeb257971a252 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 25 Sep 2020 17:39:34 -0600 -Subject: [PATCH 28/40] Support PCCT in a big-endian world +Subject: [PATCH 31/45] Support PCCT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -1286,13 +1286,13 @@ AcpiDmDumpPcct ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -1394,13 +1394,13 @@ AcpiDmDumpPcct ( ACPI_STATUS Status; ACPI_PCCT_SUBSPACE *Subtable; ACPI_DMTABLE_INFO *InfoTable; - UINT32 Length = Table->Length; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_PCCT); @@ -28,7 +28,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -1301,12 +1301,12 @@ AcpiDmDumpPcct ( +@@ -1409,12 +1409,12 @@ AcpiDmDumpPcct ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); @@ -43,7 +43,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c Subtable->Header.Length, AcpiDmTableInfoPcctHdr); if (ACPI_FAILURE (Status)) { -@@ -1349,7 +1349,7 @@ AcpiDmDumpPcct ( +@@ -1462,7 +1462,7 @@ AcpiDmDumpPcct ( } AcpiOsPrintf ("\n"); diff --git a/0032-Support-SLIC-and-MSDM-in-a-big-endian-world.patch b/0032-Support-SLIC-and-MSDM-in-a-big-endian-world.patch deleted file mode 100644 index bc20a15..0000000 --- a/0032-Support-SLIC-and-MSDM-in-a-big-endian-world.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0455d918688d9d208644d7f5f6f10d6199486e9c Mon Sep 17 00:00:00 2001 -From: Al Stone -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 ---- - 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); - } - - diff --git a/0029-Support-WDAT-in-a-big-endian-world.patch b/0032-Support-WDAT-in-a-big-endian-world.patch similarity index 72% rename from 0029-Support-WDAT-in-a-big-endian-world.patch rename to 0032-Support-WDAT-in-a-big-endian-world.patch index 3e0661c..d28ec57 100644 --- a/0029-Support-WDAT-in-a-big-endian-world.patch +++ b/0032-Support-WDAT-in-a-big-endian-world.patch @@ -1,22 +1,22 @@ -From 520e143b2bacb39032c06a33f61ae05583be6b2a Mon Sep 17 00:00:00 2001 +From ff1449919ee7d395d301e3a56a4ba333604d0458 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Fri, 25 Sep 2020 18:13:20 -0600 -Subject: [PATCH 29/40] Support WDAT in a big-endian world +Subject: [PATCH 32/45] Support WDAT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump3.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump3.c +Index: acpica-unix2-20210604/source/common/dmtbdump3.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump3.c -+++ acpica-unix2-20200925/source/common/dmtbdump3.c -@@ -568,11 +568,12 @@ AcpiDmDumpWdat ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/source/common/dmtbdump3.c +@@ -675,11 +675,12 @@ AcpiDmDumpWdat ( ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_WDAT); ACPI_WDAT_ENTRY *Subtable; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ @@ -26,7 +26,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c if (ACPI_FAILURE (Status)) { return; -@@ -581,12 +582,12 @@ AcpiDmDumpWdat ( +@@ -688,12 +689,12 @@ AcpiDmDumpWdat ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset); diff --git a/0030-Support-TCPA-in-a-big-endian-world.patch b/0033-Support-TCPA-in-a-big-endian-world.patch similarity index 70% rename from 0030-Support-TCPA-in-a-big-endian-world.patch rename to 0033-Support-TCPA-in-a-big-endian-world.patch index 4c9780e..21e8818 100644 --- a/0030-Support-TCPA-in-a-big-endian-world.patch +++ b/0033-Support-TCPA-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From b2e9a4397077ad56fea5a8b3f9f63ce3be65ae48 Mon Sep 17 00:00:00 2001 +From b69b833f5a9205080b27d83379a31fad7fca1575 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sun, 27 Sep 2020 12:09:28 -0600 -Subject: [PATCH 30/40] Support TCPA in a big-endian world +Subject: [PATCH 33/45] Support TCPA in a big-endian world Signed-off-by: Al Stone --- @@ -9,15 +9,15 @@ Signed-off-by: Al Stone source/compiler/dttable2.c | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump3.c +Index: acpica-unix2-20210604/source/common/dmtbdump3.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump3.c -+++ acpica-unix2-20200925/source/common/dmtbdump3.c -@@ -342,11 +342,13 @@ AcpiDmDumpTcpa ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/source/common/dmtbdump3.c +@@ -401,11 +401,13 @@ AcpiDmDumpTcpa ( ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR ( ACPI_TABLE_TCPA_HDR, Table, Offset); ACPI_STATUS Status; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT16 PlatformClass; @@ -28,12 +28,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c 0, AcpiDmTableInfoTcpaHdr); if (ACPI_FAILURE (Status)) { -@@ -357,18 +359,19 @@ AcpiDmDumpTcpa ( +@@ -416,18 +418,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); ++ PlatformClass = AcpiUtReadUint16 (&CommonHeader->PlatformClass); + switch (PlatformClass) { case ACPI_TCPA_CLIENT_TABLE: @@ -52,11 +52,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c break; default: -Index: acpica-unix2-20200925/source/compiler/dttable2.c +Index: acpica-unix2-20210604/source/compiler/dttable2.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable2.c -+++ acpica-unix2-20200925/source/compiler/dttable2.c -@@ -1773,6 +1773,7 @@ DtCompileTcpa ( +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -2139,6 +2139,7 @@ DtCompileTcpa ( ACPI_TABLE_TCPA_HDR *TcpaHeader; DT_SUBTABLE *ParentTable; ACPI_STATUS Status; @@ -64,12 +64,12 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c /* Compile the main table */ -@@ -1793,7 +1794,8 @@ DtCompileTcpa ( +@@ -2159,7 +2160,8 @@ DtCompileTcpa ( */ TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer); - switch (TcpaHeader->PlatformClass) -+ PlatformClass = AcpiUtReadUint16(&TcpaHeader->PlatformClass); ++ PlatformClass = AcpiUtReadUint16 (&TcpaHeader->PlatformClass); + switch (PlatformClass) { case ACPI_TCPA_CLIENT_TABLE: diff --git a/0031-Support-STAO-in-a-big-endian-world.patch b/0034-Support-STAO-in-a-big-endian-world.patch similarity index 74% rename from 0031-Support-STAO-in-a-big-endian-world.patch rename to 0034-Support-STAO-in-a-big-endian-world.patch index 7ea55bc..e338c5f 100644 --- a/0031-Support-STAO-in-a-big-endian-world.patch +++ b/0034-Support-STAO-in-a-big-endian-world.patch @@ -1,23 +1,23 @@ -From 63fc38478f12b8c8b0d263d25f72ff7538fba2ce Mon Sep 17 00:00:00 2001 +From c313a76ce818135f02ab158a9f0c8e4b8e96698a Mon Sep 17 00:00:00 2001 From: Al Stone Date: Mon, 28 Sep 2020 11:49:42 -0600 -Subject: [PATCH 31/40] Support STAO in a big-endian world +Subject: [PATCH 34/45] Support STAO in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump3.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump3.c +Index: acpica-unix2-20210604/source/common/dmtbdump3.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump3.c -+++ acpica-unix2-20200925/source/common/dmtbdump3.c +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/source/common/dmtbdump3.c @@ -285,14 +285,14 @@ AcpiDmDumpStao ( { ACPI_STATUS Status; char *Namepath; - UINT32 Length = Table->Length; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); UINT32 StringLength; UINT32 Offset = sizeof (ACPI_TABLE_STAO); diff --git a/0035-Support-PMTT-in-a-big-endian-world.patch b/0035-Support-PMTT-in-a-big-endian-world.patch deleted file mode 100644 index b6aaee6..0000000 --- a/0035-Support-PMTT-in-a-big-endian-world.patch +++ /dev/null @@ -1,216 +0,0 @@ -From b55af37d2419fc5ea630774f49b4ed9b724451b3 Mon Sep 17 00:00:00 2001 -From: Al Stone -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 ---- - 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) - { diff --git a/0035-Support-SLIC-and-MSDM-in-a-big-endian-world.patch b/0035-Support-SLIC-and-MSDM-in-a-big-endian-world.patch new file mode 100644 index 0000000..3f8fa6d --- /dev/null +++ b/0035-Support-SLIC-and-MSDM-in-a-big-endian-world.patch @@ -0,0 +1,33 @@ +From 948bebd1a0999bc3481641d3fc996c49432709c6 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Mon, 28 Sep 2020 12:49:23 -0600 +Subject: [PATCH 35/45] Support SLIC and MSDM in a big-endian world + +When dumping the SLIC table, it was also found that the code was +not starting at the proper offset on disassembly. Set the offset +to the first byte after the header instead of the very beginning +of the table. + +Signed-off-by: Al Stone +--- + source/common/dmtbdump3.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +Index: acpica-unix2-20210604/source/common/dmtbdump3.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/source/common/dmtbdump3.c +@@ -68,9 +68,11 @@ 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), ++ (void *) (Table + sizeof (*Table)), ++ TableLength - sizeof (*Table), AcpiDmTableInfoSlic); + } + + diff --git a/0033-Support-MCFG-in-a-big-endian-world.patch b/0036-Support-MCFG-in-a-big-endian-world.patch similarity index 77% rename from 0033-Support-MCFG-in-a-big-endian-world.patch rename to 0036-Support-MCFG-in-a-big-endian-world.patch index f50441b..c5a30da 100644 --- a/0033-Support-MCFG-in-a-big-endian-world.patch +++ b/0036-Support-MCFG-in-a-big-endian-world.patch @@ -1,22 +1,22 @@ -From 0fecc447cd64bf9da3345b2912e41e6005eb1011 Mon Sep 17 00:00:00 2001 +From 0fb79a24fb70ab1e1e4879220af82a9fa00af586 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Mon, 28 Sep 2020 13:01:18 -0600 -Subject: [PATCH 33/40] Support MCFG in a big-endian world +Subject: [PATCH 36/45] Support MCFG in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump2.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -769,11 +769,12 @@ AcpiDmDumpMcfg ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -930,11 +930,12 @@ AcpiDmDumpMcfg ( ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MCFG); ACPI_MCFG_ALLOCATION *Subtable; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ @@ -26,7 +26,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -782,17 +783,17 @@ AcpiDmDumpMcfg ( +@@ -943,17 +944,17 @@ AcpiDmDumpMcfg ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); diff --git a/0037-Support-IVRS-in-a-big-endian-world.patch b/0037-Support-IVRS-in-a-big-endian-world.patch deleted file mode 100644 index 53f8bf2..0000000 --- a/0037-Support-IVRS-in-a-big-endian-world.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 49b3d77990241c7216412d78e52cf15b3aa6d1ad Mon Sep 17 00:00:00 2001 -From: Al Stone -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 ---- - 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); - } - } - diff --git a/0034-Support-LPIT-in-a-big-endian-world.patch b/0037-Support-LPIT-in-a-big-endian-world.patch similarity index 72% rename from 0034-Support-LPIT-in-a-big-endian-world.patch rename to 0037-Support-LPIT-in-a-big-endian-world.patch index fd68c2a..e5e83d3 100644 --- a/0034-Support-LPIT-in-a-big-endian-world.patch +++ b/0037-Support-LPIT-in-a-big-endian-world.patch @@ -1,27 +1,27 @@ -From b521edcfceab513a900a000aa462d7f86b65a040 Mon Sep 17 00:00:00 2001 +From d10bfd67b5352ff5587e06fc1f82b896bab49614 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Mon, 28 Sep 2020 16:49:30 -0600 -Subject: [PATCH 34/40] Support LPIT in a big-endian world +Subject: [PATCH 37/45] Support LPIT in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -534,7 +534,7 @@ AcpiDmDumpLpit ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -690,7 +690,7 @@ AcpiDmDumpLpit ( { ACPI_STATUS Status; ACPI_LPIT_HEADER *Subtable; - UINT32 Length = Table->Length; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); UINT32 Offset = sizeof (ACPI_TABLE_LPIT); ACPI_DMTABLE_INFO *InfoTable; UINT32 SubtableLength; -@@ -543,11 +543,11 @@ AcpiDmDumpLpit ( +@@ -699,11 +699,11 @@ AcpiDmDumpLpit ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset); @@ -35,7 +35,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr); if (ACPI_FAILURE (Status)) { -@@ -571,7 +571,7 @@ AcpiDmDumpLpit ( +@@ -727,7 +727,7 @@ AcpiDmDumpLpit ( return; } diff --git a/0038-Support-PMTT-in-a-big-endian-world.patch b/0038-Support-PMTT-in-a-big-endian-world.patch new file mode 100644 index 0000000..4c6338c --- /dev/null +++ b/0038-Support-PMTT-in-a-big-endian-world.patch @@ -0,0 +1,85 @@ +From bd19995fa268ed3e93c071162d0e9c2d35ada0d4 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Tue, 29 Jun 2021 16:23:30 -0600 +Subject: [PATCH 38/45] Support PMTT in a big-endian world + +Signed-off-by: Al Stone +--- + source/common/dmtbdump2.c | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +Index: acpica-unix2-20210604/source/common/dmtbdump2.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -1686,8 +1686,9 @@ AcpiDmDumpPmtt ( + { + ACPI_STATUS Status; + ACPI_PMTT_HEADER *Subtable; +- UINT32 Length = Table->Length; ++ UINT32 Length = AcpiUtReadUint32 (&Table->Length); + UINT32 Offset = sizeof (ACPI_TABLE_PMTT); ++ UINT16 SubtableLength; + + + /* Main table */ +@@ -1701,17 +1702,18 @@ AcpiDmDumpPmtt ( + /* Subtables */ + + Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); +- while (Offset < Table->Length) ++ while (Offset < Length) + { + /* Each of the types below contain the common subtable header */ + + AcpiOsPrintf ("\n"); ++ SubtableLength = AcpiUtReadUint16 (&Subtable->Length); + switch (Subtable->Type) + { + case ACPI_PMTT_TYPE_SOCKET: + + Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoPmtt0); ++ SubtableLength, AcpiDmTableInfoPmtt0); + if (ACPI_FAILURE (Status)) + { + return; +@@ -1720,7 +1722,7 @@ AcpiDmDumpPmtt ( + + case ACPI_PMTT_TYPE_CONTROLLER: + Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoPmtt1); ++ SubtableLength, AcpiDmTableInfoPmtt1); + if (ACPI_FAILURE (Status)) + { + return; +@@ -1729,7 +1731,7 @@ AcpiDmDumpPmtt ( + + case ACPI_PMTT_TYPE_DIMM: + Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoPmtt2); ++ SubtableLength, AcpiDmTableInfoPmtt2); + if (ACPI_FAILURE (Status)) + { + return; +@@ -1738,7 +1740,7 @@ AcpiDmDumpPmtt ( + + case ACPI_PMTT_TYPE_VENDOR: + Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoPmttVendor); ++ SubtableLength, AcpiDmTableInfoPmttVendor); + if (ACPI_FAILURE (Status)) + { + return; +@@ -1754,9 +1756,9 @@ AcpiDmDumpPmtt ( + + /* Point to next subtable */ + +- Offset += Subtable->Length; ++ Offset += SubtableLength; + Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, +- Subtable, Subtable->Length); ++ Subtable, SubtableLength); + } + } + diff --git a/0039-Add-partial-big-endian-support-for-WPBT-tables.patch b/0039-Add-partial-big-endian-support-for-WPBT-tables.patch deleted file mode 100644 index 3207b7d..0000000 --- a/0039-Add-partial-big-endian-support-for-WPBT-tables.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 9d7f9c8f4ecbee2e621d471a8c4944cebe62947d Mon Sep 17 00:00:00 2001 -From: Al Stone -Date: Wed, 30 Sep 2020 18:59:57 -0600 -Subject: [PATCH 1/5] 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 ---- - 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; - diff --git a/0038-Support-TPM2-in-a-big-endian-world.patch b/0039-Support-TPM2-in-a-big-endian-world.patch similarity index 74% rename from 0038-Support-TPM2-in-a-big-endian-world.patch rename to 0039-Support-TPM2-in-a-big-endian-world.patch index b0298bb..08e3522 100644 --- a/0038-Support-TPM2-in-a-big-endian-world.patch +++ b/0039-Support-TPM2-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From 1e1129d788087025cf31b0c3babdb9bca01f1c4e Mon Sep 17 00:00:00 2001 +From c240ab3af6a4ad4405def7188e3d64da06a69f37 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Wed, 30 Sep 2020 18:42:38 -0600 -Subject: [PATCH 38/40] Support TPM2 in a big-endian world +Subject: [PATCH 39/45] Support TPM2 in a big-endian world Signed-off-by: Al Stone --- @@ -9,15 +9,15 @@ Signed-off-by: Al Stone source/compiler/dttable2.c | 8 +++++--- 2 files changed, 15 insertions(+), 11 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump3.c +Index: acpica-unix2-20210604/source/common/dmtbdump3.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump3.c -+++ acpica-unix2-20200925/source/common/dmtbdump3.c -@@ -409,11 +409,12 @@ AcpiDmDumpTpm2Rev3 ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/source/common/dmtbdump3.c +@@ -470,11 +470,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); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ @@ -27,7 +27,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c if (ACPI_FAILURE (Status)) { return; -@@ -425,8 +426,8 @@ AcpiDmDumpTpm2Rev3 ( +@@ -486,8 +487,8 @@ AcpiDmDumpTpm2Rev3 ( { case ACPI_TPM23_ACPI_START_METHOD: @@ -38,15 +38,15 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c break; default: -@@ -456,6 +457,7 @@ AcpiDmDumpTpm2 ( +@@ -517,6 +518,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); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); if (Table->Revision == 3) -@@ -466,7 +468,7 @@ AcpiDmDumpTpm2 ( +@@ -527,7 +529,7 @@ AcpiDmDumpTpm2 ( /* Main table */ @@ -55,7 +55,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c if (ACPI_FAILURE (Status)) { -@@ -474,8 +476,8 @@ AcpiDmDumpTpm2 ( +@@ -535,8 +537,8 @@ AcpiDmDumpTpm2 ( } AcpiOsPrintf ("\n"); @@ -66,7 +66,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c if (ACPI_FAILURE (Status)) { return; -@@ -490,8 +492,8 @@ AcpiDmDumpTpm2 ( +@@ -551,8 +553,8 @@ AcpiDmDumpTpm2 ( Offset += sizeof (ACPI_TPM2_TRAILER); AcpiOsPrintf ("\n"); @@ -77,11 +77,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump3.c break; default: -Index: acpica-unix2-20200925/source/compiler/dttable2.c +Index: acpica-unix2-20210604/source/compiler/dttable2.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable2.c -+++ acpica-unix2-20200925/source/compiler/dttable2.c -@@ -1904,6 +1904,7 @@ DtCompileTpm2 ( +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -2267,6 +2267,7 @@ DtCompileTpm2 ( DT_SUBTABLE *ParentTable; ACPI_STATUS Status = AE_OK; ACPI_TABLE_HEADER *Header; @@ -89,17 +89,17 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c ParentTable = DtPeekSubtable (); -@@ -1947,7 +1948,8 @@ DtCompileTpm2 ( +@@ -2310,7 +2311,8 @@ DtCompileTpm2 ( /* Subtable type depends on the StartMethod */ - switch (Tpm2Header->StartMethod) -+ StartMethod = *(UINT8 *)&Tpm2Header->StartMethod; ++ StartMethod = *(UINT8 *) &Tpm2Header->StartMethod; + switch (StartMethod) { case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC: -@@ -1978,7 +1980,7 @@ DtCompileTpm2 ( +@@ -2341,7 +2343,7 @@ DtCompileTpm2 ( case ACPI_TPM2_RESERVED10: AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n", @@ -108,7 +108,7 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c Status = AE_ERROR; break; -@@ -1986,7 +1988,7 @@ DtCompileTpm2 ( +@@ -2349,7 +2351,7 @@ DtCompileTpm2 ( default: AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n", diff --git a/0043-Support-S3PT-in-a-big-endian-world.patch b/0040-Support-S3PT-in-a-big-endian-world.patch similarity index 71% rename from 0043-Support-S3PT-in-a-big-endian-world.patch rename to 0040-Support-S3PT-in-a-big-endian-world.patch index b8c804e..07e0a24 100644 --- a/0043-Support-S3PT-in-a-big-endian-world.patch +++ b/0040-Support-S3PT-in-a-big-endian-world.patch @@ -1,27 +1,27 @@ -From 5805d42c0cec5366daa12e0f4caed7a58b13fe5b Mon Sep 17 00:00:00 2001 +From 9fc0e46189feb926b13713422ea2722e273a31b5 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Mon, 19 Oct 2020 17:30:30 -0400 -Subject: [PATCH 5/5] Support S3PT in a big-endian world +Subject: [PATCH 40/45] Support S3PT in a big-endian world --- source/common/dmtbdump2.c | 15 +++++++++------ source/compiler/dttable2.c | 4 +++- 2 files changed, 12 insertions(+), 7 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/source/common/dmtbdump2.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump2.c -+++ acpica-unix2-20200925/source/common/dmtbdump2.c -@@ -1809,6 +1809,8 @@ AcpiDmDumpS3pt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -2039,6 +2039,8 @@ AcpiDmDumpS3pt ( ACPI_FPDT_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables); -+ UINT32 S3ptTableLength = AcpiUtReadUint32(&S3ptTable->Length); ++ UINT32 S3ptTableLength = AcpiUtReadUint32 (&S3ptTable->Length); + UINT16 SubtableType; /* Main table */ -@@ -1820,19 +1822,20 @@ AcpiDmDumpS3pt ( +@@ -2050,19 +2052,20 @@ AcpiDmDumpS3pt ( } Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset); @@ -40,12 +40,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c } - switch (Subtable->Type) -+ SubtableType = AcpiUtReadUint16(&Subtable->Type); ++ SubtableType = AcpiUtReadUint16 (&Subtable->Type); + switch (SubtableType) { case ACPI_S3PT_TYPE_RESUME: -@@ -1847,7 +1850,7 @@ AcpiDmDumpS3pt ( +@@ -2077,7 +2080,7 @@ AcpiDmDumpS3pt ( default: AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", @@ -54,7 +54,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c /* Attempt to continue */ -@@ -1860,7 +1863,7 @@ AcpiDmDumpS3pt ( +@@ -2090,7 +2093,7 @@ AcpiDmDumpS3pt ( } AcpiOsPrintf ("\n"); @@ -63,7 +63,7 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { -@@ -1874,7 +1877,7 @@ NextSubtable: +@@ -2104,7 +2107,7 @@ NextSubtable: Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length); } @@ -72,11 +72,11 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c } -Index: acpica-unix2-20200925/source/compiler/dttable2.c +Index: acpica-unix2-20210604/source/compiler/dttable2.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/dttable2.c -+++ acpica-unix2-20200925/source/compiler/dttable2.c -@@ -1188,6 +1188,7 @@ DtCompileS3pt ( +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -1406,6 +1406,7 @@ DtCompileS3pt ( DT_SUBTABLE *ParentTable; ACPI_DMTABLE_INFO *InfoTable; DT_FIELD *SubtableStart; @@ -84,12 +84,12 @@ Index: acpica-unix2-20200925/source/compiler/dttable2.c Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt, -@@ -1215,7 +1216,8 @@ DtCompileS3pt ( +@@ -1433,7 +1434,8 @@ DtCompileS3pt ( S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer); - switch (S3ptHeader->Type) -+ S3ptHeaderType = AcpiUtReadUint16(&S3ptHeader->Type); ++ S3ptHeaderType = AcpiUtReadUint16 (&S3ptHeader->Type); + switch (S3ptHeaderType) { case ACPI_S3PT_TYPE_RESUME: diff --git a/0036-Support-IORT-in-a-big-endian-world.patch b/0041-Support-IORT-in-a-big-endian-world.patch similarity index 61% rename from 0036-Support-IORT-in-a-big-endian-world.patch rename to 0041-Support-IORT-in-a-big-endian-world.patch index e44456e..ccc6e77 100644 --- a/0036-Support-IORT-in-a-big-endian-world.patch +++ b/0041-Support-IORT-in-a-big-endian-world.patch @@ -1,20 +1,20 @@ -From 88d16feb9d6982cc9c09f2ae9b76b26f0d9c96e0 Mon Sep 17 00:00:00 2001 +From 5bd43bca1708a56d32e63da0278e04caf2865927 Mon Sep 17 00:00:00 2001 From: Al Stone -Date: Wed, 30 Sep 2020 17:48:04 -0600 -Subject: [PATCH 36/40] Support IORT in a big-endian world +Date: Tue, 29 Jun 2021 17:38:20 -0600 +Subject: [PATCH 41/45] Support IORT in a big-endian world Signed-off-by: Al Stone --- - source/common/dmtbdump2.c | 73 ++++++++++++++++++++++---------------- - source/compiler/dttable1.c | 37 ++++++++++--------- - 2 files changed, 64 insertions(+), 46 deletions(-) + source/common/dmtbdump2.c | 85 ++++++++++++++++++++++---------------- + source/compiler/dttable1.c | 40 ++++++++++-------- + 2 files changed, 72 insertions(+), 53 deletions(-) -Index: acpica-unix2-20200925/source/common/dmtbdump2.c +Index: acpica-unix2-20210604/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; +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -77,17 +77,20 @@ AcpiDmDumpIort ( + ACPI_IORT_RMR *IortRmr = NULL; UINT32 Offset; UINT32 NodeOffset; + UINT32 NodeLength; @@ -23,8 +23,9 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c char *String; UINT32 i; UINT32 MappingByteLength; + UINT8 Revision; + UINT32 MappingCount; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); /* Main table */ @@ -34,12 +35,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c if (ACPI_FAILURE (Status)) { return; -@@ -95,25 +98,26 @@ AcpiDmDumpIort ( +@@ -109,18 +112,19 @@ AcpiDmDumpIort ( /* Dump the OptionalPadding (optional) */ - if (Iort->NodeOffset > Offset) -+ NodeOffset = AcpiUtReadUint32(&Iort->NodeOffset); ++ NodeOffset = AcpiUtReadUint32 (&Iort->NodeOffset); + if (NodeOffset > Offset) { - Status = AcpiDmDumpTable (Table->Length, Offset, Table, @@ -54,54 +55,68 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c - Offset = Iort->NodeOffset; - while (Offset < Table->Length) -+ Offset = AcpiUtReadUint32(&Iort->NodeOffset); ++ 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)) +@@ -130,12 +134,12 @@ AcpiDmDumpIort ( + + if (Revision == 0) { -@@ -142,7 +146,7 @@ AcpiDmDumpIort ( +- Status = AcpiDmDumpTable (Table->Length, Offset, ++ Status = AcpiDmDumpTable (TableLength, Offset, + IortNode, Length, AcpiDmTableInfoIortHdr); + } + else if (Revision >= 3) + { +- Status = AcpiDmDumpTable (Table->Length, Offset, ++ Status = AcpiDmDumpTable (TableLength, Offset, + IortNode, Length, AcpiDmTableInfoIortHdr3); + } + +@@ -166,7 +170,7 @@ AcpiDmDumpIort ( case ACPI_IORT_NODE_PCI_ROOT_COMPLEX: InfoTable = AcpiDmTableInfoIort2; - Length = IortNode->Length - NodeOffset; -+ Length = AcpiUtReadUint16(&IortNode->Length) - NodeOffset; ++ Length = AcpiUtReadUint16 (&IortNode->Length) - NodeOffset; break; case ACPI_IORT_NODE_SMMU: -@@ -155,13 +159,13 @@ AcpiDmDumpIort ( +@@ -179,19 +183,19 @@ AcpiDmDumpIort ( case ACPI_IORT_NODE_SMMU_V3: InfoTable = AcpiDmTableInfoIort4; - Length = IortNode->Length - NodeOffset; -+ Length = AcpiUtReadUint16(&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; ++ Length = AcpiUtReadUint16 (&IortNode->Length) - NodeOffset; break; - default: -@@ -171,7 +175,7 @@ AcpiDmDumpIort ( + case ACPI_IORT_NODE_RMR: + + InfoTable = AcpiDmTableInfoIort6; +- Length = IortNode->Length - NodeOffset; ++ Length = AcpiUtReadUint16 (&IortNode->Length) - NodeOffset; + IortRmr = ACPI_ADD_PTR (ACPI_IORT_RMR, IortNode, NodeOffset); + break; + +@@ -202,7 +206,7 @@ AcpiDmDumpIort ( /* Attempt to continue */ - if (!IortNode->Length) -+ if (!AcpiUtReadUint16(&IortNode->Length)) ++ if (!AcpiUtReadUint16 (&IortNode->Length)) { AcpiOsPrintf ("Invalid zero length IORT node\n"); return; -@@ -182,7 +186,7 @@ AcpiDmDumpIort ( +@@ -213,7 +217,7 @@ AcpiDmDumpIort ( /* Dump the node subtable header */ AcpiOsPrintf ("\n"); @@ -110,13 +125,12 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), Length, InfoTable); if (ACPI_FAILURE (Status)) -@@ -202,9 +206,11 @@ AcpiDmDumpIort ( +@@ -233,9 +237,10 @@ AcpiDmDumpIort ( if (IortItsGroup) { - for (i = 0; i < IortItsGroup->ItsCount; i++) -+ UINT32 ItsCount = AcpiUtReadUint32(&IortItsGroup->ItsCount); -+ ++ UINT32 ItsCount = AcpiUtReadUint32 (&IortItsGroup->ItsCount); + for (i = 0; i < ItsCount; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, @@ -124,47 +138,47 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 4, AcpiDmTableInfoIort0a); if (ACPI_FAILURE (Status)) -@@ -221,12 +227,14 @@ AcpiDmDumpIort ( +@@ -252,12 +257,14 @@ AcpiDmDumpIort ( /* Dump the Padding (optional) */ - if (IortNode->Length > NodeOffset) -+ NodeLength = AcpiUtReadUint16(&IortNode->Length); ++ 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) * ++ 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 ( +@@ -274,9 +281,11 @@ AcpiDmDumpIort ( if (IortSmmu) { -+ UINT32 InterruptCount; ++ UINT32 InterruptCount; + Length = 2 * sizeof (UINT64); - NodeOffset = IortSmmu->GlobalInterruptOffset; - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, -+ NodeOffset = AcpiUtReadUint32(&IortSmmu->GlobalInterruptOffset); ++ 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 ( +@@ -284,10 +293,11 @@ AcpiDmDumpIort ( return; } - NodeOffset = IortSmmu->ContextInterruptOffset; - for (i = 0; i < IortSmmu->ContextInterruptCount; i++) -+ NodeOffset = AcpiUtReadUint32(&IortSmmu->ContextInterruptOffset); -+ InterruptCount = AcpiUtReadUint32(&IortSmmu->ContextInterruptCount); ++ NodeOffset = AcpiUtReadUint32 (&IortSmmu->ContextInterruptOffset); ++ InterruptCount = AcpiUtReadUint32 (&IortSmmu->ContextInterruptCount); + for (i = 0; i < InterruptCount; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, @@ -172,14 +186,14 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 8, AcpiDmTableInfoIort3b); if (ACPI_FAILURE (Status)) -@@ -267,10 +278,11 @@ AcpiDmDumpIort ( +@@ -298,10 +308,11 @@ AcpiDmDumpIort ( NodeOffset += 8; } - NodeOffset = IortSmmu->PmuInterruptOffset; - for (i = 0; i < IortSmmu->PmuInterruptCount; i++) -+ NodeOffset = AcpiUtReadUint32(&IortSmmu->PmuInterruptOffset); -+ InterruptCount = AcpiUtReadUint32(&IortSmmu->PmuInterruptCount); ++ NodeOffset = AcpiUtReadUint32 (&IortSmmu->PmuInterruptOffset); ++ InterruptCount = AcpiUtReadUint32 (&IortSmmu->PmuInterruptCount); + for (i = 0; i < InterruptCount; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, @@ -187,14 +201,33 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 8, AcpiDmTableInfoIort3c); if (ACPI_FAILURE (Status)) -@@ -290,12 +302,13 @@ AcpiDmDumpIort ( +@@ -319,12 +330,15 @@ AcpiDmDumpIort ( + /* Validate IortRmr to avoid compiler warnings */ + if (IortRmr) + { +- NodeOffset = IortRmr->RmrOffset; ++ UINT32 RmrCount; ++ ++ NodeOffset = AcpiUtReadUint32 (&IortRmr->RmrOffset); ++ RmrCount = AcpiUtReadUint32 (&IortRmr->RmrCount); + Length = sizeof (ACPI_IORT_RMR_DESC); +- for (i = 0; i < IortRmr->RmrCount; i++) ++ for (i = 0; i < RmrCount; i++) + { + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ++ Status = AcpiDmDumpTable (TableLength, Offset + NodeOffset, + ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), + Length, AcpiDmTableInfoIort6a); + if (ACPI_FAILURE (Status)) +@@ -344,12 +358,13 @@ AcpiDmDumpIort ( /* Dump the ID mappings */ - NodeOffset = IortNode->MappingOffset; - for (i = 0; i < IortNode->MappingCount; i++) -+ NodeOffset = AcpiUtReadUint32(&IortNode->MappingOffset); -+ MappingCount = AcpiUtReadUint32(&IortNode->MappingCount); ++ NodeOffset = AcpiUtReadUint32 (&IortNode->MappingOffset); ++ MappingCount = AcpiUtReadUint32 (&IortNode->MappingCount); + for (i = 0; i < MappingCount; i++) { AcpiOsPrintf ("\n"); @@ -204,28 +237,28 @@ Index: acpica-unix2-20200925/source/common/dmtbdump2.c ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), Length, AcpiDmTableInfoIortMap); if (ACPI_FAILURE (Status)) -@@ -309,7 +322,7 @@ AcpiDmDumpIort ( +@@ -363,7 +378,7 @@ AcpiDmDumpIort ( NextSubtable: /* Point to next node subtable */ - Offset += IortNode->Length; -+ Offset += AcpiUtReadUint16(&IortNode->Length); ++ Offset += AcpiUtReadUint16 (&IortNode->Length); } } -Index: acpica-unix2-20200925/source/compiler/dttable1.c +Index: acpica-unix2-20210604/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; +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -1592,6 +1592,7 @@ DtCompileIort ( ACPI_IORT_ITS_GROUP *IortItsGroup; ACPI_IORT_SMMU *IortSmmu; + ACPI_IORT_RMR *IortRmr; + UINT32 IortNodeOffset; UINT32 NodeNumber; UINT32 NodeLength; UINT32 IdMappingNumber; -@@ -1548,7 +1549,7 @@ DtCompileIort ( +@@ -1637,7 +1638,7 @@ DtCompileIort ( * Optionally allows the generic data types to be used for filling * this field. */ @@ -234,7 +267,7 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad, &Subtable); if (ACPI_FAILURE (Status)) -@@ -1558,7 +1559,7 @@ DtCompileIort ( +@@ -1647,7 +1648,7 @@ DtCompileIort ( if (Subtable) { DtInsertSubtable (ParentTable, Subtable); @@ -243,34 +276,32 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c } else { -@@ -1568,8 +1569,9 @@ DtCompileIort ( +@@ -1657,7 +1658,7 @@ DtCompileIort ( { return (Status); } - Iort->NodeOffset += PaddingLength; + IortNodeOffset += PaddingLength; } -+ Iort->NodeOffset = AcpiUtReadUint32(&IortNodeOffset); NodeNumber = 0; - while (*PFieldList) -@@ -1623,7 +1625,7 @@ DtCompileIort ( +@@ -1721,7 +1722,7 @@ DtCompileIort ( ItsNumber++; } - IortItsGroup->ItsCount = ItsNumber; -+ IortItsGroup->ItsCount = AcpiUtReadUint32(&ItsNumber); ++ IortItsGroup->ItsCount = AcpiUtReadUint32 (&ItsNumber); break; case ACPI_IORT_NODE_NAMED_COMPONENT: -@@ -1657,15 +1659,18 @@ DtCompileIort ( +@@ -1755,15 +1756,18 @@ DtCompileIort ( } else { - if (NodeLength > IortNode->MappingOffset) -+ UINT32 MappingOffset; ++ UINT32 MappingOffset; + -+ MappingOffset = IortNode->MappingOffset; ++ MappingOffset = IortNode->MappingOffset; + if (NodeLength > MappingOffset) { return (AE_BAD_DATA); @@ -285,7 +316,7 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c &Subtable); if (ACPI_FAILURE (Status)) { -@@ -1673,7 +1678,7 @@ DtCompileIort ( +@@ -1771,7 +1775,7 @@ DtCompileIort ( } DtInsertSubtable (ParentTable, Subtable); @@ -294,72 +325,90 @@ Index: acpica-unix2-20200925/source/compiler/dttable1.c } } break; -@@ -1706,7 +1711,7 @@ DtCompileIort ( +@@ -1804,7 +1808,7 @@ DtCompileIort ( /* Compile global interrupt array */ - IortSmmu->GlobalInterruptOffset = NodeLength; -+ IortSmmu->GlobalInterruptOffset = AcpiUtReadUint32(&NodeLength); ++ IortSmmu->GlobalInterruptOffset = AcpiUtReadUint32 (&NodeLength); Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a, &Subtable); if (ACPI_FAILURE (Status)) -@@ -1720,7 +1725,7 @@ DtCompileIort ( +@@ -1818,7 +1822,7 @@ DtCompileIort ( /* Compile context interrupt array */ ContextIrptNumber = 0; - IortSmmu->ContextInterruptOffset = NodeLength; -+ IortSmmu->ContextInterruptOffset = AcpiUtReadUint32(&NodeLength); ++ IortSmmu->ContextInterruptOffset = AcpiUtReadUint32 (&NodeLength); while (*PFieldList) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b, -@@ -1740,12 +1745,12 @@ DtCompileIort ( +@@ -1838,12 +1842,12 @@ DtCompileIort ( ContextIrptNumber++; } - IortSmmu->ContextInterruptCount = ContextIrptNumber; -+ IortSmmu->ContextInterruptCount = AcpiUtReadUint32(&ContextIrptNumber); ++ IortSmmu->ContextInterruptCount = AcpiUtReadUint32 (&ContextIrptNumber); /* Compile PMU interrupt array */ PmuIrptNumber = 0; - IortSmmu->PmuInterruptOffset = NodeLength; -+ IortSmmu->PmuInterruptOffset = AcpiUtReadUint32(&NodeLength); ++ IortSmmu->PmuInterruptOffset = AcpiUtReadUint32 (&NodeLength); while (*PFieldList) { Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c, -@@ -1765,7 +1770,7 @@ DtCompileIort ( +@@ -1863,7 +1867,7 @@ DtCompileIort ( PmuIrptNumber++; } - IortSmmu->PmuInterruptCount = PmuIrptNumber; -+ IortSmmu->PmuInterruptCount = AcpiUtReadUint32(&PmuIrptNumber); ++ IortSmmu->PmuInterruptCount = AcpiUtReadUint32 (&PmuIrptNumber); break; case ACPI_IORT_NODE_SMMU_V3: -@@ -1802,7 +1807,7 @@ DtCompileIort ( +@@ -1908,7 +1912,7 @@ DtCompileIort ( + /* Compile RMR Descriptors */ + + RmrCount = 0; +- IortRmr->RmrOffset = NodeLength; ++ IortRmr->RmrOffset = AcpiUtReadUint32 (&NodeLength); + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort6a, +@@ -1928,7 +1932,7 @@ DtCompileIort ( + RmrCount++; + } + +- IortRmr->RmrCount = RmrCount; ++ IortRmr->RmrCount = AcpiUtReadUint32 (&RmrCount); + break; + + default: +@@ -1939,7 +1943,7 @@ DtCompileIort ( /* Compile Array of ID mappings */ - IortNode->MappingOffset = NodeLength; -+ IortNode->MappingOffset = AcpiUtReadUint32(&NodeLength); ++ IortNode->MappingOffset = AcpiUtReadUint32 (&NodeLength); IdMappingNumber = 0; while (*PFieldList) { -@@ -1823,7 +1828,7 @@ DtCompileIort ( +@@ -1960,7 +1964,7 @@ DtCompileIort ( IdMappingNumber++; } - IortNode->MappingCount = IdMappingNumber; -+ IortNode->MappingCount = AcpiUtReadUint32(&IdMappingNumber); ++ IortNode->MappingCount = AcpiUtReadUint32 (&IdMappingNumber); if (!IdMappingNumber) { IortNode->MappingOffset = 0; -@@ -1838,7 +1843,7 @@ DtCompileIort ( +@@ -1975,7 +1979,7 @@ DtCompileIort ( NodeNumber++; } - Iort->NodeCount = NodeNumber; -+ Iort->NodeCount = AcpiUtReadUint32(&NodeNumber); ++ Iort->NodeCount = AcpiUtReadUint32 (&NodeNumber); return (AE_OK); } diff --git a/0041-Support-MTMR-in-a-big-endian-world.patch b/0041-Support-MTMR-in-a-big-endian-world.patch deleted file mode 100644 index c1245bd..0000000 --- a/0041-Support-MTMR-in-a-big-endian-world.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 62c6c5b94772b7f8f5de6136a2ba61e31d0c7b3c Mon Sep 17 00:00:00 2001 -From: Al Stone -Date: Fri, 16 Oct 2020 20:52:43 -0400 -Subject: [PATCH 3/5] Support MTMR in a big-endian world - -Signed-off-by: Al Stone ---- - 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 -@@ -1048,11 +1048,12 @@ AcpiDmDumpMtmr ( - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_MTMR); - ACPI_MTMR_ENTRY *Subtable; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); - - - /* Main table */ - -- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr); -+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMtmr); - if (ACPI_FAILURE (Status)) - { - return; -@@ -1061,12 +1062,12 @@ AcpiDmDumpMtmr ( - /* Subtables */ - - Subtable = ACPI_ADD_PTR (ACPI_MTMR_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_MTMR_ENTRY), AcpiDmTableInfoMtmr0); - if (ACPI_FAILURE (Status)) - { diff --git a/0042-Support-IVRS-in-a-big-endian-world.patch b/0042-Support-IVRS-in-a-big-endian-world.patch new file mode 100644 index 0000000..6d8bab7 --- /dev/null +++ b/0042-Support-IVRS-in-a-big-endian-world.patch @@ -0,0 +1,138 @@ +From b64cff82b2b33ed659826d777d2db039f64fd198 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Tue, 29 Jun 2021 17:45:24 -0600 +Subject: [PATCH 42/45] Support IVRS in a big-endian world + +Signed-off-by: Al Stone +--- + source/common/dmtbdump2.c | 34 +++++++++++++++++++--------------- + 1 file changed, 19 insertions(+), 15 deletions(-) + +Index: acpica-unix2-20210604/source/common/dmtbdump2.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c ++++ acpica-unix2-20210604/source/common/dmtbdump2.c +@@ -419,11 +419,14 @@ 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; +@@ -433,8 +436,9 @@ AcpiDmDumpIvrs ( + + Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); + +- while (Offset < Table->Length) ++ while (Offset < TableLength) + { ++ SubtableLength = AcpiUtReadUint16 (&Subtable->Length); + switch (Subtable->Type) + { + /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */ +@@ -471,7 +475,7 @@ AcpiDmDumpIvrs ( + + /* Attempt to continue */ + +- if (!Subtable->Length) ++ if (!SubtableLength) + { + AcpiOsPrintf ("Invalid zero length subtable\n"); + return; +@@ -481,8 +485,8 @@ AcpiDmDumpIvrs ( + + /* Dump the subtable */ + +- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, +- Subtable->Length, InfoTable); ++ Status = AcpiDmDumpTable (TableLength, Offset, Subtable, ++ SubtableLength, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; +@@ -511,7 +515,7 @@ AcpiDmDumpIvrs ( + + /* Process all of the Device Entries */ + +- while (EntryOffset < (Offset + Subtable->Length)) ++ while (EntryOffset < (Offset + SubtableLength)) + { + AcpiOsPrintf ("\n"); + +@@ -581,7 +585,7 @@ AcpiDmDumpIvrs ( + + /* Dump the Device Entry */ + +- Status = AcpiDmDumpTable (Table->Length, EntryOffset, ++ Status = AcpiDmDumpTable (TableLength, EntryOffset, + DeviceEntry, EntryLength, InfoTable); + if (ACPI_FAILURE (Status)) + { +@@ -605,12 +609,12 @@ AcpiDmDumpIvrs ( + */ + if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiHid)) + { +- Status = AcpiDmDumpTable (Table->Length, EntryOffset, ++ Status = AcpiDmDumpTable (TableLength, EntryOffset, + &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidInteger); + } + else + { +- Status = AcpiDmDumpTable (Table->Length, EntryOffset, ++ Status = AcpiDmDumpTable (TableLength, EntryOffset, + &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidString); + } + if (ACPI_FAILURE (Status)) +@@ -628,12 +632,12 @@ AcpiDmDumpIvrs ( + */ + if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiCid)) + { +- Status = AcpiDmDumpTable (Table->Length, EntryOffset, ++ Status = AcpiDmDumpTable (TableLength, EntryOffset, + &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidInteger); + } + else + { +- Status = AcpiDmDumpTable (Table->Length, EntryOffset, ++ Status = AcpiDmDumpTable (TableLength, EntryOffset, + &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidString); + } + if (ACPI_FAILURE (Status)) +@@ -650,7 +654,7 @@ AcpiDmDumpIvrs ( + + if (HidSubtable->UidType == ACPI_IVRS_UID_IS_STRING) + { +- Status = AcpiDmDumpTable (Table->Length, EntryOffset, ++ Status = AcpiDmDumpTable (TableLength, EntryOffset, + &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidString); + if (ACPI_FAILURE (Status)) + { +@@ -659,7 +663,7 @@ AcpiDmDumpIvrs ( + } + else /* ACPI_IVRS_UID_IS_INTEGER */ + { +- Status = AcpiDmDumpTable (Table->Length, EntryOffset, ++ Status = AcpiDmDumpTable (TableLength, EntryOffset, + &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidInteger); + if (ACPI_FAILURE (Status)) + { +@@ -678,8 +682,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); + } + } + diff --git a/0042-Support-VRTC-in-a-big-endian-world.patch b/0042-Support-VRTC-in-a-big-endian-world.patch deleted file mode 100644 index e66d27e..0000000 --- a/0042-Support-VRTC-in-a-big-endian-world.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 19eefeadf92a471f1c4fbc6dd4d035e45fa76dcd Mon Sep 17 00:00:00 2001 -From: Al Stone -Date: Mon, 19 Oct 2020 17:17:40 -0400 -Subject: [PATCH 4/5] Support VRTC in a big-endian world - ---- - 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 -@@ -521,11 +521,12 @@ AcpiDmDumpVrtc ( - ACPI_STATUS Status; - UINT32 Offset = sizeof (ACPI_TABLE_VRTC); - ACPI_VRTC_ENTRY *Subtable; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); - - - /* Main table */ - -- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc); -+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoVrtc); - if (ACPI_FAILURE (Status)) - { - return; -@@ -534,12 +535,12 @@ AcpiDmDumpVrtc ( - /* Subtables */ - - Subtable = ACPI_ADD_PTR (ACPI_VRTC_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_VRTC_ENTRY), AcpiDmTableInfoVrtc0); - if (ACPI_FAILURE (Status)) - { diff --git a/0040-Support-DSDT-SSDT-in-a-big-endian-world.patch b/0043-Support-DSDT-SSDT-in-a-big-endian-world.patch similarity index 71% rename from 0040-Support-DSDT-SSDT-in-a-big-endian-world.patch rename to 0043-Support-DSDT-SSDT-in-a-big-endian-world.patch index bfa106b..60a1e72 100644 --- a/0040-Support-DSDT-SSDT-in-a-big-endian-world.patch +++ b/0043-Support-DSDT-SSDT-in-a-big-endian-world.patch @@ -1,7 +1,7 @@ -From a11c0a997dca2b40d1bcff68368d9d5d5297b781 Mon Sep 17 00:00:00 2001 +From 14d220a34462e61fe69141c86f4c3cd2ae68c279 Mon Sep 17 00:00:00 2001 From: Al Stone -Date: Thu, 15 Oct 2020 11:35:23 -0600 -Subject: [PATCH 2/5] Support DSDT/SSDT in a big-endian world +Date: Wed, 30 Sep 2020 18:59:57 -0600 +Subject: [PATCH 43/45] Support DSDT/SSDT in a big-endian world. NB: this is a very large diff. The problem is that ResourceTemplates are treated differently during compilation and disassembly so each of @@ -12,38 +12,55 @@ wasn't that much of a change, and most of it was on the codegen side. Signed-off-by: Al Stone --- + source/common/adwalk.c | 3 +- source/common/dmrestag.c | 2 +- source/common/dmtables.c | 17 +- source/common/dmtbdump.c | 3 +- - source/compiler/aslcodegen.c | 61 ++++-- + source/common/dmtbdump3.c | 8 +- + source/compiler/aslcodegen.c | 59 ++++-- source/compiler/aslopcodes.c | 3 +- - source/compiler/aslrestype1.c | 44 +++-- - source/compiler/aslrestype1i.c | 33 ++-- + source/compiler/aslrestype1.c | 60 ++++-- + source/compiler/aslrestype1i.c | 35 ++-- source/compiler/aslrestype2.c | 20 +- source/compiler/aslrestype2d.c | 99 ++++++---- source/compiler/aslrestype2e.c | 90 ++++++--- source/compiler/aslrestype2q.c | 81 +++++--- source/compiler/aslrestype2s.c | 214 +++++++++++++++++---- source/compiler/aslrestype2w.c | 94 +++++---- - source/components/disassembler/dmbuffer.c | 10 +- - source/components/disassembler/dmopcode.c | 8 +- + source/compiler/dttable2.c | 3 +- + source/components/disassembler/dmbuffer.c | 37 +++- + source/components/disassembler/dmopcode.c | 21 +- source/components/disassembler/dmresrc.c | 2 +- source/components/disassembler/dmresrcl.c | 43 +++-- source/components/disassembler/dmresrcl2.c | 128 +++++++----- source/components/disassembler/dmresrcs.c | 18 +- source/components/disassembler/dmwalk.c | 2 +- - source/components/dispatcher/dsfield.c | 16 +- source/components/namespace/nsaccess.c | 2 +- - source/components/namespace/nsnames.c | 2 +- + source/components/namespace/nsnames.c | 4 +- source/components/namespace/nsparse.c | 6 +- source/components/namespace/nsutils.c | 7 +- - 25 files changed, 682 insertions(+), 323 deletions(-) + source/components/utilities/utresrc.c | 2 +- + 28 files changed, 721 insertions(+), 341 deletions(-) -Index: acpica-unix2-20200925/source/common/dmrestag.c +Index: acpica-unix2-20210604/source/common/adwalk.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmrestag.c -+++ acpica-unix2-20200925/source/common/dmrestag.c -@@ -1038,7 +1038,7 @@ AcpiDmAddResourcesToNamespace ( +--- acpica-unix2-20210604.orig/source/common/adwalk.c ++++ acpica-unix2-20210604/source/common/adwalk.c +@@ -679,7 +679,8 @@ AcpiDmLoadDescendingOp ( + + if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) + { +- *ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name; ++ AcpiUtWriteUint (FieldPath, ACPI_NAMESEG_SIZE, ++ &Op->Named.Name, ACPI_NAMESEG_SIZE); + FieldPath[4] = 0; + Path = FieldPath; + } +Index: acpica-unix2-20210604/source/common/dmrestag.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmrestag.c ++++ acpica-unix2-20210604/source/common/dmrestag.c +@@ -1048,7 +1048,7 @@ AcpiDmAddResourcesToNamespace ( * NextOp contains the Aml pointer and the Aml length */ AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data, @@ -52,18 +69,18 @@ Index: acpica-unix2-20200925/source/common/dmrestag.c AcpiDmAddResourceToNamespace, (void **) BufferNode); } -Index: acpica-unix2-20200925/source/common/dmtables.c +Index: acpica-unix2-20210604/source/common/dmtables.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtables.c -+++ acpica-unix2-20200925/source/common/dmtables.c +--- acpica-unix2-20210604.orig/source/common/dmtables.c ++++ acpica-unix2-20210604/source/common/dmtables.c @@ -142,6 +142,10 @@ AdCreateTableHeader ( ACPI_TABLE_HEADER *Table) { UINT8 Checksum; -+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length); -+ UINT32 OemRevision = AcpiUtReadUint32(&Table->OemRevision); -+ UINT32 CompilerRevision = -+ AcpiUtReadUint32(&Table->AslCompilerRevision); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); ++ UINT32 OemRevision = AcpiUtReadUint32 (&Table->OemRevision); ++ UINT32 CompilerRevision = ++ AcpiUtReadUint32 (&Table->AslCompilerRevision); /* Reset globals for External statements */ @@ -111,29 +128,62 @@ Index: acpica-unix2-20200925/source/common/dmtables.c fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature); - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); -+ AmlLength = AcpiUtReadUint32(&Table->Length); ++ AmlLength = AcpiUtReadUint32 (&Table->Length); + AmlLength -= sizeof (ACPI_TABLE_HEADER); AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)); AcpiUtSetIntegerWidth (Table->Revision); -Index: acpica-unix2-20200925/source/common/dmtbdump.c +Index: acpica-unix2-20210604/source/common/dmtbdump.c =================================================================== ---- acpica-unix2-20200925.orig/source/common/dmtbdump.c -+++ acpica-unix2-20200925/source/common/dmtbdump.c -@@ -333,8 +333,7 @@ AcpiDmDumpXsdt ( +--- acpica-unix2-20210604.orig/source/common/dmtbdump.c ++++ acpica-unix2-20210604/source/common/dmtbdump.c +@@ -338,8 +338,7 @@ AcpiDmDumpXsdt ( for (i = 0; i < Entries; i++) { AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i); - AcpiOsPrintf ("%8.8X%8.8X\n", -- ACPI_FORMAT_UINT64 (AcpiUtReadUint64(&Array[i]))); -+ AcpiOsPrintf ("%16.16lX\n", AcpiUtReadUint64(&Array[i])); +- ACPI_FORMAT_UINT64 (AcpiUtReadUint64 (&Array[i]))); ++ AcpiOsPrintf ("%16.16lX\n", AcpiUtReadUint64 (&Array[i])); Offset += sizeof (UINT64); } } -Index: acpica-unix2-20200925/source/compiler/aslcodegen.c +Index: acpica-unix2-20210604/source/common/dmtbdump3.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslcodegen.c -+++ acpica-unix2-20200925/source/compiler/aslcodegen.c +--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c ++++ acpica-unix2-20210604/source/common/dmtbdump3.c +@@ -736,13 +736,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; +@@ -751,10 +751,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-20210604/source/compiler/aslcodegen.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/aslcodegen.c ++++ acpica-unix2-20210604/source/compiler/aslcodegen.c @@ -238,6 +238,10 @@ CgWriteAmlOpcode ( { UINT8 PkgLenFirstByte; @@ -145,43 +195,30 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c union { UINT16 Opcode; UINT8 OpcodeBytes[2]; -@@ -305,25 +309,26 @@ CgWriteAmlOpcode ( - - /* Value is the length to be encoded (Used in field definitions) */ - -- PkgLen.Len = (UINT32) Op->Asl.Value.Integer; -+ PkgLen.Len = (UINT32) Op->Asl.Value.Integer; - break; - - default: +@@ -312,14 +316,15 @@ CgWriteAmlOpcode ( /* Check for two-byte opcode */ -+ Tmp16 = AcpiUtReadUint16(&Aml.Opcode); ++ Tmp16 = AcpiUtReadUint16 (&Aml.Opcode); if (Aml.Opcode > 0x00FF) { /* Write the high byte first */ - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1); -+ CgLocalWriteAmlData (Op, ((UINT8 *)&Tmp16)+1, 1); ++ CgLocalWriteAmlData (Op, ((UINT8 *) &Tmp16)+1, 1); } - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1); -+ CgLocalWriteAmlData (Op, (UINT8 *)&Tmp16, 1); ++ CgLocalWriteAmlData (Op, (UINT8 *) &Tmp16, 1); /* Subtreelength doesn't include length of package length bytes */ -- PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes; -+ PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes; - break; - } - @@ -335,7 +340,8 @@ CgWriteAmlOpcode ( { /* Simplest case -- no bytes to follow, just write the count */ - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1); -+ Tmp8 = (UINT8) PkgLen.Len; ++ Tmp8 = (UINT8) PkgLen.Len; + CgLocalWriteAmlData (Op, &Tmp8, 1); } else if (Op->Asl.AmlPkgLenBytes != 0) @@ -190,7 +227,7 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c * Encode the "bytes to follow" in the first byte, top two bits. * The low-order nybble of the length is in the bottom 4 bits */ -+ Tmp8 = (UINT8) PkgLen.Len; ++ Tmp8 = (UINT8) PkgLen.Len; PkgLenFirstByte = (UINT8) (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) | - (PkgLen.LenBytes[0] & 0x0F)); @@ -202,9 +239,9 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c * Now we can write the remaining bytes - * either 1, 2, or 3 bytes */ -+ Tmp32 = PkgLen.Len; -+ AcpiUtWriteUint(&PkgLen.Len, Op->Asl.AmlPkgLenBytes, -+ &Tmp32, sizeof(UINT32)); ++ Tmp32 = PkgLen.Len; ++ AcpiUtWriteUint (&PkgLen.Len, Op->Asl.AmlPkgLenBytes, ++ &Tmp32, sizeof (UINT32)); for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++) { CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1); @@ -213,32 +250,33 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c case AML_BYTE_OP: - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1); -+ Tmp64 = 0; -+ AcpiUtWriteUint(&Tmp64, 1, &Op->Asl.Value.Integer, 8); ++ Tmp64 = 0; ++ AcpiUtWriteUint (&Tmp64, 1, &Op->Asl.Value.Integer, 8); + CgLocalWriteAmlData (Op, &Tmp64, 1); break; case AML_WORD_OP: - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2); -+ Tmp64 = 0; -+ AcpiUtWriteUint(&Tmp64, 2, &Op->Asl.Value.Integer, 8); +- break; ++ Tmp64 = 0; ++ AcpiUtWriteUint (&Tmp64, 2, &Op->Asl.Value.Integer, 8); + CgLocalWriteAmlData (Op, &Tmp64, 2); - break; ++ break; case AML_DWORD_OP: - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4); -+ Tmp64 = 0; -+ AcpiUtWriteUint(&Tmp64, 4, &Op->Asl.Value.Integer, 8); ++ Tmp64 = 0; ++ AcpiUtWriteUint (&Tmp64, 4, &Op->Asl.Value.Integer, 8); + CgLocalWriteAmlData (Op, &Tmp64, 4); break; case AML_QWORD_OP: - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8); -+ Tmp64 = 0; -+ AcpiUtWriteUint(&Tmp64, 8, &Op->Asl.Value.Integer, 8); ++ Tmp64 = 0; ++ AcpiUtWriteUint (&Tmp64, 8, &Op->Asl.Value.Integer, 8); + CgLocalWriteAmlData (Op, &Tmp64, 8); break; @@ -256,8 +294,8 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c Child = Child->Asl.Next; - AslGbl_TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer; -+ AcpiUtWriteUint(&Tmp32, sizeof(UINT32), -+ &Child->Asl.Value.Integer, sizeof(Child->Asl.Value.Integer)); ++ AcpiUtWriteUint (&Tmp32, sizeof (UINT32), ++ &Child->Asl.Value.Integer, sizeof (Child->Asl.Value.Integer)); + AslGbl_TableHeader.OemRevision = Tmp32; /* Compiler ID */ @@ -268,7 +306,7 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c - AslGbl_TableHeader.AslCompilerRevision = ACPI_CA_VERSION; + Tmp32 = ACPI_CA_VERSION; -+ AslGbl_TableHeader.AslCompilerRevision = AcpiUtReadUint32(&Tmp32); ++ AslGbl_TableHeader.AslCompilerRevision = AcpiUtReadUint32 (&Tmp32); /* Table length. Checksum zero for now, will rewrite later */ @@ -283,7 +321,7 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c + */ + + Tmp32 = AslGbl_TableHeader.Length; -+ AslGbl_TableHeader.Length = AcpiUtReadUint32(&Tmp32); ++ AslGbl_TableHeader.Length = AcpiUtReadUint32 (&Tmp32); + /* Write entire header and clear the table header global */ @@ -301,31 +339,31 @@ Index: acpica-unix2-20200925/source/compiler/aslcodegen.c case AML_RAW_DATA_QWORD: - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength); -+ Tmp64 = 0; -+ AcpiUtWriteUint(&Tmp64, Op->Asl.AmlLength, -+ &Op->Asl.Value.Integer, sizeof(UINT64)); ++ Tmp64 = 0; ++ AcpiUtWriteUint (&Tmp64, Op->Asl.AmlLength, ++ &Op->Asl.Value.Integer, sizeof (UINT64)); + CgLocalWriteAmlData (Op, &Tmp64, Op->Asl.AmlLength); return; -Index: acpica-unix2-20200925/source/compiler/aslopcodes.c +Index: acpica-unix2-20210604/source/compiler/aslopcodes.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslopcodes.c -+++ acpica-unix2-20200925/source/compiler/aslopcodes.c +--- acpica-unix2-20210604.orig/source/compiler/aslopcodes.c ++++ acpica-unix2-20210604/source/compiler/aslopcodes.c @@ -511,7 +511,8 @@ OpcDoUnicode ( for (i = 0; i < Count; i++) { - UnicodeString[i] = (UINT16) AsciiString[i]; -+ AcpiUtWriteUint(&UnicodeString[i], sizeof(UINT16), -+ &AsciiString[i], sizeof(UINT8)); ++ AcpiUtWriteUint (&UnicodeString[i], sizeof (UINT16), ++ &AsciiString[i], sizeof (UINT8)); } /* -Index: acpica-unix2-20200925/source/compiler/aslrestype1.c +Index: acpica-unix2-20210604/source/compiler/aslrestype1.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype1.c -+++ acpica-unix2-20200925/source/compiler/aslrestype1.c +--- acpica-unix2-20210604.orig/source/compiler/aslrestype1.c ++++ acpica-unix2-20210604/source/compiler/aslrestype1.c @@ -143,6 +143,7 @@ RsDoMemory24Descriptor ( ASL_RESOURCE_NODE *Rnode; UINT32 CurrentByteOffset; @@ -340,7 +378,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; - Descriptor->Memory24.ResourceLength = 9; + Tmp16 = 9; -+ Descriptor->Memory24.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Memory24.ResourceLength = AcpiUtReadUint16 (&Tmp16); /* Process all child initialization nodes */ @@ -350,7 +388,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory24.Minimum = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Memory24.Minimum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum)); MinOp = InitializerOp; @@ -360,7 +398,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory24.Maximum = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Memory24.Maximum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum)); MaxOp = InitializerOp; @@ -370,7 +408,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory24.Alignment = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Memory24.Alignment = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment)); break; @@ -379,10 +417,25 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory24.AddressLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Memory24.AddressLength = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength)); LengthOp = InitializerOp; +@@ -214,10 +220,10 @@ RsDoMemory24Descriptor ( + /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */ + + RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24, +- Descriptor->Memory24.Minimum, +- Descriptor->Memory24.Maximum, +- Descriptor->Memory24.AddressLength, +- Descriptor->Memory24.Alignment, ++ (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Minimum), ++ (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Maximum), ++ (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.AddressLength), ++ (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Alignment), + MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp); + + return (Rnode); @@ -249,6 +255,8 @@ RsDoMemory32Descriptor ( ASL_RESOURCE_NODE *Rnode; UINT32 CurrentByteOffset; @@ -398,7 +451,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; - Descriptor->Memory32.ResourceLength = 17; + Tmp16 = 17; -+ Descriptor->Memory32.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Memory32.ResourceLength = AcpiUtReadUint16 (&Tmp16); /* Process all child initialization nodes */ @@ -408,7 +461,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory32.Minimum = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Memory32.Minimum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum)); MinOp = InitializerOp; @@ -418,7 +471,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory32.Maximum = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Memory32.Maximum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum)); MaxOp = InitializerOp; @@ -428,7 +481,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory32.Alignment = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Memory32.Alignment = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment)); AlignOp = InitializerOp; @@ -438,10 +491,25 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Memory32.AddressLength = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Memory32.AddressLength = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength)); LengthOp = InitializerOp; +@@ -321,10 +334,10 @@ RsDoMemory32Descriptor ( + /* Validate the Min/Max/Len/Align values */ + + RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32, +- Descriptor->Memory32.Minimum, +- Descriptor->Memory32.Maximum, +- Descriptor->Memory32.AddressLength, +- Descriptor->Memory32.Alignment, ++ AcpiUtReadUint32 (&Descriptor->Memory32.Minimum), ++ AcpiUtReadUint32 (&Descriptor->Memory32.Maximum), ++ AcpiUtReadUint32 (&Descriptor->Memory32.AddressLength), ++ AcpiUtReadUint32 (&Descriptor->Memory32.Alignment), + MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp); + + return (Rnode); @@ -352,6 +365,8 @@ RsDoMemory32FixedDescriptor ( ASL_RESOURCE_NODE *Rnode; UINT32 CurrentByteOffset; @@ -457,7 +525,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; - Descriptor->FixedMemory32.ResourceLength = 9; + Tmp16 = 9; -+ Descriptor->FixedMemory32.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->FixedMemory32.ResourceLength = AcpiUtReadUint16 (&Tmp16); /* Process all child initialization nodes */ @@ -467,7 +535,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->FixedMemory32.Address = AcpiUtReadUint32(&Tmp32); ++ Descriptor->FixedMemory32.Address = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address)); break; @@ -476,14 +544,14 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1.c - Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->FixedMemory32.AddressLength = AcpiUtReadUint32(&Tmp32); ++ Descriptor->FixedMemory32.AddressLength = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength)); break; -Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c +Index: acpica-unix2-20210604/source/compiler/aslrestype1i.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype1i.c -+++ acpica-unix2-20200925/source/compiler/aslrestype1i.c +--- acpica-unix2-20210604.orig/source/compiler/aslrestype1i.c ++++ acpica-unix2-20210604/source/compiler/aslrestype1i.c @@ -199,6 +199,7 @@ RsDoFixedDmaDescriptor ( ASL_RESOURCE_NODE *Rnode; UINT32 CurrentByteOffset; @@ -498,7 +566,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c - Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->FixedDma.RequestLines = AcpiUtReadUint16(&Tmp16); ++ Descriptor->FixedDma.RequestLines = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines)); break; @@ -507,7 +575,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c - Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->FixedDma.Channels = AcpiUtReadUint16(&Tmp16); ++ Descriptor->FixedDma.Channels = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels)); break; @@ -526,10 +594,19 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c - Descriptor->FixedIo.Address = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->FixedIo.Address = AcpiUtReadUint16(&Tmp16); ++ Descriptor->FixedIo.Address = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS, CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address)); AddressOp = InitializerOp; +@@ -324,7 +328,7 @@ RsDoFixedIoDescriptor ( + + /* Error checks */ + +- if (Descriptor->FixedIo.Address > 0x03FF) ++ if (AcpiUtReadUint16 (&Descriptor->FixedIo.Address) > 0x03FF) + { + AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL); + } @@ -358,6 +362,7 @@ RsDoIoDescriptor ( ASL_RESOURCE_NODE *Rnode; UINT32 CurrentByteOffset; @@ -545,7 +622,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c - Descriptor->Io.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Io.Minimum = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Io.Minimum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum)); MinOp = InitializerOp; @@ -556,7 +633,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c - Descriptor->Io.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Io.Maximum = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Io.Maximum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum)); MaxOp = InitializerOp; @@ -568,10 +645,10 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c - Descriptor->Io.Maximum, - Descriptor->Io.AddressLength, - Descriptor->Io.Alignment, -+ (UINT32)(AcpiUtReadUint16(&Descriptor->Io.Minimum)), -+ (UINT32)(AcpiUtReadUint16(&Descriptor->Io.Maximum)), -+ (UINT32)Descriptor->Io.AddressLength, -+ (UINT32)Descriptor->Io.Alignment, ++ (UINT32) (AcpiUtReadUint16 (&Descriptor->Io.Minimum)), ++ (UINT32) (AcpiUtReadUint16 (&Descriptor->Io.Maximum)), ++ (UINT32) Descriptor->Io.AddressLength, ++ (UINT32) Descriptor->Io.Alignment, MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp); return (Rnode); @@ -580,7 +657,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c /* Now we can set the channel mask */ - Descriptor->Irq.IrqMask = IrqMask; -+ Descriptor->Irq.IrqMask = AcpiUtReadUint16(&IrqMask); ++ Descriptor->Irq.IrqMask = AcpiUtReadUint16 (&IrqMask); return (Rnode); } @@ -592,10 +669,10 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype1i.c + Descriptor->Irq.IrqMask = AcpiUtReadUint16(&IrqMask); return (Rnode); } -Index: acpica-unix2-20200925/source/compiler/aslrestype2.c +Index: acpica-unix2-20210604/source/compiler/aslrestype2.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype2.c -+++ acpica-unix2-20200925/source/compiler/aslrestype2.c +--- acpica-unix2-20210604.orig/source/compiler/aslrestype2.c ++++ acpica-unix2-20210604/source/compiler/aslrestype2.c @@ -77,6 +77,8 @@ RsDoGeneralRegisterDescriptor ( ASL_RESOURCE_NODE *Rnode; UINT32 CurrentByteOffset; @@ -611,7 +688,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2.c Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER; - Descriptor->GenericReg.ResourceLength = 12; + Tmp16 = 12; -+ Descriptor->GenericReg.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->GenericReg.ResourceLength = AcpiUtReadUint16 (&Tmp16); /* Process all child initialization nodes */ @@ -621,7 +698,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2.c - Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer; + Tmp64 = InitializerOp->Asl.Value.Integer; -+ Descriptor->GenericReg.Address = AcpiUtReadUint64(&Tmp64); ++ Descriptor->GenericReg.Address = AcpiUtReadUint64 (&Tmp64); RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS, CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address)); break; @@ -649,7 +726,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2.c - Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Rover->DwordItem = AcpiUtReadUint32(&Tmp32); ++ Rover->DwordItem = AcpiUtReadUint32 (&Tmp32); Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4); Descriptor->ExtendedIrq.InterruptCount++; Descriptor->ExtendedIrq.ResourceLength += 4; @@ -658,7 +735,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2.c (Descriptor->ExtendedIrq.ResourceLength + StringLength); } + Tmp16 = Descriptor->ExtendedIrq.ResourceLength; -+ Descriptor->ExtendedIrq.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->ExtendedIrq.ResourceLength = AcpiUtReadUint16 (&Tmp16); Rnode->BufferLength = (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - @@ -667,21 +744,21 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2.c Descriptor = Rnode->Buffer; Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE; - Descriptor->VendorLarge.ResourceLength = (UINT16) i; -+ AcpiUtWriteUint(&Descriptor->VendorLarge.ResourceLength, sizeof(UINT16), -+ &i, sizeof(UINT32)); ++ AcpiUtWriteUint (&Descriptor->VendorLarge.ResourceLength, sizeof (UINT16), ++ &i, sizeof (UINT32)); /* Point to end-of-descriptor for vendor data */ -Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c +Index: acpica-unix2-20210604/source/compiler/aslrestype2d.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype2d.c -+++ acpica-unix2-20200925/source/compiler/aslrestype2d.c +--- acpica-unix2-20210604.orig/source/compiler/aslrestype2d.c ++++ acpica-unix2-20210604/source/compiler/aslrestype2d.c @@ -84,6 +84,8 @@ RsDoDwordIoDescriptor ( UINT32 CurrentByteOffset; UINT32 i; BOOLEAN ResSourceIndex = FALSE; -+ UINT16 Tmp16; -+ UINT32 Tmp32; ++ UINT16 Tmp16; ++ UINT32 Tmp32; InitializerOp = Info->DescriptorTypeOp->Asl.Child; @@ -691,8 +768,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Granularity = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); GranOp = InitializerOp; @@ -702,8 +779,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Minimum = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); MinOp = InitializerOp; @@ -713,8 +790,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Maximum = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); MaxOp = InitializerOp; @@ -724,8 +801,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.TranslationOffset = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); break; @@ -734,8 +811,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.AddressLength = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); LengthOp = InitializerOp; @@ -744,17 +821,17 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c /* Validate the Min/Max/Len/Gran values */ + Tmp16 = Descriptor->Address32.ResourceLength; -+ Descriptor->Address32.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16); + RsLargeAddressCheck ( - (UINT64) Descriptor->Address32.Minimum, - (UINT64) Descriptor->Address32.Maximum, - (UINT64) Descriptor->Address32.AddressLength, - (UINT64) Descriptor->Address32.Granularity, -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Minimum), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Maximum), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.AddressLength), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Granularity), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity), Descriptor->Address32.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); @@ -774,7 +851,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Granularity = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); GranOp = InitializerOp; @@ -785,7 +862,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Minimum = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); MinOp = InitializerOp; @@ -796,7 +873,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Maximum = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); MaxOp = InitializerOp; @@ -807,7 +884,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.TranslationOffset = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); break; @@ -817,7 +894,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; + Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.AddressLength = AcpiUtReadUint32(&Tmp32); ++ Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); LengthOp = InitializerOp; @@ -826,17 +903,17 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c /* Validate the Min/Max/Len/Gran values */ + Tmp16 = Descriptor->Address32.ResourceLength; -+ Descriptor->Address32.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16); + RsLargeAddressCheck ( - (UINT64) Descriptor->Address32.Minimum, - (UINT64) Descriptor->Address32.Maximum, - (UINT64) Descriptor->Address32.AddressLength, - (UINT64) Descriptor->Address32.Granularity, -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Minimum), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Maximum), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.AddressLength), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Granularity), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity), Descriptor->Address32.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); @@ -855,8 +932,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Granularity = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Granularity = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); GranOp = InitializerOp; @@ -866,8 +943,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Minimum = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Minimum = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); MinOp = InitializerOp; @@ -877,8 +954,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.Maximum = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.Maximum = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); MaxOp = InitializerOp; @@ -888,8 +965,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.TranslationOffset = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.TranslationOffset = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); break; @@ -898,8 +975,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c - Descriptor->Address32.AddressLength = - (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address32.AddressLength = AcpiUtReadUint32(&Tmp32); ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32); RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); LengthOp = InitializerOp; @@ -908,286 +985,24 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2d.c /* Validate the Min/Max/Len/Gran values */ + Tmp16 = Descriptor->Address32.ResourceLength; -+ Descriptor->Address32.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16); + RsLargeAddressCheck ( - (UINT64) Descriptor->Address32.Minimum, - (UINT64) Descriptor->Address32.Maximum, - (UINT64) Descriptor->Address32.AddressLength, - (UINT64) Descriptor->Address32.Granularity, -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Minimum), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Maximum), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.AddressLength), -+ (UINT64) AcpiUtReadUint32(&Descriptor->Address32.Granularity), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength), ++ (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity), Descriptor->Address32.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); -Index: acpica-unix2-20200925/source/compiler/aslrestype2e.c +Index: acpica-unix2-20210604/source/compiler/aslrestype2q.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype2e.c -+++ acpica-unix2-20200925/source/compiler/aslrestype2e.c -@@ -80,6 +80,7 @@ RsDoExtendedIoDescriptor ( - UINT16 StringLength = 0; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -139,7 +140,8 @@ RsDoExtendedIoDescriptor ( - - case 5: /* Address Granularity */ - -- Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Granularity = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; -@@ -147,7 +149,8 @@ RsDoExtendedIoDescriptor ( - - case 6: /* Address Min */ - -- Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Minimum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; -@@ -155,7 +158,8 @@ RsDoExtendedIoDescriptor ( - - case 7: /* Address Max */ - -- Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Maximum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; -@@ -163,14 +167,16 @@ RsDoExtendedIoDescriptor ( - - case 8: /* Translation Offset */ - -- Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.TranslationOffset = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 9: /* Address Length */ - -- Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.AddressLength = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; -@@ -178,7 +184,8 @@ RsDoExtendedIoDescriptor ( - - case 10: /* Type-Specific Attributes */ - -- Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.TypeSpecific = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; -@@ -213,11 +220,14 @@ RsDoExtendedIoDescriptor ( - - /* Validate the Min/Max/Len/Gran values */ - -+ Tmp16 = Descriptor->ExtAddress64.ResourceLength; -+ Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16(&Tmp16); -+ - RsLargeAddressCheck ( -- Descriptor->ExtAddress64.Minimum, -- Descriptor->ExtAddress64.Maximum, -- Descriptor->ExtAddress64.AddressLength, -- Descriptor->ExtAddress64.Granularity, -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Minimum), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Maximum), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.AddressLength), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Granularity), - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); - -@@ -253,6 +263,7 @@ RsDoExtendedMemoryDescriptor ( - UINT16 StringLength = 0; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -319,7 +330,8 @@ RsDoExtendedMemoryDescriptor ( - - case 6: /* Address Granularity */ - -- Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Granularity = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; -@@ -327,7 +339,8 @@ RsDoExtendedMemoryDescriptor ( - - case 7: /* Min Address */ - -- Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Minimum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; -@@ -335,7 +348,8 @@ RsDoExtendedMemoryDescriptor ( - - case 8: /* Max Address */ - -- Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Maximum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; -@@ -343,14 +357,16 @@ RsDoExtendedMemoryDescriptor ( - - case 9: /* Translation Offset */ - -- Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.TranslationOffset = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 10: /* Address Length */ - -- Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.AddressLength = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; -@@ -358,7 +374,8 @@ RsDoExtendedMemoryDescriptor ( - - case 11: /* Type-Specific Attributes */ - -- Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.TypeSpecific = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; -@@ -394,11 +411,14 @@ RsDoExtendedMemoryDescriptor ( - - /* Validate the Min/Max/Len/Gran values */ - -+ Tmp16 = Descriptor->ExtAddress64.ResourceLength; -+ Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16(&Tmp16); -+ - RsLargeAddressCheck ( -- Descriptor->ExtAddress64.Minimum, -- Descriptor->ExtAddress64.Maximum, -- Descriptor->ExtAddress64.AddressLength, -- Descriptor->ExtAddress64.Granularity, -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Minimum), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Maximum), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.AddressLength), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Granularity), - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); - -@@ -434,6 +454,7 @@ RsDoExtendedSpaceDescriptor ( - UINT16 StringLength = 0; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -497,7 +518,8 @@ RsDoExtendedSpaceDescriptor ( - - case 6: /* Address Granularity */ - -- Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Granularity = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); - GranOp = InitializerOp; -@@ -505,7 +527,8 @@ RsDoExtendedSpaceDescriptor ( - - case 7: /* Min Address */ - -- Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Minimum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); - MinOp = InitializerOp; -@@ -513,7 +536,8 @@ RsDoExtendedSpaceDescriptor ( - - case 8: /* Max Address */ - -- Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.Maximum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); - MaxOp = InitializerOp; -@@ -521,14 +545,16 @@ RsDoExtendedSpaceDescriptor ( - - case 9: /* Translation Offset */ - -- Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.TranslationOffset = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); - break; - - case 10: /* Address Length */ - -- Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.AddressLength = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); - LengthOp = InitializerOp; -@@ -536,7 +562,8 @@ RsDoExtendedSpaceDescriptor ( - - case 11: /* Type-Specific Attributes */ - -- Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; -+ Descriptor->ExtAddress64.TypeSpecific = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); - RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); - break; -@@ -557,11 +584,14 @@ RsDoExtendedSpaceDescriptor ( - - /* Validate the Min/Max/Len/Gran values */ - -+ Tmp16 = Descriptor->ExtAddress64.ResourceLength; -+ Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16(&Tmp16); -+ - RsLargeAddressCheck ( -- Descriptor->ExtAddress64.Minimum, -- Descriptor->ExtAddress64.Maximum, -- Descriptor->ExtAddress64.AddressLength, -- Descriptor->ExtAddress64.Granularity, -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Minimum), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Maximum), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.AddressLength), -+ AcpiUtReadUint64(&Descriptor->ExtAddress64.Granularity), - Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); - -Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c -=================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype2q.c -+++ acpica-unix2-20200925/source/compiler/aslrestype2q.c +--- acpica-unix2-20210604.orig/source/compiler/aslrestype2q.c ++++ acpica-unix2-20210604/source/compiler/aslrestype2q.c @@ -84,6 +84,7 @@ RsDoQwordIoDescriptor ( UINT32 CurrentByteOffset; UINT32 i; @@ -1201,8 +1016,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 5: /* Address Granularity */ - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Granularity = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Granularity = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); GranOp = InitializerOp; @@ -1211,8 +1026,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 6: /* Address Min */ - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Minimum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Minimum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); MinOp = InitializerOp; @@ -1221,8 +1036,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 7: /* Address Max */ - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Maximum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Maximum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); MaxOp = InitializerOp; @@ -1231,8 +1046,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 8: /* Translation Offset */ - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.TranslationOffset = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.TranslationOffset = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); break; @@ -1240,8 +1055,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 9: /* Address Length */ - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.AddressLength = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.AddressLength = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); LengthOp = InitializerOp; @@ -1250,17 +1065,17 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c /* Validate the Min/Max/Len/Gran values */ + Tmp16 = Descriptor->Address64.ResourceLength; -+ Descriptor->Address64.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16); + RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, -+ AcpiUtReadUint64(&Descriptor->Address64.Minimum), -+ AcpiUtReadUint64(&Descriptor->Address64.Maximum), -+ AcpiUtReadUint64(&Descriptor->Address64.AddressLength), -+ AcpiUtReadUint64(&Descriptor->Address64.Granularity), ++ AcpiUtReadUint64 (&Descriptor->Address64.Minimum), ++ AcpiUtReadUint64 (&Descriptor->Address64.Maximum), ++ AcpiUtReadUint64 (&Descriptor->Address64.AddressLength), ++ AcpiUtReadUint64 (&Descriptor->Address64.Granularity), Descriptor->Address64.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); @@ -1277,8 +1092,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 6: /* Address Granularity */ - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Granularity = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Granularity = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); GranOp = InitializerOp; @@ -1287,8 +1102,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 7: /* Min Address */ - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Minimum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Minimum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); MinOp = InitializerOp; @@ -1297,8 +1112,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 8: /* Max Address */ - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Maximum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Maximum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); MaxOp = InitializerOp; @@ -1307,8 +1122,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 9: /* Translation Offset */ - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.TranslationOffset = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.TranslationOffset = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); break; @@ -1316,8 +1131,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 10: /* Address Length */ - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.AddressLength = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.AddressLength = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); LengthOp = InitializerOp; @@ -1326,17 +1141,17 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c /* Validate the Min/Max/Len/Gran values */ + Tmp16 = Descriptor->Address64.ResourceLength; -+ Descriptor->Address64.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16); + RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, -+ AcpiUtReadUint64(&Descriptor->Address64.Minimum), -+ AcpiUtReadUint64(&Descriptor->Address64.Maximum), -+ AcpiUtReadUint64(&Descriptor->Address64.AddressLength), -+ AcpiUtReadUint64(&Descriptor->Address64.Granularity), ++ AcpiUtReadUint64 (&Descriptor->Address64.Minimum), ++ AcpiUtReadUint64 (&Descriptor->Address64.Maximum), ++ AcpiUtReadUint64 (&Descriptor->Address64.AddressLength), ++ AcpiUtReadUint64 (&Descriptor->Address64.Granularity), Descriptor->Address64.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); @@ -1353,8 +1168,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 6: /* Address Granularity */ - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Granularity = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Granularity = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); GranOp = InitializerOp; @@ -1363,8 +1178,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 7: /* Min Address */ - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Minimum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Minimum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); MinOp = InitializerOp; @@ -1373,8 +1188,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 8: /* Max Address */ - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.Maximum = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.Maximum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); MaxOp = InitializerOp; @@ -1383,8 +1198,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 9: /* Translation Offset */ - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.TranslationOffset = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.TranslationOffset = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); break; @@ -1392,8 +1207,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c case 10: /* Address Length */ - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; -+ Descriptor->Address64.AddressLength = -+ AcpiUtReadUint64(&InitializerOp->Asl.Value.Integer); ++ Descriptor->Address64.AddressLength = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); LengthOp = InitializerOp; @@ -1402,618 +1217,24 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2q.c /* Validate the Min/Max/Len/Gran values */ + Tmp16 = Descriptor->Address64.ResourceLength; -+ Descriptor->Address64.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16); + RsLargeAddressCheck ( - Descriptor->Address64.Minimum, - Descriptor->Address64.Maximum, - Descriptor->Address64.AddressLength, - Descriptor->Address64.Granularity, -+ AcpiUtReadUint64(&Descriptor->Address64.Minimum), -+ AcpiUtReadUint64(&Descriptor->Address64.Maximum), -+ AcpiUtReadUint64(&Descriptor->Address64.AddressLength), -+ AcpiUtReadUint64(&Descriptor->Address64.Granularity), ++ AcpiUtReadUint64 (&Descriptor->Address64.Minimum), ++ AcpiUtReadUint64 (&Descriptor->Address64.Maximum), ++ AcpiUtReadUint64 (&Descriptor->Address64.AddressLength), ++ AcpiUtReadUint64 (&Descriptor->Address64.Granularity), Descriptor->Address64.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); -Index: acpica-unix2-20200925/source/compiler/aslrestype2s.c +Index: acpica-unix2-20210604/source/compiler/aslrestype2w.c =================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype2s.c -+++ acpica-unix2-20200925/source/compiler/aslrestype2s.c -@@ -343,6 +343,7 @@ RsDoGpioIntDescriptor ( - UINT32 CurrentByteOffset; - UINT32 PinCount = 0; - UINT32 i; -+ UINT16 Tmp16; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -485,7 +486,8 @@ RsDoGpioIntDescriptor ( - * (implies resource source must immediately follow the pin list.) - * Name: _PIN - */ -- *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ *InterruptList = AcpiUtReadUint16(&Tmp16); - InterruptList++; - PinCount++; - -@@ -518,6 +520,27 @@ RsDoGpioIntDescriptor ( - - MpSaveGpioInfo (Info->MappingOp, Descriptor, - PinCount, PinList, ResourceSource); -+ -+ /* correct endian-ness issues */ -+ Tmp16 = Descriptor->Gpio.ResourceLength; -+ Descriptor->Gpio.ResourceLength = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.Flags; -+ Descriptor->Gpio.Flags = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.IntFlags; -+ Descriptor->Gpio.IntFlags = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.DriveStrength; -+ Descriptor->Gpio.DriveStrength = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.DebounceTimeout; -+ Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.PinTableOffset; -+ Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.ResSourceOffset; -+ Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.VendorOffset; -+ Descriptor->Gpio.VendorOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.VendorLength; -+ Descriptor->Gpio.VendorLength = AcpiUtReadUint16(&Tmp16); -+ - return (Rnode); - } - -@@ -552,6 +575,7 @@ RsDoGpioIoDescriptor ( - UINT32 CurrentByteOffset; - UINT32 PinCount = 0; - UINT32 i; -+ UINT16 Tmp16; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -691,7 +715,8 @@ RsDoGpioIoDescriptor ( - * (implies resource source must immediately follow the pin list.) - * Name: _PIN - */ -- *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ *InterruptList = AcpiUtReadUint16(&Tmp16); - InterruptList++; - PinCount++; - -@@ -724,6 +749,27 @@ RsDoGpioIoDescriptor ( - - MpSaveGpioInfo (Info->MappingOp, Descriptor, - PinCount, PinList, ResourceSource); -+ -+ /* correct endian-ness issues */ -+ Tmp16 = Descriptor->Gpio.ResourceLength; -+ Descriptor->Gpio.ResourceLength = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.Flags; -+ Descriptor->Gpio.Flags = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.IntFlags; -+ Descriptor->Gpio.IntFlags = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.DriveStrength; -+ Descriptor->Gpio.DriveStrength = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.DebounceTimeout; -+ Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.PinTableOffset; -+ Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.ResSourceOffset; -+ Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.VendorOffset; -+ Descriptor->Gpio.VendorOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->Gpio.VendorLength; -+ Descriptor->Gpio.VendorLength = AcpiUtReadUint16(&Tmp16); -+ - return (Rnode); - } - -@@ -754,6 +800,8 @@ RsDoI2cSerialBusDescriptor ( - UINT16 DescriptorSize; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; -+ UINT32 Tmp32; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -781,7 +829,8 @@ RsDoI2cSerialBusDescriptor ( - Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION; - Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION; - Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE; -- Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength; -+ Tmp16 = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength; -+ Descriptor->I2cSerialBus.TypeDataLength = AcpiUtReadUint16(&Tmp16); - - if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2) - { -@@ -795,13 +844,15 @@ RsDoI2cSerialBusDescriptor ( - - /* Process all child initialization nodes */ - -+ Descriptor->I2cSerialBus.TypeSpecificFlags = 0; - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Slave Address [WORD] (_ADR) */ - -- Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->I2cSerialBus.SlaveAddress = AcpiUtReadUint16(&Tmp16); - RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress)); - break; -@@ -815,16 +866,19 @@ RsDoI2cSerialBusDescriptor ( - - case 2: /* Connection Speed [DWORD] (_SPE) */ - -- Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->I2cSerialBus.ConnectionSpeed = AcpiUtReadUint32(&Tmp32); - RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, - CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed)); - break; - - case 3: /* Addressing Mode [Flag] (_MOD) */ - -- RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); -+ Tmp16 = AcpiUtReadUint16(&Descriptor->I2cSerialBus.TypeSpecificFlags); -+ RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0); -+ Descriptor->I2cSerialBus.TypeSpecificFlags = AcpiUtReadUint16(&Tmp16); - break; - - case 4: /* ResSource [Optional Field - STRING] */ -@@ -882,6 +936,8 @@ RsDoI2cSerialBusDescriptor ( - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - -+ Tmp16 = Descriptor->I2cSerialBus.ResourceLength; -+ Descriptor->I2cSerialBus.ResourceLength = AcpiUtReadUint16(&Tmp16); - MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); - return (Rnode); - } -@@ -913,6 +969,8 @@ RsDoSpiSerialBusDescriptor ( - UINT16 DescriptorSize; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; -+ UINT32 Tmp32; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -935,12 +993,13 @@ RsDoSpiSerialBusDescriptor ( - sizeof (AML_RESOURCE_LARGE_HEADER)); - - Descriptor = Rnode->Buffer; -- Descriptor->SpiSerialBus.ResourceLength = DescriptorSize; -+ Descriptor->SpiSerialBus.ResourceLength = AcpiUtReadUint16(&DescriptorSize); - Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; - Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION; - Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION; - Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE; -- Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength; -+ Tmp16 = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength; -+ Descriptor->SpiSerialBus.TypeDataLength = AcpiUtReadUint16(&Tmp16); - - if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2) - { -@@ -955,29 +1014,35 @@ RsDoSpiSerialBusDescriptor ( - - /* Process all child initialization nodes */ - -+ Descriptor->SpiSerialBus.TypeSpecificFlags = 0; - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Device Selection [WORD] (_ADR) */ - -- Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->SpiSerialBus.DeviceSelection = AcpiUtReadUint16(&Tmp16); - RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection)); - break; - - case 1: /* Device Polarity [Flag] (_DPL) */ - -- RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0); -+ Tmp16 = AcpiUtReadUint16(&Descriptor->SpiSerialBus.TypeSpecificFlags); -+ RsSetFlagBits16 (&Tmp16, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1); -+ Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16(&Tmp16); - break; - - case 2: /* Wire Mode [Flag] (_MOD) */ - -- RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); -+ Tmp16 = AcpiUtReadUint16(&Descriptor->SpiSerialBus.TypeSpecificFlags); -+ RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0); -+ Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16(&Tmp16); - break; - - case 3: /* Device Bit Length [BYTE] (_LEN) */ -@@ -996,7 +1061,8 @@ RsDoSpiSerialBusDescriptor ( - - case 5: /* Connection Speed [DWORD] (_SPE) */ - -- Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->SpiSerialBus.ConnectionSpeed = AcpiUtReadUint32(&Tmp32); - RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, - CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed)); - break; -@@ -1101,6 +1167,8 @@ RsDoUartSerialBusDescriptor ( - UINT16 DescriptorSize; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; -+ UINT32 Tmp32; - - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; -@@ -1123,12 +1191,13 @@ RsDoUartSerialBusDescriptor ( - sizeof (AML_RESOURCE_LARGE_HEADER)); - - Descriptor = Rnode->Buffer; -- Descriptor->UartSerialBus.ResourceLength = DescriptorSize; -+ Descriptor->UartSerialBus.ResourceLength = AcpiUtReadUint16(&DescriptorSize); - Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; - Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION; - Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION; - Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE; -- Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength; -+ Tmp16 = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength; -+ Descriptor->UartSerialBus.TypeDataLength = AcpiUtReadUint16(&Tmp16); - - if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2) - { -@@ -1142,29 +1211,35 @@ RsDoUartSerialBusDescriptor ( - - /* Process all child initialization nodes */ - -+ Descriptor->UartSerialBus.TypeSpecificFlags = 0; - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */ - -- Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->UartSerialBus.DefaultBaudRate = AcpiUtReadUint32(&Tmp32); - RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, - CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate)); - break; - - case 1: /* Bits Per Byte [Flags] (_LEN) */ - -- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3); -+ Tmp16 = AcpiUtReadUint16(&Descriptor->UartSerialBus.TypeSpecificFlags); -+ RsSetFlagBits16 (&Tmp16, InitializerOp, 4, 3); - RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3); -+ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16(&Tmp16);; - break; - - case 2: /* Stop Bits [Flags] (_STB) */ - -- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1); -+ Tmp16 = AcpiUtReadUint16(&Descriptor->UartSerialBus.TypeSpecificFlags); -+ RsSetFlagBits16 (&Tmp16, InitializerOp, 2, 1); - RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS, - CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2); -+ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16(&Tmp16);; - break; - - case 3: /* Lines In Use [BYTE] (_LIN) */ -@@ -1176,9 +1251,11 @@ RsDoUartSerialBusDescriptor ( - - case 4: /* Endianness [Flag] (_END) */ - -- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0); -+ Tmp16 = AcpiUtReadUint16(&Descriptor->UartSerialBus.TypeSpecificFlags); -+ RsSetFlagBits16 (&Tmp16, InitializerOp, 7, 0); - RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7); -+ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16(&Tmp16);; - break; - - case 5: /* Parity [BYTE] (_PAR) */ -@@ -1190,21 +1267,25 @@ RsDoUartSerialBusDescriptor ( - - case 6: /* Flow Control [Flags] (_FLC) */ - -- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); -+ Tmp16 = AcpiUtReadUint16(&Descriptor->UartSerialBus.TypeSpecificFlags); -+ RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0); - RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL, - CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2); -+ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16(&Tmp16);; - break; - - case 7: /* Rx Buffer Size [WORD] (_RXL) */ - -- Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->UartSerialBus.RxFifoSize = AcpiUtReadUint16(&Tmp16); - RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX, - CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize)); - break; - - case 8: /* Tx Buffer Size [WORD] (_TXL) */ - -- Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->UartSerialBus.TxFifoSize = AcpiUtReadUint16(&Tmp16); - RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX, - CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize)); - break; -@@ -1308,6 +1389,7 @@ RsDoPinFunctionDescriptor ( - UINT32 CurrentByteOffset; - UINT32 PinCount = 0; - UINT32 i; -+ UINT16 Tmp16; - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; - CurrentByteOffset = Info->CurrentByteOffset; -@@ -1331,7 +1413,7 @@ RsDoPinFunctionDescriptor ( - sizeof (AML_RESOURCE_LARGE_HEADER)); - - Descriptor = Rnode->Buffer; -- Descriptor->PinFunction.ResourceLength = DescriptorSize; -+ Descriptor->PinFunction.ResourceLength = AcpiUtReadUint16(&DescriptorSize); - Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION; - Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION; - -@@ -1371,7 +1453,8 @@ RsDoPinFunctionDescriptor ( - - case 2: /* Function Number [WORD] (_FUN) */ - -- Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->PinFunction.FunctionNumber = AcpiUtReadUint16(&Tmp16); - RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, - CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber)); - break; -@@ -1419,6 +1502,12 @@ RsDoPinFunctionDescriptor ( - { - Descriptor->PinFunction.VendorLength = VendorLength; - } -+ Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor); -+ Descriptor->PinFunction.VendorOffset = AcpiUtReadUint16(&Tmp16); -+ -+ Tmp16 = Descriptor->PinFunction.VendorLength; -+ Descriptor->PinFunction.VendorLength = AcpiUtReadUint16(&Tmp16); -+ - break; - - default: -@@ -1430,7 +1519,8 @@ RsDoPinFunctionDescriptor ( - * (implies resource source must immediately follow the pin list.) - * Name: _PIN - */ -- *PinList = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ *PinList = AcpiUtReadUint16(&Tmp16); - PinList++; - PinCount++; - -@@ -1461,6 +1551,13 @@ RsDoPinFunctionDescriptor ( - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - -+ /* correct the endian-ness of the values */ -+ Tmp16 = Descriptor->PinFunction.PinTableOffset; -+ Descriptor->PinFunction.PinTableOffset = AcpiUtReadUint16(&Tmp16); -+ -+ Tmp16 = Descriptor->PinFunction.ResSourceOffset; -+ Descriptor->PinFunction.ResSourceOffset = AcpiUtReadUint16(&Tmp16); -+ - return (Rnode); - } - -@@ -1494,6 +1591,8 @@ RsDoPinConfigDescriptor ( - UINT32 CurrentByteOffset; - UINT32 PinCount = 0; - UINT32 i; -+ UINT16 Tmp16; -+ UINT32 Tmp32; - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; - CurrentByteOffset = Info->CurrentByteOffset; -@@ -1517,7 +1616,7 @@ RsDoPinConfigDescriptor ( - sizeof (AML_RESOURCE_LARGE_HEADER)); - - Descriptor = Rnode->Buffer; -- Descriptor->PinConfig.ResourceLength = DescriptorSize; -+ Descriptor->PinConfig.ResourceLength = AcpiUtReadUint16(&DescriptorSize); - Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG; - Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION; - -@@ -1571,7 +1670,8 @@ RsDoPinConfigDescriptor ( - - case 2: /* Pin Config Value [DWORD] (_VAL) */ - -- Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->PinConfig.PinConfigValue = AcpiUtReadUint32(&Tmp32); - RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, - CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue)); - break; -@@ -1630,7 +1730,8 @@ RsDoPinConfigDescriptor ( - * (implies resource source must immediately follow the pin list.) - * Name: _PIN - */ -- *PinList = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ *PinList = AcpiUtReadUint16(&Tmp16); - PinList++; - PinCount++; - -@@ -1661,6 +1762,16 @@ RsDoPinConfigDescriptor ( - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - -+ /* correct the endianness if needed */ -+ Tmp16 = Descriptor->PinConfig.PinTableOffset; -+ Descriptor->PinConfig.PinTableOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinConfig.ResSourceOffset; -+ Descriptor->PinConfig.ResSourceOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinConfig.VendorOffset; -+ Descriptor->PinConfig.VendorOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinConfig.VendorLength; -+ Descriptor->PinConfig.VendorLength = AcpiUtReadUint16(&Tmp16); -+ - return (Rnode); - } - -@@ -1694,6 +1805,7 @@ RsDoPinGroupDescriptor ( - UINT32 CurrentByteOffset; - UINT32 PinCount = 0; - UINT32 i; -+ UINT16 Tmp16; - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; - CurrentByteOffset = Info->CurrentByteOffset; -@@ -1717,7 +1829,7 @@ RsDoPinGroupDescriptor ( - sizeof (AML_RESOURCE_LARGE_HEADER)); - - Descriptor = Rnode->Buffer; -- Descriptor->PinGroup.ResourceLength = DescriptorSize; -+ Descriptor->PinGroup.ResourceLength = AcpiUtReadUint16(&DescriptorSize); - Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP; - Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION; - -@@ -1784,7 +1896,8 @@ RsDoPinGroupDescriptor ( - * (implies resource source must immediately follow the pin list.) - * Name: _PIN - */ -- *PinList = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ *PinList = AcpiUtReadUint16(&Tmp16); - PinList++; - PinCount++; - -@@ -1815,6 +1928,16 @@ RsDoPinGroupDescriptor ( - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - -+ /* correct enddianness as needed */ -+ Tmp16 = Descriptor->PinGroup.PinTableOffset; -+ Descriptor->PinGroup.PinTableOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroup.LabelOffset; -+ Descriptor->PinGroup.LabelOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroup.VendorOffset; -+ Descriptor->PinGroup.VendorOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroup.VendorLength; -+ Descriptor->PinGroup.VendorLength = AcpiUtReadUint16(&Tmp16); -+ - return (Rnode); - } - -@@ -1847,6 +1970,7 @@ RsDoPinGroupFunctionDescriptor ( - UINT16 DescriptorSize; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; - CurrentByteOffset = Info->CurrentByteOffset; -@@ -1870,7 +1994,7 @@ RsDoPinGroupFunctionDescriptor ( - sizeof (AML_RESOURCE_LARGE_HEADER)); - - Descriptor = Rnode->Buffer; -- Descriptor->PinGroupFunction.ResourceLength = DescriptorSize; -+ Descriptor->PinGroupFunction.ResourceLength = AcpiUtReadUint16(&DescriptorSize); - Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION; - Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION; - -@@ -1902,7 +2026,8 @@ RsDoPinGroupFunctionDescriptor ( - - case 1: /* Function Number [WORD] */ - -- Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->PinGroupFunction.FunctionNumber = AcpiUtReadUint16(&Tmp16); - RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, - CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber)); - break; -@@ -1961,6 +2086,16 @@ RsDoPinGroupFunctionDescriptor ( - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - -+ /* correct enddianness as needed */ -+ Tmp16 = Descriptor->PinGroupFunction.ResSourceOffset; -+ Descriptor->PinGroupFunction.ResSourceOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroupFunction.ResSourceLabelOffset; -+ Descriptor->PinGroupFunction.ResSourceLabelOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroupFunction.VendorOffset; -+ Descriptor->PinGroupFunction.VendorOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroupFunction.VendorLength; -+ Descriptor->PinGroupFunction.VendorLength = AcpiUtReadUint16(&Tmp16); -+ - return (Rnode); - } - -@@ -1993,6 +2128,8 @@ RsDoPinGroupConfigDescriptor ( - UINT16 DescriptorSize; - UINT32 CurrentByteOffset; - UINT32 i; -+ UINT16 Tmp16; -+ UINT32 Tmp32; - - InitializerOp = Info->DescriptorTypeOp->Asl.Child; - CurrentByteOffset = Info->CurrentByteOffset; -@@ -2016,7 +2153,7 @@ RsDoPinGroupConfigDescriptor ( - sizeof (AML_RESOURCE_LARGE_HEADER)); - - Descriptor = Rnode->Buffer; -- Descriptor->PinGroupConfig.ResourceLength = DescriptorSize; -+ Descriptor->PinGroupConfig.ResourceLength = AcpiUtReadUint16(&DescriptorSize); - Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG; - Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION; - -@@ -2069,7 +2206,8 @@ RsDoPinGroupConfigDescriptor ( - - case 2: /* Pin Config Value [DWORD] (_VAL) */ - -- Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; -+ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; -+ Descriptor->PinGroupConfig.PinConfigValue = AcpiUtReadUint32(&Tmp32); - RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, - CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue)); - break; -@@ -2130,5 +2268,15 @@ RsDoPinGroupConfigDescriptor ( - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - -+ /* correct enddianness as needed */ -+ Tmp16 = Descriptor->PinGroupConfig.ResSourceOffset; -+ Descriptor->PinGroupConfig.ResSourceOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroupConfig.ResSourceLabelOffset; -+ Descriptor->PinGroupConfig.ResSourceLabelOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroupConfig.VendorOffset; -+ Descriptor->PinGroupConfig.VendorOffset = AcpiUtReadUint16(&Tmp16); -+ Tmp16 = Descriptor->PinGroupConfig.VendorLength; -+ Descriptor->PinGroupConfig.VendorLength = AcpiUtReadUint16(&Tmp16); -+ - return (Rnode); - } -Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c -=================================================================== ---- acpica-unix2-20200925.orig/source/compiler/aslrestype2w.c -+++ acpica-unix2-20200925/source/compiler/aslrestype2w.c +--- acpica-unix2-20210604.orig/source/compiler/aslrestype2w.c ++++ acpica-unix2-20210604/source/compiler/aslrestype2w.c @@ -84,6 +84,7 @@ RsDoWordIoDescriptor ( UINT32 CurrentByteOffset; UINT32 i; @@ -2027,8 +1248,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c case 5: /* Address Granularity */ - Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Granularity = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); GranOp = InitializerOp; @@ -2037,8 +1258,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c case 6: /* Address Min */ - Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Minimum = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); MinOp = InitializerOp; @@ -2047,8 +1268,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c case 7: /* Address Max */ - Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Maximum = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); MaxOp = InitializerOp; @@ -2057,8 +1278,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c case 8: /* Translation Offset */ - Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.TranslationOffset = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); break; @@ -2066,8 +1287,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c case 9: /* Address Length */ - Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.AddressLength = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); LengthOp = InitializerOp; @@ -2079,16 +1300,16 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - (UINT64) Descriptor->Address16.Maximum, - (UINT64) Descriptor->Address16.AddressLength, - (UINT64) Descriptor->Address16.Granularity, -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Minimum), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Maximum), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.AddressLength), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Granularity), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity), Descriptor->Address16.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); + /* correct enddianness */ + Tmp16 = Descriptor->Address16.ResourceLength; -+ Descriptor->Address16.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16); + Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + OptionIndex + StringLength; @@ -2108,7 +1329,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.Granularity = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Granularity = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); GranOp = InitializerOp; @@ -2119,7 +1340,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Minimum = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); MinOp = InitializerOp; @@ -2130,7 +1351,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Maximum = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); MaxOp = InitializerOp; @@ -2141,7 +1362,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.TranslationOffset = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.TranslationOffset = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); break; @@ -2151,7 +1372,7 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.AddressLength = - (UINT16) InitializerOp->Asl.Value.Integer; + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.AddressLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); LengthOp = InitializerOp; @@ -2163,16 +1384,16 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - (UINT64) Descriptor->Address16.Maximum, - (UINT64) Descriptor->Address16.AddressLength, - (UINT64) Descriptor->Address16.Granularity, -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Minimum), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Maximum), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.AddressLength), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Granularity), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity), Descriptor->Address16.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); + /* correct enddianness */ + Tmp16 = Descriptor->Address16.ResourceLength; -+ Descriptor->Address16.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16); + Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + OptionIndex + StringLength; @@ -2191,8 +1412,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.Granularity = - (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Granularity = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); GranOp = InitializerOp; @@ -2202,8 +1423,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.Minimum = - (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Minimum = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); MinOp = InitializerOp; @@ -2213,8 +1434,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.Maximum = - (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.Maximum = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); MaxOp = InitializerOp; @@ -2224,8 +1445,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.TranslationOffset = - (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.TranslationOffset = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); break; @@ -2234,8 +1455,8 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - Descriptor->Address16.AddressLength = - (UINT16) InitializerOp->Asl.Value.Integer; -+ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; -+ Descriptor->Address16.AddressLength = AcpiUtReadUint16(&Tmp16); ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16); RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); LengthOp = InitializerOp; @@ -2247,24 +1468,38 @@ Index: acpica-unix2-20200925/source/compiler/aslrestype2w.c - (UINT64) Descriptor->Address16.Maximum, - (UINT64) Descriptor->Address16.AddressLength, - (UINT64) Descriptor->Address16.Granularity, -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Minimum), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Maximum), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.AddressLength), -+ (UINT64) AcpiUtReadUint16(&Descriptor->Address16.Granularity), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength), ++ (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity), Descriptor->Address16.Flags, MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); + /* correct enddianness */ + Tmp16 = Descriptor->Address16.ResourceLength; -+ Descriptor->Address16.ResourceLength = AcpiUtReadUint16(&Tmp16); ++ Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16); + Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + OptionIndex + StringLength; return (Rnode); -Index: acpica-unix2-20200925/source/components/disassembler/dmbuffer.c +Index: acpica-unix2-20210604/source/compiler/dttable2.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/disassembler/dmbuffer.c -+++ acpica-unix2-20200925/source/components/disassembler/dmbuffer.c +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -2635,7 +2635,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; + +Index: acpica-unix2-20210604/source/components/disassembler/dmbuffer.c +=================================================================== +--- acpica-unix2-20210604.orig/source/components/disassembler/dmbuffer.c ++++ acpica-unix2-20210604/source/components/disassembler/dmbuffer.c @@ -204,7 +204,7 @@ AcpiDmByteList ( @@ -2305,21 +1540,94 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmbuffer.c for (i = 0; i < (WordCount - 1); i++) { - OutputValue = (int) WordData[i]; -+ OutputValue = (int) AcpiUtReadUint16(&WordData[i]); ++ OutputValue = (int) AcpiUtReadUint16 (&WordData[i]); /* Handle values that must be escaped */ -Index: acpica-unix2-20200925/source/components/disassembler/dmopcode.c +@@ -947,7 +947,29 @@ AcpiDmGetHardwareIdType ( + + /* Swap from little-endian to big-endian to simplify conversion */ + +- BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer); ++ BigEndianId = (UINT32) Op->Common.Value.Integer; ++ if (UtIsBigEndianMachine()) ++ { ++ /* ++ * We'll need to store the bytes in little-endian order ++ * so they can be re-used properly later since everything is ++ * assumed to be in little-endian form. ++ */ ++ ++ UINT32 *Ptr = (UINT32 *)(&Op->Common.Value.Integer); ++ *Ptr = AcpiUtDwordByteSwap (BigEndianId); ++ } ++ else ++ { ++ /* ++ * We'll need to just use the bytes in big-endian order; ++ * they're already in little-endian order. ++ */ ++ ++ UINT32 Tmp32 = BigEndianId; ++ ++ BigEndianId = AcpiUtDwordByteSwap ((UINT32) Tmp32); ++ } + + /* Create the 3 leading ASCII letters */ + +@@ -1073,11 +1095,12 @@ AcpiDmDecompressEisaId ( + { + char IdBuffer[ACPI_EISAID_STRING_SIZE]; + const AH_DEVICE_ID *Info; ++ UINT32 Tmp32 = EncodedId; + + + /* Convert EISAID to a string an emit the statement */ + +- AcpiExEisaIdToString (IdBuffer, EncodedId); ++ AcpiExEisaIdToString (IdBuffer, AcpiUtReadUint32 (&Tmp32)); + AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer); + + /* If we know about the ID, emit the description */ +Index: acpica-unix2-20210604/source/components/disassembler/dmopcode.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/disassembler/dmopcode.c -+++ acpica-unix2-20200925/source/components/disassembler/dmopcode.c -@@ -882,23 +882,23 @@ AcpiDmDisassembleOneOp ( +--- acpica-unix2-20210604.orig/source/components/disassembler/dmopcode.c ++++ acpica-unix2-20210604/source/components/disassembler/dmopcode.c +@@ -778,7 +778,9 @@ AcpiDmDisassembleOneOp ( + } + else + { +- AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer); ++ UINT16 Tmp16 = (UINT16) Op->Common.Value.Integer; ++ ++ AcpiOsPrintf ("0x%4.4X", (UINT32) AcpiUtReadUint16 (&Tmp16)); + } + break; - case AML_INT_NAMEDFIELD_OP: +@@ -790,14 +792,19 @@ AcpiDmDisassembleOneOp ( + } + else + { +- AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer); ++ UINT32 Tmp32 = (UINT32) Op->Common.Value.Integer; ++ ++ AcpiOsPrintf ("0x%8.8X", (UINT32) AcpiUtReadUint32 (&Tmp32)); + } + break; -- Length = AcpiDmDumpName (Op->Named.Name); -+ Length = AcpiDmDumpName (AcpiUtReadUint32(&Op->Named.Name)); + case AML_QWORD_OP: +- AcpiOsPrintf ("0x%8.8X%8.8X", +- ACPI_FORMAT_UINT64 (Op->Common.Value.Integer)); ++ { ++ UINT64 Tmp64 = AcpiUtReadUint64 (&Op->Common.Value.Integer); ++ ++ AcpiOsPrintf ("0x%8.8X%8.8X", ACPI_FORMAT_UINT64 (Tmp64)); ++ } + break; + + case AML_STRING_OP: +@@ -887,18 +894,18 @@ AcpiDmDisassembleOneOp ( AcpiOsPrintf (","); ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0); AcpiOsPrintf ("%*.s %u", (unsigned) (5 - Length), " ", @@ -2341,10 +1649,10 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmopcode.c Info->BitOffset += Offset; if (Info->BitOffset % 8 == 0) -Index: acpica-unix2-20200925/source/components/disassembler/dmresrc.c +Index: acpica-unix2-20210604/source/components/disassembler/dmresrc.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/disassembler/dmresrc.c -+++ acpica-unix2-20200925/source/components/disassembler/dmresrc.c +--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrc.c ++++ acpica-unix2-20210604/source/components/disassembler/dmresrc.c @@ -417,7 +417,7 @@ AcpiDmIsResourceTemplate ( return (AE_TYPE); } @@ -2354,10 +1662,10 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrc.c /* Get the length of the raw initialization byte list */ -Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c +Index: acpica-unix2-20210604/source/components/disassembler/dmresrcl.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/disassembler/dmresrcl.c -+++ acpica-unix2-20200925/source/components/disassembler/dmresrcl.c +--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrcl.c ++++ acpica-unix2-20210604/source/components/disassembler/dmresrcl.c @@ -141,6 +141,8 @@ AcpiDmMemoryFields ( UINT32 Level) { @@ -2373,18 +1681,18 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c - AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i], - AcpiDmMemoryNames[i]); -+ Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i]; -+ AcpiDmDumpInteger16 (AcpiUtReadUint16(&Tmp16), -+ AcpiDmMemoryNames[i]); ++ Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i]; ++ AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Tmp16), ++ AcpiDmMemoryNames[i]); break; case 32: - AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i], - AcpiDmMemoryNames[i]); -+ Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i]; -+ AcpiDmDumpInteger32 (AcpiUtReadUint32(&Tmp32), -+ AcpiDmMemoryNames[i]); ++ Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i]; ++ AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Tmp32), ++ AcpiDmMemoryNames[i]); break; default: @@ -2404,27 +1712,27 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c - AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i], - AcpiDmAddressNames[i]); -+ Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i]; -+ AcpiDmDumpInteger16 (AcpiUtReadUint16(&Tmp16), -+ AcpiDmAddressNames[i]); ++ Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i]; ++ AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Tmp16), ++ AcpiDmAddressNames[i]); break; case 32: - AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i], - AcpiDmAddressNames[i]); -+ Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i]; -+ AcpiDmDumpInteger32 (AcpiUtReadUint32(&Tmp32), -+ AcpiDmAddressNames[i]); ++ Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i]; ++ AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Tmp32), ++ AcpiDmAddressNames[i]); break; case 64: - AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i], - AcpiDmAddressNames[i]); -+ Tmp64 = ACPI_CAST_PTR (UINT64, Source)[i]; -+ AcpiDmDumpInteger64 (AcpiUtReadUint64(&Tmp64), -+ AcpiDmAddressNames[i]); ++ Tmp64 = ACPI_CAST_PTR (UINT64, Source)[i]; ++ AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Tmp64), ++ AcpiDmAddressNames[i]); break; default: @@ -2433,7 +1741,7 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c AcpiDmIndent (Level + 1); - AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific, -+ AcpiDmDumpInteger64 (AcpiUtReadUint64(&Resource->ExtAddress64.TypeSpecific), ++ AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Resource->ExtAddress64.TypeSpecific), "Type-Specific Attributes"); /* Insert a descriptor name */ @@ -2442,12 +1750,12 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c AcpiDmIndent (Level + 1); - AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, -+ AcpiDmDumpInteger32 (AcpiUtReadUint32(&Resource->FixedMemory32.Address), ++ AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Resource->FixedMemory32.Address), "Address Base"); AcpiDmIndent (Level + 1); - AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, -+ AcpiDmDumpInteger32 (AcpiUtReadUint32(&Resource->FixedMemory32.AddressLength), ++ AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Resource->FixedMemory32.AddressLength), "Address Length"); /* Insert a descriptor name */ @@ -2456,8 +1764,8 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c AcpiDmIndent (Level + 1); - AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address"); -+ AcpiDmDumpInteger64 (AcpiUtReadUint64(&Resource->GenericReg.Address), -+ "Address"); ++ AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Resource->GenericReg.Address), ++ "Address"); /* Optional field for ACPI 3.0 */ @@ -2466,7 +1774,7 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c sizeof (AML_RESOURCE_EXTENDED_IRQ) + ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32), - Resource->ExtendedIrq.ResourceLength); -+ AcpiUtReadUint16(&Resource->ExtendedIrq.ResourceLength)); ++ AcpiUtReadUint16 (&Resource->ExtendedIrq.ResourceLength)); /* Insert a descriptor name */ @@ -2475,15 +1783,15 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl.c AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%8.8X,\n", - (UINT32) Resource->ExtendedIrq.Interrupts[i]); -+ AcpiUtReadUint32(&Resource->ExtendedIrq.Interrupts[i])); ++ AcpiUtReadUint32 (&Resource->ExtendedIrq.Interrupts[i])); } AcpiDmIndent (Level); -Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c +Index: acpica-unix2-20210604/source/components/disassembler/dmresrcl2.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/disassembler/dmresrcl2.c -+++ acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c -@@ -191,22 +191,27 @@ AcpiDmGpioCommon ( +--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrcl2.c ++++ acpica-unix2-20210604/source/components/disassembler/dmresrcl2.c +@@ -199,22 +199,27 @@ AcpiDmGpioCommon ( char *DeviceName = NULL; UINT32 PinCount; UINT32 i; @@ -2497,7 +1805,7 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c AcpiDmIndent (Level + 1); - if (Resource->Gpio.ResSourceOffset) -+ ResSourceOffset = AcpiUtReadUint16(&Resource->Gpio.ResSourceOffset); ++ ResSourceOffset = AcpiUtReadUint16 (&Resource->Gpio.ResSourceOffset); + if (ResSourceOffset) { DeviceName = ACPI_ADD_PTR (char, @@ -2510,18 +1818,18 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex); - AcpiOsPrintf ("%s, ", - AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]); -+ Tmp16 = AcpiUtReadUint16(&Resource->Gpio.Flags); ++ Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.Flags); + AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Tmp16)]); /* Insert a descriptor name */ -@@ -215,15 +220,15 @@ AcpiDmGpioCommon ( +@@ -223,15 +228,15 @@ AcpiDmGpioCommon ( /* Dump the vendor data */ - if (Resource->Gpio.VendorOffset) -+ VendorOffset = AcpiUtReadUint16(&Resource->Gpio.VendorOffset); -+ VendorLength = AcpiUtReadUint16(&Resource->Gpio.VendorLength); ++ VendorOffset = AcpiUtReadUint16 (&Resource->Gpio.VendorOffset); ++ VendorLength = AcpiUtReadUint16 (&Resource->Gpio.VendorLength); + if (VendorOffset) { AcpiOsPrintf ("\n"); @@ -2536,30 +1844,30 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c } AcpiOsPrintf (")\n"); -@@ -233,17 +238,17 @@ AcpiDmGpioCommon ( +@@ -241,17 +246,17 @@ AcpiDmGpioCommon ( AcpiDmIndent (Level + 1); AcpiOsPrintf ("{ // Pin list\n"); - PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset - - Resource->Gpio.PinTableOffset)) / - sizeof (UINT16); -+ PinCount = (UINT32) AcpiUtReadUint16(&Resource->Gpio.ResSourceOffset); -+ PinCount -= (UINT32) AcpiUtReadUint16(&Resource->Gpio.PinTableOffset); ++ PinCount = (UINT32) AcpiUtReadUint16 (&Resource->Gpio.ResSourceOffset); ++ PinCount -= (UINT32) AcpiUtReadUint16 (&Resource->Gpio.PinTableOffset); + PinCount /= sizeof (UINT16); PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, - Resource->Gpio.PinTableOffset); -+ AcpiUtReadUint16(&Resource->Gpio.PinTableOffset)); ++ AcpiUtReadUint16 (&Resource->Gpio.PinTableOffset)); for (i = 0; i < PinCount; i++) { AcpiDmIndent (Level + 2); - AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], -+ AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16(&(PinList[i])), ++ AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16 (&(PinList[i])), ((i + 1) < PinCount) ? "," : ""); } -@@ -277,16 +282,18 @@ AcpiDmGpioIntDescriptor ( +@@ -285,16 +290,18 @@ AcpiDmGpioIntDescriptor ( UINT32 Length, UINT32 Level) { @@ -2570,7 +1878,7 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c /* EdgeLevel, ActiveLevel, Shared */ AcpiDmIndent (Level); -+ Tmp16 = AcpiUtReadUint16(&Resource->Gpio.IntFlags); ++ Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags); AcpiOsPrintf ("GpioInt (%s, %s, %s, ", - AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)], - AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)], @@ -2581,17 +1889,17 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c /* PinConfig, DebounceTimeout */ -@@ -299,7 +306,8 @@ AcpiDmGpioIntDescriptor ( +@@ -307,7 +314,8 @@ AcpiDmGpioIntDescriptor ( { AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig); } - AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout); + AcpiOsPrintf ("0x%4.4X,\n", -+ AcpiUtReadUint16(&Resource->Gpio.DebounceTimeout)); ++ AcpiUtReadUint16 (&Resource->Gpio.DebounceTimeout)); /* Dump the GpioInt/GpioIo common portion of the descriptor */ -@@ -329,14 +337,16 @@ AcpiDmGpioIoDescriptor ( +@@ -337,14 +345,16 @@ AcpiDmGpioIoDescriptor ( UINT32 Length, UINT32 Level) { @@ -2602,14 +1910,14 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c /* Shared, PinConfig */ AcpiDmIndent (Level); -+ Tmp16 = AcpiUtReadUint16(&Resource->Gpio.IntFlags); ++ Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags); AcpiOsPrintf ("GpioIo (%s, ", - AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]); + AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]); if (Resource->Gpio.PinConfig <= 3) { -@@ -350,10 +360,10 @@ AcpiDmGpioIoDescriptor ( +@@ -358,10 +368,10 @@ AcpiDmGpioIoDescriptor ( /* DebounceTimeout, DriveStrength, IoRestriction */ @@ -2617,14 +1925,14 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c - AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength); - AcpiOsPrintf ("%s,\n", - AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]); -+ AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16(&Resource->Gpio.DebounceTimeout)); -+ AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16(&Resource->Gpio.DriveStrength)); -+ Tmp16 = AcpiUtReadUint16(&Resource->Gpio.IntFlags); ++ AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16 (&Resource->Gpio.DebounceTimeout)); ++ AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16 (&Resource->Gpio.DriveStrength)); ++ Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags); + AcpiOsPrintf ("%s,\n", AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Tmp16)]); /* Dump the GpioInt/GpioIo common portion of the descriptor */ -@@ -434,6 +444,9 @@ AcpiDmPinFunctionDescriptor ( +@@ -442,6 +452,9 @@ AcpiDmPinFunctionDescriptor ( char *DeviceName = NULL; UINT32 PinCount; UINT32 i; @@ -2634,16 +1942,16 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c AcpiDmIndent (Level); AcpiOsPrintf ("PinFunction (%s, ", -@@ -451,12 +464,14 @@ AcpiDmPinFunctionDescriptor ( +@@ -459,12 +472,14 @@ AcpiDmPinFunctionDescriptor ( /* FunctionNumber */ - AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber); -+ AcpiOsPrintf ("0x%4.4X, ", -+ AcpiUtReadUint16(&Resource->PinFunction.FunctionNumber)); ++ AcpiOsPrintf ("0x%4.4X, ", ++ AcpiUtReadUint16 (&Resource->PinFunction.FunctionNumber)); - if (Resource->PinFunction.ResSourceOffset) -+ ResSourceOffset = AcpiUtReadUint16(&Resource->PinFunction.ResSourceOffset); ++ ResSourceOffset = AcpiUtReadUint16 (&Resource->PinFunction.ResSourceOffset); + if (ResSourceOffset) { DeviceName = ACPI_ADD_PTR (char, @@ -2652,13 +1960,13 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); } -@@ -476,15 +491,15 @@ AcpiDmPinFunctionDescriptor ( +@@ -484,15 +499,15 @@ AcpiDmPinFunctionDescriptor ( /* Dump the vendor data */ - if (Resource->PinFunction.VendorLength) -+ VendorOffset = AcpiUtReadUint16(&Resource->PinFunction.VendorOffset); -+ VendorLength = AcpiUtReadUint16(&Resource->PinFunction.VendorLength); ++ VendorOffset = AcpiUtReadUint16 (&Resource->PinFunction.VendorOffset); ++ VendorLength = AcpiUtReadUint16 (&Resource->PinFunction.VendorLength); + if (VendorLength) { AcpiOsPrintf ("\n"); @@ -2673,81 +1981,81 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c } AcpiOsPrintf (")\n"); -@@ -495,17 +510,17 @@ AcpiDmPinFunctionDescriptor ( +@@ -503,17 +518,17 @@ AcpiDmPinFunctionDescriptor ( AcpiOsPrintf ("{ // Pin list\n"); - PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset - - Resource->PinFunction.PinTableOffset)) / - sizeof (UINT16); -+ PinCount = AcpiUtReadUint16(&Resource->PinFunction.ResSourceOffset); -+ PinCount -= AcpiUtReadUint16(&Resource->PinFunction.PinTableOffset); ++ PinCount = AcpiUtReadUint16 (&Resource->PinFunction.ResSourceOffset); ++ PinCount -= AcpiUtReadUint16 (&Resource->PinFunction.PinTableOffset); + PinCount /= sizeof (UINT16); PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, - Resource->PinFunction.PinTableOffset); -+ AcpiUtReadUint16(&Resource->PinFunction.PinTableOffset)); ++ AcpiUtReadUint16 (&Resource->PinFunction.PinTableOffset)); for (i = 0; i < PinCount; i++) { AcpiDmIndent (Level + 2); - AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], -+ AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16(&(PinList[i])), ++ AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16 (&(PinList[i])), ((i + 1) < PinCount) ? "," : ""); } -@@ -541,7 +556,8 @@ AcpiDmDumpSerialBusVendorData ( +@@ -549,7 +564,8 @@ AcpiDmDumpSerialBusVendorData ( { case AML_RESOURCE_I2C_SERIALBUSTYPE: - VendorLength = Resource->CommonSerialBus.TypeDataLength - -+ VendorLength = -+ AcpiUtReadUint16(&Resource->CommonSerialBus.TypeDataLength) - ++ VendorLength = ++ AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) - AML_RESOURCE_I2C_MIN_DATA_LEN; VendorData = ACPI_ADD_PTR (UINT8, Resource, -@@ -550,7 +566,8 @@ AcpiDmDumpSerialBusVendorData ( +@@ -558,7 +574,8 @@ AcpiDmDumpSerialBusVendorData ( case AML_RESOURCE_SPI_SERIALBUSTYPE: - VendorLength = Resource->CommonSerialBus.TypeDataLength - -+ VendorLength = -+ AcpiUtReadUint16(&Resource->CommonSerialBus.TypeDataLength) - ++ VendorLength = ++ AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) - AML_RESOURCE_SPI_MIN_DATA_LEN; VendorData = ACPI_ADD_PTR (UINT8, Resource, -@@ -559,7 +576,8 @@ AcpiDmDumpSerialBusVendorData ( +@@ -567,7 +584,8 @@ AcpiDmDumpSerialBusVendorData ( case AML_RESOURCE_UART_SERIALBUSTYPE: - VendorLength = Resource->CommonSerialBus.TypeDataLength - -+ VendorLength = -+ AcpiUtReadUint16(&Resource->CommonSerialBus.TypeDataLength) - ++ VendorLength = ++ AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) - AML_RESOURCE_UART_MIN_DATA_LEN; VendorData = ACPI_ADD_PTR (UINT8, Resource, -@@ -607,9 +625,9 @@ AcpiDmI2cSerialBusDescriptor ( +@@ -693,9 +711,9 @@ AcpiDmI2cSerialBusDescriptor ( AcpiDmIndent (Level); AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n", - Resource->I2cSerialBus.SlaveAddress, -+ AcpiUtReadUint16(&Resource->I2cSerialBus.SlaveAddress), ++ AcpiUtReadUint16 (&Resource->I2cSerialBus.SlaveAddress), AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)], - Resource->I2cSerialBus.ConnectionSpeed); -+ AcpiUtReadUint32(&Resource->I2cSerialBus.ConnectionSpeed)); ++ AcpiUtReadUint32 (&Resource->I2cSerialBus.ConnectionSpeed)); AcpiDmIndent (Level + 1); AcpiOsPrintf ("%s, ", -@@ -618,7 +636,7 @@ AcpiDmI2cSerialBusDescriptor ( +@@ -704,7 +722,7 @@ AcpiDmI2cSerialBusDescriptor ( /* ResourceSource is a required field */ ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + - Resource->CommonSerialBus.TypeDataLength; -+ AcpiUtReadUint16(&Resource->CommonSerialBus.TypeDataLength); ++ AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength); DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); -@@ -675,15 +693,17 @@ AcpiDmSpiSerialBusDescriptor ( +@@ -761,15 +779,17 @@ AcpiDmSpiSerialBusDescriptor ( { UINT32 ResourceSourceOffset; char *DeviceName; @@ -2757,36 +2065,36 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */ AcpiDmIndent (Level); -+ Tmp16 = AcpiUtReadUint16(&Resource->SpiSerialBus.TypeSpecificFlags); ++ Tmp16 = AcpiUtReadUint16 (&Resource->SpiSerialBus.TypeSpecificFlags); AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n", - Resource->SpiSerialBus.DeviceSelection, - AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)], - AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)], -+ AcpiUtReadUint16(&Resource->SpiSerialBus.DeviceSelection), ++ AcpiUtReadUint16 (&Resource->SpiSerialBus.DeviceSelection), + AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Tmp16, 1)], + AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Tmp16)], Resource->SpiSerialBus.DataBitLength); /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */ -@@ -691,7 +711,7 @@ AcpiDmSpiSerialBusDescriptor ( +@@ -777,7 +797,7 @@ AcpiDmSpiSerialBusDescriptor ( AcpiDmIndent (Level + 1); AcpiOsPrintf ("%s, 0x%8.8X, %s,\n", AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)], - Resource->SpiSerialBus.ConnectionSpeed, -+ AcpiUtReadUint32(&Resource->SpiSerialBus.ConnectionSpeed), ++ AcpiUtReadUint32 (&Resource->SpiSerialBus.ConnectionSpeed), AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]); AcpiDmIndent (Level + 1); -@@ -701,7 +721,7 @@ AcpiDmSpiSerialBusDescriptor ( +@@ -787,7 +807,7 @@ AcpiDmSpiSerialBusDescriptor ( /* ResourceSource is a required field */ ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + - Resource->CommonSerialBus.TypeDataLength; -+ AcpiUtReadUint16(&Resource->CommonSerialBus.TypeDataLength); ++ AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength); DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); -@@ -758,15 +778,17 @@ AcpiDmUartSerialBusDescriptor ( +@@ -844,15 +864,17 @@ AcpiDmUartSerialBusDescriptor ( { UINT32 ResourceSourceOffset; char *DeviceName; @@ -2796,44 +2104,44 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcl2.c /* ConnectionSpeed, BitsPerByte, StopBits */ AcpiDmIndent (Level); -+ Tmp16 = AcpiUtReadUint16(&Resource->UartSerialBus.TypeSpecificFlags); ++ Tmp16 = AcpiUtReadUint16 (&Resource->UartSerialBus.TypeSpecificFlags); AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n", - Resource->UartSerialBus.DefaultBaudRate, - AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)], - AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]); -+ AcpiUtReadUint32(&Resource->UartSerialBus.DefaultBaudRate), ++ AcpiUtReadUint32 (&Resource->UartSerialBus.DefaultBaudRate), + AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Tmp16, 4)], + AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 2)]); /* LinesInUse, IsBigEndian, Parity, FlowControl */ -@@ -781,13 +803,13 @@ AcpiDmUartSerialBusDescriptor ( +@@ -867,13 +889,13 @@ AcpiDmUartSerialBusDescriptor ( AcpiDmIndent (Level + 1); AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ", - Resource->UartSerialBus.RxFifoSize, - Resource->UartSerialBus.TxFifoSize); -+ AcpiUtReadUint16(&Resource->UartSerialBus.RxFifoSize), -+ AcpiUtReadUint16(&Resource->UartSerialBus.TxFifoSize)); ++ AcpiUtReadUint16 (&Resource->UartSerialBus.RxFifoSize), ++ AcpiUtReadUint16 (&Resource->UartSerialBus.TxFifoSize)); /* ResourceSource is a required field */ ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + - Resource->CommonSerialBus.TypeDataLength; -+ AcpiUtReadUint16(&Resource->CommonSerialBus.TypeDataLength); ++ AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength); DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset); AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); -Index: acpica-unix2-20200925/source/components/disassembler/dmresrcs.c +Index: acpica-unix2-20210604/source/components/disassembler/dmresrcs.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/disassembler/dmresrcs.c -+++ acpica-unix2-20200925/source/components/disassembler/dmresrcs.c +--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrcs.c ++++ acpica-unix2-20210604/source/components/disassembler/dmresrcs.c @@ -93,7 +93,7 @@ AcpiDmIrqDescriptor ( AcpiOsPrintf (")\n"); AcpiDmIndent (Level + 1); - AcpiDmBitList (Resource->Irq.IrqMask); -+ AcpiDmBitList (AcpiUtReadUint16(&Resource->Irq.IrqMask)); ++ AcpiDmBitList (AcpiUtReadUint16 (&Resource->Irq.IrqMask)); } @@ -2843,8 +2151,8 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcs.c AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ", - Resource->FixedDma.RequestLines, - Resource->FixedDma.Channels); -+ AcpiUtReadUint16(&Resource->FixedDma.RequestLines), -+ AcpiUtReadUint16(&Resource->FixedDma.Channels)); ++ AcpiUtReadUint16 (&Resource->FixedDma.RequestLines), ++ AcpiUtReadUint16 (&Resource->FixedDma.Channels)); if (Resource->FixedDma.Width <= 5) { @@ -2853,13 +2161,13 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcs.c AcpiDmIndent (Level + 1); - AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum"); -+ AcpiDmDumpInteger16 (AcpiUtReadUint16(&Resource->Io.Minimum), -+ "Range Minimum"); ++ AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->Io.Minimum), ++ "Range Minimum"); AcpiDmIndent (Level + 1); - AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum"); -+ AcpiDmDumpInteger16 (AcpiUtReadUint16(&Resource->Io.Maximum), -+ "Range Maximum"); ++ AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->Io.Maximum), ++ "Range Maximum"); AcpiDmIndent (Level + 1); AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment"); @@ -2868,20 +2176,20 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmresrcs.c AcpiDmIndent (Level + 1); - AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address"); -+ AcpiDmDumpInteger16 (AcpiUtReadUint16(&Resource->FixedIo.Address), -+ "Address"); ++ AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->FixedIo.Address), ++ "Address"); AcpiDmIndent (Level + 1); - AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length"); -+ AcpiDmDumpInteger8 (AcpiUtReadUint16(&Resource->FixedIo.AddressLength), -+ "Length"); ++ AcpiDmDumpInteger8 (AcpiUtReadUint16 (&Resource->FixedIo.AddressLength), ++ "Length"); /* Insert a descriptor name */ -Index: acpica-unix2-20200925/source/components/disassembler/dmwalk.c +Index: acpica-unix2-20210604/source/components/disassembler/dmwalk.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/disassembler/dmwalk.c -+++ acpica-unix2-20200925/source/components/disassembler/dmwalk.c +--- acpica-unix2-20210604.orig/source/components/disassembler/dmwalk.c ++++ acpica-unix2-20210604/source/components/disassembler/dmwalk.c @@ -1155,7 +1155,7 @@ AcpiDmAscendingOp ( { ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST; @@ -2891,59 +2199,11 @@ Index: acpica-unix2-20200925/source/components/disassembler/dmwalk.c } } -Index: acpica-unix2-20200925/source/components/dispatcher/dsfield.c +Index: acpica-unix2-20210604/source/components/namespace/nsaccess.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/dispatcher/dsfield.c -+++ acpica-unix2-20200925/source/components/dispatcher/dsfield.c -@@ -336,6 +336,8 @@ AcpiDsGetFieldNames ( - char *NamePath; - #endif - -+ char TmpName[ACPI_NAMESEG_SIZE+1]; -+ - - ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info); - -@@ -442,14 +444,17 @@ AcpiDsGetFieldNames ( - - /* Lookup the name, it should already exist */ - -+ memset(TmpName, 0, ACPI_NAMESEG_SIZE+1); -+ AcpiUtWriteUint(TmpName, ACPI_NAMESEG_SIZE, -+ &Arg->Named.Name, ACPI_NAMESEG_SIZE); - Status = AcpiNsLookup (WalkState->ScopeInfo, -- (char *) &Arg->Named.Name, Info->FieldType, -+ TmpName, Info->FieldType, - ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Info->FieldNode); - if (ACPI_FAILURE (Status)) - { - ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, -- (char *) &Arg->Named.Name, Status); -+ TmpName, Status); - return_ACPI_STATUS (Status); - } - else -@@ -703,8 +708,13 @@ AcpiDsInitFieldObjects ( - */ - if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) - { -+ char Tmp[ACPI_NAMESEG_SIZE+1]; -+ -+ memset(&Tmp, 0, ACPI_NAMESEG_SIZE+1); -+ AcpiUtWriteUint(&Tmp, ACPI_NAMESEG_SIZE, -+ &Arg->Named.Name, ACPI_NAMESEG_SIZE); - Status = AcpiNsLookup (WalkState->ScopeInfo, -- (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, -+ Tmp, Type, ACPI_IMODE_LOAD_PASS1, - Flags, WalkState, &Node); - if (ACPI_FAILURE (Status)) - { -Index: acpica-unix2-20200925/source/components/namespace/nsaccess.c -=================================================================== ---- acpica-unix2-20200925.orig/source/components/namespace/nsaccess.c -+++ acpica-unix2-20200925/source/components/namespace/nsaccess.c -@@ -645,7 +645,7 @@ AcpiNsLookup ( +--- acpica-unix2-20210604.orig/source/components/namespace/nsaccess.c ++++ acpica-unix2-20210604/source/components/namespace/nsaccess.c +@@ -644,7 +644,7 @@ AcpiNsLookup ( /* Extract one ACPI name from the front of the pathname */ @@ -2952,12 +2212,16 @@ Index: acpica-unix2-20200925/source/components/namespace/nsaccess.c /* Try to find the single (4 character) ACPI name */ -Index: acpica-unix2-20200925/source/components/namespace/nsnames.c +Index: acpica-unix2-20210604/source/components/namespace/nsnames.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/namespace/nsnames.c -+++ acpica-unix2-20200925/source/components/namespace/nsnames.c -@@ -300,7 +300,7 @@ AcpiNsBuildNormalizedPath ( - ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); +--- acpica-unix2-20210604.orig/source/components/namespace/nsnames.c ++++ acpica-unix2-20210604/source/components/namespace/nsnames.c +@@ -297,10 +297,10 @@ AcpiNsBuildNormalizedPath ( + { + if (NextNode != Node) + { +- ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); ++ ACPI_PATH_PUT8 (FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length); } - ACPI_MOVE_32_TO_32 (Name, &NextNode->Name); @@ -2965,10 +2229,10 @@ Index: acpica-unix2-20200925/source/components/namespace/nsnames.c DoNoTrailing = NoTrailing; for (i = 0; i < 4; i++) { -Index: acpica-unix2-20200925/source/components/namespace/nsparse.c +Index: acpica-unix2-20210604/source/components/namespace/nsparse.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/namespace/nsparse.c -+++ acpica-unix2-20200925/source/components/namespace/nsparse.c +--- acpica-unix2-20210604.orig/source/components/namespace/nsparse.c ++++ acpica-unix2-20210604/source/components/namespace/nsparse.c @@ -203,6 +203,7 @@ AcpiNsOneCompleteParse ( ACPI_WALK_STATE *WalkState; ACPI_TABLE_HEADER *Table; @@ -2982,7 +2246,7 @@ Index: acpica-unix2-20200925/source/components/namespace/nsparse.c /* Table must consist of at least a complete header */ - if (Table->Length < sizeof (ACPI_TABLE_HEADER)) -+ TableLength = AcpiUtReadUint32(&Table->Length); ++ TableLength = AcpiUtReadUint32 (&Table->Length); + if (TableLength < sizeof (ACPI_TABLE_HEADER)) { return_ACPI_STATUS (AE_BAD_HEADER); @@ -2994,15 +2258,15 @@ Index: acpica-unix2-20200925/source/components/namespace/nsparse.c Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); if (ACPI_FAILURE (Status)) -Index: acpica-unix2-20200925/source/components/namespace/nsutils.c +Index: acpica-unix2-20210604/source/components/namespace/nsutils.c =================================================================== ---- acpica-unix2-20200925.orig/source/components/namespace/nsutils.c -+++ acpica-unix2-20200925/source/components/namespace/nsutils.c +--- acpica-unix2-20210604.orig/source/components/namespace/nsutils.c ++++ acpica-unix2-20210604/source/components/namespace/nsutils.c @@ -272,7 +272,6 @@ AcpiNsBuildInternalName ( const char *ExternalName = Info->NextExternalChar; char *Result = NULL; UINT32 i; -- char TmpSeg[ACPI_NAMESEG_SIZE+1]; +- char TmpSeg[ACPI_NAMESEG_SIZE+1]; ACPI_FUNCTION_TRACE (NsBuildInternalName); @@ -3010,7 +2274,7 @@ Index: acpica-unix2-20200925/source/components/namespace/nsutils.c for (; NumSegments; NumSegments--) { -- memset(TmpSeg, 0, ACPI_NAMESEG_SIZE+1); +- memset (TmpSeg, 0, ACPI_NAMESEG_SIZE+1); for (i = 0; i < ACPI_NAMESEG_SIZE; i++) { if (ACPI_IS_PATH_SEPARATOR (*ExternalName) || @@ -3030,7 +2294,876 @@ Index: acpica-unix2-20200925/source/components/namespace/nsutils.c ExternalName++; } } -- AcpiUtWriteUint(Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE); +- AcpiUtWriteUint (Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE); /* Now we must have a path separator, or the pathname is bad */ +Index: acpica-unix2-20210604/source/components/utilities/utresrc.c +=================================================================== +--- acpica-unix2-20210604.orig/source/components/utilities/utresrc.c ++++ acpica-unix2-20210604/source/components/utilities/utresrc.c +@@ -541,7 +541,7 @@ AcpiUtGetResourceLength ( + { + /* Large Resource type -- bytes 1-2 contain the 16-bit length */ + +- ACPI_MOVE_16_TO_16 (&ResourceLength, ACPI_ADD_PTR (UINT8, Aml, 1)); ++ ResourceLength = AcpiUtReadUint16 (ACPI_ADD_PTR (UINT8, Aml, 1)); + + } + else +Index: acpica-unix2-20210604/source/compiler/aslrestype2e.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/aslrestype2e.c ++++ acpica-unix2-20210604/source/compiler/aslrestype2e.c +@@ -80,6 +80,7 @@ RsDoExtendedIoDescriptor ( + UINT16 StringLength = 0; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -139,7 +140,8 @@ RsDoExtendedIoDescriptor ( + + case 5: /* Address Granularity */ + +- Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Granularity = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); + GranOp = InitializerOp; +@@ -147,7 +149,8 @@ RsDoExtendedIoDescriptor ( + + case 6: /* Address Min */ + +- Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Minimum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); + MinOp = InitializerOp; +@@ -155,7 +158,8 @@ RsDoExtendedIoDescriptor ( + + case 7: /* Address Max */ + +- Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Maximum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); + MaxOp = InitializerOp; +@@ -163,14 +167,16 @@ RsDoExtendedIoDescriptor ( + + case 8: /* Translation Offset */ + +- Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.TranslationOffset = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); + break; + + case 9: /* Address Length */ + +- Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.AddressLength = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); + LengthOp = InitializerOp; +@@ -178,7 +184,8 @@ RsDoExtendedIoDescriptor ( + + case 10: /* Type-Specific Attributes */ + +- Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.TypeSpecific = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); + break; +@@ -213,11 +220,14 @@ RsDoExtendedIoDescriptor ( + + /* Validate the Min/Max/Len/Gran values */ + ++ Tmp16 = Descriptor->ExtAddress64.ResourceLength; ++ Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16); ++ + RsLargeAddressCheck ( +- Descriptor->ExtAddress64.Minimum, +- Descriptor->ExtAddress64.Maximum, +- Descriptor->ExtAddress64.AddressLength, +- Descriptor->ExtAddress64.Granularity, ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity), + Descriptor->ExtAddress64.Flags, + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); + +@@ -253,6 +263,7 @@ RsDoExtendedMemoryDescriptor ( + UINT16 StringLength = 0; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -319,7 +330,8 @@ RsDoExtendedMemoryDescriptor ( + + case 6: /* Address Granularity */ + +- Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Granularity = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); + GranOp = InitializerOp; +@@ -327,7 +339,8 @@ RsDoExtendedMemoryDescriptor ( + + case 7: /* Min Address */ + +- Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Minimum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); + MinOp = InitializerOp; +@@ -335,7 +348,8 @@ RsDoExtendedMemoryDescriptor ( + + case 8: /* Max Address */ + +- Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Maximum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); + MaxOp = InitializerOp; +@@ -343,14 +357,16 @@ RsDoExtendedMemoryDescriptor ( + + case 9: /* Translation Offset */ + +- Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.TranslationOffset = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); + break; + + case 10: /* Address Length */ + +- Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.AddressLength = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); + LengthOp = InitializerOp; +@@ -358,7 +374,8 @@ RsDoExtendedMemoryDescriptor ( + + case 11: /* Type-Specific Attributes */ + +- Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.TypeSpecific = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); + break; +@@ -394,11 +411,14 @@ RsDoExtendedMemoryDescriptor ( + + /* Validate the Min/Max/Len/Gran values */ + ++ Tmp16 = Descriptor->ExtAddress64.ResourceLength; ++ Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16); ++ + RsLargeAddressCheck ( +- Descriptor->ExtAddress64.Minimum, +- Descriptor->ExtAddress64.Maximum, +- Descriptor->ExtAddress64.AddressLength, +- Descriptor->ExtAddress64.Granularity, ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity), + Descriptor->ExtAddress64.Flags, + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); + +@@ -434,6 +454,7 @@ RsDoExtendedSpaceDescriptor ( + UINT16 StringLength = 0; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -497,7 +518,8 @@ RsDoExtendedSpaceDescriptor ( + + case 6: /* Address Granularity */ + +- Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Granularity = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); + GranOp = InitializerOp; +@@ -505,7 +527,8 @@ RsDoExtendedSpaceDescriptor ( + + case 7: /* Min Address */ + +- Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Minimum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); + MinOp = InitializerOp; +@@ -513,7 +536,8 @@ RsDoExtendedSpaceDescriptor ( + + case 8: /* Max Address */ + +- Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.Maximum = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); + MaxOp = InitializerOp; +@@ -521,14 +545,16 @@ RsDoExtendedSpaceDescriptor ( + + case 9: /* Translation Offset */ + +- Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.TranslationOffset = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); + break; + + case 10: /* Address Length */ + +- Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.AddressLength = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); + LengthOp = InitializerOp; +@@ -536,7 +562,8 @@ RsDoExtendedSpaceDescriptor ( + + case 11: /* Type-Specific Attributes */ + +- Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; ++ Descriptor->ExtAddress64.TypeSpecific = ++ AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer); + RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, + CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); + break; +@@ -557,11 +584,14 @@ RsDoExtendedSpaceDescriptor ( + + /* Validate the Min/Max/Len/Gran values */ + ++ Tmp16 = Descriptor->ExtAddress64.ResourceLength; ++ Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16); ++ + RsLargeAddressCheck ( +- Descriptor->ExtAddress64.Minimum, +- Descriptor->ExtAddress64.Maximum, +- Descriptor->ExtAddress64.AddressLength, +- Descriptor->ExtAddress64.Granularity, ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength), ++ AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity), + Descriptor->ExtAddress64.Flags, + MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); + +Index: acpica-unix2-20210604/source/compiler/aslrestype2s.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/aslrestype2s.c ++++ acpica-unix2-20210604/source/compiler/aslrestype2s.c +@@ -343,6 +343,7 @@ RsDoGpioIntDescriptor ( + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; ++ UINT16 Tmp16; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -485,7 +486,8 @@ RsDoGpioIntDescriptor ( + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ +- *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ *InterruptList = AcpiUtReadUint16 (&Tmp16); + InterruptList++; + PinCount++; + +@@ -518,6 +520,27 @@ RsDoGpioIntDescriptor ( + + MpSaveGpioInfo (Info->MappingOp, Descriptor, + PinCount, PinList, ResourceSource); ++ ++ /* correct endian-ness issues */ ++ Tmp16 = Descriptor->Gpio.ResourceLength; ++ Descriptor->Gpio.ResourceLength = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.Flags; ++ Descriptor->Gpio.Flags = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.IntFlags; ++ Descriptor->Gpio.IntFlags = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.DriveStrength; ++ Descriptor->Gpio.DriveStrength = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.DebounceTimeout; ++ Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.PinTableOffset; ++ Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.ResSourceOffset; ++ Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.VendorOffset; ++ Descriptor->Gpio.VendorOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.VendorLength; ++ Descriptor->Gpio.VendorLength = AcpiUtReadUint16 (&Tmp16); ++ + return (Rnode); + } + +@@ -552,6 +575,7 @@ RsDoGpioIoDescriptor ( + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; ++ UINT16 Tmp16; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -691,7 +715,8 @@ RsDoGpioIoDescriptor ( + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ +- *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ *InterruptList = AcpiUtReadUint16 (&Tmp16); + InterruptList++; + PinCount++; + +@@ -724,6 +749,27 @@ RsDoGpioIoDescriptor ( + + MpSaveGpioInfo (Info->MappingOp, Descriptor, + PinCount, PinList, ResourceSource); ++ ++ /* correct endian-ness issues */ ++ Tmp16 = Descriptor->Gpio.ResourceLength; ++ Descriptor->Gpio.ResourceLength = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.Flags; ++ Descriptor->Gpio.Flags = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.IntFlags; ++ Descriptor->Gpio.IntFlags = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.DriveStrength; ++ Descriptor->Gpio.DriveStrength = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.DebounceTimeout; ++ Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.PinTableOffset; ++ Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.ResSourceOffset; ++ Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.VendorOffset; ++ Descriptor->Gpio.VendorOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->Gpio.VendorLength; ++ Descriptor->Gpio.VendorLength = AcpiUtReadUint16 (&Tmp16); ++ + return (Rnode); + } + +@@ -754,6 +800,8 @@ RsDoI2cSerialBusDescriptor ( + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; ++ UINT32 Tmp32; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -781,7 +829,8 @@ RsDoI2cSerialBusDescriptor ( + Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION; + Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION; + Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE; +- Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength; ++ Tmp16 = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength; ++ Descriptor->I2cSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16); + + if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2) + { +@@ -795,13 +844,15 @@ RsDoI2cSerialBusDescriptor ( + + /* Process all child initialization nodes */ + ++ Descriptor->I2cSerialBus.TypeSpecificFlags = 0; + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Slave Address [WORD] (_ADR) */ + +- Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->I2cSerialBus.SlaveAddress = AcpiUtReadUint16 (&Tmp16); + RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, + CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress)); + break; +@@ -815,16 +866,19 @@ RsDoI2cSerialBusDescriptor ( + + case 2: /* Connection Speed [DWORD] (_SPE) */ + +- Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->I2cSerialBus.ConnectionSpeed = AcpiUtReadUint32 (&Tmp32); + RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, + CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed)); + break; + + case 3: /* Addressing Mode [Flag] (_MOD) */ + +- RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); ++ Tmp16 = AcpiUtReadUint16 (&Descriptor->I2cSerialBus.TypeSpecificFlags); ++ RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0); ++ Descriptor->I2cSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16); + break; + + case 4: /* ResSource [Optional Field - STRING] */ +@@ -882,6 +936,8 @@ RsDoI2cSerialBusDescriptor ( + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + ++ Tmp16 = Descriptor->I2cSerialBus.ResourceLength; ++ Descriptor->I2cSerialBus.ResourceLength = AcpiUtReadUint16 (&Tmp16); + MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); + return (Rnode); + } +@@ -913,6 +969,8 @@ RsDoSpiSerialBusDescriptor ( + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; ++ UINT32 Tmp32; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -935,12 +993,13 @@ RsDoSpiSerialBusDescriptor ( + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; +- Descriptor->SpiSerialBus.ResourceLength = DescriptorSize; ++ Descriptor->SpiSerialBus.ResourceLength = AcpiUtReadUint16 (&DescriptorSize); + Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; + Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION; + Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION; + Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE; +- Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength; ++ Tmp16 = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength; ++ Descriptor->SpiSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16); + + if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2) + { +@@ -955,29 +1014,35 @@ RsDoSpiSerialBusDescriptor ( + + /* Process all child initialization nodes */ + ++ Descriptor->SpiSerialBus.TypeSpecificFlags = 0; + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Device Selection [WORD] (_ADR) */ + +- Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->SpiSerialBus.DeviceSelection = AcpiUtReadUint16 (&Tmp16); + RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection)); + break; + + case 1: /* Device Polarity [Flag] (_DPL) */ + +- RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0); ++ Tmp16 = AcpiUtReadUint16 (&Descriptor->SpiSerialBus.TypeSpecificFlags); ++ RsSetFlagBits16 (&Tmp16, InitializerOp, 1, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1); ++ Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16); + break; + + case 2: /* Wire Mode [Flag] (_MOD) */ + +- RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); ++ Tmp16 = AcpiUtReadUint16 (&Descriptor->SpiSerialBus.TypeSpecificFlags); ++ RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0); ++ Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16); + break; + + case 3: /* Device Bit Length [BYTE] (_LEN) */ +@@ -996,7 +1061,8 @@ RsDoSpiSerialBusDescriptor ( + + case 5: /* Connection Speed [DWORD] (_SPE) */ + +- Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->SpiSerialBus.ConnectionSpeed = AcpiUtReadUint32 (&Tmp32); + RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, + CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed)); + break; +@@ -1101,6 +1167,8 @@ RsDoUartSerialBusDescriptor ( + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; ++ UINT32 Tmp32; + + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; +@@ -1123,12 +1191,13 @@ RsDoUartSerialBusDescriptor ( + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; +- Descriptor->UartSerialBus.ResourceLength = DescriptorSize; ++ Descriptor->UartSerialBus.ResourceLength = AcpiUtReadUint16 (&DescriptorSize); + Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS; + Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION; + Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION; + Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE; +- Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength; ++ Tmp16 = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength; ++ Descriptor->UartSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16); + + if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2) + { +@@ -1142,29 +1211,35 @@ RsDoUartSerialBusDescriptor ( + + /* Process all child initialization nodes */ + ++ Descriptor->UartSerialBus.TypeSpecificFlags = 0; + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */ + +- Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer; ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->UartSerialBus.DefaultBaudRate = AcpiUtReadUint32 (&Tmp32); + RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate)); + break; + + case 1: /* Bits Per Byte [Flags] (_LEN) */ + +- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3); ++ Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags); ++ RsSetFlagBits16 (&Tmp16, InitializerOp, 4, 3); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3); ++ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);; + break; + + case 2: /* Stop Bits [Flags] (_STB) */ + +- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1); ++ Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags); ++ RsSetFlagBits16 (&Tmp16, InitializerOp, 2, 1); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2); ++ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);; + break; + + case 3: /* Lines In Use [BYTE] (_LIN) */ +@@ -1176,9 +1251,11 @@ RsDoUartSerialBusDescriptor ( + + case 4: /* Endianness [Flag] (_END) */ + +- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0); ++ Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags); ++ RsSetFlagBits16 (&Tmp16, InitializerOp, 7, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7); ++ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);; + break; + + case 5: /* Parity [BYTE] (_PAR) */ +@@ -1190,21 +1267,25 @@ RsDoUartSerialBusDescriptor ( + + case 6: /* Flow Control [Flags] (_FLC) */ + +- RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); ++ Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags); ++ RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0); + RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2); ++ Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);; + break; + + case 7: /* Rx Buffer Size [WORD] (_RXL) */ + +- Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->UartSerialBus.RxFifoSize = AcpiUtReadUint16 (&Tmp16); + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize)); + break; + + case 8: /* Tx Buffer Size [WORD] (_TXL) */ + +- Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->UartSerialBus.TxFifoSize = AcpiUtReadUint16 (&Tmp16); + RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX, + CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize)); + break; +@@ -1444,6 +1525,7 @@ RsDoPinFunctionDescriptor ( + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; ++ UINT16 Tmp16; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; +@@ -1467,7 +1549,7 @@ RsDoPinFunctionDescriptor ( + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; +- Descriptor->PinFunction.ResourceLength = DescriptorSize; ++ Descriptor->PinFunction.ResourceLength = AcpiUtReadUint16 (&DescriptorSize); + Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION; + Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION; + +@@ -1507,7 +1589,8 @@ RsDoPinFunctionDescriptor ( + + case 2: /* Function Number [WORD] (_FUN) */ + +- Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->PinFunction.FunctionNumber = AcpiUtReadUint16 (&Tmp16); + RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber)); + break; +@@ -1555,6 +1638,12 @@ RsDoPinFunctionDescriptor ( + { + Descriptor->PinFunction.VendorLength = VendorLength; + } ++ Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor); ++ Descriptor->PinFunction.VendorOffset = AcpiUtReadUint16 (&Tmp16); ++ ++ Tmp16 = Descriptor->PinFunction.VendorLength; ++ Descriptor->PinFunction.VendorLength = AcpiUtReadUint16 (&Tmp16); ++ + break; + + default: +@@ -1566,7 +1655,8 @@ RsDoPinFunctionDescriptor ( + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ +- *PinList = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ *PinList = AcpiUtReadUint16 (&Tmp16); + PinList++; + PinCount++; + +@@ -1597,6 +1687,13 @@ RsDoPinFunctionDescriptor ( + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + ++ /* correct the endian-ness of the values */ ++ Tmp16 = Descriptor->PinFunction.PinTableOffset; ++ Descriptor->PinFunction.PinTableOffset = AcpiUtReadUint16 (&Tmp16); ++ ++ Tmp16 = Descriptor->PinFunction.ResSourceOffset; ++ Descriptor->PinFunction.ResSourceOffset = AcpiUtReadUint16 (&Tmp16); ++ + return (Rnode); + } + +@@ -1630,6 +1727,8 @@ RsDoPinConfigDescriptor ( + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; ++ UINT16 Tmp16; ++ UINT32 Tmp32; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; +@@ -1653,7 +1752,7 @@ RsDoPinConfigDescriptor ( + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; +- Descriptor->PinConfig.ResourceLength = DescriptorSize; ++ Descriptor->PinConfig.ResourceLength = AcpiUtReadUint16 (&DescriptorSize); + Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG; + Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION; + +@@ -1707,7 +1806,8 @@ RsDoPinConfigDescriptor ( + + case 2: /* Pin Config Value [DWORD] (_VAL) */ + +- Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->PinConfig.PinConfigValue = AcpiUtReadUint32 (&Tmp32); + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue)); + break; +@@ -1766,7 +1866,8 @@ RsDoPinConfigDescriptor ( + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ +- *PinList = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ *PinList = AcpiUtReadUint16 (&Tmp16); + PinList++; + PinCount++; + +@@ -1797,6 +1898,16 @@ RsDoPinConfigDescriptor ( + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + ++ /* correct the endianness if needed */ ++ Tmp16 = Descriptor->PinConfig.PinTableOffset; ++ Descriptor->PinConfig.PinTableOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinConfig.ResSourceOffset; ++ Descriptor->PinConfig.ResSourceOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinConfig.VendorOffset; ++ Descriptor->PinConfig.VendorOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinConfig.VendorLength; ++ Descriptor->PinConfig.VendorLength = AcpiUtReadUint16 (&Tmp16); ++ + return (Rnode); + } + +@@ -1830,6 +1941,7 @@ RsDoPinGroupDescriptor ( + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; ++ UINT16 Tmp16; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; +@@ -1853,7 +1965,7 @@ RsDoPinGroupDescriptor ( + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; +- Descriptor->PinGroup.ResourceLength = DescriptorSize; ++ Descriptor->PinGroup.ResourceLength = AcpiUtReadUint16 (&DescriptorSize); + Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP; + Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION; + +@@ -1920,7 +2032,8 @@ RsDoPinGroupDescriptor ( + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ +- *PinList = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ *PinList = AcpiUtReadUint16 (&Tmp16); + PinList++; + PinCount++; + +@@ -1951,6 +2064,16 @@ RsDoPinGroupDescriptor ( + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + ++ /* correct enddianness as needed */ ++ Tmp16 = Descriptor->PinGroup.PinTableOffset; ++ Descriptor->PinGroup.PinTableOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroup.LabelOffset; ++ Descriptor->PinGroup.LabelOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroup.VendorOffset; ++ Descriptor->PinGroup.VendorOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroup.VendorLength; ++ Descriptor->PinGroup.VendorLength = AcpiUtReadUint16 (&Tmp16); ++ + return (Rnode); + } + +@@ -1983,6 +2106,7 @@ RsDoPinGroupFunctionDescriptor ( + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; +@@ -2006,7 +2130,7 @@ RsDoPinGroupFunctionDescriptor ( + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; +- Descriptor->PinGroupFunction.ResourceLength = DescriptorSize; ++ Descriptor->PinGroupFunction.ResourceLength = AcpiUtReadUint16 (&DescriptorSize); + Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION; + Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION; + +@@ -2038,7 +2162,8 @@ RsDoPinGroupFunctionDescriptor ( + + case 1: /* Function Number [WORD] */ + +- Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; ++ Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer; ++ Descriptor->PinGroupFunction.FunctionNumber = AcpiUtReadUint16 (&Tmp16); + RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber)); + break; +@@ -2097,6 +2222,16 @@ RsDoPinGroupFunctionDescriptor ( + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + ++ /* correct enddianness as needed */ ++ Tmp16 = Descriptor->PinGroupFunction.ResSourceOffset; ++ Descriptor->PinGroupFunction.ResSourceOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroupFunction.ResSourceLabelOffset; ++ Descriptor->PinGroupFunction.ResSourceLabelOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroupFunction.VendorOffset; ++ Descriptor->PinGroupFunction.VendorOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroupFunction.VendorLength; ++ Descriptor->PinGroupFunction.VendorLength = AcpiUtReadUint16 (&Tmp16); ++ + return (Rnode); + } + +@@ -2129,6 +2264,8 @@ RsDoPinGroupConfigDescriptor ( + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; ++ UINT16 Tmp16; ++ UINT32 Tmp32; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; +@@ -2152,7 +2289,7 @@ RsDoPinGroupConfigDescriptor ( + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; +- Descriptor->PinGroupConfig.ResourceLength = DescriptorSize; ++ Descriptor->PinGroupConfig.ResourceLength = AcpiUtReadUint16 (&DescriptorSize); + Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG; + Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION; + +@@ -2205,7 +2342,8 @@ RsDoPinGroupConfigDescriptor ( + + case 2: /* Pin Config Value [DWORD] (_VAL) */ + +- Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; ++ Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer; ++ Descriptor->PinGroupConfig.PinConfigValue = AcpiUtReadUint32 (&Tmp32); + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue)); + break; +@@ -2266,5 +2404,15 @@ RsDoPinGroupConfigDescriptor ( + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + ++ /* correct enddianness as needed */ ++ Tmp16 = Descriptor->PinGroupConfig.ResSourceOffset; ++ Descriptor->PinGroupConfig.ResSourceOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroupConfig.ResSourceLabelOffset; ++ Descriptor->PinGroupConfig.ResSourceLabelOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroupConfig.VendorOffset; ++ Descriptor->PinGroupConfig.VendorOffset = AcpiUtReadUint16 (&Tmp16); ++ Tmp16 = Descriptor->PinGroupConfig.VendorLength; ++ Descriptor->PinGroupConfig.VendorLength = AcpiUtReadUint16 (&Tmp16); ++ + return (Rnode); + } diff --git a/0044-Initial-support-for-WPBT-in-big-endian-needs-more.patch b/0044-Initial-support-for-WPBT-in-big-endian-needs-more.patch new file mode 100644 index 0000000..1a2b1a2 --- /dev/null +++ b/0044-Initial-support-for-WPBT-in-big-endian-needs-more.patch @@ -0,0 +1,23 @@ +From bd137d3712e6bc7e4d2d11350a208a36750e4063 Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Tue, 6 Jul 2021 18:26:41 -0600 +Subject: [PATCH 44/45] Initial support for WPBT in big-endian, needs more + +Signed-off-by: Al Stone +--- + source/compiler/dttable2.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: acpica-unix2-20210604/source/compiler/dttable2.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/dttable2.c ++++ acpica-unix2-20210604/source/compiler/dttable2.c +@@ -2638,7 +2638,7 @@ DtCompileWpbt ( + AcpiUtWriteUint (&Length, sizeof (UINT16), + &Subtable->TotalLength, sizeof (UINT32)); + Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer); +- Table->ArgumentsLength = Length; ++ Table->ArgumentsLength = AcpiUtReadUint16 (&Length); + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); diff --git a/0045-CSRT-fixed-use-of-optional-ResourceInfo.patch b/0045-CSRT-fixed-use-of-optional-ResourceInfo.patch new file mode 100644 index 0000000..45bfbb5 --- /dev/null +++ b/0045-CSRT-fixed-use-of-optional-ResourceInfo.patch @@ -0,0 +1,213 @@ +From 0d87ee42adda7837bec3cc0ff86e40c2f2e8dc4f Mon Sep 17 00:00:00 2001 +From: Al Stone +Date: Fri, 9 Jul 2021 14:52:55 -0600 +Subject: [PATCH 45/45] CSRT: fixed use of optional ResourceInfo + +In a resource sub-sub-table, there may be a ResourceInfo entry. Neither +the compiler nor disassembler accounted for that possibility properly. + +Signed-off-by: Al Stone +--- + source/common/dmtbdump1.c | 43 +++++++++++++++++++++----------------- + source/compiler/dttable1.c | 28 +++++++++++++------------ + 2 files changed, 39 insertions(+), 32 deletions(-) + +Index: acpica-unix2-20210604/source/common/dmtbdump1.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c ++++ acpica-unix2-20210604/source/common/dmtbdump1.c +@@ -374,11 +374,13 @@ AcpiDmDumpCsrt ( + ACPI_CSRT_GROUP *Subtable; + ACPI_CSRT_SHARED_INFO *SharedInfoTable; + ACPI_CSRT_DESCRIPTOR *SubSubtable; +- UINT32 Length = AcpiUtReadUint32 (&Table->Length); ++ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length); + UINT32 Offset = sizeof (ACPI_TABLE_CSRT); + UINT32 SubOffset; + UINT32 SubSubOffset; + UINT32 InfoLength; ++ UINT32 SubtableLength; ++ UINT32 SubSubtableLength; + + + /* The main table only contains the ACPI header, thus already handled */ +@@ -386,13 +388,14 @@ AcpiDmDumpCsrt ( + /* Subtables (Resource Groups) */ + + Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); +- while (Offset < Length) ++ while (Offset < TableLength) + { + /* Resource group subtable */ + ++ SubtableLength = AcpiUtReadUint32 (&Subtable->Length); + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Length, Offset, Subtable, +- Subtable->Length, AcpiDmTableInfoCsrt0); ++ Status = AcpiDmDumpTable (TableLength, Offset, Subtable, ++ SubtableLength, AcpiDmTableInfoCsrt0); + if (ACPI_FAILURE (Status)) + { + return; +@@ -405,26 +408,28 @@ AcpiDmDumpCsrt ( + Offset + SubOffset); + + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Length, Offset + SubOffset, SharedInfoTable, +- sizeof (ACPI_CSRT_SHARED_INFO), AcpiDmTableInfoCsrt1); ++ Status = AcpiDmDumpTable (TableLength, Offset + SubOffset, ++ SharedInfoTable, sizeof (ACPI_CSRT_SHARED_INFO), ++ AcpiDmTableInfoCsrt1); + if (ACPI_FAILURE (Status)) + { + return; + } + +- SubOffset += Subtable->SharedInfoLength; ++ SubOffset += AcpiUtReadUint32 (&Subtable->SharedInfoLength); + + /* Sub-Subtables (Resource Descriptors) */ + + SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, + Offset + SubOffset); + +- while ((SubOffset < Subtable->Length) && +- ((Offset + SubOffset) < Length)) ++ while ((SubOffset < SubtableLength) && ++ ((Offset + SubOffset) < TableLength)) + { ++ SubSubtableLength = AcpiUtReadUint32 (&SubSubtable->Length); + AcpiOsPrintf ("\n"); +- Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable, +- SubSubtable->Length, AcpiDmTableInfoCsrt2); ++ Status = AcpiDmDumpTable (TableLength, Offset + SubOffset, ++ SubSubtable, SubSubtableLength, AcpiDmTableInfoCsrt2); + if (ACPI_FAILURE (Status)) + { + return; +@@ -434,11 +439,12 @@ AcpiDmDumpCsrt ( + + /* Resource-specific info buffer */ + +- InfoLength = SubSubtable->Length - SubSubOffset; ++ InfoLength = SubSubtableLength - SubSubOffset; + if (InfoLength) + { +- Status = AcpiDmDumpTable (Length, +- Offset + SubOffset + SubSubOffset, Table, ++ Status = AcpiDmDumpTable (TableLength, ++ Offset + SubOffset + SubSubOffset, ++ (UINT8 *)SubSubtable + SubSubOffset, + InfoLength, AcpiDmTableInfoCsrt2a); + if (ACPI_FAILURE (Status)) + { +@@ -448,16 +454,15 @@ AcpiDmDumpCsrt ( + + /* Point to next sub-subtable */ + +- SubOffset += SubSubtable->Length; ++ SubOffset += SubSubtableLength; + SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable, +- SubSubtable->Length); ++ SubSubtableLength); + } + + /* Point to next subtable */ + +- Offset += Subtable->Length; +- Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, +- Subtable->Length); ++ Offset += SubtableLength; ++ Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, SubtableLength); + } + } + +Index: acpica-unix2-20210604/source/compiler/dttable1.c +=================================================================== +--- acpica-unix2-20210604.orig/source/compiler/dttable1.c ++++ acpica-unix2-20210604/source/compiler/dttable1.c +@@ -353,14 +353,16 @@ DtCompileCsrt ( + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; +- UINT32 DescriptorCount; ++ UINT32 DescriptorLength; + UINT32 GroupLength; + UINT32 Tmp; ++ UINT32 Offset; + + + /* Subtables (Resource Groups) */ + + ParentTable = DtPeekSubtable (); ++ + while (*PFieldList) + { + /* Resource group subtable */ +@@ -375,16 +377,13 @@ DtCompileCsrt ( + /* Compute the number of resource descriptors */ + + Tmp = AcpiUtReadUint32 (&(ACPI_CAST_PTR (ACPI_CSRT_GROUP, +- Subtable->Buffer))->Length); ++ Subtable->Buffer))->Length); + GroupLength = Tmp; + Tmp = AcpiUtReadUint32 (&(ACPI_CAST_PTR (ACPI_CSRT_GROUP, +- Subtable->Buffer))->SharedInfoLength); ++ Subtable->Buffer))->SharedInfoLength); + GroupLength -= Tmp; + GroupLength -= sizeof (ACPI_CSRT_GROUP); + +- DescriptorCount = (GroupLength / +- sizeof (ACPI_CSRT_DESCRIPTOR)); +- + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + ParentTable = DtPeekSubtable (); +@@ -399,10 +398,13 @@ DtCompileCsrt ( + } + + DtInsertSubtable (ParentTable, Subtable); ++ DtPushSubtable (Subtable); ++ ParentTable = DtPeekSubtable (); + + /* Sub-Subtables (Resource Descriptors) */ + +- while (*PFieldList && DescriptorCount) ++ Offset = 0; ++ while (*PFieldList && (Offset < GroupLength)) + { + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2, +@@ -411,6 +413,10 @@ DtCompileCsrt ( + { + return (Status); + } ++ DescriptorLength = AcpiUtReadUint32 ( ++ &(ACPI_CAST_PTR (ACPI_CSRT_GROUP, ++ Subtable->Buffer))->Length); ++ + + DtInsertSubtable (ParentTable, Subtable); + +@@ -420,11 +426,7 @@ DtCompileCsrt ( + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoCsrt2a, + &Subtable); +- if (ACPI_FAILURE (Status)) +- { +- return (Status); +- } +- if (Subtable) ++ if (ACPI_SUCCESS (Status) && Subtable) + { + DtInsertSubtable (ParentTable, Subtable); + } +@@ -432,7 +434,7 @@ DtCompileCsrt ( + + DtPopSubtable (); + ParentTable = DtPeekSubtable (); +- DescriptorCount--; ++ Offset += DescriptorLength; + } + + DtPopSubtable (); diff --git a/0045-Correct-a-couple-of-endianness-issues-previously-uns.patch b/0045-Correct-a-couple-of-endianness-issues-previously-uns.patch deleted file mode 100644 index 471ab55..0000000 --- a/0045-Correct-a-couple-of-endianness-issues-previously-uns.patch +++ /dev/null @@ -1,86 +0,0 @@ -From e942e785b3ec47693029e3841075becba31f2635 Mon Sep 17 00:00:00 2001 -From: Al Stone -Date: Wed, 28 Oct 2020 12:53:34 -0600 -Subject: [PATCH] Correct a couple of endianness issues previously unseen - -Just odds and ends of some resource types and ASL analysis - -Signed-off-by: Al Stone ---- - source/compiler/aslanalyze.c | 4 ++-- - source/compiler/aslrestype1.c | 16 ++++++++-------- - source/compiler/aslrestype1i.c | 2 +- - 3 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c -index 63feba2b1..f76a8c3cd 100644 ---- a/source/compiler/aslanalyze.c -+++ b/source/compiler/aslanalyze.c -@@ -577,7 +577,7 @@ ApCheckForGpeNameConflict ( - - /* Need a null-terminated string version of NameSeg */ - -- ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg); -+ ACPI_COPY_NAMESEG (Name, Op->Asl.NameSeg); - Name[ACPI_NAMESEG_SIZE] = 0; - - /* -@@ -604,7 +604,7 @@ ApCheckForGpeNameConflict ( - * We are now sure we have an _Lxx or _Exx. - * Create the target name that would cause collision (Flip E/L) - */ -- ACPI_MOVE_32_TO_32 (Target, Name); -+ ACPI_COPY_NAMESEG (Target, Name); - - /* Inject opposite letter ("L" versus "E") */ - -diff --git a/source/compiler/aslrestype1.c b/source/compiler/aslrestype1.c -index e7639c0bb..fd4428aab 100644 ---- a/source/compiler/aslrestype1.c -+++ b/source/compiler/aslrestype1.c -@@ -328,10 +328,10 @@ RsDoMemory24Descriptor ( - /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24, -- Descriptor->Memory24.Minimum, -- Descriptor->Memory24.Maximum, -- Descriptor->Memory24.AddressLength, -- Descriptor->Memory24.Alignment, -+ (UINT32) AcpiUtReadUint16(&Descriptor->Memory24.Minimum), -+ (UINT32) AcpiUtReadUint16(&Descriptor->Memory24.Maximum), -+ (UINT32) AcpiUtReadUint16(&Descriptor->Memory24.AddressLength), -+ (UINT32) AcpiUtReadUint16(&Descriptor->Memory24.Alignment), - MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp); - - return (Rnode); -@@ -442,10 +442,10 @@ RsDoMemory32Descriptor ( - /* Validate the Min/Max/Len/Align values */ - - RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32, -- Descriptor->Memory32.Minimum, -- Descriptor->Memory32.Maximum, -- Descriptor->Memory32.AddressLength, -- Descriptor->Memory32.Alignment, -+ AcpiUtReadUint32(&Descriptor->Memory32.Minimum), -+ AcpiUtReadUint32(&Descriptor->Memory32.Maximum), -+ AcpiUtReadUint32(&Descriptor->Memory32.AddressLength), -+ AcpiUtReadUint32(&Descriptor->Memory32.Alignment), - MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp); - - return (Rnode); -diff --git a/source/compiler/aslrestype1i.c b/source/compiler/aslrestype1i.c -index 532553c4b..d41e3a1e8 100644 ---- a/source/compiler/aslrestype1i.c -+++ b/source/compiler/aslrestype1i.c -@@ -436,7 +436,7 @@ RsDoFixedIoDescriptor ( - - /* Error checks */ - -- if (Descriptor->FixedIo.Address > 0x03FF) -+ if (AcpiUtReadUint16(&Descriptor->FixedIo.Address) > 0x03FF) - { - AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL); - } --- -2.26.2 - diff --git a/acpica-tools.spec b/acpica-tools.spec index 9480424..e7722b6 100644 --- a/acpica-tools.spec +++ b/acpica-tools.spec @@ -28,47 +28,47 @@ Patch0: 0001-Add-in-basic-infrastructure-for-big-endian-support.patch Patch1: 0002-Modify-utility-functions-to-be-endian-agnostic.patch Patch2: 0003-Always-display-table-header-content-in-human-readabl.patch Patch3: 0004-Re-enable-support-for-big-endian-machines.patch -Patch4: 0005-Support-MADT-aka-APIC-in-a-big-endian-world.patch -Patch5: 0006-Support-ASF-tables-in-a-big-endian-world.patch -Patch6: 0007-Support-CPEP-tables-in-a-big-endian-world.patch -Patch7: 0008-Support-DBG2-table-in-a-big-endian-world.patch -Patch8: 0009-Support-DMAR-in-a-big-endian-world.patch -Patch9: 0010-Support-DRTM-in-a-big-endian-world.patch -Patch10: 0011-Support-EINJ-in-a-big-endian-world.patch -Patch11: 0012-Support-ERST-in-a-big-endian-world.patch -Patch12: 0013-Support-FADT-aka-FACP-in-a-big-endian-world.patch -Patch13: 0014-Support-most-FPDTs-in-a-big-endian-world.patch -Patch14: 0015-Support-GTDT-in-a-big-endian-world.patch -Patch15: 0016-Support-HEST-in-a-big-endian-world.patch -Patch16: 0017-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch -Patch17: 0018-Support-XSDT-in-a-big-endian-world.patch -Patch18: 0019-Support-SRAT-in-a-big-endian-world.patch -Patch19: 0020-Support-SLIT-in-a-big-endian-world.patch -Patch20: 0021-Support-MSCT-in-a-big-endian-world.patch -Patch21: 0022-Support-MPST-in-a-big-endian-world.patch -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 -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 -Patch30: 0031-Support-STAO-in-a-big-endian-world.patch -Patch31: 0032-Support-SLIC-and-MSDM-in-a-big-endian-world.patch -Patch32: 0033-Support-MCFG-in-a-big-endian-world.patch -Patch33: 0034-Support-LPIT-in-a-big-endian-world.patch -Patch34: 0035-Support-PMTT-in-a-big-endian-world.patch -Patch35: 0036-Support-IORT-in-a-big-endian-world.patch -Patch36: 0037-Support-IVRS-in-a-big-endian-world.patch -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 -Patch40: 0041-Support-MTMR-in-a-big-endian-world.patch -Patch41: 0042-Support-VRTC-in-a-big-endian-world.patch -Patch42: 0043-Support-S3PT-in-a-big-endian-world.patch -Patch43: 0044-Correct-an-endian-ness-problem-when-converting-ASL-t.patch -Patch44: 0045-Correct-a-couple-of-endianness-issues-previously-uns.patch +Patch4: 0005-Correct-an-endian-ness-problem-when-converting-ASL-t.patch +Patch5: 0006-Use-more-reliable-ACPI_COPY_NAMSEG-in-GPE-name-check.patch +Patch6: 0007-Handle-dumping-Unicode-properly-when-big-endian.patch +Patch7: 0008-Support-MADT-aka-APIC-in-a-big-endian-world.patch +Patch8: 0009-Support-ASF-tables-in-a-big-endian-world.patch +Patch9: 0010-Support-CPEP-tables-in-a-big-endian-world.patch +Patch10: 0011-Support-DBG2-table-in-a-big-endian-world.patch +Patch11: 0012-Support-DMAR-in-a-big-endian-world.patch +Patch12: 0013-Support-DRTM-in-a-big-endian-world.patch +Patch13: 0014-Support-EINJ-in-a-big-endian-world.patch +Patch14: 0015-Support-ERST-in-a-big-endian-world.patch +Patch15: 0016-Support-FADT-aka-FACP-in-a-big-endian-world.patch +Patch16: 0017-Support-most-FPDTs-in-a-big-endian-world.patch +Patch17: 0018-Support-GTDT-in-a-big-endian-world.patch +Patch18: 0019-Support-HEST-in-a-big-endian-world.patch +Patch19: 0020-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch +Patch20: 0021-Support-XSDT-in-a-big-endian-world.patch +Patch21: 0022-Support-SRAT-in-a-big-endian-world.patch +Patch22: 0023-Support-SLIT-in-a-big-endian-world.patch +Patch23: 0024-Support-MSCT-in-a-big-endian-world.patch +Patch24: 0025-Support-MPST-in-a-big-endian-world.patch +Patch25: 0026-Support-NFIT-in-a-big-endian-world.patch +Patch26: 0027-Support-SDEV-in-a-big-endian-world.patch +Patch27: 0028-Support-HMAT-in-a-big-endian-world.patch +Patch28: 0029-Support-PDTT-in-a-big-endian-world.patch +Patch29: 0030-Support-PPTT-in-a-big-endian-world.patch +Patch30: 0031-Support-PCCT-in-a-big-endian-world.patch +Patch31: 0032-Support-WDAT-in-a-big-endian-world.patch +Patch32: 0033-Support-TCPA-in-a-big-endian-world.patch +Patch33: 0034-Support-STAO-in-a-big-endian-world.patch +Patch34: 0035-Support-SLIC-and-MSDM-in-a-big-endian-world.patch +Patch35: 0036-Support-MCFG-in-a-big-endian-world.patch +Patch36: 0037-Support-LPIT-in-a-big-endian-world.patch +Patch37: 0038-Support-PMTT-in-a-big-endian-world.patch +Patch38: 0039-Support-TPM2-in-a-big-endian-world.patch +Patch39: 0040-Support-S3PT-in-a-big-endian-world.patch +Patch40: 0041-Support-IORT-in-a-big-endian-world.patch +Patch41: 0042-Support-IVRS-in-a-big-endian-world.patch +Patch42: 0043-Support-DSDT-SSDT-in-a-big-endian-world.patch +Patch43: 0044-Initial-support-for-WPBT-in-big-endian-needs-more.patch +Patch44: 0045-CSRT-fixed-use-of-optional-ResourceInfo.patch # other miscellaneous patches Patch100: unaligned.patch @@ -253,11 +253,12 @@ fi %changelog -* Sat Jul 7 2021 Al Stone - 20210604-1 +* Sun Jul 11 2021 Al Stone - 20210604-1 - Update to 20210604 source tree (please note that tarballs for versions between 20200925 and 20210604 have been uploaded for archival reasons but no packaged version of these has been commited to the Fedora project) -- Bring the big-endian patches up-to-date. +- Bring the big-endian patches up-to-date with what has been submitted + upstream (not accepted currently). * Mon Jan 25 2021 Fedora Release Engineering - 20200925-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/arm7hl.patch b/arm7hl.patch index bcac21f..55d4aef 100644 --- a/arm7hl.patch +++ b/arm7hl.patch @@ -1,8 +1,8 @@ -Index: acpica-unix2-20200925/source/include/acmacros.h +Index: acpica-unix2-20210604/source/include/acmacros.h =================================================================== ---- acpica-unix2-20200925.orig/source/include/acmacros.h -+++ acpica-unix2-20200925/source/include/acmacros.h -@@ -163,6 +163,8 @@ +--- acpica-unix2-20210604.orig/source/include/acmacros.h ++++ acpica-unix2-20210604/source/include/acmacros.h +@@ -108,6 +108,8 @@ /* 16-bit source, 16/32/64 destination */ @@ -11,7 +11,7 @@ Index: acpica-unix2-20200925/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];} -@@ -182,6 +184,7 @@ +@@ -127,6 +129,7 @@ /* 64-bit source, 16/32/64 destination */ diff --git a/badcode.asl.result b/badcode.asl.result index 7f3e923..100cd4b 100644 --- a/badcode.asl.result +++ b/badcode.asl.result @@ -256,7 +256,7 @@ Warning 3144 - ^ Method Local is set but never used Intel ACPI Component Architecture ASL+ Optimizing Compiler/Disassembler version VVVVVVVV -Copyright (c) 2000 - 2020 Intel Corporation +Copyright (c) 2000 - 2021 Intel Corporation Ignoring all errors, forcing AML file generation diff --git a/converterSample.asl.result b/converterSample.asl.result index 064ef5f..a3b6ca1 100644 --- a/converterSample.asl.result +++ b/converterSample.asl.result @@ -31,7 +31,7 @@ Remark 2158 - ^ Unnecessary/redundant use of Offset Intel ACPI Component Architecture ASL+ Optimizing Compiler/Disassembler version VVVVVVVV -Copyright (c) 2000 - 2020 Intel Corporation +Copyright (c) 2000 - 2021 Intel Corporation Ignoring all errors, forcing AML file generation diff --git a/grammar.asl.result b/grammar.asl.result index 97fae9a..5269983 100644 --- a/grammar.asl.result +++ b/grammar.asl.result @@ -580,7 +580,7 @@ Warning 3141 - Missing dependency ^ (Device object requires a _HID or _ADR i Intel ACPI Component Architecture ASL+ Optimizing Compiler/Disassembler version VVVVVVVV -Copyright (c) 2000 - 2020 Intel Corporation +Copyright (c) 2000 - 2021 Intel Corporation Ignoring all errors, forcing AML file generation diff --git a/str-trunc-warn.patch b/str-trunc-warn.patch index 1355b0c..eeb47c3 100644 --- a/str-trunc-warn.patch +++ b/str-trunc-warn.patch @@ -14,8 +14,8 @@ Index: acpica-unix2-20200925/source/compiler/aslanalyze.c "Method returns [%s], %s operator requires [%s]", AslGbl_StringBuffer, OpInfo->Name, AslGbl_StringBuffer2); -- AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer); -+ AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, strp); +- AslError (ASL_WARNING, ASL_MSG_INVALID_TYPE, ArgOp, AslGbl_MsgBuffer); ++ AslError (ASL_WARNING, ASL_MSG_INVALID_TYPE, ArgOp, strp); + if (cnt > 0) + free(strp); } diff --git a/ull-32bit.patch b/ull-32bit.patch index 3d8fe39..7d0580b 100644 --- a/ull-32bit.patch +++ b/ull-32bit.patch @@ -1,14 +1,15 @@ -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-27 08:50:34.949398104 -0500 -+++ acpica-unix2-20200925/source/common/dmtbdump.c 2020-10-27 08:54:27.609955141 -0500 -@@ -333,7 +333,11 @@ +Index: acpica-unix2-20210604/source/common/dmtbdump.c +=================================================================== +--- acpica-unix2-20210604.orig/source/common/dmtbdump.c ++++ acpica-unix2-20210604/source/common/dmtbdump.c +@@ -338,7 +338,11 @@ AcpiDmDumpXsdt ( for (i = 0; i < Entries; i++) { AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i); +#if ACPI_MACHINE_WIDTH == 32 -+ AcpiOsPrintf ("%16.16llX\n", AcpiUtReadUint64(&Array[i])); ++ AcpiOsPrintf ("%16.16llX\n", AcpiUtReadUint64 (&Array[i])); +#else - AcpiOsPrintf ("%16.16lX\n", AcpiUtReadUint64(&Array[i])); + AcpiOsPrintf ("%16.16lX\n", AcpiUtReadUint64 (&Array[i])); +#endif Offset += sizeof (UINT64); }