osunixxf.c revision 213800
1193267Sjkim/****************************************************************************** 2193267Sjkim * 3193267Sjkim * Module Name: osunixxf - UNIX OSL interfaces 4193267Sjkim * 5193267Sjkim *****************************************************************************/ 6193267Sjkim 7193267Sjkim/****************************************************************************** 8193267Sjkim * 9193267Sjkim * 1. Copyright Notice 10193267Sjkim * 11202766Sjkim * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. 12193267Sjkim * All rights reserved. 13193267Sjkim * 14193267Sjkim * 2. License 15193267Sjkim * 16193267Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property 17193267Sjkim * rights. You may have additional license terms from the party that provided 18193267Sjkim * you this software, covering your right to use that party's intellectual 19193267Sjkim * property rights. 20193267Sjkim * 21193267Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22193267Sjkim * copy of the source code appearing in this file ("Covered Code") an 23193267Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24193267Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy, 25193267Sjkim * make derivatives, distribute, use and display any portion of the Covered 26193267Sjkim * Code in any form, with the right to sublicense such rights; and 27193267Sjkim * 28193267Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29193267Sjkim * license (with the right to sublicense), under only those claims of Intel 30193267Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell, 31193267Sjkim * offer to sell, and import the Covered Code and derivative works thereof 32193267Sjkim * solely to the minimum extent necessary to exercise the above copyright 33193267Sjkim * license, and in no event shall the patent license extend to any additions 34193267Sjkim * to or modifications of the Original Intel Code. No other license or right 35193267Sjkim * is granted directly or by implication, estoppel or otherwise; 36193267Sjkim * 37193267Sjkim * The above copyright and patent license is granted only if the following 38193267Sjkim * conditions are met: 39193267Sjkim * 40193267Sjkim * 3. Conditions 41193267Sjkim * 42193267Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43193267Sjkim * Redistribution of source code of any substantial portion of the Covered 44193267Sjkim * Code or modification with rights to further distribute source must include 45193267Sjkim * the above Copyright Notice, the above License, this list of Conditions, 46193267Sjkim * and the following Disclaimer and Export Compliance provision. In addition, 47193267Sjkim * Licensee must cause all Covered Code to which Licensee contributes to 48193267Sjkim * contain a file documenting the changes Licensee made to create that Covered 49193267Sjkim * Code and the date of any change. Licensee must include in that file the 50193267Sjkim * documentation of any changes made by any predecessor Licensee. Licensee 51193267Sjkim * must include a prominent statement that the modification is derived, 52193267Sjkim * directly or indirectly, from Original Intel Code. 53193267Sjkim * 54193267Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55193267Sjkim * Redistribution of source code of any substantial portion of the Covered 56193267Sjkim * Code or modification without rights to further distribute source must 57193267Sjkim * include the following Disclaimer and Export Compliance provision in the 58193267Sjkim * documentation and/or other materials provided with distribution. In 59193267Sjkim * addition, Licensee may not authorize further sublicense of source of any 60193267Sjkim * portion of the Covered Code, and must include terms to the effect that the 61193267Sjkim * license from Licensee to its licensee is limited to the intellectual 62193267Sjkim * property embodied in the software Licensee provides to its licensee, and 63193267Sjkim * not to intellectual property embodied in modifications its licensee may 64193267Sjkim * make. 65193267Sjkim * 66193267Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any 67193267Sjkim * substantial portion of the Covered Code or modification must reproduce the 68193267Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance 69193267Sjkim * provision in the documentation and/or other materials provided with the 70193267Sjkim * distribution. 71193267Sjkim * 72193267Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original 73193267Sjkim * Intel Code. 74193267Sjkim * 75193267Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76193267Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or 77193267Sjkim * other dealings in products derived from or relating to the Covered Code 78193267Sjkim * without prior written authorization from Intel. 79193267Sjkim * 80193267Sjkim * 4. Disclaimer and Export Compliance 81193267Sjkim * 82193267Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83193267Sjkim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84193267Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85193267Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86193267Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87193267Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88193267Sjkim * PARTICULAR PURPOSE. 89193267Sjkim * 90193267Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91193267Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92193267Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93193267Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94193267Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95193267Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96193267Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97193267Sjkim * LIMITED REMEDY. 98193267Sjkim * 99193267Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this 100193267Sjkim * software or system incorporating such software without first obtaining any 101193267Sjkim * required license or other approval from the U. S. Department of Commerce or 102193267Sjkim * any other agency or department of the United States Government. In the 103193267Sjkim * event Licensee exports any such software from the United States or 104193267Sjkim * re-exports any such software from a foreign destination, Licensee shall 105193267Sjkim * ensure that the distribution and export/re-export of the software is in 106193267Sjkim * compliance with all laws, regulations, orders, or other restrictions of the 107193267Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108193267Sjkim * any of its subsidiaries will export/re-export any technical data, process, 109193267Sjkim * software, or service, directly or indirectly, to any country for which the 110193267Sjkim * United States government or any agency thereof requires an export license, 111193267Sjkim * other governmental approval, or letter of assurance, without first obtaining 112193267Sjkim * such license, approval or letter. 113193267Sjkim * 114193267Sjkim *****************************************************************************/ 115193267Sjkim 116193267Sjkim 117193267Sjkim/* 118213800Sjkim * These interfaces are required in order to compile the ASL compiler and the 119213800Sjkim * various ACPICA tools under Linux or other Unix-like system. 120209734Sjkim * 121209734Sjkim * Note: Use #define __APPLE__ for OS X generation. 122193267Sjkim */ 123193267Sjkim#include <stdio.h> 124193267Sjkim#include <stdlib.h> 125193267Sjkim#include <stdarg.h> 126193267Sjkim#include <unistd.h> 127193267Sjkim#include <sys/time.h> 128193267Sjkim#include <semaphore.h> 129193267Sjkim#include <pthread.h> 130209734Sjkim#include <errno.h> 131193267Sjkim 132193267Sjkim#include "acpi.h" 133193267Sjkim#include "accommon.h" 134193267Sjkim#include "amlcode.h" 135193267Sjkim#include "acparser.h" 136193267Sjkim#include "acdebug.h" 137193267Sjkim 138193267Sjkim#define _COMPONENT ACPI_OS_SERVICES 139193267Sjkim ACPI_MODULE_NAME ("osunixxf") 140193267Sjkim 141193267Sjkim 142193267Sjkimextern FILE *AcpiGbl_DebugFile; 143193267SjkimFILE *AcpiGbl_OutputFile; 144193267Sjkim 145193267Sjkim 146193267Sjkim/* Upcalls to AcpiExec */ 147193267Sjkim 148193267SjkimACPI_PHYSICAL_ADDRESS 149193267SjkimAeLocalGetRootPointer ( 150193267Sjkim void); 151193267Sjkim 152193267Sjkimvoid 153193267SjkimAeTableOverride ( 154193267Sjkim ACPI_TABLE_HEADER *ExistingTable, 155193267Sjkim ACPI_TABLE_HEADER **NewTable); 156193267Sjkim 157193267Sjkimtypedef void* (*PTHREAD_CALLBACK) (void *); 158193267Sjkim 159213800Sjkim/* Apple-specific */ 160193267Sjkim 161213800Sjkim#ifdef __APPLE__ 162213800Sjkim#define sem_destroy sem_close 163213800Sjkim#endif 164213800Sjkim 165213800Sjkim 166193267Sjkim/****************************************************************************** 167193267Sjkim * 168193267Sjkim * FUNCTION: AcpiOsInitialize, AcpiOsTerminate 169193267Sjkim * 170193267Sjkim * PARAMETERS: None 171193267Sjkim * 172193267Sjkim * RETURN: Status 173193267Sjkim * 174213800Sjkim * DESCRIPTION: Init and terminate. Nothing to do. 175193267Sjkim * 176193267Sjkim *****************************************************************************/ 177193267Sjkim 178193267SjkimACPI_STATUS 179213800SjkimAcpiOsInitialize ( 180213800Sjkim void) 181193267Sjkim{ 182193267Sjkim 183193267Sjkim AcpiGbl_OutputFile = stdout; 184193267Sjkim return (AE_OK); 185193267Sjkim} 186193267Sjkim 187193267Sjkim 188193267SjkimACPI_STATUS 189213800SjkimAcpiOsTerminate ( 190213800Sjkim void) 191193267Sjkim{ 192193267Sjkim 193193267Sjkim return (AE_OK); 194193267Sjkim} 195193267Sjkim 196193267Sjkim 197193267Sjkim/****************************************************************************** 198193267Sjkim * 199193267Sjkim * FUNCTION: AcpiOsGetRootPointer 200193267Sjkim * 201193267Sjkim * PARAMETERS: None 202193267Sjkim * 203193267Sjkim * RETURN: RSDP physical address 204193267Sjkim * 205213800Sjkim * DESCRIPTION: Gets the ACPI root pointer (RSDP) 206193267Sjkim * 207193267Sjkim *****************************************************************************/ 208193267Sjkim 209193267SjkimACPI_PHYSICAL_ADDRESS 210193267SjkimAcpiOsGetRootPointer ( 211193267Sjkim void) 212193267Sjkim{ 213193267Sjkim 214193267Sjkim return (AeLocalGetRootPointer ()); 215193267Sjkim} 216193267Sjkim 217193267Sjkim 218193267Sjkim/****************************************************************************** 219193267Sjkim * 220193267Sjkim * FUNCTION: AcpiOsPredefinedOverride 221193267Sjkim * 222213800Sjkim * PARAMETERS: InitVal - Initial value of the predefined object 223213800Sjkim * NewVal - The new value for the object 224193267Sjkim * 225213800Sjkim * RETURN: Status, pointer to value. Null pointer returned if not 226193267Sjkim * overriding. 227193267Sjkim * 228193267Sjkim * DESCRIPTION: Allow the OS to override predefined names 229193267Sjkim * 230193267Sjkim *****************************************************************************/ 231193267Sjkim 232193267SjkimACPI_STATUS 233193267SjkimAcpiOsPredefinedOverride ( 234193267Sjkim const ACPI_PREDEFINED_NAMES *InitVal, 235193267Sjkim ACPI_STRING *NewVal) 236193267Sjkim{ 237193267Sjkim 238193267Sjkim if (!InitVal || !NewVal) 239193267Sjkim { 240193267Sjkim return (AE_BAD_PARAMETER); 241193267Sjkim } 242193267Sjkim 243193267Sjkim *NewVal = NULL; 244193267Sjkim return (AE_OK); 245193267Sjkim} 246193267Sjkim 247193267Sjkim 248193267Sjkim/****************************************************************************** 249193267Sjkim * 250193267Sjkim * FUNCTION: AcpiOsTableOverride 251193267Sjkim * 252213800Sjkim * PARAMETERS: ExistingTable - Header of current table (probably 253213800Sjkim * firmware) 254213800Sjkim * NewTable - Where an entire new table is returned. 255193267Sjkim * 256213800Sjkim * RETURN: Status, pointer to new table. Null pointer returned if no 257193267Sjkim * table is available to override 258193267Sjkim * 259193267Sjkim * DESCRIPTION: Return a different version of a table if one is available 260193267Sjkim * 261193267Sjkim *****************************************************************************/ 262193267Sjkim 263193267SjkimACPI_STATUS 264193267SjkimAcpiOsTableOverride ( 265193267Sjkim ACPI_TABLE_HEADER *ExistingTable, 266193267Sjkim ACPI_TABLE_HEADER **NewTable) 267193267Sjkim{ 268193267Sjkim 269193267Sjkim if (!ExistingTable || !NewTable) 270193267Sjkim { 271193267Sjkim return (AE_BAD_PARAMETER); 272193267Sjkim } 273193267Sjkim 274193267Sjkim *NewTable = NULL; 275193267Sjkim 276193267Sjkim#ifdef ACPI_EXEC_APP 277193267Sjkim 278193267Sjkim AeTableOverride (ExistingTable, NewTable); 279193267Sjkim return (AE_OK); 280193267Sjkim#else 281193267Sjkim 282193267Sjkim return (AE_NO_ACPI_TABLES); 283193267Sjkim#endif 284193267Sjkim} 285193267Sjkim 286193267Sjkim 287193267Sjkim/****************************************************************************** 288193267Sjkim * 289193267Sjkim * FUNCTION: AcpiOsRedirectOutput 290193267Sjkim * 291193267Sjkim * PARAMETERS: Destination - An open file handle/pointer 292193267Sjkim * 293193267Sjkim * RETURN: None 294193267Sjkim * 295193267Sjkim * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf 296193267Sjkim * 297193267Sjkim *****************************************************************************/ 298193267Sjkim 299193267Sjkimvoid 300193267SjkimAcpiOsRedirectOutput ( 301193267Sjkim void *Destination) 302193267Sjkim{ 303193267Sjkim 304193267Sjkim AcpiGbl_OutputFile = Destination; 305193267Sjkim} 306193267Sjkim 307193267Sjkim 308193267Sjkim/****************************************************************************** 309193267Sjkim * 310193267Sjkim * FUNCTION: AcpiOsPrintf 311193267Sjkim * 312213800Sjkim * PARAMETERS: fmt, ... - Standard printf format 313193267Sjkim * 314193267Sjkim * RETURN: None 315193267Sjkim * 316193267Sjkim * DESCRIPTION: Formatted output 317193267Sjkim * 318193267Sjkim *****************************************************************************/ 319193267Sjkim 320193267Sjkimvoid ACPI_INTERNAL_VAR_XFACE 321193267SjkimAcpiOsPrintf ( 322193267Sjkim const char *Fmt, 323193267Sjkim ...) 324193267Sjkim{ 325193267Sjkim va_list Args; 326193267Sjkim 327193267Sjkim 328193267Sjkim va_start (Args, Fmt); 329193267Sjkim AcpiOsVprintf (Fmt, Args); 330193267Sjkim va_end (Args); 331193267Sjkim} 332193267Sjkim 333193267Sjkim 334193267Sjkim/****************************************************************************** 335193267Sjkim * 336193267Sjkim * FUNCTION: AcpiOsVprintf 337193267Sjkim * 338213800Sjkim * PARAMETERS: fmt - Standard printf format 339213800Sjkim * args - Argument list 340193267Sjkim * 341193267Sjkim * RETURN: None 342193267Sjkim * 343193267Sjkim * DESCRIPTION: Formatted output with argument list pointer 344193267Sjkim * 345193267Sjkim *****************************************************************************/ 346193267Sjkim 347193267Sjkimvoid 348193267SjkimAcpiOsVprintf ( 349193267Sjkim const char *Fmt, 350193267Sjkim va_list Args) 351193267Sjkim{ 352193267Sjkim INT32 Count = 0; 353193267Sjkim UINT8 Flags; 354193267Sjkim 355193267Sjkim 356193267Sjkim Flags = AcpiGbl_DbOutputFlags; 357193267Sjkim if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) 358193267Sjkim { 359193267Sjkim /* Output is directable to either a file (if open) or the console */ 360193267Sjkim 361193267Sjkim if (AcpiGbl_DebugFile) 362193267Sjkim { 363193267Sjkim /* Output file is open, send the output there */ 364193267Sjkim 365193267Sjkim Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args); 366193267Sjkim } 367193267Sjkim else 368193267Sjkim { 369193267Sjkim /* No redirection, send output to console (once only!) */ 370193267Sjkim 371193267Sjkim Flags |= ACPI_DB_CONSOLE_OUTPUT; 372193267Sjkim } 373193267Sjkim } 374193267Sjkim 375193267Sjkim if (Flags & ACPI_DB_CONSOLE_OUTPUT) 376193267Sjkim { 377193267Sjkim Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args); 378193267Sjkim } 379193267Sjkim} 380193267Sjkim 381193267Sjkim 382193267Sjkim/****************************************************************************** 383193267Sjkim * 384193267Sjkim * FUNCTION: AcpiOsGetLine 385193267Sjkim * 386213800Sjkim * PARAMETERS: fmt - Standard printf format 387213800Sjkim * args - Argument list 388193267Sjkim * 389193267Sjkim * RETURN: Actual bytes read 390193267Sjkim * 391193267Sjkim * DESCRIPTION: Formatted input with argument list pointer 392193267Sjkim * 393193267Sjkim *****************************************************************************/ 394193267Sjkim 395193267SjkimUINT32 396193267SjkimAcpiOsGetLine ( 397193267Sjkim char *Buffer) 398193267Sjkim{ 399193267Sjkim UINT8 Temp; 400193267Sjkim UINT32 i; 401193267Sjkim 402193267Sjkim 403193267Sjkim for (i = 0; ; i++) 404193267Sjkim { 405193267Sjkim scanf ("%1c", &Temp); 406193267Sjkim if (!Temp || Temp == '\n') 407193267Sjkim { 408193267Sjkim break; 409193267Sjkim } 410193267Sjkim 411193267Sjkim Buffer [i] = Temp; 412193267Sjkim } 413193267Sjkim 414193267Sjkim /* Null terminate the buffer */ 415193267Sjkim 416193267Sjkim Buffer [i] = 0; 417193267Sjkim 418193267Sjkim /* Return the number of bytes in the string */ 419193267Sjkim 420193267Sjkim return (i); 421193267Sjkim} 422193267Sjkim 423213800Sjkim 424193267Sjkim/****************************************************************************** 425193267Sjkim * 426193267Sjkim * FUNCTION: AcpiOsMapMemory 427193267Sjkim * 428213800Sjkim * PARAMETERS: where - Physical address of memory to be mapped 429213800Sjkim * length - How much memory to map 430193267Sjkim * 431213800Sjkim * RETURN: Pointer to mapped memory. Null on error. 432193267Sjkim * 433193267Sjkim * DESCRIPTION: Map physical memory into caller's address space 434193267Sjkim * 435193267Sjkim *****************************************************************************/ 436193267Sjkim 437193267Sjkimvoid * 438193267SjkimAcpiOsMapMemory ( 439193267Sjkim ACPI_PHYSICAL_ADDRESS where, 440193267Sjkim ACPI_SIZE length) 441193267Sjkim{ 442193267Sjkim 443193267Sjkim return (ACPI_TO_POINTER ((ACPI_SIZE) where)); 444193267Sjkim} 445193267Sjkim 446193267Sjkim 447193267Sjkim/****************************************************************************** 448193267Sjkim * 449193267Sjkim * FUNCTION: AcpiOsUnmapMemory 450193267Sjkim * 451213800Sjkim * PARAMETERS: where - Logical address of memory to be unmapped 452213800Sjkim * length - How much memory to unmap 453193267Sjkim * 454193267Sjkim * RETURN: None. 455193267Sjkim * 456213800Sjkim * DESCRIPTION: Delete a previously created mapping. Where and Length must 457193267Sjkim * correspond to a previous mapping exactly. 458193267Sjkim * 459193267Sjkim *****************************************************************************/ 460193267Sjkim 461193267Sjkimvoid 462193267SjkimAcpiOsUnmapMemory ( 463193267Sjkim void *where, 464193267Sjkim ACPI_SIZE length) 465193267Sjkim{ 466193267Sjkim 467193267Sjkim return; 468193267Sjkim} 469193267Sjkim 470193267Sjkim 471193267Sjkim/****************************************************************************** 472193267Sjkim * 473193267Sjkim * FUNCTION: AcpiOsAllocate 474193267Sjkim * 475213800Sjkim * PARAMETERS: Size - Amount to allocate, in bytes 476193267Sjkim * 477213800Sjkim * RETURN: Pointer to the new allocation. Null on error. 478193267Sjkim * 479213800Sjkim * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. 480193267Sjkim * 481193267Sjkim *****************************************************************************/ 482193267Sjkim 483193267Sjkimvoid * 484193267SjkimAcpiOsAllocate ( 485193267Sjkim ACPI_SIZE size) 486193267Sjkim{ 487193267Sjkim void *Mem; 488193267Sjkim 489193267Sjkim 490193267Sjkim Mem = (void *) malloc ((size_t) size); 491193267Sjkim return (Mem); 492193267Sjkim} 493193267Sjkim 494193267Sjkim 495193267Sjkim/****************************************************************************** 496193267Sjkim * 497193267Sjkim * FUNCTION: AcpiOsFree 498193267Sjkim * 499213800Sjkim * PARAMETERS: mem - Pointer to previously allocated memory 500193267Sjkim * 501193267Sjkim * RETURN: None. 502193267Sjkim * 503193267Sjkim * DESCRIPTION: Free memory allocated via AcpiOsAllocate 504193267Sjkim * 505193267Sjkim *****************************************************************************/ 506193267Sjkim 507193267Sjkimvoid 508193267SjkimAcpiOsFree ( 509193267Sjkim void *mem) 510193267Sjkim{ 511193267Sjkim 512193267Sjkim free (mem); 513193267Sjkim} 514193267Sjkim 515193267Sjkim 516213800Sjkim#ifdef ACPI_SINGLE_THREADED 517193267Sjkim/****************************************************************************** 518193267Sjkim * 519213800Sjkim * FUNCTION: Semaphore stub functions 520213800Sjkim * 521213800Sjkim * DESCRIPTION: Stub functions used for single-thread applications that do 522213800Sjkim * not require semaphore synchronization. Full implementations 523213800Sjkim * of these functions appear after the stubs. 524213800Sjkim * 525213800Sjkim *****************************************************************************/ 526213800Sjkim 527213800SjkimACPI_STATUS 528213800SjkimAcpiOsCreateSemaphore ( 529213800Sjkim UINT32 MaxUnits, 530213800Sjkim UINT32 InitialUnits, 531213800Sjkim ACPI_HANDLE *OutHandle) 532213800Sjkim{ 533213800Sjkim *OutHandle = (ACPI_HANDLE) 1; 534213800Sjkim return (AE_OK); 535213800Sjkim} 536213800Sjkim 537213800SjkimACPI_STATUS 538213800SjkimAcpiOsDeleteSemaphore ( 539213800Sjkim ACPI_HANDLE Handle) 540213800Sjkim{ 541213800Sjkim return (AE_OK); 542213800Sjkim} 543213800Sjkim 544213800SjkimACPI_STATUS 545213800SjkimAcpiOsWaitSemaphore ( 546213800Sjkim ACPI_HANDLE Handle, 547213800Sjkim UINT32 Units, 548213800Sjkim UINT16 Timeout) 549213800Sjkim{ 550213800Sjkim return (AE_OK); 551213800Sjkim} 552213800Sjkim 553213800SjkimACPI_STATUS 554213800SjkimAcpiOsSignalSemaphore ( 555213800Sjkim ACPI_HANDLE Handle, 556213800Sjkim UINT32 Units) 557213800Sjkim{ 558213800Sjkim return (AE_OK); 559213800Sjkim} 560213800Sjkim 561213800Sjkim#else 562213800Sjkim/****************************************************************************** 563213800Sjkim * 564193267Sjkim * FUNCTION: AcpiOsCreateSemaphore 565193267Sjkim * 566193267Sjkim * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore 567193267Sjkim * OutHandle - Where a handle will be returned 568193267Sjkim * 569193267Sjkim * RETURN: Status 570193267Sjkim * 571193267Sjkim * DESCRIPTION: Create an OS semaphore 572193267Sjkim * 573193267Sjkim *****************************************************************************/ 574193267Sjkim 575193267SjkimACPI_STATUS 576193267SjkimAcpiOsCreateSemaphore ( 577193267Sjkim UINT32 MaxUnits, 578193267Sjkim UINT32 InitialUnits, 579193267Sjkim ACPI_HANDLE *OutHandle) 580193267Sjkim{ 581193267Sjkim sem_t *Sem; 582193267Sjkim 583193267Sjkim 584193267Sjkim if (!OutHandle) 585193267Sjkim { 586193267Sjkim return (AE_BAD_PARAMETER); 587193267Sjkim } 588193267Sjkim 589209734Sjkim#ifdef __APPLE__ 590209734Sjkim { 591213800Sjkim char *SemaphoreName = tmpnam (NULL); 592213800Sjkim 593213800Sjkim Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits); 594213800Sjkim if (!Sem) 595213800Sjkim { 596213800Sjkim return (AE_NO_MEMORY); 597213800Sjkim } 598213800Sjkim sem_unlink (SemaphoreName); /* This just deletes the name */ 599209734Sjkim } 600209734Sjkim 601209734Sjkim#else 602193267Sjkim Sem = AcpiOsAllocate (sizeof (sem_t)); 603193267Sjkim if (!Sem) 604193267Sjkim { 605193267Sjkim return (AE_NO_MEMORY); 606193267Sjkim } 607193267Sjkim 608193267Sjkim if (sem_init (Sem, 0, InitialUnits) == -1) 609193267Sjkim { 610193267Sjkim AcpiOsFree (Sem); 611193267Sjkim return (AE_BAD_PARAMETER); 612193267Sjkim } 613209734Sjkim#endif 614193267Sjkim 615193267Sjkim *OutHandle = (ACPI_HANDLE) Sem; 616193267Sjkim return (AE_OK); 617193267Sjkim} 618193267Sjkim 619193267Sjkim 620193267Sjkim/****************************************************************************** 621193267Sjkim * 622193267Sjkim * FUNCTION: AcpiOsDeleteSemaphore 623193267Sjkim * 624193267Sjkim * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 625193267Sjkim * 626193267Sjkim * RETURN: Status 627193267Sjkim * 628193267Sjkim * DESCRIPTION: Delete an OS semaphore 629193267Sjkim * 630193267Sjkim *****************************************************************************/ 631193267Sjkim 632193267SjkimACPI_STATUS 633193267SjkimAcpiOsDeleteSemaphore ( 634193267Sjkim ACPI_HANDLE Handle) 635193267Sjkim{ 636193267Sjkim sem_t *Sem = (sem_t *) Handle; 637193267Sjkim 638193267Sjkim 639193267Sjkim if (!Sem) 640193267Sjkim { 641193267Sjkim return (AE_BAD_PARAMETER); 642193267Sjkim } 643193267Sjkim 644193267Sjkim if (sem_destroy (Sem) == -1) 645193267Sjkim { 646193267Sjkim return (AE_BAD_PARAMETER); 647193267Sjkim } 648193267Sjkim 649193267Sjkim return (AE_OK); 650193267Sjkim} 651193267Sjkim 652193267Sjkim 653193267Sjkim/****************************************************************************** 654193267Sjkim * 655193267Sjkim * FUNCTION: AcpiOsWaitSemaphore 656193267Sjkim * 657193267Sjkim * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 658193267Sjkim * Units - How many units to wait for 659193267Sjkim * Timeout - How long to wait 660193267Sjkim * 661193267Sjkim * RETURN: Status 662193267Sjkim * 663193267Sjkim * DESCRIPTION: Wait for units 664193267Sjkim * 665193267Sjkim *****************************************************************************/ 666193267Sjkim 667193267SjkimACPI_STATUS 668193267SjkimAcpiOsWaitSemaphore ( 669193267Sjkim ACPI_HANDLE Handle, 670193267Sjkim UINT32 Units, 671193267Sjkim UINT16 Timeout) 672193267Sjkim{ 673193267Sjkim ACPI_STATUS Status = AE_OK; 674193267Sjkim sem_t *Sem = (sem_t *) Handle; 675193267Sjkim struct timespec T; 676193267Sjkim 677193267Sjkim 678193267Sjkim if (!Sem) 679193267Sjkim { 680193267Sjkim return (AE_BAD_PARAMETER); 681193267Sjkim } 682193267Sjkim 683193267Sjkim switch (Timeout) 684193267Sjkim { 685193267Sjkim /* 686193267Sjkim * No Wait: 687193267Sjkim * -------- 688193267Sjkim * A zero timeout value indicates that we shouldn't wait - just 689193267Sjkim * acquire the semaphore if available otherwise return AE_TIME 690193267Sjkim * (a.k.a. 'would block'). 691193267Sjkim */ 692193267Sjkim case 0: 693193267Sjkim 694193267Sjkim if (sem_trywait(Sem) == -1) 695193267Sjkim { 696193267Sjkim Status = (AE_TIME); 697193267Sjkim } 698193267Sjkim break; 699193267Sjkim 700193267Sjkim /* Wait Indefinitely */ 701193267Sjkim 702193267Sjkim case ACPI_WAIT_FOREVER: 703193267Sjkim 704193267Sjkim if (sem_wait (Sem)) 705193267Sjkim { 706193267Sjkim Status = (AE_TIME); 707193267Sjkim } 708193267Sjkim break; 709193267Sjkim 710193267Sjkim /* Wait with Timeout */ 711193267Sjkim 712193267Sjkim default: 713193267Sjkim 714193267Sjkim T.tv_sec = Timeout / 1000; 715193267Sjkim T.tv_nsec = (Timeout - (T.tv_sec * 1000)) * 1000000; 716193267Sjkim 717193267Sjkim#ifdef ACPI_USE_ALTERNATE_TIMEOUT 718193267Sjkim /* 719193267Sjkim * Alternate timeout mechanism for environments where 720193267Sjkim * sem_timedwait is not available or does not work properly. 721193267Sjkim */ 722193267Sjkim while (Timeout) 723193267Sjkim { 724193267Sjkim if (sem_trywait (Sem) == 0) 725193267Sjkim { 726193267Sjkim /* Got the semaphore */ 727193267Sjkim return (AE_OK); 728193267Sjkim } 729193267Sjkim usleep (1000); /* one millisecond */ 730193267Sjkim Timeout--; 731193267Sjkim } 732193267Sjkim Status = (AE_TIME); 733193267Sjkim#else 734193267Sjkim 735193267Sjkim if (sem_timedwait (Sem, &T)) 736193267Sjkim { 737193267Sjkim Status = (AE_TIME); 738193267Sjkim } 739193267Sjkim#endif 740193267Sjkim 741193267Sjkim break; 742193267Sjkim } 743193267Sjkim 744193267Sjkim return (Status); 745193267Sjkim} 746193267Sjkim 747193267Sjkim 748193267Sjkim/****************************************************************************** 749193267Sjkim * 750193267Sjkim * FUNCTION: AcpiOsSignalSemaphore 751193267Sjkim * 752193267Sjkim * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 753193267Sjkim * Units - Number of units to send 754193267Sjkim * 755193267Sjkim * RETURN: Status 756193267Sjkim * 757193267Sjkim * DESCRIPTION: Send units 758193267Sjkim * 759193267Sjkim *****************************************************************************/ 760193267Sjkim 761193267SjkimACPI_STATUS 762193267SjkimAcpiOsSignalSemaphore ( 763193267Sjkim ACPI_HANDLE Handle, 764193267Sjkim UINT32 Units) 765193267Sjkim{ 766193267Sjkim sem_t *Sem = (sem_t *)Handle; 767193267Sjkim 768193267Sjkim 769193267Sjkim if (!Sem) 770193267Sjkim { 771193267Sjkim return (AE_BAD_PARAMETER); 772193267Sjkim } 773193267Sjkim 774193267Sjkim if (sem_post (Sem) == -1) 775193267Sjkim { 776193267Sjkim return (AE_LIMIT); 777193267Sjkim } 778193267Sjkim 779193267Sjkim return (AE_OK); 780193267Sjkim} 781193267Sjkim 782213800Sjkim#endif /* ACPI_SINGLE_THREADED */ 783193267Sjkim 784213800Sjkim 785193267Sjkim/****************************************************************************** 786193267Sjkim * 787193267Sjkim * FUNCTION: Spinlock interfaces 788193267Sjkim * 789193267Sjkim * DESCRIPTION: Map these interfaces to semaphore interfaces 790193267Sjkim * 791193267Sjkim *****************************************************************************/ 792193267Sjkim 793193267SjkimACPI_STATUS 794193267SjkimAcpiOsCreateLock ( 795193267Sjkim ACPI_SPINLOCK *OutHandle) 796193267Sjkim{ 797193267Sjkim 798193267Sjkim return (AcpiOsCreateSemaphore (1, 1, OutHandle)); 799193267Sjkim} 800193267Sjkim 801193267Sjkim 802193267Sjkimvoid 803193267SjkimAcpiOsDeleteLock ( 804193267Sjkim ACPI_SPINLOCK Handle) 805193267Sjkim{ 806193267Sjkim AcpiOsDeleteSemaphore (Handle); 807193267Sjkim} 808193267Sjkim 809193267Sjkim 810193267SjkimACPI_CPU_FLAGS 811193267SjkimAcpiOsAcquireLock ( 812193267Sjkim ACPI_HANDLE Handle) 813193267Sjkim{ 814193267Sjkim AcpiOsWaitSemaphore (Handle, 1, 0xFFFF); 815193267Sjkim return (0); 816193267Sjkim} 817193267Sjkim 818193267Sjkim 819193267Sjkimvoid 820193267SjkimAcpiOsReleaseLock ( 821193267Sjkim ACPI_SPINLOCK Handle, 822193267Sjkim ACPI_CPU_FLAGS Flags) 823193267Sjkim{ 824193267Sjkim AcpiOsSignalSemaphore (Handle, 1); 825193267Sjkim} 826193267Sjkim 827193267Sjkim 828193267Sjkim/****************************************************************************** 829193267Sjkim * 830193267Sjkim * FUNCTION: AcpiOsInstallInterruptHandler 831193267Sjkim * 832213800Sjkim * PARAMETERS: InterruptNumber - Level handler should respond to. 833213800Sjkim * Isr - Address of the ACPI interrupt handler 834213800Sjkim * ExceptPtr - Where status is returned 835193267Sjkim * 836193267Sjkim * RETURN: Handle to the newly installed handler. 837193267Sjkim * 838213800Sjkim * DESCRIPTION: Install an interrupt handler. Used to install the ACPI 839193267Sjkim * OS-independent handler. 840193267Sjkim * 841193267Sjkim *****************************************************************************/ 842193267Sjkim 843193267SjkimUINT32 844193267SjkimAcpiOsInstallInterruptHandler ( 845193267Sjkim UINT32 InterruptNumber, 846193267Sjkim ACPI_OSD_HANDLER ServiceRoutine, 847193267Sjkim void *Context) 848193267Sjkim{ 849193267Sjkim 850193267Sjkim return (AE_OK); 851193267Sjkim} 852193267Sjkim 853193267Sjkim 854193267Sjkim/****************************************************************************** 855193267Sjkim * 856193267Sjkim * FUNCTION: AcpiOsRemoveInterruptHandler 857193267Sjkim * 858213800Sjkim * PARAMETERS: Handle - Returned when handler was installed 859193267Sjkim * 860193267Sjkim * RETURN: Status 861193267Sjkim * 862193267Sjkim * DESCRIPTION: Uninstalls an interrupt handler. 863193267Sjkim * 864193267Sjkim *****************************************************************************/ 865193267Sjkim 866193267SjkimACPI_STATUS 867193267SjkimAcpiOsRemoveInterruptHandler ( 868193267Sjkim UINT32 InterruptNumber, 869193267Sjkim ACPI_OSD_HANDLER ServiceRoutine) 870193267Sjkim{ 871193267Sjkim 872193267Sjkim return (AE_OK); 873193267Sjkim} 874193267Sjkim 875193267Sjkim 876193267Sjkim/****************************************************************************** 877193267Sjkim * 878193267Sjkim * FUNCTION: AcpiOsExecute 879193267Sjkim * 880213800Sjkim * PARAMETERS: Type - Type of execution 881213800Sjkim * Function - Address of the function to execute 882213800Sjkim * Context - Passed as a parameter to the function 883193267Sjkim * 884193267Sjkim * RETURN: Status. 885193267Sjkim * 886193267Sjkim * DESCRIPTION: Execute a new thread 887193267Sjkim * 888193267Sjkim *****************************************************************************/ 889193267Sjkim 890193267SjkimACPI_STATUS 891193267SjkimAcpiOsExecute ( 892193267Sjkim ACPI_EXECUTE_TYPE Type, 893193267Sjkim ACPI_OSD_EXEC_CALLBACK Function, 894193267Sjkim void *Context) 895193267Sjkim{ 896193267Sjkim pthread_t thread; 897193267Sjkim int ret; 898193267Sjkim 899193267Sjkim 900193267Sjkim ret = pthread_create (&thread, NULL, (PTHREAD_CALLBACK) Function, Context); 901193267Sjkim if (ret) 902193267Sjkim { 903193267Sjkim AcpiOsPrintf("Create thread failed"); 904193267Sjkim } 905193267Sjkim return (0); 906193267Sjkim} 907193267Sjkim 908193267Sjkim 909193267Sjkim/****************************************************************************** 910193267Sjkim * 911193267Sjkim * FUNCTION: AcpiOsStall 912193267Sjkim * 913213800Sjkim * PARAMETERS: microseconds - Time to sleep 914193267Sjkim * 915193267Sjkim * RETURN: Blocks until sleep is completed. 916193267Sjkim * 917193267Sjkim * DESCRIPTION: Sleep at microsecond granularity 918193267Sjkim * 919193267Sjkim *****************************************************************************/ 920193267Sjkim 921193267Sjkimvoid 922193267SjkimAcpiOsStall ( 923193267Sjkim UINT32 microseconds) 924193267Sjkim{ 925193267Sjkim 926193267Sjkim if (microseconds) 927193267Sjkim { 928193267Sjkim usleep (microseconds); 929193267Sjkim } 930193267Sjkim} 931193267Sjkim 932193267Sjkim 933193267Sjkim/****************************************************************************** 934193267Sjkim * 935193267Sjkim * FUNCTION: AcpiOsSleep 936193267Sjkim * 937213800Sjkim * PARAMETERS: milliseconds - Time to sleep 938193267Sjkim * 939193267Sjkim * RETURN: Blocks until sleep is completed. 940193267Sjkim * 941193267Sjkim * DESCRIPTION: Sleep at millisecond granularity 942193267Sjkim * 943193267Sjkim *****************************************************************************/ 944193267Sjkim 945193267Sjkimvoid 946193267SjkimAcpiOsSleep ( 947202766Sjkim UINT64 milliseconds) 948193267Sjkim{ 949193267Sjkim 950193267Sjkim sleep (milliseconds / 1000); /* Sleep for whole seconds */ 951193267Sjkim 952193267Sjkim /* 953193267Sjkim * Arg to usleep() must be less than 1,000,000 (1 second) 954193267Sjkim */ 955193267Sjkim usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ 956193267Sjkim} 957193267Sjkim 958213800Sjkim 959193267Sjkim/****************************************************************************** 960193267Sjkim * 961193267Sjkim * FUNCTION: AcpiOsGetTimer 962193267Sjkim * 963193267Sjkim * PARAMETERS: None 964193267Sjkim * 965193267Sjkim * RETURN: Current time in 100 nanosecond units 966193267Sjkim * 967193267Sjkim * DESCRIPTION: Get the current system time 968193267Sjkim * 969193267Sjkim *****************************************************************************/ 970193267Sjkim 971193267SjkimUINT64 972213800SjkimAcpiOsGetTimer ( 973213800Sjkim void) 974193267Sjkim{ 975193267Sjkim struct timeval time; 976193267Sjkim 977193267Sjkim 978193267Sjkim gettimeofday (&time, NULL); 979193267Sjkim 980193267Sjkim /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */ 981193267Sjkim 982193267Sjkim return (((UINT64) time.tv_sec * 10000000) + ((UINT64) time.tv_usec * 10)); 983193267Sjkim} 984193267Sjkim 985193267Sjkim 986193267Sjkim/****************************************************************************** 987193267Sjkim * 988193267Sjkim * FUNCTION: AcpiOsReadPciConfiguration 989193267Sjkim * 990213800Sjkim * PARAMETERS: PciId - Seg/Bus/Dev 991213800Sjkim * Register - Device Register 992213800Sjkim * Value - Buffer where value is placed 993213800Sjkim * Width - Number of bits 994193267Sjkim * 995193267Sjkim * RETURN: Status 996193267Sjkim * 997193267Sjkim * DESCRIPTION: Read data from PCI configuration space 998193267Sjkim * 999193267Sjkim *****************************************************************************/ 1000193267Sjkim 1001193267SjkimACPI_STATUS 1002193267SjkimAcpiOsReadPciConfiguration ( 1003193267Sjkim ACPI_PCI_ID *PciId, 1004193267Sjkim UINT32 Register, 1005210944Sjkim UINT64 *Value, 1006193267Sjkim UINT32 Width) 1007193267Sjkim{ 1008193267Sjkim 1009193267Sjkim return (AE_OK); 1010193267Sjkim} 1011193267Sjkim 1012193267Sjkim 1013193267Sjkim/****************************************************************************** 1014193267Sjkim * 1015193267Sjkim * FUNCTION: AcpiOsWritePciConfiguration 1016193267Sjkim * 1017213800Sjkim * PARAMETERS: PciId - Seg/Bus/Dev 1018213800Sjkim * Register - Device Register 1019213800Sjkim * Value - Value to be written 1020213800Sjkim * Width - Number of bits 1021193267Sjkim * 1022193267Sjkim * RETURN: Status. 1023193267Sjkim * 1024193267Sjkim * DESCRIPTION: Write data to PCI configuration space 1025193267Sjkim * 1026193267Sjkim *****************************************************************************/ 1027193267Sjkim 1028193267SjkimACPI_STATUS 1029193267SjkimAcpiOsWritePciConfiguration ( 1030193267Sjkim ACPI_PCI_ID *PciId, 1031193267Sjkim UINT32 Register, 1032202766Sjkim UINT64 Value, 1033193267Sjkim UINT32 Width) 1034193267Sjkim{ 1035193267Sjkim 1036193267Sjkim return (AE_OK); 1037193267Sjkim} 1038193267Sjkim 1039193267Sjkim 1040193267Sjkim/****************************************************************************** 1041193267Sjkim * 1042193267Sjkim * FUNCTION: AcpiOsReadPort 1043193267Sjkim * 1044213800Sjkim * PARAMETERS: Address - Address of I/O port/register to read 1045213800Sjkim * Value - Where value is placed 1046213800Sjkim * Width - Number of bits 1047193267Sjkim * 1048193267Sjkim * RETURN: Value read from port 1049193267Sjkim * 1050193267Sjkim * DESCRIPTION: Read data from an I/O port or register 1051193267Sjkim * 1052193267Sjkim *****************************************************************************/ 1053193267Sjkim 1054193267SjkimACPI_STATUS 1055193267SjkimAcpiOsReadPort ( 1056193267Sjkim ACPI_IO_ADDRESS Address, 1057193267Sjkim UINT32 *Value, 1058193267Sjkim UINT32 Width) 1059193267Sjkim{ 1060193267Sjkim 1061193267Sjkim switch (Width) 1062193267Sjkim { 1063193267Sjkim case 8: 1064193267Sjkim *Value = 0xFF; 1065193267Sjkim break; 1066193267Sjkim 1067193267Sjkim case 16: 1068193267Sjkim *Value = 0xFFFF; 1069193267Sjkim break; 1070193267Sjkim 1071193267Sjkim case 32: 1072193267Sjkim *Value = 0xFFFFFFFF; 1073193267Sjkim break; 1074193267Sjkim 1075193267Sjkim default: 1076193267Sjkim return (AE_BAD_PARAMETER); 1077193267Sjkim } 1078193267Sjkim 1079193267Sjkim return (AE_OK); 1080193267Sjkim} 1081193267Sjkim 1082193267Sjkim 1083193267Sjkim/****************************************************************************** 1084193267Sjkim * 1085193267Sjkim * FUNCTION: AcpiOsWritePort 1086193267Sjkim * 1087213800Sjkim * PARAMETERS: Address - Address of I/O port/register to write 1088213800Sjkim * Value - Value to write 1089213800Sjkim * Width - Number of bits 1090193267Sjkim * 1091193267Sjkim * RETURN: None 1092193267Sjkim * 1093193267Sjkim * DESCRIPTION: Write data to an I/O port or register 1094193267Sjkim * 1095193267Sjkim *****************************************************************************/ 1096193267Sjkim 1097193267SjkimACPI_STATUS 1098193267SjkimAcpiOsWritePort ( 1099193267Sjkim ACPI_IO_ADDRESS Address, 1100193267Sjkim UINT32 Value, 1101193267Sjkim UINT32 Width) 1102193267Sjkim{ 1103193267Sjkim 1104193267Sjkim return (AE_OK); 1105193267Sjkim} 1106193267Sjkim 1107193267Sjkim 1108193267Sjkim/****************************************************************************** 1109193267Sjkim * 1110193267Sjkim * FUNCTION: AcpiOsReadMemory 1111193267Sjkim * 1112213800Sjkim * PARAMETERS: Address - Physical Memory Address to read 1113213800Sjkim * Value - Where value is placed 1114213800Sjkim * Width - Number of bits 1115193267Sjkim * 1116193267Sjkim * RETURN: Value read from physical memory address 1117193267Sjkim * 1118193267Sjkim * DESCRIPTION: Read data from a physical memory address 1119193267Sjkim * 1120193267Sjkim *****************************************************************************/ 1121193267Sjkim 1122193267SjkimACPI_STATUS 1123193267SjkimAcpiOsReadMemory ( 1124193267Sjkim ACPI_PHYSICAL_ADDRESS Address, 1125193267Sjkim UINT32 *Value, 1126193267Sjkim UINT32 Width) 1127193267Sjkim{ 1128193267Sjkim 1129193267Sjkim switch (Width) 1130193267Sjkim { 1131193267Sjkim case 8: 1132193267Sjkim case 16: 1133193267Sjkim case 32: 1134193267Sjkim *Value = 0; 1135193267Sjkim break; 1136193267Sjkim 1137193267Sjkim default: 1138193267Sjkim return (AE_BAD_PARAMETER); 1139193267Sjkim } 1140193267Sjkim return (AE_OK); 1141193267Sjkim} 1142193267Sjkim 1143193267Sjkim 1144193267Sjkim/****************************************************************************** 1145193267Sjkim * 1146193267Sjkim * FUNCTION: AcpiOsWriteMemory 1147193267Sjkim * 1148213800Sjkim * PARAMETERS: Address - Physical Memory Address to write 1149213800Sjkim * Value - Value to write 1150213800Sjkim * Width - Number of bits 1151193267Sjkim * 1152193267Sjkim * RETURN: None 1153193267Sjkim * 1154193267Sjkim * DESCRIPTION: Write data to a physical memory address 1155193267Sjkim * 1156193267Sjkim *****************************************************************************/ 1157193267Sjkim 1158193267SjkimACPI_STATUS 1159193267SjkimAcpiOsWriteMemory ( 1160193267Sjkim ACPI_PHYSICAL_ADDRESS Address, 1161193267Sjkim UINT32 Value, 1162193267Sjkim UINT32 Width) 1163193267Sjkim{ 1164193267Sjkim 1165193267Sjkim return (AE_OK); 1166193267Sjkim} 1167193267Sjkim 1168193267Sjkim 1169193267Sjkim/****************************************************************************** 1170193267Sjkim * 1171193267Sjkim * FUNCTION: AcpiOsReadable 1172193267Sjkim * 1173193267Sjkim * PARAMETERS: Pointer - Area to be verified 1174193267Sjkim * Length - Size of area 1175193267Sjkim * 1176193267Sjkim * RETURN: TRUE if readable for entire length 1177193267Sjkim * 1178193267Sjkim * DESCRIPTION: Verify that a pointer is valid for reading 1179193267Sjkim * 1180193267Sjkim *****************************************************************************/ 1181193267Sjkim 1182193267SjkimBOOLEAN 1183193267SjkimAcpiOsReadable ( 1184193267Sjkim void *Pointer, 1185193267Sjkim ACPI_SIZE Length) 1186193267Sjkim{ 1187193267Sjkim 1188193267Sjkim return (TRUE); 1189193267Sjkim} 1190193267Sjkim 1191193267Sjkim 1192193267Sjkim/****************************************************************************** 1193193267Sjkim * 1194193267Sjkim * FUNCTION: AcpiOsWritable 1195193267Sjkim * 1196193267Sjkim * PARAMETERS: Pointer - Area to be verified 1197193267Sjkim * Length - Size of area 1198193267Sjkim * 1199193267Sjkim * RETURN: TRUE if writable for entire length 1200193267Sjkim * 1201193267Sjkim * DESCRIPTION: Verify that a pointer is valid for writing 1202193267Sjkim * 1203193267Sjkim *****************************************************************************/ 1204193267Sjkim 1205193267SjkimBOOLEAN 1206193267SjkimAcpiOsWritable ( 1207193267Sjkim void *Pointer, 1208193267Sjkim ACPI_SIZE Length) 1209193267Sjkim{ 1210193267Sjkim 1211193267Sjkim return (TRUE); 1212193267Sjkim} 1213193267Sjkim 1214193267Sjkim 1215193267Sjkim/****************************************************************************** 1216193267Sjkim * 1217193267Sjkim * FUNCTION: AcpiOsGetThreadId 1218193267Sjkim * 1219193267Sjkim * PARAMETERS: None 1220193267Sjkim * 1221193267Sjkim * RETURN: Id of the running thread 1222193267Sjkim * 1223213800Sjkim * DESCRIPTION: Get the ID of the current (running) thread 1224193267Sjkim * 1225193267Sjkim *****************************************************************************/ 1226193267Sjkim 1227193267SjkimACPI_THREAD_ID 1228212700SjkimAcpiOsGetThreadId ( 1229212700Sjkim void) 1230193267Sjkim{ 1231193267Sjkim 1232212700Sjkim return (ACPI_CAST_PTHREAD_T (pthread_self())); 1233193267Sjkim} 1234193267Sjkim 1235193267Sjkim 1236193267Sjkim/****************************************************************************** 1237193267Sjkim * 1238193267Sjkim * FUNCTION: AcpiOsSignal 1239193267Sjkim * 1240213800Sjkim * PARAMETERS: Function - ACPI CA signal function code 1241213800Sjkim * Info - Pointer to function-dependent structure 1242193267Sjkim * 1243193267Sjkim * RETURN: Status 1244193267Sjkim * 1245193267Sjkim * DESCRIPTION: Miscellaneous functions. Example implementation only. 1246193267Sjkim * 1247193267Sjkim *****************************************************************************/ 1248193267Sjkim 1249193267SjkimACPI_STATUS 1250193267SjkimAcpiOsSignal ( 1251193267Sjkim UINT32 Function, 1252193267Sjkim void *Info) 1253193267Sjkim{ 1254193267Sjkim 1255193267Sjkim switch (Function) 1256193267Sjkim { 1257193267Sjkim case ACPI_SIGNAL_FATAL: 1258193267Sjkim break; 1259193267Sjkim 1260193267Sjkim case ACPI_SIGNAL_BREAKPOINT: 1261193267Sjkim break; 1262193267Sjkim 1263193267Sjkim default: 1264193267Sjkim break; 1265193267Sjkim } 1266193267Sjkim 1267193267Sjkim return (AE_OK); 1268193267Sjkim} 1269