dmbuffer.c revision 228110
1100894Srwatson/*******************************************************************************
2126097Srwatson *
3100894Srwatson * Module Name: dmbuffer - AML disassembler, buffer and string support
4126097Srwatson *
5145147Srwatson ******************************************************************************/
6172930Srwatson
7100894Srwatson/*
8100894Srwatson * Copyright (C) 2000 - 2011, Intel Corp.
9100894Srwatson * All rights reserved.
10100894Srwatson *
11100894Srwatson * Redistribution and use in source and binary forms, with or without
12106392Srwatson * modification, are permitted provided that the following conditions
13106392Srwatson * are met:
14106392Srwatson * 1. Redistributions of source code must retain the above copyright
15106392Srwatson *    notice, this list of conditions, and the following disclaimer,
16100894Srwatson *    without modification.
17172930Srwatson * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18172930Srwatson *    substantially similar to the "NO WARRANTY" disclaimer below
19172930Srwatson *    ("Disclaimer") and any redistribution must be conditioned upon
20100894Srwatson *    including a substantially similar Disclaimer requirement for further
21100894Srwatson *    binary redistribution.
22100894Srwatson * 3. Neither the names of the above-listed copyright holders nor the names
23100894Srwatson *    of any contributors may be used to endorse or promote products derived
24100894Srwatson *    from this software without specific prior written permission.
25100894Srwatson *
26100894Srwatson * Alternatively, this software may be distributed under the terms of the
27100894Srwatson * GNU General Public License ("GPL") version 2 as published by the Free
28100894Srwatson * Software Foundation.
29100894Srwatson *
30100894Srwatson * NO WARRANTY
31100894Srwatson * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32100894Srwatson * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33100894Srwatson * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34100894Srwatson * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35100894Srwatson * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36100894Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37100894Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38100894Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39100894Srwatson * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40100894Srwatson * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41116182Sobrien * POSSIBILITY OF SUCH DAMAGES.
42116182Sobrien */
43116182Sobrien
44116182Sobrien
45100894Srwatson#include <contrib/dev/acpica/include/acpi.h>
46101173Srwatson#include <contrib/dev/acpica/include/accommon.h>
47100894Srwatson#include <contrib/dev/acpica/include/acdisasm.h>
48106856Srwatson#include <contrib/dev/acpica/include/acparser.h>
49106468Srwatson#include <contrib/dev/acpica/include/amlcode.h>
50100979Srwatson
51100979Srwatson
52102949Sbde#ifdef ACPI_DISASSEMBLER
53100979Srwatson
54100979Srwatson#define _COMPONENT          ACPI_CA_DEBUGGER
55100979Srwatson        ACPI_MODULE_NAME    ("dmbuffer")
56116701Srwatson
57100979Srwatson/* Local prototypes */
58100979Srwatson
59100979Srwatsonstatic void
60100979SrwatsonAcpiDmUnicode (
61100979Srwatson    ACPI_PARSE_OBJECT       *Op);
62100979Srwatson
63100894Srwatsonstatic void
64100979SrwatsonAcpiDmIsEisaIdElement (
65100979Srwatson    ACPI_PARSE_OBJECT       *Op);
66100979Srwatson
67100979Srwatson
68100979Srwatson/*******************************************************************************
69163606Srwatson *
70121361Srwatson * FUNCTION:    AcpiDmDisasmByteList
71165469Srwatson *
72100979Srwatson * PARAMETERS:  Level               - Current source code indentation level
73103136Srwatson *              ByteData            - Pointer to the byte list
74103136Srwatson *              ByteCount           - Length of the byte list
75103136Srwatson *
76103136Srwatson * RETURN:      None
77121361Srwatson *
78101892Srwatson * DESCRIPTION: Dump an AML "ByteList" in Hex format. 8 bytes per line, prefixed
79100979Srwatson *              with the hex buffer offset.
80100979Srwatson *
81100979Srwatson ******************************************************************************/
82100979Srwatson
83100979Srwatsonvoid
84100979SrwatsonAcpiDmDisasmByteList (
85100979Srwatson    UINT32                  Level,
86122524Srwatson    UINT8                   *ByteData,
87122524Srwatson    UINT32                  ByteCount)
88104521Srwatson{
89122524Srwatson    UINT32                  i;
90104521Srwatson
91122524Srwatson
92172930Srwatson    if (!ByteCount)
93122524Srwatson    {
94104521Srwatson        return;
95104521Srwatson    }
96104521Srwatson
97172930Srwatson    /* Dump the byte list */
98105694Srwatson
99105694Srwatson    for (i = 0; i < ByteCount; i++)
100122524Srwatson    {
101105694Srwatson        /* New line every 8 bytes */
102105694Srwatson
103122524Srwatson        if (((i % 8) == 0) && (i < ByteCount))
104122524Srwatson        {
105122524Srwatson            if (i > 0)
106122524Srwatson            {
107122524Srwatson                AcpiOsPrintf ("\n");
108122524Srwatson            }
109172930Srwatson
110122524Srwatson            AcpiDmIndent (Level);
111122524Srwatson            if (ByteCount > 8)
112122524Srwatson            {
113105694Srwatson                AcpiOsPrintf ("/* %04X */  ", i);
114172930Srwatson            }
115107105Srwatson        }
116107105Srwatson
117122524Srwatson        AcpiOsPrintf (" 0x%2.2X", (UINT32) ByteData[i]);
118107105Srwatson
119107105Srwatson        /* Add comma if there are more bytes to display */
120105988Srwatson
121122524Srwatson        if (i < (ByteCount -1))
122104521Srwatson        {
123104521Srwatson            AcpiOsPrintf (",");
124172930Srwatson        }
125122524Srwatson    }
126104521Srwatson
127104521Srwatson    if (Level)
128104521Srwatson    {
129172930Srwatson        AcpiOsPrintf ("\n");
130105694Srwatson    }
131105694Srwatson}
132122524Srwatson
133122524Srwatson
134105694Srwatson/*******************************************************************************
135105694Srwatson *
136122524Srwatson * FUNCTION:    AcpiDmByteList
137122524Srwatson *
138122524Srwatson * PARAMETERS:  Info            - Parse tree walk info
139122524Srwatson *              Op              - Byte list op
140172930Srwatson *
141122524Srwatson * RETURN:      None
142122524Srwatson *
143122524Srwatson * DESCRIPTION: Dump a buffer byte list, handling the various types of buffers.
144105694Srwatson *              Buffer type must be already set in the Op DisasmOpcode.
145172930Srwatson *
146107105Srwatson ******************************************************************************/
147107105Srwatson
148122524Srwatsonvoid
149122524SrwatsonAcpiDmByteList (
150107105Srwatson    ACPI_OP_WALK_INFO       *Info,
151107105Srwatson    ACPI_PARSE_OBJECT       *Op)
152121361Srwatson{
153172930Srwatson    UINT8                   *ByteData;
154122159Srwatson    UINT32                  ByteCount;
155105694Srwatson
156104522Srwatson
157104522Srwatson    ByteData = Op->Named.Data;
158121507Srwatson    ByteCount = (UINT32) Op->Common.Value.Integer;
159104522Srwatson
160104522Srwatson    /*
161104522Srwatson     * The byte list belongs to a buffer, and can be produced by either
162104522Srwatson     * a ResourceTemplate, Unicode, quoted string, or a plain byte list.
163121361Srwatson     */
164172930Srwatson    switch (Op->Common.Parent->Common.DisasmOpcode)
165105694Srwatson    {
166105694Srwatson    case ACPI_DASM_RESOURCE:
167105694Srwatson
168121507Srwatson        AcpiDmResourceTemplate (Info, Op->Common.Parent, ByteData, ByteCount);
169105694Srwatson        break;
170105694Srwatson
171105694Srwatson    case ACPI_DASM_STRING:
172105694Srwatson
173104522Srwatson        AcpiDmIndent (Info->Level);
174165425Srwatson        AcpiUtPrintString ((char *) ByteData, ACPI_UINT8_MAX);
175165425Srwatson        AcpiOsPrintf ("\n");
176104522Srwatson        break;
177104521Srwatson
178172930Srwatson    case ACPI_DASM_UNICODE:
179104522Srwatson
180104522Srwatson        AcpiDmUnicode (Op);
181172930Srwatson        break;
182104522Srwatson
183104522Srwatson    case ACPI_DASM_BUFFER:
184104522Srwatson    default:
185104522Srwatson
186104522Srwatson        /*
187104522Srwatson         * Not a resource, string, or unicode string.
188104522Srwatson         * Just dump the buffer
189172930Srwatson         */
190104522Srwatson        AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
191104522Srwatson        break;
192172930Srwatson    }
193104522Srwatson}
194104522Srwatson
195104522Srwatson
196104522Srwatson/*******************************************************************************
197104522Srwatson *
198104522Srwatson * FUNCTION:    AcpiDmIsUnicodeBuffer
199104522Srwatson *
200104522Srwatson * PARAMETERS:  Op              - Buffer Object to be examined
201104522Srwatson *
202104522Srwatson * RETURN:      TRUE if buffer contains a UNICODE string
203104522Srwatson *
204165425Srwatson * DESCRIPTION: Determine if a buffer Op contains a Unicode string
205165425Srwatson *
206104522Srwatson ******************************************************************************/
207104522Srwatson
208172930SrwatsonBOOLEAN
209104522SrwatsonAcpiDmIsUnicodeBuffer (
210104522Srwatson    ACPI_PARSE_OBJECT       *Op)
211172930Srwatson{
212104522Srwatson    UINT8                   *ByteData;
213104522Srwatson    UINT32                  ByteCount;
214105988Srwatson    UINT32                  WordCount;
215122524Srwatson    ACPI_PARSE_OBJECT       *SizeOp;
216106468Srwatson    ACPI_PARSE_OBJECT       *NextOp;
217122524Srwatson    UINT32                  i;
218106468Srwatson
219106468Srwatson
220106468Srwatson    /* Buffer size is the buffer argument */
221106468Srwatson
222106468Srwatson    SizeOp = Op->Common.Value.Arg;
223106468Srwatson
224106468Srwatson    /* Next, the initializer byte list to examine */
225106468Srwatson
226106468Srwatson    NextOp = SizeOp->Common.Next;
227106468Srwatson    if (!NextOp)
228106468Srwatson    {
229106468Srwatson        return (FALSE);
230106468Srwatson    }
231106468Srwatson
232106468Srwatson    /* Extract the byte list info */
233111119Simp
234106468Srwatson    ByteData = NextOp->Named.Data;
235106468Srwatson    ByteCount = (UINT32) NextOp->Common.Value.Integer;
236106468Srwatson    WordCount = ACPI_DIV_2 (ByteCount);
237106468Srwatson
238106468Srwatson    /*
239106468Srwatson     * Unicode string must have an even number of bytes and last
240122524Srwatson     * word must be zero
241172930Srwatson     */
242106468Srwatson    if ((!ByteCount)     ||
243106468Srwatson         (ByteCount < 4) ||
244122524Srwatson         (ByteCount & 1) ||
245106468Srwatson        ((UINT16 *) (void *) ByteData)[WordCount - 1] != 0)
246106468Srwatson    {
247122524Srwatson        return (FALSE);
248106468Srwatson    }
249106468Srwatson
250106468Srwatson    /* For each word, 1st byte must be ascii, 2nd byte must be zero */
251100979Srwatson
252106468Srwatson    for (i = 0; i < (ByteCount - 2); i += 2)
253100979Srwatson    {
254122524Srwatson        if ((!ACPI_IS_PRINT (ByteData[i])) ||
255122524Srwatson            (ByteData[(ACPI_SIZE) i + 1] != 0))
256122524Srwatson        {
257122524Srwatson            return (FALSE);
258106468Srwatson        }
259100979Srwatson    }
260100979Srwatson
261100979Srwatson    /* Ignore the Size argument in the disassembly of this buffer op */
262165425Srwatson
263165425Srwatson    SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
264165425Srwatson    return (TRUE);
265100979Srwatson}
266107271Srwatson
267100979Srwatson
268100979Srwatson/*******************************************************************************
269100979Srwatson *
270100979Srwatson * FUNCTION:    AcpiDmIsStringBuffer
271100979Srwatson *
272100979Srwatson * PARAMETERS:  Op              - Buffer Object to be examined
273100979Srwatson *
274100979Srwatson * RETURN:      TRUE if buffer contains a ASCII string, FALSE otherwise
275100979Srwatson *
276100979Srwatson * DESCRIPTION: Determine if a buffer Op contains a ASCII string
277100979Srwatson *
278100979Srwatson ******************************************************************************/
279100979Srwatson
280100979SrwatsonBOOLEAN
281100979SrwatsonAcpiDmIsStringBuffer (
282100979Srwatson    ACPI_PARSE_OBJECT       *Op)
283100979Srwatson{
284100979Srwatson    UINT8                   *ByteData;
285100979Srwatson    UINT32                  ByteCount;
286100979Srwatson    ACPI_PARSE_OBJECT       *SizeOp;
287100979Srwatson    ACPI_PARSE_OBJECT       *NextOp;
288100979Srwatson    UINT32                  i;
289100979Srwatson
290100979Srwatson
291100979Srwatson    /* Buffer size is the buffer argument */
292100979Srwatson
293100979Srwatson    SizeOp = Op->Common.Value.Arg;
294100979Srwatson
295100979Srwatson    /* Next, the initializer byte list to examine */
296100979Srwatson
297100979Srwatson    NextOp = SizeOp->Common.Next;
298100979Srwatson    if (!NextOp)
299100979Srwatson    {
300100979Srwatson        return (FALSE);
301100979Srwatson    }
302100979Srwatson
303100979Srwatson    /* Extract the byte list info */
304100979Srwatson
305150913Scsjp    ByteData = NextOp->Named.Data;
306104546Srwatson    ByteCount = (UINT32) NextOp->Common.Value.Integer;
307151115Scsjp
308100979Srwatson    /* Last byte must be the null terminator */
309100979Srwatson
310156225Stegge    if ((!ByteCount)     ||
311100979Srwatson         (ByteCount < 2) ||
312103136Srwatson         (ByteData[ByteCount-1] != 0))
313103136Srwatson    {
314103136Srwatson        return (FALSE);
315100979Srwatson    }
316100979Srwatson
317100979Srwatson    for (i = 0; i < (ByteCount - 1); i++)
318100979Srwatson    {
319100979Srwatson        /* TBD: allow some escapes (non-ascii chars).
320100979Srwatson         * they will be handled in the string output routine
321100979Srwatson         */
322100979Srwatson
323100979Srwatson        if (!ACPI_IS_PRINT (ByteData[i]))
324100979Srwatson        {
325100979Srwatson            return (FALSE);
326100979Srwatson        }
327100979Srwatson    }
328100979Srwatson
329100979Srwatson    return (TRUE);
330100979Srwatson}
331100979Srwatson
332100979Srwatson
333100979Srwatson/*******************************************************************************
334100979Srwatson *
335151115Scsjp * FUNCTION:    AcpiDmUnicode
336151115Scsjp *
337151115Scsjp * PARAMETERS:  Op              - Byte List op containing Unicode string
338150923Scsjp *
339151115Scsjp * RETURN:      None
340151115Scsjp *
341100979Srwatson * DESCRIPTION: Dump Unicode string as a standard ASCII string.  (Remove
342151115Scsjp *              the extra zero bytes).
343100979Srwatson *
344165425Srwatson ******************************************************************************/
345165425Srwatson
346165425Srwatsonstatic void
347100979SrwatsonAcpiDmUnicode (
348100979Srwatson    ACPI_PARSE_OBJECT       *Op)
349100979Srwatson{
350100979Srwatson    UINT16                  *WordData;
351150913Scsjp    UINT32                  WordCount;
352100979Srwatson    UINT32                  i;
353104546Srwatson
354172930Srwatson
355100979Srwatson    /* Extract the buffer info as a WORD buffer */
356100979Srwatson
357165425Srwatson    WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
358165425Srwatson    WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
359100979Srwatson
360100979Srwatson
361150913Scsjp    AcpiOsPrintf ("\"");
362150913Scsjp
363100979Srwatson    /* Write every other byte as an ASCII character */
364150913Scsjp
365102949Sbde    for (i = 0; i < (WordCount - 1); i++)
366102949Sbde    {
367102949Sbde        AcpiOsPrintf ("%c", (int) WordData[i]);
368102949Sbde    }
369100979Srwatson
370100979Srwatson    AcpiOsPrintf ("\")");
371100979Srwatson}
372100979Srwatson
373100979Srwatson
374165425Srwatson/*******************************************************************************
375165425Srwatson *
376100979Srwatson * FUNCTION:    AcpiDmIsEisaIdElement
377100979Srwatson *
378100979Srwatson * PARAMETERS:  Op              - Op to be examined
379100979Srwatson *
380100979Srwatson * RETURN:      None
381100979Srwatson *
382100979Srwatson * DESCRIPTION: Determine if an Op (argument to _HID or _CID) can be converted
383100979Srwatson *              to an EISA ID.
384100979Srwatson *
385100979Srwatson ******************************************************************************/
386100979Srwatson
387156225Steggestatic void
388100979SrwatsonAcpiDmIsEisaIdElement (
389113955Salc    ACPI_PARSE_OBJECT       *Op)
390100979Srwatson{
391100979Srwatson    UINT32                  BigEndianId;
392100979Srwatson    UINT32                  Prefix[3];
393100979Srwatson    UINT32                  i;
394100979Srwatson
395113955Salc
396100979Srwatson    /* The parameter must be either a word or a dword */
397156225Stegge
398100979Srwatson    if ((Op->Common.AmlOpcode != AML_DWORD_OP) &&
399100979Srwatson        (Op->Common.AmlOpcode != AML_WORD_OP))
400100979Srwatson    {
401100979Srwatson        return;
402100979Srwatson    }
403100979Srwatson
404100979Srwatson    /* Swap from little-endian to big-endian to simplify conversion */
405100979Srwatson
406100979Srwatson    BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
407100979Srwatson
408100979Srwatson    /* Create the 3 leading ASCII letters */
409100979Srwatson
410100979Srwatson    Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
411100979Srwatson    Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
412100979Srwatson    Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
413100979Srwatson
414100979Srwatson    /* Verify that all 3 are ascii and alpha */
415100979Srwatson
416100979Srwatson    for (i = 0; i < 3; i++)
417100979Srwatson    {
418100979Srwatson        if (!ACPI_IS_ASCII (Prefix[i]) ||
419100979Srwatson            !ACPI_IS_ALPHA (Prefix[i]))
420100979Srwatson        {
421100979Srwatson            return;
422100979Srwatson        }
423100979Srwatson    }
424100979Srwatson
425150913Scsjp    /* OK - mark this node as convertable to an EISA ID */
426100979Srwatson
427100979Srwatson    Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
428100979Srwatson}
429100979Srwatson
430100979Srwatson
431100979Srwatson/*******************************************************************************
432100979Srwatson *
433100979Srwatson * FUNCTION:    AcpiDmIsEisaId
434100979Srwatson *
435121361Srwatson * PARAMETERS:  Op              - Op to be examined
436172930Srwatson *
437100979Srwatson * RETURN:      None
438100979Srwatson *
439172930Srwatson * DESCRIPTION: Determine if a Name() Op can be converted to an EisaId.
440100979Srwatson *
441100979Srwatson ******************************************************************************/
442100979Srwatson
443172930Srwatsonvoid
444100979SrwatsonAcpiDmIsEisaId (
445100979Srwatson    ACPI_PARSE_OBJECT       *Op)
446100979Srwatson{
447172930Srwatson    UINT32                  Name;
448100979Srwatson    ACPI_PARSE_OBJECT       *NextOp;
449100979Srwatson
450100979Srwatson
451100979Srwatson    /* Get the NameSegment */
452100979Srwatson
453172930Srwatson    Name = AcpiPsGetName (Op);
454100979Srwatson    if (!Name)
455100979Srwatson    {
456100979Srwatson        return;
457172930Srwatson    }
458100979Srwatson
459100979Srwatson    NextOp = AcpiPsGetDepthNext (NULL, Op);
460100979Srwatson    if (!NextOp)
461100979Srwatson    {
462100979Srwatson        return;
463172930Srwatson    }
464100979Srwatson
465100979Srwatson    /* Check for _HID - has one argument */
466100979Srwatson
467168955Srwatson    if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
468102103Srwatson    {
469172930Srwatson        AcpiDmIsEisaIdElement (NextOp);
470100979Srwatson        return;
471100979Srwatson    }
472100979Srwatson
473100979Srwatson    /* Exit if not _CID */
474100979Srwatson
475172930Srwatson    if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__CID))
476100979Srwatson    {
477100979Srwatson        return;
478100979Srwatson    }
479168955Srwatson
480102103Srwatson    /* _CID can contain a single argument or a package */
481172930Srwatson
482100979Srwatson    if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP)
483100979Srwatson    {
484100979Srwatson        AcpiDmIsEisaIdElement (NextOp);
485100979Srwatson        return;
486100979Srwatson    }
487172930Srwatson
488100979Srwatson    /* _CID with Package: get the package length */
489100979Srwatson
490100979Srwatson    NextOp = AcpiPsGetDepthNext (NULL, NextOp);
491168955Srwatson
492102103Srwatson    /* Don't need to use the length, just walk the peer list */
493172930Srwatson
494100979Srwatson    NextOp = NextOp->Common.Next;
495100979Srwatson    while (NextOp)
496100979Srwatson    {
497145147Srwatson        AcpiDmIsEisaIdElement (NextOp);
498145147Srwatson        NextOp = NextOp->Common.Next;
499172930Srwatson    }
500145147Srwatson}
501145147Srwatson
502145147Srwatson
503168955Srwatson/*******************************************************************************
504145147Srwatson *
505172930Srwatson * FUNCTION:    AcpiDmEisaId
506145147Srwatson *
507145147Srwatson * PARAMETERS:  EncodedId       - Raw encoded EISA ID.
508145147Srwatson *
509145147Srwatson * RETURN:      None
510172930Srwatson *
511145147Srwatson * DESCRIPTION: Convert an encoded EISAID back to the original ASCII String.
512145147Srwatson *
513145147Srwatson ******************************************************************************/
514168955Srwatson
515145147Srwatsonvoid
516172930SrwatsonAcpiDmEisaId (
517145147Srwatson    UINT32                  EncodedId)
518145147Srwatson{
519145147Srwatson    UINT32                  BigEndianId;
520145147Srwatson
521172930Srwatson
522145147Srwatson    /* Swap from little-endian to big-endian to simplify conversion */
523145147Srwatson
524145147Srwatson    BigEndianId = AcpiUtDwordByteSwap (EncodedId);
525168955Srwatson
526145147Srwatson
527172930Srwatson    /* Split to form "AAANNNN" string */
528168955Srwatson
529145147Srwatson    AcpiOsPrintf ("EisaId (\"%c%c%c%4.4X\")",
530145147Srwatson
531145147Srwatson        /* Three Alpha characters (AAA), 5 bits each */
532145147Srwatson
533172930Srwatson        (int) ((BigEndianId >> 26) & 0x1F) + 0x40,
534145147Srwatson        (int) ((BigEndianId >> 21) & 0x1F) + 0x40,
535145147Srwatson        (int) ((BigEndianId >> 16) & 0x1F) + 0x40,
536145147Srwatson
537168955Srwatson        /* Numeric part (NNNN) is simply the lower 16 bits */
538145147Srwatson
539172930Srwatson        (UINT32) (BigEndianId & 0xFFFF));
540168955Srwatson}
541145147Srwatson
542145147Srwatson#endif
543145147Srwatson