Merge from vendor branch GCC:
[dragonfly.git] / sys / contrib / dev / acpica-unix-20031203 / osunixxf.c
1 /******************************************************************************
2  *
3  * Module Name: osunixxf - UNIX OSL interfaces
4  *
5  *****************************************************************************/
6
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights.  You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code.  No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision.  In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change.  Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee.  Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution.  In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government.  In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115
116
117 /*
118  * These interfaces are required in order to compile the ASL compiler under
119  * Linux.
120  */
121
122 #include <stdio.h>
123 #include <stdlib.h>
124 #include <stdarg.h>
125 #include <unistd.h>
126 #include <sys/time.h>
127
128 #include "acpi.h"
129 #include "amlcode.h"
130 #include "acparser.h"
131 #include "acdebug.h"
132
133 #define _COMPONENT          ACPI_OS_SERVICES
134         ACPI_MODULE_NAME    ("osunixxf")
135
136
137 extern FILE                    *AcpiGbl_DebugFile;
138 FILE                           *AcpiGbl_OutputFile;
139
140
141 /******************************************************************************
142  *
143  * FUNCTION:    AcpiOsInitialize, AcpiOsTerminate
144  *
145  * PARAMETERS:  None
146  *
147  * RETURN:      Status
148  *
149  * DESCRIPTION: Init and terminate.  Nothing to do.
150  *
151  *****************************************************************************/
152
153 ACPI_STATUS
154 AcpiOsInitialize (void)
155 {
156     AcpiGbl_OutputFile = stdout;
157
158     return AE_OK;
159 }
160
161
162 ACPI_STATUS
163 AcpiOsTerminate (void)
164 {
165     return AE_OK;
166 }
167
168
169 /******************************************************************************
170  *
171  * FUNCTION:    AcpiOsGetRootPointer
172  *
173  * PARAMETERS:  Flags   - Logical or physical addressing mode
174  *              Address - Where the address is returned
175  *
176  * RETURN:      Status
177  *
178  * DESCRIPTION: Gets the root pointer (RSDP)
179  *
180  *****************************************************************************/
181
182 ACPI_STATUS
183 AcpiOsGetRootPointer (
184     UINT32                  Flags,
185     ACPI_POINTER           *Address)
186 {
187
188     return (AE_OK);
189 }
190
191
192 /******************************************************************************
193  *
194  * FUNCTION:    AcpiOsPredefinedOverride
195  *
196  * PARAMETERS:  InitVal     - Initial value of the predefined object
197  *              NewVal      - The new value for the object
198  *
199  * RETURN:      Status, pointer to value.  Null pointer returned if not
200  *              overriding.
201  *
202  * DESCRIPTION: Allow the OS to override predefined names
203  *
204  *****************************************************************************/
205
206 ACPI_STATUS
207 AcpiOsPredefinedOverride (
208     const ACPI_PREDEFINED_NAMES *InitVal,
209     ACPI_STRING                 *NewVal)
210 {
211
212     if (!InitVal || !NewVal)
213     {
214         return (AE_BAD_PARAMETER);
215     }
216
217     *NewVal = NULL;
218     return (AE_OK);
219 }
220
221
222 /******************************************************************************
223  *
224  * FUNCTION:    AcpiOsTableOverride
225  *
226  * PARAMETERS:  ExistingTable   - Header of current table (probably firmware)
227  *              NewTable        - Where an entire new table is returned.
228  *
229  * RETURN:      Status, pointer to new table.  Null pointer returned if no
230  *              table is available to override
231  *
232  * DESCRIPTION: Return a different version of a table if one is available
233  *
234  *****************************************************************************/
235
236 ACPI_STATUS
237 AcpiOsTableOverride (
238     ACPI_TABLE_HEADER       *ExistingTable,
239     ACPI_TABLE_HEADER       **NewTable)
240 {
241     if (!ExistingTable || !NewTable)
242     {
243         return (AE_BAD_PARAMETER);
244     }
245
246     /* TODO: Add table-getting code here */
247     *NewTable = NULL;
248     return (AE_NO_ACPI_TABLES);
249 }
250
251
252 /******************************************************************************
253  *
254  * FUNCTION:    AcpiOsReadable
255  *
256  * PARAMETERS:  Pointer             - Area to be verified
257  *              Length              - Size of area
258  *
259  * RETURN:      TRUE if readable for entire length
260  *
261  * DESCRIPTION: Verify that a pointer is valid for reading
262  *
263  *****************************************************************************/
264
265 BOOLEAN
266 AcpiOsReadable (
267     void                    *Pointer,
268     ACPI_SIZE               Length)
269 {
270
271     return (TRUE);
272 }
273
274
275 /******************************************************************************
276  *
277  * FUNCTION:    AcpiOsWritable
278  *
279  * PARAMETERS:  Pointer             - Area to be verified
280  *              Length              - Size of area
281  *
282  * RETURN:      TRUE if writable for entire length
283  *
284  * DESCRIPTION: Verify that a pointer is valid for writing
285  *
286  *****************************************************************************/
287
288 BOOLEAN
289 AcpiOsWritable (
290     void                    *Pointer,
291     ACPI_SIZE               Length)
292 {
293
294     return (TRUE);
295 }
296
297
298 /******************************************************************************
299  *
300  * FUNCTION:    AcpiOsRedirectOutput
301  *
302  * PARAMETERS:  Destination         - An open file handle/pointer
303  *
304  * RETURN:      None
305  *
306  * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
307  *
308  *****************************************************************************/
309
310 void
311 AcpiOsRedirectOutput (
312     void                    *Destination)
313 {
314
315     AcpiGbl_OutputFile = Destination;
316 }
317
318
319 /******************************************************************************
320  *
321  * FUNCTION:    AcpiOsPrintf
322  *
323  * PARAMETERS:  fmt, ...            Standard printf format
324  *
325  * RETURN:      None
326  *
327  * DESCRIPTION: Formatted output
328  *
329  *****************************************************************************/
330
331 void ACPI_INTERNAL_VAR_XFACE
332 AcpiOsPrintf (
333     const char              *Fmt,
334     ...)
335 {
336     va_list                 Args;
337
338
339     va_start (Args, Fmt);
340
341     AcpiOsVprintf (Fmt, Args);
342
343     va_end (Args);
344     return;
345 }
346
347
348 /******************************************************************************
349  *
350  * FUNCTION:    AcpiOsVprintf
351  *
352  * PARAMETERS:  fmt                 Standard printf format
353  *              args                Argument list
354  *
355  * RETURN:      None
356  *
357  * DESCRIPTION: Formatted output with argument list pointer
358  *
359  *****************************************************************************/
360
361 void
362 AcpiOsVprintf (
363     const char              *Fmt,
364     va_list                 Args)
365 {
366     INT32                   Count = 0;
367     UINT8                   Flags;
368
369
370     Flags = AcpiGbl_DbOutputFlags;
371     if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
372     {
373         /* Output is directable to either a file (if open) or the console */
374
375         if (AcpiGbl_DebugFile)
376         {
377             /* Output file is open, send the output there */
378
379             Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args);
380         }
381         else
382         {
383             /* No redirection, send output to console (once only!) */
384
385             Flags |= ACPI_DB_CONSOLE_OUTPUT;
386         }
387     }
388
389     if (Flags & ACPI_DB_CONSOLE_OUTPUT)
390     {
391         Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args);
392     }
393
394     return;
395 }
396
397
398 /******************************************************************************
399  *
400  * FUNCTION:    AcpiOsGetLine
401  *
402  * PARAMETERS:  fmt                 Standard printf format
403  *              args                Argument list
404  *
405  * RETURN:      Actual bytes read
406  *
407  * DESCRIPTION: Formatted input with argument list pointer
408  *
409  *****************************************************************************/
410
411 UINT32
412 AcpiOsGetLine (
413     char                    *Buffer)
414 {
415     UINT8                   Temp;
416     UINT32                  i;
417
418
419     for (i = 0; ; i++)
420     {
421         scanf ("%1c", &Temp);
422         if (!Temp || Temp == '\n')
423         {
424             break;
425         }
426
427         Buffer [i] = Temp;
428     }
429
430     /* Null terminate the buffer */
431
432     Buffer [i] = 0;
433
434     /* Return the number of bytes in the string */
435
436     return (i);
437 }
438
439 /******************************************************************************
440  *
441  * FUNCTION:    AcpiOsMapMemory
442  *
443  * PARAMETERS:  where               Physical address of memory to be mapped
444  *              length              How much memory to map
445  *              there               Logical address of mapped memory
446  *
447  * RETURN:      Pointer to mapped memory.  Null on error.
448  *
449  * DESCRIPTION: Map physical memory into caller's address space
450  *
451  *****************************************************************************/
452
453 ACPI_STATUS
454 AcpiOsMapMemory (
455     ACPI_PHYSICAL_ADDRESS   where,
456     ACPI_SIZE               length,
457     void                    **there)
458 {
459     *there = ACPI_TO_POINTER (where);
460
461     return AE_OK;
462 }
463
464
465 /******************************************************************************
466  *
467  * FUNCTION:    AcpiOsUnmapMemory
468  *
469  * PARAMETERS:  where               Logical address of memory to be unmapped
470  *              length              How much memory to unmap
471  *
472  * RETURN:      None.
473  *
474  * DESCRIPTION: Delete a previously created mapping.  Where and Length must
475  *              correspond to a previous mapping exactly.
476  *
477  *****************************************************************************/
478
479 void
480 AcpiOsUnmapMemory (
481     void                    *where,
482     ACPI_SIZE               length)
483 {
484
485     return;
486 }
487
488
489 /******************************************************************************
490  *
491  * FUNCTION:    AcpiOsAllocate
492  *
493  * PARAMETERS:  Size                Amount to allocate, in bytes
494  *
495  * RETURN:      Pointer to the new allocation.  Null on error.
496  *
497  * DESCRIPTION: Allocate memory.  Algorithm is dependent on the OS.
498  *
499  *****************************************************************************/
500
501 void *
502 AcpiOsAllocate (
503     ACPI_SIZE               size)
504 {
505     void                    *Mem;
506
507
508     Mem = (void *) malloc ((size_t) size);
509
510     return Mem;
511 }
512
513
514 /******************************************************************************
515  *
516  * FUNCTION:    AcpiOsFree
517  *
518  * PARAMETERS:  mem                 Pointer to previously allocated memory
519  *
520  * RETURN:      None.
521  *
522  * DESCRIPTION: Free memory allocated via AcpiOsAllocate
523  *
524  *****************************************************************************/
525
526 void
527 AcpiOsFree (
528     void                    *mem)
529 {
530
531
532     free (mem);
533 }
534
535
536 /******************************************************************************
537  *
538  * FUNCTION:    AcpiOsCreateSemaphore
539  *
540  * PARAMETERS:  InitialUnits        - Units to be assigned to the new semaphore
541  *              OutHandle           - Where a handle will be returned
542  *
543  * RETURN:      Status
544  *
545  * DESCRIPTION: Create an OS semaphore
546  *
547  *****************************************************************************/
548
549 ACPI_STATUS
550 AcpiOsCreateSemaphore (
551     UINT32              MaxUnits,
552     UINT32              InitialUnits,
553     ACPI_HANDLE         *OutHandle)
554 {
555
556
557     *OutHandle = (ACPI_HANDLE) 1;
558     return AE_OK;
559 }
560
561 /******************************************************************************
562  *
563  * FUNCTION:    AcpiOsDeleteSemaphore
564  *
565  * PARAMETERS:  Handle              - Handle returned by AcpiOsCreateSemaphore
566  *
567  * RETURN:      Status
568  *
569  * DESCRIPTION: Delete an OS semaphore
570  *
571  *****************************************************************************/
572
573 ACPI_STATUS
574 AcpiOsDeleteSemaphore (
575     ACPI_HANDLE         Handle)
576 {
577
578     if (!Handle)
579     {
580         return AE_BAD_PARAMETER;
581     }
582
583     return AE_OK;
584 }
585
586
587 /******************************************************************************
588  *
589  * FUNCTION:    AcpiOsWaitSemaphore
590  *
591  * PARAMETERS:  Handle              - Handle returned by AcpiOsCreateSemaphore
592  *              Units               - How many units to wait for
593  *              Timeout             - How long to wait
594  *
595  * RETURN:      Status
596  *
597  * DESCRIPTION: Wait for units
598  *
599  *****************************************************************************/
600
601 ACPI_STATUS
602 AcpiOsWaitSemaphore (
603     ACPI_HANDLE         Handle,
604     UINT32              Units,
605     UINT16              Timeout)
606 {
607
608
609     return AE_OK;
610 }
611
612
613 /******************************************************************************
614  *
615  * FUNCTION:    AcpiOsSignalSemaphore
616  *
617  * PARAMETERS:  Handle              - Handle returned by AcpiOsCreateSemaphore
618  *              Units               - Number of units to send
619  *
620  * RETURN:      Status
621  *
622  * DESCRIPTION: Send units
623  *
624  *****************************************************************************/
625
626 ACPI_STATUS
627 AcpiOsSignalSemaphore (
628     ACPI_HANDLE         Handle,
629     UINT32              Units)
630 {
631
632
633     return AE_OK;
634 }
635
636
637 ACPI_STATUS
638 AcpiOsCreateLock (
639     ACPI_HANDLE             *OutHandle)
640 {
641
642     return (AcpiOsCreateSemaphore (1, 1, OutHandle));
643 }
644
645 void
646 AcpiOsDeleteLock (
647     ACPI_HANDLE             Handle)
648 {
649     AcpiOsDeleteSemaphore (Handle);
650 }
651
652
653 void
654 AcpiOsAcquireLock (
655     ACPI_HANDLE             Handle,
656     UINT32                  Flags)
657 {
658     AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
659 }
660
661
662 void
663 AcpiOsReleaseLock (
664     ACPI_HANDLE             Handle,
665     UINT32                  Flags)
666 {
667     AcpiOsSignalSemaphore (Handle, 1);
668 }
669
670
671 /******************************************************************************
672  *
673  * FUNCTION:    AcpiOsInstallInterruptHandler
674  *
675  * PARAMETERS:  InterruptNumber     Level handler should respond to.
676  *              Isr                 Address of the ACPI interrupt handler
677  *              ExceptPtr           Where status is returned
678  *
679  * RETURN:      Handle to the newly installed handler.
680  *
681  * DESCRIPTION: Install an interrupt handler.  Used to install the ACPI
682  *              OS-independent handler.
683  *
684  *****************************************************************************/
685
686 UINT32
687 AcpiOsInstallInterruptHandler (
688     UINT32                  InterruptNumber,
689     OSD_HANDLER             ServiceRoutine,
690     void                    *Context)
691 {
692
693
694     return AE_OK;
695 }
696
697
698 /******************************************************************************
699  *
700  * FUNCTION:    AcpiOsRemoveInterruptHandler
701  *
702  * PARAMETERS:  Handle              Returned when handler was installed
703  *
704  * RETURN:      Status
705  *
706  * DESCRIPTION: Uninstalls an interrupt handler.
707  *
708  *****************************************************************************/
709
710 ACPI_STATUS
711 AcpiOsRemoveInterruptHandler (
712     UINT32                  InterruptNumber,
713     OSD_HANDLER             ServiceRoutine)
714 {
715
716     return AE_OK;
717 }
718
719
720 /******************************************************************************
721  *
722  * FUNCTION:    AcpiOsQueueForExecution
723  *
724  * PARAMETERS:  Priority        - Requested execution priority
725  *              Function        - Address of the function to execute
726  *              Context         - Passed as a parameter to the function
727  *
728  * RETURN:      Status.
729  *
730  * DESCRIPTION: Sleep at microsecond granularity
731  *
732  *****************************************************************************/
733
734 ACPI_STATUS
735 AcpiOsQueueForExecution (
736     UINT32                  Priority,
737     OSD_EXECUTION_CALLBACK  Function,
738     void                    *Context)
739 {
740
741 //    _beginthread (Function, (unsigned) 0, Context);
742     return 0;
743 }
744
745
746 /******************************************************************************
747  *
748  * FUNCTION:    AcpiOsBreakpoint
749  *
750  * PARAMETERS:  Msg                 Message to print
751  *
752  * RETURN:      Status
753  *
754  * DESCRIPTION: Print a message and break to the debugger.
755  *
756  *****************************************************************************/
757
758 ACPI_STATUS
759 AcpiOsBreakpoint (
760     char                    *Msg)
761 {
762
763     /* Print the message and do an INT 3 */
764
765     if (Msg)
766     {
767         AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg);
768     }
769     else
770     {
771         AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
772     }
773
774
775     return AE_OK;
776 }
777
778
779 /******************************************************************************
780  *
781  * FUNCTION:    AcpiOsSleepUsec
782  *
783  * PARAMETERS:  microseconds        To sleep
784  *
785  * RETURN:      Blocks until sleep is completed.
786  *
787  * DESCRIPTION: Sleep at microsecond granularity
788  *
789  *****************************************************************************/
790
791 void
792 AcpiOsStall (
793     UINT32                  microseconds)
794 {
795
796     if (microseconds)
797     {
798         usleep (microseconds);
799     }
800     return;
801 }
802
803
804 /******************************************************************************
805  *
806  * FUNCTION:    AcpiOsSleep
807  *
808  * PARAMETERS:  seconds             To sleep
809  *              milliseconds        To sleep
810  *
811  * RETURN:      Blocks until sleep is completed.
812  *
813  * DESCRIPTION: Sleep at second/millisecond granularity
814  *
815  *****************************************************************************/
816
817 void
818 AcpiOsSleep (
819     UINT32                  seconds,
820     UINT32                  milliseconds)
821 {
822
823     sleep (seconds + (milliseconds / 1000));    /* Sleep for whole seconds */
824
825     /* 
826      * Arg to usleep() must be less than 1,000,000 (1 second)
827      */
828     usleep ((milliseconds % 1000) * 1000);      /* Sleep for remaining usecs */
829
830     return;
831 }
832
833 /******************************************************************************
834  *
835  * FUNCTION:    AcpiOsGetTimer
836  *
837  * PARAMETERS:  None
838  *
839  * RETURN:      Current time in milliseconds
840  *
841  * DESCRIPTION: Get the current system time (in milliseconds).
842  *
843  *****************************************************************************/
844
845 UINT32
846 AcpiOsGetTimer (void)
847 {
848     struct timeval  time;
849
850     gettimeofday(&time, NULL);
851
852     return ((time.tv_sec/1000) + (time.tv_usec*1000));
853 }
854
855
856 /******************************************************************************
857  *
858  * FUNCTION:    AcpiOsReadPciConfiguration
859  *
860  * PARAMETERS:  PciId               Seg/Bus/Dev
861  *              Register            Device Register
862  *              Value               Buffer where value is placed
863  *              Width               Number of bits
864  *
865  * RETURN:      Status
866  *
867  * DESCRIPTION: Read data from PCI configuration space
868  *
869  *****************************************************************************/
870
871 ACPI_STATUS
872 AcpiOsReadPciConfiguration (
873     ACPI_PCI_ID             *PciId,
874     UINT32                  Register,
875     void                    *Value,
876     UINT32                  Width)
877 {
878
879     return (AE_OK);
880 }
881
882
883 /******************************************************************************
884  *
885  * FUNCTION:    AcpiOsWritePciConfiguration
886  *
887  * PARAMETERS:  PciId               Seg/Bus/Dev
888  *              Register            Device Register
889  *              Value               Value to be written
890  *              Width               Number of bits
891  *
892  * RETURN:      Status.
893  *
894  * DESCRIPTION: Write data to PCI configuration space
895  *
896  *****************************************************************************/
897
898 ACPI_STATUS
899 AcpiOsWritePciConfiguration (
900     ACPI_PCI_ID             *PciId,
901     UINT32                  Register,
902     ACPI_INTEGER            Value,
903     UINT32                  Width)
904 {
905
906     return (AE_OK);
907 }
908
909 /* TEMPORARY STUB FUNCTION */
910 void
911 AcpiOsDerivePciId(
912     ACPI_HANDLE             rhandle,
913     ACPI_HANDLE             chandle,
914     ACPI_PCI_ID             **PciId)
915 {
916
917 }
918
919
920 /******************************************************************************
921  *
922  * FUNCTION:    AcpiOsReadPort
923  *
924  * PARAMETERS:  Address             Address of I/O port/register to read
925  *              Value               Where value is placed
926  *              Width               Number of bits
927  *
928  * RETURN:      Value read from port
929  *
930  * DESCRIPTION: Read data from an I/O port or register
931  *
932  *****************************************************************************/
933
934 ACPI_STATUS
935 AcpiOsReadPort (
936     ACPI_IO_ADDRESS         Address,
937     UINT32                  *Value,
938     UINT32                  Width)
939 {
940
941     switch (Width)
942     {
943     case 8:
944         *Value = 0xFF;
945         break;
946
947     case 16:
948         *Value = 0xFFFF;
949         break;
950
951     case 32:
952         *Value = 0xFFFFFFFF;
953         break;
954     }
955
956     return (AE_OK);
957 }
958
959
960 /******************************************************************************
961  *
962  * FUNCTION:    AcpiOsWritePort
963  *
964  * PARAMETERS:  Address             Address of I/O port/register to write
965  *              Value               Value to write
966  *              Width               Number of bits
967  *
968  * RETURN:      None
969  *
970  * DESCRIPTION: Write data to an I/O port or register
971  *
972  *****************************************************************************/
973
974 ACPI_STATUS
975 AcpiOsWritePort (
976     ACPI_IO_ADDRESS         Address,
977     UINT32                  Value,
978     UINT32                  Width)
979 {
980
981     return (AE_OK);
982 }
983
984
985 /******************************************************************************
986  *
987  * FUNCTION:    AcpiOsReadMemory
988  *
989  * PARAMETERS:  Address             Physical Memory Address to read
990  *              Value               Where value is placed
991  *              Width               Number of bits
992  *
993  * RETURN:      Value read from physical memory address
994  *
995  * DESCRIPTION: Read data from a physical memory address
996  *
997  *****************************************************************************/
998
999 ACPI_STATUS
1000 AcpiOsReadMemory (
1001     ACPI_PHYSICAL_ADDRESS   Address,
1002     UINT32                  *Value,
1003     UINT32                  Width)
1004 {
1005
1006     switch (Width)
1007     {
1008     case 8:
1009     case 16:
1010     case 32:
1011         *Value = 0;
1012         break;
1013
1014     default:
1015         return (AE_BAD_PARAMETER);
1016         break;
1017     }
1018     return (AE_OK);
1019 }
1020
1021
1022 /******************************************************************************
1023  *
1024  * FUNCTION:    AcpiOsWriteMemory
1025  *
1026  * PARAMETERS:  Address             Physical Memory Address to write
1027  *              Value               Value to write
1028  *              Width               Number of bits
1029  *
1030  * RETURN:      None
1031  *
1032  * DESCRIPTION: Write data to a physical memory address
1033  *
1034  *****************************************************************************/
1035
1036 ACPI_STATUS
1037 AcpiOsWriteMemory (
1038     ACPI_PHYSICAL_ADDRESS   Address,
1039     UINT32                  Value,
1040     UINT32                  Width)
1041 {
1042
1043     return (AE_OK);
1044 }
1045
1046
1047 UINT32
1048 AcpiOsGetThreadId(void)
1049 {
1050     return getpid();
1051 }
1052
1053
1054 /******************************************************************************
1055  *
1056  * FUNCTION:    AcpiOsSignal
1057  *
1058  * PARAMETERS:  Function            ACPI CA signal function code
1059  *              Info                Pointer to function-dependent structure
1060  *
1061  * RETURN:      Status
1062  *
1063  * DESCRIPTION: Miscellaneous functions
1064  *
1065  *****************************************************************************/
1066
1067 ACPI_STATUS
1068 AcpiOsSignal (
1069     UINT32                  Function,
1070     void                    *Info)
1071 {
1072
1073     switch (Function)
1074     {
1075     case ACPI_SIGNAL_FATAL:
1076         break;
1077
1078     case ACPI_SIGNAL_BREAKPOINT:
1079
1080         if (Info)
1081         {
1082             AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info);
1083         }
1084         else
1085         {
1086             AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
1087         }
1088
1089         break;
1090     }
1091
1092
1093     return (AE_OK);
1094 }
1095
1096