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.
45 * These interfaces are required in order to compile the ASL compiler and the
46 * various ACPICA tools under Linux or other Unix-like system.
59 #include <semaphore.h>
63 #define _COMPONENT ACPI_OS_SERVICES
64 ACPI_MODULE_NAME ("osunixxf")
67 BOOLEAN AcpiGbl_DebugTimeout = FALSE;
70 /* Upcalls to AcpiExec */
74 ACPI_TABLE_HEADER *ExistingTable,
75 ACPI_TABLE_HEADER **NewTable);
77 typedef void* (*PTHREAD_CALLBACK) (void *);
79 /* Buffer used by AcpiOsVprintf */
81 #define ACPI_VPRINTF_BUFFER_SIZE 512
82 #define _ASCII_NEWLINE '\n'
84 /* Terminal support for AcpiExec only */
89 struct termios OriginalTermAttributes;
90 int TermAttributesWereSet = 0;
107 /******************************************************************************
109 * FUNCTION: OsEnterLineEditMode, OsExitLineEditMode
115 * DESCRIPTION: Enter/Exit the raw character input mode for the terminal.
117 * Interactive line-editing support for the AML debugger. Used with the
118 * common/acgetline module.
120 * readline() is not used because of non-portability. It is not available
121 * on all systems, and if it is, often the package must be manually installed.
123 * Therefore, we use the POSIX tcgetattr/tcsetattr and do the minimal line
124 * editing that we need in AcpiOsGetLine.
126 * If the POSIX tcgetattr/tcsetattr interfaces are unavailable, these
127 * calls will also work:
128 * For OsEnterLineEditMode: system ("stty cbreak -echo")
129 * For OsExitLineEditMode: system ("stty cooked echo")
131 *****************************************************************************/
134 OsEnterLineEditMode (
137 struct termios LocalTermAttributes;
140 /* Get and keep the original attributes */
142 if (tcgetattr (STDIN_FILENO, &OriginalTermAttributes))
144 fprintf (stderr, "Could not get terminal attributes!\n");
148 /* Set the new attributes to enable raw character input */
150 memcpy (&LocalTermAttributes, &OriginalTermAttributes,
151 sizeof (struct termios));
153 LocalTermAttributes.c_lflag &= ~(ICANON | ECHO);
154 LocalTermAttributes.c_cc[VMIN] = 1;
155 LocalTermAttributes.c_cc[VTIME] = 0;
157 if (tcsetattr (STDIN_FILENO, TCSANOW, &LocalTermAttributes))
159 fprintf (stderr, "Could not set terminal attributes!\n");
163 TermAttributesWereSet = 1;
172 if (!TermAttributesWereSet)
177 /* Set terminal attributes back to the original values */
179 if (tcsetattr (STDIN_FILENO, TCSANOW, &OriginalTermAttributes))
181 fprintf (stderr, "Could not restore terminal attributes!\n");
188 /* These functions are not needed for other ACPICA utilities */
190 #define OsEnterLineEditMode()
191 #define OsExitLineEditMode()
195 /******************************************************************************
197 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
203 * DESCRIPTION: Initialize and terminate this module.
205 *****************************************************************************/
214 AcpiGbl_OutputFile = stdout;
216 OsEnterLineEditMode ();
218 Status = AcpiOsCreateLock (&AcpiGbl_PrintLock);
219 if (ACPI_FAILURE (Status))
232 OsExitLineEditMode ();
237 #ifndef ACPI_USE_NATIVE_RSDP_POINTER
238 /******************************************************************************
240 * FUNCTION: AcpiOsGetRootPointer
244 * RETURN: RSDP physical address
246 * DESCRIPTION: Gets the ACPI root pointer (RSDP)
248 *****************************************************************************/
250 ACPI_PHYSICAL_ADDRESS
251 AcpiOsGetRootPointer (
260 /******************************************************************************
262 * FUNCTION: AcpiOsPredefinedOverride
264 * PARAMETERS: InitVal - Initial value of the predefined object
265 * NewVal - The new value for the object
267 * RETURN: Status, pointer to value. Null pointer returned if not
270 * DESCRIPTION: Allow the OS to override predefined names
272 *****************************************************************************/
275 AcpiOsPredefinedOverride (
276 const ACPI_PREDEFINED_NAMES *InitVal,
280 if (!InitVal || !NewVal)
282 return (AE_BAD_PARAMETER);
290 /******************************************************************************
292 * FUNCTION: AcpiOsTableOverride
294 * PARAMETERS: ExistingTable - Header of current table (probably
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);
320 AeTableOverride (ExistingTable, NewTable);
324 return (AE_NO_ACPI_TABLES);
329 /******************************************************************************
331 * FUNCTION: AcpiOsPhysicalTableOverride
333 * PARAMETERS: ExistingTable - Header of current table (probably firmware)
334 * NewAddress - Where new table address is returned
336 * NewTableLength - Where new table length is returned
338 * RETURN: Status, address/length of new table. Null pointer returned
339 * if no table is available to override.
341 * DESCRIPTION: Returns AE_SUPPORT, function not used in user space.
343 *****************************************************************************/
346 AcpiOsPhysicalTableOverride (
347 ACPI_TABLE_HEADER *ExistingTable,
348 ACPI_PHYSICAL_ADDRESS *NewAddress,
349 UINT32 *NewTableLength)
356 /******************************************************************************
358 * FUNCTION: AcpiOsRedirectOutput
360 * PARAMETERS: Destination - An open file handle/pointer
364 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
366 *****************************************************************************/
369 AcpiOsRedirectOutput (
373 AcpiGbl_OutputFile = Destination;
377 /******************************************************************************
379 * FUNCTION: AcpiOsPrintf
381 * PARAMETERS: fmt, ... - Standard printf format
385 * DESCRIPTION: Formatted output. Note: very similar to AcpiOsVprintf
386 * (performance), changes should be tracked in both functions.
388 *****************************************************************************/
390 void ACPI_INTERNAL_VAR_XFACE
399 Flags = AcpiGbl_DbOutputFlags;
400 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
402 /* Output is directable to either a file (if open) or the console */
404 if (AcpiGbl_DebugFile)
406 /* Output file is open, send the output there */
408 va_start (Args, Fmt);
409 vfprintf (AcpiGbl_DebugFile, Fmt, Args);
414 /* No redirection, send output to console (once only!) */
416 Flags |= ACPI_DB_CONSOLE_OUTPUT;
420 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
422 va_start (Args, Fmt);
423 vfprintf (AcpiGbl_OutputFile, Fmt, Args);
429 /******************************************************************************
431 * FUNCTION: AcpiOsVprintf
433 * PARAMETERS: fmt - Standard printf format
434 * args - Argument list
438 * DESCRIPTION: Formatted output with argument list pointer. Note: very
439 * similar to AcpiOsPrintf, changes should be tracked in both
442 *****************************************************************************/
450 char Buffer[ACPI_VPRINTF_BUFFER_SIZE];
454 * We build the output string in a local buffer because we may be
455 * outputting the buffer twice. Using vfprintf is problematic because
456 * some implementations modify the args pointer/structure during
457 * execution. Thus, we use the local buffer for portability.
459 * Note: Since this module is intended for use by the various ACPICA
460 * utilities/applications, we can safely declare the buffer on the stack.
461 * Also, This function is used for relatively small error messages only.
463 vsnprintf (Buffer, ACPI_VPRINTF_BUFFER_SIZE, Fmt, Args);
465 Flags = AcpiGbl_DbOutputFlags;
466 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT)
468 /* Output is directable to either a file (if open) or the console */
470 if (AcpiGbl_DebugFile)
472 /* Output file is open, send the output there */
474 fputs (Buffer, AcpiGbl_DebugFile);
478 /* No redirection, send output to console (once only!) */
480 Flags |= ACPI_DB_CONSOLE_OUTPUT;
484 if (Flags & ACPI_DB_CONSOLE_OUTPUT)
486 fputs (Buffer, AcpiGbl_OutputFile);
491 #ifndef ACPI_EXEC_APP
492 /******************************************************************************
494 * FUNCTION: AcpiOsGetLine
496 * PARAMETERS: Buffer - Where to return the command line
497 * BufferLength - Maximum length of Buffer
498 * BytesRead - Where the actual byte count is returned
500 * RETURN: Status and actual bytes read
502 * DESCRIPTION: Get the next input line from the terminal. NOTE: For the
503 * AcpiExec utility, we use the acgetline module instead to
504 * provide line-editing and history support.
506 *****************************************************************************/
518 /* Standard AcpiOsGetLine for all utilities except AcpiExec */
520 for (EndOfLine = 0; ; EndOfLine++)
522 if (EndOfLine >= BufferLength)
524 return (AE_BUFFER_OVERFLOW);
527 if ((InputChar = getchar ()) == EOF)
532 if (!InputChar || InputChar == _ASCII_NEWLINE)
537 Buffer[EndOfLine] = (char) InputChar;
540 /* Null terminate the buffer */
542 Buffer[EndOfLine] = 0;
544 /* Return the number of bytes in the string */
548 *BytesRead = EndOfLine;
556 #ifndef ACPI_USE_NATIVE_MEMORY_MAPPING
557 /******************************************************************************
559 * FUNCTION: AcpiOsMapMemory
561 * PARAMETERS: where - Physical address of memory to be mapped
562 * length - How much memory to map
564 * RETURN: Pointer to mapped memory. Null on error.
566 * DESCRIPTION: Map physical memory into caller's address space
568 *****************************************************************************/
572 ACPI_PHYSICAL_ADDRESS where,
576 return (ACPI_TO_POINTER ((ACPI_SIZE) where));
580 /******************************************************************************
582 * FUNCTION: AcpiOsUnmapMemory
584 * PARAMETERS: where - Logical address of memory to be unmapped
585 * length - How much memory to unmap
589 * DESCRIPTION: Delete a previously created mapping. Where and Length must
590 * correspond to a previous mapping exactly.
592 *****************************************************************************/
605 /******************************************************************************
607 * FUNCTION: AcpiOsAllocate
609 * PARAMETERS: Size - Amount to allocate, in bytes
611 * RETURN: Pointer to the new allocation. Null on error.
613 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
615 *****************************************************************************/
624 Mem = (void *) malloc ((size_t) size);
629 #ifdef USE_NATIVE_ALLOCATE_ZEROED
630 /******************************************************************************
632 * FUNCTION: AcpiOsAllocateZeroed
634 * PARAMETERS: Size - Amount to allocate, in bytes
636 * RETURN: Pointer to the new allocation. Null on error.
638 * DESCRIPTION: Allocate and zero memory. Algorithm is dependent on the OS.
640 *****************************************************************************/
643 AcpiOsAllocateZeroed (
649 Mem = (void *) calloc (1, (size_t) size);
655 /******************************************************************************
657 * FUNCTION: AcpiOsFree
659 * PARAMETERS: mem - Pointer to previously allocated memory
663 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
665 *****************************************************************************/
676 #ifdef ACPI_SINGLE_THREADED
677 /******************************************************************************
679 * FUNCTION: Semaphore stub functions
681 * DESCRIPTION: Stub functions used for single-thread applications that do
682 * not require semaphore synchronization. Full implementations
683 * of these functions appear after the stubs.
685 *****************************************************************************/
688 AcpiOsCreateSemaphore (
691 ACPI_HANDLE *OutHandle)
693 *OutHandle = (ACPI_HANDLE) 1;
698 AcpiOsDeleteSemaphore (
705 AcpiOsWaitSemaphore (
714 AcpiOsSignalSemaphore (
722 /******************************************************************************
724 * FUNCTION: AcpiOsCreateSemaphore
726 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore
727 * OutHandle - Where a handle will be returned
731 * DESCRIPTION: Create an OS semaphore
733 *****************************************************************************/
736 AcpiOsCreateSemaphore (
739 ACPI_HANDLE *OutHandle)
746 return (AE_BAD_PARAMETER);
751 char *SemaphoreName = tmpnam (NULL);
753 Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits);
756 return (AE_NO_MEMORY);
758 sem_unlink (SemaphoreName); /* This just deletes the name */
762 Sem = AcpiOsAllocate (sizeof (sem_t));
765 return (AE_NO_MEMORY);
768 if (sem_init (Sem, 0, InitialUnits) == -1)
771 return (AE_BAD_PARAMETER);
775 *OutHandle = (ACPI_HANDLE) Sem;
780 /******************************************************************************
782 * FUNCTION: AcpiOsDeleteSemaphore
784 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
788 * DESCRIPTION: Delete an OS semaphore
790 *****************************************************************************/
793 AcpiOsDeleteSemaphore (
796 sem_t *Sem = (sem_t *) Handle;
801 return (AE_BAD_PARAMETER);
804 if (sem_destroy (Sem) == -1)
806 return (AE_BAD_PARAMETER);
813 /******************************************************************************
815 * FUNCTION: AcpiOsWaitSemaphore
817 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
818 * Units - How many units to wait for
819 * MsecTimeout - How long to wait (milliseconds)
823 * DESCRIPTION: Wait for units
825 *****************************************************************************/
828 AcpiOsWaitSemaphore (
833 ACPI_STATUS Status = AE_OK;
834 sem_t *Sem = (sem_t *) Handle;
835 #ifndef ACPI_USE_ALTERNATE_TIMEOUT
836 struct timespec Time;
843 return (AE_BAD_PARAMETER);
851 * A zero timeout value indicates that we shouldn't wait - just
852 * acquire the semaphore if available otherwise return AE_TIME
853 * (a.k.a. 'would block').
857 if (sem_trywait(Sem) == -1)
863 /* Wait Indefinitely */
865 case ACPI_WAIT_FOREVER:
873 /* Wait with MsecTimeout */
877 #ifdef ACPI_USE_ALTERNATE_TIMEOUT
879 * Alternate timeout mechanism for environments where
880 * sem_timedwait is not available or does not work properly.
884 if (sem_trywait (Sem) == 0)
886 /* Got the semaphore */
890 if (MsecTimeout >= 10)
893 usleep (10 * ACPI_USEC_PER_MSEC); /* ten milliseconds */
898 usleep (ACPI_USEC_PER_MSEC); /* one millisecond */
904 * The interface to sem_timedwait is an absolute time, so we need to
905 * get the current time, then add in the millisecond Timeout value.
907 if (clock_gettime (CLOCK_REALTIME, &Time) == -1)
909 perror ("clock_gettime");
913 Time.tv_sec += (MsecTimeout / ACPI_MSEC_PER_SEC);
914 Time.tv_nsec += ((MsecTimeout % ACPI_MSEC_PER_SEC) * ACPI_NSEC_PER_MSEC);
916 /* Handle nanosecond overflow (field must be less than one second) */
918 if (Time.tv_nsec >= ACPI_NSEC_PER_SEC)
920 Time.tv_sec += (Time.tv_nsec / ACPI_NSEC_PER_SEC);
921 Time.tv_nsec = (Time.tv_nsec % ACPI_NSEC_PER_SEC);
924 while (((RetVal = sem_timedwait (Sem, &Time)) == -1) && (errno == EINTR))
931 if (errno != ETIMEDOUT)
933 perror ("sem_timedwait");
945 /******************************************************************************
947 * FUNCTION: AcpiOsSignalSemaphore
949 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
950 * Units - Number of units to send
954 * DESCRIPTION: Send units
956 *****************************************************************************/
959 AcpiOsSignalSemaphore (
963 sem_t *Sem = (sem_t *)Handle;
968 return (AE_BAD_PARAMETER);
971 if (sem_post (Sem) == -1)
979 #endif /* ACPI_SINGLE_THREADED */
982 /******************************************************************************
984 * FUNCTION: Spinlock interfaces
986 * DESCRIPTION: Map these interfaces to semaphore interfaces
988 *****************************************************************************/
992 ACPI_SPINLOCK *OutHandle)
995 return (AcpiOsCreateSemaphore (1, 1, OutHandle));
1001 ACPI_SPINLOCK Handle)
1003 AcpiOsDeleteSemaphore (Handle);
1011 AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
1018 ACPI_SPINLOCK Handle,
1019 ACPI_CPU_FLAGS Flags)
1021 AcpiOsSignalSemaphore (Handle, 1);
1025 /******************************************************************************
1027 * FUNCTION: AcpiOsInstallInterruptHandler
1029 * PARAMETERS: InterruptNumber - Level handler should respond to.
1030 * Isr - Address of the ACPI interrupt handler
1031 * ExceptPtr - Where status is returned
1033 * RETURN: Handle to the newly installed handler.
1035 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
1036 * OS-independent handler.
1038 *****************************************************************************/
1041 AcpiOsInstallInterruptHandler (
1042 UINT32 InterruptNumber,
1043 ACPI_OSD_HANDLER ServiceRoutine,
1051 /******************************************************************************
1053 * FUNCTION: AcpiOsRemoveInterruptHandler
1055 * PARAMETERS: Handle - Returned when handler was installed
1059 * DESCRIPTION: Uninstalls an interrupt handler.
1061 *****************************************************************************/
1064 AcpiOsRemoveInterruptHandler (
1065 UINT32 InterruptNumber,
1066 ACPI_OSD_HANDLER ServiceRoutine)
1073 /******************************************************************************
1075 * FUNCTION: AcpiOsStall
1077 * PARAMETERS: microseconds - Time to sleep
1079 * RETURN: Blocks until sleep is completed.
1081 * DESCRIPTION: Sleep at microsecond granularity
1083 *****************************************************************************/
1087 UINT32 microseconds)
1092 usleep (microseconds);
1097 /******************************************************************************
1099 * FUNCTION: AcpiOsSleep
1101 * PARAMETERS: milliseconds - Time to sleep
1103 * RETURN: Blocks until sleep is completed.
1105 * DESCRIPTION: Sleep at millisecond granularity
1107 *****************************************************************************/
1111 UINT64 milliseconds)
1114 /* Sleep for whole seconds */
1116 sleep (milliseconds / ACPI_MSEC_PER_SEC);
1119 * Sleep for remaining microseconds.
1120 * Arg to usleep() is in usecs and must be less than 1,000,000 (1 second).
1122 usleep ((milliseconds % ACPI_MSEC_PER_SEC) * ACPI_USEC_PER_MSEC);
1126 /******************************************************************************
1128 * FUNCTION: AcpiOsGetTimer
1132 * RETURN: Current time in 100 nanosecond units
1134 * DESCRIPTION: Get the current system time
1136 *****************************************************************************/
1142 struct timeval time;
1145 /* This timer has sufficient resolution for user-space application code */
1147 gettimeofday (&time, NULL);
1149 /* (Seconds * 10^7 = 100ns(10^-7)) + (Microseconds(10^-6) * 10^1 = 100ns) */
1151 return (((UINT64) time.tv_sec * ACPI_100NSEC_PER_SEC) +
1152 ((UINT64) time.tv_usec * ACPI_100NSEC_PER_USEC));
1156 /******************************************************************************
1158 * FUNCTION: AcpiOsReadPciConfiguration
1160 * PARAMETERS: PciId - Seg/Bus/Dev
1161 * PciRegister - Device Register
1162 * Value - Buffer where value is placed
1163 * Width - Number of bits
1167 * DESCRIPTION: Read data from PCI configuration space
1169 *****************************************************************************/
1172 AcpiOsReadPciConfiguration (
1184 /******************************************************************************
1186 * FUNCTION: AcpiOsWritePciConfiguration
1188 * PARAMETERS: PciId - Seg/Bus/Dev
1189 * PciRegister - Device Register
1190 * Value - Value to be written
1191 * Width - Number of bits
1195 * DESCRIPTION: Write data to PCI configuration space
1197 *****************************************************************************/
1200 AcpiOsWritePciConfiguration (
1211 /******************************************************************************
1213 * FUNCTION: AcpiOsReadPort
1215 * PARAMETERS: Address - Address of I/O port/register to read
1216 * Value - Where value is placed
1217 * Width - Number of bits
1219 * RETURN: Value read from port
1221 * DESCRIPTION: Read data from an I/O port or register
1223 *****************************************************************************/
1227 ACPI_IO_ADDRESS Address,
1246 *Value = 0xFFFFFFFF;
1251 return (AE_BAD_PARAMETER);
1258 /******************************************************************************
1260 * FUNCTION: AcpiOsWritePort
1262 * PARAMETERS: Address - Address of I/O port/register to write
1263 * Value - Value to write
1264 * Width - Number of bits
1268 * DESCRIPTION: Write data to an I/O port or register
1270 *****************************************************************************/
1274 ACPI_IO_ADDRESS Address,
1283 /******************************************************************************
1285 * FUNCTION: AcpiOsReadMemory
1287 * PARAMETERS: Address - Physical Memory Address to read
1288 * Value - Where value is placed
1289 * Width - Number of bits (8,16,32, or 64)
1291 * RETURN: Value read from physical memory address. Always returned
1292 * as a 64-bit integer, regardless of the read width.
1294 * DESCRIPTION: Read data from a physical memory address
1296 *****************************************************************************/
1300 ACPI_PHYSICAL_ADDRESS Address,
1317 return (AE_BAD_PARAMETER);
1323 /******************************************************************************
1325 * FUNCTION: AcpiOsWriteMemory
1327 * PARAMETERS: Address - Physical Memory Address to write
1328 * Value - Value to write
1329 * Width - Number of bits (8,16,32, or 64)
1333 * DESCRIPTION: Write data to a physical memory address
1335 *****************************************************************************/
1339 ACPI_PHYSICAL_ADDRESS Address,
1348 /******************************************************************************
1350 * FUNCTION: AcpiOsReadable
1352 * PARAMETERS: Pointer - Area to be verified
1353 * Length - Size of area
1355 * RETURN: TRUE if readable for entire length
1357 * DESCRIPTION: Verify that a pointer is valid for reading
1359 *****************************************************************************/
1371 /******************************************************************************
1373 * FUNCTION: AcpiOsWritable
1375 * PARAMETERS: Pointer - Area to be verified
1376 * Length - Size of area
1378 * RETURN: TRUE if writable for entire length
1380 * DESCRIPTION: Verify that a pointer is valid for writing
1382 *****************************************************************************/
1394 /******************************************************************************
1396 * FUNCTION: AcpiOsSignal
1398 * PARAMETERS: Function - ACPI A signal function code
1399 * Info - Pointer to function-dependent structure
1403 * DESCRIPTION: Miscellaneous functions. Example implementation only.
1405 *****************************************************************************/
1415 case ACPI_SIGNAL_FATAL:
1419 case ACPI_SIGNAL_BREAKPOINT:
1431 /* Optional multi-thread support */
1433 #ifndef ACPI_SINGLE_THREADED
1434 /******************************************************************************
1436 * FUNCTION: AcpiOsGetThreadId
1440 * RETURN: Id of the running thread
1442 * DESCRIPTION: Get the ID of the current (running) thread
1444 *****************************************************************************/
1453 thread = pthread_self();
1454 return (ACPI_CAST_PTHREAD_T (thread));
1458 /******************************************************************************
1460 * FUNCTION: AcpiOsExecute
1462 * PARAMETERS: Type - Type of execution
1463 * Function - Address of the function to execute
1464 * Context - Passed as a parameter to the function
1468 * DESCRIPTION: Execute a new thread
1470 *****************************************************************************/
1474 ACPI_EXECUTE_TYPE Type,
1475 ACPI_OSD_EXEC_CALLBACK Function,
1482 ret = pthread_create (&thread, NULL, (PTHREAD_CALLBACK) Function, Context);
1485 AcpiOsPrintf("Create thread failed");
1490 #else /* ACPI_SINGLE_THREADED */
1500 ACPI_EXECUTE_TYPE Type,
1501 ACPI_OSD_EXEC_CALLBACK Function,
1510 #endif /* ACPI_SINGLE_THREADED */
1513 /******************************************************************************
1515 * FUNCTION: AcpiOsWaitEventsComplete
1521 * DESCRIPTION: Wait for all asynchronous events to complete. This
1522 * implementation does nothing.
1524 *****************************************************************************/
1527 AcpiOsWaitEventsComplete (