dtcompile.c revision 218590
165557Sjasone/******************************************************************************
265557Sjasone *
365557Sjasone * Module Name: dtcompile.c - Front-end for data table compiler
465557Sjasone *
565557Sjasone *****************************************************************************/
665557Sjasone
765557Sjasone/*
865557Sjasone * Copyright (C) 2000 - 2011, Intel Corp.
965557Sjasone * All rights reserved.
1065557Sjasone *
1165557Sjasone * Redistribution and use in source and binary forms, with or without
1265557Sjasone * modification, are permitted provided that the following conditions
1365557Sjasone * are met:
1465557Sjasone * 1. Redistributions of source code must retain the above copyright
1565557Sjasone *    notice, this list of conditions, and the following disclaimer,
1665557Sjasone *    without modification.
1765557Sjasone * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1865557Sjasone *    substantially similar to the "NO WARRANTY" disclaimer below
1965557Sjasone *    ("Disclaimer") and any redistribution must be conditioned upon
2065557Sjasone *    including a substantially similar Disclaimer requirement for further
2165557Sjasone *    binary redistribution.
2265557Sjasone * 3. Neither the names of the above-listed copyright holders nor the names
2365557Sjasone *    of any contributors may be used to endorse or promote products derived
2465557Sjasone *    from this software without specific prior written permission.
2565557Sjasone *
2665557Sjasone * Alternatively, this software may be distributed under the terms of the
2765557Sjasone * GNU General Public License ("GPL") version 2 as published by the Free
2865557Sjasone * Software Foundation.
2967352Sjhb *
3065557Sjasone * NO WARRANTY
3165557Sjasone * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3265557Sjasone * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3374912Sjhb * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3474912Sjhb * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3574912Sjhb * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3672200Sbmilekic * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3772200Sbmilekic * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3872200Sbmilekic * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3965557Sjasone * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4065557Sjasone * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4165557Sjasone * POSSIBILITY OF SUCH DAMAGES.
4265557Sjasone */
4365557Sjasone
4465557Sjasone#define __DTCOMPILE_C__
4565557Sjasone#define _DECLARE_DT_GLOBALS
4665557Sjasone
4765557Sjasone#include <contrib/dev/acpica/compiler/aslcompiler.h>
4865557Sjasone#include <contrib/dev/acpica/compiler/dtcompiler.h>
4965557Sjasone
5065557Sjasone#define _COMPONENT          DT_COMPILER
5165557Sjasone        ACPI_MODULE_NAME    ("dtcompile")
5265557Sjasone
5365557Sjasonestatic char                 VersionString[9];
5465557Sjasone
5565557Sjasone
5665557Sjasone/* Local prototypes */
5765557Sjasone
58111881Sjhbstatic ACPI_STATUS
59111881SjhbDtInitialize (
60111881Sjhb    void);
61111881Sjhb
62111881Sjhbstatic ACPI_STATUS
63111881SjhbDtCompileDataTable (
64111881Sjhb    DT_FIELD                **Field);
65111881Sjhb
66111881Sjhbstatic void
67111881SjhbDtInsertCompilerIds (
68111881Sjhb    DT_FIELD                *FieldList);
69111881Sjhb
70111881Sjhb
71111881Sjhb/******************************************************************************
72111881Sjhb *
73111881Sjhb * FUNCTION:    DtDoCompile
74111881Sjhb *
75111881Sjhb * PARAMETERS:  None
76111881Sjhb *
77111881Sjhb * RETURN:      Status
78111881Sjhb *
79111881Sjhb * DESCRIPTION: Main entry point for the data table compiler.
80111881Sjhb *
81111881Sjhb * Note: Assumes Gbl_Files[ASL_FILE_INPUT] is initialized and the file is
82111881Sjhb *          open at seek offset zero.
83111881Sjhb *
84116182Sobrien *****************************************************************************/
85116182Sobrien
86116182SobrienACPI_STATUS
8768790SjhbDtDoCompile (
8867676Sjhb    void)
8967676Sjhb{
9065557Sjasone    ACPI_STATUS             Status;
9167352Sjhb    UINT8                   Event;
92131930Smarcel    DT_FIELD                *FieldList;
9367352Sjhb
9474912Sjhb
9574912Sjhb    /* Initialize globals */
9667352Sjhb
9774912Sjhb    Status = DtInitialize ();
9865557Sjasone    if (ACPI_FAILURE (Status))
9967676Sjhb    {
10065557Sjasone        printf ("Error during compiler initialization, 0x%X\n", Status);
10165557Sjasone        return (Status);
10268790Sjhb    }
10368790Sjhb
104111881Sjhb    /*
105111881Sjhb     * Scan the input file (file is already open) and
106105508Sphk     * build the parse tree
107105508Sphk     */
108105508Sphk    Event = UtBeginEvent ("Scan and parse input file");
109139378Sjhb    FieldList = DtScanFile (Gbl_Files[ASL_FILE_INPUT].Handle);
11074912Sjhb    UtEndEvent (Event);
11165557Sjasone
11283798Sjhb    /* Did the parse tree get successfully constructed? */
11374912Sjhb
11474912Sjhb    if (!FieldList)
11567352Sjhb    {
11674912Sjhb        /* TBD: temporary error message. Msgs should come from function above */
11771352Sjasone
11874912Sjhb        DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
11971352Sjasone            "Input file does not appear to be an ASL or data table source file");
12074912Sjhb
12171352Sjasone        Status = AE_ERROR;
12274912Sjhb        goto CleanupAndExit;
12374912Sjhb    }
12474912Sjhb
12574912Sjhb    Event = UtBeginEvent ("Compile parse tree");
12674912Sjhb
12774912Sjhb    /*
12874912Sjhb     * Compile the parse tree
12974912Sjhb     */
13074912Sjhb    Status = DtCompileDataTable (&FieldList);
13174912Sjhb    UtEndEvent (Event);
13274912Sjhb
13374912Sjhb    DtFreeFieldList ();
13474912Sjhb
135112118Sjhb    if (ACPI_FAILURE (Status))
13674912Sjhb    {
13771352Sjasone        /* TBD: temporary error message. Msgs should come from function above */
13874912Sjhb
13974912Sjhb        DtError (ASL_ERROR, ASL_MSG_SYNTAX, NULL,
14074912Sjhb            "Could not compile input file");
14174912Sjhb
14274912Sjhb        goto CleanupAndExit;
14371352Sjasone    }
14474912Sjhb
14571352Sjasone    /* Create/open the binary output file */
146105508Sphk
14774912Sjhb    Gbl_Files[ASL_FILE_AML_OUTPUT].Filename = NULL;
14874912Sjhb    Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
14974912Sjhb    if (ACPI_FAILURE (Status))
15074912Sjhb    {
151105508Sphk        goto CleanupAndExit;
15271352Sjasone    }
15374912Sjhb
15474912Sjhb    /* Write the binary, then the optional hex file */
15574912Sjhb
15674912Sjhb    DtOutputBinary (Gbl_RootTable);
15771352Sjasone    LsDoHexOutput ();
158112117Sjhb    DtWriteTableToListing ();
159112117Sjhb
160112117SjhbCleanupAndExit:
161112117Sjhb
16274912Sjhb    CmCleanupAndExit ();
16374912Sjhb    return (Status);
164112117Sjhb}
165112117Sjhb
166112117Sjhb
16774912Sjhb/******************************************************************************
168112117Sjhb *
16974912Sjhb * FUNCTION:    DtInitialize
170112117Sjhb *
171112117Sjhb * PARAMETERS:  None
172112562Sjhb *
17374912Sjhb * RETURN:      Status
174112118Sjhb *
175112116Sjhb * DESCRIPTION: Initialize data table compiler globals. Enables multiple
17674912Sjhb *              compiles per invocation.
17774912Sjhb *
17874912Sjhb *****************************************************************************/
17974912Sjhb
18074912Sjhbstatic ACPI_STATUS
18174912SjhbDtInitialize (
18274912Sjhb    void)
18374912Sjhb{
18476272Sjhb    ACPI_STATUS             Status;
18576272Sjhb
186111881Sjhb
187112115Sjhb    Status = AcpiOsInitialize ();
188112061Sjhb    if (ACPI_FAILURE (Status))
189100011Smp    {
190100011Smp        return (Status);
191100011Smp    }
192100011Smp
19372200Sbmilekic    Status = AcpiUtInitGlobals ();
194134873Sjmg    if (ACPI_FAILURE (Status))
19572200Sbmilekic    {
196112562Sjhb        return (Status);
197112562Sjhb    }
198112562Sjhb
199112562Sjhb    Gbl_FieldList = NULL;
200112562Sjhb    Gbl_RootTable = NULL;
201112562Sjhb    Gbl_SubtableStack = NULL;
202112562Sjhb
203112562Sjhb    sprintf (VersionString, "%X", (UINT32) ACPI_CA_VERSION);
204112562Sjhb    return (AE_OK);
20577843Speter}
206134873Sjmg
207134873Sjmg
208112562Sjhb/******************************************************************************
20971352Sjasone *
210131930Smarcel * FUNCTION:    DtInsertCompilerIds
21172200Sbmilekic *
212131930Smarcel * PARAMETERS:  FieldList           - Current field list pointer
213131930Smarcel *
21465557Sjasone * RETURN:      None
21565557Sjasone *
21665557Sjasone * DESCRIPTION: Insert the IDs (Name, Version) of the current compiler into
217131930Smarcel *              the original ACPI table header.
218131930Smarcel *
21967676Sjhb *****************************************************************************/
220131930Smarcel
22165557Sjasonestatic void
222134873SjmgDtInsertCompilerIds (
223134873Sjmg    DT_FIELD                *FieldList)
224110779Speter{
225110779Speter    DT_FIELD                *Next;
226131930Smarcel    UINT32                  i;
227110779Speter
228110779Speter
229110779Speter    /*
230110779Speter     * Don't insert current compiler ID if requested. Used for compiler
231110779Speter     * debug/validation only.
232134873Sjmg     */
233134873Sjmg    if (Gbl_UseOriginalCompilerId)
234131930Smarcel    {
23565557Sjasone        return;
23667676Sjhb    }
23777843Speter
23867676Sjhb    /* Walk to the Compiler fields at the end of the header */
23977843Speter
24065557Sjasone    Next = FieldList;
241134873Sjmg    for (i = 0; i < 7; i++)
242134873Sjmg    {
243134873Sjmg        Next = Next->Next;
24465557Sjasone    }
24574912Sjhb
24674912Sjhb    Next->Value = ASL_CREATOR_ID;
24774912Sjhb    Next->Flags = DT_FIELD_NOT_ALLOCATED;
24874912Sjhb
24974912Sjhb    Next = Next->Next;
25074912Sjhb    Next->Value = VersionString;
25174912Sjhb    Next->Flags = DT_FIELD_NOT_ALLOCATED;
25265557Sjasone}
25374912Sjhb
25474912Sjhb
25574912Sjhb/******************************************************************************
25665557Sjasone *
25774912Sjhb * FUNCTION:    DtCompileDataTable
25874912Sjhb *
25974912Sjhb * PARAMETERS:  FieldList           - Current field list pointer
260111951Sjhb *
261108184Skris * RETURN:      Status
262108184Skris *
26396122Salfred * DESCRIPTION: Entry point to compile one data table
26491140Stanimura *
26574912Sjhb *****************************************************************************/
26691140Stanimura
26774912Sjhbstatic ACPI_STATUS
26874912SjhbDtCompileDataTable (
269113275Smike    DT_FIELD                **FieldList)
27074912Sjhb{
27175464Sjhb    ACPI_DMTABLE_DATA       *TableData;
272130022Srwatson    DT_SUBTABLE             *Subtable;
273130022Srwatson    char                    *Signature;
274130022Srwatson    ACPI_TABLE_HEADER       *AcpiTableHeader;
275130022Srwatson    ACPI_STATUS             Status;
276130396Srwatson
277130396Srwatson
278130022Srwatson    /* Verify that we at least have a table signature and save it */
279130022Srwatson
280130022Srwatson    Signature = DtGetFieldValue (*FieldList, "Signature");
281130022Srwatson    if (!Signature)
282130022Srwatson    {
283130396Srwatson        sprintf (MsgBuffer, "Expected \"%s\"", "Signature");
284130022Srwatson        DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
285130022Srwatson            *FieldList, MsgBuffer);
286130022Srwatson        return (AE_ERROR);
287130022Srwatson    }
288130022Srwatson
289148896Srwatson    Gbl_Signature = UtLocalCalloc (ACPI_STRLEN (Signature) + 1);
290148682Srwatson    strcpy (Gbl_Signature, Signature);
291148896Srwatson
292148682Srwatson    /*
293148682Srwatson     * Handle tables that don't use the common ACPI table header structure.
294148682Srwatson     * Currently, these are the FACS and RSDP. Also check for an OEMx table,
295148682Srwatson     * these tables have user-defined contents.
296148682Srwatson     */
297130022Srwatson    if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_FACS))
298130396Srwatson    {
299130396Srwatson        Status = DtCompileFacs (FieldList);
300130396Srwatson        if (ACPI_FAILURE (Status))
301130031Sjhb        {
302130022Srwatson            return (Status);
303130022Srwatson        }
304130022Srwatson
305130022Srwatson        DtSetTableLength ();
306130022Srwatson        return (Status);
307130396Srwatson    }
308130022Srwatson    else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP))
309130022Srwatson    {
310130022Srwatson        Status = DtCompileRsdp (FieldList);
311130022Srwatson        return (Status);
312130022Srwatson    }
313130022Srwatson    else if (!ACPI_STRNCMP (Signature, "OEM", 3))
314130396Srwatson    {
315130022Srwatson        DtFatal (ASL_MSG_OEM_TABLE, *FieldList, Signature);
316130022Srwatson        return (AE_ERROR);
317130022Srwatson    }
318130022Srwatson
319130022Srwatson    /* Validate the signature via the ACPI table list */
320130022Srwatson
321130031Sjhb    TableData = AcpiDmGetTableData (Signature);
322130022Srwatson    if (!TableData)
323132639Srwatson    {
324132639Srwatson        DtFatal (ASL_MSG_UNKNOWN_TABLE, *FieldList, Signature);
325132639Srwatson        return (AE_ERROR);
326132639Srwatson    }
327132639Srwatson
328132639Srwatson    /*
329134971Srwatson     * All other tables must use the common ACPI table header. Insert the
330134971Srwatson     * current iASL IDs (name, version), and compile the header now.
331134971Srwatson     */
332134971Srwatson    DtInsertCompilerIds (*FieldList);
333134971Srwatson
334144832Spjd    Status = DtCompileTable (FieldList, AcpiDmTableInfoHeader,
335143335Srwatson                &Gbl_RootTable, TRUE);
336143335Srwatson    if (ACPI_FAILURE (Status))
337143335Srwatson    {
338143335Srwatson        return (Status);
339143335Srwatson    }
340134971Srwatson
341134971Srwatson    DtPushSubtable (Gbl_RootTable);
342144836Spjd
343144836Spjd    /* Dispatch to per-table compile */
344145425Sjeff
345145425Sjeff    if (TableData->CmTableHandler)
346145425Sjeff    {
347144836Spjd        /* Complex table, has a handler */
348144836Spjd
349144836Spjd        Status = TableData->CmTableHandler ((void **) FieldList);
35075464Sjhb        if (ACPI_FAILURE (Status))
35175464Sjhb        {
35284331Sjhb            return (Status);
35384331Sjhb        }
35472224Sjhb    }
35574912Sjhb    else if (TableData->TableInfo)
35672224Sjhb    {
35774912Sjhb        /* Simple table, just walk the info table */
35872224Sjhb
359124972Sru        Subtable = NULL;
360103091Sjake        Status = DtCompileTable (FieldList, TableData->TableInfo,
361109015Sjake                    &Subtable, TRUE);
36274912Sjhb        if (ACPI_FAILURE (Status))
36374912Sjhb        {
364119813Ssam            return (Status);
365122001Sjhb        }
36674912Sjhb
367126324Sjhb        DtInsertSubtable (Gbl_RootTable, Subtable);
36874912Sjhb        DtPopSubtable ();
369122514Sjhb    }
370122514Sjhb    else
37174912Sjhb    {
372136374Srwatson        DtFatal (ASL_MSG_COMPILER_INTERNAL, *FieldList,
37365557Sjasone            "Missing table dispatch info");
37465557Sjasone        return (AE_ERROR);
37565557Sjasone    }
37690278Sjhb
37799416Salc    /* Set the final table length and then the checksum */
37888322Sjhb
37972224Sjhb    DtSetTableLength ();
38074912Sjhb    AcpiTableHeader = ACPI_CAST_PTR (
381122849Speter        ACPI_TABLE_HEADER, Gbl_RootTable->Buffer);
38299862Speter    DtSetTableChecksum (&AcpiTableHeader->Checksum);
383112993Speter
384108187Sjake    return (AE_OK);
385108187Sjake}
386146982Smarius
38799862Speter
388108187Sjake/******************************************************************************
38978785Sjhb *
39095473Sdes * FUNCTION:    DtCompileTable
391111028Sjeff *
392103786Sjeff * PARAMETERS:  Field               - Current field list pointer
393104951Speter *              Info                - Info table for this ACPI table
394104951Speter *              RetSubtable         - Compile result of table
395104951Speter *              Required            - If this subtable must exist
396115425Speter *
397111068Speter * RETURN:      Status
398143204Swpaul *
399111068Speter * DESCRIPTION: Compile a subtable
400144966Svkashyap *
401144966Svkashyap *****************************************************************************/
402144966Svkashyap
403144966SvkashyapACPI_STATUS
404144966SvkashyapDtCompileTable (
40574912Sjhb    DT_FIELD                **Field,
40674912Sjhb    ACPI_DMTABLE_INFO       *Info,
40765557Sjasone    DT_SUBTABLE             **RetSubtable,
40865557Sjasone    BOOLEAN                 Required)
409105508Sphk{
41065557Sjasone    DT_FIELD                *LocalField;
41165557Sjasone    UINT32                  Length;
41265557Sjasone    DT_SUBTABLE             *Subtable;
41365557Sjasone    DT_SUBTABLE             *InlineSubtable;
41465856Sjhb    UINT32                  FieldLength = 0;
41565557Sjasone    UINT8                   FieldType;
41672200Sbmilekic    UINT8                   *Buffer;
41772200Sbmilekic    UINT8                   *FlagBuffer = NULL;
418105508Sphk    ACPI_STATUS             Status;
41965557Sjasone
42074912Sjhb
42174912Sjhb    if (!Field || !*Field)
42274912Sjhb    {
42397963Sjhb        return (AE_BAD_PARAMETER);
42474912Sjhb    }
42574912Sjhb
42674912Sjhb    Length = DtGetSubtableLength (*Field, Info);
42774912Sjhb    Subtable = UtLocalCalloc (sizeof (DT_SUBTABLE));
42893811Sjhb
42974912Sjhb    if (Length > 0)
43097963Sjhb    {
43174912Sjhb        Subtable->Buffer = UtLocalCalloc (Length);
432122514Sjhb    }
43374912Sjhb    Subtable->Length = Length;
43474912Sjhb    Subtable->TotalLength = Length;
43574912Sjhb    Buffer = Subtable->Buffer;
43674912Sjhb
43774912Sjhb    LocalField = *Field;
43874912Sjhb
43974912Sjhb    /*
44074912Sjhb     * Main loop walks the info table for this ACPI table or subtable
44174912Sjhb     */
44274912Sjhb    for (; Info->Name; Info++)
44374912Sjhb    {
44474912Sjhb        if (!LocalField)
44574912Sjhb        {
44674912Sjhb            sprintf (MsgBuffer, "Found NULL field - Field name \"%s\" needed",
44774912Sjhb                Info->Name);
44874912Sjhb            DtFatal (ASL_MSG_COMPILER_INTERNAL, NULL, MsgBuffer);
44971352Sjasone            Status = AE_BAD_DATA;
45074912Sjhb            goto Error;
45165557Sjasone        }
45274912Sjhb
45374912Sjhb        /* Does input field name match what is expected? */
45474912Sjhb
45574912Sjhb        if (ACPI_STRCMP (LocalField->Name, Info->Name))
45665557Sjasone        {
45774912Sjhb            /*
45874912Sjhb             * If Required = TRUE, the subtable must exist.
45974912Sjhb             * If Required = FALSE, the subtable is optional
46074912Sjhb             * (For example, AcpiDmTableInfoDmarScope in DMAR table is
46174912Sjhb             * optional)
46274912Sjhb             */
46374912Sjhb            if (Required)
46487593Sobrien            {
46597963Sjhb                sprintf (MsgBuffer, "Expected \"%s\"", Info->Name);
46693811Sjhb                DtNameError (ASL_ERROR, ASL_MSG_INVALID_FIELD_NAME,
46793811Sjhb                    LocalField, MsgBuffer);
46874912Sjhb            }
46974912Sjhb            else
47074912Sjhb            {
47174912Sjhb                Status = AE_NOT_FOUND;
47274912Sjhb                goto Error;
47374912Sjhb            }
47474912Sjhb        }
47574912Sjhb
47674912Sjhb        /* Maintain table offsets */
47774912Sjhb
47875569Sjhb        LocalField->TableOffset = Gbl_CurrentTableOffset;
47975569Sjhb        FieldLength = DtGetFieldLength (LocalField, Info);
48074912Sjhb        Gbl_CurrentTableOffset += FieldLength;
48174912Sjhb
48274912Sjhb        FieldType = DtGetFieldType (Info);
48375569Sjhb        Gbl_InputFieldCount++;
48475569Sjhb
48574912Sjhb        switch (FieldType)
486112117Sjhb        {
487112117Sjhb        case DT_FIELD_TYPE_FLAGS_INTEGER:
48874912Sjhb            /*
48965557Sjasone             * Start of the definition of a flags field.
49065557Sjasone             * This master flags integer starts at value zero, in preparation
49165557Sjasone             * to compile and insert the flag fields from the individual bits
49274912Sjhb             */
49374912Sjhb            LocalField = LocalField->Next;
49497963Sjhb            *Field = LocalField;
49574912Sjhb
49693811Sjhb            FlagBuffer = Buffer;
49774912Sjhb            break;
49874912Sjhb
49974912Sjhb        case DT_FIELD_TYPE_FLAG:
50074912Sjhb
50174912Sjhb            /* Individual Flag field, can be multiple bits */
50274912Sjhb
50374912Sjhb            if (FlagBuffer)
50474912Sjhb            {
50574912Sjhb                DtCompileFlag (FlagBuffer, LocalField, Info);
50674912Sjhb            }
50765557Sjasone            else
50874912Sjhb            {
50965557Sjasone                /* TBD - this is an internal error */
510112562Sjhb            }
511112562Sjhb
512112562Sjhb            LocalField = LocalField->Next;
513112562Sjhb            *Field = LocalField;
514112562Sjhb            break;
515112562Sjhb
516112562Sjhb        case DT_FIELD_TYPE_INLINE_SUBTABLE:
517112562Sjhb            /*
518112562Sjhb             * Recursion (one level max): compile GAS (Generic Address)
519112562Sjhb             * or Notify in-line subtable
520112562Sjhb             */
521112562Sjhb            LocalField = LocalField->Next;
522112562Sjhb            *Field = LocalField;
523112562Sjhb
524112562Sjhb            if (Info->Opcode == ACPI_DMT_GAS)
525112562Sjhb            {
526112562Sjhb                Status = DtCompileTable (Field, AcpiDmTableInfoGas,
527112562Sjhb                    &InlineSubtable, TRUE);
528112562Sjhb            }
529112562Sjhb            else
53074912Sjhb            {
53174912Sjhb                Status = DtCompileTable (Field, AcpiDmTableInfoHestNotify,
53274912Sjhb                    &InlineSubtable, TRUE);
53374912Sjhb            }
53474912Sjhb
53574912Sjhb            if (ACPI_FAILURE (Status))
53674912Sjhb            {
53782284Sjhb                goto Error;
53874912Sjhb            }
53974912Sjhb
54074912Sjhb            DtSetSubtableLength (InlineSubtable);
54182284Sjhb
54274912Sjhb            ACPI_MEMCPY (Buffer, InlineSubtable->Buffer, FieldLength);
54374912Sjhb            ACPI_FREE (InlineSubtable->Buffer);
54474912Sjhb            ACPI_FREE (InlineSubtable);
54582284Sjhb            LocalField = *Field;
54674912Sjhb            break;
54782244Sjhb
54882244Sjhb        case DT_FIELD_TYPE_LABEL:
54982284Sjhb
55082244Sjhb            DtWriteFieldToListing (Buffer, LocalField, 0);
55182244Sjhb            LocalField = LocalField->Next;
55274912Sjhb            break;
55397963Sjhb
55474912Sjhb        default:
55574912Sjhb
55674912Sjhb            /* Normal case for most field types (Integer, String, etc.) */
55774912Sjhb
55874912Sjhb            DtCompileOneField (Buffer, LocalField,
559112562Sjhb                FieldLength, FieldType, Info->Flags);
56074912Sjhb
56193811Sjhb            DtWriteFieldToListing (Buffer, LocalField, FieldLength);
56274912Sjhb            LocalField = LocalField->Next;
56374912Sjhb
56474912Sjhb            if (Info->Flags & DT_LENGTH)
56574912Sjhb            {
56674912Sjhb                /* Field is an Integer that will contain a subtable length */
56774912Sjhb
56874912Sjhb                Subtable->LengthField = Buffer;
56975362Sjhb                Subtable->SizeOfLengthField = FieldLength;
57074912Sjhb            }
57174912Sjhb
57274912Sjhb            break;
57374912Sjhb        }
57474912Sjhb
57582284Sjhb        Buffer += FieldLength;
57674912Sjhb    }
57774912Sjhb
57876272Sjhb    *Field = LocalField;
57975362Sjhb    *RetSubtable = Subtable;
58075362Sjhb    return (AE_OK);
58175362Sjhb
58297948SjhbError:
58375362Sjhb    ACPI_FREE (Subtable->Buffer);
584112117Sjhb    ACPI_FREE (Subtable);
585112117Sjhb    return (Status);
586112117Sjhb}
587112117Sjhb