[packages/acpica/dev-20220331] - updated to 20220331 + current Fedora patch set; acpinames is gone

qboosh qboosh at pld-linux.org
Thu Jun 29 22:40:33 CEST 2023


commit b643ab7edd44dd1987bf605db0c6e71c415c8e86
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Jun 29 22:33:47 2023 +0200

    - updated to 20220331 + current Fedora patch set; acpinames is gone

 ...sic-infrastructure-for-big-endian-support.patch |  530 ++
 ...y-utility-functions-to-be-endian-agnostic.patch |  200 +
 ...lay-table-header-content-in-human-readabl.patch |   45 +
 ...Re-enable-support-for-big-endian-machines.patch |   78 +
 ...endian-ness-problem-when-converting-ASL-t.patch |   41 +
 ...liable-ACPI_COPY_NAMSEG-in-GPE-name-check.patch |   32 +
 ...-dumping-Unicode-properly-when-big-endian.patch |   53 +
 ...pport-MADT-aka-APIC-in-a-big-endian-world.patch |   32 +
 ...-Support-ASF-tables-in-a-big-endian-world.patch |   55 +
 ...Support-CPEP-tables-in-a-big-endian-world.patch |   32 +
 ...-Support-DBG2-table-in-a-big-endian-world.patch |  256 +
 0012-Support-DMAR-in-a-big-endian-world.patch      |  171 +
 0013-Support-DRTM-in-a-big-endian-world.patch      |  112 +
 0014-Support-EINJ-in-a-big-endian-world.patch      |   32 +
 0015-Support-ERST-in-a-big-endian-world.patch      |   32 +
 ...pport-FADT-aka-FACP-in-a-big-endian-world.patch |  189 +
 ...-Support-most-FPDTs-in-a-big-endian-world.patch |   85 +
 0018-Support-GTDT-in-a-big-endian-world.patch      |   69 +
 0019-Support-HEST-in-a-big-endian-world.patch      |   75 +
 ...upport-RSDT-RSD-PTR-in-a-big-endian-world.patch |   37 +
 0021-Support-XSDT-in-a-big-endian-world.patch      |   38 +
 0022-Support-SRAT-in-a-big-endian-world.patch      |   52 +
 0023-Support-SLIT-in-a-big-endian-world.patch      |   61 +
 0024-Support-MSCT-in-a-big-endian-world.patch      |   43 +
 0025-Support-MPST-in-a-big-endian-world.patch      |  152 +
 0026-Support-NFIT-in-a-big-endian-world.patch      |  227 +
 0027-Support-SDEV-in-a-big-endian-world.patch      |  206 +
 0028-Support-HMAT-in-a-big-endian-world.patch      |  278 +
 0029-Support-PDTT-in-a-big-endian-world.patch      |   43 +
 0030-Support-PPTT-in-a-big-endian-world.patch      |  105 +
 0031-Support-PCCT-in-a-big-endian-world.patch      |   54 +
 0032-Support-WDAT-in-a-big-endian-world.patch      |   43 +
 0033-Support-TCPA-in-a-big-endian-world.patch      |   76 +
 0034-Support-STAO-in-a-big-endian-world.patch      |   40 +
 ...pport-SLIC-and-MSDM-in-a-big-endian-world.patch |   33 +
 0036-Support-MCFG-in-a-big-endian-world.patch      |   50 +
 0037-Support-LPIT-in-a-big-endian-world.patch      |   46 +
 0038-Support-PMTT-in-a-big-endian-world.patch      |   85 +
 0039-Support-TPM2-in-a-big-endian-world.patch      |  119 +
 0040-Support-S3PT-in-a-big-endian-world.patch      |   96 +
 0041-Support-IORT-in-a-big-endian-world.patch      |  414 ++
 0042-Support-IVRS-in-a-big-endian-world.patch      |  138 +
 0043-Support-DSDT-SSDT-in-a-big-endian-world.patch | 3171 ++++++++++
 ...support-for-WPBT-in-big-endian-needs-more.patch |   23 +
 0045-CSRT-fixed-use-of-optional-ResourceInfo.patch |  213 +
 0046-Support-PHAT-in-a-big-endian-world.patch      |  180 +
 0047-Support-PRMT-in-a-big-endian-world.patch      |   51 +
 0048-Support-RGRT-in-a-big-endian-world.patch      |   35 +
 0049-Support-SVKL-in-a-big-endian-world.patch      |   42 +
 acpica-OPT_LDFLAGS.patch                           |   26 +
 acpica-dangling-ptr.patch                          |   24 +
 acpica-dbtest.patch                                |   40 +
 acpica-simple-64bit.patch                          |   21 +
 acpica-ull-32bit.patch                             |   16 +
 debian-unaligned.patch => acpica-unaligned.patch   |   12 +-
 acpica-uuid-len.patch                              |   12 +
 acpica.spec                                        |  149 +-
 acpinames.1                                        |   49 -
 aslcodegen.patch                                   |   29 -
 big-endian-v2.patch                                |   19 -
 debian-big_endian.patch                            | 6629 --------------------
 facp.patch                                         |   28 -
 int-format.patch                                   |  102 +-
 mips-be-fix.patch                                  |   23 +-
 ppc64le.patch                                      |   16 -
 ptr-cast.patch                                     |   21 +-
 str-trunc-warn.patch                               |   22 +-
 67 files changed, 8614 insertions(+), 6894 deletions(-)
---
diff --git a/acpica.spec b/acpica.spec
index f329b24..17dae23 100644
--- a/acpica.spec
+++ b/acpica.spec
@@ -5,44 +5,94 @@
 Summary:	ACPI Component Architecture - an assembler and disassembler for DSDT tables
 Summary(pl.UTF-8):	ACPI CA - asembler i disasembler dla tablic DSDT
 Name:		acpica
-Version:	20200430
+Version:	20220331
 Release:	1
 License:	GPL v2
 Group:		Development/Tools
-Source0:	https://acpica.org/sites/acpica/files/%{name}-unix-%{version}.tar.gz
-# Source0-md5:	7888f1e1e67f1bbaf33f1a869d1f0482
+Source0:	https://acpica.org/sites/acpica/files/%{name}-unix2-%{version}.tar.gz
+# Source0-md5:	5721db851442be86054d45acd1dcacef
 Source1:	https://acpica.org/sites/acpica/files/acpitests-unix-%{version}.tar.gz
-# Source1-md5:	69cb94daf85cd5d5bd374c077cf66499
+# Source1-md5:	9902b30fd402852a90a4ec59e471c5ff
 Source2:	iasl.1
 Source3:	acpibin.1
 Source4:	acpidump.1
 Source5:	acpiexec.1
 Source6:	acpihelp.1
-Source7:	acpinames.1
 Source8:	acpisrc.1
 Source9:	acpixtract.1
-Patch0:		debian-big_endian.patch
-Patch1:		debian-unaligned.patch
-Patch6:		int-format.patch
-Patch8:		facp.patch
-Patch9:		template.patch
-Patch11:	ppc64le.patch
-Patch12:	arm7hl.patch
-Patch13:	armv7-str-fixes.patch
-Patch14:	big-endian-v2.patch
-Patch16:	mips-be-fix.patch
-Patch17:	cve-2017-13693.patch
-Patch18:	cve-2017-13694.patch
-Patch19:	cve-2017-13695.patch
-Patch20:	str-trunc-warn.patch
-Patch21:	ptr-cast.patch
-Patch22:	aslcodegen.patch
+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-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
+# skipped in Fedora(?)
+#Patch43:	0044-Initial-support-for-WPBT-in-big-endian-needs-more.patch
+Patch44:	0045-CSRT-fixed-use-of-optional-ResourceInfo.patch
+Patch45:	0046-Support-PHAT-in-a-big-endian-world.patch
+Patch46:	0047-Support-PRMT-in-a-big-endian-world.patch
+Patch47:	0048-Support-RGRT-in-a-big-endian-world.patch
+Patch48:	0049-Support-SVKL-in-a-big-endian-world.patch
+Patch100:	%{name}-unaligned.patch
+Patch101:	%{name}-OPT_LDFLAGS.patch
+Patch102:	int-format.patch
+Patch104:	template.patch
+Patch105:	arm7hl.patch
+Patch106:       %{name}-simple-64bit.patch
+Patch107:	mips-be-fix.patch
+Patch108:	cve-2017-13693.patch
+Patch109:	cve-2017-13694.patch
+Patch110:	cve-2017-13695.patch
+Patch111:	str-trunc-warn.patch
+Patch112:	ptr-cast.patch
+Patch113:	armv7-str-fixes.patch
+Patch114:	%{name}-dbtest.patch
+Patch115:	%{name}-ull-32bit.patch
+Patch116:	%{name}-dangling-ptr.patch
+Patch117:	%{name}-uuid-len.patch
 URL:		https://acpica.org/
 BuildRequires:	bison
 BuildRequires:	flex
 BuildRequires:	sed >= 4.0
 Provides:	iasl
-Obsoletes:	iasl
+Obsoletes:	iasl < 20061110
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -54,17 +104,24 @@ Pakiet ACPI Component Architecture zawiera asembler i disasembler do
 tablic DSDT.
 
 %prep
-%setup -q -n %{name}-unix-%{version}
+%setup -q -n %{name}-unix2-%{version}
 tar -x --strip-components=1 -f %{SOURCE1}
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
 %patch6 -p1
+%patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
 %patch11 -p1
 %patch12 -p1
 %patch13 -p1
 %patch14 -p1
+%patch15 -p1
 %patch16 -p1
 %patch17 -p1
 %patch18 -p1
@@ -72,6 +129,48 @@ tar -x --strip-components=1 -f %{SOURCE1}
 %patch20 -p1
 %patch21 -p1
 %patch22 -p1
+%patch23 -p1
+%patch24 -p1
+%patch25 -p1
+%patch26 -p1
+%patch27 -p1
+%patch28 -p1
+%patch29 -p1
+%patch30 -p1
+%patch31 -p1
+%patch32 -p1
+%patch33 -p1
+%patch34 -p1
+%patch35 -p1
+%patch36 -p1
+%patch37 -p1
+%patch38 -p1
+%patch39 -p1
+%patch40 -p1
+%patch41 -p1
+%patch42 -p1
+#patch43 -p1
+%patch44 -p1
+%patch45 -p1
+%patch46 -p1
+%patch47 -p1
+%patch100 -p1
+%patch101 -p1
+%patch102 -p1
+%patch104 -p1
+%patch105 -p1
+%patch106 -p1
+%patch107 -p1
+%patch108 -p1
+%patch109 -p1
+%patch110 -p1
+%patch111 -p1
+%patch112 -p1
+%patch113 -p1
+%patch114 -p1
+%patch115 -p1
+%patch116 -p1
+%patch117 -p1
 
 %build
 %define	makeopts \\\
@@ -112,7 +211,7 @@ rm -rf $RPM_BUILD_ROOT
 	DESTDIR=$RPM_BUILD_ROOT
 
 install -d $RPM_BUILD_ROOT%{_mandir}/man1
-cp -p %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} %{SOURCE9} \
+cp -p %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE8} %{SOURCE9} \
 	$RPM_BUILD_ROOT%{_mandir}/man1
 
 %{__rm} $RPM_BUILD_ROOT%{_bindir}/acpiexamples
@@ -127,7 +226,6 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_bindir}/acpidump
 %attr(755,root,root) %{_bindir}/acpiexec
 %attr(755,root,root) %{_bindir}/acpihelp
-%attr(755,root,root) %{_bindir}/acpinames
 %attr(755,root,root) %{_bindir}/acpisrc
 %attr(755,root,root) %{_bindir}/acpixtract
 %attr(755,root,root) %{_bindir}/iasl
@@ -135,7 +233,6 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/acpidump.1*
 %{_mandir}/man1/acpiexec.1*
 %{_mandir}/man1/acpihelp.1*
-%{_mandir}/man1/acpinames.1*
 %{_mandir}/man1/acpisrc.1*
 %{_mandir}/man1/acpixtract.1*
 %{_mandir}/man1/iasl.1*
diff --git a/0001-Add-in-basic-infrastructure-for-big-endian-support.patch b/0001-Add-in-basic-infrastructure-for-big-endian-support.patch
new file mode 100644
index 0000000..4e12c34
--- /dev/null
+++ b/0001-Add-in-basic-infrastructure-for-big-endian-support.patch
@@ -0,0 +1,530 @@
+From 4594630ec2e6a33efce3047a86b08fa170b75848 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Thu, 15 Oct 2020 11:53:33 -0600
+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
+format -- along with AcpiUtWriteUint() that writes out an integer in
+host-native format as a little-endian value.
+
+But, to do that, I'm adding the functions in a new file: utendian.c.  So,
+the header files need fixing, and the makefiles need to be sure to compile
+the new code.  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
+the cases I know about.
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ generate/unix/acpibin/Makefile         |   1 +
+ generate/unix/acpidump/Makefile        |   1 +
+ generate/unix/acpiexamples/Makefile    |   1 +
+ generate/unix/acpiexec/Makefile        |   1 +
+ generate/unix/acpihelp/Makefile        |   1 +
+ generate/unix/iasl/Makefile            |   1 +
+ source/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-20220331/generate/unix/acpibin/Makefile
+===================================================================
+--- acpica-unix2-20220331.orig/generate/unix/acpibin/Makefile
++++ acpica-unix2-20220331/generate/unix/acpibin/Makefile
+@@ -37,6 +37,7 @@ OBJECTS = \
+ 	$(OBJDIR)/utcache.o\
+ 	$(OBJDIR)/utdebug.o\
+ 	$(OBJDIR)/utdecode.o\
++	$(OBJDIR)/utendian.o\
+ 	$(OBJDIR)/utexcep.o\
+ 	$(OBJDIR)/utglobal.o\
+ 	$(OBJDIR)/utlock.o\
+Index: acpica-unix2-20220331/generate/unix/acpidump/Makefile
+===================================================================
+--- acpica-unix2-20220331.orig/generate/unix/acpidump/Makefile
++++ acpica-unix2-20220331/generate/unix/acpidump/Makefile
+@@ -36,6 +36,7 @@ OBJECTS = \
+ 	$(OBJDIR)/osunixdir.o\
+ 	$(OBJDIR)/osunixmap.o\
+ 	$(OBJDIR)/osunixxf.o\
++	$(OBJDIR)/utendian.o\
+ 	$(OBJDIR)/tbprint.o\
+ 	$(OBJDIR)/tbxfroot.o\
+ 	$(OBJDIR)/utascii.o\
+Index: acpica-unix2-20220331/generate/unix/acpiexamples/Makefile
+===================================================================
+--- acpica-unix2-20220331.orig/generate/unix/acpiexamples/Makefile
++++ acpica-unix2-20220331/generate/unix/acpiexamples/Makefile
+@@ -139,6 +139,7 @@ OBJECTS = \
+ 	$(OBJDIR)/utdebug.o\
+ 	$(OBJDIR)/utdecode.o\
+ 	$(OBJDIR)/utdelete.o\
++	$(OBJDIR)/utendian.o\
+ 	$(OBJDIR)/uterror.o\
+ 	$(OBJDIR)/uteval.o\
+ 	$(OBJDIR)/utexcep.o\
+Index: acpica-unix2-20220331/generate/unix/acpiexec/Makefile
+===================================================================
+--- acpica-unix2-20220331.orig/generate/unix/acpiexec/Makefile
++++ acpica-unix2-20220331/generate/unix/acpiexec/Makefile
+@@ -214,6 +214,7 @@ OBJECTS = \
+ 	$(OBJDIR)/utdebug.o\
+ 	$(OBJDIR)/utdecode.o\
+ 	$(OBJDIR)/utdelete.o\
++	$(OBJDIR)/utendian.o\
+ 	$(OBJDIR)/uterror.o\
+ 	$(OBJDIR)/uteval.o\
+ 	$(OBJDIR)/utexcep.o\
+Index: acpica-unix2-20220331/generate/unix/acpihelp/Makefile
+===================================================================
+--- acpica-unix2-20220331.orig/generate/unix/acpihelp/Makefile
++++ acpica-unix2-20220331/generate/unix/acpihelp/Makefile
+@@ -45,6 +45,7 @@ OBJECTS = \
+ 	$(OBJDIR)/getopt.o\
+ 	$(OBJDIR)/osunixxf.o\
+ 	$(OBJDIR)/utdebug.o\
++	$(OBJDIR)/utendian.o\
+ 	$(OBJDIR)/utexcep.o\
+ 	$(OBJDIR)/utglobal.o\
+ 	$(OBJDIR)/uthex.o\
+Index: acpica-unix2-20220331/generate/unix/iasl/Makefile
+===================================================================
+--- acpica-unix2-20220331.orig/generate/unix/iasl/Makefile
++++ acpica-unix2-20220331/generate/unix/iasl/Makefile
+@@ -225,6 +225,7 @@ OBJECTS = \
+ 	$(OBJDIR)/utdebug.o\
+ 	$(OBJDIR)/utdecode.o\
+ 	$(OBJDIR)/utdelete.o\
++	$(OBJDIR)/utendian.o\
+ 	$(OBJDIR)/uterror.o\
+ 	$(OBJDIR)/utexcep.o\
+ 	$(OBJDIR)/utglobal.o\
+Index: acpica-unix2-20220331/source/compiler/aslcompiler.h
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/aslcompiler.h
++++ acpica-unix2-20220331/source/compiler/aslcompiler.h
+@@ -1120,10 +1120,6 @@ BOOLEAN
+ UtIsIdInteger (
+     UINT8                   *Target);
+ 
+-UINT8
+-UtIsBigEndianMachine (
+-    void);
+-
+ BOOLEAN
+ UtQueryForOverwrite (
+     char                    *Pathname);
+Index: acpica-unix2-20220331/source/compiler/aslutils.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/aslutils.c
++++ acpica-unix2-20220331/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-20220331/source/components/utilities/utendian.c
+===================================================================
+--- /dev/null
++++ acpica-unix2-20220331/source/components/utilities/utendian.c
+@@ -0,0 +1,236 @@
++/******************************************************************************
++ *
++ * Module Name: utendian -- byte swapping support for other-endianness
++ *
++ *****************************************************************************/
++
++/*****************************************************************************
++ *
++ * Copyright (c) 2020, Al Stone <ahs3 at redhat.com>
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions, and the following disclaimer,
++ *    without modification.
++ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
++ *    substantially similar to the "NO WARRANTY" disclaimer below
++ *    ("Disclaimer") and any redistribution must be conditioned upon
++ *    including a substantially similar Disclaimer requirement for further
++ *    binary redistribution.
++ * 3. Neither the names of the above-listed copyright holders nor the names
++ *    of any contributors may be used to endorse or promote products derived
++ *    from this software without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
++ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
++ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
++ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
++ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ *
++ * Alternatively, you may choose to be licensed under the terms of the
++ * GNU General Public License ("GPL") version 2 as published by the Free
++ * Software Foundation.
++ *
++ *****************************************************************************/
++
++#include "acpi.h"
++#include "accommon.h"
++
++#define _COMPONENT          ACPI_COMPILER
++        ACPI_MODULE_NAME    ("utendian")
++
++/*
++ * Endianness support functions.
++ *
++ * Ultimately, everything in ACPI tables or AML must be in little-endian
++ * format.  However, we sometimes find it necessary to run on a big-endian
++ * machine and create or read those little-endian values.  This is a small
++ * libary of functions to make that easier, and more visible.
++ *
++ */
++
++/*******************************************************************************
++ *
++ * FUNCTION:    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
++ *                                    value
++ *
++ * RETURN:      UINT16 value in host-native form
++ *
++ * DESCRIPTION: Read a UINT16 little-endian value from a given location
++ *              and return it in host-native form
++ *
++ ******************************************************************************/
++
++UINT16
++AcpiUtReadUint16 (
++    void                    *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);
++}
++
++/*******************************************************************************
++ *
++ * FUNCTION:    AcpiUtReadUint32
++ *
++ * PARAMETERS:  Src         - location containing the little-endian
++ *                                    value
++ *
++ * RETURN:      UINT32 value in host-native form
++ *
++ * DESCRIPTION: Read a UINT32 little-endian value from a given location
++ *              and return it in host-native form
++ *
++ ******************************************************************************/
++
++UINT32
++AcpiUtReadUint32 (
++    void                    *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);
++}
++
++/*******************************************************************************
++ *
++ * FUNCTION:    AcpiUtReadUint64
++ *
++ * PARAMETERS:  Src         - location containing the little-endian
++ *                                    value
++ *
++ * RETURN:      UINT64 value in host-native form
++ *
++ * DESCRIPTION: Read a UINT64 little-endian value from a given location
++ *              and return it in host-native form
++ *
++ ******************************************************************************/
++
++UINT64
++AcpiUtReadUint64 (
++    void                    *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];
++    Dst[2] = Src[5];
++    Dst[3] = Src[4];
++    Dst[4] = Src[3];
++    Dst[5] = Src[2];
++    Dst[6] = Src[1];
++    Dst[7] = Src[0];
++
++    return (Result);
++}
++
++/*******************************************************************************
++ *
++ * FUNCTION:    AcpiUtWriteUint
++ *
++ * PARAMETERS:  DstPtr      - where to place the retrieved value
++ *              DstLength   - space in bytes for this int type
++ *              SrcPtr      - where the little-endian value lives
++ *              SrcLength   - space in bytes for this int type
++ *
++ * RETURN:      None.
++ *
++ * DESCRIPTION: Write a host-native integer value of the given size, and
++ *              store it in the location specified in little-endian form.
++ *              Given the amount of integer type casting done, this general
++ *              version seems the most useful (vs 32->32, 32->16, 16->32,
++ *              ad infinitum)
++ *
++ ******************************************************************************/
++
++void
++AcpiUtWriteUint (
++    void                    *DstPtr,
++    int                     DstLength,
++    const void              *SrcPtr,
++    const int               SrcLength)
++{
++    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];
++
++}
+Index: acpica-unix2-20220331/source/include/acmacros.h
+===================================================================
+--- acpica-unix2-20220331.orig/source/include/acmacros.h
++++ acpica-unix2-20220331/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-20220331/source/include/acutils.h
+===================================================================
+--- acpica-unix2-20220331.orig/source/include/acutils.h
++++ acpica-unix2-20220331/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)
++UINT32
++AcpiUtReadUint32 (
++    void                    *SrcPtr);
++
++UINT16
++AcpiUtReadUint16 (
++    void                    *SrcPtr);
++
++UINT64
++AcpiUtReadUint64 (
++    void                    *SrcPtr);
++
++void  
++AcpiUtWriteUint (
++    void                    *DstPtr,
++    int                     DstLength,
++    const void              *SrcPtr,
++    const int               SrcLength);
++#endif
++
+ #endif /* _ACUTILS_H */
+Index: acpica-unix2-20220331/source/include/platform/aclinux.h
+===================================================================
+--- acpica-unix2-20220331.orig/source/include/platform/aclinux.h
++++ acpica-unix2-20220331/source/include/platform/aclinux.h
+@@ -203,6 +203,7 @@
+ 
+ #ifdef ACPI_USE_STANDARD_HEADERS
+ #include <unistd.h>
++#include <endian.h>
+ #endif
+ 
+ /* Define/disable kernel-specific declarators */
diff --git a/0002-Modify-utility-functions-to-be-endian-agnostic.patch b/0002-Modify-utility-functions-to-be-endian-agnostic.patch
new file mode 100644
index 0000000..a328096
--- /dev/null
+++ b/0002-Modify-utility-functions-to-be-endian-agnostic.patch
@@ -0,0 +1,200 @@
+From 51b0d06c0a6c4d4e19432ebf930299855c8fcf23 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 18 Sep 2020 15:14:30 -0600
+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
+does not need to change further to work on both big- and little-endian
+machines.
+
+These particular files were changed to handle the reading and writing
+of files (the length is often embedded in the binary stream), and to
+handle the reading and writing of integer values.  The common cases are
+to "read" a 32-bit unsigned int in little-endian format, but convert it
+to host-native, and to write a byte, word, double word or quad word value
+as little-endian, regardless of host-native format.
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/acfileio.c           | 16 ++++++++++------
+ source/common/dmtable.c            |  8 ++++----
+ source/compiler/dtfield.c          |  2 +-
+ source/compiler/dtsubtable.c       |  4 ++--
+ source/components/tables/tbprint.c | 13 +++++++++----
+ 5 files changed, 26 insertions(+), 17 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/acfileio.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/acfileio.c
++++ acpica-unix2-20220331/source/common/acfileio.c
+@@ -280,6 +280,7 @@ AcGetOneTableFromFile (
+     ACPI_TABLE_HEADER       *Table;
+     INT32                   Count;
+     long                    TableOffset;
++    UINT32                  Length;
+ 
+ 
+     *ReturnTable = NULL;
+@@ -319,7 +320,8 @@ AcGetOneTableFromFile (
+ 
+     /* Allocate a buffer for the entire table */
+ 
+-    Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
++    Length = AcpiUtReadUint32 (&TableHeader.Length);
++    Table = AcpiOsAllocate ((ACPI_SIZE) Length);
+     if (!Table)
+     {
+         return (AE_NO_MEMORY);
+@@ -329,13 +331,13 @@ AcGetOneTableFromFile (
+ 
+     fseek (File, TableOffset, SEEK_SET);
+ 
+-    Count = fread (Table, 1, TableHeader.Length, File);
++    Count = fread (Table, 1, Length, File);
+ 
+     /*
+      * Checks for data table headers happen later in the execution. Only verify
+      * for Aml tables at this point in the code.
+      */
+-    if (GetOnlyAmlTables && Count != (INT32) TableHeader.Length)
++    if (GetOnlyAmlTables && Count != (INT32) Length)
+     {
+         Status = AE_ERROR;
+         goto ErrorExit;
+@@ -343,7 +345,7 @@ AcGetOneTableFromFile (
+ 
+     /* Validate the checksum (just issue a warning) */
+ 
+-    Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
++    Status = AcpiTbVerifyChecksum (Table, Length);
+     if (ACPI_FAILURE (Status))
+     {
+         Status = AcCheckTextModeCorruption (Table);
+@@ -436,6 +438,7 @@ AcValidateTableHeader (
+     long                    OriginalOffset;
+     UINT32                  FileSize;
+     UINT32                  i;
++    UINT32                  Length;
+ 
+ 
+     ACPI_FUNCTION_TRACE (AcValidateTableHeader);
+@@ -472,11 +475,12 @@ AcValidateTableHeader (
+     /* Validate table length against bytes remaining in the file */
+ 
+     FileSize = CmGetFileSize (File);
+-    if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
++    Length = AcpiUtReadUint32 (&TableHeader.Length);
++    if (Length > (UINT32) (FileSize - TableOffset))
+     {
+         fprintf (stderr, "Table [%4.4s] is too long for file - "
+             "needs: 0x%.2X, remaining in file: 0x%.2X\n",
+-            TableHeader.Signature, TableHeader.Length,
++            TableHeader.Signature, Length,
+             (UINT32) (FileSize - TableOffset));
+         return (AE_BAD_HEADER);
+     }
+Index: acpica-unix2-20220331/source/common/dmtable.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtable.c
++++ acpica-unix2-20220331/source/common/dmtable.c
+@@ -713,7 +713,7 @@ AcpiDmDumpDataTable (
+         {
+             /* Dump the raw table data */
+ 
+-            Length = Table->Length;
++            Length = AcpiUtReadUint32 (&Table->Length);
+ 
+             AcpiOsPrintf ("\n/*\n%s: Length %d (0x%X)\n\n",
+                 ACPI_RAW_TABLE_DATA_HEADER, Length, Length);
+@@ -730,7 +730,7 @@ AcpiDmDumpDataTable (
+      */
+     if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
+     {
+-        Length = Table->Length;
++        Length = AcpiUtReadUint32 (&Table->Length);
+         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -751,7 +751,7 @@ AcpiDmDumpDataTable (
+         /*
+          * All other tables must use the common ACPI table header, dump it now
+          */
+-        Length = Table->Length;
++        Length = AcpiUtReadUint32(&Table->Length);
+         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -1415,7 +1415,7 @@ AcpiDmDumpTable (
+ 
+             AcpiOsPrintf ("%2.2X", *Target);
+             Temp8 = AcpiDmGenerateChecksum (Table,
+-                ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
++                AcpiUtReadUint32 (&(ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length)),
+                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
+ 
+             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
+Index: acpica-unix2-20220331/source/compiler/dtfield.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dtfield.c
++++ acpica-unix2-20220331/source/compiler/dtfield.c
+@@ -361,7 +361,7 @@ DtCompileInteger (
+         DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, AslGbl_MsgBuffer);
+     }
+ 
+-    memcpy (Buffer, &Value, ByteLength);
++    AcpiUtWriteUint (Buffer, ByteLength, &Value, sizeof (UINT64));
+     return;
+ }
+ 
+Index: acpica-unix2-20220331/source/compiler/dtsubtable.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dtsubtable.c
++++ acpica-unix2-20220331/source/compiler/dtsubtable.c
+@@ -378,6 +378,6 @@ DtSetSubtableLength (
+         return;
+     }
+ 
+-    memcpy (Subtable->LengthField, &Subtable->TotalLength,
+-        Subtable->SizeOfLengthField);
++    AcpiUtWriteUint (Subtable->LengthField, Subtable->SizeOfLengthField,
++                     &Subtable->TotalLength, sizeof (Subtable->TotalLength));
+ }
+Index: acpica-unix2-20220331/source/components/tables/tbprint.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/components/tables/tbprint.c
++++ acpica-unix2-20220331/source/components/tables/tbprint.c
+@@ -44,6 +44,8 @@
+ #include "acpi.h"
+ #include "accommon.h"
+ #include "actables.h"
++#include "platform/acenv.h"
++#include "acutils.h"
+ 
+ #define _COMPONENT          ACPI_TABLES
+         ACPI_MODULE_NAME    ("tbprint")
+@@ -151,7 +153,7 @@ AcpiTbPrintTableHeader (
+ 
+         ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
+             Header->Signature, ACPI_FORMAT_UINT64 (Address),
+-            Header->Length));
++            AcpiUtReadUint32 (&Header->Length)));
+     }
+     else if (ACPI_VALIDATE_RSDP_SIG (ACPI_CAST_PTR (ACPI_TABLE_RSDP,
+         Header)->Signature))
+@@ -179,9 +181,12 @@ AcpiTbPrintTableHeader (
+             "%-4.4s 0x%8.8X%8.8X"
+             " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
+             LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
+-            LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
+-            LocalHeader.OemTableId, LocalHeader.OemRevision,
+-            LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
++            AcpiUtReadUint32 (&LocalHeader.Length),
++            LocalHeader.Revision, LocalHeader.OemId,
++            LocalHeader.OemTableId,
++            AcpiUtReadUint32 (&LocalHeader.OemRevision),
++            LocalHeader.AslCompilerId,
++            AcpiUtReadUint32 (&LocalHeader.AslCompilerRevision)));
+     }
+ }
+ 
diff --git a/0003-Always-display-table-header-content-in-human-readabl.patch b/0003-Always-display-table-header-content-in-human-readabl.patch
new file mode 100644
index 0000000..f540ac1
--- /dev/null
+++ b/0003-Always-display-table-header-content-in-human-readabl.patch
@@ -0,0 +1,45 @@
+From 62cc2f4ae212bd0fad83f643921ac216ebb9a986 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 18 Sep 2020 15:20:37 -0600
+Subject: [PATCH 03/45] Always display table header content in human-readable
+ form
+
+When comparing two binary data tables, little-endian values are read
+from each table header and printed out.  Make sure they show up in a
+form that makes sense to humans.
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/tools/acpibin/abcompare.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+Index: acpica-unix2-20220331/source/tools/acpibin/abcompare.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/tools/acpibin/abcompare.c
++++ acpica-unix2-20220331/source/tools/acpibin/abcompare.c
+@@ -42,6 +42,7 @@
+  */
+ 
+ #include "acpibin.h"
++#include "acutils.h"
+ 
+ 
+ ACPI_TABLE_HEADER           Header1;
+@@ -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 ("Revision           %8.2X : %2.2X\n",    Header->Revision, Header2->Revision);
+     printf ("Checksum           %8.2X : %2.2X\n",    Header->Checksum, Header2->Checksum);
+     printf ("OEM ID             %8.6s : %.6s\n",     Header->OemId, Header2->OemId);
+     printf ("OEM Table ID       %8.8s : %.8s\n",     Header->OemTableId, Header2->OemTableId);
+-    printf ("OEM Revision       %8.8X : %8.8X\n",    Header->OemRevision, Header2->OemRevision);
++    printf ("OEM Revision       %8.8X : %8.8X\n",    AcpiUtReadUint32 (&Header->OemRevision), AcpiUtReadUint32 (&Header2->OemRevision));
+     printf ("ASL Compiler ID    %8.4s : %.4s\n",     Header->AslCompilerId, Header2->AslCompilerId);
+-    printf ("Compiler Revision  %8.8X : %8.8X\n",    Header->AslCompilerRevision, Header2->AslCompilerRevision);
++    printf ("Compiler Revision  %8.8X : %8.8X\n",    AcpiUtReadUint32 (&Header->AslCompilerRevision), AcpiUtReadUint32 (&Header2->AslCompilerRevision));
+     printf ("\n");
+ }
+ 
diff --git a/0004-Re-enable-support-for-big-endian-machines.patch b/0004-Re-enable-support-for-big-endian-machines.patch
new file mode 100644
index 0000000..d2dc432
--- /dev/null
+++ b/0004-Re-enable-support-for-big-endian-machines.patch
@@ -0,0 +1,78 @@
+From 16734feab4204d6930c1ede62e527920607daace Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 16 Sep 2020 16:27:06 -0600
+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
+compiling/disassembling data tables).
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/compiler/aslmain.c             | 12 ------------
+ source/components/namespace/nsutils.c |  7 +++++--
+ 2 files changed, 5 insertions(+), 14 deletions(-)
+
+Index: acpica-unix2-20220331/source/compiler/aslmain.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/aslmain.c
++++ acpica-unix2-20220331/source/compiler/aslmain.c
+@@ -101,18 +101,6 @@ main (
+ 
+     signal (SIGINT, AslSignalHandler);
+ 
+-    /*
+-     * Big-endian machines are not currently supported. ACPI tables must
+-     * be little-endian, and support for big-endian machines needs to
+-     * be implemented.
+-     */
+-    if (UtIsBigEndianMachine ())
+-    {
+-        fprintf (stderr,
+-            "iASL is not currently supported on big-endian machines.\n");
+-        return (-1);
+-    }
+-
+     AcpiOsInitialize ();
+     ACPI_DEBUG_INITIALIZE (); /* For debug version only */
+ 
+Index: acpica-unix2-20220331/source/components/namespace/nsutils.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/components/namespace/nsutils.c
++++ acpica-unix2-20220331/source/components/namespace/nsutils.c
+@@ -272,6 +272,7 @@ AcpiNsBuildInternalName (
+     const char              *ExternalName = Info->NextExternalChar;
+     char                    *Result = NULL;
+     UINT32                  i;
++    char                    TmpSeg[ACPI_NAMESEG_SIZE+1];
+ 
+ 
+     ACPI_FUNCTION_TRACE (NsBuildInternalName);
+@@ -335,6 +336,7 @@ AcpiNsBuildInternalName (
+ 
+     for (; NumSegments; NumSegments--)
+     {
++        memset (TmpSeg, 0, ACPI_NAMESEG_SIZE+1);
+         for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
+         {
+             if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
+@@ -342,16 +344,17 @@ AcpiNsBuildInternalName (
+             {
+                 /* Pad the segment with underscore(s) if segment is short */
+ 
+-                Result[i] = '_';
++                TmpSeg[i] = '_';
+             }
+             else
+             {
+                 /* Convert the character to uppercase and save it */
+ 
+-                Result[i] = (char) toupper ((int) *ExternalName);
++                TmpSeg[i] = (char) toupper ((int) *ExternalName);
+                 ExternalName++;
+             }
+         }
++    AcpiUtWriteUint (Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE);
+ 
+         /* Now we must have a path separator, or the pathname is bad */
+ 
diff --git a/0005-Correct-an-endian-ness-problem-when-converting-ASL-t.patch b/0005-Correct-an-endian-ness-problem-when-converting-ASL-t.patch
new file mode 100644
index 0000000..e5a9dc5
--- /dev/null
+++ b/0005-Correct-an-endian-ness-problem-when-converting-ASL-t.patch
@@ -0,0 +1,41 @@
+From 055fee09d8f9244b6c437ad18b98edb81a87e8bc Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Tue, 27 Oct 2020 17:50:52 -0600
+Subject: [PATCH 05/45] Correct an endian-ness problem when converting ASL to
+ ASL+
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/compiler/cvparser.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/compiler/cvparser.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/cvparser.c
++++ acpica-unix2-20220331/source/compiler/cvparser.c
+@@ -144,6 +144,7 @@ CvInitFileTree (
+     char                    *ChildFilename = NULL;
+     UINT8                   *AmlStart;
+     UINT32                  AmlLength;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     if (!AcpiGbl_CaptureComments)
+@@ -152,7 +153,7 @@ CvInitFileTree (
+     }
+ 
+ 
+-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
++    AmlLength = TableLength - sizeof (ACPI_TABLE_HEADER);
+     AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
+ 
+     CvDbgPrint ("AmlLength: %x\n", AmlLength);
+@@ -162,7 +163,7 @@ CvInitFileTree (
+     AcpiGbl_FileTreeRoot = AcpiOsAcquireObject (AcpiGbl_FileCache);
+ 
+     AcpiGbl_FileTreeRoot->FileStart = (char *)(AmlStart);
+-    AcpiGbl_FileTreeRoot->FileEnd = (char *)(AmlStart + Table->Length);
++    AcpiGbl_FileTreeRoot->FileEnd = (char *)(AmlStart + TableLength);
+     AcpiGbl_FileTreeRoot->Next = NULL;
+     AcpiGbl_FileTreeRoot->Parent = NULL;
+     AcpiGbl_FileTreeRoot->Filename = (char *)(AmlStart+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..5893e93
--- /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 <ahs3 at redhat.com>
+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 <ahs3 at redhat.com>
+---
+ source/compiler/aslanalyze.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/compiler/aslanalyze.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/aslanalyze.c
++++ acpica-unix2-20220331/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..70d83d6
--- /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 <ahs3 at redhat.com>
+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 <ahs3 at redhat.com>
+---
+ source/common/dmtbdump.c | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump.c
++++ acpica-unix2-20220331/source/common/dmtbdump.c
+@@ -200,6 +200,8 @@ AcpiDmDumpUnicode (
+     UINT8                   *Buffer;
+     UINT32                  Length;
+     UINT32                  i;
++    UINT16		    Tmp16;
++    UINT32                  start;
+ 
+ 
+     Buffer = ((UINT8 *) Table) + BufferOffset;
+@@ -209,7 +211,8 @@ AcpiDmDumpUnicode (
+ 
+     for (i = 0; i < Length; i += 2)
+     {
+-        if (!isprint (Buffer[i]))
++        Tmp16 = AcpiUtReadUint16 (&Buffer[i]);
++        if (!isprint (Tmp16))
+         {
+             goto DumpRawBuffer;
+         }
+@@ -217,7 +220,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])
+         {
+@@ -230,7 +234,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/0008-Support-MADT-aka-APIC-in-a-big-endian-world.patch b/0008-Support-MADT-aka-APIC-in-a-big-endian-world.patch
new file mode 100644
index 0000000..9121ab8
--- /dev/null
+++ b/0008-Support-MADT-aka-APIC-in-a-big-endian-world.patch
@@ -0,0 +1,32 @@
+From 7b107ab7348d903108140f6033e90596b12325c4 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Thu, 15 Oct 2020 12:12:11 -0600
+Subject: [PATCH 08/45] Support MADT (aka APIC) in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump2.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/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                  Offset = sizeof (ACPI_TABLE_MADT);
+     ACPI_DMTABLE_INFO       *InfoTable;
+ 
+@@ -781,7 +781,7 @@ AcpiDmDumpMadt (
+     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+     DbgPrint (ASL_PARSE_OUTPUT, "//0B) Offset %X, from table start: 0x%8.8X%8.8X\n",
+         Offset, ACPI_FORMAT_UINT64 (ACPI_CAST_PTR (char, Subtable) - ACPI_CAST_PTR (char, Table)));
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         /* Common subtable header */
+ 
diff --git a/0009-Support-ASF-tables-in-a-big-endian-world.patch b/0009-Support-ASF-tables-in-a-big-endian-world.patch
new file mode 100644
index 0000000..a3f815d
--- /dev/null
+++ b/0009-Support-ASF-tables-in-a-big-endian-world.patch
@@ -0,0 +1,55 @@
+From ce811b4c38b9a09533ee8bafa22813f6e43c023d Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 18 Sep 2020 16:41:02 -0600
+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.
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -358,16 +358,18 @@ AcpiDmDumpAsf (
+     UINT32                  DataOffset = 0;
+     UINT32                  i;
+     UINT8                   Type;
++    UINT32                  TableLength;
+ 
+ 
+     /* No main table, only subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
+-    while (Offset < Table->Length)
++    TableLength = AcpiUtReadUint32 (&Table->Length);
++    while (Offset < TableLength)
+     {
+         /* Common subtable header */
+ 
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -425,7 +427,7 @@ AcpiDmDumpAsf (
+             return;
+         }
+ 
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Header.Length, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -442,7 +444,7 @@ AcpiDmDumpAsf (
+             for (i = 0; i < DataCount; i++)
+             {
+                 AcpiOsPrintf ("\n");
+-                Status = AcpiDmDumpTable (Table->Length, DataOffset,
++                Status = AcpiDmDumpTable (TableLength, DataOffset,
+                     DataTable, DataLength, DataInfoTable);
+                 if (ACPI_FAILURE (Status))
+                 {
diff --git a/0010-Support-CPEP-tables-in-a-big-endian-world.patch b/0010-Support-CPEP-tables-in-a-big-endian-world.patch
new file mode 100644
index 0000000..e9451cd
--- /dev/null
+++ b/0010-Support-CPEP-tables-in-a-big-endian-world.patch
@@ -0,0 +1,32 @@
+From 0c4be57a5e0e45b4197c2d9a0b26462d3b1a9b80 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 18 Sep 2020 16:54:13 -0600
+Subject: [PATCH 10/45] Support CPEP tables in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -614,7 +614,7 @@ AcpiDmDumpCpep (
+ {
+     ACPI_STATUS             Status;
+     ACPI_CPEP_POLLING       *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
+ 
+ 
+@@ -629,7 +629,7 @@ AcpiDmDumpCpep (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         AcpiOsPrintf ("\n");
+         Status = AcpiDmDumpTable (Length, Offset, Subtable,
diff --git a/0011-Support-DBG2-table-in-a-big-endian-world.patch b/0011-Support-DBG2-table-in-a-big-endian-world.patch
new file mode 100644
index 0000000..76cb7ac
--- /dev/null
+++ b/0011-Support-DBG2-table-in-a-big-endian-world.patch
@@ -0,0 +1,256 @@
+From 2cb0b87a15682da4f19f707fa3ffece504f94b5a Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Sat, 19 Sep 2020 13:37:38 -0600
+Subject: [PATCH 11/45] Support DBG2 table in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c  | 37 ++++++++++++++++++--------------
+ source/compiler/dttable1.c | 43 ++++++++++++++++++++++++--------------
+ 2 files changed, 48 insertions(+), 32 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -669,7 +669,7 @@ AcpiDmDumpCsrt (
+     ACPI_CSRT_GROUP         *Subtable;
+     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
+     ACPI_CSRT_DESCRIPTOR    *SubSubtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_CSRT);
+     UINT32                  SubOffset;
+     UINT32                  SubSubOffset;
+@@ -681,7 +681,7 @@ AcpiDmDumpCsrt (
+     /* Subtables (Resource Groups) */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         /* Resource group subtable */
+ 
+@@ -715,7 +715,7 @@ AcpiDmDumpCsrt (
+             Offset + SubOffset);
+ 
+         while ((SubOffset < Subtable->Length) &&
+-              ((Offset + SubOffset) < Table->Length))
++              ((Offset + SubOffset) < Length))
+         {
+             AcpiOsPrintf ("\n");
+             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
+@@ -776,12 +776,13 @@ AcpiDmDumpDbg2 (
+ {
+     ACPI_STATUS             Status;
+     ACPI_DBG2_DEVICE        *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_DBG2);
+     UINT32                  i;
+     UINT32                  ArrayOffset;
+     UINT32                  AbsoluteOffset;
+     UINT8                   *Array;
++    UINT16                  SubtableLength;
+ 
+ 
+     /* Main table */
+@@ -795,11 +796,12 @@ AcpiDmDumpDbg2 (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         AcpiOsPrintf ("\n");
++        SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
+         Status = AcpiDmDumpTable (Length, Offset, Subtable,
+-            Subtable->Length, AcpiDmTableInfoDbg2Device);
++            SubtableLength, AcpiDmTableInfoDbg2Device);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+@@ -809,13 +811,13 @@ AcpiDmDumpDbg2 (
+ 
+         for (i = 0; i < Subtable->RegisterCount; i++)
+         {
+-            ArrayOffset = Subtable->BaseAddressOffset +
++            ArrayOffset = AcpiUtReadUint16 (&Subtable->BaseAddressOffset) +
+                 (sizeof (ACPI_GENERIC_ADDRESS) * i);
+             AbsoluteOffset = Offset + ArrayOffset;
+             Array = (UINT8 *) Subtable + ArrayOffset;
+ 
+             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
+-                Subtable->Length, AcpiDmTableInfoDbg2Addr);
++                SubtableLength, AcpiDmTableInfoDbg2Addr);
+             if (ACPI_FAILURE (Status))
+             {
+                 return;
+@@ -826,13 +828,13 @@ AcpiDmDumpDbg2 (
+ 
+         for (i = 0; i < Subtable->RegisterCount; i++)
+         {
+-            ArrayOffset = Subtable->AddressSizeOffset +
++            ArrayOffset = AcpiUtReadUint16 (&Subtable->AddressSizeOffset) +
+                 (sizeof (UINT32) * i);
+             AbsoluteOffset = Offset + ArrayOffset;
+             Array = (UINT8 *) Subtable + ArrayOffset;
+ 
+             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
+-                Subtable->Length, AcpiDmTableInfoDbg2Size);
++                SubtableLength, AcpiDmTableInfoDbg2Size);
+             if (ACPI_FAILURE (Status))
+             {
+                 return;
+@@ -842,12 +844,12 @@ AcpiDmDumpDbg2 (
+         /* Dump the Namestring (required) */
+ 
+         AcpiOsPrintf ("\n");
+-        ArrayOffset = Subtable->NamepathOffset;
++        ArrayOffset = AcpiUtReadUint16 (&Subtable->NamepathOffset);
+         AbsoluteOffset = Offset + ArrayOffset;
+         Array = (UINT8 *) Subtable + ArrayOffset;
+ 
+         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
+-            Subtable->Length, AcpiDmTableInfoDbg2Name);
++            SubtableLength, AcpiDmTableInfoDbg2Name);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+@@ -857,8 +859,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),
++                Array, AcpiUtReadUint16 (&Subtable->OemDataLength),
+                 AcpiDmTableInfoDbg2OemData);
+             if (ACPI_FAILURE (Status))
+             {
+@@ -868,9 +873,9 @@ AcpiDmDumpDbg2 (
+ 
+         /* Point to next subtable */
+ 
+-        Offset += Subtable->Length;
++        Offset += SubtableLength;
+         Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
+-            Subtable->Length);
++            SubtableLength);
+     }
+ }
+ 
+Index: acpica-unix2-20220331/source/compiler/dttable1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable1.c
++++ acpica-unix2-20220331/source/compiler/dttable1.c
+@@ -718,6 +718,7 @@ DtCompileCsrt (
+     DT_FIELD                **PFieldList = (DT_FIELD **) List;
+     UINT32                  DescriptorCount;
+     UINT32                  GroupLength;
++    UINT32                  Tmp;
+ 
+ 
+     /* Subtables (Resource Groups) */
+@@ -736,12 +737,13 @@ DtCompileCsrt (
+ 
+         /* Compute the number of resource descriptors */
+ 
+-        GroupLength =
+-            (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
+-                Subtable->Buffer))->Length -
+-            (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
+-                Subtable->Buffer))->SharedInfoLength -
+-            sizeof (ACPI_CSRT_GROUP);
++        Tmp = AcpiUtReadUint32 (&(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
++                                Subtable->Buffer))->Length);
++        GroupLength = Tmp;
++        Tmp = AcpiUtReadUint32 (&(ACPI_CAST_PTR (ACPI_CSRT_GROUP,
++                                Subtable->Buffer))->SharedInfoLength);
++        GroupLength -= Tmp;
++        GroupLength -= sizeof (ACPI_CSRT_GROUP);
+ 
+         DescriptorCount = (GroupLength  /
+             sizeof (ACPI_CSRT_DESCRIPTOR));
+@@ -829,6 +831,7 @@ DtCompileDbg2 (
+     ACPI_DBG2_DEVICE        *DeviceInfo;
+     UINT16                  CurrentOffset;
+     UINT32                  i;
++    UINT32                  Tmp;
+ 
+ 
+     /* Main table */
+@@ -845,10 +848,12 @@ DtCompileDbg2 (
+     /* Main table fields */
+ 
+     Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
+-    Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
+-        ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
++    Tmp = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
++       ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
++    AcpiUtWriteUint (&Dbg2Header->InfoOffset, sizeof (UINT32),
++            &Tmp, sizeof (UINT32));
+ 
+-    SubtableCount = Dbg2Header->InfoCount;
++    SubtableCount = Tmp;
+     DtPushSubtable (Subtable);
+ 
+     /* Process all Device Information subtables (Count = InfoCount) */
+@@ -875,7 +880,8 @@ DtCompileDbg2 (
+ 
+         /* BaseAddressRegister GAS array (Required, size is RegisterCount) */
+ 
+-        DeviceInfo->BaseAddressOffset = CurrentOffset;
++        AcpiUtWriteUint (&DeviceInfo->BaseAddressOffset, sizeof (UINT16),
++                &CurrentOffset, sizeof (UINT16));
+         for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
+         {
+             Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
+@@ -891,7 +897,8 @@ DtCompileDbg2 (
+ 
+         /* AddressSize array (Required, size = RegisterCount) */
+ 
+-        DeviceInfo->AddressSizeOffset = CurrentOffset;
++        AcpiUtWriteUint (&DeviceInfo->AddressSizeOffset, sizeof (UINT16),
++                &CurrentOffset, sizeof (UINT16));
+         for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
+         {
+             Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
+@@ -907,7 +914,8 @@ DtCompileDbg2 (
+ 
+         /* NamespaceString device identifier (Required, size = NamePathLength) */
+ 
+-        DeviceInfo->NamepathOffset = CurrentOffset;
++        AcpiUtWriteUint (&DeviceInfo->NamepathOffset, sizeof (UINT16),
++            &CurrentOffset, sizeof (UINT16));
+         Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
+             &Subtable);
+         if (ACPI_FAILURE (Status))
+@@ -917,8 +925,9 @@ DtCompileDbg2 (
+ 
+         /* Update the device info header */
+ 
+-        DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
+-        CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
++        AcpiUtWriteUint (&DeviceInfo->NamepathLength, sizeof (UINT16),
++            &Subtable->Length, sizeof (UINT32));
++        CurrentOffset += AcpiUtReadUint16 (&DeviceInfo->NamepathLength);
+         DtInsertSubtable (ParentTable, Subtable);
+ 
+         /* OemData - Variable-length data (Optional, size = OemDataLength) */
+@@ -945,8 +954,10 @@ DtCompileDbg2 (
+ 
+         if (Subtable && Subtable->Length)
+         {
+-            DeviceInfo->OemDataOffset = CurrentOffset;
+-            DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
++            AcpiUtWriteUint (&DeviceInfo->OemDataOffset, sizeof (UINT16),
++                &CurrentOffset, sizeof (UINT16));
++            AcpiUtWriteUint (&DeviceInfo->OemDataLength, sizeof (UINT16),
++                &Subtable->Length, sizeof (UINT32));
+ 
+             DtInsertSubtable (ParentTable, Subtable);
+         }
diff --git a/0012-Support-DMAR-in-a-big-endian-world.patch b/0012-Support-DMAR-in-a-big-endian-world.patch
new file mode 100644
index 0000000..3d54025
--- /dev/null
+++ b/0012-Support-DMAR-in-a-big-endian-world.patch
@@ -0,0 +1,171 @@
+From 06623392351dfea54bd69507b6672c933a5e3fd2 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Sat, 19 Sep 2020 15:22:00 -0600
+Subject: [PATCH 12/45] Support DMAR in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtable.c    |  4 ++--
+ source/common/dmtbdump1.c  | 26 +++++++++++++++-----------
+ source/compiler/dttable1.c | 12 +++++++-----
+ 3 files changed, 24 insertions(+), 18 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtable.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtable.c
++++ acpica-unix2-20220331/source/common/dmtable.c
+@@ -1578,13 +1578,13 @@ AcpiDmDumpTable (
+ 
+             /* DMAR subtable types */
+ 
+-            Temp16 = ACPI_GET16 (Target);
++            Temp16 = AcpiUtReadUint16 (Target);
+             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
+             {
+                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
+             }
+ 
+-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
++            AcpiOsPrintf (UINT16_FORMAT, Temp16,
+                 AcpiDmDmarSubnames[Temp16]);
+             break;
+ 
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -899,13 +899,15 @@ AcpiDmDumpDmar (
+ {
+     ACPI_STATUS             Status;
+     ACPI_DMAR_HEADER        *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
+     ACPI_DMTABLE_INFO       *InfoTable;
+     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
+     UINT32                  ScopeOffset;
+     UINT8                   *PciPath;
+     UINT32                  PathOffset;
++    UINT16                  SubtableType;
++    UINT16                  SubtableLength;
+ 
+ 
+     /* Main table */
+@@ -919,13 +921,14 @@ AcpiDmDumpDmar (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         /* Common subtable header */
+ 
+         AcpiOsPrintf ("\n");
++        SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
+         Status = AcpiDmDumpTable (Length, Offset, Subtable,
+-            Subtable->Length, AcpiDmTableInfoDmarHdr);
++            SubtableLength, AcpiDmTableInfoDmarHdr);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+@@ -933,7 +936,8 @@ AcpiDmDumpDmar (
+ 
+         AcpiOsPrintf ("\n");
+ 
+-        switch (Subtable->Type)
++        SubtableType = AcpiUtReadUint16 (&Subtable->Type);
++        switch (SubtableType)
+         {
+         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+ 
+@@ -974,12 +978,12 @@ AcpiDmDumpDmar (
+         default:
+ 
+             AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
+-                Subtable->Type);
++                SubtableType);
+             return;
+         }
+ 
+         Status = AcpiDmDumpTable (Length, Offset, Subtable,
+-            Subtable->Length, InfoTable);
++            SubtableLength, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+@@ -988,8 +992,8 @@ AcpiDmDumpDmar (
+         /*
+          * Dump the optional device scope entries
+          */
+-        if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
+-            (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
++        if ((SubtableType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
++            (SubtableType == ACPI_DMAR_TYPE_NAMESPACE))
+         {
+             /* These types do not support device scopes */
+ 
+@@ -997,7 +1001,7 @@ AcpiDmDumpDmar (
+         }
+ 
+         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
+-        while (ScopeOffset < Subtable->Length)
++        while (ScopeOffset < SubtableLength)
+         {
+             AcpiOsPrintf ("\n");
+             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
+@@ -1038,9 +1042,9 @@ AcpiDmDumpDmar (
+ NextSubtable:
+         /* Point to next subtable */
+ 
+-        Offset += Subtable->Length;
++        Offset += SubtableLength;
+         Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
+-            Subtable->Length);
++            SubtableLength);
+     }
+ }
+ 
+Index: acpica-unix2-20220331/source/compiler/dttable1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable1.c
++++ acpica-unix2-20220331/source/compiler/dttable1.c
+@@ -997,6 +997,7 @@ DtCompileDmar (
+     ACPI_DMAR_DEVICE_SCOPE  *DmarDeviceScope;
+     UINT32                  DeviceScopeLength;
+     UINT32                  PciPathLength;
++    UINT16                  DmarHeaderType;
+ 
+ 
+     Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
+@@ -1027,7 +1028,8 @@ DtCompileDmar (
+ 
+         DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
+ 
+-        switch (DmarHeader->Type)
++        DmarHeaderType = AcpiUtReadUint16 (&DmarHeader->Type);
++        switch (DmarHeaderType)
+         {
+         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+ 
+@@ -1079,8 +1081,8 @@ DtCompileDmar (
+         /*
+          * Optional Device Scope subtables
+          */
+-        if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
+-            (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
++        if ((DmarHeaderType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
++            (DmarHeaderType == ACPI_DMAR_TYPE_NAMESPACE))
+         {
+             /* These types do not support device scopes */
+ 
+@@ -1089,8 +1091,8 @@ DtCompileDmar (
+         }
+ 
+         DtPushSubtable (Subtable);
+-        DeviceScopeLength = DmarHeader->Length - Subtable->Length -
+-            ParentTable->Length;
++        DeviceScopeLength = AcpiUtReadUint16 (&DmarHeader->Length) -
++                Subtable->Length - ParentTable->Length;
+         while (DeviceScopeLength)
+         {
+             Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
diff --git a/0013-Support-DRTM-in-a-big-endian-world.patch b/0013-Support-DRTM-in-a-big-endian-world.patch
new file mode 100644
index 0000000..02725bb
--- /dev/null
+++ b/0013-Support-DRTM-in-a-big-endian-world.patch
@@ -0,0 +1,112 @@
+From bcdec27f562b0df37546b5e8ad2eab76348062eb Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Sat, 19 Sep 2020 15:44:06 -0600
+Subject: [PATCH 13/45] Support DRTM in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c  | 25 +++++++++++++++----------
+ source/compiler/dttable1.c |  6 ++++--
+ 2 files changed, 19 insertions(+), 12 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -1071,11 +1071,14 @@ AcpiDmDumpDrtm (
+     ACPI_DRTM_RESOURCE_LIST *DrtmRl;
+     ACPI_DRTM_DPS_ID        *DrtmDps;
+     UINT32                  Count;
++    UINT32                  ResourceCount;
++    UINT32                  ValidatedTableCount;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
+         AcpiDmTableInfoDrtm);
+     if (ACPI_FAILURE (Status))
+     {
+@@ -1090,7 +1093,7 @@ AcpiDmDumpDrtm (
+ 
+     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
+     AcpiOsPrintf ("\n");
+-    Status = AcpiDmDumpTable (Table->Length, Offset,
++    Status = AcpiDmDumpTable (TableLength, Offset,
+         DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
+         AcpiDmTableInfoDrtm0);
+     if (ACPI_FAILURE (Status))
+@@ -1103,10 +1106,11 @@ AcpiDmDumpDrtm (
+     /* Dump Validated table addresses */
+ 
+     Count = 0;
+-    while ((Offset < Table->Length) &&
+-            (DrtmVtl->ValidatedTableCount > Count))
++    ValidatedTableCount = AcpiUtReadUint32 (&DrtmVtl->ValidatedTableCount);
++    while ((Offset < TableLength) &&
++            (ValidatedTableCount > Count))
+     {
+-        Status = AcpiDmDumpTable (Table->Length, Offset,
++        Status = AcpiDmDumpTable (TableLength, Offset,
+             ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
+             AcpiDmTableInfoDrtm0a);
+         if (ACPI_FAILURE (Status))
+@@ -1122,7 +1126,7 @@ AcpiDmDumpDrtm (
+ 
+     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
+     AcpiOsPrintf ("\n");
+-    Status = AcpiDmDumpTable (Table->Length, Offset,
++    Status = AcpiDmDumpTable (TableLength, Offset,
+         DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
+         AcpiDmTableInfoDrtm1);
+     if (ACPI_FAILURE (Status))
+@@ -1135,10 +1139,11 @@ AcpiDmDumpDrtm (
+     /* Dump the Resource List */
+ 
+     Count = 0;
+-    while ((Offset < Table->Length) &&
+-           (DrtmRl->ResourceCount > Count))
++    ResourceCount = AcpiUtReadUint32 (&DrtmRl->ResourceCount);
++    while ((Offset < TableLength) &&
++           (ResourceCount > Count))
+     {
+-        Status = AcpiDmDumpTable (Table->Length, Offset,
++        Status = AcpiDmDumpTable (TableLength, Offset,
+             ACPI_ADD_PTR (void, Table, Offset),
+             sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
+         if (ACPI_FAILURE (Status))
+@@ -1154,7 +1159,7 @@ AcpiDmDumpDrtm (
+ 
+     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
+     AcpiOsPrintf ("\n");
+-    (void) AcpiDmDumpTable (Table->Length, Offset,
++    (void) AcpiDmDumpTable (TableLength, Offset,
+         DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
+ }
+ 
+Index: acpica-unix2-20220331/source/compiler/dttable1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable1.c
++++ acpica-unix2-20220331/source/compiler/dttable1.c
+@@ -1217,7 +1217,8 @@ DtCompileDrtm (
+         Count++;
+     }
+ 
+-    DrtmVtl->ValidatedTableCount = Count;
++    AcpiUtWriteUint (&DrtmVtl->ValidatedTableCount, sizeof (UINT32),
++            &Count, sizeof (UINT32));
+     DtPopSubtable ();
+     ParentTable = DtPeekSubtable ();
+ 
+@@ -1255,7 +1256,8 @@ DtCompileDrtm (
+         Count++;
+     }
+ 
+-    DrtmRl->ResourceCount = Count;
++    AcpiUtWriteUint(&DrtmRl->ResourceCount, sizeof(UINT32),
++            &Count, sizeof(UINT32));
+     DtPopSubtable ();
+     ParentTable = DtPeekSubtable ();
+ 
diff --git a/0014-Support-EINJ-in-a-big-endian-world.patch b/0014-Support-EINJ-in-a-big-endian-world.patch
new file mode 100644
index 0000000..f65e6ff
--- /dev/null
+++ b/0014-Support-EINJ-in-a-big-endian-world.patch
@@ -0,0 +1,32 @@
+From 70d1047abe010c80c2dd74f6afdc7005b91e6163 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Sat, 19 Sep 2020 15:50:19 -0600
+Subject: [PATCH 14/45] Support EINJ in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -1183,7 +1183,7 @@ AcpiDmDumpEinj (
+ {
+     ACPI_STATUS             Status;
+     ACPI_WHEA_HEADER        *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
+ 
+ 
+@@ -1198,7 +1198,7 @@ AcpiDmDumpEinj (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         AcpiOsPrintf ("\n");
+         Status = AcpiDmDumpTable (Length, Offset, Subtable,
diff --git a/0015-Support-ERST-in-a-big-endian-world.patch b/0015-Support-ERST-in-a-big-endian-world.patch
new file mode 100644
index 0000000..a6146e2
--- /dev/null
+++ b/0015-Support-ERST-in-a-big-endian-world.patch
@@ -0,0 +1,32 @@
+From e588961ca36e70c24aa1c49e96bcd1997bf98f89 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Sat, 19 Sep 2020 15:54:56 -0600
+Subject: [PATCH 15/45] Support ERST in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -1236,7 +1236,7 @@ AcpiDmDumpErst (
+ {
+     ACPI_STATUS             Status;
+     ACPI_WHEA_HEADER        *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
+ 
+ 
+@@ -1251,7 +1251,7 @@ AcpiDmDumpErst (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         AcpiOsPrintf ("\n");
+         Status = AcpiDmDumpTable (Length, Offset, Subtable,
diff --git a/0016-Support-FADT-aka-FACP-in-a-big-endian-world.patch b/0016-Support-FADT-aka-FACP-in-a-big-endian-world.patch
new file mode 100644
index 0000000..1b9b3aa
--- /dev/null
+++ b/0016-Support-FADT-aka-FACP-in-a-big-endian-world.patch
@@ -0,0 +1,189 @@
+From b3051bc2bad8988f3ad81a8307de6f1d0eef4ace Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Sun, 20 Sep 2020 11:42:21 -0600
+Subject: [PATCH 16/45] Support FADT (aka, FACP) in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump.c          | 25 ++++++++++++-----------
+ source/components/tables/tbfadt.c | 34 +++++++++++++++++++++++--------
+ 2 files changed, 38 insertions(+), 21 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump.c
++++ acpica-unix2-20220331/source/common/dmtbdump.c
+@@ -417,11 +417,12 @@ AcpiDmDumpFadt (
+     ACPI_TABLE_HEADER       *Table)
+ {
+     ACPI_STATUS             Status;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
+         AcpiDmTableInfoFadt1);
+     if (ACPI_FAILURE (Status))
+     {
+@@ -430,10 +431,10 @@ AcpiDmDumpFadt (
+ 
+     /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
+ 
+-    if ((Table->Length > ACPI_FADT_V1_SIZE) &&
+-        (Table->Length <= ACPI_FADT_V2_SIZE))
++    if ((TableLength > ACPI_FADT_V1_SIZE) &&
++        (TableLength <= ACPI_FADT_V2_SIZE))
+     {
+-        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
++        Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
+             AcpiDmTableInfoFadt2);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -443,9 +444,9 @@ AcpiDmDumpFadt (
+ 
+     /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
+ 
+-    else if (Table->Length > ACPI_FADT_V2_SIZE)
++    else if (TableLength > ACPI_FADT_V2_SIZE)
+     {
+-        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
++        Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
+             AcpiDmTableInfoFadt3);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -454,9 +455,9 @@ AcpiDmDumpFadt (
+ 
+         /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
+ 
+-        if (Table->Length > ACPI_FADT_V3_SIZE)
++        if (TableLength > ACPI_FADT_V3_SIZE)
+         {
+-            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
++            Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
+                 AcpiDmTableInfoFadt5);
+             if (ACPI_FAILURE (Status))
+             {
+@@ -466,9 +467,9 @@ AcpiDmDumpFadt (
+ 
+         /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
+ 
+-        if (Table->Length > ACPI_FADT_V3_SIZE)
++        if (TableLength > ACPI_FADT_V3_SIZE)
+         {
+-            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
++            Status = AcpiDmDumpTable (TableLength, 0, Table, 0,
+                 AcpiDmTableInfoFadt6);
+             if (ACPI_FAILURE (Status))
+             {
+@@ -479,11 +480,11 @@ AcpiDmDumpFadt (
+ 
+     /* Validate various fields in the FADT, including length */
+ 
+-    AcpiTbCreateLocalFadt (Table, Table->Length);
++    AcpiTbCreateLocalFadt (Table, TableLength);
+ 
+     /* Validate FADT length against the revision */
+ 
+-    AcpiDmValidateFadtLength (Table->Revision, Table->Length);
++    AcpiDmValidateFadtLength (Table->Revision, TableLength);
+ }
+ 
+ 
+Index: acpica-unix2-20220331/source/components/tables/tbfadt.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/components/tables/tbfadt.c
++++ acpica-unix2-20220331/source/components/tables/tbfadt.c
+@@ -289,7 +289,6 @@ AcpiTbSelectAddress (
+     UINT32                  Address32,
+     UINT64                  Address64)
+ {
+-
+     if (!Address64)
+     {
+         /* 64-bit address is zero, use 32-bit address */
+@@ -520,6 +519,9 @@ AcpiTbConvertFadt (
+     UINT8                   Length;
+     UINT8                   Flags;
+     UINT32                  i;
++    UINT32                  Tmp;
++    UINT32                  Value32;
++    UINT64                  Value64;
+ 
+ 
+     /*
+@@ -533,7 +535,7 @@ AcpiTbConvertFadt (
+      * Note: The FADT revision value is unreliable. Only the length can be
+      * trusted.
+      */
+-    if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
++    if (AcpiUtReadUint32 (&AcpiGbl_FADT.Header.Length) <= ACPI_FADT_V2_SIZE)
+     {
+         AcpiGbl_FADT.PreferredProfile = 0;
+         AcpiGbl_FADT.PstateControl = 0;
+@@ -546,14 +548,19 @@ AcpiTbConvertFadt (
+      * current FADT version as defined by the ACPI specification.
+      * Thus, we will have a common FADT internally.
+      */
+-    AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
++    Tmp = sizeof (ACPI_TABLE_FADT);
++    AcpiUtWriteUint (&AcpiGbl_FADT.Header.Length, sizeof (UINT32),
++            &Tmp, sizeof (UINT32));
+ 
+     /*
+      * Expand the 32-bit DSDT addresses to 64-bit as necessary.
+      * Later ACPICA code will always use the X 64-bit field.
+      */
+-    AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
+-        AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
++    Value32 = AcpiUtReadUint32 (&AcpiGbl_FADT.Dsdt);
++    Value64 = AcpiUtReadUint64 (&AcpiGbl_FADT.XDsdt);
++    Value64 = AcpiTbSelectAddress ("DSDT", Value32, Value64);
++    AcpiUtWriteUint (&AcpiGbl_FADT.XDsdt, sizeof (UINT64),
++                &Value64, sizeof (UINT64));
+ 
+     /* If Hardware Reduced flag is set, we are all done */
+ 
+@@ -614,7 +621,11 @@ AcpiTbConvertFadt (
+         {
+             if (Address64->Address)
+             {
+-                if (Address64->Address != (UINT64) Address32)
++                Value32 = AcpiUtReadUint32 (&Address32);
++                Value64 = AcpiUtReadUint64 (&Address64->Address);
++
++                /* if (Address64->Address != (UINT64) Address32) */
++                if (Value64 != (UINT64) Value32)
+                 {
+                     /* Address mismatch */
+ 
+@@ -655,9 +666,10 @@ AcpiTbConvertFadt (
+              */
+             if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
+             {
++                Value32 = AcpiUtReadUint32 (&Address32);
+                 AcpiTbInitGenericAddress (Address64,
+                     ACPI_ADR_SPACE_SYSTEM_IO, Length,
+-                    (UINT64) Address32, Name, Flags);
++                    (UINT64) Value32, Name, Flags);
+             }
+         }
+ 
+@@ -780,10 +792,14 @@ AcpiTbSetupFadtRegisters (
+ 
+         if (Source64->Address)
+         {
++            UINT64 Address64;
++
++            Address64 = AcpiUtReadUint64 (&Source64->Address);
++            Address64 +=
++                (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth);
+             AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
+                 Source64->SpaceId, Pm1RegisterByteWidth,
+-                Source64->Address +
+-                    (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
++                Address64,
+                 "PmRegisters", 0);
+         }
+     }
diff --git a/0017-Support-most-FPDTs-in-a-big-endian-world.patch b/0017-Support-most-FPDTs-in-a-big-endian-world.patch
new file mode 100644
index 0000000..41c0019
--- /dev/null
+++ b/0017-Support-most-FPDTs-in-a-big-endian-world.patch
@@ -0,0 +1,85 @@
+From 35f533074fb78d52e87c5a14406a136480a6fe62 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Tue, 22 Sep 2020 17:51:45 -0600
+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.
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c  | 12 +++++++-----
+ source/compiler/dttable1.c |  4 +++-
+ 2 files changed, 10 insertions(+), 6 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -1289,9 +1289,10 @@ AcpiDmDumpFpdt (
+ {
+     ACPI_STATUS             Status;
+     ACPI_FPDT_HEADER        *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
+     ACPI_DMTABLE_INFO       *InfoTable;
++    UINT16                  SubtableType;
+ 
+ 
+     /* There is no main table (other than the standard ACPI header) */
+@@ -1299,19 +1300,20 @@ AcpiDmDumpFpdt (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         /* Common subtable header */
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Length, AcpiDmTableInfoFpdtHdr);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+         }
+ 
+-        switch (Subtable->Type)
++        SubtableType = AcpiUtReadUint16 (&Subtable->Type);
++        switch (SubtableType)
+         {
+         case ACPI_FPDT_TYPE_BOOT:
+ 
+@@ -1338,7 +1340,7 @@ AcpiDmDumpFpdt (
+             goto NextSubtable;
+         }
+ 
+-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Length, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
+Index: acpica-unix2-20220331/source/compiler/dttable1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable1.c
++++ acpica-unix2-20220331/source/compiler/dttable1.c
+@@ -1493,6 +1493,7 @@ DtCompileFpdt (
+     ACPI_DMTABLE_INFO       *InfoTable;
+     DT_FIELD                **PFieldList = (DT_FIELD **) List;
+     DT_FIELD                *SubtableStart;
++    UINT16                  SubtableType;
+ 
+ 
+     while (*PFieldList)
+@@ -1511,7 +1512,8 @@ DtCompileFpdt (
+ 
+         FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
+ 
+-        switch (FpdtHeader->Type)
++        SubtableType = AcpiUtReadUint16 (&FpdtHeader->Type);
++        switch (SubtableType)
+         {
+         case ACPI_FPDT_TYPE_BOOT:
+ 
diff --git a/0018-Support-GTDT-in-a-big-endian-world.patch b/0018-Support-GTDT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..4bdb9bc
--- /dev/null
+++ b/0018-Support-GTDT-in-a-big-endian-world.patch
@@ -0,0 +1,69 @@
+From 492e41a24fd088c7ab609ee8ad518f69c9cd29e3 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Tue, 22 Sep 2020 18:12:01 -0600
+Subject: [PATCH 18/45] Support GTDT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c  | 13 +++++++++----
+ source/compiler/dttable1.c |  9 +++++++--
+ 2 files changed, 16 insertions(+), 6 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -1376,7 +1376,7 @@ AcpiDmDumpGtdt (
+ {
+     ACPI_STATUS             Status;
+     ACPI_GTDT_HEADER        *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
+     ACPI_DMTABLE_INFO       *InfoTable;
+     UINT32                  SubtableLength;
+@@ -1412,7 +1412,7 @@ AcpiDmDumpGtdt (
+ 
+     /* Subtables */
+ 
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         /* Common subtable header */
+ 
+@@ -1430,8 +1430,13 @@ AcpiDmDumpGtdt (
+         case ACPI_GTDT_TYPE_TIMER_BLOCK:
+ 
+             SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
+-            GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
+-                Subtable))->TimerCount;
++            {
++                UINT32 Tmp32;
++
++                Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
++                    Subtable))->TimerCount;
++                GtCount = AcpiUtReadUint32 (&Tmp32);
++            }
+ 
+             InfoTable = AcpiDmTableInfoGtdt0;
+             break;
+Index: acpica-unix2-20220331/source/compiler/dttable1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable1.c
++++ acpica-unix2-20220331/source/compiler/dttable1.c
+@@ -1439,8 +1439,13 @@ DtCompileGtdt (
+             DtPushSubtable (Subtable);
+             ParentTable = DtPeekSubtable ();
+ 
+-            GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
+-                Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
++            {
++                UINT32 Tmp32;
++
++                Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
++                    Subtable->Buffer - sizeof (ACPI_GTDT_HEADER)))->TimerCount;
++                GtCount = AcpiUtReadUint32 (&Tmp32);
++            }
+ 
+             while (GtCount)
+             {
diff --git a/0019-Support-HEST-in-a-big-endian-world.patch b/0019-Support-HEST-in-a-big-endian-world.patch
new file mode 100644
index 0000000..e54f2ed
--- /dev/null
+++ b/0019-Support-HEST-in-a-big-endian-world.patch
@@ -0,0 +1,75 @@
+From 6b73a4881e436bb8cf86c05c1cc4b5360efe1c7f Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 23 Sep 2020 11:54:49 -0600
+Subject: [PATCH 19/45] Support HEST in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c  | 10 ++++++----
+ source/compiler/dttable1.c |  4 +++-
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -1517,12 +1517,13 @@ AcpiDmDumpHest (
+ {
+     ACPI_STATUS             Status;
+     ACPI_HEST_HEADER        *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
+     ACPI_DMTABLE_INFO       *InfoTable;
+     UINT32                  SubtableLength;
+     UINT32                  BankCount;
+     ACPI_HEST_IA_ERROR_BANK *BankTable;
++    UINT16                  SubtableType;
+ 
+ 
+     /* Main table */
+@@ -1536,10 +1537,11 @@ AcpiDmDumpHest (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < Length)
+     {
+         BankCount = 0;
+-        switch (Subtable->Type)
++        SubtableType = Subtable->Type;
++        switch (SubtableType)
+         {
+         case ACPI_HEST_TYPE_IA32_CHECK:
+ 
+@@ -1606,7 +1608,7 @@ AcpiDmDumpHest (
+             /* Cannot continue on unknown type - no length */
+ 
+             AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n",
+-                Subtable->Type);
++                SubtableType);
+             return;
+         }
+ 
+Index: acpica-unix2-20220331/source/compiler/dttable1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable1.c
++++ acpica-unix2-20220331/source/compiler/dttable1.c
+@@ -1575,6 +1575,7 @@ DtCompileHest (
+     DT_FIELD                *SubtableStart;
+     ACPI_DMTABLE_INFO       *InfoTable;
+     UINT16                  Type;
++    UINT16                  Tmp16;
+     UINT32                  BankCount;
+ 
+ 
+@@ -1593,7 +1594,8 @@ DtCompileHest (
+         /* Get subtable type */
+ 
+         SubtableStart = *PFieldList;
+-        DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
++        DtCompileInteger ((UINT8 *) &Tmp16, *PFieldList, 2, 0);
++        Type = AcpiUtReadUint32 (&Tmp16);
+ 
+         switch (Type)
+         {
diff --git a/0020-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch b/0020-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch
new file mode 100644
index 0000000..e47951d
--- /dev/null
+++ b/0020-Support-RSDT-RSD-PTR-in-a-big-endian-world.patch
@@ -0,0 +1,37 @@
+From 198abe6e9fcb03676513146bf2f9b8ccc49e5827 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 23 Sep 2020 12:11:46 -0600
+Subject: [PATCH 20/45] Support RSDT ('RSD PTR') in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump.c
++++ acpica-unix2-20220331/source/common/dmtbdump.c
+@@ -336,6 +336,7 @@ AcpiDmDumpRsdt (
+     UINT32                  Entries;
+     UINT32                  Offset;
+     UINT32                  i;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Point to start of table pointer array */
+@@ -345,12 +346,12 @@ AcpiDmDumpRsdt (
+ 
+     /* RSDT uses 32-bit pointers */
+ 
+-    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
++    Entries = (TableLength - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
+ 
+     for (i = 0; i < Entries; i++)
+     {
+         AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
+-        AcpiOsPrintf ("%8.8X\n", Array[i]);
++        AcpiOsPrintf ("%8.8X\n", AcpiUtReadUint32 (&Array[i]));
+         Offset += sizeof (UINT32);
+     }
+ }
diff --git a/0021-Support-XSDT-in-a-big-endian-world.patch b/0021-Support-XSDT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..86ca379
--- /dev/null
+++ b/0021-Support-XSDT-in-a-big-endian-world.patch
@@ -0,0 +1,38 @@
+From 75d974e42fefabfd6684d62f58bff678b55f396b Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 23 Sep 2020 12:16:37 -0600
+Subject: [PATCH 21/45] Support XSDT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump.c
++++ acpica-unix2-20220331/source/common/dmtbdump.c
+@@ -377,6 +377,7 @@ AcpiDmDumpXsdt (
+     UINT32                  Entries;
+     UINT32                  Offset;
+     UINT32                  i;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Point to start of table pointer array */
+@@ -386,12 +387,13 @@ AcpiDmDumpXsdt (
+ 
+     /* XSDT uses 64-bit pointers */
+ 
+-    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
++    Entries = (TableLength - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
+ 
+     for (i = 0; i < Entries; i++)
+     {
+         AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
+-        AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
++        AcpiOsPrintf ("%8.8X%8.8X\n",
++                ACPI_FORMAT_UINT64 (AcpiUtReadUint64 (&Array[i])));
+         Offset += sizeof (UINT64);
+     }
+ }
diff --git a/0022-Support-SRAT-in-a-big-endian-world.patch b/0022-Support-SRAT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..0993d26
--- /dev/null
+++ b/0022-Support-SRAT-in-a-big-endian-world.patch
@@ -0,0 +1,52 @@
+From 724fcc83d359e4c8abbd2a48755e96049afa06d6 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 23 Sep 2020 12:25:38 -0600
+Subject: [PATCH 22/45] Support SRAT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump3.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump3.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump3.c
++++ acpica-unix2-20220331/source/common/dmtbdump3.c
+@@ -173,11 +173,12 @@ AcpiDmDumpSrat (
+     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
+     ACPI_SUBTABLE_HEADER    *Subtable;
+     ACPI_DMTABLE_INFO       *InfoTable;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSrat);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -186,12 +187,12 @@ AcpiDmDumpSrat (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         /* Common subtable header */
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Length, AcpiDmTableInfoSratHdr);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -250,7 +251,7 @@ AcpiDmDumpSrat (
+         }
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Length, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
diff --git a/0023-Support-SLIT-in-a-big-endian-world.patch b/0023-Support-SLIT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..15936a4
--- /dev/null
+++ b/0023-Support-SLIT-in-a-big-endian-world.patch
@@ -0,0 +1,61 @@
+From b11d50752feb9f1b52db076d1fb4753b30a53642 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 23 Sep 2020 12:49:52 -0600
+Subject: [PATCH 23/45] Support SLIT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump3.c  | 8 +++++---
+ source/compiler/dttable2.c | 2 +-
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump3.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump3.c
++++ acpica-unix2-20220331/source/common/dmtbdump3.c
+@@ -96,11 +96,12 @@ AcpiDmDumpSlit (
+     UINT32                  Localities;
+     UINT32                  i;
+     UINT32                  j;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSlit);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -108,7 +109,8 @@ AcpiDmDumpSlit (
+ 
+     /* Display the Locality NxN Matrix */
+ 
+-    Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
++    Localities = (UINT32)
++        AcpiUtReadUint64 (&ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount);
+     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
+     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
+ 
+@@ -121,7 +123,7 @@ AcpiDmDumpSlit (
+         {
+             /* Check for beyond EOT */
+ 
+-            if (Offset >= Table->Length)
++            if (Offset >= TableLength)
+             {
+                 AcpiOsPrintf (
+                     "\n**** Not enough room in table for all localities\n");
+Index: acpica-unix2-20220331/source/compiler/dttable2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable2.c
++++ acpica-unix2-20220331/source/compiler/dttable2.c
+@@ -2234,7 +2234,7 @@ DtCompileSlit (
+     ParentTable = DtPeekSubtable ();
+     DtInsertSubtable (ParentTable, Subtable);
+ 
+-    Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
++    Localities = (UINT32) AcpiUtReadUint64 (Subtable->Buffer);
+     LocalityBuffer = UtLocalCalloc (Localities);
+     LocalityListLength = 0;
+ 
diff --git a/0024-Support-MSCT-in-a-big-endian-world.patch b/0024-Support-MSCT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..5ee3854
--- /dev/null
+++ b/0024-Support-MSCT-in-a-big-endian-world.patch
@@ -0,0 +1,43 @@
+From ae38e1578d18abf41330bb3dbaef9ea56a52f49b Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 23 Sep 2020 15:44:21 -0600
+Subject: [PATCH 24/45] Support MSCT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump2.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/source/common/dmtbdump2.c
+@@ -1185,11 +1185,12 @@ AcpiDmDumpMsct (
+     ACPI_STATUS             Status;
+     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
+     ACPI_MSCT_PROXIMITY     *Subtable;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMsct);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -1198,12 +1199,12 @@ AcpiDmDumpMsct (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         /* Common subtable header */
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
+         if (ACPI_FAILURE (Status))
+         {
diff --git a/0025-Support-MPST-in-a-big-endian-world.patch b/0025-Support-MPST-in-a-big-endian-world.patch
new file mode 100644
index 0000000..ef704b7
--- /dev/null
+++ b/0025-Support-MPST-in-a-big-endian-world.patch
@@ -0,0 +1,152 @@
+From 0a25688f36df62579f4dd0444ceba33a0f8d4dcc Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Wed, 23 Sep 2020 16:08:24 -0600
+Subject: [PATCH 25/45] Support MPST in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump2.c  | 33 +++++++++++++++++++--------------
+ source/compiler/dttable2.c |  8 ++++----
+ 2 files changed, 23 insertions(+), 18 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/source/common/dmtbdump2.c
+@@ -1047,11 +1047,13 @@ AcpiDmDumpMpst (
+     UINT16                  SubtableCount;
+     UINT32                  PowerStateCount;
+     UINT32                  ComponentCount;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
++    UINT16                  Tmp16;
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoMpst);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -1059,13 +1061,14 @@ AcpiDmDumpMpst (
+ 
+     /* Subtable: Memory Power Node(s) */
+ 
+-    SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
++    Tmp16 = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
++    SubtableCount = AcpiUtReadUint16 (&Tmp16);
+     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
+ 
+-    while ((Offset < Table->Length) && SubtableCount)
++    while ((Offset < TableLength) && SubtableCount)
+     {
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable0,
+             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -1074,8 +1077,8 @@ AcpiDmDumpMpst (
+ 
+         /* Extract the sub-subtable counts */
+ 
+-        PowerStateCount = Subtable0->NumPowerStates;
+-        ComponentCount = Subtable0->NumPhysicalComponents;
++        PowerStateCount = AcpiUtReadUint16 (&Subtable0->NumPowerStates);
++        ComponentCount = AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents);
+         Offset += sizeof (ACPI_MPST_POWER_NODE);
+ 
+         /* Sub-subtables - Memory Power State Structure(s) */
+@@ -1086,7 +1089,7 @@ AcpiDmDumpMpst (
+         while (PowerStateCount)
+         {
+             AcpiOsPrintf ("\n");
+-            Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
++            Status = AcpiDmDumpTable (TableLength, Offset, Subtable0A,
+                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
+             if (ACPI_FAILURE (Status))
+             {
+@@ -1109,7 +1112,7 @@ AcpiDmDumpMpst (
+ 
+         while (ComponentCount)
+         {
+-            Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
++            Status = AcpiDmDumpTable (TableLength, Offset, Subtable0B,
+                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
+             if (ACPI_FAILURE (Status))
+             {
+@@ -1126,22 +1129,24 @@ AcpiDmDumpMpst (
+         SubtableCount--;
+         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
+             sizeof (ACPI_MPST_POWER_NODE) +
+-            (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
+-            (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
++            (sizeof (ACPI_MPST_POWER_STATE) *
++                AcpiUtReadUint16 (&Subtable0->NumPowerStates)) +
++            (sizeof (ACPI_MPST_COMPONENT) *
++                AcpiUtReadUint16 (&Subtable0->NumPhysicalComponents)));
+     }
+ 
+     /* Subtable: Count of Memory Power State Characteristic structures */
+ 
+     AcpiOsPrintf ("\n");
+     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
+-    Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
++    Status = AcpiDmDumpTable (TableLength, Offset, Subtable1,
+         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+     }
+ 
+-    SubtableCount = Subtable1->CharacteristicsCount;
++    SubtableCount = AcpiUtReadUint16 (&Subtable1->CharacteristicsCount);
+     Offset += sizeof (ACPI_MPST_DATA_HDR);
+ 
+     /* Subtable: Memory Power State Characteristics structure(s) */
+@@ -1149,10 +1154,10 @@ AcpiDmDumpMpst (
+     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
+         sizeof (ACPI_MPST_DATA_HDR));
+ 
+-    while ((Offset < Table->Length) && SubtableCount)
++    while ((Offset < TableLength) && SubtableCount)
+     {
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable2,
+             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
+         if (ACPI_FAILURE (Status))
+         {
+Index: acpica-unix2-20220331/source/compiler/dttable2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable2.c
++++ acpica-unix2-20220331/source/compiler/dttable2.c
+@@ -359,7 +359,7 @@ DtCompileMpst (
+     DtPushSubtable (Subtable);
+ 
+     MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
+-    SubtableCount = MpstChannelInfo->PowerNodeCount;
++    SubtableCount = AcpiUtReadUint16 (&MpstChannelInfo->PowerNodeCount);
+ 
+     while (*PFieldList && SubtableCount)
+     {
+@@ -377,8 +377,8 @@ DtCompileMpst (
+         DtPushSubtable (Subtable);
+ 
+         MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
+-        PowerStateCount = MpstPowerNode->NumPowerStates;
+-        ComponentCount = MpstPowerNode->NumPhysicalComponents;
++        PowerStateCount = AcpiUtReadUint16 (&MpstPowerNode->NumPowerStates);
++        ComponentCount = AcpiUtReadUint16 (&MpstPowerNode->NumPhysicalComponents);
+ 
+         ParentTable = DtPeekSubtable ();
+ 
+@@ -431,7 +431,7 @@ DtCompileMpst (
+     DtPushSubtable (Subtable);
+ 
+     MpstDataHeader = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable->Buffer);
+-    SubtableCount = MpstDataHeader->CharacteristicsCount;
++    SubtableCount = AcpiUtReadUint16(&MpstDataHeader->CharacteristicsCount);
+ 
+     ParentTable = DtPeekSubtable ();
+ 
diff --git a/0026-Support-NFIT-in-a-big-endian-world.patch b/0026-Support-NFIT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..6b85634
--- /dev/null
+++ b/0026-Support-NFIT-in-a-big-endian-world.patch
@@ -0,0 +1,227 @@
+From 5aec8511fc433a71cb8b6d26be464355d0c3f5cc Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Thu, 24 Sep 2020 15:25:53 -0600
+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 <ahs3 at redhat.com>
+---
+ source/common/dmtable.c    |  4 ++--
+ source/common/dmtbdump2.c  | 49 ++++++++++++++++++++++----------------
+ source/compiler/dttable2.c | 11 ++++++---
+ 3 files changed, 39 insertions(+), 25 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtable.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtable.c
++++ acpica-unix2-20220331/source/common/dmtable.c
+@@ -1766,13 +1766,13 @@ AcpiDmDumpTable (
+ 
+             /* NFIT subtable types */
+ 
+-            Temp16 = ACPI_GET16 (Target);
++            Temp16 = AcpiUtReadUint16 (Target);
+             if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
+             {
+                 Temp16 = ACPI_NFIT_TYPE_RESERVED;
+             }
+ 
+-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
++            AcpiOsPrintf (UINT16_FORMAT, Temp16,
+                 AcpiDmNfitSubnames[Temp16]);
+             break;
+ 
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/source/common/dmtbdump2.c
+@@ -1244,18 +1244,23 @@ AcpiDmDumpNfit (
+     ACPI_STATUS             Status;
+     UINT32                  Offset = sizeof (ACPI_TABLE_NFIT);
+     UINT32                  FieldOffset = 0;
+-    UINT32                  Length;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+     ACPI_NFIT_HEADER        *Subtable;
+     ACPI_DMTABLE_INFO       *InfoTable;
+     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
+     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
+     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
+     UINT32                  i;
++    UINT32                  Length;
++    UINT32                  LineCount;
++    UINT16                  SubtableLength;
++    UINT16                  SubtableType;
++    UINT16                  HintCount;
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNfit);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -1264,19 +1269,21 @@ AcpiDmDumpNfit (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         /* NFIT subtable header */
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+-            Subtable->Length, AcpiDmTableInfoNfitHdr);
++        SubtableType = AcpiUtReadUint16 (&Subtable->Type);
++        SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
++            SubtableLength, AcpiDmTableInfoNfitHdr);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+         }
+ 
+-        switch (Subtable->Type)
++        switch (SubtableType)
+         {
+         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
+ 
+@@ -1327,11 +1334,11 @@ AcpiDmDumpNfit (
+ 
+         default:
+             AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
+-                Subtable->Type);
++                SubtableType);
+ 
+             /* Attempt to continue */
+ 
+-            if (!Subtable->Length)
++            if (!SubtableLength)
+             {
+                 AcpiOsPrintf ("Invalid zero length subtable\n");
+                 return;
+@@ -1340,8 +1347,8 @@ AcpiDmDumpNfit (
+         }
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
+-            Subtable->Length, InfoTable);
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
++            SubtableLength, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+@@ -1349,14 +1356,15 @@ AcpiDmDumpNfit (
+ 
+         /* Per-subtable variable-length fields */
+ 
+-        switch (Subtable->Type)
++        switch (SubtableType)
+         {
+         case ACPI_NFIT_TYPE_INTERLEAVE:
+ 
+             Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
+-            for (i = 0; i < Interleave->LineCount; i++)
++            LineCount = AcpiUtReadUint32 (&Interleave->LineCount);
++            for (i = 0; i < LineCount; i++)
+             {
+-                Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
++                Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
+                     &Interleave->LineOffset[i],
+                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
+                 if (ACPI_FAILURE (Status))
+@@ -1370,14 +1378,14 @@ AcpiDmDumpNfit (
+ 
+         case ACPI_NFIT_TYPE_SMBIOS:
+ 
+-            Length = Subtable->Length -
++            Length = SubtableLength -
+                 sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
+ 
+             if (Length)
+             {
+-                Status = AcpiDmDumpTable (Table->Length,
++                Status = AcpiDmDumpTable (TableLength,
+                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
+-                    SmbiosInfo,
++                    SmbiosInfo + Offset,
+                     Length, AcpiDmTableInfoNfit3a);
+                 if (ACPI_FAILURE (Status))
+                 {
+@@ -1390,9 +1398,10 @@ AcpiDmDumpNfit (
+         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
+ 
+             Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
+-            for (i = 0; i < Hint->HintCount; i++)
++            HintCount = AcpiUtReadUint16 (&Hint->HintCount);
++            for (i = 0; i < HintCount; i++)
+             {
+-                Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
++                Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
+                     &Hint->HintAddress[i],
+                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
+                 if (ACPI_FAILURE (Status))
+@@ -1411,8 +1420,8 @@ AcpiDmDumpNfit (
+ NextSubtable:
+         /* Point to next subtable */
+ 
+-        Offset += Subtable->Length;
+-        Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
++        Offset += SubtableLength;
++        Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, SubtableLength);
+     }
+ }
+ 
+Index: acpica-unix2-20220331/source/compiler/dttable2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable2.c
++++ acpica-unix2-20220331/source/compiler/dttable2.c
+@@ -506,6 +506,7 @@ DtCompileNfit (
+     UINT32                  Count;
+     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
+     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
++    UINT16                  NfitHeaderType;
+ 
+ 
+     /* Main table */
+@@ -539,7 +540,8 @@ DtCompileNfit (
+ 
+         NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
+ 
+-        switch (NfitHeader->Type)
++        NfitHeaderType = AcpiUtReadUint16 (&NfitHeader->Type);
++        switch (NfitHeaderType)
+         {
+         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
+ 
+@@ -599,7 +601,7 @@ DtCompileNfit (
+         DtInsertSubtable (ParentTable, Subtable);
+         DtPopSubtable ();
+ 
+-        switch (NfitHeader->Type)
++        switch (NfitHeaderType)
+         {
+         case ACPI_NFIT_TYPE_INTERLEAVE:
+ 
+@@ -625,7 +627,8 @@ DtCompileNfit (
+                 Count++;
+             }
+ 
+-            Interleave->LineCount = Count;
++            AcpiUtWriteUint (&Interleave->LineCount, sizeof (UINT32),
++                &Count, sizeof (UINT32));
+             break;
+ 
+         case ACPI_NFIT_TYPE_SMBIOS:
+@@ -671,6 +674,8 @@ DtCompileNfit (
+             }
+ 
+             Hint->HintCount = (UINT16) Count;
++            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..680961e
--- /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 <ahs3 at redhat.com>
+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 <ahs3 at redhat.com>
+---
+ source/common/dmtbdump2.c  | 48 +++++++++++++++++++++-----------------
+ source/compiler/dttable2.c | 27 ++++++++++++++++++++-
+ 2 files changed, 52 insertions(+), 23 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/source/common/dmtbdump2.c
+@@ -2581,7 +2581,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;
+@@ -2589,11 +2589,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;
+@@ -2602,13 +2603,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;
+@@ -2631,8 +2633,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;
+@@ -2691,12 +2693,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))
+@@ -2708,14 +2710,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))
+@@ -2730,12 +2732,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);
+@@ -2750,12 +2752,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))
+@@ -2772,8 +2776,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-20220331/source/compiler/dttable2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable2.c
++++ acpica-unix2-20220331/source/compiler/dttable2.c
+@@ -1890,6 +1890,7 @@ DtCompileSdev (
+     UINT32                      EntryCount;
+     ACPI_SDEV_SECURE_COMPONENT  *SecureComponent = NULL;
+     UINT16                      ComponentLength = 0;
++    UINT16                      Tmp16;
+ 
+ 
+     /* Subtables */
+@@ -1911,7 +1912,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)
+         {
+@@ -2084,6 +2085,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:
+@@ -2146,6 +2159,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/0028-Support-HMAT-in-a-big-endian-world.patch b/0028-Support-HMAT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..386db57
--- /dev/null
+++ b/0028-Support-HMAT-in-a-big-endian-world.patch
@@ -0,0 +1,278 @@
+From 915b8b70726fd01befdeac0c8630db528ac40552 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 25 Sep 2020 16:56:55 -0600
+Subject: [PATCH 28/45] Support HMAT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump1.c  | 70 ++++++++++++++++++++++----------------
+ source/compiler/dttable1.c | 24 ++++++++++---
+ 2 files changed, 59 insertions(+), 35 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump1.c
++++ acpica-unix2-20220331/source/common/dmtbdump1.c
+@@ -1680,37 +1680,45 @@ AcpiDmDumpHmat (
+     UINT32                  Length;
+     ACPI_DMTABLE_INFO       *InfoTable;
+     UINT32                  i, j;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
++    UINT16                  HmatStructType;
++    UINT32                  HmatStructLength;
++    UINT32                  InitPDs;
++    UINT32                  TgtPDs;
++    UINT16                  SMBIOSHandles;
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoHmat);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoHmat);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+     }
+     Offset = sizeof (ACPI_TABLE_HMAT);
+ 
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         AcpiOsPrintf ("\n");
+ 
+         /* Dump HMAT structure header */
+ 
+         HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset);
+-        if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE))
++        HmatStructLength = AcpiUtReadUint32 (&HmatStruct->Length);
++        if (HmatStructLength < sizeof (ACPI_HMAT_STRUCTURE))
+         {
+             AcpiOsPrintf ("Invalid HMAT structure length\n");
+             return;
+         }
+-        Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
+-            HmatStruct->Length, AcpiDmTableInfoHmatHdr);
++        Status = AcpiDmDumpTable (TableLength, Offset, HmatStruct,
++            HmatStructLength, AcpiDmTableInfoHmatHdr);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+         }
+ 
+-        switch (HmatStruct->Type)
++        HmatStructType = AcpiUtReadUint16 (&HmatStruct->Type);
++        switch (HmatStructType)
+         {
+         case ACPI_HMAT_TYPE_ADDRESS_RANGE:
+ 
+@@ -1733,7 +1741,7 @@ AcpiDmDumpHmat (
+         default:
+ 
+             AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n",
+-                HmatStruct->Type);
++                HmatStructType);
+ 
+             /* Attempt to continue */
+ 
+@@ -1742,13 +1750,13 @@ AcpiDmDumpHmat (
+ 
+         /* Dump HMAT structure body */
+ 
+-        if (HmatStruct->Length < Length)
++        if (HmatStructLength < Length)
+         {
+             AcpiOsPrintf ("Invalid HMAT structure length\n");
+             return;
+         }
+-        Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct,
+-            HmatStruct->Length, InfoTable);
++        Status = AcpiDmDumpTable (TableLength, Offset, HmatStruct,
++            HmatStructLength, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
+             return;
+@@ -1756,7 +1764,7 @@ AcpiDmDumpHmat (
+ 
+         /* Dump HMAT structure additionals */
+ 
+-        switch (HmatStruct->Type)
++        switch (HmatStructType)
+         {
+         case ACPI_HMAT_TYPE_LOCALITY:
+ 
+@@ -1765,15 +1773,16 @@ AcpiDmDumpHmat (
+ 
+             /* Dump initiator proximity domains */
+ 
+-            if ((UINT32)(HmatStruct->Length - SubtableOffset) <
+-                (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4))
++            InitPDs = AcpiUtReadUint32 (&HmatLocality->NumberOfInitiatorPDs);
++            if ((UINT32) (HmatStructLength - SubtableOffset) <
++                (UINT32) (InitPDs * 4))
+             {
+                 AcpiOsPrintf ("Invalid initiator proximity domain number\n");
+                 return;
+             }
+-            for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
++            for (i = 0; i < InitPDs; i++)
+             {
+-                Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
++                Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
+                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
+                     4, AcpiDmTableInfoHmat1a);
+                 if (ACPI_FAILURE (Status))
+@@ -1786,15 +1795,16 @@ AcpiDmDumpHmat (
+ 
+             /* Dump target proximity domains */
+ 
+-            if ((UINT32)(HmatStruct->Length - SubtableOffset) <
+-                (UINT32)(HmatLocality->NumberOfTargetPDs * 4))
++            TgtPDs = AcpiUtReadUint32 (&HmatLocality->NumberOfTargetPDs);
++            if ((UINT32) (HmatStructLength - SubtableOffset) <
++                (UINT32) (TgtPDs * 4))
+             {
+                 AcpiOsPrintf ("Invalid target proximity domain number\n");
+                 return;
+             }
+-            for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++)
++            for (i = 0; i < TgtPDs; i++)
+             {
+-                Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
++                Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
+                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
+                     4, AcpiDmTableInfoHmat1b);
+                 if (ACPI_FAILURE (Status))
+@@ -1807,18 +1817,17 @@ AcpiDmDumpHmat (
+ 
+             /* Dump latency/bandwidth entris */
+ 
+-            if ((UINT32)(HmatStruct->Length - SubtableOffset) <
+-                (UINT32)(HmatLocality->NumberOfInitiatorPDs *
+-                         HmatLocality->NumberOfTargetPDs * 2))
++            if ((UINT32) (HmatStructLength - SubtableOffset) <
++                (UINT32) (InitPDs * TgtPDs * 2))
+             {
+                 AcpiOsPrintf ("Invalid latency/bandwidth entry number\n");
+                 return;
+             }
+-            for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++)
++            for (i = 0; i < InitPDs; i++)
+             {
+-                for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++)
++                for (j = 0; j < TgtPDs; j++)
+                 {
+-                    Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
++                    Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
+                         ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
+                         2, AcpiDmTableInfoHmat1c);
+                     if (ACPI_FAILURE(Status))
+@@ -1838,15 +1847,16 @@ AcpiDmDumpHmat (
+ 
+             /* Dump SMBIOS handles */
+ 
+-            if ((UINT32)(HmatStruct->Length - SubtableOffset) <
+-                (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2))
++            SMBIOSHandles = AcpiUtReadUint16 (&HmatCache->NumberOfSMBIOSHandles);
++            if ((UINT32) (HmatStructLength - SubtableOffset) <
++                (UINT32) (SMBIOSHandles * 2))
+             {
+                 AcpiOsPrintf ("Invalid SMBIOS handle number\n");
+                 return;
+             }
+-            for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++)
++            for (i = 0; i < SMBIOSHandles; i++)
+             {
+-                Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
++                Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
+                     ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset),
+                     2, AcpiDmTableInfoHmat2a);
+                 if (ACPI_FAILURE (Status))
+@@ -1866,6 +1876,6 @@ AcpiDmDumpHmat (
+ NextSubtable:
+         /* Point to next HMAT structure subtable */
+ 
+-        Offset += (HmatStruct->Length);
++        Offset += (HmatStructLength);
+     }
+ }
+Index: acpica-unix2-20220331/source/compiler/dttable1.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable1.c
++++ acpica-unix2-20220331/source/compiler/dttable1.c
+@@ -1737,6 +1737,8 @@ DtCompileHmat (
+     UINT32                  TgtPDNumber;
+     UINT64                  EntryNumber;
+     UINT16                  SMBIOSHandleNumber;
++    UINT16                  HmatStructType;
++    UINT32                  Length;
+ 
+ 
+     ParentTable = DtPeekSubtable ();
+@@ -1767,7 +1769,8 @@ DtCompileHmat (
+ 
+         /* Compile HMAT structure body */
+ 
+-        switch (HmatStruct->Type)
++        HmatStructType = AcpiUtReadUint16 (&HmatStruct->Type);
++        switch (HmatStructType)
+         {
+         case ACPI_HMAT_TYPE_ADDRESS_RANGE:
+ 
+@@ -1800,7 +1803,7 @@ DtCompileHmat (
+ 
+         /* Compile HMAT structure additionals */
+ 
+-        switch (HmatStruct->Type)
++        switch (HmatStructType)
+         {
+         case ACPI_HMAT_TYPE_LOCALITY:
+ 
+@@ -1826,7 +1829,7 @@ DtCompileHmat (
+                 HmatStruct->Length += Subtable->Length;
+                 IntPDNumber++;
+             }
+-            HmatLocality->NumberOfInitiatorPDs = IntPDNumber;
++            HmatLocality->NumberOfInitiatorPDs = AcpiUtReadUint32 (&IntPDNumber);
+ 
+             /* Compile target proximity domain list */
+ 
+@@ -1847,7 +1850,7 @@ DtCompileHmat (
+                 HmatStruct->Length += Subtable->Length;
+                 TgtPDNumber++;
+             }
+-            HmatLocality->NumberOfTargetPDs = TgtPDNumber;
++            HmatLocality->NumberOfTargetPDs = AcpiUtReadUint32 (&TgtPDNumber);
+ 
+             /* Save start of the entries for reporting errors */
+ 
+@@ -1873,6 +1876,9 @@ DtCompileHmat (
+                 EntryNumber++;
+             }
+ 
++            Length = AcpiUtReadUint32 (&HmatStruct->Length);
++            HmatStruct->Length = Length;
++
+             /* Validate number of entries */
+ 
+             if (EntryNumber !=
+@@ -1906,11 +1912,19 @@ DtCompileHmat (
+                 HmatStruct->Length += Subtable->Length;
+                 SMBIOSHandleNumber++;
+             }
+-            HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber;
++            HmatCache->NumberOfSMBIOSHandles =
++                    AcpiUtReadUint16 (&SMBIOSHandleNumber);
++
++            Length = AcpiUtReadUint32 (&HmatStruct->Length);
++            HmatStruct->Length = Length;
++
+             break;
+ 
+         default:
+ 
++        Length = AcpiUtReadUint32(&HmatStruct->Length);
++        HmatStruct->Length = Length;
++
+             break;
+         }
+     }
diff --git a/0029-Support-PDTT-in-a-big-endian-world.patch b/0029-Support-PDTT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..51e41d1
--- /dev/null
+++ b/0029-Support-PDTT-in-a-big-endian-world.patch
@@ -0,0 +1,43 @@
+From 253fe3545e7d4eaa9cb93c771c9619f410109a02 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 25 Sep 2020 17:03:05 -0600
+Subject: [PATCH 29/45] Support PDTT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump2.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/source/common/dmtbdump2.c
+@@ -1954,13 +1954,13 @@ AcpiDmDumpPdtt (
+ {
+     ACPI_STATUS             Status;
+     ACPI_PDTT_CHANNEL       *Subtable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_PDTT);
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoPdtt);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -1969,10 +1969,10 @@ AcpiDmDumpPdtt (
+     /* Subtables. Currently there is only one type, but can be multiples */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0);
+         if (ACPI_FAILURE (Status))
+         {
diff --git a/0030-Support-PPTT-in-a-big-endian-world.patch b/0030-Support-PPTT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..86fb5cd
--- /dev/null
+++ b/0030-Support-PPTT-in-a-big-endian-world.patch
@@ -0,0 +1,105 @@
+From 8923211d8bc1b0e4d3af6ff31ed6479057f612f6 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 25 Sep 2020 17:16:12 -0600
+Subject: [PATCH 30/45] Support PPTT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump2.c  | 17 ++++++++++-------
+ source/compiler/dttable2.c |  7 +++++--
+ 2 files changed, 15 insertions(+), 9 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/source/common/dmtbdump2.c
+@@ -2241,6 +2241,8 @@ AcpiDmDumpPptt (
+     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
+     ACPI_DMTABLE_INFO       *InfoTable;
+     UINT32                  i;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
++    UINT32                  NumPrivRes;
+ 
+ 
+     /* There is no main table (other than the standard ACPI header) */
+@@ -2248,7 +2250,7 @@ AcpiDmDumpPptt (
+     /* Subtables */
+ 
+     Offset = sizeof (ACPI_TABLE_HEADER);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         AcpiOsPrintf ("\n");
+ 
+@@ -2260,7 +2262,7 @@ AcpiDmDumpPptt (
+             AcpiOsPrintf ("Invalid subtable length\n");
+             return;
+         }
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Length, AcpiDmTableInfoPpttHdr);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -2302,7 +2304,7 @@ AcpiDmDumpPptt (
+             AcpiOsPrintf ("Invalid subtable length\n");
+             return;
+         }
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Length, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -2318,15 +2320,16 @@ AcpiDmDumpPptt (
+ 
+             /* Dump SMBIOS handles */
+ 
+-            if ((UINT8)(Subtable->Length - SubtableOffset) <
+-                (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
++            NumPrivRes = AcpiUtReadUint32 (&PpttProcessor->NumberOfPrivResources);
++            if ((UINT8) (Subtable->Length - SubtableOffset) <
++                (UINT8) (NumPrivRes * 4))
+             {
+                 AcpiOsPrintf ("Invalid private resource number\n");
+                 return;
+             }
+-            for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
++            for (i = 0; i < NumPrivRes; i++)
+             {
+-                Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
++                Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
+                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
+                     4, AcpiDmTableInfoPptt0a);
+                 if (ACPI_FAILURE (Status))
+Index: acpica-unix2-20220331/source/compiler/dttable2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/compiler/dttable2.c
++++ acpica-unix2-20220331/source/compiler/dttable2.c
+@@ -1520,6 +1520,7 @@ DtCompilePptt (
+     DT_FIELD                **PFieldList = (DT_FIELD **) List;
+     DT_FIELD                *SubtableStart;
+     ACPI_TABLE_HEADER       *PpttAcpiHeader;
++    UINT32                  NumPrivRes;
+ 
+ 
+     ParentTable = DtPeekSubtable ();
+@@ -1584,7 +1585,7 @@ DtCompilePptt (
+             {
+                 /* Compile initiator proximity domain list */
+ 
+-                PpttProcessor->NumberOfPrivResources = 0;
++                NumPrivRes = 0;
+                 while (*PFieldList)
+                 {
+                     Status = DtCompileTable (PFieldList,
+@@ -1600,8 +1601,10 @@ DtCompilePptt (
+ 
+                     DtInsertSubtable (ParentTable, Subtable);
+                     PpttHeader->Length += (UINT8)(Subtable->Length);
+-                    PpttProcessor->NumberOfPrivResources++;
++                    NumPrivRes++;
+                 }
++                PpttProcessor->NumberOfPrivResources =
++                        AcpiUtReadUint32 (&NumPrivRes);
+             }
+             break;
+ 
diff --git a/0031-Support-PCCT-in-a-big-endian-world.patch b/0031-Support-PCCT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..6400618
--- /dev/null
+++ b/0031-Support-PCCT-in-a-big-endian-world.patch
@@ -0,0 +1,54 @@
+From a58ff76fc6e68488d93b55016a7aeb257971a252 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 25 Sep 2020 17:39:34 -0600
+Subject: [PATCH 31/45] Support PCCT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump2.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump2.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump2.c
++++ acpica-unix2-20220331/source/common/dmtbdump2.c
+@@ -1850,13 +1850,13 @@ AcpiDmDumpPcct (
+     ACPI_STATUS             Status;
+     ACPI_PCCT_SUBSPACE      *Subtable;
+     ACPI_DMTABLE_INFO       *InfoTable;
+-    UINT32                  Length = Table->Length;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoPcct);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -1865,12 +1865,12 @@ AcpiDmDumpPcct (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         /* Common subtable header */
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Header.Length, AcpiDmTableInfoPcctHdr);
+         if (ACPI_FAILURE (Status))
+         {
+@@ -1918,7 +1918,7 @@ AcpiDmDumpPcct (
+         }
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             Subtable->Header.Length, InfoTable);
+         if (ACPI_FAILURE (Status))
+         {
diff --git a/0032-Support-WDAT-in-a-big-endian-world.patch b/0032-Support-WDAT-in-a-big-endian-world.patch
new file mode 100644
index 0000000..9bf59a7
--- /dev/null
+++ b/0032-Support-WDAT-in-a-big-endian-world.patch
@@ -0,0 +1,43 @@
+From ff1449919ee7d395d301e3a56a4ba333604d0458 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Fri, 25 Sep 2020 18:13:20 -0600
+Subject: [PATCH 32/45] Support WDAT in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump3.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump3.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump3.c
++++ acpica-unix2-20220331/source/common/dmtbdump3.c
+@@ -680,11 +680,12 @@ AcpiDmDumpWdat (
+     ACPI_STATUS             Status;
+     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
+     ACPI_WDAT_ENTRY         *Subtable;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
++    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoWdat);
+     if (ACPI_FAILURE (Status))
+     {
+         return;
+@@ -693,12 +694,12 @@ AcpiDmDumpWdat (
+     /* Subtables */
+ 
+     Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
+-    while (Offset < Table->Length)
++    while (Offset < TableLength)
+     {
+         /* Common subtable header */
+ 
+         AcpiOsPrintf ("\n");
+-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
++        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
+         if (ACPI_FAILURE (Status))
+         {
diff --git a/0033-Support-TCPA-in-a-big-endian-world.patch b/0033-Support-TCPA-in-a-big-endian-world.patch
new file mode 100644
index 0000000..bccfb52
--- /dev/null
+++ b/0033-Support-TCPA-in-a-big-endian-world.patch
@@ -0,0 +1,76 @@
+From b69b833f5a9205080b27d83379a31fad7fca1575 Mon Sep 17 00:00:00 2001
+From: Al Stone <ahs3 at redhat.com>
+Date: Sun, 27 Sep 2020 12:09:28 -0600
+Subject: [PATCH 33/45] Support TCPA in a big-endian world
+
+Signed-off-by: Al Stone <ahs3 at redhat.com>
+---
+ source/common/dmtbdump3.c  | 13 ++++++++-----
+ source/compiler/dttable2.c |  4 +++-
+ 2 files changed, 11 insertions(+), 6 deletions(-)
+
+Index: acpica-unix2-20220331/source/common/dmtbdump3.c
+===================================================================
+--- acpica-unix2-20220331.orig/source/common/dmtbdump3.c
++++ acpica-unix2-20220331/source/common/dmtbdump3.c
+@@ -406,11 +406,13 @@ AcpiDmDumpTcpa (
+     ACPI_TABLE_TCPA_HDR     *Subtable = ACPI_ADD_PTR (
+                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
+     ACPI_STATUS             Status;
++    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
++    UINT16                  PlatformClass;
+ 
+ 
+     /* Main table */
+ 
+-    Status = AcpiDmDumpTable (Table->Length, 0, Table,
++    Status = AcpiDmDumpTable (TableLength, 0, Table,
+         0, AcpiDmTableInfoTcpaHdr);
+     if (ACPI_FAILURE (Status))
+     {
+@@ -421,18 +423,19 @@ AcpiDmDumpTcpa (
+      * Examine the PlatformClass field to determine the table type.
+      * Either a client or server table. Only one.
+      */
<Skipped 12270 lines>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/acpica.git/commitdiff/b643ab7edd44dd1987bf605db0c6e71c415c8e86



More information about the pld-cvs-commit mailing list