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;
96 int TermAttributesWereSet = 0;
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 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 if (tcsetattr (STDIN_FILENO, TCSANOW, &LocalTermAttributes))
165 fprintf (stderr, "Could not set terminal attributes!\n");
169 TermAttributesWereSet = 1;
178 if (!TermAttributesWereSet)
183 /* Set terminal attributes back to the original values */
185 if (tcsetattr (STDIN_FILENO, TCSANOW, &OriginalTermAttributes))
187 fprintf (stderr, "Could not restore terminal attributes!\n");
194 /* These functions are not needed for other ACPICA utilities */
196 #define OsEnterLineEditMode()
197 #define OsExitLineEditMode()
201 /******************************************************************************
203 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
209 * DESCRIPTION: Initialize and terminate this module.
211 *****************************************************************************/
218 AcpiGbl_OutputFile = stdout;
220 OsEnterLineEditMode ();
229 OsExitLineEditMode ();
234 /******************************************************************************
236 * FUNCTION: AcpiOsGetRootPointer
240 * RETURN: RSDP physical address
242 * DESCRIPTION: Gets the ACPI root pointer (RSDP)
244 *****************************************************************************/
246 ACPI_PHYSICAL_ADDRESS
247 AcpiOsGetRootPointer (
251 return (AeLocalGetRootPointer ());
255 /******************************************************************************
257 * FUNCTION: AcpiOsPredefinedOverride
259 * PARAMETERS: InitVal - Initial value of the predefined object
260 * NewVal - The new value for the object
262 * RETURN: Status, pointer to value. Null pointer returned if not
265 * DESCRIPTION: Allow the OS to override predefined names
267 *****************************************************************************/
270 AcpiOsPredefinedOverride (
271 const ACPI_PREDEFINED_NAMES *InitVal,
275 if (!InitVal || !NewVal)
277 return (AE_BAD_PARAMETER);
285 /******************************************************************************
287 * FUNCTION: AcpiOsTableOverride
289 * PARAMETERS: ExistingTable - Header of current table (probably
291 * NewTable - Where an entire new table is returned.
293 * RETURN: Status, pointer to new table. Null pointer returned if no
294 * table is available to override
296 * DESCRIPTION: Return a different version of a table if one is available
298 *****************************************************************************/
301 AcpiOsTableOverride (
302 ACPI_TABLE_HEADER *ExistingTable,
303 ACPI_TABLE_HEADER **NewTable)
306 if (!ExistingTable || !NewTable)
308 return (AE_BAD_PARAMETER);
315 AeTableOverride (ExistingTable, NewTable);
319 return (AE_NO_ACPI_TABLES);
324 /******************************************************************************
326 * FUNCTION: AcpiOsPhysicalTableOverride
328 * PARAMETERS: ExistingTable - Header of current table (probably firmware)
329 * NewAddress - Where new table address is returned
331 * NewTableLength - Where new table length is returned
333 * RETURN: Status, address/length of new table. Null pointer returned
334 * if no table is available to override.
336 * DESCRIPTION: Returns AE_SUPPORT, function not used in user space.
338 *****************************************************************************/
341 AcpiOsPhysicalTableOverride (
342 ACPI_TABLE_HEADER *ExistingTable,
343 ACPI_PHYSICAL_ADDRESS *NewAddress,
344 UINT32 *NewTableLength)
351 /******************************************************************************
353 * FUNCTION: AcpiOsRedirectOutput
355 * PARAMETERS: Destination - An open file handle/pointer
359 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
361 *****************************************************************************/
364 AcpiOsRedirectOutput (
368 AcpiGbl_OutputFile = Destination;
372 /******************************************************************************
374 * FUNCTION: AcpiOsPrintf
376 * PARAMETERS: fmt, ... - Standard printf format
380 * DESCRIPTION: Formatted output. Note: very similar to AcpiOsVprintf
381 * (performance), changes should be tracked in both functions.
383 *****************************************************************************/
385 void ACPI_INTERNAL_VAR_XFACE
394 Flags = AcpiGbl_DbOutputFlags;
395 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
397 /* Output is directable to either a file (if open) or the console */
399 if (AcpiGbl_DebugFile)
401 /* Output file is open, send the output there */
403 va_start (Args, Fmt);
404 vfprintf (AcpiGbl_DebugFile, Fmt, Args);
409 /* No redirection, send output to console (once only!) */
411 Flags |= ACPI_DB_CONSOLE_OUTPUT;
415 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
417 va_start (Args, Fmt);
418 vfprintf (AcpiGbl_OutputFile, Fmt, Args);
424 /******************************************************************************
426 * FUNCTION: AcpiOsVprintf
428 * PARAMETERS: fmt - Standard printf format
429 * args - Argument list
433 * DESCRIPTION: Formatted output with argument list pointer. Note: very
434 * similar to AcpiOsPrintf, changes should be tracked in both
437 *****************************************************************************/
445 char Buffer[ACPI_VPRINTF_BUFFER_SIZE];
449 * We build the output string in a local buffer because we may be
450 * outputting the buffer twice. Using vfprintf is problematic because
451 * some implementations modify the args pointer/structure during
452 * execution. Thus, we use the local buffer for portability.
454 * Note: Since this module is intended for use by the various ACPICA
455 * utilities/applications, we can safely declare the buffer on the stack.
456 * Also, This function is used for relatively small error messages only.
458 vsnprintf (Buffer, ACPI_VPRINTF_BUFFER_SIZE, Fmt, Args);
460 Flags = AcpiGbl_DbOutputFlags;
461 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
463 /* Output is directable to either a file (if open) or the console */
465 if (AcpiGbl_DebugFile)
467 /* Output file is open, send the output there */
469 fputs (Buffer, AcpiGbl_DebugFile);
473 /* No redirection, send output to console (once only!) */
475 Flags |= ACPI_DB_CONSOLE_OUTPUT;
479 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
481 fputs (Buffer, AcpiGbl_OutputFile);
486 #ifndef ACPI_EXEC_APP
487 /******************************************************************************
489 * FUNCTION: AcpiOsGetLine
491 * PARAMETERS: Buffer - Where to return the command line
492 * BufferLength - Maximum length of Buffer
493 * BytesRead - Where the actual byte count is returned
495 * RETURN: Status and actual bytes read
497 * DESCRIPTION: Get the next input line from the terminal. NOTE: For the
498 * AcpiExec utility, we use the acgetline module instead to
499 * provide line-editing and history support.
501 *****************************************************************************/
513 /* Standard AcpiOsGetLine for all utilities except AcpiExec */
515 for (EndOfLine = 0; ; EndOfLine++)
517 if (EndOfLine >= BufferLength)
519 return (AE_BUFFER_OVERFLOW);
522 if ((InputChar = getchar ()) == EOF)
527 if (!InputChar || InputChar == _ASCII_NEWLINE)
532 Buffer[EndOfLine] = (char) InputChar;
535 /* Null terminate the buffer */
537 Buffer[EndOfLine] = 0;
539 /* Return the number of bytes in the string */
543 *BytesRead = EndOfLine;
551 /******************************************************************************
553 * FUNCTION: AcpiOsMapMemory
555 * PARAMETERS: where - Physical address of memory to be mapped
556 * length - How much memory to map
558 * RETURN: Pointer to mapped memory. Null on error.
560 * DESCRIPTION: Map physical memory into caller's address space
562 *****************************************************************************/
566 ACPI_PHYSICAL_ADDRESS where,
570 return (ACPI_TO_POINTER ((ACPI_SIZE) where));
574 /******************************************************************************
576 * FUNCTION: AcpiOsUnmapMemory
578 * PARAMETERS: where - Logical address of memory to be unmapped
579 * length - How much memory to unmap
583 * DESCRIPTION: Delete a previously created mapping. Where and Length must
584 * correspond to a previous mapping exactly.
586 *****************************************************************************/
598 /******************************************************************************
600 * FUNCTION: AcpiOsAllocate
602 * PARAMETERS: Size - Amount to allocate, in bytes
604 * RETURN: Pointer to the new allocation. Null on error.
606 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
608 *****************************************************************************/
617 Mem = (void *) malloc ((size_t) size);
622 /******************************************************************************
624 * FUNCTION: AcpiOsFree
626 * PARAMETERS: mem - Pointer to previously allocated memory
630 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
632 *****************************************************************************/
643 #ifdef ACPI_SINGLE_THREADED
644 /******************************************************************************
646 * FUNCTION: Semaphore stub functions
648 * DESCRIPTION: Stub functions used for single-thread applications that do
649 * not require semaphore synchronization. Full implementations
650 * of these functions appear after the stubs.
652 *****************************************************************************/
655 AcpiOsCreateSemaphore (
658 ACPI_HANDLE *OutHandle)
660 *OutHandle = (ACPI_HANDLE) 1;
665 AcpiOsDeleteSemaphore (
672 AcpiOsWaitSemaphore (
681 AcpiOsSignalSemaphore (
689 /******************************************************************************
691 * FUNCTION: AcpiOsCreateSemaphore
693 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore
694 * OutHandle - Where a handle will be returned
698 * DESCRIPTION: Create an OS semaphore
700 *****************************************************************************/
703 AcpiOsCreateSemaphore (
706 ACPI_HANDLE *OutHandle)
713 return (AE_BAD_PARAMETER);
718 char *SemaphoreName = tmpnam (NULL);
720 Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits);
723 return (AE_NO_MEMORY);
725 sem_unlink (SemaphoreName); /* This just deletes the name */
729 Sem = AcpiOsAllocate (sizeof (sem_t));
732 return (AE_NO_MEMORY);
735 if (sem_init (Sem, 0, InitialUnits) == -1)
738 return (AE_BAD_PARAMETER);
742 *OutHandle = (ACPI_HANDLE) Sem;
747 /******************************************************************************
749 * FUNCTION: AcpiOsDeleteSemaphore
751 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
755 * DESCRIPTION: Delete an OS semaphore
757 *****************************************************************************/
760 AcpiOsDeleteSemaphore (
763 sem_t *Sem = (sem_t *) Handle;
768 return (AE_BAD_PARAMETER);
771 if (sem_destroy (Sem) == -1)
773 return (AE_BAD_PARAMETER);
780 /******************************************************************************
782 * FUNCTION: AcpiOsWaitSemaphore
784 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
785 * Units - How many units to wait for
786 * MsecTimeout - How long to wait (milliseconds)
790 * DESCRIPTION: Wait for units
792 *****************************************************************************/
795 AcpiOsWaitSemaphore (
800 ACPI_STATUS Status = AE_OK;
801 sem_t *Sem = (sem_t *) Handle;
802 #ifndef ACPI_USE_ALTERNATE_TIMEOUT
803 struct timespec Time;
810 return (AE_BAD_PARAMETER);
818 * A zero timeout value indicates that we shouldn't wait - just
819 * acquire the semaphore if available otherwise return AE_TIME
820 * (a.k.a. 'would block').
824 if (sem_trywait(Sem) == -1)
830 /* Wait Indefinitely */
832 case ACPI_WAIT_FOREVER:
840 /* Wait with MsecTimeout */
844 #ifdef ACPI_USE_ALTERNATE_TIMEOUT
846 * Alternate timeout mechanism for environments where
847 * sem_timedwait is not available or does not work properly.
851 if (sem_trywait (Sem) == 0)
853 /* Got the semaphore */
857 if (MsecTimeout >= 10)
860 usleep (10 * ACPI_USEC_PER_MSEC); /* ten milliseconds */
865 usleep (ACPI_USEC_PER_MSEC); /* one millisecond */
871 * The interface to sem_timedwait is an absolute time, so we need to
872 * get the current time, then add in the millisecond Timeout value.
874 if (clock_gettime (CLOCK_REALTIME, &Time) == -1)
876 perror ("clock_gettime");
880 Time.tv_sec += (MsecTimeout / ACPI_MSEC_PER_SEC);
881 Time.tv_nsec += ((MsecTimeout % ACPI_MSEC_PER_SEC) * ACPI_NSEC_PER_MSEC);
883 /* Handle nanosecond overflow (field must be less than one second) */
885 if (Time.tv_nsec >= ACPI_NSEC_PER_SEC)
887 Time.tv_sec += (Time.tv_nsec / ACPI_NSEC_PER_SEC);
888 Time.tv_nsec = (Time.tv_nsec % ACPI_NSEC_PER_SEC);
891 while (((RetVal = sem_timedwait (Sem, &Time)) == -1) && (errno == EINTR))
898 if (errno != ETIMEDOUT)
900 perror ("sem_timedwait");
912 /******************************************************************************
914 * FUNCTION: AcpiOsSignalSemaphore
916 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
917 * Units - Number of units to send
921 * DESCRIPTION: Send units
923 *****************************************************************************/
926 AcpiOsSignalSemaphore (
930 sem_t *Sem = (sem_t *)Handle;
935 return (AE_BAD_PARAMETER);
938 if (sem_post (Sem) == -1)
946 #endif /* ACPI_SINGLE_THREADED */
949 /******************************************************************************
951 * FUNCTION: Spinlock interfaces
953 * DESCRIPTION: Map these interfaces to semaphore interfaces
955 *****************************************************************************/
959 ACPI_SPINLOCK *OutHandle)
962 return (AcpiOsCreateSemaphore (1, 1, OutHandle));
968 ACPI_SPINLOCK Handle)
970 AcpiOsDeleteSemaphore (Handle);
978 AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
985 ACPI_SPINLOCK Handle,
986 ACPI_CPU_FLAGS Flags)
988 AcpiOsSignalSemaphore (Handle, 1);
992 /******************************************************************************
994 * FUNCTION: AcpiOsInstallInterruptHandler
996 * PARAMETERS: InterruptNumber - Level handler should respond to.
997 * Isr - Address of the ACPI interrupt handler
998 * ExceptPtr - Where status is returned
1000 * RETURN: Handle to the newly installed handler.
1002 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
1003 * OS-independent handler.
1005 *****************************************************************************/
1008 AcpiOsInstallInterruptHandler (
1009 UINT32 InterruptNumber,
1010 ACPI_OSD_HANDLER ServiceRoutine,
1018 /******************************************************************************
1020 * FUNCTION: AcpiOsRemoveInterruptHandler
1022 * PARAMETERS: Handle - Returned when handler was installed
1026 * DESCRIPTION: Uninstalls an interrupt handler.
1028 *****************************************************************************/
1031 AcpiOsRemoveInterruptHandler (
1032 UINT32 InterruptNumber,
1033 ACPI_OSD_HANDLER ServiceRoutine)
1040 /******************************************************************************
1042 * FUNCTION: AcpiOsStall
1044 * PARAMETERS: microseconds - Time to sleep
1046 * RETURN: Blocks until sleep is completed.
1048 * DESCRIPTION: Sleep at microsecond granularity
1050 *****************************************************************************/
1054 UINT32 microseconds)
1059 usleep (microseconds);
1064 /******************************************************************************
1066 * FUNCTION: AcpiOsSleep
1068 * PARAMETERS: milliseconds - Time to sleep
1070 * RETURN: Blocks until sleep is completed.
1072 * DESCRIPTION: Sleep at millisecond granularity
1074 *****************************************************************************/
1078 UINT64 milliseconds)
1081 /* Sleep for whole seconds */
1083 sleep (milliseconds / ACPI_MSEC_PER_SEC);
1086 * Sleep for remaining microseconds.
1087 * Arg to usleep() is in usecs and must be less than 1,000,000 (1 second).
1089 usleep ((milliseconds % ACPI_MSEC_PER_SEC) * ACPI_USEC_PER_MSEC);
1093 /******************************************************************************
1095 * FUNCTION: AcpiOsGetTimer
1099 * RETURN: Current time in 100 nanosecond units
1101 * DESCRIPTION: Get the current system time
1103 *****************************************************************************/
1109 struct timeval time;
1112 /* This timer has sufficient resolution for user-space application code */
1114 gettimeofday (&time, NULL);
1116 /* (Seconds * 10^7 = 100ns(10^-7)) + (Microseconds(10^-6) * 10^1 = 100ns) */
1118 return (((UINT64) time.tv_sec * ACPI_100NSEC_PER_SEC) +
1119 ((UINT64) time.tv_usec * ACPI_100NSEC_PER_USEC));
1123 /******************************************************************************
1125 * FUNCTION: AcpiOsReadPciConfiguration
1127 * PARAMETERS: PciId - Seg/Bus/Dev
1128 * Register - Device Register
1129 * Value - Buffer where value is placed
1130 * Width - Number of bits
1134 * DESCRIPTION: Read data from PCI configuration space
1136 *****************************************************************************/
1139 AcpiOsReadPciConfiguration (
1151 /******************************************************************************
1153 * FUNCTION: AcpiOsWritePciConfiguration
1155 * PARAMETERS: PciId - Seg/Bus/Dev
1156 * Register - Device Register
1157 * Value - Value to be written
1158 * Width - Number of bits
1162 * DESCRIPTION: Write data to PCI configuration space
1164 *****************************************************************************/
1167 AcpiOsWritePciConfiguration (
1178 /******************************************************************************
1180 * FUNCTION: AcpiOsReadPort
1182 * PARAMETERS: Address - Address of I/O port/register to read
1183 * Value - Where value is placed
1184 * Width - Number of bits
1186 * RETURN: Value read from port
1188 * DESCRIPTION: Read data from an I/O port or register
1190 *****************************************************************************/
1194 ACPI_IO_ADDRESS Address,
1213 *Value = 0xFFFFFFFF;
1218 return (AE_BAD_PARAMETER);
1225 /******************************************************************************
1227 * FUNCTION: AcpiOsWritePort
1229 * PARAMETERS: Address - Address of I/O port/register to write
1230 * Value - Value to write
1231 * Width - Number of bits
1235 * DESCRIPTION: Write data to an I/O port or register
1237 *****************************************************************************/
1241 ACPI_IO_ADDRESS Address,
1250 /******************************************************************************
1252 * FUNCTION: AcpiOsReadMemory
1254 * PARAMETERS: Address - Physical Memory Address to read
1255 * Value - Where value is placed
1256 * Width - Number of bits (8,16,32, or 64)
1258 * RETURN: Value read from physical memory address. Always returned
1259 * as a 64-bit integer, regardless of the read width.
1261 * DESCRIPTION: Read data from a physical memory address
1263 *****************************************************************************/
1267 ACPI_PHYSICAL_ADDRESS Address,
1284 return (AE_BAD_PARAMETER);
1290 /******************************************************************************
1292 * FUNCTION: AcpiOsWriteMemory
1294 * PARAMETERS: Address - Physical Memory Address to write
1295 * Value - Value to write
1296 * Width - Number of bits (8,16,32, or 64)
1300 * DESCRIPTION: Write data to a physical memory address
1302 *****************************************************************************/
1306 ACPI_PHYSICAL_ADDRESS Address,
1315 /******************************************************************************
1317 * FUNCTION: AcpiOsReadable
1319 * PARAMETERS: Pointer - Area to be verified
1320 * Length - Size of area
1322 * RETURN: TRUE if readable for entire length
1324 * DESCRIPTION: Verify that a pointer is valid for reading
1326 *****************************************************************************/
1338 /******************************************************************************
1340 * FUNCTION: AcpiOsWritable
1342 * PARAMETERS: Pointer - Area to be verified
1343 * Length - Size of area
1345 * RETURN: TRUE if writable for entire length
1347 * DESCRIPTION: Verify that a pointer is valid for writing
1349 *****************************************************************************/
1361 /******************************************************************************
1363 * FUNCTION: AcpiOsSignal
1365 * PARAMETERS: Function - ACPI A signal function code
1366 * Info - Pointer to function-dependent structure
1370 * DESCRIPTION: Miscellaneous functions. Example implementation only.
1372 *****************************************************************************/
1382 case ACPI_SIGNAL_FATAL:
1386 case ACPI_SIGNAL_BREAKPOINT:
1398 /* Optional multi-thread support */
1400 #ifndef ACPI_SINGLE_THREADED
1401 /******************************************************************************
1403 * FUNCTION: AcpiOsGetThreadId
1407 * RETURN: Id of the running thread
1409 * DESCRIPTION: Get the ID of the current (running) thread
1411 *****************************************************************************/
1420 thread = pthread_self();
1421 return (ACPI_CAST_PTHREAD_T (thread));
1425 /******************************************************************************
1427 * FUNCTION: AcpiOsExecute
1429 * PARAMETERS: Type - Type of execution
1430 * Function - Address of the function to execute
1431 * Context - Passed as a parameter to the function
1435 * DESCRIPTION: Execute a new thread
1437 *****************************************************************************/
1441 ACPI_EXECUTE_TYPE Type,
1442 ACPI_OSD_EXEC_CALLBACK Function,
1449 ret = pthread_create (&thread, NULL, (PTHREAD_CALLBACK) Function, Context);
1452 AcpiOsPrintf("Create thread failed");
1457 #endif /* ACPI_SINGLE_THREADED */
1460 /******************************************************************************
1462 * FUNCTION: AcpiOsWaitEventsComplete
1468 * DESCRIPTION: Wait for all asynchronous events to complete. This
1469 * implementation does nothing.
1471 *****************************************************************************/
1474 AcpiOsWaitEventsComplete (