Blame SOURCES/CEDT-support_09.patch

ed51cc
commit d9798f5275bb20ab88ac854ba04e6e3bdb22cf6d
ed51cc
Author: Lawrence Hileman <larry.hileman@xconn-tech.com>
ed51cc
Date:   Mon Jan 17 15:24:34 2022 -0800
ed51cc
ed51cc
    Fix Compile issue with CEDT and add template
ed51cc
ed51cc
diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c
ed51cc
index 79550ab..6eea2a4 100644
ed51cc
--- a/source/compiler/dttable1.c
ed51cc
+++ b/source/compiler/dttable1.c
ed51cc
@@ -262,6 +262,7 @@ DtCompileCedt (
ed51cc
 
ed51cc
     while (*PFieldList)
ed51cc
     {
ed51cc
+        int InsertFlag = 1;             // if CFMWS and has more than one target, then set to zero later
ed51cc
         SubtableStart = *PFieldList;
ed51cc
 
ed51cc
         /* CEDT Header */
ed51cc
@@ -283,24 +284,68 @@ DtCompileCedt (
ed51cc
         {
ed51cc
         case ACPI_CEDT_TYPE_CHBS:
ed51cc
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt0, &Subtable);
ed51cc
+            if (ACPI_FAILURE (Status))
ed51cc
+            {
ed51cc
+                return (Status);
ed51cc
+            }
ed51cc
             break;
ed51cc
-        case ACPI_CEDT_TYPE_CFMWS:
ed51cc
+        case ACPI_CEDT_TYPE_CFMWS: {
ed51cc
+            unsigned char *dump;
ed51cc
+            unsigned int idx, offset, max = 0;
ed51cc
+
ed51cc
+            // Compile table with first "Interleave target"
ed51cc
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt1, &Subtable);
ed51cc
+            if (ACPI_FAILURE (Status))
ed51cc
+            {
ed51cc
+                return (Status);
ed51cc
+            }
ed51cc
+
ed51cc
+            // Look in buffer for the number of targets
ed51cc
+            offset = (unsigned int) ACPI_OFFSET (ACPI_CEDT_CFMWS, InterleaveWays);
ed51cc
+            dump = (unsigned char *) Subtable->Buffer - 4;     // place at beginning of cedt1
ed51cc
+            max = 0x01 << dump[offset]; // 2^max, so 0=1, 1=2, 2=4, 3=8.  8 is MAX
ed51cc
+            if (max > 8)    max=1;      // Error in encoding Interleaving Ways.
ed51cc
+            if (max == 1)               // if only one target, then break here.
ed51cc
+                break;                  // break if only one target.
ed51cc
+
ed51cc
+            // We need to add more interleave targets, so write the current Subtable.
ed51cc
+            ParentTable = DtPeekSubtable ();
ed51cc
+            DtInsertSubtable (ParentTable, Subtable);   // Insert AcpiDmTableInfoCedt1 table so we can put in
ed51cc
+            DtPushSubtable (Subtable);                  // the targets > the first.
ed51cc
+
ed51cc
+            // Now, find out all interleave targets beyond the first.
ed51cc
+            for (idx = 1; idx < max; idx++) {
ed51cc
+                ParentTable = DtPeekSubtable ();
ed51cc
+
ed51cc
+                if (*PFieldList)
ed51cc
+                {
ed51cc
+                    Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt1_te, &Subtable);
ed51cc
+                    if (ACPI_FAILURE (Status))
ed51cc
+                    {
ed51cc
+                        return (Status);
ed51cc
+                    }
ed51cc
+                    if (Subtable)
ed51cc
+                    {
ed51cc
+                        DtInsertSubtable (ParentTable, Subtable);       // got a target, so insert table.
ed51cc
+                        InsertFlag = 0;
ed51cc
+                    }
ed51cc
+                }
ed51cc
+            }
ed51cc
+
ed51cc
+            DtPopSubtable ();
ed51cc
+            ParentTable = DtPeekSubtable ();
ed51cc
             break;
ed51cc
+        }
ed51cc
 
ed51cc
         default:
ed51cc
             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "CEDT");
ed51cc
             return (AE_ERROR);
ed51cc
         }
ed51cc
 
ed51cc
-        /* CEDT Subtable */
ed51cc
-        if (ACPI_FAILURE (Status))
ed51cc
-        {
ed51cc
-            return (Status);
ed51cc
-        }
ed51cc
-
ed51cc
         ParentTable = DtPeekSubtable ();
ed51cc
-        DtInsertSubtable (ParentTable, Subtable);
ed51cc
+        if (InsertFlag == 1) {
ed51cc
+                DtInsertSubtable (ParentTable, Subtable);
ed51cc
+        }
ed51cc
         DtPopSubtable ();
ed51cc
     }
ed51cc
 
ed51cc
diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h
ed51cc
index 82f352a..ceddb93 100644
ed51cc
--- a/source/compiler/dttemplate.h
ed51cc
+++ b/source/compiler/dttemplate.h
ed51cc
@@ -98,23 +98,58 @@ const unsigned char TemplateBoot[] =
ed51cc
 
ed51cc
 const unsigned char TemplateCedt[] =
ed51cc
 {
ed51cc
-    0x43,0x45,0x44,0x54,0x84,0x00,0x00,0x00,  /* 00000000    "CEDT...." */
ed51cc
-    0x01,0x8B,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
ed51cc
-    0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
ed51cc
-    0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
ed51cc
-    0x05,0x01,0x21,0x20,0x00,0x00,0x20,0x00,  /* 00000020    "..! .. ." */
ed51cc
-    0x33,0x33,0xCD,0xAB,0x01,0x00,0x00,0x00,  /* 00000028    "33......" */
ed51cc
-    0x00,0x00,0x00,0x00,0x00,0x21,0x43,0xD5,  /* 00000030    ".....!C." */
ed51cc
-    0x00,0x00,0x00,0x00,0x45,0x23,0x01,0x00,  /* 00000038    "....E#.." */
ed51cc
+    0x43,0x45,0x44,0x54,0x9c,0x01,0x00,0x00,  /* 00000000    "CEDT...." */
ed51cc
+    0x01,0x87,0x49,0x4e,0x54,0x45,0x4c,0x20,  /* 00000008    "..INTEL " */
ed51cc
+    0x54,0x45,0x4d,0x50,0x4c,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
ed51cc
+    0x00,0x00,0x00,0x00,0x49,0x4e,0x54,0x4c,  /* 00000018    "....INTL" */
ed51cc
+    0x17,0x12,0x21,0x20,0x00,0x00,0x20,0x00,  /* 00000020    "..! .. ." */
ed51cc
+    0x00,0x5e,0xba,0x00,0x00,0x00,0x00,0x00,  /* 00000028    ".^......" */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,  /* 00000030    "........" */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,  /* 00000038    "..... .." */
ed51cc
     0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,  /* 00000040    "...... ." */
ed51cc
-    0x44,0x44,0xCD,0xAB,0x01,0x00,0x00,0x00,  /* 00000048    "DD......" */
ed51cc
-    0x00,0x00,0x00,0x00,0x00,0x21,0x43,0xA5,  /* 00000050    ".....!C." */
ed51cc
-    0x00,0x00,0x00,0x00,0x45,0x23,0xB1,0x00,  /* 00000058    "....E#.." */
ed51cc
+    0x01,0x5e,0xba,0x00,0x00,0x00,0x00,0x00,  /* 00000048    ".^......" */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,  /* 00000050    "..... .." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,  /* 00000058    "..... .." */
ed51cc
     0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,  /* 00000060    "...... ." */
ed51cc
-    0x55,0x55,0xCD,0xAB,0x01,0x00,0x00,0x00,  /* 00000068    "UU......" */
ed51cc
-    0x00,0x00,0x00,0x00,0x00,0x21,0x43,0xB5,  /* 00000070    ".....!C." */
ed51cc
-    0x00,0x00,0x00,0x00,0x45,0x23,0xB1,0x00,  /* 00000078    "....E#.." */
ed51cc
-    0x00,0x00,0x00,0x00                       /* 00000080    "...."     */
ed51cc
+    0x02,0x5e,0xba,0x00,0x00,0x00,0x00,0x00,  /* 00000068    ".^......" */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,  /* 00000070    ".....0.." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,  /* 00000078    "..... .." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,  /* 00000080    "...... ." */
ed51cc
+    0x03,0x5e,0xba,0x00,0x00,0x00,0x00,0x00,  /* 00000088    ".^......" */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,  /* 00000090    ".....@.." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,  /* 00000098    "..... .." */
ed51cc
+    0x00,0x00,0x00,0x00,0x01,0x00,0x28,0x00,  /* 000000a0    "......(." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000a8    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000b0    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000b8    "........" */
ed51cc
+    0x03,0x00,0x00,0x00,0x06,0x00,0x01,0x00,  /* 000000c0    "........" */
ed51cc
+    0x00,0x5e,0xba,0x00,0x01,0x00,0x28,0x00,  /* 000000c8    ".^....(." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000d0    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000d8    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000e0    "........" */
ed51cc
+    0x03,0x00,0x00,0x00,0x06,0x00,0x01,0x00,  /* 000000e8    "........" */
ed51cc
+    0x01,0x5e,0xba,0x00,0x01,0x00,0x28,0x00,  /* 000000f0    ".^....(." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000f8    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000100    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000108    "........" */
ed51cc
+    0x03,0x00,0x00,0x00,0x06,0x00,0x01,0x00,  /* 00000110    "........" */
ed51cc
+    0x02,0x5e,0xba,0x00,0x01,0x00,0x28,0x00,  /* 00000118    ".^....(." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000120    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000128    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000130    "........" */
ed51cc
+    0x03,0x00,0x00,0x00,0x06,0x00,0x01,0x00,  /* 00000138    "........" */
ed51cc
+    0x03,0x5e,0xba,0x00,0x01,0x00,0x2c,0x00,  /* 00000140    ".^....,." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000148    "........" */
ed51cc
+    0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000150    "........" */
ed51cc
+    0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00,  /* 00000158    "........" */
ed51cc
+    0x03,0x00,0x00,0x00,0x06,0x00,0x01,0x00,  /* 00000160    "........" */
ed51cc
+    0x00,0x5e,0xba,0x00,0x01,0x5e,0xba,0x00,  /* 00000160    ".^...^.." */
ed51cc
+    0x01,0x00,0x2c,0x00,0x00,0x00,0x00,0x00,  /* 00000170    "..,....." */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,  /* 00000178    "........" */
ed51cc
+    0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,  /* 00000180    "........" */
ed51cc
+    0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,  /* 00000188    "........" */
ed51cc
+    0x0a,0x00,0x01,0x00,0x02,0x5e,0xba,0x00,  /* 00000190    ".....^.." */
ed51cc
+    0x03,0x5e,0xba,0x00                       /* 00000198    ".^.."     */
ed51cc
 };
ed51cc
 
ed51cc
 const unsigned char TemplateCpep[] =