1 /******************************************************************************
3 * Module Name: oswinxf - Windows OSL
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
12 * All rights reserved.
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
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
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
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
72 * 3.4. Intel retains all right, title, and interest in and to the Original
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
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
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 #pragma warning(disable:4115) /* warning C4115: named type definition in parentheses (caused by rpcasync.h> */
124 #include <windowsx.h>
134 #include "accommon.h"
136 #define _COMPONENT ACPI_OS_SERVICES
137 ACPI_MODULE_NAME ("oswinxf")
140 /* Semaphore information structure */
142 typedef struct acpi_os_semaphore_info
148 } ACPI_OS_SEMAPHORE_INFO;
150 /* Need enough semaphores to run the large aslts suite */
152 #define ACPI_OS_MAX_SEMAPHORES 256
154 ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES];
157 /* Upcalls to AcpiExec */
159 ACPI_PHYSICAL_ADDRESS
160 AeLocalGetRootPointer (
165 ACPI_TABLE_HEADER *ExistingTable,
166 ACPI_TABLE_HEADER **NewTable);
173 extern FILE *AcpiGbl_DebugFile;
174 extern BOOLEAN AcpiGbl_DebugTimeout;
176 FILE *AcpiGbl_OutputFile;
177 UINT64 TimerFrequency;
178 char TableName[ACPI_NAME_SIZE + 1];
180 #define ACPI_OS_DEBUG_TIMEOUT 30000 /* 30 seconds */
183 /******************************************************************************
185 * FUNCTION: AcpiOsTerminate
191 * DESCRIPTION: Nothing to do for windows
193 *****************************************************************************/
196 AcpiOsTerminate (void)
202 /******************************************************************************
204 * FUNCTION: AcpiOsInitialize
210 * DESCRIPTION: Init this OSL
212 *****************************************************************************/
215 AcpiOsInitialize (void)
217 LARGE_INTEGER LocalTimerFrequency;
220 AcpiGbl_OutputFile = stdout;
222 /* Clear the semaphore info array */
224 memset (AcpiGbl_Semaphores, 0x00, sizeof (AcpiGbl_Semaphores));
226 /* Get the timer frequency for use in AcpiOsGetTimer */
229 if (QueryPerformanceFrequency (&LocalTimerFrequency))
231 /* Frequency is in ticks per second */
233 TimerFrequency = LocalTimerFrequency.QuadPart;
240 /******************************************************************************
242 * FUNCTION: AcpiOsGetRootPointer
246 * RETURN: RSDP physical address
248 * DESCRIPTION: Gets the root pointer (RSDP)
250 *****************************************************************************/
252 ACPI_PHYSICAL_ADDRESS
253 AcpiOsGetRootPointer (
257 return (AeLocalGetRootPointer ());
261 /******************************************************************************
263 * FUNCTION: AcpiOsPredefinedOverride
265 * PARAMETERS: InitVal - Initial value of the predefined object
266 * NewVal - The new value for the object
268 * RETURN: Status, pointer to value. Null pointer returned if not
271 * DESCRIPTION: Allow the OS to override predefined names
273 *****************************************************************************/
276 AcpiOsPredefinedOverride (
277 const ACPI_PREDEFINED_NAMES *InitVal,
281 if (!InitVal || !NewVal)
283 return (AE_BAD_PARAMETER);
291 /******************************************************************************
293 * FUNCTION: AcpiOsTableOverride
295 * PARAMETERS: ExistingTable - Header of current table (probably firmware)
296 * NewTable - Where an entire new table is returned.
298 * RETURN: Status, pointer to new table. Null pointer returned if no
299 * table is available to override
301 * DESCRIPTION: Return a different version of a table if one is available
303 *****************************************************************************/
306 AcpiOsTableOverride (
307 ACPI_TABLE_HEADER *ExistingTable,
308 ACPI_TABLE_HEADER **NewTable)
311 if (!ExistingTable || !NewTable)
313 return (AE_BAD_PARAMETER);
321 /* Call back up to AcpiExec */
323 AeTableOverride (ExistingTable, NewTable);
327 #ifdef ACPI_ASL_COMPILER
329 /* Attempt to get the table from the registry */
331 /* Construct a null-terminated string from table signature */
333 TableName[ACPI_NAME_SIZE] = 0;
334 ACPI_STRNCPY (TableName, ExistingTable->Signature, ACPI_NAME_SIZE);
336 *NewTable = OsGetTable (TableName);
339 AcpiOsPrintf ("Table [%s] obtained from registry, %d bytes\n",
340 TableName, (*NewTable)->Length);
344 AcpiOsPrintf ("Could not read table %s from registry\n", TableName);
352 /******************************************************************************
354 * FUNCTION: AcpiOsGetTimer
358 * RETURN: Current ticks in 100-nanosecond units
360 * DESCRIPTION: Get the value of a system timer
362 ******************************************************************************/
371 /* Attempt to use hi-granularity timer first */
373 if (TimerFrequency &&
374 QueryPerformanceCounter (&Timer))
376 /* Convert to 100 nanosecond ticks */
378 return ((UINT64) ((Timer.QuadPart * (UINT64) 10000000) / TimerFrequency));
381 /* Fall back to the lo-granularity timer */
385 /* Convert milliseconds to 100 nanosecond ticks */
387 return ((UINT64) GetTickCount() * 10000);
392 /******************************************************************************
394 * FUNCTION: AcpiOsReadable
396 * PARAMETERS: Pointer - Area to be verified
397 * Length - Size of area
399 * RETURN: TRUE if readable for entire length
401 * DESCRIPTION: Verify that a pointer is valid for reading
403 *****************************************************************************/
411 return ((BOOLEAN) !IsBadReadPtr (Pointer, Length));
415 /******************************************************************************
417 * FUNCTION: AcpiOsWritable
419 * PARAMETERS: Pointer - Area to be verified
420 * Length - Size of area
422 * RETURN: TRUE if writable for entire length
424 * DESCRIPTION: Verify that a pointer is valid for writing
426 *****************************************************************************/
434 return ((BOOLEAN) !IsBadWritePtr (Pointer, Length));
438 /******************************************************************************
440 * FUNCTION: AcpiOsRedirectOutput
442 * PARAMETERS: Destination - An open file handle/pointer
446 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
448 *****************************************************************************/
451 AcpiOsRedirectOutput (
455 AcpiGbl_OutputFile = Destination;
459 /******************************************************************************
461 * FUNCTION: AcpiOsPrintf
463 * PARAMETERS: fmt, ... Standard printf format
467 * DESCRIPTION: Formatted output
469 *****************************************************************************/
471 void ACPI_INTERNAL_VAR_XFACE
479 va_start (Args, Fmt);
481 AcpiOsVprintf (Fmt, Args);
488 /******************************************************************************
490 * FUNCTION: AcpiOsVprintf
492 * PARAMETERS: fmt Standard printf format
497 * DESCRIPTION: Formatted output with argument list pointer
499 *****************************************************************************/
510 Flags = AcpiGbl_DbOutputFlags;
511 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
513 /* Output is directable to either a file (if open) or the console */
515 if (AcpiGbl_DebugFile)
517 /* Output file is open, send the output there */
519 Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args);
523 /* No redirection, send output to console (once only!) */
525 Flags |= ACPI_DB_CONSOLE_OUTPUT;
529 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
531 Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args);
538 /******************************************************************************
540 * FUNCTION: AcpiOsGetLine
542 * PARAMETERS: fmt Standard printf format
545 * RETURN: Actual bytes read
547 * DESCRIPTION: Formatted input with argument list pointer
549 *****************************************************************************/
561 scanf ("%1c", &Temp);
562 if (!Temp || Temp == '\n')
570 /* Null terminate the buffer */
574 /* Return the number of bytes in the string */
580 /******************************************************************************
582 * FUNCTION: AcpiOsMapMemory
584 * PARAMETERS: where Physical address of memory to be mapped
585 * length How much memory to map
587 * RETURN: Pointer to mapped memory. Null on error.
589 * DESCRIPTION: Map physical memory into caller's address space
591 *****************************************************************************/
595 ACPI_PHYSICAL_ADDRESS where,
599 return (ACPI_TO_POINTER ((ACPI_SIZE) where));
603 /******************************************************************************
605 * FUNCTION: AcpiOsUnmapMemory
607 * PARAMETERS: where Logical address of memory to be unmapped
608 * length How much memory to unmap
612 * DESCRIPTION: Delete a previously created mapping. Where and Length must
613 * correspond to a previous mapping exactly.
615 *****************************************************************************/
627 /******************************************************************************
629 * FUNCTION: AcpiOsAllocate
631 * PARAMETERS: Size Amount to allocate, in bytes
633 * RETURN: Pointer to the new allocation. Null on error.
635 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
637 *****************************************************************************/
646 Mem = (void *) malloc ((size_t) size);
652 /******************************************************************************
654 * FUNCTION: AcpiOsFree
656 * PARAMETERS: mem Pointer to previously allocated memory
660 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
662 *****************************************************************************/
673 /******************************************************************************
675 * FUNCTION: AcpiOsCreateSemaphore
677 * PARAMETERS: MaxUnits - Maximum units that can be sent
678 * InitialUnits - Units to be assigned to the new semaphore
679 * OutHandle - Where a handle will be returned
683 * DESCRIPTION: Create an OS semaphore
685 *****************************************************************************/
688 AcpiOsCreateSemaphore (
691 ACPI_SEMAPHORE *OutHandle)
693 #ifdef _MULTI_THREADED
697 ACPI_FUNCTION_NAME (OsCreateSemaphore);
701 if (MaxUnits == ACPI_UINT32_MAX)
706 if (InitialUnits == ACPI_UINT32_MAX)
708 InitialUnits = MaxUnits;
711 if (InitialUnits > MaxUnits)
713 return AE_BAD_PARAMETER;
716 #ifdef _MULTI_THREADED
718 /* Find an empty slot */
720 for (i = 0; i < ACPI_OS_MAX_SEMAPHORES; i++)
722 if (!AcpiGbl_Semaphores[i].OsHandle)
727 if (i >= ACPI_OS_MAX_SEMAPHORES)
729 ACPI_EXCEPTION ((AE_INFO, AE_LIMIT,
730 "Reached max semaphores (%u), could not create", ACPI_OS_MAX_SEMAPHORES));
734 /* Create an OS semaphore */
736 Mutex = CreateSemaphore (NULL, InitialUnits, MaxUnits, NULL);
739 ACPI_ERROR ((AE_INFO, "Could not create semaphore"));
743 AcpiGbl_Semaphores[i].MaxUnits = (UINT16) MaxUnits;
744 AcpiGbl_Semaphores[i].CurrentUnits = (UINT16) InitialUnits;
745 AcpiGbl_Semaphores[i].OsHandle = Mutex;
747 ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Handle=%d, Max=%d, Current=%d, OsHandle=%p\n",
748 i, MaxUnits, InitialUnits, Mutex));
750 *OutHandle = (void *) i;
757 /******************************************************************************
759 * FUNCTION: AcpiOsDeleteSemaphore
761 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
765 * DESCRIPTION: Delete an OS semaphore
767 *****************************************************************************/
770 AcpiOsDeleteSemaphore (
771 ACPI_SEMAPHORE Handle)
773 UINT32 Index = (UINT32) Handle;
776 if ((Index >= ACPI_OS_MAX_SEMAPHORES) ||
777 !AcpiGbl_Semaphores[Index].OsHandle)
779 return AE_BAD_PARAMETER;
783 #ifdef _MULTI_THREADED
785 CloseHandle (AcpiGbl_Semaphores[Index].OsHandle);
786 AcpiGbl_Semaphores[Index].OsHandle = NULL;
793 /******************************************************************************
795 * FUNCTION: AcpiOsWaitSemaphore
797 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
798 * Units - How many units to wait for
799 * Timeout - How long to wait
803 * DESCRIPTION: Wait for units
805 *****************************************************************************/
808 AcpiOsWaitSemaphore (
809 ACPI_SEMAPHORE Handle,
813 #ifdef _MULTI_THREADED
814 UINT32 Index = (UINT32) Handle;
816 UINT32 OsTimeout = Timeout;
819 ACPI_FUNCTION_ENTRY ();
822 if ((Index >= ACPI_OS_MAX_SEMAPHORES) ||
823 !AcpiGbl_Semaphores[Index].OsHandle)
825 return AE_BAD_PARAMETER;
830 printf ("WaitSemaphore: Attempt to receive %d units\n", Units);
831 return AE_NOT_IMPLEMENTED;
834 if (Timeout == ACPI_WAIT_FOREVER)
836 OsTimeout = INFINITE;
837 if (AcpiGbl_DebugTimeout)
839 /* The debug timeout will prevent hang conditions */
841 OsTimeout = ACPI_OS_DEBUG_TIMEOUT;
846 /* Add 10ms to account for clock tick granularity */
851 WaitStatus = WaitForSingleObject (AcpiGbl_Semaphores[Index].OsHandle, OsTimeout);
852 if (WaitStatus == WAIT_TIMEOUT)
854 if (AcpiGbl_DebugTimeout)
856 ACPI_EXCEPTION ((AE_INFO, AE_TIME,
857 "Debug timeout on semaphore 0x%04X (%ums)\n",
858 Index, ACPI_OS_DEBUG_TIMEOUT));
863 if (AcpiGbl_Semaphores[Index].CurrentUnits == 0)
865 ACPI_ERROR ((AE_INFO, "%s - No unit received. Timeout 0x%X, OS_Status 0x%X",
866 AcpiUtGetMutexName (Index), Timeout, WaitStatus));
871 AcpiGbl_Semaphores[Index].CurrentUnits--;
878 /******************************************************************************
880 * FUNCTION: AcpiOsSignalSemaphore
882 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
883 * Units - Number of units to send
887 * DESCRIPTION: Send units
889 *****************************************************************************/
892 AcpiOsSignalSemaphore (
893 ACPI_SEMAPHORE Handle,
896 #ifdef _MULTI_THREADED
898 UINT32 Index = (UINT32) Handle;
901 ACPI_FUNCTION_ENTRY ();
904 if (Index >= ACPI_OS_MAX_SEMAPHORES)
906 printf ("SignalSemaphore: Index/Handle out of range: %2.2X\n", Index);
907 return AE_BAD_PARAMETER;
910 if (!AcpiGbl_Semaphores[Index].OsHandle)
912 printf ("SignalSemaphore: Null OS handle, Index %2.2X\n", Index);
913 return AE_BAD_PARAMETER;
918 printf ("SignalSemaphore: Attempt to signal %d units, Index %2.2X\n", Units, Index);
919 return AE_NOT_IMPLEMENTED;
922 if ((AcpiGbl_Semaphores[Index].CurrentUnits + 1) >
923 AcpiGbl_Semaphores[Index].MaxUnits)
925 ACPI_ERROR ((AE_INFO,
926 "Oversignalled semaphore[%u]! Current %u Max %u",
927 Index, AcpiGbl_Semaphores[Index].CurrentUnits,
928 AcpiGbl_Semaphores[Index].MaxUnits));
933 AcpiGbl_Semaphores[Index].CurrentUnits++;
934 ReleaseSemaphore (AcpiGbl_Semaphores[Index].OsHandle, Units, NULL);
942 /* Spinlock interfaces, just implement with a semaphore */
946 ACPI_SPINLOCK *OutHandle)
948 return (AcpiOsCreateSemaphore (1, 1, OutHandle));
953 ACPI_SPINLOCK Handle)
955 AcpiOsDeleteSemaphore (Handle);
960 ACPI_SPINLOCK Handle)
962 AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
968 ACPI_SPINLOCK Handle,
969 ACPI_CPU_FLAGS Flags)
971 AcpiOsSignalSemaphore (Handle, 1);
975 #if ACPI_FUTURE_IMPLEMENTATION
977 /* Mutex interfaces, just implement with a semaphore */
981 ACPI_MUTEX *OutHandle)
983 return (AcpiOsCreateSemaphore (1, 1, OutHandle));
990 AcpiOsDeleteSemaphore (Handle);
998 AcpiOsWaitSemaphore (Handle, 1, Timeout);
1003 AcpiOsReleaseMutex (
1006 AcpiOsSignalSemaphore (Handle, 1);
1011 /******************************************************************************
1013 * FUNCTION: AcpiOsInstallInterruptHandler
1015 * PARAMETERS: InterruptNumber Level handler should respond to.
1016 * Isr Address of the ACPI interrupt handler
1017 * ExceptPtr Where status is returned
1019 * RETURN: Handle to the newly installed handler.
1021 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
1022 * OS-independent handler.
1024 *****************************************************************************/
1027 AcpiOsInstallInterruptHandler (
1028 UINT32 InterruptNumber,
1029 ACPI_OSD_HANDLER ServiceRoutine,
1037 /******************************************************************************
1039 * FUNCTION: AcpiOsRemoveInterruptHandler
1041 * PARAMETERS: Handle Returned when handler was installed
1045 * DESCRIPTION: Uninstalls an interrupt handler.
1047 *****************************************************************************/
1050 AcpiOsRemoveInterruptHandler (
1051 UINT32 InterruptNumber,
1052 ACPI_OSD_HANDLER ServiceRoutine)
1059 /******************************************************************************
1061 * FUNCTION: AcpiOsGetThreadId
1065 * RETURN: Id of the running thread
1067 * DESCRIPTION: Get the Id of the current (running) thread
1069 *****************************************************************************/
1077 /* Ensure ID is never 0 */
1079 ThreadId = GetCurrentThreadId ();
1080 return (ThreadId + 1);
1084 /******************************************************************************
1086 * FUNCTION: AcpiOsExecute
1088 * PARAMETERS: Type - Type of execution
1089 * Function - Address of the function to execute
1090 * Context - Passed as a parameter to the function
1094 * DESCRIPTION: Execute a new thread
1096 *****************************************************************************/
1100 ACPI_EXECUTE_TYPE Type,
1101 ACPI_OSD_EXEC_CALLBACK Function,
1105 #ifdef _MULTI_THREADED
1106 _beginthread (Function, (unsigned) 0, Context);
1113 /******************************************************************************
1115 * FUNCTION: AcpiOsStall
1117 * PARAMETERS: microseconds To sleep
1119 * RETURN: Blocks until sleep is completed.
1121 * DESCRIPTION: Sleep at microsecond granularity
1123 *****************************************************************************/
1127 UINT32 microseconds)
1130 Sleep ((microseconds / 1000) + 1);
1135 /******************************************************************************
1137 * FUNCTION: AcpiOsSleep
1139 * PARAMETERS: milliseconds To sleep
1141 * RETURN: Blocks until sleep is completed.
1143 * DESCRIPTION: Sleep at millisecond granularity
1145 *****************************************************************************/
1149 UINT64 milliseconds)
1152 /* Add 10ms to account for clock tick granularity */
1154 Sleep (((unsigned long) milliseconds) + 10);
1159 /******************************************************************************
1161 * FUNCTION: AcpiOsValidateInterface
1163 * PARAMETERS: Interface - Requested interface to be validated
1165 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
1167 * DESCRIPTION: Match an interface string to the interfaces supported by the
1168 * host. Strings originate from an AML call to the _OSI method.
1170 *****************************************************************************/
1173 AcpiOsValidateInterface (
1177 return (AE_SUPPORT);
1181 /******************************************************************************
1183 * FUNCTION: AcpiOsReadPciConfiguration
1185 * PARAMETERS: PciId Seg/Bus/Dev
1186 * Register Device Register
1187 * Value Buffer where value is placed
1188 * Width Number of bits
1192 * DESCRIPTION: Read data from PCI configuration space
1194 *****************************************************************************/
1197 AcpiOsReadPciConfiguration (
1208 /******************************************************************************
1210 * FUNCTION: AcpiOsWritePciConfiguration
1212 * PARAMETERS: PciId Seg/Bus/Dev
1213 * Register Device Register
1214 * Value Value to be written
1215 * Width Number of bits
1219 * DESCRIPTION: Write data to PCI configuration space
1221 *****************************************************************************/
1224 AcpiOsWritePciConfiguration (
1234 /* TEMPORARY STUB FUNCTION */
1237 ACPI_HANDLE rhandle,
1238 ACPI_HANDLE chandle,
1239 ACPI_PCI_ID **PciId)
1246 /******************************************************************************
1248 * FUNCTION: AcpiOsReadPort
1250 * PARAMETERS: Address Address of I/O port/register to read
1251 * Value Where value is placed
1252 * Width Number of bits
1254 * RETURN: Value read from port
1256 * DESCRIPTION: Read data from an I/O port or register
1258 *****************************************************************************/
1262 ACPI_IO_ADDRESS Address,
1278 *Value = 0xFFFFFFFF;
1282 return (AE_BAD_PARAMETER);
1289 /******************************************************************************
1291 * FUNCTION: AcpiOsWritePort
1293 * PARAMETERS: Address Address of I/O port/register to write
1294 * Value Value to write
1295 * Width Number of bits
1299 * DESCRIPTION: Write data to an I/O port or register
1301 *****************************************************************************/
1305 ACPI_IO_ADDRESS Address,
1314 /******************************************************************************
1316 * FUNCTION: AcpiOsReadMemory
1318 * PARAMETERS: Address Physical Memory Address to read
1319 * Value Where value is placed
1320 * Width Number of bits
1322 * RETURN: Value read from physical memory address. Always returned
1323 * as a 32-bit integer, regardless of the read width.
1325 * DESCRIPTION: Read data from a physical memory address
1327 *****************************************************************************/
1331 ACPI_PHYSICAL_ADDRESS Address,
1345 return (AE_BAD_PARAMETER);
1353 /******************************************************************************
1355 * FUNCTION: AcpiOsWriteMemory
1357 * PARAMETERS: Address Physical Memory Address to write
1358 * Value Value to write
1359 * Width Number of bits
1363 * DESCRIPTION: Write data to a physical memory address
1365 *****************************************************************************/
1369 ACPI_PHYSICAL_ADDRESS Address,
1378 /******************************************************************************
1380 * FUNCTION: AcpiOsSignal
1382 * PARAMETERS: Function ACPI CA signal function code
1383 * Info Pointer to function-dependent structure
1387 * DESCRIPTION: Miscellaneous functions. Example implementation only.
1389 *****************************************************************************/
1399 case ACPI_SIGNAL_FATAL:
1402 case ACPI_SIGNAL_BREAKPOINT:
1413 /******************************************************************************
1415 * FUNCTION: Local cache interfaces
1417 * DESCRIPTION: Implements cache interfaces via malloc/free for testing
1420 *****************************************************************************/
1422 #ifndef ACPI_USE_LOCAL_CACHE
1429 ACPI_CACHE_T **ReturnCache)
1431 ACPI_MEMORY_LIST *NewCache;
1434 NewCache = malloc (sizeof (ACPI_MEMORY_LIST));
1437 return (AE_NO_MEMORY);
1440 memset (NewCache, 0, sizeof (ACPI_MEMORY_LIST));
1441 NewCache->LinkOffset = 8;
1442 NewCache->ListName = CacheName;
1443 NewCache->ObjectSize = ObjectSize;
1444 NewCache->MaxDepth = MaxDepth;
1446 *ReturnCache = (ACPI_CACHE_T) NewCache;
1452 ACPI_CACHE_T *Cache)
1460 ACPI_CACHE_T *Cache)
1466 AcpiOsAcquireObject (
1467 ACPI_CACHE_T *Cache)
1471 NewObject = malloc (((ACPI_MEMORY_LIST *) Cache)->ObjectSize);
1472 memset (NewObject, 0, ((ACPI_MEMORY_LIST *) Cache)->ObjectSize);
1478 AcpiOsReleaseObject (
1479 ACPI_CACHE_T *Cache,