1249109Sjkim/******************************************************************************
2249109Sjkim *
3249109Sjkim * Module Name: asloffset - Generate a C "offset table" for BIOS use.
4249109Sjkim *
5249109Sjkim *****************************************************************************/
6249109Sjkim
7249109Sjkim/*
8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp.
9249109Sjkim * All rights reserved.
10249109Sjkim *
11249109Sjkim * Redistribution and use in source and binary forms, with or without
12249109Sjkim * modification, are permitted provided that the following conditions
13249109Sjkim * are met:
14249109Sjkim * 1. Redistributions of source code must retain the above copyright
15249109Sjkim *    notice, this list of conditions, and the following disclaimer,
16249109Sjkim *    without modification.
17249109Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18249109Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19249109Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20249109Sjkim *    including a substantially similar Disclaimer requirement for further
21249109Sjkim *    binary redistribution.
22249109Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23249109Sjkim *    of any contributors may be used to endorse or promote products derived
24249109Sjkim *    from this software without specific prior written permission.
25249109Sjkim *
26249109Sjkim * Alternatively, this software may be distributed under the terms of the
27249109Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28249109Sjkim * Software Foundation.
29249109Sjkim *
30249109Sjkim * NO WARRANTY
31249109Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32249109Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33249109Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34249109Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35249109Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36249109Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37249109Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38249109Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39249109Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40249109Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41249109Sjkim * POSSIBILITY OF SUCH DAMAGES.
42249109Sjkim */
43249109Sjkim
44249112Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h>
45249109Sjkim#include "aslcompiler.y.h"
46249112Sjkim#include <contrib/dev/acpica/include/amlcode.h>
47249112Sjkim#include <contrib/dev/acpica/include/acnamesp.h>
48249109Sjkim
49249109Sjkim
50249109Sjkim#define _COMPONENT          ACPI_COMPILER
51249109Sjkim        ACPI_MODULE_NAME    ("asloffset")
52249109Sjkim
53249109Sjkim
54249109Sjkim/* Local prototypes */
55249109Sjkim
56249109Sjkimstatic void
57249109SjkimLsEmitOffsetTableEntry (
58249109Sjkim    UINT32                  FileId,
59249109Sjkim    ACPI_NAMESPACE_NODE     *Node,
60253690Sjkim    UINT32                  NamepathOffset,
61249109Sjkim    UINT32                  Offset,
62249109Sjkim    char                    *OpName,
63249109Sjkim    UINT64                  Value,
64253690Sjkim    UINT8                   AmlOpcode,
65253690Sjkim    UINT16                  ParentOpcode);
66249109Sjkim
67249109Sjkim
68249109Sjkim/*******************************************************************************
69249109Sjkim *
70249109Sjkim * FUNCTION:    LsAmlOffsetWalk
71249109Sjkim *
72249109Sjkim * PARAMETERS:  ASL_WALK_CALLBACK
73249109Sjkim *
74249109Sjkim * RETURN:      Status
75249109Sjkim *
76249109Sjkim * DESCRIPTION: Process one node during a offset table file generation.
77249109Sjkim *
78249109Sjkim * Three types of objects are currently emitted to the offset table:
79249109Sjkim *   1) Tagged (named) resource descriptors
80249109Sjkim *   2) Named integer objects with constant integer values
81250838Sjkim *   3) Named package objects
82250838Sjkim *   4) Operation Regions that have constant Offset (address) parameters
83250838Sjkim *   5) Control methods
84249109Sjkim *
85249109Sjkim * The offset table allows the BIOS to dynamically update the values of these
86249109Sjkim * objects at boot time.
87249109Sjkim *
88249109Sjkim ******************************************************************************/
89249109Sjkim
90249109SjkimACPI_STATUS
91249109SjkimLsAmlOffsetWalk (
92249109Sjkim    ACPI_PARSE_OBJECT       *Op,
93249109Sjkim    UINT32                  Level,
94249109Sjkim    void                    *Context)
95249109Sjkim{
96249109Sjkim    UINT32                  FileId = (UINT32) ACPI_TO_INTEGER (Context);
97249109Sjkim    ACPI_NAMESPACE_NODE     *Node;
98249109Sjkim    UINT32                  Length;
99253690Sjkim    UINT32                  NamepathOffset;
100253690Sjkim    UINT32                  DataOffset;
101250838Sjkim    ACPI_PARSE_OBJECT       *NextOp;
102249109Sjkim
103249109Sjkim
104249109Sjkim    /* Ignore actual data blocks for resource descriptors */
105249109Sjkim
106249109Sjkim    if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA)
107249109Sjkim    {
108249109Sjkim        return (AE_OK); /* Do NOT update the global AML offset */
109249109Sjkim    }
110249109Sjkim
111249109Sjkim    /* We are only interested in named objects (have a namespace node) */
112249109Sjkim
113249109Sjkim    Node = Op->Asl.Node;
114249109Sjkim    if (!Node)
115249109Sjkim    {
116249109Sjkim        Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength;
117249109Sjkim        return (AE_OK);
118249109Sjkim    }
119249109Sjkim
120249109Sjkim    /* Named resource descriptor (has a descriptor tag) */
121249109Sjkim
122249109Sjkim    if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE) &&
123249109Sjkim        (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC))
124249109Sjkim    {
125253690Sjkim        LsEmitOffsetTableEntry (FileId, Node, 0, Gbl_CurrentAmlOffset,
126253690Sjkim            Op->Asl.ParseOpName, 0, Op->Asl.Extra, AML_BUFFER_OP);
127253690Sjkim
128250838Sjkim        Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength;
129250838Sjkim        return (AE_OK);
130249109Sjkim    }
131249109Sjkim
132250838Sjkim    switch (Op->Asl.AmlOpcode)
133250838Sjkim    {
134250838Sjkim    case AML_NAME_OP:
135249109Sjkim
136250838Sjkim        /* Named object -- Name (NameString, DataRefObject) */
137250838Sjkim
138249109Sjkim        if (!Op->Asl.Child)
139249109Sjkim        {
140249109Sjkim            FlPrintFile (FileId, "%s NO CHILD!\n", MsgBuffer);
141249109Sjkim            return (AE_OK);
142249109Sjkim        }
143249109Sjkim
144249109Sjkim        Length = Op->Asl.FinalAmlLength;
145253690Sjkim        NamepathOffset = Gbl_CurrentAmlOffset + Length;
146249109Sjkim
147249109Sjkim        /* Get to the NameSeg/NamePath Op (and length of the name) */
148249109Sjkim
149249109Sjkim        Op = Op->Asl.Child;
150249109Sjkim
151253690Sjkim        /* Get offset of last nameseg and the actual data */
152253690Sjkim
153253690Sjkim        NamepathOffset = Gbl_CurrentAmlOffset + Length +
154253690Sjkim            (Op->Asl.FinalAmlLength - ACPI_NAME_SIZE);
155253690Sjkim
156253690Sjkim        DataOffset = Gbl_CurrentAmlOffset + Length +
157253690Sjkim            Op->Asl.FinalAmlLength;
158253690Sjkim
159249109Sjkim        /* Get actual value associated with the name */
160249109Sjkim
161249109Sjkim        Op = Op->Asl.Next;
162249109Sjkim        switch (Op->Asl.AmlOpcode)
163249109Sjkim        {
164249109Sjkim        case AML_BYTE_OP:
165249109Sjkim        case AML_WORD_OP:
166249109Sjkim        case AML_DWORD_OP:
167249109Sjkim        case AML_QWORD_OP:
168249109Sjkim
169250838Sjkim            /* The +1 is to handle the integer size prefix (opcode) */
170249109Sjkim
171253690Sjkim            LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, (DataOffset + 1),
172250838Sjkim                Op->Asl.ParseOpName, Op->Asl.Value.Integer,
173253690Sjkim                (UINT8) Op->Asl.AmlOpcode, AML_NAME_OP);
174249109Sjkim            break;
175249109Sjkim
176253690Sjkim        case AML_ONE_OP:
177253690Sjkim        case AML_ONES_OP:
178253690Sjkim        case AML_ZERO_OP:
179253690Sjkim
180253690Sjkim            /* For these, offset will point to the opcode */
181253690Sjkim
182253690Sjkim            LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, DataOffset,
183253690Sjkim                Op->Asl.ParseOpName, Op->Asl.Value.Integer,
184253690Sjkim                (UINT8) Op->Asl.AmlOpcode, AML_NAME_OP);
185253690Sjkim            break;
186253690Sjkim
187250838Sjkim        case AML_PACKAGE_OP:
188250838Sjkim        case AML_VAR_PACKAGE_OP:
189250838Sjkim
190253690Sjkim            /* Get the package element count */
191253690Sjkim
192250838Sjkim            NextOp = Op->Asl.Child;
193250838Sjkim
194253690Sjkim            LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, DataOffset,
195253690Sjkim                Op->Asl.ParseOpName, NextOp->Asl.Value.Integer,
196253690Sjkim                (UINT8) Op->Asl.AmlOpcode, AML_NAME_OP);
197249109Sjkim            break;
198250838Sjkim
199250838Sjkim         default:
200250838Sjkim             break;
201249109Sjkim        }
202249109Sjkim
203249109Sjkim        Gbl_CurrentAmlOffset += Length;
204249109Sjkim        return (AE_OK);
205249109Sjkim
206250838Sjkim    case AML_REGION_OP:
207249109Sjkim
208250838Sjkim        /* OperationRegion (NameString, RegionSpace, RegionOffset, RegionLength) */
209250838Sjkim
210249109Sjkim        Length = Op->Asl.FinalAmlLength;
211249109Sjkim
212249109Sjkim        /* Get the name/namepath node */
213249109Sjkim
214250838Sjkim        NextOp = Op->Asl.Child;
215249109Sjkim
216253690Sjkim        /* Get offset of last nameseg and the actual data */
217253690Sjkim
218253690Sjkim        NamepathOffset = Gbl_CurrentAmlOffset + Length +
219253690Sjkim            (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE);
220253690Sjkim
221253690Sjkim        DataOffset = Gbl_CurrentAmlOffset + Length +
222253690Sjkim            (NextOp->Asl.FinalAmlLength + 1);
223253690Sjkim
224249109Sjkim        /* Get the SpaceId node, then the Offset (address) node */
225249109Sjkim
226250838Sjkim        NextOp = NextOp->Asl.Next;
227250838Sjkim        NextOp = NextOp->Asl.Next;
228249109Sjkim
229250838Sjkim        switch (NextOp->Asl.AmlOpcode)
230249109Sjkim        {
231249109Sjkim        /*
232249109Sjkim         * We are only interested in integer constants that can be changed
233249109Sjkim         * at boot time. Note, the One/Ones/Zero opcodes are considered
234249109Sjkim         * non-changeable, so we ignore them here.
235249109Sjkim         */
236249109Sjkim        case AML_BYTE_OP:
237249109Sjkim        case AML_WORD_OP:
238249109Sjkim        case AML_DWORD_OP:
239249109Sjkim        case AML_QWORD_OP:
240249109Sjkim
241253690Sjkim            LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, (DataOffset + 1),
242250838Sjkim                Op->Asl.ParseOpName, NextOp->Asl.Value.Integer,
243253690Sjkim                (UINT8) NextOp->Asl.AmlOpcode, AML_REGION_OP);
244249109Sjkim
245249109Sjkim            Gbl_CurrentAmlOffset += Length;
246249109Sjkim            return (AE_OK);
247249109Sjkim
248249109Sjkim        default:
249249109Sjkim            break;
250249109Sjkim        }
251250838Sjkim        break;
252250838Sjkim
253250838Sjkim    case AML_METHOD_OP:
254250838Sjkim
255250838Sjkim        /* Method (Namepath, ...) */
256250838Sjkim
257250838Sjkim        Length = Op->Asl.FinalAmlLength;
258250838Sjkim
259250838Sjkim        /* Get the NameSeg/NamePath Op */
260250838Sjkim
261250838Sjkim        NextOp = Op->Asl.Child;
262250838Sjkim
263253690Sjkim        /* Get offset of last nameseg and the actual data (flags byte) */
264250838Sjkim
265253690Sjkim        NamepathOffset = Gbl_CurrentAmlOffset + Length +
266253690Sjkim            (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE);
267250838Sjkim
268253690Sjkim        DataOffset = Gbl_CurrentAmlOffset + Length +
269253690Sjkim            NextOp->Asl.FinalAmlLength;
270253690Sjkim
271253690Sjkim        /* Get the flags byte Op */
272253690Sjkim
273253690Sjkim        NextOp = NextOp->Asl.Next;
274253690Sjkim
275253690Sjkim        LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, DataOffset,
276253690Sjkim            Op->Asl.ParseOpName, NextOp->Asl.Value.Integer,
277253690Sjkim            (UINT8) Op->Asl.AmlOpcode, AML_METHOD_OP);
278250838Sjkim        break;
279250838Sjkim
280253690Sjkim    case AML_PROCESSOR_OP:
281253690Sjkim
282253690Sjkim        /* Processor (Namepath, ProcessorId, Address, Length) */
283253690Sjkim
284253690Sjkim        Length = Op->Asl.FinalAmlLength;
285253690Sjkim        NextOp = Op->Asl.Child;     /* Get Namepath */
286253690Sjkim
287253690Sjkim        /* Get offset of last nameseg and the actual data (PBlock address) */
288253690Sjkim
289253690Sjkim        NamepathOffset = Gbl_CurrentAmlOffset + Length +
290253690Sjkim            (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE);
291253690Sjkim
292253690Sjkim        DataOffset = Gbl_CurrentAmlOffset + Length +
293253690Sjkim            (NextOp->Asl.FinalAmlLength + 1);
294253690Sjkim
295253690Sjkim        NextOp = NextOp->Asl.Next;  /* Get ProcessorID (BYTE) */
296253690Sjkim        NextOp = NextOp->Asl.Next;  /* Get Address (DWORD) */
297253690Sjkim
298253690Sjkim        LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, DataOffset,
299253690Sjkim            Op->Asl.ParseOpName, NextOp->Asl.Value.Integer,
300253690Sjkim            (UINT8) AML_DWORD_OP, AML_PROCESSOR_OP);
301253690Sjkim        break;
302253690Sjkim
303253690Sjkim    case AML_DEVICE_OP:
304253690Sjkim    case AML_SCOPE_OP:
305253690Sjkim    case AML_THERMAL_ZONE_OP:
306253690Sjkim
307253690Sjkim        /* Device/Scope/ThermalZone (Namepath) */
308253690Sjkim
309253690Sjkim        Length = Op->Asl.FinalAmlLength;
310253690Sjkim        NextOp = Op->Asl.Child;     /* Get Namepath */
311253690Sjkim
312253690Sjkim        /* Get offset of last nameseg */
313253690Sjkim
314253690Sjkim        NamepathOffset = Gbl_CurrentAmlOffset + Length +
315253690Sjkim            (NextOp->Asl.FinalAmlLength - ACPI_NAME_SIZE);
316253690Sjkim
317253690Sjkim        LsEmitOffsetTableEntry (FileId, Node, NamepathOffset, 0,
318253690Sjkim            Op->Asl.ParseOpName, 0, (UINT8) 0, Op->Asl.AmlOpcode);
319253690Sjkim        break;
320253690Sjkim
321250838Sjkim    default:
322250838Sjkim        break;
323249109Sjkim    }
324249109Sjkim
325249109Sjkim    Gbl_CurrentAmlOffset += Op->Asl.FinalAmlLength;
326249109Sjkim    return (AE_OK);
327249109Sjkim}
328249109Sjkim
329249109Sjkim
330249109Sjkim/*******************************************************************************
331249109Sjkim *
332249109Sjkim * FUNCTION:    LsEmitOffsetTableEntry
333249109Sjkim *
334249109Sjkim * PARAMETERS:  FileId          - ID of current listing file
335249109Sjkim *              Node            - Namespace node associated with the name
336249109Sjkim *              Offset          - Offset of the value within the AML table
337249109Sjkim *              OpName          - Name of the AML opcode
338249109Sjkim *              Value           - Current value of the AML field
339249109Sjkim *              AmlOpcode       - Opcode associated with the field
340253690Sjkim *              ObjectType      - ACPI object type
341249109Sjkim *
342249109Sjkim * RETURN:      None
343249109Sjkim *
344249109Sjkim * DESCRIPTION: Emit a line of the offset table (-so option)
345249109Sjkim *
346249109Sjkim ******************************************************************************/
347249109Sjkim
348249109Sjkimstatic void
349249109SjkimLsEmitOffsetTableEntry (
350249109Sjkim    UINT32                  FileId,
351249109Sjkim    ACPI_NAMESPACE_NODE     *Node,
352253690Sjkim    UINT32                  NamepathOffset,
353249109Sjkim    UINT32                  Offset,
354249109Sjkim    char                    *OpName,
355249109Sjkim    UINT64                  Value,
356253690Sjkim    UINT8                   AmlOpcode,
357253690Sjkim    UINT16                  ParentOpcode)
358249109Sjkim{
359249109Sjkim    ACPI_BUFFER             TargetPath;
360249109Sjkim    ACPI_STATUS             Status;
361249109Sjkim
362249109Sjkim
363249109Sjkim    /* Get the full pathname to the namespace node */
364249109Sjkim
365249109Sjkim    TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
366306536Sjkim    Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE);
367249109Sjkim    if (ACPI_FAILURE (Status))
368249109Sjkim    {
369249109Sjkim        return;
370249109Sjkim    }
371249109Sjkim
372249109Sjkim    /* [1] - Skip the opening backslash for the path */
373249109Sjkim
374249109Sjkim    strcpy (MsgBuffer, "\"");
375249109Sjkim    strcat (MsgBuffer, &((char *) TargetPath.Pointer)[1]);
376249109Sjkim    strcat (MsgBuffer, "\",");
377249109Sjkim    ACPI_FREE (TargetPath.Pointer);
378249109Sjkim
379249109Sjkim    /*
380249109Sjkim     * Max offset is 4G, constrained by 32-bit ACPI table length.
381249109Sjkim     * Max Length for Integers is 8 bytes.
382249109Sjkim     */
383249109Sjkim    FlPrintFile (FileId,
384253690Sjkim        "    {%-29s 0x%4.4X, 0x%8.8X, 0x%2.2X, 0x%8.8X, 0x%8.8X%8.8X}, /* %s */\n",
385253690Sjkim        MsgBuffer, ParentOpcode, NamepathOffset, AmlOpcode,
386253690Sjkim        Offset, ACPI_FORMAT_UINT64 (Value), OpName);
387249109Sjkim}
388249109Sjkim
389249109Sjkim
390249109Sjkim/*******************************************************************************
391249109Sjkim *
392249109Sjkim * FUNCTION:    LsDoOffsetTableHeader, LsDoOffsetTableFooter
393249109Sjkim *
394249109Sjkim * PARAMETERS:  FileId          - ID of current listing file
395249109Sjkim *
396249109Sjkim * RETURN:      None
397249109Sjkim *
398249109Sjkim * DESCRIPTION: Header and footer for the offset table file.
399249109Sjkim *
400249109Sjkim ******************************************************************************/
401249109Sjkim
402249109Sjkimvoid
403249109SjkimLsDoOffsetTableHeader (
404249109Sjkim    UINT32                  FileId)
405249109Sjkim{
406249109Sjkim
407249109Sjkim    FlPrintFile (FileId,
408249109Sjkim        "#ifndef __AML_OFFSET_TABLE_H\n"
409249109Sjkim        "#define __AML_OFFSET_TABLE_H\n\n");
410249109Sjkim
411249109Sjkim    FlPrintFile (FileId, "typedef struct {\n"
412253690Sjkim        "    char                   *Pathname;      /* Full pathname (from root) to the object */\n"
413253690Sjkim        "    unsigned short         ParentOpcode;   /* AML opcode for the parent object */\n"
414253690Sjkim        "    unsigned long          NamesegOffset;  /* Offset of last nameseg in the parent namepath */\n"
415253690Sjkim        "    unsigned char          Opcode;         /* AML opcode for the data */\n"
416253690Sjkim        "    unsigned long          Offset;         /* Offset for the data */\n"
417253690Sjkim        "    unsigned long long     Value;          /* Original value of the data (as applicable) */\n"
418249109Sjkim        "} AML_OFFSET_TABLE_ENTRY;\n\n");
419249109Sjkim
420249109Sjkim    FlPrintFile (FileId,
421249109Sjkim        "#endif /* __AML_OFFSET_TABLE_H */\n\n");
422249109Sjkim
423249109Sjkim    FlPrintFile (FileId,
424250838Sjkim        "/*\n"
425253690Sjkim        " * Information specific to the supported object types:\n"
426250838Sjkim        " *\n"
427250838Sjkim        " * Integers:\n"
428253690Sjkim        " *    Opcode is the integer prefix, indicates length of the data\n"
429253690Sjkim        " *        (One of: BYTE, WORD, DWORD, QWORD, ZERO, ONE, ONES)\n"
430250838Sjkim        " *    Offset points to the actual integer data\n"
431250838Sjkim        " *    Value is the existing value in the AML\n"
432250838Sjkim        " *\n"
433250838Sjkim        " * Packages:\n"
434253690Sjkim        " *    Opcode is the package or var_package opcode\n"
435250838Sjkim        " *    Offset points to the package opcode\n"
436253690Sjkim        " *    Value is the package element count\n"
437250838Sjkim        " *\n"
438250838Sjkim        " * Operation Regions:\n"
439250838Sjkim        " *    Opcode is the address integer prefix, indicates length of the data\n"
440253690Sjkim        " *    Offset points to the region address\n"
441250838Sjkim        " *    Value is the existing address value in the AML\n"
442250838Sjkim        " *\n"
443250838Sjkim        " * Control Methods:\n"
444253690Sjkim        " *    Offset points to the method flags byte\n"
445253690Sjkim        " *    Value is the existing flags value in the AML\n"
446250838Sjkim        " *\n"
447253690Sjkim        " * Processors:\n"
448253690Sjkim        " *    Offset points to the first byte of the PBlock Address\n"
449253690Sjkim        " *\n"
450250838Sjkim        " * Resource Descriptors:\n"
451253690Sjkim        " *    Opcode is the descriptor type\n"
452250838Sjkim        " *    Offset points to the start of the descriptor\n"
453253690Sjkim        " *\n"
454253690Sjkim        " * Scopes/Devices/ThermalZones:\n"
455253690Sjkim        " *    Nameseg offset only\n"
456250838Sjkim        " */\n");
457250838Sjkim
458250838Sjkim    FlPrintFile (FileId,
459249109Sjkim        "AML_OFFSET_TABLE_ENTRY   %s_%s_OffsetTable[] =\n{\n",
460249109Sjkim        Gbl_TableSignature, Gbl_TableId);
461249109Sjkim}
462249109Sjkim
463249109Sjkim
464249109Sjkimvoid
465249109SjkimLsDoOffsetTableFooter (
466249109Sjkim    UINT32                  FileId)
467249109Sjkim{
468249109Sjkim
469249109Sjkim    FlPrintFile (FileId,
470253690Sjkim        "    {NULL,0,0,0,0,0} /* Table terminator */\n};\n\n");
471249109Sjkim    Gbl_CurrentAmlOffset = 0;
472249109Sjkim}
473