Blame SOURCES/CEDT-support_09.patch

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