Merge from vendor branch DHCP:
[dragonfly.git] / sys / contrib / dev / acpica-unix-20040527 / utilities / utmisc.c
1 /*******************************************************************************
2  *
3  * Module Name: utmisc - common utility procedures
4  *              $Revision: 100 $
5  *
6  ******************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116
117
118 #define __UTMISC_C__
119
120 #include "acpi.h"
121 #include "acnamesp.h"
122
123
124 #define _COMPONENT          ACPI_UTILITIES
125         ACPI_MODULE_NAME    ("utmisc")
126
127
128 /*******************************************************************************
129  *
130  * FUNCTION:    AcpiUtPrintString
131  *
132  * PARAMETERS:  String          - Null terminated ASCII string
133  *
134  * RETURN:      None
135  *
136  * DESCRIPTION: Dump an ASCII string with support for ACPI-defined escape
137  *              sequences.
138  *
139  ******************************************************************************/
140
141 void
142 AcpiUtPrintString (
143     char                    *String,
144     UINT8                   MaxLength)
145 {
146     UINT32                  i;
147
148
149     if (!String)
150     {
151         AcpiOsPrintf ("<\"NULL STRING PTR\">");
152         return;
153     }
154
155     AcpiOsPrintf ("\"");
156     for (i = 0; String[i] && (i < MaxLength); i++)
157     {
158         /* Escape sequences */
159
160         switch (String[i])
161         {
162         case 0x07:
163             AcpiOsPrintf ("\\a");        /* BELL */
164             break;
165
166         case 0x08:
167             AcpiOsPrintf ("\\b");       /* BACKSPACE */
168             break;
169
170         case 0x0C:
171             AcpiOsPrintf ("\\f");       /* FORMFEED */
172             break;
173
174         case 0x0A:
175             AcpiOsPrintf ("\\n");       /* LINEFEED */
176             break;
177
178         case 0x0D:
179             AcpiOsPrintf ("\\r");       /* CARRIAGE RETURN*/
180             break;
181
182         case 0x09:
183             AcpiOsPrintf ("\\t");       /* HORIZONTAL TAB */
184             break;
185
186         case 0x0B:
187             AcpiOsPrintf ("\\v");       /* VERTICAL TAB */
188             break;
189
190         case '\'':                      /* Single Quote */
191         case '\"':                      /* Double Quote */
192         case '\\':                      /* Backslash */
193             AcpiOsPrintf ("\\%c", (int) String[i]);
194             break;
195
196         default:
197
198             /* Check for printable character or hex escape */
199
200             if (ACPI_IS_PRINT (String[i]))
201             {
202                 /* This is a normal character */
203
204                 AcpiOsPrintf ("%c", (int) String[i]);
205             }
206             else
207             {
208                 /* All others will be Hex escapes */
209
210                 AcpiOsPrintf ("\\x%2.2X", (INT32) String[i]);
211             }
212             break;
213         }
214     }
215     AcpiOsPrintf ("\"");
216
217     if (i == MaxLength && String[i])
218     {
219         AcpiOsPrintf ("...");
220     }
221 }
222
223
224 /*******************************************************************************
225  *
226  * FUNCTION:    AcpiUtDwordByteSwap
227  *
228  * PARAMETERS:  Value           - Value to be converted
229  *
230  * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
231  *
232  ******************************************************************************/
233
234 UINT32
235 AcpiUtDwordByteSwap (
236     UINT32                  Value)
237 {
238     union
239     {
240         UINT32              Value;
241         UINT8               Bytes[4];
242     } Out;
243
244     union
245     {
246         UINT32              Value;
247         UINT8               Bytes[4];
248     } In;
249
250
251     ACPI_FUNCTION_ENTRY ();
252
253
254     In.Value = Value;
255
256     Out.Bytes[0] = In.Bytes[3];
257     Out.Bytes[1] = In.Bytes[2];
258     Out.Bytes[2] = In.Bytes[1];
259     Out.Bytes[3] = In.Bytes[0];
260
261     return (Out.Value);
262 }
263
264
265 /*******************************************************************************
266  *
267  * FUNCTION:    AcpiUtSetIntegerWidth
268  *
269  * PARAMETERS:  Revision            From DSDT header
270  *
271  * RETURN:      None
272  *
273  * DESCRIPTION: Set the global integer bit width based upon the revision
274  *              of the DSDT.  For Revision 1 and 0, Integers are 32 bits.
275  *              For Revision 2 and above, Integers are 64 bits.  Yes, this
276  *              makes a difference.
277  *
278  ******************************************************************************/
279
280 void
281 AcpiUtSetIntegerWidth (
282     UINT8                   Revision)
283 {
284
285     if (Revision <= 1)
286     {
287         AcpiGbl_IntegerBitWidth    = 32;
288         AcpiGbl_IntegerNybbleWidth = 8;
289         AcpiGbl_IntegerByteWidth   = 4;
290     }
291     else
292     {
293         AcpiGbl_IntegerBitWidth    = 64;
294         AcpiGbl_IntegerNybbleWidth = 16;
295         AcpiGbl_IntegerByteWidth   = 8;
296     }
297 }
298
299
300 #ifdef ACPI_DEBUG_OUTPUT
301 /*******************************************************************************
302  *
303  * FUNCTION:    AcpiUtDisplayInitPathname
304  *
305  * PARAMETERS:  ObjHandle           - Handle whose pathname will be displayed
306  *              Path                - Additional path string to be appended.
307  *                                      (NULL if no extra path)
308  *
309  * RETURN:      ACPI_STATUS
310  *
311  * DESCRIPTION: Display full pathname of an object, DEBUG ONLY
312  *
313  ******************************************************************************/
314
315 void
316 AcpiUtDisplayInitPathname (
317     UINT8                   Type,
318     ACPI_NAMESPACE_NODE     *ObjHandle,
319     char                    *Path)
320 {
321     ACPI_STATUS             Status;
322     ACPI_BUFFER             Buffer;
323
324
325     ACPI_FUNCTION_ENTRY ();
326
327
328     /* Only print the path if the appropriate debug level is enabled */
329
330     if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
331     {
332         return;
333     }
334
335     /* Get the full pathname to the node */
336
337     Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
338     Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
339     if (ACPI_FAILURE (Status))
340     {
341         return;
342     }
343
344     /* Print what we're doing */
345
346     switch (Type)
347     {
348     case ACPI_TYPE_METHOD:
349         AcpiOsPrintf ("Executing    ");
350         break;
351
352     default:
353         AcpiOsPrintf ("Initializing ");
354         break;
355     }
356
357     /* Print the object type and pathname */
358
359     AcpiOsPrintf ("%-12s  %s", AcpiUtGetTypeName (Type), (char *) Buffer.Pointer);
360
361     /* Extra path is used to append names like _STA, _INI, etc. */
362
363     if (Path)
364     {
365         AcpiOsPrintf (".%s", Path);
366     }
367     AcpiOsPrintf ("\n");
368
369     ACPI_MEM_FREE (Buffer.Pointer);
370 }
371 #endif
372
373
374 /*******************************************************************************
375  *
376  * FUNCTION:    AcpiUtValidAcpiName
377  *
378  * PARAMETERS:  Character           - The character to be examined
379  *
380  * RETURN:      1 if Character may appear in a name, else 0
381  *
382  * DESCRIPTION: Check for a valid ACPI name.  Each character must be one of:
383  *              1) Upper case alpha
384  *              2) numeric
385  *              3) underscore
386  *
387  ******************************************************************************/
388
389 BOOLEAN
390 AcpiUtValidAcpiName (
391     UINT32                  Name)
392 {
393     char                    *NamePtr = (char *) &Name;
394     char                    Character;
395     ACPI_NATIVE_UINT        i;
396
397
398     ACPI_FUNCTION_ENTRY ();
399
400
401     for (i = 0; i < ACPI_NAME_SIZE; i++)
402     {
403         Character = *NamePtr;
404         NamePtr++;
405
406         if (!((Character == '_') ||
407               (Character >= 'A' && Character <= 'Z') ||
408               (Character >= '0' && Character <= '9')))
409         {
410             return (FALSE);
411         }
412     }
413
414     return (TRUE);
415 }
416
417
418 /*******************************************************************************
419  *
420  * FUNCTION:    AcpiUtValidAcpiCharacter
421  *
422  * PARAMETERS:  Character           - The character to be examined
423  *
424  * RETURN:      1 if Character may appear in a name, else 0
425  *
426  * DESCRIPTION: Check for a printable character
427  *
428  ******************************************************************************/
429
430 BOOLEAN
431 AcpiUtValidAcpiCharacter (
432     char                    Character)
433 {
434
435     ACPI_FUNCTION_ENTRY ();
436
437     return ((BOOLEAN)   ((Character == '_') ||
438                         (Character >= 'A' && Character <= 'Z') ||
439                         (Character >= '0' && Character <= '9')));
440 }
441
442
443 /*******************************************************************************
444  *
445  * FUNCTION:    AcpiUtStrtoul64
446  *
447  * PARAMETERS:  String          - Null terminated string
448  *              Terminater      - Where a pointer to the terminating byte is returned
449  *              Base            - Radix of the string
450  *
451  * RETURN:      Converted value
452  *
453  * DESCRIPTION: Convert a string into an unsigned value.
454  *
455  ******************************************************************************/
456 #define NEGATIVE    1
457 #define POSITIVE    0
458
459 ACPI_STATUS
460 AcpiUtStrtoul64 (
461     char                    *String,
462     UINT32                  Base,
463     ACPI_INTEGER            *RetInteger)
464 {
465     UINT32                  Index;
466     ACPI_INTEGER            ReturnValue = 0;
467     ACPI_STATUS             Status = AE_OK;
468     ACPI_INTEGER            Dividend;
469     ACPI_INTEGER            Quotient;
470
471
472     *RetInteger = 0;
473
474     switch (Base)
475     {
476     case 0:
477     case 8:
478     case 10:
479     case 16:
480         break;
481
482     default:
483         /*
484          * The specified Base parameter is not in the domain of
485          * this function:
486          */
487         return (AE_BAD_PARAMETER);
488     }
489
490     /*
491      * skip over any white space in the buffer:
492      */
493     while (ACPI_IS_SPACE (*String) || *String == '\t')
494     {
495         ++String;
496     }
497
498     /*
499      * If the input parameter Base is zero, then we need to
500      * determine if it is octal, decimal, or hexadecimal:
501      */
502     if (Base == 0)
503     {
504         if (*String == '0')
505         {
506             if (ACPI_TOLOWER (*(++String)) == 'x')
507             {
508                 Base = 16;
509                 ++String;
510             }
511             else
512             {
513                 Base = 8;
514             }
515         }
516         else
517         {
518             Base = 10;
519         }
520     }
521
522     /*
523      * For octal and hexadecimal bases, skip over the leading
524      * 0 or 0x, if they are present.
525      */
526     if (Base == 8 && *String == '0')
527     {
528         String++;
529     }
530
531     if (Base == 16 &&
532         *String == '0' &&
533         ACPI_TOLOWER (*(++String)) == 'x')
534     {
535         String++;
536     }
537
538     /* Main loop: convert the string to an unsigned long */
539
540     while (*String)
541     {
542         if (ACPI_IS_DIGIT (*String))
543         {
544             Index = ((UINT8) *String) - '0';
545         }
546         else
547         {
548             Index = (UINT8) ACPI_TOUPPER (*String);
549             if (ACPI_IS_UPPER ((char) Index))
550             {
551                 Index = Index - 'A' + 10;
552             }
553             else
554             {
555                 goto ErrorExit;
556             }
557         }
558
559         if (Index >= Base)
560         {
561             goto ErrorExit;
562         }
563
564         /* Check to see if value is out of range: */
565
566         Dividend = ACPI_INTEGER_MAX - (ACPI_INTEGER) Index;
567         (void) AcpiUtShortDivide (&Dividend, Base, &Quotient, NULL);
568         if (ReturnValue > Quotient)
569         {
570             goto ErrorExit;
571         }
572
573         ReturnValue *= Base;
574         ReturnValue += Index;
575         ++String;
576     }
577
578     *RetInteger = ReturnValue;
579     return (Status);
580
581
582 ErrorExit:
583     switch (Base)
584     {
585     case 8:
586         Status = AE_BAD_OCTAL_CONSTANT;
587         break;
588
589     case 10:
590         Status = AE_BAD_DECIMAL_CONSTANT;
591         break;
592
593     case 16:
594         Status = AE_BAD_HEX_CONSTANT;
595         break;
596
597     default:
598         /* Base validated above */
599         break;
600     }
601
602     return (Status);
603 }
604
605
606 /*******************************************************************************
607  *
608  * FUNCTION:    AcpiUtStrupr
609  *
610  * PARAMETERS:  SrcString       - The source string to convert to
611  *
612  * RETURN:      SrcString
613  *
614  * DESCRIPTION: Convert string to uppercase
615  *
616  ******************************************************************************/
617
618 char *
619 AcpiUtStrupr (
620     char                    *SrcString)
621 {
622     char                    *String;
623
624
625     ACPI_FUNCTION_ENTRY ();
626
627
628     /* Walk entire string, uppercasing the letters */
629
630     for (String = SrcString; *String; )
631     {
632         *String = (char) ACPI_TOUPPER (*String);
633         String++;
634     }
635
636     return (SrcString);
637 }
638
639
640 /*******************************************************************************
641  *
642  * FUNCTION:    AcpiUtMutexInitialize
643  *
644  * PARAMETERS:  None.
645  *
646  * RETURN:      Status
647  *
648  * DESCRIPTION: Create the system mutex objects.
649  *
650  ******************************************************************************/
651
652 ACPI_STATUS
653 AcpiUtMutexInitialize (
654     void)
655 {
656     UINT32                  i;
657     ACPI_STATUS             Status;
658
659
660     ACPI_FUNCTION_TRACE ("UtMutexInitialize");
661
662
663     /*
664      * Create each of the predefined mutex objects
665      */
666     for (i = 0; i < NUM_MUTEX; i++)
667     {
668         Status = AcpiUtCreateMutex (i);
669         if (ACPI_FAILURE (Status))
670         {
671             return_ACPI_STATUS (Status);
672         }
673     }
674
675     Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
676     return_ACPI_STATUS (Status);
677 }
678
679
680 /*******************************************************************************
681  *
682  * FUNCTION:    AcpiUtMutexTerminate
683  *
684  * PARAMETERS:  None.
685  *
686  * RETURN:      None.
687  *
688  * DESCRIPTION: Delete all of the system mutex objects.
689  *
690  ******************************************************************************/
691
692 void
693 AcpiUtMutexTerminate (
694     void)
695 {
696     UINT32                  i;
697
698
699     ACPI_FUNCTION_TRACE ("UtMutexTerminate");
700
701
702     /*
703      * Delete each predefined mutex object
704      */
705     for (i = 0; i < NUM_MUTEX; i++)
706     {
707         (void) AcpiUtDeleteMutex (i);
708     }
709
710     AcpiOsDeleteLock (AcpiGbl_GpeLock);
711     return_VOID;
712 }
713
714
715 /*******************************************************************************
716  *
717  * FUNCTION:    AcpiUtCreateMutex
718  *
719  * PARAMETERS:  MutexID         - ID of the mutex to be created
720  *
721  * RETURN:      Status
722  *
723  * DESCRIPTION: Create a mutex object.
724  *
725  ******************************************************************************/
726
727 ACPI_STATUS
728 AcpiUtCreateMutex (
729     ACPI_MUTEX_HANDLE       MutexId)
730 {
731     ACPI_STATUS             Status = AE_OK;
732
733
734     ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
735
736
737     if (MutexId > MAX_MUTEX)
738     {
739         return_ACPI_STATUS (AE_BAD_PARAMETER);
740     }
741
742     if (!AcpiGbl_MutexInfo[MutexId].Mutex)
743     {
744         Status = AcpiOsCreateSemaphore (1, 1,
745                         &AcpiGbl_MutexInfo[MutexId].Mutex);
746         AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
747         AcpiGbl_MutexInfo[MutexId].UseCount = 0;
748     }
749
750     return_ACPI_STATUS (Status);
751 }
752
753
754 /*******************************************************************************
755  *
756  * FUNCTION:    AcpiUtDeleteMutex
757  *
758  * PARAMETERS:  MutexID         - ID of the mutex to be deleted
759  *
760  * RETURN:      Status
761  *
762  * DESCRIPTION: Delete a mutex object.
763  *
764  ******************************************************************************/
765
766 ACPI_STATUS
767 AcpiUtDeleteMutex (
768     ACPI_MUTEX_HANDLE       MutexId)
769 {
770     ACPI_STATUS             Status;
771
772
773     ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
774
775
776     if (MutexId > MAX_MUTEX)
777     {
778         return_ACPI_STATUS (AE_BAD_PARAMETER);
779     }
780
781     Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex);
782
783     AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
784     AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
785
786     return_ACPI_STATUS (Status);
787 }
788
789
790 /*******************************************************************************
791  *
792  * FUNCTION:    AcpiUtAcquireMutex
793  *
794  * PARAMETERS:  MutexID         - ID of the mutex to be acquired
795  *
796  * RETURN:      Status
797  *
798  * DESCRIPTION: Acquire a mutex object.
799  *
800  ******************************************************************************/
801
802 ACPI_STATUS
803 AcpiUtAcquireMutex (
804     ACPI_MUTEX_HANDLE       MutexId)
805 {
806     ACPI_STATUS             Status;
807     UINT32                  i;
808     UINT32                  ThisThreadId;
809
810
811     ACPI_FUNCTION_NAME ("UtAcquireMutex");
812
813
814     if (MutexId > MAX_MUTEX)
815     {
816         return (AE_BAD_PARAMETER);
817     }
818
819     ThisThreadId = AcpiOsGetThreadId ();
820
821     /*
822      * Deadlock prevention.  Check if this thread owns any mutexes of value
823      * greater than or equal to this one.  If so, the thread has violated
824      * the mutex ordering rule.  This indicates a coding error somewhere in
825      * the ACPI subsystem code.
826      */
827     for (i = MutexId; i < MAX_MUTEX; i++)
828     {
829         if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
830         {
831             if (i == MutexId)
832             {
833                 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
834                         "Mutex [%s] already acquired by this thread [%X]\n",
835                         AcpiUtGetMutexName (MutexId), ThisThreadId));
836
837                 return (AE_ALREADY_ACQUIRED);
838             }
839
840             ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
841                     "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
842                     ThisThreadId, AcpiUtGetMutexName (i),
843                     AcpiUtGetMutexName (MutexId)));
844
845             return (AE_ACQUIRE_DEADLOCK);
846         }
847     }
848
849     ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
850                 "Thread %X attempting to acquire Mutex [%s]\n",
851                 ThisThreadId, AcpiUtGetMutexName (MutexId)));
852
853     Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex,
854                                     1, ACPI_WAIT_FOREVER);
855     if (ACPI_SUCCESS (Status))
856     {
857         ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
858                     ThisThreadId, AcpiUtGetMutexName (MutexId)));
859
860         AcpiGbl_MutexInfo[MutexId].UseCount++;
861         AcpiGbl_MutexInfo[MutexId].OwnerId = ThisThreadId;
862     }
863     else
864     {
865         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n",
866                     ThisThreadId, AcpiUtGetMutexName (MutexId),
867                     AcpiFormatException (Status)));
868     }
869
870     return (Status);
871 }
872
873
874 /*******************************************************************************
875  *
876  * FUNCTION:    AcpiUtReleaseMutex
877  *
878  * PARAMETERS:  MutexID         - ID of the mutex to be released
879  *
880  * RETURN:      Status
881  *
882  * DESCRIPTION: Release a mutex object.
883  *
884  ******************************************************************************/
885
886 ACPI_STATUS
887 AcpiUtReleaseMutex (
888     ACPI_MUTEX_HANDLE       MutexId)
889 {
890     ACPI_STATUS             Status;
891     UINT32                  i;
892     UINT32                  ThisThreadId;
893
894
895     ACPI_FUNCTION_NAME ("UtReleaseMutex");
896
897
898     ThisThreadId = AcpiOsGetThreadId ();
899     ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
900         "Thread %X releasing Mutex [%s]\n", ThisThreadId,
901         AcpiUtGetMutexName (MutexId)));
902
903     if (MutexId > MAX_MUTEX)
904     {
905         return (AE_BAD_PARAMETER);
906     }
907
908     /*
909      * Mutex must be acquired in order to release it!
910      */
911     if (AcpiGbl_MutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED)
912     {
913         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
914                 "Mutex [%s] is not acquired, cannot release\n",
915                 AcpiUtGetMutexName (MutexId)));
916
917         return (AE_NOT_ACQUIRED);
918     }
919
920     /*
921      * Deadlock prevention.  Check if this thread owns any mutexes of value
922      * greater than this one.  If so, the thread has violated the mutex
923      * ordering rule.  This indicates a coding error somewhere in
924      * the ACPI subsystem code.
925      */
926     for (i = MutexId; i < MAX_MUTEX; i++)
927     {
928         if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
929         {
930             if (i == MutexId)
931             {
932                 continue;
933             }
934
935             ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
936                     "Invalid release order: owns [%s], releasing [%s]\n",
937                     AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId)));
938
939             return (AE_RELEASE_DEADLOCK);
940         }
941     }
942
943     /* Mark unlocked FIRST */
944
945     AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
946
947     Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1);
948
949     if (ACPI_FAILURE (Status))
950     {
951         ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n",
952                     ThisThreadId, AcpiUtGetMutexName (MutexId),
953                     AcpiFormatException (Status)));
954     }
955     else
956     {
957         ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
958                     ThisThreadId, AcpiUtGetMutexName (MutexId)));
959     }
960
961     return (Status);
962 }
963
964
965 /*******************************************************************************
966  *
967  * FUNCTION:    AcpiUtCreateUpdateStateAndPush
968  *
969  * PARAMETERS:  *Object         - Object to be added to the new state
970  *              Action          - Increment/Decrement
971  *              StateList       - List the state will be added to
972  *
973  * RETURN:      None
974  *
975  * DESCRIPTION: Create a new state and push it
976  *
977  ******************************************************************************/
978
979 ACPI_STATUS
980 AcpiUtCreateUpdateStateAndPush (
981     ACPI_OPERAND_OBJECT     *Object,
982     UINT16                  Action,
983     ACPI_GENERIC_STATE      **StateList)
984 {
985     ACPI_GENERIC_STATE       *State;
986
987
988     ACPI_FUNCTION_ENTRY ();
989
990
991     /* Ignore null objects; these are expected */
992
993     if (!Object)
994     {
995         return (AE_OK);
996     }
997
998     State = AcpiUtCreateUpdateState (Object, Action);
999     if (!State)
1000     {
1001         return (AE_NO_MEMORY);
1002     }
1003
1004     AcpiUtPushGenericState (StateList, State);
1005     return (AE_OK);
1006 }
1007
1008
1009 /*******************************************************************************
1010  *
1011  * FUNCTION:    AcpiUtCreatePkgStateAndPush
1012  *
1013  * PARAMETERS:  *Object         - Object to be added to the new state
1014  *              Action          - Increment/Decrement
1015  *              StateList       - List the state will be added to
1016  *
1017  * RETURN:      None
1018  *
1019  * DESCRIPTION: Create a new state and push it
1020  *
1021  ******************************************************************************/
1022
1023 ACPI_STATUS
1024 AcpiUtCreatePkgStateAndPush (
1025     void                    *InternalObject,
1026     void                    *ExternalObject,
1027     UINT16                  Index,
1028     ACPI_GENERIC_STATE      **StateList)
1029 {
1030     ACPI_GENERIC_STATE       *State;
1031
1032
1033     ACPI_FUNCTION_ENTRY ();
1034
1035
1036     State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index);
1037     if (!State)
1038     {
1039         return (AE_NO_MEMORY);
1040     }
1041
1042     AcpiUtPushGenericState (StateList, State);
1043     return (AE_OK);
1044 }
1045
1046
1047 /*******************************************************************************
1048  *
1049  * FUNCTION:    AcpiUtPushGenericState
1050  *
1051  * PARAMETERS:  ListHead            - Head of the state stack
1052  *              State               - State object to push
1053  *
1054  * RETURN:      Status
1055  *
1056  * DESCRIPTION: Push a state object onto a state stack
1057  *
1058  ******************************************************************************/
1059
1060 void
1061 AcpiUtPushGenericState (
1062     ACPI_GENERIC_STATE      **ListHead,
1063     ACPI_GENERIC_STATE      *State)
1064 {
1065     ACPI_FUNCTION_TRACE ("UtPushGenericState");
1066
1067
1068     /* Push the state object onto the front of the list (stack) */
1069
1070     State->Common.Next = *ListHead;
1071     *ListHead = State;
1072
1073     return_VOID;
1074 }
1075
1076
1077 /*******************************************************************************
1078  *
1079  * FUNCTION:    AcpiUtPopGenericState
1080  *
1081  * PARAMETERS:  ListHead            - Head of the state stack
1082  *
1083  * RETURN:      Status
1084  *
1085  * DESCRIPTION: Pop a state object from a state stack
1086  *
1087  ******************************************************************************/
1088
1089 ACPI_GENERIC_STATE *
1090 AcpiUtPopGenericState (
1091     ACPI_GENERIC_STATE      **ListHead)
1092 {
1093     ACPI_GENERIC_STATE      *State;
1094
1095
1096     ACPI_FUNCTION_TRACE ("UtPopGenericState");
1097
1098
1099     /* Remove the state object at the head of the list (stack) */
1100
1101     State = *ListHead;
1102     if (State)
1103     {
1104         /* Update the list head */
1105
1106         *ListHead = State->Common.Next;
1107     }
1108
1109     return_PTR (State);
1110 }
1111
1112
1113 /*******************************************************************************
1114  *
1115  * FUNCTION:    AcpiUtCreateGenericState
1116  *
1117  * PARAMETERS:  None
1118  *
1119  * RETURN:      Status
1120  *
1121  * DESCRIPTION: Create a generic state object.  Attempt to obtain one from
1122  *              the global state cache;  If none available, create a new one.
1123  *
1124  ******************************************************************************/
1125
1126 ACPI_GENERIC_STATE *
1127 AcpiUtCreateGenericState (void)
1128 {
1129     ACPI_GENERIC_STATE      *State;
1130
1131
1132     ACPI_FUNCTION_ENTRY ();
1133
1134
1135     State = AcpiUtAcquireFromCache (ACPI_MEM_LIST_STATE);
1136
1137     /* Initialize */
1138
1139     if (State)
1140     {
1141         State->Common.DataType = ACPI_DESC_TYPE_STATE;
1142     }
1143
1144     return (State);
1145 }
1146
1147
1148 /*******************************************************************************
1149  *
1150  * FUNCTION:    AcpiUtCreateThreadState
1151  *
1152  * PARAMETERS:  None
1153  *
1154  * RETURN:      Thread State
1155  *
1156  * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
1157  *              to track per-thread info during method execution
1158  *
1159  ******************************************************************************/
1160
1161 ACPI_THREAD_STATE *
1162 AcpiUtCreateThreadState (
1163     void)
1164 {
1165     ACPI_GENERIC_STATE      *State;
1166
1167
1168     ACPI_FUNCTION_TRACE ("UtCreateThreadState");
1169
1170
1171     /* Create the generic state object */
1172
1173     State = AcpiUtCreateGenericState ();
1174     if (!State)
1175     {
1176         return_PTR (NULL);
1177     }
1178
1179     /* Init fields specific to the update struct */
1180
1181     State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD;
1182     State->Thread.ThreadId = AcpiOsGetThreadId ();
1183
1184     return_PTR ((ACPI_THREAD_STATE *) State);
1185 }
1186
1187
1188 /*******************************************************************************
1189  *
1190  * FUNCTION:    AcpiUtCreateUpdateState
1191  *
1192  * PARAMETERS:  Object              - Initial Object to be installed in the
1193  *                                    state
1194  *              Action              - Update action to be performed
1195  *
1196  * RETURN:      Status
1197  *
1198  * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
1199  *              to update reference counts and delete complex objects such
1200  *              as packages.
1201  *
1202  ******************************************************************************/
1203
1204 ACPI_GENERIC_STATE *
1205 AcpiUtCreateUpdateState (
1206     ACPI_OPERAND_OBJECT     *Object,
1207     UINT16                  Action)
1208 {
1209     ACPI_GENERIC_STATE      *State;
1210
1211
1212     ACPI_FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
1213
1214
1215     /* Create the generic state object */
1216
1217     State = AcpiUtCreateGenericState ();
1218     if (!State)
1219     {
1220         return_PTR (NULL);
1221     }
1222
1223     /* Init fields specific to the update struct */
1224
1225     State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE;
1226     State->Update.Object = Object;
1227     State->Update.Value  = Action;
1228
1229     return_PTR (State);
1230 }
1231
1232
1233 /*******************************************************************************
1234  *
1235  * FUNCTION:    AcpiUtCreatePkgState
1236  *
1237  * PARAMETERS:  Object              - Initial Object to be installed in the
1238  *                                    state
1239  *              Action              - Update action to be performed
1240  *
1241  * RETURN:      Status
1242  *
1243  * DESCRIPTION: Create a "Package State"
1244  *
1245  ******************************************************************************/
1246
1247 ACPI_GENERIC_STATE *
1248 AcpiUtCreatePkgState (
1249     void                    *InternalObject,
1250     void                    *ExternalObject,
1251     UINT16                  Index)
1252 {
1253     ACPI_GENERIC_STATE      *State;
1254
1255
1256     ACPI_FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
1257
1258
1259     /* Create the generic state object */
1260
1261     State = AcpiUtCreateGenericState ();
1262     if (!State)
1263     {
1264         return_PTR (NULL);
1265     }
1266
1267     /* Init fields specific to the update struct */
1268
1269     State->Common.DataType  = ACPI_DESC_TYPE_STATE_PACKAGE;
1270     State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
1271     State->Pkg.DestObject   = ExternalObject;
1272     State->Pkg.Index        = Index;
1273     State->Pkg.NumPackages  = 1;
1274
1275     return_PTR (State);
1276 }
1277
1278
1279 /*******************************************************************************
1280  *
1281  * FUNCTION:    AcpiUtCreateControlState
1282  *
1283  * PARAMETERS:  None
1284  *
1285  * RETURN:      Status
1286  *
1287  * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
1288  *              to support nested IF/WHILE constructs in the AML.
1289  *
1290  ******************************************************************************/
1291
1292 ACPI_GENERIC_STATE *
1293 AcpiUtCreateControlState (
1294     void)
1295 {
1296     ACPI_GENERIC_STATE      *State;
1297
1298
1299     ACPI_FUNCTION_TRACE ("UtCreateControlState");
1300
1301
1302     /* Create the generic state object */
1303
1304     State = AcpiUtCreateGenericState ();
1305     if (!State)
1306     {
1307         return_PTR (NULL);
1308     }
1309
1310     /* Init fields specific to the control struct */
1311
1312     State->Common.DataType  = ACPI_DESC_TYPE_STATE_CONTROL;
1313     State->Common.State     = ACPI_CONTROL_CONDITIONAL_EXECUTING;
1314
1315     return_PTR (State);
1316 }
1317
1318
1319 /*******************************************************************************
1320  *
1321  * FUNCTION:    AcpiUtDeleteGenericState
1322  *
1323  * PARAMETERS:  State               - The state object to be deleted
1324  *
1325  * RETURN:      Status
1326  *
1327  * DESCRIPTION: Put a state object back into the global state cache.  The object
1328  *              is not actually freed at this time.
1329  *
1330  ******************************************************************************/
1331
1332 void
1333 AcpiUtDeleteGenericState (
1334     ACPI_GENERIC_STATE      *State)
1335 {
1336     ACPI_FUNCTION_TRACE ("UtDeleteGenericState");
1337
1338
1339     AcpiUtReleaseToCache (ACPI_MEM_LIST_STATE, State);
1340     return_VOID;
1341 }
1342
1343
1344 /*******************************************************************************
1345  *
1346  * FUNCTION:    AcpiUtDeleteGenericStateCache
1347  *
1348  * PARAMETERS:  None
1349  *
1350  * RETURN:      Status
1351  *
1352  * DESCRIPTION: Purge the global state object cache.  Used during subsystem
1353  *              termination.
1354  *
1355  ******************************************************************************/
1356
1357 void
1358 AcpiUtDeleteGenericStateCache (
1359     void)
1360 {
1361     ACPI_FUNCTION_TRACE ("UtDeleteGenericStateCache");
1362
1363
1364     AcpiUtDeleteGenericCache (ACPI_MEM_LIST_STATE);
1365     return_VOID;
1366 }
1367
1368
1369 /*******************************************************************************
1370  *
1371  * FUNCTION:    AcpiUtWalkPackageTree
1372  *
1373  * PARAMETERS:  ObjDesc         - The Package object on which to resolve refs
1374  *
1375  * RETURN:      Status
1376  *
1377  * DESCRIPTION: Walk through a package
1378  *
1379  ******************************************************************************/
1380
1381 ACPI_STATUS
1382 AcpiUtWalkPackageTree (
1383     ACPI_OPERAND_OBJECT     *SourceObject,
1384     void                    *TargetObject,
1385     ACPI_PKG_CALLBACK       WalkCallback,
1386     void                    *Context)
1387 {
1388     ACPI_STATUS             Status = AE_OK;
1389     ACPI_GENERIC_STATE      *StateList = NULL;
1390     ACPI_GENERIC_STATE      *State;
1391     UINT32                  ThisIndex;
1392     ACPI_OPERAND_OBJECT     *ThisSourceObj;
1393
1394
1395     ACPI_FUNCTION_TRACE ("UtWalkPackageTree");
1396
1397
1398     State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0);
1399     if (!State)
1400     {
1401         return_ACPI_STATUS (AE_NO_MEMORY);
1402     }
1403
1404     while (State)
1405     {
1406         /* Get one element of the package */
1407
1408         ThisIndex     = State->Pkg.Index;
1409         ThisSourceObj = (ACPI_OPERAND_OBJECT *)
1410                         State->Pkg.SourceObject->Package.Elements[ThisIndex];
1411
1412         /*
1413          * Check for:
1414          * 1) An uninitialized package element.  It is completely
1415          *    legal to declare a package and leave it uninitialized
1416          * 2) Not an internal object - can be a namespace node instead
1417          * 3) Any type other than a package.  Packages are handled in else
1418          *    case below.
1419          */
1420         if ((!ThisSourceObj) ||
1421             (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) ||
1422             (ACPI_GET_OBJECT_TYPE (ThisSourceObj) != ACPI_TYPE_PACKAGE))
1423         {
1424             Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj,
1425                                     State, Context);
1426             if (ACPI_FAILURE (Status))
1427             {
1428                 return_ACPI_STATUS (Status);
1429             }
1430
1431             State->Pkg.Index++;
1432             while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count)
1433             {
1434                 /*
1435                  * We've handled all of the objects at this level,  This means
1436                  * that we have just completed a package.  That package may
1437                  * have contained one or more packages itself.
1438                  *
1439                  * Delete this state and pop the previous state (package).
1440                  */
1441                 AcpiUtDeleteGenericState (State);
1442                 State = AcpiUtPopGenericState (&StateList);
1443
1444                 /* Finished when there are no more states */
1445
1446                 if (!State)
1447                 {
1448                     /*
1449                      * We have handled all of the objects in the top level
1450                      * package just add the length of the package objects
1451                      * and exit
1452                      */
1453                     return_ACPI_STATUS (AE_OK);
1454                 }
1455
1456                 /*
1457                  * Go back up a level and move the index past the just
1458                  * completed package object.
1459                  */
1460                 State->Pkg.Index++;
1461             }
1462         }
1463         else
1464         {
1465             /* This is a subobject of type package */
1466
1467             Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj,
1468                                         State, Context);
1469             if (ACPI_FAILURE (Status))
1470             {
1471                 return_ACPI_STATUS (Status);
1472             }
1473
1474             /*
1475              * Push the current state and create a new one
1476              * The callback above returned a new target package object.
1477              */
1478             AcpiUtPushGenericState (&StateList, State);
1479             State = AcpiUtCreatePkgState (ThisSourceObj,
1480                                             State->Pkg.ThisTargetObj, 0);
1481             if (!State)
1482             {
1483                 return_ACPI_STATUS (AE_NO_MEMORY);
1484             }
1485         }
1486     }
1487
1488     /* We should never get here */
1489
1490     return_ACPI_STATUS (AE_AML_INTERNAL);
1491 }
1492
1493
1494 /*******************************************************************************
1495  *
1496  * FUNCTION:    AcpiUtGenerateChecksum
1497  *
1498  * PARAMETERS:  Buffer          - Buffer to be scanned
1499  *              Length          - number of bytes to examine
1500  *
1501  * RETURN:      checksum
1502  *
1503  * DESCRIPTION: Generate a checksum on a raw buffer
1504  *
1505  ******************************************************************************/
1506
1507 UINT8
1508 AcpiUtGenerateChecksum (
1509     UINT8                   *Buffer,
1510     UINT32                  Length)
1511 {
1512     UINT32                  i;
1513     signed char             Sum = 0;
1514
1515
1516     for (i = 0; i < Length; i++)
1517     {
1518         Sum = (signed char) (Sum + Buffer[i]);
1519     }
1520
1521     return ((UINT8) (0 - Sum));
1522 }
1523
1524
1525 /*******************************************************************************
1526  *
1527  * FUNCTION:    AcpiUtGetResourceEndTag
1528  *
1529  * PARAMETERS:  ObjDesc         - The resource template buffer object
1530  *
1531  * RETURN:      Pointer to the end tag
1532  *
1533  * DESCRIPTION: Find the END_TAG resource descriptor in a resource template
1534  *
1535  ******************************************************************************/
1536
1537
1538 UINT8 *
1539 AcpiUtGetResourceEndTag (
1540     ACPI_OPERAND_OBJECT     *ObjDesc)
1541 {
1542     UINT8                   BufferByte;
1543     UINT8                   *Buffer;
1544     UINT8                   *EndBuffer;
1545
1546
1547     Buffer    = ObjDesc->Buffer.Pointer;
1548     EndBuffer = Buffer + ObjDesc->Buffer.Length;
1549
1550     while (Buffer < EndBuffer)
1551     {
1552         BufferByte = *Buffer;
1553         if (BufferByte & ACPI_RDESC_TYPE_MASK)
1554         {
1555             /* Large Descriptor - Length is next 2 bytes */
1556
1557             Buffer += ((*(Buffer+1) | (*(Buffer+2) << 8)) + 3);
1558         }
1559         else
1560         {
1561             /* Small Descriptor.  End Tag will be found here */
1562
1563             if ((BufferByte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG)
1564             {
1565                 /* Found the end tag descriptor, all done. */
1566
1567                 return (Buffer);
1568             }
1569
1570             /* Length is in the header */
1571
1572             Buffer += ((BufferByte & 0x07) + 1);
1573         }
1574     }
1575
1576     /* End tag not found */
1577
1578     return (NULL);
1579 }
1580
1581
1582 /*******************************************************************************
1583  *
1584  * FUNCTION:    AcpiUtReportError
1585  *
1586  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
1587  *              LineNumber          - Caller's line number (for error output)
1588  *              ComponentId         - Caller's component ID (for error output)
1589  *              Message             - Error message to use on failure
1590  *
1591  * RETURN:      None
1592  *
1593  * DESCRIPTION: Print error message
1594  *
1595  ******************************************************************************/
1596
1597 void
1598 AcpiUtReportError (
1599     char                    *ModuleName,
1600     UINT32                  LineNumber,
1601     UINT32                  ComponentId)
1602 {
1603
1604
1605     AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber);
1606 }
1607
1608
1609 /*******************************************************************************
1610  *
1611  * FUNCTION:    AcpiUtReportWarning
1612  *
1613  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
1614  *              LineNumber          - Caller's line number (for error output)
1615  *              ComponentId         - Caller's component ID (for error output)
1616  *              Message             - Error message to use on failure
1617  *
1618  * RETURN:      None
1619  *
1620  * DESCRIPTION: Print warning message
1621  *
1622  ******************************************************************************/
1623
1624 void
1625 AcpiUtReportWarning (
1626     char                    *ModuleName,
1627     UINT32                  LineNumber,
1628     UINT32                  ComponentId)
1629 {
1630
1631     AcpiOsPrintf ("%8s-%04d: *** Warning: ", ModuleName, LineNumber);
1632 }
1633
1634
1635 /*******************************************************************************
1636  *
1637  * FUNCTION:    AcpiUtReportInfo
1638  *
1639  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
1640  *              LineNumber          - Caller's line number (for error output)
1641  *              ComponentId         - Caller's component ID (for error output)
1642  *              Message             - Error message to use on failure
1643  *
1644  * RETURN:      None
1645  *
1646  * DESCRIPTION: Print information message
1647  *
1648  ******************************************************************************/
1649
1650 void
1651 AcpiUtReportInfo (
1652     char                    *ModuleName,
1653     UINT32                  LineNumber,
1654     UINT32                  ComponentId)
1655 {
1656
1657     AcpiOsPrintf ("%8s-%04d: *** Info: ", ModuleName, LineNumber);
1658 }
1659
1660