1 /******************************************************************************
3 * Module Name: osunixxf - UNIX OSL interfaces
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
46 * These interfaces are required in order to compile the ASL compiler and the
47 * various ACPICA tools under Linux or other Unix-like system.
60 #include <semaphore.h>
64 #define _COMPONENT ACPI_OS_SERVICES
65 ACPI_MODULE_NAME ("osunixxf")
68 extern FILE *AcpiGbl_DebugFile
;
69 FILE *AcpiGbl_OutputFile
;
70 BOOLEAN AcpiGbl_DebugTimeout
= FALSE
;
73 /* Upcalls to AcpiExec */
76 AeLocalGetRootPointer (
81 ACPI_TABLE_HEADER
*ExistingTable
,
82 ACPI_TABLE_HEADER
**NewTable
);
84 typedef void* (*PTHREAD_CALLBACK
) (void *);
86 /* Buffer used by AcpiOsVprintf */
88 #define ACPI_VPRINTF_BUFFER_SIZE 512
89 #define _ASCII_NEWLINE '\n'
91 /* Terminal support for AcpiExec only */
96 struct termios OriginalTermAttributes
;
105 OsEnterLineEditMode (
113 /******************************************************************************
115 * FUNCTION: OsEnterLineEditMode, OsExitLineEditMode
121 * DESCRIPTION: Enter/Exit the raw character input mode for the terminal.
123 * Interactive line-editing support for the AML debugger. Used with the
124 * common/acgetline module.
126 * readline() is not used because of non-portability. It is not available
127 * on all systems, and if it is, often the package must be manually installed.
129 * Therefore, we use the POSIX tcgetattr/tcsetattr and do the minimal line
130 * editing that we need in AcpiOsGetLine.
132 * If the POSIX tcgetattr/tcsetattr interfaces are unavailable, these
133 * calls will also work:
134 * For OsEnterLineEditMode: system ("stty cbreak -echo")
135 * For OsExitLineEditMode: system ("stty cooked echo")
137 *****************************************************************************/
140 OsEnterLineEditMode (
143 struct termios LocalTermAttributes
;
146 /* Get and keep the original attributes */
148 if (tcgetattr (STDIN_FILENO
, &OriginalTermAttributes
))
150 fprintf (stderr
, "Could not get/set terminal attributes!\n");
154 /* Set the new attributes to enable raw character input */
156 memcpy (&LocalTermAttributes
, &OriginalTermAttributes
,
157 sizeof (struct termios
));
159 LocalTermAttributes
.c_lflag
&= ~(ICANON
| ECHO
);
160 LocalTermAttributes
.c_cc
[VMIN
] = 1;
161 LocalTermAttributes
.c_cc
[VTIME
] = 0;
163 tcsetattr (STDIN_FILENO
, TCSANOW
, &LocalTermAttributes
);
170 /* Set terminal attributes back to the original values */
172 tcsetattr (STDIN_FILENO
, TCSANOW
, &OriginalTermAttributes
);
178 /* These functions are not needed for other ACPICA utilities */
180 #define OsEnterLineEditMode()
181 #define OsExitLineEditMode()
185 /******************************************************************************
187 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
193 * DESCRIPTION: Initialize and terminate this module.
195 *****************************************************************************/
202 AcpiGbl_OutputFile
= stdout
;
204 OsEnterLineEditMode ();
213 OsExitLineEditMode ();
218 /******************************************************************************
220 * FUNCTION: AcpiOsGetRootPointer
224 * RETURN: RSDP physical address
226 * DESCRIPTION: Gets the ACPI root pointer (RSDP)
228 *****************************************************************************/
230 ACPI_PHYSICAL_ADDRESS
231 AcpiOsGetRootPointer (
235 return (AeLocalGetRootPointer ());
239 /******************************************************************************
241 * FUNCTION: AcpiOsPredefinedOverride
243 * PARAMETERS: InitVal - Initial value of the predefined object
244 * NewVal - The new value for the object
246 * RETURN: Status, pointer to value. Null pointer returned if not
249 * DESCRIPTION: Allow the OS to override predefined names
251 *****************************************************************************/
254 AcpiOsPredefinedOverride (
255 const ACPI_PREDEFINED_NAMES
*InitVal
,
259 if (!InitVal
|| !NewVal
)
261 return (AE_BAD_PARAMETER
);
269 /******************************************************************************
271 * FUNCTION: AcpiOsTableOverride
273 * PARAMETERS: ExistingTable - Header of current table (probably
275 * NewTable - Where an entire new table is returned.
277 * RETURN: Status, pointer to new table. Null pointer returned if no
278 * table is available to override
280 * DESCRIPTION: Return a different version of a table if one is available
282 *****************************************************************************/
285 AcpiOsTableOverride (
286 ACPI_TABLE_HEADER
*ExistingTable
,
287 ACPI_TABLE_HEADER
**NewTable
)
290 if (!ExistingTable
|| !NewTable
)
292 return (AE_BAD_PARAMETER
);
299 AeTableOverride (ExistingTable
, NewTable
);
303 return (AE_NO_ACPI_TABLES
);
308 /******************************************************************************
310 * FUNCTION: AcpiOsPhysicalTableOverride
312 * PARAMETERS: ExistingTable - Header of current table (probably firmware)
313 * NewAddress - Where new table address is returned
315 * NewTableLength - Where new table length is returned
317 * RETURN: Status, address/length of new table. Null pointer returned
318 * if no table is available to override.
320 * DESCRIPTION: Returns AE_SUPPORT, function not used in user space.
322 *****************************************************************************/
325 AcpiOsPhysicalTableOverride (
326 ACPI_TABLE_HEADER
*ExistingTable
,
327 ACPI_PHYSICAL_ADDRESS
*NewAddress
,
328 UINT32
*NewTableLength
)
335 /******************************************************************************
337 * FUNCTION: AcpiOsRedirectOutput
339 * PARAMETERS: Destination - An open file handle/pointer
343 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
345 *****************************************************************************/
348 AcpiOsRedirectOutput (
352 AcpiGbl_OutputFile
= Destination
;
356 /******************************************************************************
358 * FUNCTION: AcpiOsPrintf
360 * PARAMETERS: fmt, ... - Standard printf format
364 * DESCRIPTION: Formatted output. Note: very similar to AcpiOsVprintf
365 * (performance), changes should be tracked in both functions.
367 *****************************************************************************/
369 void ACPI_INTERNAL_VAR_XFACE
378 Flags
= AcpiGbl_DbOutputFlags
;
379 if (Flags
& ACPI_DB_REDIRECTABLE_OUTPUT
)
381 /* Output is directable to either a file (if open) or the console */
383 if (AcpiGbl_DebugFile
)
385 /* Output file is open, send the output there */
387 va_start (Args
, Fmt
);
388 vfprintf (AcpiGbl_DebugFile
, Fmt
, Args
);
393 /* No redirection, send output to console (once only!) */
395 Flags
|= ACPI_DB_CONSOLE_OUTPUT
;
399 if (Flags
& ACPI_DB_CONSOLE_OUTPUT
)
401 va_start (Args
, Fmt
);
402 vfprintf (AcpiGbl_OutputFile
, Fmt
, Args
);
408 /******************************************************************************
410 * FUNCTION: AcpiOsVprintf
412 * PARAMETERS: fmt - Standard printf format
413 * args - Argument list
417 * DESCRIPTION: Formatted output with argument list pointer. Note: very
418 * similar to AcpiOsPrintf, changes should be tracked in both
421 *****************************************************************************/
429 char Buffer
[ACPI_VPRINTF_BUFFER_SIZE
];
433 * We build the output string in a local buffer because we may be
434 * outputting the buffer twice. Using vfprintf is problematic because
435 * some implementations modify the args pointer/structure during
436 * execution. Thus, we use the local buffer for portability.
438 * Note: Since this module is intended for use by the various ACPICA
439 * utilities/applications, we can safely declare the buffer on the stack.
440 * Also, This function is used for relatively small error messages only.
442 vsnprintf (Buffer
, ACPI_VPRINTF_BUFFER_SIZE
, Fmt
, Args
);
444 Flags
= AcpiGbl_DbOutputFlags
;
445 if (Flags
& ACPI_DB_REDIRECTABLE_OUTPUT
)
447 /* Output is directable to either a file (if open) or the console */
449 if (AcpiGbl_DebugFile
)
451 /* Output file is open, send the output there */
453 fputs (Buffer
, AcpiGbl_DebugFile
);
457 /* No redirection, send output to console (once only!) */
459 Flags
|= ACPI_DB_CONSOLE_OUTPUT
;
463 if (Flags
& ACPI_DB_CONSOLE_OUTPUT
)
465 fputs (Buffer
, AcpiGbl_OutputFile
);
470 #ifndef ACPI_EXEC_APP
471 /******************************************************************************
473 * FUNCTION: AcpiOsGetLine
475 * PARAMETERS: Buffer - Where to return the command line
476 * BufferLength - Maximum length of Buffer
477 * BytesRead - Where the actual byte count is returned
479 * RETURN: Status and actual bytes read
481 * DESCRIPTION: Get the next input line from the terminal. NOTE: For the
482 * AcpiExec utility, we use the acgetline module instead to
483 * provide line-editing and history support.
485 *****************************************************************************/
497 /* Standard AcpiOsGetLine for all utilities except AcpiExec */
499 for (EndOfLine
= 0; ; EndOfLine
++)
501 if (EndOfLine
>= BufferLength
)
503 return (AE_BUFFER_OVERFLOW
);
506 if ((InputChar
= getchar ()) == EOF
)
511 if (!InputChar
|| InputChar
== _ASCII_NEWLINE
)
516 Buffer
[EndOfLine
] = (char) InputChar
;
519 /* Null terminate the buffer */
521 Buffer
[EndOfLine
] = 0;
523 /* Return the number of bytes in the string */
527 *BytesRead
= EndOfLine
;
535 /******************************************************************************
537 * FUNCTION: AcpiOsMapMemory
539 * PARAMETERS: where - Physical address of memory to be mapped
540 * length - How much memory to map
542 * RETURN: Pointer to mapped memory. Null on error.
544 * DESCRIPTION: Map physical memory into caller's address space
546 *****************************************************************************/
550 ACPI_PHYSICAL_ADDRESS where
,
554 return (ACPI_TO_POINTER ((ACPI_SIZE
) where
));
558 /******************************************************************************
560 * FUNCTION: AcpiOsUnmapMemory
562 * PARAMETERS: where - Logical address of memory to be unmapped
563 * length - How much memory to unmap
567 * DESCRIPTION: Delete a previously created mapping. Where and Length must
568 * correspond to a previous mapping exactly.
570 *****************************************************************************/
582 /******************************************************************************
584 * FUNCTION: AcpiOsAllocate
586 * PARAMETERS: Size - Amount to allocate, in bytes
588 * RETURN: Pointer to the new allocation. Null on error.
590 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
592 *****************************************************************************/
601 Mem
= (void *) malloc ((size_t) size
);
606 /******************************************************************************
608 * FUNCTION: AcpiOsFree
610 * PARAMETERS: mem - Pointer to previously allocated memory
614 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
616 *****************************************************************************/
627 #ifdef ACPI_SINGLE_THREADED
628 /******************************************************************************
630 * FUNCTION: Semaphore stub functions
632 * DESCRIPTION: Stub functions used for single-thread applications that do
633 * not require semaphore synchronization. Full implementations
634 * of these functions appear after the stubs.
636 *****************************************************************************/
639 AcpiOsCreateSemaphore (
642 ACPI_HANDLE
*OutHandle
)
644 *OutHandle
= (ACPI_HANDLE
) 1;
649 AcpiOsDeleteSemaphore (
656 AcpiOsWaitSemaphore (
665 AcpiOsSignalSemaphore (
673 /******************************************************************************
675 * FUNCTION: AcpiOsCreateSemaphore
677 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore
678 * OutHandle - Where a handle will be returned
682 * DESCRIPTION: Create an OS semaphore
684 *****************************************************************************/
687 AcpiOsCreateSemaphore (
690 ACPI_HANDLE
*OutHandle
)
697 return (AE_BAD_PARAMETER
);
702 char *SemaphoreName
= tmpnam (NULL
);
704 Sem
= sem_open (SemaphoreName
, O_EXCL
|O_CREAT
, 0755, InitialUnits
);
707 return (AE_NO_MEMORY
);
709 sem_unlink (SemaphoreName
); /* This just deletes the name */
713 Sem
= AcpiOsAllocate (sizeof (sem_t
));
716 return (AE_NO_MEMORY
);
719 if (sem_init (Sem
, 0, InitialUnits
) == -1)
722 return (AE_BAD_PARAMETER
);
726 *OutHandle
= (ACPI_HANDLE
) Sem
;
731 /******************************************************************************
733 * FUNCTION: AcpiOsDeleteSemaphore
735 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
739 * DESCRIPTION: Delete an OS semaphore
741 *****************************************************************************/
744 AcpiOsDeleteSemaphore (
747 sem_t
*Sem
= (sem_t
*) Handle
;
752 return (AE_BAD_PARAMETER
);
755 if (sem_destroy (Sem
) == -1)
757 return (AE_BAD_PARAMETER
);
764 /******************************************************************************
766 * FUNCTION: AcpiOsWaitSemaphore
768 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
769 * Units - How many units to wait for
770 * MsecTimeout - How long to wait (milliseconds)
774 * DESCRIPTION: Wait for units
776 *****************************************************************************/
779 AcpiOsWaitSemaphore (
784 ACPI_STATUS Status
= AE_OK
;
785 sem_t
*Sem
= (sem_t
*) Handle
;
786 #ifndef ACPI_USE_ALTERNATE_TIMEOUT
787 struct timespec Time
;
794 return (AE_BAD_PARAMETER
);
802 * A zero timeout value indicates that we shouldn't wait - just
803 * acquire the semaphore if available otherwise return AE_TIME
804 * (a.k.a. 'would block').
808 if (sem_trywait(Sem
) == -1)
814 /* Wait Indefinitely */
816 case ACPI_WAIT_FOREVER
:
824 /* Wait with MsecTimeout */
828 #ifdef ACPI_USE_ALTERNATE_TIMEOUT
830 * Alternate timeout mechanism for environments where
831 * sem_timedwait is not available or does not work properly.
835 if (sem_trywait (Sem
) == 0)
837 /* Got the semaphore */
841 if (MsecTimeout
>= 10)
844 usleep (10 * ACPI_USEC_PER_MSEC
); /* ten milliseconds */
849 usleep (ACPI_USEC_PER_MSEC
); /* one millisecond */
855 * The interface to sem_timedwait is an absolute time, so we need to
856 * get the current time, then add in the millisecond Timeout value.
858 if (clock_gettime (CLOCK_REALTIME
, &Time
) == -1)
860 perror ("clock_gettime");
864 Time
.tv_sec
+= (MsecTimeout
/ ACPI_MSEC_PER_SEC
);
865 Time
.tv_nsec
+= ((MsecTimeout
% ACPI_MSEC_PER_SEC
) * ACPI_NSEC_PER_MSEC
);
867 /* Handle nanosecond overflow (field must be less than one second) */
869 if (Time
.tv_nsec
>= ACPI_NSEC_PER_SEC
)
871 Time
.tv_sec
+= (Time
.tv_nsec
/ ACPI_NSEC_PER_SEC
);
872 Time
.tv_nsec
= (Time
.tv_nsec
% ACPI_NSEC_PER_SEC
);
875 while (((RetVal
= sem_timedwait (Sem
, &Time
)) == -1) && (errno
== EINTR
))
882 if (errno
!= ETIMEDOUT
)
884 perror ("sem_timedwait");
896 /******************************************************************************
898 * FUNCTION: AcpiOsSignalSemaphore
900 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
901 * Units - Number of units to send
905 * DESCRIPTION: Send units
907 *****************************************************************************/
910 AcpiOsSignalSemaphore (
914 sem_t
*Sem
= (sem_t
*)Handle
;
919 return (AE_BAD_PARAMETER
);
922 if (sem_post (Sem
) == -1)
930 #endif /* ACPI_SINGLE_THREADED */
933 /******************************************************************************
935 * FUNCTION: Spinlock interfaces
937 * DESCRIPTION: Map these interfaces to semaphore interfaces
939 *****************************************************************************/
943 ACPI_SPINLOCK
*OutHandle
)
946 return (AcpiOsCreateSemaphore (1, 1, OutHandle
));
952 ACPI_SPINLOCK Handle
)
954 AcpiOsDeleteSemaphore (Handle
);
962 AcpiOsWaitSemaphore (Handle
, 1, 0xFFFF);
969 ACPI_SPINLOCK Handle
,
970 ACPI_CPU_FLAGS Flags
)
972 AcpiOsSignalSemaphore (Handle
, 1);
976 /******************************************************************************
978 * FUNCTION: AcpiOsInstallInterruptHandler
980 * PARAMETERS: InterruptNumber - Level handler should respond to.
981 * Isr - Address of the ACPI interrupt handler
982 * ExceptPtr - Where status is returned
984 * RETURN: Handle to the newly installed handler.
986 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
987 * OS-independent handler.
989 *****************************************************************************/
992 AcpiOsInstallInterruptHandler (
993 UINT32 InterruptNumber
,
994 ACPI_OSD_HANDLER ServiceRoutine
,
1002 /******************************************************************************
1004 * FUNCTION: AcpiOsRemoveInterruptHandler
1006 * PARAMETERS: Handle - Returned when handler was installed
1010 * DESCRIPTION: Uninstalls an interrupt handler.
1012 *****************************************************************************/
1015 AcpiOsRemoveInterruptHandler (
1016 UINT32 InterruptNumber
,
1017 ACPI_OSD_HANDLER ServiceRoutine
)
1024 /******************************************************************************
1026 * FUNCTION: AcpiOsStall
1028 * PARAMETERS: microseconds - Time to sleep
1030 * RETURN: Blocks until sleep is completed.
1032 * DESCRIPTION: Sleep at microsecond granularity
1034 *****************************************************************************/
1038 UINT32 microseconds
)
1043 usleep (microseconds
);
1048 /******************************************************************************
1050 * FUNCTION: AcpiOsSleep
1052 * PARAMETERS: milliseconds - Time to sleep
1054 * RETURN: Blocks until sleep is completed.
1056 * DESCRIPTION: Sleep at millisecond granularity
1058 *****************************************************************************/
1062 UINT64 milliseconds
)
1065 /* Sleep for whole seconds */
1067 sleep (milliseconds
/ ACPI_MSEC_PER_SEC
);
1070 * Sleep for remaining microseconds.
1071 * Arg to usleep() is in usecs and must be less than 1,000,000 (1 second).
1073 usleep ((milliseconds
% ACPI_MSEC_PER_SEC
) * ACPI_USEC_PER_MSEC
);
1077 /******************************************************************************
1079 * FUNCTION: AcpiOsGetTimer
1083 * RETURN: Current time in 100 nanosecond units
1085 * DESCRIPTION: Get the current system time
1087 *****************************************************************************/
1093 struct timeval time
;
1096 /* This timer has sufficient resolution for user-space application code */
1098 gettimeofday (&time
, NULL
);
1100 /* (Seconds * 10^7 = 100ns(10^-7)) + (Microseconds(10^-6) * 10^1 = 100ns) */
1102 return (((UINT64
) time
.tv_sec
* ACPI_100NSEC_PER_SEC
) +
1103 ((UINT64
) time
.tv_usec
* ACPI_100NSEC_PER_USEC
));
1107 /******************************************************************************
1109 * FUNCTION: AcpiOsReadPciConfiguration
1111 * PARAMETERS: PciId - Seg/Bus/Dev
1112 * Register - Device Register
1113 * Value - Buffer where value is placed
1114 * Width - Number of bits
1118 * DESCRIPTION: Read data from PCI configuration space
1120 *****************************************************************************/
1123 AcpiOsReadPciConfiguration (
1135 /******************************************************************************
1137 * FUNCTION: AcpiOsWritePciConfiguration
1139 * PARAMETERS: PciId - Seg/Bus/Dev
1140 * Register - Device Register
1141 * Value - Value to be written
1142 * Width - Number of bits
1146 * DESCRIPTION: Write data to PCI configuration space
1148 *****************************************************************************/
1151 AcpiOsWritePciConfiguration (
1162 /******************************************************************************
1164 * FUNCTION: AcpiOsReadPort
1166 * PARAMETERS: Address - Address of I/O port/register to read
1167 * Value - Where value is placed
1168 * Width - Number of bits
1170 * RETURN: Value read from port
1172 * DESCRIPTION: Read data from an I/O port or register
1174 *****************************************************************************/
1178 ACPI_IO_ADDRESS Address
,
1197 *Value
= 0xFFFFFFFF;
1202 return (AE_BAD_PARAMETER
);
1209 /******************************************************************************
1211 * FUNCTION: AcpiOsWritePort
1213 * PARAMETERS: Address - Address of I/O port/register to write
1214 * Value - Value to write
1215 * Width - Number of bits
1219 * DESCRIPTION: Write data to an I/O port or register
1221 *****************************************************************************/
1225 ACPI_IO_ADDRESS Address
,
1234 /******************************************************************************
1236 * FUNCTION: AcpiOsReadMemory
1238 * PARAMETERS: Address - Physical Memory Address to read
1239 * Value - Where value is placed
1240 * Width - Number of bits (8,16,32, or 64)
1242 * RETURN: Value read from physical memory address. Always returned
1243 * as a 64-bit integer, regardless of the read width.
1245 * DESCRIPTION: Read data from a physical memory address
1247 *****************************************************************************/
1251 ACPI_PHYSICAL_ADDRESS Address
,
1268 return (AE_BAD_PARAMETER
);
1274 /******************************************************************************
1276 * FUNCTION: AcpiOsWriteMemory
1278 * PARAMETERS: Address - Physical Memory Address to write
1279 * Value - Value to write
1280 * Width - Number of bits (8,16,32, or 64)
1284 * DESCRIPTION: Write data to a physical memory address
1286 *****************************************************************************/
1290 ACPI_PHYSICAL_ADDRESS Address
,
1299 /******************************************************************************
1301 * FUNCTION: AcpiOsReadable
1303 * PARAMETERS: Pointer - Area to be verified
1304 * Length - Size of area
1306 * RETURN: TRUE if readable for entire length
1308 * DESCRIPTION: Verify that a pointer is valid for reading
1310 *****************************************************************************/
1322 /******************************************************************************
1324 * FUNCTION: AcpiOsWritable
1326 * PARAMETERS: Pointer - Area to be verified
1327 * Length - Size of area
1329 * RETURN: TRUE if writable for entire length
1331 * DESCRIPTION: Verify that a pointer is valid for writing
1333 *****************************************************************************/
1345 /******************************************************************************
1347 * FUNCTION: AcpiOsSignal
1349 * PARAMETERS: Function - ACPI CA signal function code
1350 * Info - Pointer to function-dependent structure
1354 * DESCRIPTION: Miscellaneous functions. Example implementation only.
1356 *****************************************************************************/
1366 case ACPI_SIGNAL_FATAL
:
1370 case ACPI_SIGNAL_BREAKPOINT
:
1382 /* Optional multi-thread support */
1384 #ifndef ACPI_SINGLE_THREADED
1385 /******************************************************************************
1387 * FUNCTION: AcpiOsGetThreadId
1391 * RETURN: Id of the running thread
1393 * DESCRIPTION: Get the ID of the current (running) thread
1395 *****************************************************************************/
1404 thread
= pthread_self();
1405 return (ACPI_CAST_PTHREAD_T (thread
));
1409 /******************************************************************************
1411 * FUNCTION: AcpiOsExecute
1413 * PARAMETERS: Type - Type of execution
1414 * Function - Address of the function to execute
1415 * Context - Passed as a parameter to the function
1419 * DESCRIPTION: Execute a new thread
1421 *****************************************************************************/
1425 ACPI_EXECUTE_TYPE Type
,
1426 ACPI_OSD_EXEC_CALLBACK Function
,
1433 ret
= pthread_create (&thread
, NULL
, (PTHREAD_CALLBACK
) Function
, Context
);
1436 AcpiOsPrintf("Create thread failed");
1441 #endif /* ACPI_SINGLE_THREADED */
1444 /******************************************************************************
1446 * FUNCTION: AcpiOsWaitEventsComplete
1452 * DESCRIPTION: Wait for all asynchronous events to complete. This
1453 * implementation does nothing.
1455 *****************************************************************************/
1458 AcpiOsWaitEventsComplete (