osunixxf.c revision 138287
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 - 2004, 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
137extern FILE                    *AcpiGbl_DebugFile;
138FILE                           *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
153ACPI_STATUS
154AcpiOsInitialize (void)
155{
156    AcpiGbl_OutputFile = stdout;
157
158    return AE_OK;
159}
160
161
162ACPI_STATUS
163AcpiOsTerminate (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
182ACPI_STATUS
183AcpiOsGetRootPointer (
184    UINT32                  Flags,
185    ACPI_POINTER           *Address)
186{
187
188    return (AeLocalGetRootPointer(Flags, Address));
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
206ACPI_STATUS
207AcpiOsPredefinedOverride (
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
236ACPI_STATUS
237AcpiOsTableOverride (
238    ACPI_TABLE_HEADER       *ExistingTable,
239    ACPI_TABLE_HEADER       **NewTable)
240{
241
242    if (!ExistingTable || !NewTable)
243    {
244        return (AE_BAD_PARAMETER);
245    }
246
247    *NewTable = NULL;
248
249#ifdef _ACPI_EXEC_APP
250
251    /* This code exercises the table override mechanism in the core */
252
253    if (!ACPI_STRNCMP (ExistingTable->Signature, DSDT_SIG, ACPI_NAME_SIZE))
254    {
255        /* override DSDT with itself */
256
257        *NewTable = AcpiGbl_DbTablePtr;
258    }
259    return (AE_OK);
260#else
261    return AE_NO_ACPI_TABLES;
262#endif
263}
264
265
266/******************************************************************************
267 *
268 * FUNCTION:    AcpiOsReadable
269 *
270 * PARAMETERS:  Pointer             - Area to be verified
271 *              Length              - Size of area
272 *
273 * RETURN:      TRUE if readable for entire length
274 *
275 * DESCRIPTION: Verify that a pointer is valid for reading
276 *
277 *****************************************************************************/
278
279BOOLEAN
280AcpiOsReadable (
281    void                    *Pointer,
282    ACPI_SIZE               Length)
283{
284
285    return (TRUE);
286}
287
288
289/******************************************************************************
290 *
291 * FUNCTION:    AcpiOsWritable
292 *
293 * PARAMETERS:  Pointer             - Area to be verified
294 *              Length              - Size of area
295 *
296 * RETURN:      TRUE if writable for entire length
297 *
298 * DESCRIPTION: Verify that a pointer is valid for writing
299 *
300 *****************************************************************************/
301
302BOOLEAN
303AcpiOsWritable (
304    void                    *Pointer,
305    ACPI_SIZE               Length)
306{
307
308    return (TRUE);
309}
310
311
312/******************************************************************************
313 *
314 * FUNCTION:    AcpiOsRedirectOutput
315 *
316 * PARAMETERS:  Destination         - An open file handle/pointer
317 *
318 * RETURN:      None
319 *
320 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
321 *
322 *****************************************************************************/
323
324void
325AcpiOsRedirectOutput (
326    void                    *Destination)
327{
328
329    AcpiGbl_OutputFile = Destination;
330}
331
332
333/******************************************************************************
334 *
335 * FUNCTION:    AcpiOsPrintf
336 *
337 * PARAMETERS:  fmt, ...            Standard printf format
338 *
339 * RETURN:      None
340 *
341 * DESCRIPTION: Formatted output
342 *
343 *****************************************************************************/
344
345void ACPI_INTERNAL_VAR_XFACE
346AcpiOsPrintf (
347    const char              *Fmt,
348    ...)
349{
350    va_list                 Args;
351
352
353    va_start (Args, Fmt);
354
355    AcpiOsVprintf (Fmt, Args);
356
357    va_end (Args);
358    return;
359}
360
361
362/******************************************************************************
363 *
364 * FUNCTION:    AcpiOsVprintf
365 *
366 * PARAMETERS:  fmt                 Standard printf format
367 *              args                Argument list
368 *
369 * RETURN:      None
370 *
371 * DESCRIPTION: Formatted output with argument list pointer
372 *
373 *****************************************************************************/
374
375void
376AcpiOsVprintf (
377    const char              *Fmt,
378    va_list                 Args)
379{
380    INT32                   Count = 0;
381    UINT8                   Flags;
382
383
384    Flags = AcpiGbl_DbOutputFlags;
385    if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
386    {
387        /* Output is directable to either a file (if open) or the console */
388
389        if (AcpiGbl_DebugFile)
390        {
391            /* Output file is open, send the output there */
392
393            Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args);
394        }
395        else
396        {
397            /* No redirection, send output to console (once only!) */
398
399            Flags |= ACPI_DB_CONSOLE_OUTPUT;
400        }
401    }
402
403    if (Flags & ACPI_DB_CONSOLE_OUTPUT)
404    {
405        Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args);
406    }
407
408    return;
409}
410
411
412/******************************************************************************
413 *
414 * FUNCTION:    AcpiOsGetLine
415 *
416 * PARAMETERS:  fmt                 Standard printf format
417 *              args                Argument list
418 *
419 * RETURN:      Actual bytes read
420 *
421 * DESCRIPTION: Formatted input with argument list pointer
422 *
423 *****************************************************************************/
424
425UINT32
426AcpiOsGetLine (
427    char                    *Buffer)
428{
429    UINT8                   Temp;
430    UINT32                  i;
431
432
433    for (i = 0; ; i++)
434    {
435        scanf ("%1c", &Temp);
436        if (!Temp || Temp == '\n')
437        {
438            break;
439        }
440
441        Buffer [i] = Temp;
442    }
443
444    /* Null terminate the buffer */
445
446    Buffer [i] = 0;
447
448    /* Return the number of bytes in the string */
449
450    return (i);
451}
452
453/******************************************************************************
454 *
455 * FUNCTION:    AcpiOsMapMemory
456 *
457 * PARAMETERS:  where               Physical address of memory to be mapped
458 *              length              How much memory to map
459 *              there               Logical address of mapped memory
460 *
461 * RETURN:      Pointer to mapped memory.  Null on error.
462 *
463 * DESCRIPTION: Map physical memory into caller's address space
464 *
465 *****************************************************************************/
466
467ACPI_STATUS
468AcpiOsMapMemory (
469    ACPI_PHYSICAL_ADDRESS   where,
470    ACPI_SIZE               length,
471    void                    **there)
472{
473    *there = ACPI_TO_POINTER (where);
474
475    return AE_OK;
476}
477
478
479/******************************************************************************
480 *
481 * FUNCTION:    AcpiOsUnmapMemory
482 *
483 * PARAMETERS:  where               Logical address of memory to be unmapped
484 *              length              How much memory to unmap
485 *
486 * RETURN:      None.
487 *
488 * DESCRIPTION: Delete a previously created mapping.  Where and Length must
489 *              correspond to a previous mapping exactly.
490 *
491 *****************************************************************************/
492
493void
494AcpiOsUnmapMemory (
495    void                    *where,
496    ACPI_SIZE               length)
497{
498
499    return;
500}
501
502
503/******************************************************************************
504 *
505 * FUNCTION:    AcpiOsAllocate
506 *
507 * PARAMETERS:  Size                Amount to allocate, in bytes
508 *
509 * RETURN:      Pointer to the new allocation.  Null on error.
510 *
511 * DESCRIPTION: Allocate memory.  Algorithm is dependent on the OS.
512 *
513 *****************************************************************************/
514
515void *
516AcpiOsAllocate (
517    ACPI_SIZE               size)
518{
519    void                    *Mem;
520
521
522    Mem = (void *) malloc ((size_t) size);
523
524    return Mem;
525}
526
527
528/******************************************************************************
529 *
530 * FUNCTION:    AcpiOsFree
531 *
532 * PARAMETERS:  mem                 Pointer to previously allocated memory
533 *
534 * RETURN:      None.
535 *
536 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
537 *
538 *****************************************************************************/
539
540void
541AcpiOsFree (
542    void                    *mem)
543{
544
545
546    free (mem);
547}
548
549
550/******************************************************************************
551 *
552 * FUNCTION:    AcpiOsCreateSemaphore
553 *
554 * PARAMETERS:  InitialUnits        - Units to be assigned to the new semaphore
555 *              OutHandle           - Where a handle will be returned
556 *
557 * RETURN:      Status
558 *
559 * DESCRIPTION: Create an OS semaphore
560 *
561 *****************************************************************************/
562
563ACPI_STATUS
564AcpiOsCreateSemaphore (
565    UINT32              MaxUnits,
566    UINT32              InitialUnits,
567    ACPI_HANDLE         *OutHandle)
568{
569
570
571    *OutHandle = (ACPI_HANDLE) 1;
572    return AE_OK;
573}
574
575/******************************************************************************
576 *
577 * FUNCTION:    AcpiOsDeleteSemaphore
578 *
579 * PARAMETERS:  Handle              - Handle returned by AcpiOsCreateSemaphore
580 *
581 * RETURN:      Status
582 *
583 * DESCRIPTION: Delete an OS semaphore
584 *
585 *****************************************************************************/
586
587ACPI_STATUS
588AcpiOsDeleteSemaphore (
589    ACPI_HANDLE         Handle)
590{
591
592    if (!Handle)
593    {
594        return AE_BAD_PARAMETER;
595    }
596
597    return AE_OK;
598}
599
600
601/******************************************************************************
602 *
603 * FUNCTION:    AcpiOsWaitSemaphore
604 *
605 * PARAMETERS:  Handle              - Handle returned by AcpiOsCreateSemaphore
606 *              Units               - How many units to wait for
607 *              Timeout             - How long to wait
608 *
609 * RETURN:      Status
610 *
611 * DESCRIPTION: Wait for units
612 *
613 *****************************************************************************/
614
615ACPI_STATUS
616AcpiOsWaitSemaphore (
617    ACPI_HANDLE         Handle,
618    UINT32              Units,
619    UINT16              Timeout)
620{
621
622
623    return AE_OK;
624}
625
626
627/******************************************************************************
628 *
629 * FUNCTION:    AcpiOsSignalSemaphore
630 *
631 * PARAMETERS:  Handle              - Handle returned by AcpiOsCreateSemaphore
632 *              Units               - Number of units to send
633 *
634 * RETURN:      Status
635 *
636 * DESCRIPTION: Send units
637 *
638 *****************************************************************************/
639
640ACPI_STATUS
641AcpiOsSignalSemaphore (
642    ACPI_HANDLE         Handle,
643    UINT32              Units)
644{
645
646
647    return AE_OK;
648}
649
650
651ACPI_STATUS
652AcpiOsCreateLock (
653    ACPI_HANDLE             *OutHandle)
654{
655
656    return (AcpiOsCreateSemaphore (1, 1, OutHandle));
657}
658
659void
660AcpiOsDeleteLock (
661    ACPI_HANDLE             Handle)
662{
663    AcpiOsDeleteSemaphore (Handle);
664}
665
666
667void
668AcpiOsAcquireLock (
669    ACPI_HANDLE             Handle,
670    UINT32                  Flags)
671{
672    AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
673}
674
675
676void
677AcpiOsReleaseLock (
678    ACPI_HANDLE             Handle,
679    UINT32                  Flags)
680{
681    AcpiOsSignalSemaphore (Handle, 1);
682}
683
684
685/******************************************************************************
686 *
687 * FUNCTION:    AcpiOsInstallInterruptHandler
688 *
689 * PARAMETERS:  InterruptNumber     Level handler should respond to.
690 *              Isr                 Address of the ACPI interrupt handler
691 *              ExceptPtr           Where status is returned
692 *
693 * RETURN:      Handle to the newly installed handler.
694 *
695 * DESCRIPTION: Install an interrupt handler.  Used to install the ACPI
696 *              OS-independent handler.
697 *
698 *****************************************************************************/
699
700UINT32
701AcpiOsInstallInterruptHandler (
702    UINT32                  InterruptNumber,
703    ACPI_OSD_HANDLER        ServiceRoutine,
704    void                    *Context)
705{
706
707
708    return AE_OK;
709}
710
711
712/******************************************************************************
713 *
714 * FUNCTION:    AcpiOsRemoveInterruptHandler
715 *
716 * PARAMETERS:  Handle              Returned when handler was installed
717 *
718 * RETURN:      Status
719 *
720 * DESCRIPTION: Uninstalls an interrupt handler.
721 *
722 *****************************************************************************/
723
724ACPI_STATUS
725AcpiOsRemoveInterruptHandler (
726    UINT32                  InterruptNumber,
727    ACPI_OSD_HANDLER        ServiceRoutine)
728{
729
730    return AE_OK;
731}
732
733
734/******************************************************************************
735 *
736 * FUNCTION:    AcpiOsQueueForExecution
737 *
738 * PARAMETERS:  Priority        - Requested execution priority
739 *              Function        - Address of the function to execute
740 *              Context         - Passed as a parameter to the function
741 *
742 * RETURN:      Status.
743 *
744 * DESCRIPTION: Sleep at microsecond granularity
745 *
746 *****************************************************************************/
747
748ACPI_STATUS
749AcpiOsQueueForExecution (
750    UINT32                  Priority,
751    ACPI_OSD_EXEC_CALLBACK  Function,
752    void                    *Context)
753{
754
755//    _beginthread (Function, (unsigned) 0, Context);
756    return 0;
757}
758
759
760/******************************************************************************
761 *
762 * FUNCTION:    AcpiOsBreakpoint
763 *
764 * PARAMETERS:  Msg                 Message to print
765 *
766 * RETURN:      Status
767 *
768 * DESCRIPTION: Print a message and break to the debugger.
769 *
770 *****************************************************************************/
771
772ACPI_STATUS
773AcpiOsBreakpoint (
774    char                    *Msg)
775{
776
777    /* Print the message and do an INT 3 */
778
779    if (Msg)
780    {
781        AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg);
782    }
783    else
784    {
785        AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
786    }
787
788
789    return AE_OK;
790}
791
792
793/******************************************************************************
794 *
795 * FUNCTION:    AcpiOsStall
796 *
797 * PARAMETERS:  microseconds        To sleep
798 *
799 * RETURN:      Blocks until sleep is completed.
800 *
801 * DESCRIPTION: Sleep at microsecond granularity
802 *
803 *****************************************************************************/
804
805void
806AcpiOsStall (
807    UINT32                  microseconds)
808{
809
810    if (microseconds)
811    {
812        usleep (microseconds);
813    }
814    return;
815}
816
817
818/******************************************************************************
819 *
820 * FUNCTION:    AcpiOsSleep
821 *
822 * PARAMETERS:  milliseconds        To sleep
823 *
824 * RETURN:      Blocks until sleep is completed.
825 *
826 * DESCRIPTION: Sleep at millisecond granularity
827 *
828 *****************************************************************************/
829
830void
831AcpiOsSleep (
832    ACPI_INTEGER            milliseconds)
833{
834
835    sleep (milliseconds / 1000);    /* Sleep for whole seconds */
836
837    /*
838     * Arg to usleep() must be less than 1,000,000 (1 second)
839     */
840    usleep ((milliseconds % 1000) * 1000);      /* Sleep for remaining usecs */
841
842    return;
843}
844
845/******************************************************************************
846 *
847 * FUNCTION:    AcpiOsGetTimer
848 *
849 * PARAMETERS:  None
850 *
851 * RETURN:      Current time in 100 nanosecond units
852 *
853 * DESCRIPTION: Get the current system time
854 *
855 *****************************************************************************/
856
857UINT64
858AcpiOsGetTimer (void)
859{
860    struct timeval  time;
861
862    gettimeofday(&time, NULL);
863
864    /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */
865
866    return (((UINT64) time.tv_sec * 10000000) + ((UINT64) time.tv_usec * 10));
867}
868
869
870/******************************************************************************
871 *
872 * FUNCTION:    AcpiOsReadPciConfiguration
873 *
874 * PARAMETERS:  PciId               Seg/Bus/Dev
875 *              Register            Device Register
876 *              Value               Buffer where value is placed
877 *              Width               Number of bits
878 *
879 * RETURN:      Status
880 *
881 * DESCRIPTION: Read data from PCI configuration space
882 *
883 *****************************************************************************/
884
885ACPI_STATUS
886AcpiOsReadPciConfiguration (
887    ACPI_PCI_ID             *PciId,
888    UINT32                  Register,
889    void                    *Value,
890    UINT32                  Width)
891{
892
893    return (AE_OK);
894}
895
896
897/******************************************************************************
898 *
899 * FUNCTION:    AcpiOsWritePciConfiguration
900 *
901 * PARAMETERS:  PciId               Seg/Bus/Dev
902 *              Register            Device Register
903 *              Value               Value to be written
904 *              Width               Number of bits
905 *
906 * RETURN:      Status.
907 *
908 * DESCRIPTION: Write data to PCI configuration space
909 *
910 *****************************************************************************/
911
912ACPI_STATUS
913AcpiOsWritePciConfiguration (
914    ACPI_PCI_ID             *PciId,
915    UINT32                  Register,
916    ACPI_INTEGER            Value,
917    UINT32                  Width)
918{
919
920    return (AE_OK);
921}
922
923/* TEMPORARY STUB FUNCTION */
924void
925AcpiOsDerivePciId(
926    ACPI_HANDLE             rhandle,
927    ACPI_HANDLE             chandle,
928    ACPI_PCI_ID             **PciId)
929{
930
931}
932
933
934/******************************************************************************
935 *
936 * FUNCTION:    AcpiOsReadPort
937 *
938 * PARAMETERS:  Address             Address of I/O port/register to read
939 *              Value               Where value is placed
940 *              Width               Number of bits
941 *
942 * RETURN:      Value read from port
943 *
944 * DESCRIPTION: Read data from an I/O port or register
945 *
946 *****************************************************************************/
947
948ACPI_STATUS
949AcpiOsReadPort (
950    ACPI_IO_ADDRESS         Address,
951    UINT32                  *Value,
952    UINT32                  Width)
953{
954
955    switch (Width)
956    {
957    case 8:
958        *Value = 0xFF;
959        break;
960
961    case 16:
962        *Value = 0xFFFF;
963        break;
964
965    case 32:
966        *Value = 0xFFFFFFFF;
967        break;
968    }
969
970    return (AE_OK);
971}
972
973
974/******************************************************************************
975 *
976 * FUNCTION:    AcpiOsWritePort
977 *
978 * PARAMETERS:  Address             Address of I/O port/register to write
979 *              Value               Value to write
980 *              Width               Number of bits
981 *
982 * RETURN:      None
983 *
984 * DESCRIPTION: Write data to an I/O port or register
985 *
986 *****************************************************************************/
987
988ACPI_STATUS
989AcpiOsWritePort (
990    ACPI_IO_ADDRESS         Address,
991    UINT32                  Value,
992    UINT32                  Width)
993{
994
995    return (AE_OK);
996}
997
998
999/******************************************************************************
1000 *
1001 * FUNCTION:    AcpiOsReadMemory
1002 *
1003 * PARAMETERS:  Address             Physical Memory Address to read
1004 *              Value               Where value is placed
1005 *              Width               Number of bits
1006 *
1007 * RETURN:      Value read from physical memory address
1008 *
1009 * DESCRIPTION: Read data from a physical memory address
1010 *
1011 *****************************************************************************/
1012
1013ACPI_STATUS
1014AcpiOsReadMemory (
1015    ACPI_PHYSICAL_ADDRESS   Address,
1016    UINT32                  *Value,
1017    UINT32                  Width)
1018{
1019
1020    switch (Width)
1021    {
1022    case 8:
1023    case 16:
1024    case 32:
1025        *Value = 0;
1026        break;
1027
1028    default:
1029        return (AE_BAD_PARAMETER);
1030        break;
1031    }
1032    return (AE_OK);
1033}
1034
1035
1036/******************************************************************************
1037 *
1038 * FUNCTION:    AcpiOsWriteMemory
1039 *
1040 * PARAMETERS:  Address             Physical Memory Address to write
1041 *              Value               Value to write
1042 *              Width               Number of bits
1043 *
1044 * RETURN:      None
1045 *
1046 * DESCRIPTION: Write data to a physical memory address
1047 *
1048 *****************************************************************************/
1049
1050ACPI_STATUS
1051AcpiOsWriteMemory (
1052    ACPI_PHYSICAL_ADDRESS   Address,
1053    UINT32                  Value,
1054    UINT32                  Width)
1055{
1056
1057    return (AE_OK);
1058}
1059
1060
1061UINT32
1062AcpiOsGetThreadId(void)
1063{
1064    return getpid();
1065}
1066
1067
1068/******************************************************************************
1069 *
1070 * FUNCTION:    AcpiOsSignal
1071 *
1072 * PARAMETERS:  Function            ACPI CA signal function code
1073 *              Info                Pointer to function-dependent structure
1074 *
1075 * RETURN:      Status
1076 *
1077 * DESCRIPTION: Miscellaneous functions
1078 *
1079 *****************************************************************************/
1080
1081ACPI_STATUS
1082AcpiOsSignal (
1083    UINT32                  Function,
1084    void                    *Info)
1085{
1086
1087    switch (Function)
1088    {
1089    case ACPI_SIGNAL_FATAL:
1090        break;
1091
1092    case ACPI_SIGNAL_BREAKPOINT:
1093
1094        if (Info)
1095        {
1096            AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info);
1097        }
1098        else
1099        {
1100            AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
1101        }
1102
1103        break;
1104    }
1105
1106
1107    return (AE_OK);
1108}
1109
1110
1111