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