Import acpica-unix-20061109 from Intel.
[dragonfly.git] / sys / contrib / dev / acpica-unix-20061109 / os_specific / service_layers / osdosxf.c
blob195219709e37541210e173f9ebda4228fdfe109e
1 /******************************************************************************
3 * Module Name: osdosxf - DOS OSL interfaces
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
12 * All rights reserved.
14 * 2. License
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.
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
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;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
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.
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.
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.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
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.
80 * 4. Disclaimer and Export Compliance
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.
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.
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.
114 *****************************************************************************/
118 * These interfaces are required in order to link to the ACPI subsystem
119 * parser. They are called during the execution of the parser, and all
120 * map directly to Clibrary calls.
124 #pragma warning(disable:4115) /* warning C4115: named type definition in parentheses (caused by rpcasync.h> */
126 #include <stdio.h>
127 #include <stdlib.h>
128 #include <stdarg.h>
129 #include <process.h>
130 #include <conio.h>
132 #include "acpi.h"
133 #include "amlcode.h"
134 #include "acparser.h"
135 #include "acdebug.h"
136 #include "16bit.h"
138 #define _COMPONENT ACPI_OS_SERVICES
139 ACPI_MODULE_NAME ("adosd")
142 extern FILE *AcpiGbl_DebugFile;
143 FILE *AcpiGbl_OutputFile = stdout;
145 ACPI_STATUS
146 AeLocalGetRootPointer (
147 UINT32 Flags,
148 ACPI_POINTER *Address);
150 typedef struct
152 UINT32 Units;
153 } DOS_SEMAPHORE;
156 /******************************************************************************
158 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
160 * PARAMETERS: None
162 * RETURN: Status
164 * DESCRIPTION: Init and terminate. Nothing to do.
166 *****************************************************************************/
168 ACPI_STATUS
169 AcpiOsInitialize (void)
171 return AE_OK;
175 ACPI_STATUS
176 AcpiOsTerminate (void)
178 return AE_OK;
182 /******************************************************************************
184 * FUNCTION: AcpiOsGetRootPointer
186 * PARAMETERS: Flags - Logical/Physical addressing
187 * PhysicalAddress - of the RSDP
189 * RETURN: Status
191 * DESCRIPTION: Returns the RSDP
193 *****************************************************************************/
195 ACPI_STATUS
196 AcpiOsGetRootPointer (
197 UINT32 Flags,
198 ACPI_POINTER *Address)
200 ACPI_STATUS Status;
202 Status = AeLocalGetRootPointer (Flags, Address);
203 printf ("Root Pointer: %p\n", Address->Pointer.Logical);
204 return (Status);
208 /******************************************************************************
210 * FUNCTION: AcpiOsPredefinedOverride
212 * PARAMETERS: InitVal - Initial value of the predefined object
213 * NewVal - The new value for the object
215 * RETURN: Status, pointer to value. Null pointer returned if not
216 * overriding.
218 * DESCRIPTION: Allow the OS to override predefined names
220 *****************************************************************************/
222 ACPI_STATUS
223 AcpiOsPredefinedOverride (
224 const ACPI_PREDEFINED_NAMES *InitVal,
225 ACPI_STRING *NewVal)
228 if (!InitVal || !NewVal)
230 return (AE_BAD_PARAMETER);
233 *NewVal = NULL;
234 return (AE_OK);
238 /******************************************************************************
240 * FUNCTION: AcpiOsTableOverride
242 * PARAMETERS: ExistingTable - Header of current table (probably firmware)
243 * NewTable - Where an entire new table is returned.
245 * RETURN: Status, pointer to new table. Null pointer returned if no
246 * table is available to override
248 * DESCRIPTION: Return a different version of a table if one is available
250 *****************************************************************************/
252 ACPI_STATUS
253 AcpiOsTableOverride (
254 ACPI_TABLE_HEADER *ExistingTable,
255 ACPI_TABLE_HEADER **NewTable)
257 #ifndef ACPI_EXEC_APP
258 UINT8 *NewTablePtr;
259 UINT32 TableLength;
260 ACPI_STATUS Status;
261 char Signature[4];
262 #endif
265 if (!ExistingTable || !NewTable)
267 return (AE_BAD_PARAMETER);
270 #ifdef ACPI_EXEC_APP
271 *NewTable = NULL;
272 return (AE_OK);
274 #else
276 ACPI_STRNCPY (Signature, ExistingTable->Signature, ACPI_NAME_SIZE);
278 /* Correct signature for FADT is "FACP" */
280 if (ACPI_COMPARE_NAME (Signature, "FADT"))
282 ACPI_STRNCPY (Signature, ACPI_SIG_FADT, ACPI_NAME_SIZE);
285 Status = AfFindTable (Signature, &NewTablePtr, &TableLength);
287 *NewTable = NULL;
288 if (Status == AE_OK)
290 *NewTable = (ACPI_TABLE_HEADER *) NewTablePtr;
291 AcpiOsPrintf ("[%4.4s] obtained from memory, %d bytes\n",
292 (char *) &ExistingTable->Signature, (UINT32) (*NewTable)->Length);
294 return (Status);
295 #endif
299 /******************************************************************************
301 * FUNCTION: AcpiOsReadable
303 * PARAMETERS: Pointer - Area to be verified
304 * Length - Size of area
306 * RETURN: TRUE if readable for entire length
308 * DESCRIPTION: Verify that a pointer is valid for reading
310 *****************************************************************************/
312 BOOLEAN
313 AcpiOsReadable (
314 void *Pointer,
315 ACPI_SIZE Length)
318 return (TRUE);
322 /******************************************************************************
324 * FUNCTION: AcpiOsWritable
326 * PARAMETERS: Pointer - Area to be verified
327 * Length - Size of area
329 * RETURN: TRUE if writable for entire length
331 * DESCRIPTION: Verify that a pointer is valid for writing
333 *****************************************************************************/
335 BOOLEAN
336 AcpiOsWritable (
337 void *Pointer,
338 ACPI_SIZE Length)
341 return (TRUE);
345 /******************************************************************************
347 * FUNCTION: AcpiOslDoFormat
349 * PARAMETERS: fmt, ... Standard printf format
351 * RETURN: None
353 * DESCRIPTION: Replace %X with %lX everywhere.
355 *****************************************************************************/
357 static char NewFmt[256];
359 void
360 AcpiOslDoFormat (
361 const char *Fmt)
363 char *New = NewFmt;
364 const char *Old = Fmt;
366 while (*Fmt)
368 if (*Fmt != '%')
370 *New++ = *Fmt++;
371 continue;
374 *New++ = *Fmt++;
376 if (*Fmt == 'x' || *Fmt == 'X')
378 memcpy (New, "lX", 2);
379 New += 2;
380 Fmt += 1;
381 continue;
384 if (*Fmt == 'd')
386 memcpy (New, "ld", 2);
387 New += 2;
388 Fmt += 1;
389 continue;
392 if (*Fmt == 'u')
394 memcpy (New, "lu", 2);
395 New += 2;
396 Fmt += 1;
397 continue;
400 if (!ACPI_STRNCMP (Fmt, "2.2d", 4))
402 memcpy (New, "2.2ld", 5);
403 New += 5;
404 Fmt += 4;
405 continue;
408 if (!ACPI_STRNCMP (Fmt, "2d", 2))
410 memcpy (New, "2ld", 3);
411 New += 3;
412 Fmt += 2;
413 continue;
416 if (!ACPI_STRNCMP (Fmt, "8.8X", 4))
418 memcpy (New, "8.8lX", 5);
419 New += 5;
420 Fmt += 4;
421 continue;
424 if (!ACPI_STRNCMP (Fmt, "5.5X", 4))
426 memcpy (New, "5.5lX", 5);
427 New += 5;
428 Fmt += 4;
429 continue;
432 if (!ACPI_STRNCMP (Fmt, "4.4X", 4))
434 memcpy (New, "4.4lX", 5);
435 New += 5;
436 Fmt += 4;
437 continue;
440 if (!ACPI_STRNCMP (Fmt, "2.2X", 4))
442 memcpy (New, "2.2lX", 5);
443 New += 5;
444 Fmt += 4;
445 continue;
448 if (!ACPI_STRNCMP (Fmt, ".8X", 3))
450 memcpy (New, ".8lX", 4);
451 New += 4;
452 Fmt += 3;
453 continue;
456 if (!ACPI_STRNCMP (Fmt, ".4X", 3))
458 memcpy (New, ".4lX", 4);
459 New += 4;
460 Fmt += 3;
461 continue;
464 if (!ACPI_STRNCMP (Fmt, ".2X", 3))
466 memcpy (New, ".2lX", 4);
467 New += 4;
468 Fmt += 3;
469 continue;
472 if (!ACPI_STRNCMP (Fmt, "2X", 2))
474 memcpy (New, "2lX", 3);
475 New += 3;
476 Fmt += 2;
477 continue;
480 if (!ACPI_STRNCMP (Fmt, "02X", 2))
482 memcpy (New, "02lX", 4);
483 New += 4;
484 Fmt += 3;
485 continue;
487 *New++ = *Fmt++;
490 *New = 0;
494 /******************************************************************************
496 * FUNCTION: AcpiOsRedirectOutput
498 * PARAMETERS: Destination - An open file handle/pointer
500 * RETURN: None
502 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
504 *****************************************************************************/
506 void
507 AcpiOsRedirectOutput (
508 void *Destination)
511 AcpiGbl_OutputFile = Destination;
515 /******************************************************************************
517 * FUNCTION: AcpiOsPrintf
519 * PARAMETERS: fmt, ... Standard printf format
521 * RETURN: None
523 * DESCRIPTION: Formatted output
525 *****************************************************************************/
527 void ACPI_INTERNAL_VAR_XFACE
528 AcpiOsPrintf (
529 const char *Fmt,
530 ...)
532 va_list Args;
535 va_start (Args, Fmt);
537 AcpiOsVprintf (Fmt, Args);
539 va_end (Args);
540 return;
544 /******************************************************************************
546 * FUNCTION: AcpiOsVprintf
548 * PARAMETERS: fmt Standard printf format
549 * args Argument list
551 * RETURN: None
553 * DESCRIPTION: Formatted output with argument list pointer
555 *****************************************************************************/
557 void
558 AcpiOsVprintf (
559 const char *Fmt,
560 va_list Args)
562 INT32 Count = 0;
563 UINT8 Flags;
566 AcpiOslDoFormat (Fmt);
568 Flags = AcpiGbl_DbOutputFlags;
569 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
571 /* Output is directable to either a file (if open) or the console */
573 if (AcpiGbl_DebugFile)
575 /* Output file is open, send the output there */
577 Count = vfprintf (AcpiGbl_DebugFile, NewFmt, Args);
579 else
581 /* No redirection, send output to console (once only!) */
583 Flags |= ACPI_DB_CONSOLE_OUTPUT;
587 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
589 Count = vfprintf (AcpiGbl_OutputFile, NewFmt, Args);
592 return;
596 /******************************************************************************
598 * FUNCTION: AcpiOsGetLine
600 * PARAMETERS: fmt Standard printf format
601 * args Argument list
603 * RETURN: Actual bytes read
605 * DESCRIPTION: Formatted input with argument list pointer
607 *****************************************************************************/
609 UINT32
610 AcpiOsGetLine (
611 char *Buffer)
613 UINT8 Temp;
614 UINT32 i;
617 for (i = 0; ; i++)
619 scanf ("%1c", &Temp);
620 if (!Temp || Temp == '\n')
622 break;
625 Buffer [i] = Temp;
628 /* Null terminate the buffer */
630 Buffer [i] = 0;
632 /* Return the number of bytes in the string */
634 return (i);
637 /******************************************************************************
639 * FUNCTION: AcpiOsMapMemory
641 * PARAMETERS: where Physical address of memory to be mapped
642 * length How much memory to map
643 * there Logical address of mapped memory
645 * RETURN: Pointer to mapped memory. Null on error.
647 * DESCRIPTION: Map physical memory into caller's address space
649 *****************************************************************************/
651 ACPI_STATUS
652 AcpiOsMapMemory (
653 ACPI_PHYSICAL_ADDRESS where,
654 ACPI_SIZE length,
655 void **there)
657 *there = where;
659 return AE_OK;
663 /******************************************************************************
665 * FUNCTION: AcpiOsUnmapMemory
667 * PARAMETERS: where Logical address of memory to be unmapped
668 * length How much memory to unmap
670 * RETURN: None.
672 * DESCRIPTION: Delete a previously created mapping. Where and Length must
673 * correspond to a previous mapping exactly.
675 *****************************************************************************/
677 void
678 AcpiOsUnmapMemory (
679 void *where,
680 ACPI_SIZE length)
683 return;
687 /******************************************************************************
689 * FUNCTION: AcpiOsAllocate
691 * PARAMETERS: Size Amount to allocate, in bytes
693 * RETURN: Pointer to the new allocation. Null on error.
695 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
697 *****************************************************************************/
699 UINT32 TotalAllocations;
700 UINT32 TotalSize;
702 void *
703 AcpiOsAllocate (
704 ACPI_SIZE size)
706 void *Mem;
709 Mem = (void *) malloc ((size_t) size);
710 if (!Mem)
712 ACPI_ERROR ((AE_INFO,
713 "Could not allocate memory of size %X\n (total allocations/size, %X/%X)",
714 (UINT32) size, TotalAllocations, TotalSize));
717 TotalAllocations++;
718 TotalSize += size;
719 return Mem;
723 /******************************************************************************
725 * FUNCTION: AcpiOsFree
727 * PARAMETERS: mem Pointer to previously allocated memory
729 * RETURN: None.
731 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
733 *****************************************************************************/
735 void
736 AcpiOsFree (
737 char *mem)
741 free ((void *) mem);
745 /******************************************************************************
747 * FUNCTION: AcpiOsCreateSemaphore
749 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore
750 * OutHandle - Where a handle will be returned
752 * RETURN: Status
754 * DESCRIPTION: Create an OS semaphore
756 *****************************************************************************/
758 ACPI_STATUS
759 AcpiOsCreateSemaphore (
760 UINT32 MaxUnits,
761 UINT32 InitialUnits,
762 ACPI_HANDLE *OutHandle)
764 DOS_SEMAPHORE *Sem;
767 Sem = AcpiOsAllocate (sizeof (DOS_SEMAPHORE));
768 if (!Sem)
770 return (AE_NO_MEMORY);
773 Sem->Units = InitialUnits;
774 *OutHandle = Sem;
775 return AE_OK;
778 /******************************************************************************
780 * FUNCTION: AcpiOsDeleteSemaphore
782 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
784 * RETURN: Status
786 * DESCRIPTION: Delete an OS semaphore
788 *****************************************************************************/
790 ACPI_STATUS
791 AcpiOsDeleteSemaphore (
792 ACPI_HANDLE Handle)
795 if (!Handle)
797 return AE_BAD_PARAMETER;
800 AcpiOsFree (Handle);
801 return AE_OK;
805 /******************************************************************************
807 * FUNCTION: AcpiOsWaitSemaphore
809 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
810 * Units - How many units to wait for
811 * Timeout - How long to wait
813 * RETURN: Status
815 * DESCRIPTION: Wait for units
817 *****************************************************************************/
819 ACPI_STATUS
820 AcpiOsWaitSemaphore (
821 ACPI_HANDLE Handle,
822 UINT32 Units,
823 UINT16 Timeout)
825 DOS_SEMAPHORE *Sem;
827 if (!Handle)
829 return AE_BAD_PARAMETER;
832 Sem = Handle;
833 if (Sem->Units)
835 Sem->Units--;
836 return AE_OK;
840 return AE_TIME;
844 /******************************************************************************
846 * FUNCTION: AcpiOsSignalSemaphore
848 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
849 * Units - Number of units to send
851 * RETURN: Status
853 * DESCRIPTION: Send units
855 *****************************************************************************/
857 ACPI_STATUS
858 AcpiOsSignalSemaphore (
859 ACPI_HANDLE Handle,
860 UINT32 Units)
862 DOS_SEMAPHORE *Sem;
864 if (!Handle)
866 return AE_BAD_PARAMETER;
869 Sem = Handle;
870 Sem->Units++;
871 return AE_OK;
875 ACPI_STATUS
876 AcpiOsCreateLock (
877 ACPI_SPINLOCK *OutHandle);
880 return (AcpiOsCreateSemaphore (1, 1, OutHandle));
883 void
884 AcpiOsDeleteLock (
885 ACPI_SPINLOCK Handle)
887 AcpiOsDeleteSemaphore (Handle);
891 ACPI_CPU_FLAGS
892 AcpiOsAcquireLock (
893 ACPI_SPINLOCK Handle)
895 AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
896 return (0);
900 void
901 AcpiOsReleaseLock (
902 ACPI_SPINLOCK Handle,
903 ACPI_CPU_FLAGS Flags)
905 AcpiOsSignalSemaphore (Handle, 1);
909 /******************************************************************************
911 * FUNCTION: AcpiOsInstallInterruptHandler
913 * PARAMETERS: InterruptNumber Level handler should respond to.
914 * Isr Address of the ACPI interrupt handler
915 * ExceptPtr Where status is returned
917 * RETURN: Handle to the newly installed handler.
919 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
920 * OS-independent handler.
922 *****************************************************************************/
924 UINT32
925 AcpiOsInstallInterruptHandler (
926 UINT32 InterruptNumber,
927 ACPI_OSD_HANDLER ServiceRoutine,
928 void *Context)
932 return AE_OK;
936 /******************************************************************************
938 * FUNCTION: AcpiOsRemoveInterruptHandler
940 * PARAMETERS: Handle Returned when handler was installed
942 * RETURN: Status
944 * DESCRIPTION: Uninstalls an interrupt handler.
946 *****************************************************************************/
948 ACPI_STATUS
949 AcpiOsRemoveInterruptHandler (
950 UINT32 InterruptNumber,
951 ACPI_OSD_HANDLER ServiceRoutine)
954 return AE_OK;
958 /******************************************************************************
960 * FUNCTION: AcpiOsGetThreadId
962 * PARAMETERS: None
964 * RETURN: Id of the running thread
966 * DESCRIPTION: Get the Id of the current (running) thread
968 *****************************************************************************/
970 ACPI_THREAD_ID
971 AcpiOsGetThreadId (
972 void)
975 /* Only one thread! */
977 return (1);
982 /******************************************************************************
984 * FUNCTION: AcpiOsExecute
986 * PARAMETERS: Type - Type of execution
987 * Function - Address of the function to execute
988 * Context - Passed as a parameter to the function
990 * RETURN: Status.
992 * DESCRIPTION: Execute a new thread
994 *****************************************************************************/
996 ACPI_STATUS
997 AcpiOsExecute (
998 ACPI_EXECUTE_TYPE Type,
999 ACPI_OSD_EXEC_CALLBACK Function,
1000 void *Context)
1003 return 0;
1007 /******************************************************************************
1009 * FUNCTION: AcpiOsBreakpoint
1011 * PARAMETERS: Msg Message to print
1013 * RETURN: Status
1015 * DESCRIPTION: Print a message and break to the debugger.
1017 *****************************************************************************/
1019 ACPI_STATUS
1020 AcpiOsBreakpoint (
1021 char *Msg)
1024 /* Print the message and do an INT 3 */
1026 if (Msg)
1028 AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg);
1030 else
1032 AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
1036 return AE_OK;
1040 /******************************************************************************
1042 * FUNCTION: AcpiOsStall
1044 * PARAMETERS: microseconds To sleep
1046 * RETURN: Blocks until sleep is completed.
1048 * DESCRIPTION: Sleep at microsecond granularity
1050 *****************************************************************************/
1052 void
1053 AcpiOsStall (
1054 UINT32 microseconds)
1057 return;
1061 /******************************************************************************
1063 * FUNCTION: AcpiOsSleep
1065 * PARAMETERS: milliseconds To sleep
1067 * RETURN: Blocks until sleep is completed.
1069 * DESCRIPTION: Sleep at millisecond granularity
1071 *****************************************************************************/
1073 void
1074 AcpiOsSleep (
1075 ACPI_INTEGER milliseconds)
1078 return;
1082 /******************************************************************************
1084 * FUNCTION: AcpiOsGetTimer
1086 * PARAMETERS: None
1088 * RETURN: Current time in 100 nanosecond units
1090 * DESCRIPTION: Get the current system time
1092 *****************************************************************************/
1094 UINT64
1095 AcpiOsGetTimer (void)
1097 UINT64 Time;
1099 Time.Lo = 0;
1100 Time.Hi = 0;
1101 return (Time);
1105 /******************************************************************************
1107 * FUNCTION: AcpiOsValidateInterface
1109 * PARAMETERS: Interface - Requested interface to be validated
1111 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1113 * DESCRIPTION: Match an interface string to the interfaces supported by the
1114 * host. Strings originate from an AML call to the _OSI method.
1116 *****************************************************************************/
1118 ACPI_STATUS
1119 AcpiOsValidateInterface (
1120 char *Interface)
1123 return (AE_SUPPORT);
1127 /******************************************************************************
1129 * FUNCTION: AcpiOsValidateAddress
1131 * PARAMETERS: SpaceId - ACPI space ID
1132 * Address - Physical address
1133 * Length - Address length
1135 * RETURN: AE_OK if Address/Length is valid for the SpaceId. Otherwise,
1136 * should return AE_AML_ILLEGAL_ADDRESS.
1138 * DESCRIPTION: Validate a system address via the host OS. Used to validate
1139 * the addresses accessed by AML operation regions.
1141 *****************************************************************************/
1143 ACPI_STATUS
1144 AcpiOsValidateAddress (
1145 UINT8 SpaceId,
1146 ACPI_PHYSICAL_ADDRESS Address,
1147 ACPI_SIZE Length)
1150 return (AE_OK);
1154 /******************************************************************************
1156 * FUNCTION: AcpiOsReadPciConfiguration
1158 * PARAMETERS: PciId Seg/Bus/Dev
1159 * Register Device Register
1160 * Value Buffer where value is placed
1161 * Width Number of bits
1163 * RETURN: Status
1165 * DESCRIPTION: Read data from PCI configuration space
1167 *****************************************************************************/
1169 ACPI_STATUS
1170 AcpiOsReadPciConfiguration (
1171 ACPI_PCI_ID *PciId,
1172 UINT32 Register,
1173 void *Value,
1174 UINT32 Width)
1177 return (AE_OK);
1181 /******************************************************************************
1183 * FUNCTION: AcpiOsWritePciConfiguration
1185 * PARAMETERS: PciId Seg/Bus/Dev
1186 * Register Device Register
1187 * Value Value to be written
1188 * Width Number of bits
1190 * RETURN: Status.
1192 * DESCRIPTION: Write data to PCI configuration space
1194 *****************************************************************************/
1196 ACPI_STATUS
1197 AcpiOsWritePciConfiguration (
1198 ACPI_PCI_ID *PciId,
1199 UINT32 Register,
1200 ACPI_INTEGER Value,
1201 UINT32 Width)
1204 return (AE_OK);
1207 /* TEMPORARY STUB FUNCTION */
1208 void
1209 AcpiOsDerivePciId(
1210 ACPI_HANDLE rhandle,
1211 ACPI_HANDLE chandle,
1212 ACPI_PCI_ID **PciId)
1218 /******************************************************************************
1220 * FUNCTION: AcpiOsReadPort
1222 * PARAMETERS: Address Address of I/O port/register to read
1223 * Value Where value is placed
1224 * Width Number of bits
1226 * RETURN: Value read from port
1228 * DESCRIPTION: Read data from an I/O port or register
1230 *****************************************************************************/
1232 ACPI_STATUS
1233 AcpiOsReadPort (
1234 ACPI_IO_ADDRESS Address,
1235 UINT32 *Value,
1236 UINT32 Width)
1239 switch (Width)
1241 case 8:
1242 *Value = 0xFF;
1243 break;
1245 case 16:
1246 *Value = 0xFFFF;
1247 break;
1249 case 32:
1250 *Value = 0xFFFFFFFF;
1251 break;
1254 return (AE_OK);
1258 /******************************************************************************
1260 * FUNCTION: AcpiOsWritePort
1262 * PARAMETERS: Address Address of I/O port/register to write
1263 * Value Value to write
1264 * Width Number of bits
1266 * RETURN: None
1268 * DESCRIPTION: Write data to an I/O port or register
1270 *****************************************************************************/
1272 ACPI_STATUS
1273 AcpiOsWritePort (
1274 ACPI_IO_ADDRESS Address,
1275 UINT32 Value,
1276 UINT32 Width)
1279 return (AE_OK);
1283 /******************************************************************************
1285 * FUNCTION: AcpiOsReadMemory
1287 * PARAMETERS: Address Physical Memory Address to read
1288 * Value Where value is placed
1289 * Width Number of bits
1291 * RETURN: Value read from physical memory address
1293 * DESCRIPTION: Read data from a physical memory address
1295 *****************************************************************************/
1297 ACPI_STATUS
1298 AcpiOsReadMemory (
1299 ACPI_PHYSICAL_ADDRESS Address,
1300 UINT32 *Value,
1301 UINT32 Width)
1304 switch (Width)
1306 case 8:
1307 case 16:
1308 case 32:
1309 *Value = 0;
1310 break;
1312 default:
1313 return (AE_BAD_PARAMETER);
1314 break;
1317 return (AE_OK);
1321 /******************************************************************************
1323 * FUNCTION: AcpiOsWriteMemory
1325 * PARAMETERS: Address Physical Memory Address to write
1326 * Value Value to write
1327 * Width Number of bits
1329 * RETURN: None
1331 * DESCRIPTION: Write data to a physical memory address
1333 *****************************************************************************/
1335 ACPI_STATUS
1336 AcpiOsWriteMemory (
1337 ACPI_PHYSICAL_ADDRESS Address,
1338 UINT32 Value,
1339 UINT32 Width)
1342 return (AE_OK);
1346 /******************************************************************************
1348 * FUNCTION: AcpiOsSignal
1350 * PARAMETERS: Function ACPI CA signal function code
1351 * Info Pointer to function-dependent structure
1353 * RETURN: Status
1355 * DESCRIPTION: Miscellaneous functions
1357 *****************************************************************************/
1359 ACPI_STATUS
1360 AcpiOsSignal (
1361 UINT32 Function,
1362 void *Info)
1365 return (AE_OK);