1 /******************************************************************************
3 * Module Name: osunixxf - UNIX OSL interfaces
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2014, 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 FILE *AcpiGbl_OutputFile;
69 BOOLEAN AcpiGbl_DebugTimeout = FALSE;
72 /* Upcalls to AcpiExec */
75 AeLocalGetRootPointer (
80 ACPI_TABLE_HEADER *ExistingTable,
81 ACPI_TABLE_HEADER **NewTable);
83 typedef void* (*PTHREAD_CALLBACK) (void *);
85 /* Buffer used by AcpiOsVprintf */
87 #define ACPI_VPRINTF_BUFFER_SIZE 512
88 #define _ASCII_NEWLINE '\n'
90 /* Terminal support for AcpiExec only */
95 struct termios OriginalTermAttributes;
104 OsEnterLineEditMode (
112 /******************************************************************************
114 * FUNCTION: OsEnterLineEditMode, OsExitLineEditMode
120 * DESCRIPTION: Enter/Exit the raw character input mode for the terminal.
122 * Interactive line-editing support for the AML debugger. Used with the
123 * common/acgetline module.
125 * readline() is not used because of non-portability. It is not available
126 * on all systems, and if it is, often the package must be manually installed.
128 * Therefore, we use the POSIX tcgetattr/tcsetattr and do the minimal line
129 * editing that we need in AcpiOsGetLine.
131 * If the POSIX tcgetattr/tcsetattr interfaces are unavailable, these
132 * calls will also work:
133 * For OsEnterLineEditMode: system ("stty cbreak -echo")
134 * For OsExitLineEditMode: system ("stty cooked echo")
136 *****************************************************************************/
139 OsEnterLineEditMode (
142 struct termios LocalTermAttributes;
145 /* Get and keep the original attributes */
147 if (tcgetattr (STDIN_FILENO, &OriginalTermAttributes))
149 fprintf (stderr, "Could not get/set terminal attributes!\n");
153 /* Set the new attributes to enable raw character input */
155 memcpy (&LocalTermAttributes, &OriginalTermAttributes,
156 sizeof (struct termios));
158 LocalTermAttributes.c_lflag &= ~(ICANON | ECHO);
159 LocalTermAttributes.c_cc[VMIN] = 1;
160 LocalTermAttributes.c_cc[VTIME] = 0;
162 tcsetattr (STDIN_FILENO, TCSANOW, &LocalTermAttributes);
169 /* Set terminal attributes back to the original values */
171 tcsetattr (STDIN_FILENO, TCSANOW, &OriginalTermAttributes);
177 /* These functions are not needed for other ACPICA utilities */
179 #define OsEnterLineEditMode()
180 #define OsExitLineEditMode()
184 /******************************************************************************
186 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
192 * DESCRIPTION: Initialize and terminate this module.
194 *****************************************************************************/
201 AcpiGbl_OutputFile = stdout;
203 OsEnterLineEditMode ();
212 OsExitLineEditMode ();
217 /******************************************************************************
219 * FUNCTION: AcpiOsGetRootPointer
223 * RETURN: RSDP physical address
225 * DESCRIPTION: Gets the ACPI root pointer (RSDP)
227 *****************************************************************************/
229 ACPI_PHYSICAL_ADDRESS
230 AcpiOsGetRootPointer (
234 return (AeLocalGetRootPointer ());
238 /******************************************************************************
240 * FUNCTION: AcpiOsPredefinedOverride
242 * PARAMETERS: InitVal - Initial value of the predefined object
243 * NewVal - The new value for the object
245 * RETURN: Status, pointer to value. Null pointer returned if not
248 * DESCRIPTION: Allow the OS to override predefined names
250 *****************************************************************************/
253 AcpiOsPredefinedOverride (
254 const ACPI_PREDEFINED_NAMES *InitVal,
258 if (!InitVal || !NewVal)
260 return (AE_BAD_PARAMETER);
268 /******************************************************************************
270 * FUNCTION: AcpiOsTableOverride
272 * PARAMETERS: ExistingTable - Header of current table (probably
274 * NewTable - Where an entire new table is returned.
276 * RETURN: Status, pointer to new table. Null pointer returned if no
277 * table is available to override
279 * DESCRIPTION: Return a different version of a table if one is available
281 *****************************************************************************/
284 AcpiOsTableOverride (
285 ACPI_TABLE_HEADER *ExistingTable,
286 ACPI_TABLE_HEADER **NewTable)
289 if (!ExistingTable || !NewTable)
291 return (AE_BAD_PARAMETER);
298 AeTableOverride (ExistingTable, NewTable);
302 return (AE_NO_ACPI_TABLES);
307 /******************************************************************************
309 * FUNCTION: AcpiOsPhysicalTableOverride
311 * PARAMETERS: ExistingTable - Header of current table (probably firmware)
312 * NewAddress - Where new table address is returned
314 * NewTableLength - Where new table length is returned
316 * RETURN: Status, address/length of new table. Null pointer returned
317 * if no table is available to override.
319 * DESCRIPTION: Returns AE_SUPPORT, function not used in user space.
321 *****************************************************************************/
324 AcpiOsPhysicalTableOverride (
325 ACPI_TABLE_HEADER *ExistingTable,
326 ACPI_PHYSICAL_ADDRESS *NewAddress,
327 UINT32 *NewTableLength)
334 /******************************************************************************
336 * FUNCTION: AcpiOsRedirectOutput
338 * PARAMETERS: Destination - An open file handle/pointer
342 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
344 *****************************************************************************/
347 AcpiOsRedirectOutput (
351 AcpiGbl_OutputFile = Destination;
355 /******************************************************************************
357 * FUNCTION: AcpiOsPrintf
359 * PARAMETERS: fmt, ... - Standard printf format
363 * DESCRIPTION: Formatted output. Note: very similar to AcpiOsVprintf
364 * (performance), changes should be tracked in both functions.
366 *****************************************************************************/
368 void ACPI_INTERNAL_VAR_XFACE
377 Flags = AcpiGbl_DbOutputFlags;
378 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
380 /* Output is directable to either a file (if open) or the console */
382 if (AcpiGbl_DebugFile)
384 /* Output file is open, send the output there */
386 va_start (Args, Fmt);
387 vfprintf (AcpiGbl_DebugFile, Fmt, Args);
392 /* No redirection, send output to console (once only!) */
394 Flags |= ACPI_DB_CONSOLE_OUTPUT;
398 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
400 va_start (Args, Fmt);
401 vfprintf (AcpiGbl_OutputFile, Fmt, Args);
407 /******************************************************************************
409 * FUNCTION: AcpiOsVprintf
411 * PARAMETERS: fmt - Standard printf format
412 * args - Argument list
416 * DESCRIPTION: Formatted output with argument list pointer. Note: very
417 * similar to AcpiOsPrintf, changes should be tracked in both
420 *****************************************************************************/
428 char Buffer[ACPI_VPRINTF_BUFFER_SIZE];
432 * We build the output string in a local buffer because we may be
433 * outputting the buffer twice. Using vfprintf is problematic because
434 * some implementations modify the args pointer/structure during
435 * execution. Thus, we use the local buffer for portability.
437 * Note: Since this module is intended for use by the various ACPICA
438 * utilities/applications, we can safely declare the buffer on the stack.
439 * Also, This function is used for relatively small error messages only.
441 vsnprintf (Buffer, ACPI_VPRINTF_BUFFER_SIZE, Fmt, Args);
443 Flags = AcpiGbl_DbOutputFlags;
444 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
446 /* Output is directable to either a file (if open) or the console */
448 if (AcpiGbl_DebugFile)
450 /* Output file is open, send the output there */
452 fputs (Buffer, AcpiGbl_DebugFile);
456 /* No redirection, send output to console (once only!) */
458 Flags |= ACPI_DB_CONSOLE_OUTPUT;
462 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
464 fputs (Buffer, AcpiGbl_OutputFile);
469 #ifndef ACPI_EXEC_APP
470 /******************************************************************************
472 * FUNCTION: AcpiOsGetLine
474 * PARAMETERS: Buffer - Where to return the command line
475 * BufferLength - Maximum length of Buffer
476 * BytesRead - Where the actual byte count is returned
478 * RETURN: Status and actual bytes read
480 * DESCRIPTION: Get the next input line from the terminal. NOTE: For the
481 * AcpiExec utility, we use the acgetline module instead to
482 * provide line-editing and history support.
484 *****************************************************************************/
496 /* Standard AcpiOsGetLine for all utilities except AcpiExec */
498 for (EndOfLine = 0; ; EndOfLine++)
500 if (EndOfLine >= BufferLength)
502 return (AE_BUFFER_OVERFLOW);
505 if ((InputChar = getchar ()) == EOF)
510 if (!InputChar || InputChar == _ASCII_NEWLINE)
515 Buffer[EndOfLine] = (char) InputChar;
518 /* Null terminate the buffer */
520 Buffer[EndOfLine] = 0;
522 /* Return the number of bytes in the string */
526 *BytesRead = EndOfLine;
534 /******************************************************************************
536 * FUNCTION: AcpiOsMapMemory
538 * PARAMETERS: where - Physical address of memory to be mapped
539 * length - How much memory to map
541 * RETURN: Pointer to mapped memory. Null on error.
543 * DESCRIPTION: Map physical memory into caller's address space
545 *****************************************************************************/
549 ACPI_PHYSICAL_ADDRESS where,
553 return (ACPI_TO_POINTER ((ACPI_SIZE) where));
557 /******************************************************************************
559 * FUNCTION: AcpiOsUnmapMemory
561 * PARAMETERS: where - Logical address of memory to be unmapped
562 * length - How much memory to unmap
566 * DESCRIPTION: Delete a previously created mapping. Where and Length must
567 * correspond to a previous mapping exactly.
569 *****************************************************************************/
581 /******************************************************************************
583 * FUNCTION: AcpiOsAllocate
585 * PARAMETERS: Size - Amount to allocate, in bytes
587 * RETURN: Pointer to the new allocation. Null on error.
589 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
591 *****************************************************************************/
600 Mem = (void *) malloc ((size_t) size);
605 /******************************************************************************
607 * FUNCTION: AcpiOsFree
609 * PARAMETERS: mem - Pointer to previously allocated memory
613 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
615 *****************************************************************************/
626 #ifdef ACPI_SINGLE_THREADED
627 /******************************************************************************
629 * FUNCTION: Semaphore stub functions
631 * DESCRIPTION: Stub functions used for single-thread applications that do
632 * not require semaphore synchronization. Full implementations
633 * of these functions appear after the stubs.
635 *****************************************************************************/
638 AcpiOsCreateSemaphore (
641 ACPI_HANDLE *OutHandle)
643 *OutHandle = (ACPI_HANDLE) 1;
648 AcpiOsDeleteSemaphore (
655 AcpiOsWaitSemaphore (
664 AcpiOsSignalSemaphore (
672 /******************************************************************************
674 * FUNCTION: AcpiOsCreateSemaphore
676 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore
677 * OutHandle - Where a handle will be returned
681 * DESCRIPTION: Create an OS semaphore
683 *****************************************************************************/
686 AcpiOsCreateSemaphore (
689 ACPI_HANDLE *OutHandle)
696 return (AE_BAD_PARAMETER);
701 char *SemaphoreName = tmpnam (NULL);
703 Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits);
706 return (AE_NO_MEMORY);
708 sem_unlink (SemaphoreName); /* This just deletes the name */
712 Sem = AcpiOsAllocate (sizeof (sem_t));
715 return (AE_NO_MEMORY);
718 if (sem_init (Sem, 0, InitialUnits) == -1)
721 return (AE_BAD_PARAMETER);
725 *OutHandle = (ACPI_HANDLE) Sem;
730 /******************************************************************************
732 * FUNCTION: AcpiOsDeleteSemaphore
734 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
738 * DESCRIPTION: Delete an OS semaphore
740 *****************************************************************************/
743 AcpiOsDeleteSemaphore (
746 sem_t *Sem = (sem_t *) Handle;
751 return (AE_BAD_PARAMETER);
754 if (sem_destroy (Sem) == -1)
756 return (AE_BAD_PARAMETER);
763 /******************************************************************************
765 * FUNCTION: AcpiOsWaitSemaphore
767 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
768 * Units - How many units to wait for
769 * MsecTimeout - How long to wait (milliseconds)
773 * DESCRIPTION: Wait for units
775 *****************************************************************************/
778 AcpiOsWaitSemaphore (
783 ACPI_STATUS Status = AE_OK;
784 sem_t *Sem = (sem_t *) Handle;
785 #ifndef ACPI_USE_ALTERNATE_TIMEOUT
786 struct timespec Time;
793 return (AE_BAD_PARAMETER);
801 * A zero timeout value indicates that we shouldn't wait - just
802 * acquire the semaphore if available otherwise return AE_TIME
803 * (a.k.a. 'would block').
807 if (sem_trywait(Sem) == -1)
813 /* Wait Indefinitely */
815 case ACPI_WAIT_FOREVER:
823 /* Wait with MsecTimeout */
827 #ifdef ACPI_USE_ALTERNATE_TIMEOUT
829 * Alternate timeout mechanism for environments where
830 * sem_timedwait is not available or does not work properly.
834 if (sem_trywait (Sem) == 0)
836 /* Got the semaphore */
840 if (MsecTimeout >= 10)
843 usleep (10 * ACPI_USEC_PER_MSEC); /* ten milliseconds */
848 usleep (ACPI_USEC_PER_MSEC); /* one millisecond */
854 * The interface to sem_timedwait is an absolute time, so we need to
855 * get the current time, then add in the millisecond Timeout value.
857 if (clock_gettime (CLOCK_REALTIME, &Time) == -1)
859 perror ("clock_gettime");
863 Time.tv_sec += (MsecTimeout / ACPI_MSEC_PER_SEC);
864 Time.tv_nsec += ((MsecTimeout % ACPI_MSEC_PER_SEC) * ACPI_NSEC_PER_MSEC);
866 /* Handle nanosecond overflow (field must be less than one second) */
868 if (Time.tv_nsec >= ACPI_NSEC_PER_SEC)
870 Time.tv_sec += (Time.tv_nsec / ACPI_NSEC_PER_SEC);
871 Time.tv_nsec = (Time.tv_nsec % ACPI_NSEC_PER_SEC);
874 while (((RetVal = sem_timedwait (Sem, &Time)) == -1) && (errno == EINTR))
881 if (errno != ETIMEDOUT)
883 perror ("sem_timedwait");
895 /******************************************************************************
897 * FUNCTION: AcpiOsSignalSemaphore
899 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
900 * Units - Number of units to send
904 * DESCRIPTION: Send units
906 *****************************************************************************/
909 AcpiOsSignalSemaphore (
913 sem_t *Sem = (sem_t *)Handle;
918 return (AE_BAD_PARAMETER);
921 if (sem_post (Sem) == -1)
929 #endif /* ACPI_SINGLE_THREADED */
932 /******************************************************************************
934 * FUNCTION: Spinlock interfaces
936 * DESCRIPTION: Map these interfaces to semaphore interfaces
938 *****************************************************************************/
942 ACPI_SPINLOCK *OutHandle)
945 return (AcpiOsCreateSemaphore (1, 1, OutHandle));
951 ACPI_SPINLOCK Handle)
953 AcpiOsDeleteSemaphore (Handle);
961 AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
968 ACPI_SPINLOCK Handle,
969 ACPI_CPU_FLAGS Flags)
971 AcpiOsSignalSemaphore (Handle, 1);
975 /******************************************************************************
977 * FUNCTION: AcpiOsInstallInterruptHandler
979 * PARAMETERS: InterruptNumber - Level handler should respond to.
980 * Isr - Address of the ACPI interrupt handler
981 * ExceptPtr - Where status is returned
983 * RETURN: Handle to the newly installed handler.
985 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
986 * OS-independent handler.
988 *****************************************************************************/
991 AcpiOsInstallInterruptHandler (
992 UINT32 InterruptNumber,
993 ACPI_OSD_HANDLER ServiceRoutine,
1001 /******************************************************************************
1003 * FUNCTION: AcpiOsRemoveInterruptHandler
1005 * PARAMETERS: Handle - Returned when handler was installed
1009 * DESCRIPTION: Uninstalls an interrupt handler.
1011 *****************************************************************************/
1014 AcpiOsRemoveInterruptHandler (
1015 UINT32 InterruptNumber,
1016 ACPI_OSD_HANDLER ServiceRoutine)
1023 /******************************************************************************
1025 * FUNCTION: AcpiOsStall
1027 * PARAMETERS: microseconds - Time to sleep
1029 * RETURN: Blocks until sleep is completed.
1031 * DESCRIPTION: Sleep at microsecond granularity
1033 *****************************************************************************/
1037 UINT32 microseconds)
1042 usleep (microseconds);
1047 /******************************************************************************
1049 * FUNCTION: AcpiOsSleep
1051 * PARAMETERS: milliseconds - Time to sleep
1053 * RETURN: Blocks until sleep is completed.
1055 * DESCRIPTION: Sleep at millisecond granularity
1057 *****************************************************************************/
1061 UINT64 milliseconds)
1064 /* Sleep for whole seconds */
1066 sleep (milliseconds / ACPI_MSEC_PER_SEC);
1069 * Sleep for remaining microseconds.
1070 * Arg to usleep() is in usecs and must be less than 1,000,000 (1 second).
1072 usleep ((milliseconds % ACPI_MSEC_PER_SEC) * ACPI_USEC_PER_MSEC);
1076 /******************************************************************************
1078 * FUNCTION: AcpiOsGetTimer
1082 * RETURN: Current time in 100 nanosecond units
1084 * DESCRIPTION: Get the current system time
1086 *****************************************************************************/
1092 struct timeval time;
1095 /* This timer has sufficient resolution for user-space application code */
1097 gettimeofday (&time, NULL);
1099 /* (Seconds * 10^7 = 100ns(10^-7)) + (Microseconds(10^-6) * 10^1 = 100ns) */
1101 return (((UINT64) time.tv_sec * ACPI_100NSEC_PER_SEC) +
1102 ((UINT64) time.tv_usec * ACPI_100NSEC_PER_USEC));
1106 /******************************************************************************
1108 * FUNCTION: AcpiOsReadPciConfiguration
1110 * PARAMETERS: PciId - Seg/Bus/Dev
1111 * Register - Device Register
1112 * Value - Buffer where value is placed
1113 * Width - Number of bits
1117 * DESCRIPTION: Read data from PCI configuration space
1119 *****************************************************************************/
1122 AcpiOsReadPciConfiguration (
1134 /******************************************************************************
1136 * FUNCTION: AcpiOsWritePciConfiguration
1138 * PARAMETERS: PciId - Seg/Bus/Dev
1139 * Register - Device Register
1140 * Value - Value to be written
1141 * Width - Number of bits
1145 * DESCRIPTION: Write data to PCI configuration space
1147 *****************************************************************************/
1150 AcpiOsWritePciConfiguration (
1161 /******************************************************************************
1163 * FUNCTION: AcpiOsReadPort
1165 * PARAMETERS: Address - Address of I/O port/register to read
1166 * Value - Where value is placed
1167 * Width - Number of bits
1169 * RETURN: Value read from port
1171 * DESCRIPTION: Read data from an I/O port or register
1173 *****************************************************************************/
1177 ACPI_IO_ADDRESS Address,
1196 *Value = 0xFFFFFFFF;
1201 return (AE_BAD_PARAMETER);
1208 /******************************************************************************
1210 * FUNCTION: AcpiOsWritePort
1212 * PARAMETERS: Address - Address of I/O port/register to write
1213 * Value - Value to write
1214 * Width - Number of bits
1218 * DESCRIPTION: Write data to an I/O port or register
1220 *****************************************************************************/
1224 ACPI_IO_ADDRESS Address,
1233 /******************************************************************************
1235 * FUNCTION: AcpiOsReadMemory
1237 * PARAMETERS: Address - Physical Memory Address to read
1238 * Value - Where value is placed
1239 * Width - Number of bits (8,16,32, or 64)
1241 * RETURN: Value read from physical memory address. Always returned
1242 * as a 64-bit integer, regardless of the read width.
1244 * DESCRIPTION: Read data from a physical memory address
1246 *****************************************************************************/
1250 ACPI_PHYSICAL_ADDRESS Address,
1267 return (AE_BAD_PARAMETER);
1273 /******************************************************************************
1275 * FUNCTION: AcpiOsWriteMemory
1277 * PARAMETERS: Address - Physical Memory Address to write
1278 * Value - Value to write
1279 * Width - Number of bits (8,16,32, or 64)
1283 * DESCRIPTION: Write data to a physical memory address
1285 *****************************************************************************/
1289 ACPI_PHYSICAL_ADDRESS Address,
1298 /******************************************************************************
1300 * FUNCTION: AcpiOsReadable
1302 * PARAMETERS: Pointer - Area to be verified
1303 * Length - Size of area
1305 * RETURN: TRUE if readable for entire length
1307 * DESCRIPTION: Verify that a pointer is valid for reading
1309 *****************************************************************************/
1321 /******************************************************************************
1323 * FUNCTION: AcpiOsWritable
1325 * PARAMETERS: Pointer - Area to be verified
1326 * Length - Size of area
1328 * RETURN: TRUE if writable for entire length
1330 * DESCRIPTION: Verify that a pointer is valid for writing
1332 *****************************************************************************/
1344 /******************************************************************************
1346 * FUNCTION: AcpiOsSignal
1348 * PARAMETERS: Function - ACPI CA signal function code
1349 * Info - Pointer to function-dependent structure
1353 * DESCRIPTION: Miscellaneous functions. Example implementation only.
1355 *****************************************************************************/
1365 case ACPI_SIGNAL_FATAL:
1369 case ACPI_SIGNAL_BREAKPOINT:
1381 /* Optional multi-thread support */
1383 #ifndef ACPI_SINGLE_THREADED
1384 /******************************************************************************
1386 * FUNCTION: AcpiOsGetThreadId
1390 * RETURN: Id of the running thread
1392 * DESCRIPTION: Get the ID of the current (running) thread
1394 *****************************************************************************/
1403 thread = pthread_self();
1404 return (ACPI_CAST_PTHREAD_T (thread));
1408 /******************************************************************************
1410 * FUNCTION: AcpiOsExecute
1412 * PARAMETERS: Type - Type of execution
1413 * Function - Address of the function to execute
1414 * Context - Passed as a parameter to the function
1418 * DESCRIPTION: Execute a new thread
1420 *****************************************************************************/
1424 ACPI_EXECUTE_TYPE Type,
1425 ACPI_OSD_EXEC_CALLBACK Function,
1432 ret = pthread_create (&thread, NULL, (PTHREAD_CALLBACK) Function, Context);
1435 AcpiOsPrintf("Create thread failed");
1440 #endif /* ACPI_SINGLE_THREADED */
1443 /******************************************************************************
1445 * FUNCTION: AcpiOsWaitEventsComplete
1451 * DESCRIPTION: Wait for all asynchronous events to complete. This
1452 * implementation does nothing.
1454 *****************************************************************************/
1457 AcpiOsWaitEventsComplete (