exutils.c revision 102550
1238384Sjkim
2238384Sjkim/******************************************************************************
3238384Sjkim *
4238384Sjkim * Module Name: exutils - interpreter/scanner utilities
5238384Sjkim *              $Revision: 103 $
6238384Sjkim *
7238384Sjkim *****************************************************************************/
8296341Sdelphij
9238384Sjkim/******************************************************************************
10238384Sjkim *
11238384Sjkim * 1. Copyright Notice
12238384Sjkim *
13238384Sjkim * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
14238384Sjkim * All rights reserved.
15296341Sdelphij *
16238384Sjkim * 2. License
17238384Sjkim *
18238384Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property
19238384Sjkim * rights.  You may have additional license terms from the party that provided
20238384Sjkim * you this software, covering your right to use that party's intellectual
21238384Sjkim * property rights.
22296341Sdelphij *
23238384Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24238384Sjkim * copy of the source code appearing in this file ("Covered Code") an
25238384Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26238384Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy,
27238384Sjkim * make derivatives, distribute, use and display any portion of the Covered
28238384Sjkim * Code in any form, with the right to sublicense such rights; and
29238384Sjkim *
30238384Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31238384Sjkim * license (with the right to sublicense), under only those claims of Intel
32238384Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell,
33238384Sjkim * offer to sell, and import the Covered Code and derivative works thereof
34238384Sjkim * solely to the minimum extent necessary to exercise the above copyright
35238384Sjkim * license, and in no event shall the patent license extend to any additions
36238384Sjkim * to or modifications of the Original Intel Code.  No other license or right
37296341Sdelphij * is granted directly or by implication, estoppel or otherwise;
38238384Sjkim *
39238384Sjkim * The above copyright and patent license is granted only if the following
40296341Sdelphij * conditions are met:
41238384Sjkim *
42238384Sjkim * 3. Conditions
43238384Sjkim *
44238384Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45238384Sjkim * Redistribution of source code of any substantial portion of the Covered
46238384Sjkim * Code or modification with rights to further distribute source must include
47238384Sjkim * the above Copyright Notice, the above License, this list of Conditions,
48238384Sjkim * and the following Disclaimer and Export Compliance provision.  In addition,
49238384Sjkim * Licensee must cause all Covered Code to which Licensee contributes to
50238384Sjkim * contain a file documenting the changes Licensee made to create that Covered
51238384Sjkim * Code and the date of any change.  Licensee must include in that file the
52296341Sdelphij * documentation of any changes made by any predecessor Licensee.  Licensee
53238384Sjkim * must include a prominent statement that the modification is derived,
54238384Sjkim * directly or indirectly, from Original Intel Code.
55238384Sjkim *
56238384Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57238384Sjkim * Redistribution of source code of any substantial portion of the Covered
58238384Sjkim * Code or modification without rights to further distribute source must
59238384Sjkim * include the following Disclaimer and Export Compliance provision in the
60238384Sjkim * documentation and/or other materials provided with distribution.  In
61238384Sjkim * addition, Licensee may not authorize further sublicense of source of any
62238384Sjkim * portion of the Covered Code, and must include terms to the effect that the
63238384Sjkim * license from Licensee to its licensee is limited to the intellectual
64238384Sjkim * property embodied in the software Licensee provides to its licensee, and
65238384Sjkim * not to intellectual property embodied in modifications its licensee may
66296341Sdelphij * make.
67238384Sjkim *
68238384Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any
69238384Sjkim * substantial portion of the Covered Code or modification must reproduce the
70238384Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance
71238384Sjkim * provision in the documentation and/or other materials provided with the
72238384Sjkim * distribution.
73238384Sjkim *
74238384Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original
75238384Sjkim * Intel Code.
76238384Sjkim *
77238384Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78238384Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or
79238384Sjkim * other dealings in products derived from or relating to the Covered Code
80238384Sjkim * without prior written authorization from Intel.
81238384Sjkim *
82238384Sjkim * 4. Disclaimer and Export Compliance
83238384Sjkim *
84238384Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85238384Sjkim * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86238384Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87238384Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88238384Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89238384Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90238384Sjkim * PARTICULAR PURPOSE.
91238384Sjkim *
92238384Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93238384Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94238384Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95238384Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96238384Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97238384Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98238384Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99238384Sjkim * LIMITED REMEDY.
100238384Sjkim *
101238384Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this
102238384Sjkim * software or system incorporating such software without first obtaining any
103238384Sjkim * required license or other approval from the U. S. Department of Commerce or
104238384Sjkim * any other agency or department of the United States Government.  In the
105238384Sjkim * event Licensee exports any such software from the United States or
106238384Sjkim * re-exports any such software from a foreign destination, Licensee shall
107238384Sjkim * ensure that the distribution and export/re-export of the software is in
108238384Sjkim * compliance with all laws, regulations, orders, or other restrictions of the
109238384Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110238384Sjkim * any of its subsidiaries will export/re-export any technical data, process,
111238384Sjkim * software, or service, directly or indirectly, to any country for which the
112296341Sdelphij * United States government or any agency thereof requires an export license,
113296341Sdelphij * other governmental approval, or letter of assurance, without first obtaining
114296341Sdelphij * such license, approval or letter.
115296341Sdelphij *
116238384Sjkim *****************************************************************************/
117238384Sjkim
118238384Sjkim#define __EXUTILS_C__
119238384Sjkim
120246772Sjkim/*
121246772Sjkim * DEFINE_AML_GLOBALS is tested in amlcode.h
122246772Sjkim * to determine whether certain global names should be "defined" or only
123296341Sdelphij * "declared" in the current compilation.  This enhances maintainability
124238384Sjkim * by enabling a single header file to embody all knowledge of the names
125296341Sdelphij * in question.
126238384Sjkim *
127296341Sdelphij * Exactly one module of any executable should #define DEFINE_GLOBALS
128296341Sdelphij * before #including the header files which use this convention.  The
129296341Sdelphij * names in question will be defined and initialized in that module,
130238384Sjkim * and declared as extern in all other modules which #include those
131296341Sdelphij * header files.
132296341Sdelphij */
133296341Sdelphij
134296341Sdelphij#define DEFINE_AML_GLOBALS
135238384Sjkim
136296341Sdelphij#include "acpi.h"
137296341Sdelphij#include "acinterp.h"
138296341Sdelphij#include "amlcode.h"
139238384Sjkim#include "acevents.h"
140296341Sdelphij
141296341Sdelphij#define _COMPONENT          ACPI_EXECUTER
142296341Sdelphij        ACPI_MODULE_NAME    ("exutils")
143296341Sdelphij
144238384Sjkim
145296341Sdelphij/*******************************************************************************
146238384Sjkim *
147238384Sjkim * FUNCTION:    AcpiExValidateObjectType
148296341Sdelphij *
149296341Sdelphij * PARAMETERS:  Type            Object type to validate
150296341Sdelphij *
151238384Sjkim * DESCRIPTION: Determine if a type is a valid ACPI object type
152296341Sdelphij *
153296341Sdelphij ******************************************************************************/
154296341Sdelphij
155296341SdelphijBOOLEAN
156296341SdelphijAcpiExValidateObjectType (
157296341Sdelphij    ACPI_OBJECT_TYPE        Type)
158238384Sjkim{
159296341Sdelphij
160296341Sdelphij    ACPI_FUNCTION_ENTRY ();
161238384Sjkim
162296341Sdelphij
163296341Sdelphij    if ((Type > ACPI_TYPE_MAX && Type < INTERNAL_TYPE_BEGIN) ||
164238384Sjkim        (Type > INTERNAL_TYPE_MAX))
165296341Sdelphij    {
166296341Sdelphij        return (FALSE);
167296341Sdelphij    }
168296341Sdelphij
169238384Sjkim    return (TRUE);
170296341Sdelphij}
171296341Sdelphij
172238384Sjkim#ifndef ACPI_NO_METHOD_EXECUTION
173296341Sdelphij
174238384Sjkim/*******************************************************************************
175296341Sdelphij *
176296341Sdelphij * FUNCTION:    AcpiExEnterInterpreter
177296341Sdelphij *
178296341Sdelphij * PARAMETERS:  None
179296341Sdelphij *
180273399Sdelphij * DESCRIPTION: Enter the interpreter execution region.  Failure to enter
181296341Sdelphij *              the interpreter region is a fatal system error
182296341Sdelphij *
183238384Sjkim ******************************************************************************/
184296341Sdelphij
185296341SdelphijACPI_STATUS
186296341SdelphijAcpiExEnterInterpreter (void)
187296341Sdelphij{
188296341Sdelphij    ACPI_STATUS             Status;
189296341Sdelphij
190296341Sdelphij    ACPI_FUNCTION_TRACE ("ExEnterInterpreter");
191296341Sdelphij
192238384Sjkim
193296341Sdelphij    Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE);
194296341Sdelphij    if (ACPI_FAILURE (Status))
195296341Sdelphij    {
196296341Sdelphij        ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
197296341Sdelphij    }
198296341Sdelphij
199296341Sdelphij    return_ACPI_STATUS (Status);
200238384Sjkim}
201296341Sdelphij
202296341Sdelphij
203296341Sdelphij/*******************************************************************************
204238384Sjkim *
205296341Sdelphij * FUNCTION:    AcpiExExitInterpreter
206238384Sjkim *
207296341Sdelphij * PARAMETERS:  None
208296341Sdelphij *
209296341Sdelphij * DESCRIPTION: Exit the interpreter execution region
210296341Sdelphij *
211296341Sdelphij * Cases where the interpreter is unlocked:
212296341Sdelphij *      1) Completion of the execution of a control method
213296341Sdelphij *      2) Method blocked on a Sleep() AML opcode
214296341Sdelphij *      3) Method blocked on an Acquire() AML opcode
215296341Sdelphij *      4) Method blocked on a Wait() AML opcode
216296341Sdelphij *      5) Method blocked to acquire the global lock
217296341Sdelphij *      6) Method blocked to execute a serialized control method that is
218296341Sdelphij *          already executing
219296341Sdelphij *      7) About to invoke a user-installed opregion handler
220238384Sjkim *
221296341Sdelphij ******************************************************************************/
222296341Sdelphij
223296341Sdelphijvoid
224296341SdelphijAcpiExExitInterpreter (void)
225296341Sdelphij{
226296341Sdelphij    ACPI_STATUS             Status;
227296341Sdelphij
228296341Sdelphij
229238384Sjkim    ACPI_FUNCTION_TRACE ("ExExitInterpreter");
230296341Sdelphij
231296341Sdelphij
232238384Sjkim    Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
233238384Sjkim    if (ACPI_FAILURE (Status))
234296341Sdelphij    {
235296341Sdelphij        ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
236296341Sdelphij    }
237238384Sjkim
238296341Sdelphij    return_VOID;
239296341Sdelphij}
240296341Sdelphij
241296341Sdelphij
242296341Sdelphij/*******************************************************************************
243296341Sdelphij *
244296341Sdelphij * FUNCTION:    AcpiExTruncateFor32bitTable
245296341Sdelphij *
246296341Sdelphij * PARAMETERS:  ObjDesc         - Object to be truncated
247296341Sdelphij *
248238384Sjkim * RETURN:      none
249296341Sdelphij *
250296341Sdelphij * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
251238384Sjkim *              belongs to a 32-bit ACPI table.
252296341Sdelphij *
253296341Sdelphij ******************************************************************************/
254296341Sdelphij
255296341Sdelphijvoid
256296341SdelphijAcpiExTruncateFor32bitTable (
257296341Sdelphij    ACPI_OPERAND_OBJECT     *ObjDesc)
258238384Sjkim{
259296341Sdelphij
260296341Sdelphij    ACPI_FUNCTION_ENTRY ();
261296341Sdelphij
262296341Sdelphij
263296341Sdelphij    /*
264238384Sjkim     * Object must be a valid number and we must be executing
265296341Sdelphij     * a control method
266296341Sdelphij     */
267296341Sdelphij    if ((!ObjDesc) ||
268296341Sdelphij        (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER))
269296341Sdelphij    {
270296341Sdelphij        return;
271238384Sjkim    }
272296341Sdelphij
273296341Sdelphij    if (AcpiGbl_IntegerByteWidth == 4)
274296341Sdelphij    {
275238384Sjkim        /*
276296341Sdelphij         * We are running a method that exists in a 32-bit ACPI table.
277238384Sjkim         * Truncate the value to 32 bits by zeroing out the upper 32-bit field
278296341Sdelphij         */
279296341Sdelphij        ObjDesc->Integer.Value &= (ACPI_INTEGER) ACPI_UINT32_MAX;
280238384Sjkim    }
281296341Sdelphij}
282296341Sdelphij
283296341Sdelphij
284296341Sdelphij/*******************************************************************************
285296341Sdelphij *
286296341Sdelphij * FUNCTION:    AcpiExAcquireGlobalLock
287296341Sdelphij *
288296341Sdelphij * PARAMETERS:  FieldFlags            - Flags with Lock rule:
289296341Sdelphij *                                      AlwaysLock or NeverLock
290238384Sjkim *
291296341Sdelphij * RETURN:      TRUE/FALSE indicating whether the lock was actually acquired
292296341Sdelphij *
293296341Sdelphij * DESCRIPTION: Obtain the global lock and keep track of this fact via two
294296341Sdelphij *              methods.  A global variable keeps the state of the lock, and
295296341Sdelphij *              the state is returned to the caller.
296296341Sdelphij *
297296341Sdelphij ******************************************************************************/
298296341Sdelphij
299296341SdelphijBOOLEAN
300296341SdelphijAcpiExAcquireGlobalLock (
301296341Sdelphij    UINT32                  FieldFlags)
302296341Sdelphij{
303296341Sdelphij    BOOLEAN                 Locked = FALSE;
304296341Sdelphij    ACPI_STATUS             Status;
305296341Sdelphij
306296341Sdelphij
307296341Sdelphij    ACPI_FUNCTION_TRACE ("ExAcquireGlobalLock");
308296341Sdelphij
309296341Sdelphij
310296341Sdelphij    /* Only attempt lock if the AlwaysLock bit is set */
311296341Sdelphij
312296341Sdelphij    if (FieldFlags & AML_FIELD_LOCK_RULE_MASK)
313296341Sdelphij    {
314296341Sdelphij        /* We should attempt to get the lock, wait forever */
315296341Sdelphij
316296341Sdelphij        Status = AcpiEvAcquireGlobalLock (ACPI_UINT32_MAX);
317296341Sdelphij        if (ACPI_SUCCESS (Status))
318296341Sdelphij        {
319296341Sdelphij            Locked = TRUE;
320296341Sdelphij        }
321296341Sdelphij        else
322296341Sdelphij        {
323296341Sdelphij            ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n",
324296341Sdelphij                AcpiFormatException (Status)));
325296341Sdelphij        }
326296341Sdelphij    }
327238384Sjkim
328238384Sjkim    return_VALUE (Locked);
329296341Sdelphij}
330296341Sdelphij
331296341Sdelphij
332296341Sdelphij/*******************************************************************************
333296341Sdelphij *
334296341Sdelphij * FUNCTION:    AcpiExReleaseGlobalLock
335296341Sdelphij *
336296341Sdelphij * PARAMETERS:  LockedByMe      - Return value from corresponding call to
337296341Sdelphij *                                AcquireGlobalLock.
338296341Sdelphij *
339296341Sdelphij * RETURN:      Status
340296341Sdelphij *
341296341Sdelphij * DESCRIPTION: Release the global lock if it is locked.
342296341Sdelphij *
343296341Sdelphij ******************************************************************************/
344238384Sjkim
345296341Sdelphijvoid
346296341SdelphijAcpiExReleaseGlobalLock (
347296341Sdelphij    BOOLEAN                 LockedByMe)
348296341Sdelphij{
349296341Sdelphij    ACPI_STATUS             Status;
350296341Sdelphij
351238384Sjkim
352296341Sdelphij    ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock");
353296341Sdelphij
354296341Sdelphij
355296341Sdelphij    /* Only attempt unlock if the caller locked it */
356296341Sdelphij
357296341Sdelphij    if (LockedByMe)
358238384Sjkim    {
359296341Sdelphij        /* OK, now release the lock */
360296341Sdelphij
361238384Sjkim        Status = AcpiEvReleaseGlobalLock ();
362296341Sdelphij        if (ACPI_FAILURE (Status))
363296341Sdelphij        {
364296341Sdelphij            /* Report the error, but there isn't much else we can do */
365296341Sdelphij
366296341Sdelphij            ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n",
367296341Sdelphij                AcpiFormatException (Status)));
368296341Sdelphij        }
369296341Sdelphij    }
370296341Sdelphij
371238384Sjkim    return_VOID;
372296341Sdelphij}
373296341Sdelphij
374296341Sdelphij
375296341Sdelphij/*******************************************************************************
376296341Sdelphij *
377296341Sdelphij * FUNCTION:    AcpiExDigitsNeeded
378296341Sdelphij *
379296341Sdelphij * PARAMETERS:  Value           - Value to be represented
380296341Sdelphij *              Base            - Base of representation
381296341Sdelphij *
382238384Sjkim * RETURN:      the number of digits needed to represent Value in Base
383296341Sdelphij *
384296341Sdelphij ******************************************************************************/
385238384Sjkim
386296341SdelphijUINT32
387296341SdelphijAcpiExDigitsNeeded (
388296341Sdelphij    ACPI_INTEGER            Value,
389296341Sdelphij    UINT32                  Base)
390296341Sdelphij{
391296341Sdelphij    UINT32                  NumDigits;
392238384Sjkim    ACPI_INTEGER            CurrentValue;
393296341Sdelphij    ACPI_INTEGER            Quotient;
394296341Sdelphij
395238384Sjkim
396296341Sdelphij    ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
397296341Sdelphij
398296341Sdelphij
399296341Sdelphij    /*
400296341Sdelphij     * ACPI_INTEGER is unsigned, so we don't worry about a '-'
401296341Sdelphij     */
402238384Sjkim    CurrentValue = Value;
403296341Sdelphij    NumDigits = 0;
404296341Sdelphij
405296341Sdelphij    while (CurrentValue)
406296341Sdelphij    {
407296341Sdelphij        (void) AcpiUtShortDivide (&CurrentValue, Base, &Quotient, NULL);
408296341Sdelphij        NumDigits++;
409296341Sdelphij        CurrentValue = Quotient;
410238384Sjkim    }
411296341Sdelphij
412296341Sdelphij    return_VALUE (NumDigits);
413296341Sdelphij}
414296341Sdelphij
415296341Sdelphij
416296341Sdelphij/*******************************************************************************
417296341Sdelphij *
418238384Sjkim * FUNCTION:    AcpiExEisaIdToString
419296341Sdelphij *
420238384Sjkim * PARAMETERS:  NumericId       - EISA ID to be converted
421296341Sdelphij *              OutString       - Where to put the converted string (8 bytes)
422296341Sdelphij *
423296341Sdelphij * DESCRIPTION: Convert a numeric EISA ID to string representation
424296341Sdelphij *
425296341Sdelphij ******************************************************************************/
426296341Sdelphij
427296341Sdelphijvoid
428238384SjkimAcpiExEisaIdToString (
429296341Sdelphij    UINT32                  NumericId,
430296341Sdelphij    NATIVE_CHAR             *OutString)
431296341Sdelphij{
432296341Sdelphij    UINT32                  EisaId;
433296341Sdelphij
434296341Sdelphij
435238384Sjkim    ACPI_FUNCTION_ENTRY ();
436296341Sdelphij
437296341Sdelphij
438296341Sdelphij    /* Swap ID to big-endian to get contiguous bits */
439296341Sdelphij
440296341Sdelphij    EisaId = AcpiUtDwordByteSwap (NumericId);
441296341Sdelphij
442238384Sjkim    OutString[0] = (char) ('@' + ((EisaId >> 26) & 0x1f));
443296341Sdelphij    OutString[1] = (char) ('@' + ((EisaId >> 21) & 0x1f));
444296341Sdelphij    OutString[2] = (char) ('@' + ((EisaId >> 16) & 0x1f));
445296341Sdelphij    OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12);
446296341Sdelphij    OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8);
447296341Sdelphij    OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4);
448296341Sdelphij    OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0);
449238384Sjkim    OutString[7] = 0;
450}
451
452
453/*******************************************************************************
454 *
455 * FUNCTION:    AcpiExUnsignedIntegerToString
456 *
457 * PARAMETERS:  Value           - Value to be converted
458 *              OutString       - Where to put the converted string (8 bytes)
459 *
460 * RETURN:      Convert a number to string representation
461 *
462 ******************************************************************************/
463
464void
465AcpiExUnsignedIntegerToString (
466    ACPI_INTEGER            Value,
467    NATIVE_CHAR             *OutString)
468{
469    UINT32                  Count;
470    UINT32                  DigitsNeeded;
471    UINT32                  Remainder;
472    ACPI_INTEGER            Quotient;
473
474
475    ACPI_FUNCTION_ENTRY ();
476
477
478    DigitsNeeded = AcpiExDigitsNeeded (Value, 10);
479    OutString[DigitsNeeded] = 0;
480
481    for (Count = DigitsNeeded; Count > 0; Count--)
482    {
483        (void) AcpiUtShortDivide (&Value, 10, &Quotient, &Remainder);
484        OutString[Count-1] = (NATIVE_CHAR) ('0' + Remainder);\
485        Value = Quotient;
486    }
487}
488
489#endif
490