Blame SOURCES/0001-Add-in-basic-infrastructure-for-big-endian-support.patch

9897bb
From 4594630ec2e6a33efce3047a86b08fa170b75848 Mon Sep 17 00:00:00 2001
9897bb
From: Al Stone <ahs3@redhat.com>
9897bb
Date: Thu, 15 Oct 2020 11:53:33 -0600
9897bb
Subject: [PATCH 01/45] Add in basic infrastructure for big-endian support
9897bb
9897bb
This adds in some basic functions -- AcpiUtReadUint32(), for example,
9897bb
to read a UINT32 value in little-endian form and return it in host-native
9897bb
format -- along with AcpiUtWriteUint() that writes out an integer in
9897bb
host-native format as a little-endian value.
9897bb
9897bb
But, to do that, I'm adding the functions in a new file: utendian.c.  So,
9897bb
the header files need fixing, and the makefiles need to be sure to compile
9897bb
the new code.  Further, UtIsBigEndianMachine() needed to be moved out of
9897bb
compiler/aslutils.c so it could be used in the new functions and avoid
9897bb
having to do some conditional compilation depending on endian-ness.
9897bb
9897bb
However, this sets things up for the future, where endian-aware code can
9897bb
be added as the need is uncovered.  For now, these functions cover all of
9897bb
the cases I know about.
9897bb
9897bb
Signed-off-by: Al Stone <ahs3@redhat.com>
9897bb
---
9897bb
 generate/unix/acpibin/Makefile         |   1 +
9897bb
 generate/unix/acpidump/Makefile        |   1 +
9897bb
 generate/unix/acpiexamples/Makefile    |   1 +
9897bb
 generate/unix/acpiexec/Makefile        |   1 +
9897bb
 generate/unix/acpihelp/Makefile        |   1 +
9897bb
 generate/unix/iasl/Makefile            |   1 +
9897bb
 source/compiler/aslcompiler.h          |   4 -
9897bb
 source/compiler/aslutils.c             |  27 ---
9897bb
 source/components/utilities/utendian.c | 236 +++++++++++++++++++++++++
9897bb
 source/include/acmacros.h              |  56 ------
9897bb
 source/include/acutils.h               |  32 ++++
9897bb
 source/include/platform/aclinux.h      |   1 +
9897bb
 12 files changed, 275 insertions(+), 87 deletions(-)
9897bb
 create mode 100644 source/components/utilities/utendian.c
9897bb
9897bb
Index: acpica-unix2-20210604/generate/unix/acpibin/Makefile
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/generate/unix/acpibin/Makefile
9897bb
+++ acpica-unix2-20210604/generate/unix/acpibin/Makefile
9897bb
@@ -37,6 +37,7 @@ OBJECTS = \
9897bb
 	$(OBJDIR)/utcache.o\
9897bb
 	$(OBJDIR)/utdebug.o\
9897bb
 	$(OBJDIR)/utdecode.o\
9897bb
+	$(OBJDIR)/utendian.o\
9897bb
 	$(OBJDIR)/utexcep.o\
9897bb
 	$(OBJDIR)/utglobal.o\
9897bb
 	$(OBJDIR)/utlock.o\
9897bb
Index: acpica-unix2-20210604/generate/unix/acpidump/Makefile
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/generate/unix/acpidump/Makefile
9897bb
+++ acpica-unix2-20210604/generate/unix/acpidump/Makefile
9897bb
@@ -36,6 +36,7 @@ OBJECTS = \
9897bb
 	$(OBJDIR)/osunixdir.o\
9897bb
 	$(OBJDIR)/osunixmap.o\
9897bb
 	$(OBJDIR)/osunixxf.o\
9897bb
+	$(OBJDIR)/utendian.o\
9897bb
 	$(OBJDIR)/tbprint.o\
9897bb
 	$(OBJDIR)/tbxfroot.o\
9897bb
 	$(OBJDIR)/utascii.o\
9897bb
Index: acpica-unix2-20210604/generate/unix/acpiexamples/Makefile
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/generate/unix/acpiexamples/Makefile
9897bb
+++ acpica-unix2-20210604/generate/unix/acpiexamples/Makefile
9897bb
@@ -139,6 +139,7 @@ OBJECTS = \
9897bb
 	$(OBJDIR)/utdebug.o\
9897bb
 	$(OBJDIR)/utdecode.o\
9897bb
 	$(OBJDIR)/utdelete.o\
9897bb
+	$(OBJDIR)/utendian.o\
9897bb
 	$(OBJDIR)/uterror.o\
9897bb
 	$(OBJDIR)/uteval.o\
9897bb
 	$(OBJDIR)/utexcep.o\
9897bb
Index: acpica-unix2-20210604/generate/unix/acpiexec/Makefile
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/generate/unix/acpiexec/Makefile
9897bb
+++ acpica-unix2-20210604/generate/unix/acpiexec/Makefile
9897bb
@@ -214,6 +214,7 @@ OBJECTS = \
9897bb
 	$(OBJDIR)/utdebug.o\
9897bb
 	$(OBJDIR)/utdecode.o\
9897bb
 	$(OBJDIR)/utdelete.o\
9897bb
+	$(OBJDIR)/utendian.o\
9897bb
 	$(OBJDIR)/uterror.o\
9897bb
 	$(OBJDIR)/uteval.o\
9897bb
 	$(OBJDIR)/utexcep.o\
9897bb
Index: acpica-unix2-20210604/generate/unix/acpihelp/Makefile
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/generate/unix/acpihelp/Makefile
9897bb
+++ acpica-unix2-20210604/generate/unix/acpihelp/Makefile
9897bb
@@ -45,6 +45,7 @@ OBJECTS = \
9897bb
 	$(OBJDIR)/getopt.o\
9897bb
 	$(OBJDIR)/osunixxf.o\
9897bb
 	$(OBJDIR)/utdebug.o\
9897bb
+	$(OBJDIR)/utendian.o\
9897bb
 	$(OBJDIR)/utexcep.o\
9897bb
 	$(OBJDIR)/utglobal.o\
9897bb
 	$(OBJDIR)/uthex.o\
9897bb
Index: acpica-unix2-20210604/generate/unix/iasl/Makefile
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/generate/unix/iasl/Makefile
9897bb
+++ acpica-unix2-20210604/generate/unix/iasl/Makefile
9897bb
@@ -225,6 +225,7 @@ OBJECTS = \
9897bb
 	$(OBJDIR)/utdebug.o\
9897bb
 	$(OBJDIR)/utdecode.o\
9897bb
 	$(OBJDIR)/utdelete.o\
9897bb
+	$(OBJDIR)/utendian.o\
9897bb
 	$(OBJDIR)/uterror.o\
9897bb
 	$(OBJDIR)/utexcep.o\
9897bb
 	$(OBJDIR)/utglobal.o\
9897bb
Index: acpica-unix2-20210604/source/compiler/aslcompiler.h
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/compiler/aslcompiler.h
9897bb
+++ acpica-unix2-20210604/source/compiler/aslcompiler.h
9897bb
@@ -1120,10 +1120,6 @@ BOOLEAN
9897bb
 UtIsIdInteger (
9897bb
     UINT8                   *Target);
9897bb
 
9897bb
-UINT8
9897bb
-UtIsBigEndianMachine (
9897bb
-    void);
9897bb
-
9897bb
 BOOLEAN
9897bb
 UtQueryForOverwrite (
9897bb
     char                    *Pathname);
9897bb
Index: acpica-unix2-20210604/source/compiler/aslutils.c
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/compiler/aslutils.c
9897bb
+++ acpica-unix2-20210604/source/compiler/aslutils.c
9897bb
@@ -73,33 +73,6 @@ UtDisplayErrorSummary (
9897bb
 
9897bb
 /*******************************************************************************
9897bb
  *
9897bb
- * FUNCTION:    UtIsBigEndianMachine
9897bb
- *
9897bb
- * PARAMETERS:  None
9897bb
- *
9897bb
- * RETURN:      TRUE if machine is big endian
9897bb
- *              FALSE if machine is little endian
9897bb
- *
9897bb
- * DESCRIPTION: Detect whether machine is little endian or big endian.
9897bb
- *
9897bb
- ******************************************************************************/
9897bb
-
9897bb
-UINT8
9897bb
-UtIsBigEndianMachine (
9897bb
-    void)
9897bb
-{
9897bb
-    union {
9897bb
-        UINT32              Integer;
9897bb
-        UINT8               Bytes[4];
9897bb
-    } Overlay =                 {0xFF000000};
9897bb
-
9897bb
-
9897bb
-    return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
9897bb
-}
9897bb
-
9897bb
-
9897bb
-/*******************************************************************************
9897bb
- *
9897bb
  * FUNCTION:    UtIsIdInteger
9897bb
  *
9897bb
  * PARAMETERS:  Pointer to an ACPI ID (HID, CID) string
9897bb
Index: acpica-unix2-20210604/source/components/utilities/utendian.c
9897bb
===================================================================
9897bb
--- /dev/null
9897bb
+++ acpica-unix2-20210604/source/components/utilities/utendian.c
9897bb
@@ -0,0 +1,236 @@
9897bb
+/******************************************************************************
9897bb
+ *
9897bb
+ * Module Name: utendian -- byte swapping support for other-endianness
9897bb
+ *
9897bb
+ *****************************************************************************/
9897bb
+
9897bb
+/*****************************************************************************
9897bb
+ *
9897bb
+ * Copyright (c) 2020, Al Stone <ahs3@redhat.com>
9897bb
+ *
9897bb
+ * Redistribution and use in source and binary forms, with or without
9897bb
+ * modification, are permitted provided that the following conditions
9897bb
+ * are met:
9897bb
+ * 1. Redistributions of source code must retain the above copyright
9897bb
+ *    notice, this list of conditions, and the following disclaimer,
9897bb
+ *    without modification.
9897bb
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
9897bb
+ *    substantially similar to the "NO WARRANTY" disclaimer below
9897bb
+ *    ("Disclaimer") and any redistribution must be conditioned upon
9897bb
+ *    including a substantially similar Disclaimer requirement for further
9897bb
+ *    binary redistribution.
9897bb
+ * 3. Neither the names of the above-listed copyright holders nor the names
9897bb
+ *    of any contributors may be used to endorse or promote products derived
9897bb
+ *    from this software without specific prior written permission.
9897bb
+ *
9897bb
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
9897bb
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
9897bb
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
9897bb
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9897bb
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9897bb
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9897bb
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
9897bb
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
9897bb
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
9897bb
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
9897bb
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9897bb
+ *
9897bb
+ * Alternatively, you may choose to be licensed under the terms of the
9897bb
+ * GNU General Public License ("GPL") version 2 as published by the Free
9897bb
+ * Software Foundation.
9897bb
+ *
9897bb
+ *****************************************************************************/
9897bb
+
9897bb
+#include "acpi.h"
9897bb
+#include "accommon.h"
9897bb
+
9897bb
+#define _COMPONENT          ACPI_COMPILER
9897bb
+        ACPI_MODULE_NAME    ("utendian")
9897bb
+
9897bb
+/*
9897bb
+ * Endianness support functions.
9897bb
+ *
9897bb
+ * Ultimately, everything in ACPI tables or AML must be in little-endian
9897bb
+ * format.  However, we sometimes find it necessary to run on a big-endian
9897bb
+ * machine and create or read those little-endian values.  This is a small
9897bb
+ * libary of functions to make that easier, and more visible.
9897bb
+ *
9897bb
+ */
9897bb
+
9897bb
+/*******************************************************************************
9897bb
+ *
9897bb
+ * FUNCTION:    UtIsBigEndianMachine
9897bb
+ *
9897bb
+ * PARAMETERS:  None
9897bb
+ *
9897bb
+ * RETURN:      TRUE if machine is big endian
9897bb
+ *              FALSE if machine is little endian
9897bb
+ *
9897bb
+ * DESCRIPTION: Detect whether machine is little endian or big endian.
9897bb
+ *
9897bb
+ ******************************************************************************/
9897bb
+
9897bb
+UINT8
9897bb
+UtIsBigEndianMachine (
9897bb
+    void)
9897bb
+{
9897bb
+    union {
9897bb
+        UINT32              Integer;
9897bb
+        UINT8               Bytes[4];
9897bb
+    } Overlay =                 {0xFF000000};
9897bb
+
9897bb
+
9897bb
+    return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
9897bb
+}
9897bb
+
9897bb
+
9897bb
+/*******************************************************************************
9897bb
+ *
9897bb
+ * FUNCTION:    AcpiUtReadUint16
9897bb
+ *
9897bb
+ * PARAMETERS:  Src         - location containing the little-endian
9897bb
+ *                                    value
9897bb
+ *
9897bb
+ * RETURN:      UINT16 value in host-native form
9897bb
+ *
9897bb
+ * DESCRIPTION: Read a UINT16 little-endian value from a given location
9897bb
+ *              and return it in host-native form
9897bb
+ *
9897bb
+ ******************************************************************************/
9897bb
+
9897bb
+UINT16
9897bb
+AcpiUtReadUint16 (
9897bb
+    void                    *SrcPtr)
9897bb
+{
9897bb
+    UINT16                  Result = 0;
9897bb
+    UINT8                   *Dst = (UINT8 *) &Result;
9897bb
+    UINT8                   *Src = (UINT8 *) SrcPtr;
9897bb
+
9897bb
+    if (!UtIsBigEndianMachine())
9897bb
+    {
9897bb
+        return (*(UINT16 *) SrcPtr);
9897bb
+    }
9897bb
+
9897bb
+    Dst[0] = Src[1];
9897bb
+    Dst[1] = Src[0];
9897bb
+
9897bb
+    return (Result);
9897bb
+}
9897bb
+
9897bb
+/*******************************************************************************
9897bb
+ *
9897bb
+ * FUNCTION:    AcpiUtReadUint32
9897bb
+ *
9897bb
+ * PARAMETERS:  Src         - location containing the little-endian
9897bb
+ *                                    value
9897bb
+ *
9897bb
+ * RETURN:      UINT32 value in host-native form
9897bb
+ *
9897bb
+ * DESCRIPTION: Read a UINT32 little-endian value from a given location
9897bb
+ *              and return it in host-native form
9897bb
+ *
9897bb
+ ******************************************************************************/
9897bb
+
9897bb
+UINT32
9897bb
+AcpiUtReadUint32 (
9897bb
+    void                    *SrcPtr)
9897bb
+{
9897bb
+    UINT32                  Result = 0;
9897bb
+    UINT8                   *Dst = (UINT8 *) &Result;
9897bb
+    UINT8                   *Src = (UINT8 *) SrcPtr;
9897bb
+
9897bb
+    if (!UtIsBigEndianMachine())
9897bb
+    {
9897bb
+        return (*(UINT32 *) SrcPtr);
9897bb
+    }
9897bb
+
9897bb
+    Dst[0] = Src[3];
9897bb
+    Dst[1] = Src[2];
9897bb
+    Dst[2] = Src[1];
9897bb
+    Dst[3] = Src[0];
9897bb
+
9897bb
+    return (Result);
9897bb
+}
9897bb
+
9897bb
+/*******************************************************************************
9897bb
+ *
9897bb
+ * FUNCTION:    AcpiUtReadUint64
9897bb
+ *
9897bb
+ * PARAMETERS:  Src         - location containing the little-endian
9897bb
+ *                                    value
9897bb
+ *
9897bb
+ * RETURN:      UINT64 value in host-native form
9897bb
+ *
9897bb
+ * DESCRIPTION: Read a UINT64 little-endian value from a given location
9897bb
+ *              and return it in host-native form
9897bb
+ *
9897bb
+ ******************************************************************************/
9897bb
+
9897bb
+UINT64
9897bb
+AcpiUtReadUint64 (
9897bb
+    void                    *SrcPtr)
9897bb
+{
9897bb
+    UINT64                  Result = 0;
9897bb
+    UINT8                   *Dst = (UINT8 *) &Result;
9897bb
+    UINT8                   *Src = (UINT8 *) SrcPtr;
9897bb
+
9897bb
+    if (!UtIsBigEndianMachine())
9897bb
+    {
9897bb
+        return (*(UINT64 *) SrcPtr);
9897bb
+    }
9897bb
+
9897bb
+    Dst[0] = Src[7];
9897bb
+    Dst[1] = Src[6];
9897bb
+    Dst[2] = Src[5];
9897bb
+    Dst[3] = Src[4];
9897bb
+    Dst[4] = Src[3];
9897bb
+    Dst[5] = Src[2];
9897bb
+    Dst[6] = Src[1];
9897bb
+    Dst[7] = Src[0];
9897bb
+
9897bb
+    return (Result);
9897bb
+}
9897bb
+
9897bb
+/*******************************************************************************
9897bb
+ *
9897bb
+ * FUNCTION:    AcpiUtWriteUint
9897bb
+ *
9897bb
+ * PARAMETERS:  DstPtr      - where to place the retrieved value
9897bb
+ *              DstLength   - space in bytes for this int type
9897bb
+ *              SrcPtr      - where the little-endian value lives
9897bb
+ *              SrcLength   - space in bytes for this int type
9897bb
+ *
9897bb
+ * RETURN:      None.
9897bb
+ *
9897bb
+ * DESCRIPTION: Write a host-native integer value of the given size, and
9897bb
+ *              store it in the location specified in little-endian form.
9897bb
+ *              Given the amount of integer type casting done, this general
9897bb
+ *              version seems the most useful (vs 32->32, 32->16, 16->32,
9897bb
+ *              ad infinitum)
9897bb
+ *
9897bb
+ ******************************************************************************/
9897bb
+
9897bb
+void
9897bb
+AcpiUtWriteUint (
9897bb
+    void                    *DstPtr,
9897bb
+    int                     DstLength,
9897bb
+    const void              *SrcPtr,
9897bb
+    const int               SrcLength)
9897bb
+{
9897bb
+    UINT8                   *Dst = (UINT8 *) DstPtr;
9897bb
+    UINT8                   *Src = (UINT8 *) SrcPtr;
9897bb
+    int                      Length;
9897bb
+    int                      ii;
9897bb
+
9897bb
+    if (!UtIsBigEndianMachine())
9897bb
+    {
9897bb
+        Length = SrcLength > DstLength ? DstLength : SrcLength;
9897bb
+        memcpy (Dst, Src, Length);
9897bb
+	return;
9897bb
+    }
9897bb
+
9897bb
+    Length = SrcLength >= DstLength ? DstLength : SrcLength;
9897bb
+    for (ii = 0; ii < Length; ii++)
9897bb
+        Dst[ii] = Src[SrcLength - ii - 1];
9897bb
+
9897bb
+}
9897bb
Index: acpica-unix2-20210604/source/include/acmacros.h
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/include/acmacros.h
9897bb
+++ acpica-unix2-20210604/source/include/acmacros.h
9897bb
@@ -76,61 +76,6 @@
9897bb
  * If the hardware supports the transfer of unaligned data, just do the store.
9897bb
  * Otherwise, we have to move one byte at a time.
9897bb
  */
9897bb
-#ifdef ACPI_BIG_ENDIAN
9897bb
-/*
9897bb
- * Macros for big-endian machines
9897bb
- */
9897bb
-
9897bb
-/* These macros reverse the bytes during the move, converting little-endian to big endian */
9897bb
-
9897bb
-                                                     /* Big Endian      <==        Little Endian */
9897bb
-                                                     /*  Hi...Lo                     Lo...Hi     */
9897bb
-/* 16-bit source, 16/32/64 destination */
9897bb
-
9897bb
-#define ACPI_MOVE_16_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[1];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[0];}
9897bb
-
9897bb
-#define ACPI_MOVE_16_TO_32(d, s)        {(*(UINT32 *)(void *)(d))=0;\
9897bb
-                                           ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
9897bb
-                                           ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
9897bb
-
9897bb
-#define ACPI_MOVE_16_TO_64(d, s)        {(*(UINT64 *)(void *)(d))=0;\
9897bb
-                                           ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
9897bb
-                                           ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
9897bb
-
9897bb
-/* 32-bit source, 16/32/64 destination */
9897bb
-
9897bb
-#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
9897bb
-
9897bb
-#define ACPI_MOVE_32_TO_32(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[1];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[0];}
9897bb
-
9897bb
-#define ACPI_MOVE_32_TO_64(d, s)        {(*(UINT64 *)(void *)(d))=0;\
9897bb
-                                           ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
9897bb
-                                           ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
9897bb
-                                           ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
9897bb
-                                           ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
9897bb
-
9897bb
-/* 64-bit source, 16/32/64 destination */
9897bb
-
9897bb
-#define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
9897bb
-
9897bb
-#define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)    /* Truncate to 32 */
9897bb
-
9897bb
-#define ACPI_MOVE_64_TO_64(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[3];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[2];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
9897bb
-                                         ((  UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
9897bb
-#else
9897bb
-/*
9897bb
- * Macros for little-endian machines
9897bb
- */
9897bb
 
9897bb
 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
9897bb
 
9897bb
@@ -193,7 +138,6 @@
9897bb
                                          ((  UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\
9897bb
                                          ((  UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];}
9897bb
 #endif
9897bb
-#endif
9897bb
 
9897bb
 
9897bb
 /*
9897bb
Index: acpica-unix2-20210604/source/include/acutils.h
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/include/acutils.h
9897bb
+++ acpica-unix2-20210604/source/include/acutils.h
9897bb
@@ -1167,4 +1167,36 @@ AcpiUtConvertUuidToString (
9897bb
     char                    *OutString);
9897bb
 #endif
9897bb
 
9897bb
+
9897bb
+/*
9897bb
+ * utendian -- byte-swapping for big-endian support
9897bb
+ */
9897bb
+
9897bb
+UINT8
9897bb
+UtIsBigEndianMachine (
9897bb
+    void);
9897bb
+
9897bb
+#if defined(ACPI_ASL_COMPILER) || defined(ACPI_EXEC_APP) || \
9897bb
+    defined(ACPI_HELP_APP)     || defined(ACPI_DUMP_APP) || \
9897bb
+    defined(ACPI_EXAMPLE_APP)  || defined(ACPI_BIN_APP)
9897bb
+UINT32
9897bb
+AcpiUtReadUint32 (
9897bb
+    void                    *SrcPtr);
9897bb
+
9897bb
+UINT16
9897bb
+AcpiUtReadUint16 (
9897bb
+    void                    *SrcPtr);
9897bb
+
9897bb
+UINT64
9897bb
+AcpiUtReadUint64 (
9897bb
+    void                    *SrcPtr);
9897bb
+
9897bb
+void  
9897bb
+AcpiUtWriteUint (
9897bb
+    void                    *DstPtr,
9897bb
+    int                     DstLength,
9897bb
+    const void              *SrcPtr,
9897bb
+    const int               SrcLength);
9897bb
+#endif
9897bb
+
9897bb
 #endif /* _ACUTILS_H */
9897bb
Index: acpica-unix2-20210604/source/include/platform/aclinux.h
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/include/platform/aclinux.h
9897bb
+++ acpica-unix2-20210604/source/include/platform/aclinux.h
9897bb
@@ -198,6 +198,7 @@
9897bb
 
9897bb
 #ifdef ACPI_USE_STANDARD_HEADERS
9897bb
 #include <unistd.h>
9897bb
+#include <endian.h>
9897bb
 #endif
9897bb
 
9897bb
 /* Define/disable kernel-specific declarators */