Home | History | Annotate | Line # | Download | only in compiler
dtcompile.c revision 1.1.1.15
      1 /******************************************************************************
      2  *
      3  * Module Name: dtcompile.c - Front-end for data table compiler
      4  *
      5  *****************************************************************************/
      6 
      7 /*
      8  * Copyright (C) 2000 - 2019, Intel Corp.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions, and the following disclaimer,
     16  *    without modification.
     17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  *    including a substantially similar Disclaimer requirement for further
     21  *    binary redistribution.
     22  * 3. Neither the names of the above-listed copyright holders nor the names
     23  *    of any contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * Alternatively, this software may be distributed under the terms of the
     27  * GNU General Public License ("GPL") version 2 as published by the Free
     28  * Software Foundation.
     29  *
     30  * NO WARRANTY
     31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
     34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  * POSSIBILITY OF SUCH DAMAGES.
     42  */
     43 
     44 #define _DECLARE_DT_GLOBALS
     45 
     46 #include "aslcompiler.h"
     47 
     48 #define _COMPONENT          DT_COMPILER
     49         ACPI_MODULE_NAME    ("dtcompile")
     50 
     51 static char                 VersionString[9];
     52 
     53 
     54 /* Local prototypes */
     55 
     56 void
     57 DtInitialize (
     58     void);
     59 
     60 static ACPI_STATUS
     61 DtCompileDataTable (
     62     DT_FIELD                **Field);
     63 
     64 static void
     65 DtInsertCompilerIds (
     66     DT_FIELD                *FieldList);
     67 
     68 
     69 /******************************************************************************
     70  *
     71  * FUNCTION:    DtDoCompile
     72  *
     73  * PARAMETERS:  None
     74  *
     75  * RETURN:      Status
     76  *
     77  * DESCRIPTION: Main entry point for the data table compiler.
     78  *
     79  * Note: Assumes AslGbl_Files[ASL_FILE_INPUT] is initialized and the file is
     80  *          open at seek offset zero.
     81  *
     82  *****************************************************************************/
     83 
     84 ACPI_STATUS
     85 DtDoCompile (
     86     void)
     87 {
     88     ACPI_STATUS             Status;
     89     UINT8                   Event;
     90     DT_FIELD                *FieldList;
     91     ASL_GLOBAL_FILE_NODE    *FileNode;
     92 
     93 
     94     /* Initialize globals */
     95 
     96     DtInitialize ();
     97 
     98     /* Preprocessor */
     99 
    100     if (AslGbl_PreprocessFlag)
    101     {
    102         /* Preprocessor */
    103 
    104         Event = UtBeginEvent ("Preprocess input file");
    105         PrDoPreprocess ();
    106         UtEndEvent (Event);
    107 
    108         if (AslGbl_PreprocessOnly)
    109         {
    110             return (AE_OK);
    111         }
    112     }
    113 
    114     /* Compile the parse tree */
    115 
    116     if (AslGbl_DtLexBisonPrototype)
    117     {
    118         Event = UtBeginEvent ("Parse data table in prototype mode");
    119 
    120         DtCompilerInitLexer (AslGbl_Files[ASL_FILE_INPUT].Handle);
    121         DtCompilerParserparse ();
    122         FieldList = AslGbl_FieldList;
    123         DtCompilerTerminateLexer ();
    124 
    125         UtEndEvent (Event);
    126     }
    127     else
    128     {
    129         /*
    130          * Scan the input file (file is already open) and
    131          * build the parse tree
    132          */
    133         Event = UtBeginEvent ("Scan and parse input file");
    134         FieldList = DtScanFile (AslGbl_Files[ASL_FILE_INPUT].Handle);
    135         UtEndEvent (Event);
    136     }
    137 
    138     /* Did the parse tree get successfully constructed? */
    139 
    140     if (!FieldList)
    141     {
    142         /* TBD: temporary error message. Msgs should come from function above */
    143 
    144         DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
    145             "Input file does not appear to be an ASL or data table source file");
    146 
    147         return (AE_ERROR);
    148     }
    149 
    150     Event = UtBeginEvent ("Compile parse tree");
    151 
    152     Status = DtCompileDataTable (&FieldList);
    153     UtEndEvent (Event);
    154 
    155     FileNode = FlGetCurrentFileNode ();
    156     if (!FileNode)
    157     {
    158         fprintf (stderr, "Summary for %s could not be generated",
    159             AslGbl_Files[ASL_FILE_INPUT].Filename);
    160     }
    161     else
    162     {
    163         FileNode->TotalLineCount = AslGbl_CurrentLineNumber;
    164         FileNode->OriginalInputFileSize = AslGbl_InputByteCount;
    165         DbgPrint (ASL_PARSE_OUTPUT, "Line count: %u input file size: %u\n",
    166                 FileNode->TotalLineCount, FileNode->OriginalInputFileSize);
    167     }
    168 
    169     if (ACPI_FAILURE (Status))
    170     {
    171         FileNode->ParserErrorDetected = TRUE;
    172 
    173         /* TBD: temporary error message. Msgs should come from function above */
    174 
    175         DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
    176             "Could not compile input file");
    177 
    178         return (Status);
    179     }
    180 
    181     /* Create/open the binary output file */
    182 
    183     AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
    184     Status = FlOpenAmlOutputFile (AslGbl_OutputFilenamePrefix);
    185     if (ACPI_FAILURE (Status))
    186     {
    187         return (Status);
    188     }
    189 
    190     /* Write the binary, then the optional hex file */
    191 
    192     DtOutputBinary (AslGbl_RootTable);
    193     HxDoHexOutput ();
    194     DtWriteTableToListing ();
    195 
    196     /* Save the compile time statistics to the current file node */
    197 
    198     if (FileNode)
    199     {
    200         FileNode->TotalFields = AslGbl_InputFieldCount;
    201         FileNode->OutputByteLength = AslGbl_TableLength;
    202     }
    203 
    204     return (Status);
    205 }
    206 
    207 
    208 /******************************************************************************
    209  *
    210  * FUNCTION:    DtInitialize
    211  *
    212  * PARAMETERS:  None
    213  *
    214  * RETURN:      Status
    215  *
    216  * DESCRIPTION: Initialize data table compiler globals. Enables multiple
    217  *              compiles per invocation.
    218  *
    219  *****************************************************************************/
    220 
    221 void
    222 DtInitialize (
    223     void)
    224 {
    225 
    226 
    227     AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */
    228 
    229     AslGbl_FieldList = NULL;
    230     AslGbl_RootTable = NULL;
    231     AslGbl_SubtableStack = NULL;
    232 
    233     sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
    234     return;
    235 }
    236 
    237 
    238 /******************************************************************************
    239  *
    240  * FUNCTION:    DtInsertCompilerIds
    241  *
    242  * PARAMETERS:  FieldList           - Current field list pointer
    243  *
    244  * RETURN:      None
    245  *
    246  * DESCRIPTION: Insert the IDs (Name, Version) of the current compiler into
    247  *              the original ACPI table header.
    248  *
    249  *****************************************************************************/
    250 
    251 static void
    252 DtInsertCompilerIds (
    253     DT_FIELD                *FieldList)
    254 {
    255     DT_FIELD                *Next;
    256     UINT32                  i;
    257 
    258 
    259     /*
    260      * Don't insert current compiler ID if requested. Used for compiler
    261      * debug/validation only.
    262      */
    263     if (AslGbl_UseOriginalCompilerId)
    264     {
    265         return;
    266     }
    267 
    268     /* Walk to the Compiler fields at the end of the header */
    269 
    270     Next = FieldList;
    271     for (i = 0; i < 7; i++)
    272     {
    273         Next = Next->Next;
    274     }
    275 
    276     Next->Value = ASL_CREATOR_ID;
    277     Next->Flags = DT_FIELD_NOT_ALLOCATED;
    278 
    279     Next = Next->Next;
    280     Next->Value = VersionString;
    281     Next->Flags = DT_FIELD_NOT_ALLOCATED;
    282 }
    283 
    284 
    285 /******************************************************************************
    286  *
    287  * FUNCTION:    DtCompileDataTable
    288  *
    289  * PARAMETERS:  FieldList           - Current field list pointer
    290  *
    291  * RETURN:      Status
    292  *
    293  * DESCRIPTION: Entry point to compile one data table
    294  *
    295  *****************************************************************************/
    296 
    297 static ACPI_STATUS
    298 DtCompileDataTable (
    299     DT_FIELD                **FieldList)
    300 {
    301     const ACPI_DMTABLE_DATA *TableData;
    302     DT_SUBTABLE             *Subtable;
    303     char                    *Signature;
    304     ACPI_TABLE_HEADER       *AcpiTableHeader;
    305     ACPI_STATUS             Status;
    306     DT_FIELD                *RootField = *FieldList;
    307 
    308 
    309     /* Verify that we at least have a table signature and save it */
    310 
    311     Signature = DtGetFieldValue (*FieldList);
    312     if (!Signature)
    313     {
    314         sprintf (AslGbl_MsgBuffer, "Expected \"%s\"", "Signature");
    315         DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
    316             *FieldList, AslGbl_MsgBuffer);
    317         return (AE_ERROR);
    318     }
    319 
    320     AslGbl_Signature = UtLocalCacheCalloc (strlen (Signature) + 1);
    321     strcpy (AslGbl_Signature, Signature);
    322 
    323     /*
    324      * Handle tables that don't use the common ACPI table header structure.
    325      * Currently, these are the FACS and RSDP. Also check for an OEMx table,
    326      * these tables have user-defined contents.
    327      */
    328     if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_FACS))
    329     {
    330         Status = DtCompileFacs (FieldList);
    331         if (ACPI_FAILURE (Status))
    332         {
    333             return (Status);
    334         }
    335 
    336         DtSetTableLength ();
    337         return (Status);
    338     }
    339     else if (ACPI_VALIDATE_RSDP_SIG (Signature))
    340     {
    341         Status = DtCompileRsdp (FieldList);
    342         return (Status);
    343     }
    344     else if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_S3PT))
    345     {
    346         Status = DtCompileS3pt (FieldList);
    347         if (ACPI_FAILURE (Status))
    348         {
    349             return (Status);
    350         }
    351 
    352         DtSetTableLength ();
    353         return (Status);
    354     }
    355 
    356     /*
    357      * All other tables must use the common ACPI table header. Insert the
    358      * current iASL IDs (name, version), and compile the header now.
    359      */
    360     DtInsertCompilerIds (*FieldList);
    361 
    362     Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader,
    363         &AslGbl_RootTable);
    364     if (ACPI_FAILURE (Status))
    365     {
    366         return (Status);
    367     }
    368 
    369     DtPushSubtable (AslGbl_RootTable);
    370 
    371     /* Validate the signature via the ACPI table list */
    372 
    373     TableData = AcpiDmGetTableData (Signature);
    374     if (!TableData || AslGbl_CompileGeneric)
    375     {
    376         /* Unknown table signature and/or force generic compile */
    377 
    378         DtCompileGeneric ((void **) FieldList, NULL, NULL);
    379         goto FinishHeader;
    380     }
    381 
    382     /* Dispatch to per-table compile */
    383 
    384     if (TableData->CmTableHandler)
    385     {
    386         /* Complex table, has a handler */
    387 
    388         Status = TableData->CmTableHandler ((void **) FieldList);
    389         if (ACPI_FAILURE (Status))
    390         {
    391             return (Status);
    392         }
    393     }
    394     else if (TableData->TableInfo)
    395     {
    396         /* Simple table, just walk the info table, unless its empty */
    397 
    398         if (FieldList && *FieldList)
    399         {
    400             Subtable = NULL;
    401             Status = DtCompileTable (FieldList, TableData->TableInfo,
    402                 &Subtable);
    403             if (ACPI_FAILURE (Status))
    404             {
    405                 return (Status);
    406             }
    407 
    408             DtInsertSubtable (AslGbl_RootTable, Subtable);
    409             DtPopSubtable ();
    410         }
    411     }
    412     else
    413     {
    414         DtFatal (ASL_MSG_COMPILER_INTERNAL, *FieldList,
    415             "Missing table dispatch info");
    416         return (AE_ERROR);
    417     }
    418 
    419 FinishHeader:
    420 
    421     /* Set the final table length and then the checksum */
    422 
    423     DtSetTableLength ();
    424     AcpiTableHeader = ACPI_CAST_PTR (
    425         ACPI_TABLE_HEADER, AslGbl_RootTable->Buffer);
    426     DtSetTableChecksum (&AcpiTableHeader->Checksum);
    427 
    428     DtDumpFieldList (RootField);
    429     DtDumpSubtableList ();
    430     return (AE_OK);
    431 }
    432 
    433 
    434 /******************************************************************************
    435  *
    436  * FUNCTION:    DtCompileTable
    437  *
    438  * PARAMETERS:  Field               - Current field list pointer
    439  *              Info                - Info table for this ACPI table
    440  *              RetSubtable         - Compile result of table
    441  *
    442  * RETURN:      Status
    443  *
    444  * DESCRIPTION: Compile a subtable
    445  *
    446  *****************************************************************************/
    447 
    448 ACPI_STATUS
    449 DtCompileTable (
    450     DT_FIELD                **Field,
    451     ACPI_DMTABLE_INFO       *Info,
    452     DT_SUBTABLE             **RetSubtable)
    453 {
    454     DT_FIELD                *LocalField;
    455     UINT32                  Length;
    456     DT_SUBTABLE             *Subtable;
    457     DT_SUBTABLE             *InlineSubtable = NULL;
    458     UINT32                  FieldLength = 0;
    459     UINT8                   FieldType;
    460     UINT8                   *Buffer;
    461     UINT8                   *FlagBuffer = NULL;
    462     char                    *String;
    463     UINT32                  CurrentFlagByteOffset = 0;
    464     ACPI_STATUS             Status = AE_OK;
    465 
    466 
    467     if (!Field)
    468     {
    469         return (AE_BAD_PARAMETER);
    470     }
    471     if (!*Field)
    472     {
    473         /*
    474          * The field list is empty, this means that we are out of fields to
    475          * parse. In other words, we are at the end of the table.
    476          */
    477         return (AE_END_OF_TABLE);
    478     }
    479 
    480     /* Ignore optional subtable if name does not match */
    481 
    482     if ((Info->Flags & DT_OPTIONAL) &&
    483         strcmp ((*Field)->Name, Info->Name))
    484     {
    485         *RetSubtable = NULL;
    486         return (AE_OK);
    487     }
    488 
    489     Length = DtGetSubtableLength (*Field, Info);
    490     if (Length == ASL_EOF)
    491     {
    492         return (AE_ERROR);
    493     }
    494 
    495     Subtable = UtSubtableCacheCalloc ();
    496 
    497     if (Length > 0)
    498     {
    499         String = UtLocalCacheCalloc (Length);
    500         Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
    501     }
    502 
    503     Subtable->Length = Length;
    504     Subtable->TotalLength = Length;
    505     Buffer = Subtable->Buffer;
    506 
    507     LocalField = *Field;
    508     Subtable->Name = LocalField->Name;
    509 
    510     /*
    511      * Main loop walks the info table for this ACPI table or subtable
    512      */
    513     for (; Info->Name; Info++)
    514     {
    515         if (Info->Opcode == ACPI_DMT_EXTRA_TEXT)
    516         {
    517             continue;
    518         }
    519 
    520         if (!LocalField)
    521         {
    522             sprintf (AslGbl_MsgBuffer, "Found NULL field - Field name \"%s\" needed",
    523                 Info->Name);
    524             DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer);
    525             Status = AE_BAD_DATA;
    526             goto Error;
    527         }
    528 
    529         /* Maintain table offsets */
    530 
    531         LocalField->TableOffset = AslGbl_CurrentTableOffset;
    532         FieldLength = DtGetFieldLength (LocalField, Info);
    533         AslGbl_CurrentTableOffset += FieldLength;
    534 
    535         FieldType = DtGetFieldType (Info);
    536         AslGbl_InputFieldCount++;
    537 
    538         switch (FieldType)
    539         {
    540         case DT_FIELD_TYPE_FLAGS_INTEGER:
    541             /*
    542              * Start of the definition of a flags field.
    543              * This master flags integer starts at value zero, in preparation
    544              * to compile and insert the flag fields from the individual bits
    545              */
    546             LocalField = LocalField->Next;
    547             *Field = LocalField;
    548 
    549             FlagBuffer = Buffer;
    550             CurrentFlagByteOffset = Info->Offset;
    551             break;
    552 
    553         case DT_FIELD_TYPE_FLAG:
    554 
    555             /* Individual Flag field, can be multiple bits */
    556 
    557             if (FlagBuffer)
    558             {
    559                 /*
    560                  * We must increment the FlagBuffer when we have crossed
    561                  * into the next flags byte within the flags field
    562                  * of type DT_FIELD_TYPE_FLAGS_INTEGER.
    563                  */
    564                 FlagBuffer += (Info->Offset - CurrentFlagByteOffset);
    565                 CurrentFlagByteOffset = Info->Offset;
    566 
    567                 DtCompileFlag (FlagBuffer, LocalField, Info);
    568             }
    569             else
    570             {
    571                 /* TBD - this is an internal error */
    572             }
    573 
    574             LocalField = LocalField->Next;
    575             *Field = LocalField;
    576             break;
    577 
    578         case DT_FIELD_TYPE_INLINE_SUBTABLE:
    579             /*
    580              * Recursion (one level max): compile GAS (Generic Address)
    581              * or Notify in-line subtable
    582              */
    583             *Field = LocalField;
    584 
    585             switch (Info->Opcode)
    586             {
    587             case ACPI_DMT_GAS:
    588 
    589                 Status = DtCompileTable (Field, AcpiDmTableInfoGas,
    590                     &InlineSubtable);
    591                 break;
    592 
    593             case ACPI_DMT_HESTNTFY:
    594 
    595                 Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify,
    596                     &InlineSubtable);
    597                 break;
    598 
    599             case ACPI_DMT_IORTMEM:
    600 
    601                 Status = DtCompileTable (Field, AcpiDmTableInfoIortAcc,
    602                     &InlineSubtable);
    603                 break;
    604 
    605             default:
    606                 sprintf (AslGbl_MsgBuffer, "Invalid DMT opcode: 0x%.2X",
    607                     Info->Opcode);
    608                 DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, AslGbl_MsgBuffer);
    609                 Status = AE_BAD_DATA;
    610                 break;
    611             }
    612 
    613             if (ACPI_FAILURE (Status))
    614             {
    615                 goto Error;
    616             }
    617 
    618             DtSetSubtableLength (InlineSubtable);
    619 
    620             memcpy (Buffer, InlineSubtable->Buffer, FieldLength);
    621             LocalField = *Field;
    622             break;
    623 
    624         case DT_FIELD_TYPE_LABEL:
    625 
    626             DtWriteFieldToListing (Buffer, LocalField, 0);
    627             LocalField = LocalField->Next;
    628             break;
    629 
    630         default:
    631 
    632             /* Normal case for most field types (Integer, String, etc.) */
    633 
    634             DtCompileOneField (Buffer, LocalField,
    635                 FieldLength, FieldType, Info->Flags);
    636 
    637             DtWriteFieldToListing (Buffer, LocalField, FieldLength);
    638             LocalField = LocalField->Next;
    639 
    640             if (Info->Flags & DT_LENGTH)
    641             {
    642                 /* Field is an Integer that will contain a subtable length */
    643 
    644                 Subtable->LengthField = Buffer;
    645                 Subtable->SizeOfLengthField = FieldLength;
    646             }
    647             break;
    648         }
    649 
    650         Buffer += FieldLength;
    651     }
    652 
    653     *Field = LocalField;
    654     *RetSubtable = Subtable;
    655     return (AE_OK);
    656 
    657 Error:
    658     ACPI_FREE (Subtable->Buffer);
    659     ACPI_FREE (Subtable);
    660     return (Status);
    661 }
    662 
    663 
    664 /******************************************************************************
    665  *
    666  * FUNCTION:    DtCompileTwoSubtables
    667  *
    668  * PARAMETERS:  List                - Current field list pointer
    669  *              TableInfo1          - Info table 1
    670  *              TableInfo1          - Info table 2
    671  *
    672  * RETURN:      Status
    673  *
    674  * DESCRIPTION: Compile tables with a header and one or more same subtables.
    675  *              Include CPEP, EINJ, ERST, MCFG, MSCT, WDAT
    676  *
    677  *****************************************************************************/
    678 
    679 ACPI_STATUS
    680 DtCompileTwoSubtables (
    681     void                    **List,
    682     ACPI_DMTABLE_INFO       *TableInfo1,
    683     ACPI_DMTABLE_INFO       *TableInfo2)
    684 {
    685     ACPI_STATUS             Status;
    686     DT_SUBTABLE             *Subtable;
    687     DT_SUBTABLE             *ParentTable;
    688     DT_FIELD                **PFieldList = (DT_FIELD **) List;
    689 
    690 
    691     Status = DtCompileTable (PFieldList, TableInfo1, &Subtable);
    692     if (ACPI_FAILURE (Status))
    693     {
    694         return (Status);
    695     }
    696 
    697     ParentTable = DtPeekSubtable ();
    698     DtInsertSubtable (ParentTable, Subtable);
    699 
    700     while (*PFieldList)
    701     {
    702         Status = DtCompileTable (PFieldList, TableInfo2, &Subtable);
    703         if (ACPI_FAILURE (Status))
    704         {
    705             return (Status);
    706         }
    707 
    708         DtInsertSubtable (ParentTable, Subtable);
    709     }
    710 
    711     return (AE_OK);
    712 }
    713 
    714 
    715 /******************************************************************************
    716  *
    717  * FUNCTION:    DtCompilePadding
    718  *
    719  * PARAMETERS:  Length              - Padding field size
    720  *              RetSubtable         - Compile result of table
    721  *
    722  * RETURN:      Status
    723  *
    724  * DESCRIPTION: Compile a subtable for padding purpose
    725  *
    726  *****************************************************************************/
    727 
    728 ACPI_STATUS
    729 DtCompilePadding (
    730     UINT32                  Length,
    731     DT_SUBTABLE             **RetSubtable)
    732 {
    733     DT_SUBTABLE             *Subtable;
    734     /* UINT8                   *Buffer; */
    735     char                    *String;
    736 
    737 
    738     Subtable = UtSubtableCacheCalloc ();
    739 
    740     if (Length > 0)
    741     {
    742         String = UtLocalCacheCalloc (Length);
    743         Subtable->Buffer = ACPI_CAST_PTR (UINT8, String);
    744     }
    745 
    746     Subtable->Length = Length;
    747     Subtable->TotalLength = Length;
    748     /* Buffer = Subtable->Buffer; */
    749 
    750     *RetSubtable = Subtable;
    751     return (AE_OK);
    752 }
    753