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

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