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