osunixxf.c revision 212700
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/* 118193267Sjkim * These interfaces are required in order to compile the ASL compiler under 119193267Sjkim * Linux or other Unix-like system. 120209734Sjkim * 121209734Sjkim * Note: Use #define __APPLE__ for OS X generation. 122193267Sjkim */ 123193267Sjkim 124193267Sjkim#include <stdio.h> 125193267Sjkim#include <stdlib.h> 126193267Sjkim#include <stdarg.h> 127193267Sjkim#include <unistd.h> 128193267Sjkim#include <sys/time.h> 129193267Sjkim#include <semaphore.h> 130193267Sjkim#include <pthread.h> 131209734Sjkim#include <errno.h> 132193267Sjkim 133193267Sjkim#include "acpi.h" 134193267Sjkim#include "accommon.h" 135193267Sjkim#include "amlcode.h" 136193267Sjkim#include "acparser.h" 137193267Sjkim#include "acdebug.h" 138193267Sjkim 139193267Sjkim#define _COMPONENT ACPI_OS_SERVICES 140193267Sjkim ACPI_MODULE_NAME ("osunixxf") 141193267Sjkim 142193267Sjkim 143193267Sjkimextern FILE *AcpiGbl_DebugFile; 144193267SjkimFILE *AcpiGbl_OutputFile; 145193267Sjkim 146193267Sjkim 147193267Sjkim/* Upcalls to AcpiExec */ 148193267Sjkim 149193267SjkimACPI_PHYSICAL_ADDRESS 150193267SjkimAeLocalGetRootPointer ( 151193267Sjkim void); 152193267Sjkim 153193267Sjkimvoid 154193267SjkimAeTableOverride ( 155193267Sjkim ACPI_TABLE_HEADER *ExistingTable, 156193267Sjkim ACPI_TABLE_HEADER **NewTable); 157193267Sjkim 158193267Sjkimtypedef void* (*PTHREAD_CALLBACK) (void *); 159193267Sjkim 160193267Sjkim 161193267Sjkim/****************************************************************************** 162193267Sjkim * 163193267Sjkim * FUNCTION: AcpiOsInitialize, AcpiOsTerminate 164193267Sjkim * 165193267Sjkim * PARAMETERS: None 166193267Sjkim * 167193267Sjkim * RETURN: Status 168193267Sjkim * 169193267Sjkim * DESCRIPTION: Init and terminate. Nothing to do. 170193267Sjkim * 171193267Sjkim *****************************************************************************/ 172193267Sjkim 173193267SjkimACPI_STATUS 174193267SjkimAcpiOsInitialize (void) 175193267Sjkim{ 176193267Sjkim 177193267Sjkim AcpiGbl_OutputFile = stdout; 178193267Sjkim return (AE_OK); 179193267Sjkim} 180193267Sjkim 181193267Sjkim 182193267SjkimACPI_STATUS 183193267SjkimAcpiOsTerminate (void) 184193267Sjkim{ 185193267Sjkim 186193267Sjkim return (AE_OK); 187193267Sjkim} 188193267Sjkim 189193267Sjkim 190193267Sjkim/****************************************************************************** 191193267Sjkim * 192193267Sjkim * FUNCTION: AcpiOsGetRootPointer 193193267Sjkim * 194193267Sjkim * PARAMETERS: None 195193267Sjkim * 196193267Sjkim * RETURN: RSDP physical address 197193267Sjkim * 198193267Sjkim * DESCRIPTION: Gets the root pointer (RSDP) 199193267Sjkim * 200193267Sjkim *****************************************************************************/ 201193267Sjkim 202193267SjkimACPI_PHYSICAL_ADDRESS 203193267SjkimAcpiOsGetRootPointer ( 204193267Sjkim void) 205193267Sjkim{ 206193267Sjkim 207193267Sjkim return (AeLocalGetRootPointer ()); 208193267Sjkim} 209193267Sjkim 210193267Sjkim 211193267Sjkim/****************************************************************************** 212193267Sjkim * 213193267Sjkim * FUNCTION: AcpiOsPredefinedOverride 214193267Sjkim * 215193267Sjkim * PARAMETERS: InitVal - Initial value of the predefined object 216193267Sjkim * NewVal - The new value for the object 217193267Sjkim * 218193267Sjkim * RETURN: Status, pointer to value. Null pointer returned if not 219193267Sjkim * overriding. 220193267Sjkim * 221193267Sjkim * DESCRIPTION: Allow the OS to override predefined names 222193267Sjkim * 223193267Sjkim *****************************************************************************/ 224193267Sjkim 225193267SjkimACPI_STATUS 226193267SjkimAcpiOsPredefinedOverride ( 227193267Sjkim const ACPI_PREDEFINED_NAMES *InitVal, 228193267Sjkim ACPI_STRING *NewVal) 229193267Sjkim{ 230193267Sjkim 231193267Sjkim if (!InitVal || !NewVal) 232193267Sjkim { 233193267Sjkim return (AE_BAD_PARAMETER); 234193267Sjkim } 235193267Sjkim 236193267Sjkim *NewVal = NULL; 237193267Sjkim return (AE_OK); 238193267Sjkim} 239193267Sjkim 240193267Sjkim 241193267Sjkim/****************************************************************************** 242193267Sjkim * 243193267Sjkim * FUNCTION: AcpiOsTableOverride 244193267Sjkim * 245193267Sjkim * PARAMETERS: ExistingTable - Header of current table (probably firmware) 246193267Sjkim * NewTable - Where an entire new table is returned. 247193267Sjkim * 248193267Sjkim * RETURN: Status, pointer to new table. Null pointer returned if no 249193267Sjkim * table is available to override 250193267Sjkim * 251193267Sjkim * DESCRIPTION: Return a different version of a table if one is available 252193267Sjkim * 253193267Sjkim *****************************************************************************/ 254193267Sjkim 255193267SjkimACPI_STATUS 256193267SjkimAcpiOsTableOverride ( 257193267Sjkim ACPI_TABLE_HEADER *ExistingTable, 258193267Sjkim ACPI_TABLE_HEADER **NewTable) 259193267Sjkim{ 260193267Sjkim 261193267Sjkim if (!ExistingTable || !NewTable) 262193267Sjkim { 263193267Sjkim return (AE_BAD_PARAMETER); 264193267Sjkim } 265193267Sjkim 266193267Sjkim *NewTable = NULL; 267193267Sjkim 268193267Sjkim#ifdef ACPI_EXEC_APP 269193267Sjkim 270193267Sjkim AeTableOverride (ExistingTable, NewTable); 271193267Sjkim return (AE_OK); 272193267Sjkim#else 273193267Sjkim 274193267Sjkim return (AE_NO_ACPI_TABLES); 275193267Sjkim#endif 276193267Sjkim} 277193267Sjkim 278193267Sjkim 279193267Sjkim/****************************************************************************** 280193267Sjkim * 281193267Sjkim * FUNCTION: AcpiOsRedirectOutput 282193267Sjkim * 283193267Sjkim * PARAMETERS: Destination - An open file handle/pointer 284193267Sjkim * 285193267Sjkim * RETURN: None 286193267Sjkim * 287193267Sjkim * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf 288193267Sjkim * 289193267Sjkim *****************************************************************************/ 290193267Sjkim 291193267Sjkimvoid 292193267SjkimAcpiOsRedirectOutput ( 293193267Sjkim void *Destination) 294193267Sjkim{ 295193267Sjkim 296193267Sjkim AcpiGbl_OutputFile = Destination; 297193267Sjkim} 298193267Sjkim 299193267Sjkim 300193267Sjkim/****************************************************************************** 301193267Sjkim * 302193267Sjkim * FUNCTION: AcpiOsPrintf 303193267Sjkim * 304193267Sjkim * PARAMETERS: fmt, ... Standard printf format 305193267Sjkim * 306193267Sjkim * RETURN: None 307193267Sjkim * 308193267Sjkim * DESCRIPTION: Formatted output 309193267Sjkim * 310193267Sjkim *****************************************************************************/ 311193267Sjkim 312193267Sjkimvoid ACPI_INTERNAL_VAR_XFACE 313193267SjkimAcpiOsPrintf ( 314193267Sjkim const char *Fmt, 315193267Sjkim ...) 316193267Sjkim{ 317193267Sjkim va_list Args; 318193267Sjkim 319193267Sjkim 320193267Sjkim va_start (Args, Fmt); 321193267Sjkim AcpiOsVprintf (Fmt, Args); 322193267Sjkim va_end (Args); 323193267Sjkim} 324193267Sjkim 325193267Sjkim 326193267Sjkim/****************************************************************************** 327193267Sjkim * 328193267Sjkim * FUNCTION: AcpiOsVprintf 329193267Sjkim * 330193267Sjkim * PARAMETERS: fmt Standard printf format 331193267Sjkim * args Argument list 332193267Sjkim * 333193267Sjkim * RETURN: None 334193267Sjkim * 335193267Sjkim * DESCRIPTION: Formatted output with argument list pointer 336193267Sjkim * 337193267Sjkim *****************************************************************************/ 338193267Sjkim 339193267Sjkimvoid 340193267SjkimAcpiOsVprintf ( 341193267Sjkim const char *Fmt, 342193267Sjkim va_list Args) 343193267Sjkim{ 344193267Sjkim INT32 Count = 0; 345193267Sjkim UINT8 Flags; 346193267Sjkim 347193267Sjkim 348193267Sjkim Flags = AcpiGbl_DbOutputFlags; 349193267Sjkim if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) 350193267Sjkim { 351193267Sjkim /* Output is directable to either a file (if open) or the console */ 352193267Sjkim 353193267Sjkim if (AcpiGbl_DebugFile) 354193267Sjkim { 355193267Sjkim /* Output file is open, send the output there */ 356193267Sjkim 357193267Sjkim Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args); 358193267Sjkim } 359193267Sjkim else 360193267Sjkim { 361193267Sjkim /* No redirection, send output to console (once only!) */ 362193267Sjkim 363193267Sjkim Flags |= ACPI_DB_CONSOLE_OUTPUT; 364193267Sjkim } 365193267Sjkim } 366193267Sjkim 367193267Sjkim if (Flags & ACPI_DB_CONSOLE_OUTPUT) 368193267Sjkim { 369193267Sjkim Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args); 370193267Sjkim } 371193267Sjkim} 372193267Sjkim 373193267Sjkim 374193267Sjkim/****************************************************************************** 375193267Sjkim * 376193267Sjkim * FUNCTION: AcpiOsGetLine 377193267Sjkim * 378193267Sjkim * PARAMETERS: fmt Standard printf format 379193267Sjkim * args Argument list 380193267Sjkim * 381193267Sjkim * RETURN: Actual bytes read 382193267Sjkim * 383193267Sjkim * DESCRIPTION: Formatted input with argument list pointer 384193267Sjkim * 385193267Sjkim *****************************************************************************/ 386193267Sjkim 387193267SjkimUINT32 388193267SjkimAcpiOsGetLine ( 389193267Sjkim char *Buffer) 390193267Sjkim{ 391193267Sjkim UINT8 Temp; 392193267Sjkim UINT32 i; 393193267Sjkim 394193267Sjkim 395193267Sjkim for (i = 0; ; i++) 396193267Sjkim { 397193267Sjkim scanf ("%1c", &Temp); 398193267Sjkim if (!Temp || Temp == '\n') 399193267Sjkim { 400193267Sjkim break; 401193267Sjkim } 402193267Sjkim 403193267Sjkim Buffer [i] = Temp; 404193267Sjkim } 405193267Sjkim 406193267Sjkim /* Null terminate the buffer */ 407193267Sjkim 408193267Sjkim Buffer [i] = 0; 409193267Sjkim 410193267Sjkim /* Return the number of bytes in the string */ 411193267Sjkim 412193267Sjkim return (i); 413193267Sjkim} 414193267Sjkim 415193267Sjkim/****************************************************************************** 416193267Sjkim * 417193267Sjkim * FUNCTION: AcpiOsMapMemory 418193267Sjkim * 419193267Sjkim * PARAMETERS: where Physical address of memory to be mapped 420193267Sjkim * length How much memory to map 421193267Sjkim * 422193267Sjkim * RETURN: Pointer to mapped memory. Null on error. 423193267Sjkim * 424193267Sjkim * DESCRIPTION: Map physical memory into caller's address space 425193267Sjkim * 426193267Sjkim *****************************************************************************/ 427193267Sjkim 428193267Sjkimvoid * 429193267SjkimAcpiOsMapMemory ( 430193267Sjkim ACPI_PHYSICAL_ADDRESS where, 431193267Sjkim ACPI_SIZE length) 432193267Sjkim{ 433193267Sjkim 434193267Sjkim return (ACPI_TO_POINTER ((ACPI_SIZE) where)); 435193267Sjkim} 436193267Sjkim 437193267Sjkim 438193267Sjkim/****************************************************************************** 439193267Sjkim * 440193267Sjkim * FUNCTION: AcpiOsUnmapMemory 441193267Sjkim * 442193267Sjkim * PARAMETERS: where Logical address of memory to be unmapped 443193267Sjkim * length How much memory to unmap 444193267Sjkim * 445193267Sjkim * RETURN: None. 446193267Sjkim * 447193267Sjkim * DESCRIPTION: Delete a previously created mapping. Where and Length must 448193267Sjkim * correspond to a previous mapping exactly. 449193267Sjkim * 450193267Sjkim *****************************************************************************/ 451193267Sjkim 452193267Sjkimvoid 453193267SjkimAcpiOsUnmapMemory ( 454193267Sjkim void *where, 455193267Sjkim ACPI_SIZE length) 456193267Sjkim{ 457193267Sjkim 458193267Sjkim return; 459193267Sjkim} 460193267Sjkim 461193267Sjkim 462193267Sjkim/****************************************************************************** 463193267Sjkim * 464193267Sjkim * FUNCTION: AcpiOsAllocate 465193267Sjkim * 466193267Sjkim * PARAMETERS: Size Amount to allocate, in bytes 467193267Sjkim * 468193267Sjkim * RETURN: Pointer to the new allocation. Null on error. 469193267Sjkim * 470193267Sjkim * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. 471193267Sjkim * 472193267Sjkim *****************************************************************************/ 473193267Sjkim 474193267Sjkimvoid * 475193267SjkimAcpiOsAllocate ( 476193267Sjkim ACPI_SIZE size) 477193267Sjkim{ 478193267Sjkim void *Mem; 479193267Sjkim 480193267Sjkim 481193267Sjkim Mem = (void *) malloc ((size_t) size); 482193267Sjkim return (Mem); 483193267Sjkim} 484193267Sjkim 485193267Sjkim 486193267Sjkim/****************************************************************************** 487193267Sjkim * 488193267Sjkim * FUNCTION: AcpiOsFree 489193267Sjkim * 490193267Sjkim * PARAMETERS: mem Pointer to previously allocated memory 491193267Sjkim * 492193267Sjkim * RETURN: None. 493193267Sjkim * 494193267Sjkim * DESCRIPTION: Free memory allocated via AcpiOsAllocate 495193267Sjkim * 496193267Sjkim *****************************************************************************/ 497193267Sjkim 498193267Sjkimvoid 499193267SjkimAcpiOsFree ( 500193267Sjkim void *mem) 501193267Sjkim{ 502193267Sjkim 503193267Sjkim free (mem); 504193267Sjkim} 505193267Sjkim 506193267Sjkim 507193267Sjkim/****************************************************************************** 508193267Sjkim * 509193267Sjkim * FUNCTION: AcpiOsCreateSemaphore 510193267Sjkim * 511193267Sjkim * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore 512193267Sjkim * OutHandle - Where a handle will be returned 513193267Sjkim * 514193267Sjkim * RETURN: Status 515193267Sjkim * 516193267Sjkim * DESCRIPTION: Create an OS semaphore 517193267Sjkim * 518193267Sjkim *****************************************************************************/ 519193267Sjkim 520193267SjkimACPI_STATUS 521193267SjkimAcpiOsCreateSemaphore ( 522193267Sjkim UINT32 MaxUnits, 523193267Sjkim UINT32 InitialUnits, 524193267Sjkim ACPI_HANDLE *OutHandle) 525193267Sjkim{ 526193267Sjkim sem_t *Sem; 527193267Sjkim 528193267Sjkim 529193267Sjkim if (!OutHandle) 530193267Sjkim { 531193267Sjkim return (AE_BAD_PARAMETER); 532193267Sjkim } 533193267Sjkim 534209734Sjkim#ifdef __APPLE__ 535209734Sjkim Sem = sem_open (tmpnam (NULL), O_EXCL|O_CREAT, 0755, InitialUnits); 536209734Sjkim if (!Sem) 537209734Sjkim { 538209734Sjkim return (AE_NO_MEMORY); 539209734Sjkim } 540209734Sjkim 541209734Sjkim#else 542193267Sjkim Sem = AcpiOsAllocate (sizeof (sem_t)); 543193267Sjkim if (!Sem) 544193267Sjkim { 545193267Sjkim return (AE_NO_MEMORY); 546193267Sjkim } 547193267Sjkim 548193267Sjkim if (sem_init (Sem, 0, InitialUnits) == -1) 549193267Sjkim { 550193267Sjkim AcpiOsFree (Sem); 551193267Sjkim return (AE_BAD_PARAMETER); 552193267Sjkim } 553209734Sjkim#endif 554193267Sjkim 555193267Sjkim *OutHandle = (ACPI_HANDLE) Sem; 556193267Sjkim return (AE_OK); 557193267Sjkim} 558193267Sjkim 559193267Sjkim 560193267Sjkim/****************************************************************************** 561193267Sjkim * 562193267Sjkim * FUNCTION: AcpiOsDeleteSemaphore 563193267Sjkim * 564193267Sjkim * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 565193267Sjkim * 566193267Sjkim * RETURN: Status 567193267Sjkim * 568193267Sjkim * DESCRIPTION: Delete an OS semaphore 569193267Sjkim * 570193267Sjkim *****************************************************************************/ 571193267Sjkim 572193267SjkimACPI_STATUS 573193267SjkimAcpiOsDeleteSemaphore ( 574193267Sjkim ACPI_HANDLE Handle) 575193267Sjkim{ 576193267Sjkim sem_t *Sem = (sem_t *) Handle; 577193267Sjkim 578193267Sjkim 579193267Sjkim if (!Sem) 580193267Sjkim { 581193267Sjkim return (AE_BAD_PARAMETER); 582193267Sjkim } 583193267Sjkim 584193267Sjkim if (sem_destroy (Sem) == -1) 585193267Sjkim { 586193267Sjkim return (AE_BAD_PARAMETER); 587193267Sjkim } 588193267Sjkim 589193267Sjkim return (AE_OK); 590193267Sjkim} 591193267Sjkim 592193267Sjkim 593193267Sjkim/****************************************************************************** 594193267Sjkim * 595193267Sjkim * FUNCTION: AcpiOsWaitSemaphore 596193267Sjkim * 597193267Sjkim * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 598193267Sjkim * Units - How many units to wait for 599193267Sjkim * Timeout - How long to wait 600193267Sjkim * 601193267Sjkim * RETURN: Status 602193267Sjkim * 603193267Sjkim * DESCRIPTION: Wait for units 604193267Sjkim * 605193267Sjkim *****************************************************************************/ 606193267Sjkim 607193267SjkimACPI_STATUS 608193267SjkimAcpiOsWaitSemaphore ( 609193267Sjkim ACPI_HANDLE Handle, 610193267Sjkim UINT32 Units, 611193267Sjkim UINT16 Timeout) 612193267Sjkim{ 613193267Sjkim ACPI_STATUS Status = AE_OK; 614193267Sjkim sem_t *Sem = (sem_t *) Handle; 615193267Sjkim struct timespec T; 616193267Sjkim 617193267Sjkim 618193267Sjkim if (!Sem) 619193267Sjkim { 620193267Sjkim return (AE_BAD_PARAMETER); 621193267Sjkim } 622193267Sjkim 623193267Sjkim switch (Timeout) 624193267Sjkim { 625193267Sjkim /* 626193267Sjkim * No Wait: 627193267Sjkim * -------- 628193267Sjkim * A zero timeout value indicates that we shouldn't wait - just 629193267Sjkim * acquire the semaphore if available otherwise return AE_TIME 630193267Sjkim * (a.k.a. 'would block'). 631193267Sjkim */ 632193267Sjkim case 0: 633193267Sjkim 634193267Sjkim if (sem_trywait(Sem) == -1) 635193267Sjkim { 636193267Sjkim Status = (AE_TIME); 637193267Sjkim } 638193267Sjkim break; 639193267Sjkim 640193267Sjkim /* Wait Indefinitely */ 641193267Sjkim 642193267Sjkim case ACPI_WAIT_FOREVER: 643193267Sjkim 644193267Sjkim if (sem_wait (Sem)) 645193267Sjkim { 646193267Sjkim Status = (AE_TIME); 647193267Sjkim } 648193267Sjkim break; 649193267Sjkim 650193267Sjkim /* Wait with Timeout */ 651193267Sjkim 652193267Sjkim default: 653193267Sjkim 654193267Sjkim T.tv_sec = Timeout / 1000; 655193267Sjkim T.tv_nsec = (Timeout - (T.tv_sec * 1000)) * 1000000; 656193267Sjkim 657193267Sjkim#ifdef ACPI_USE_ALTERNATE_TIMEOUT 658193267Sjkim /* 659193267Sjkim * Alternate timeout mechanism for environments where 660193267Sjkim * sem_timedwait is not available or does not work properly. 661193267Sjkim */ 662193267Sjkim while (Timeout) 663193267Sjkim { 664193267Sjkim if (sem_trywait (Sem) == 0) 665193267Sjkim { 666193267Sjkim /* Got the semaphore */ 667193267Sjkim return (AE_OK); 668193267Sjkim } 669193267Sjkim usleep (1000); /* one millisecond */ 670193267Sjkim Timeout--; 671193267Sjkim } 672193267Sjkim Status = (AE_TIME); 673193267Sjkim#else 674193267Sjkim 675193267Sjkim if (sem_timedwait (Sem, &T)) 676193267Sjkim { 677193267Sjkim Status = (AE_TIME); 678193267Sjkim } 679193267Sjkim#endif 680193267Sjkim 681193267Sjkim break; 682193267Sjkim } 683193267Sjkim 684193267Sjkim return (Status); 685193267Sjkim} 686193267Sjkim 687193267Sjkim 688193267Sjkim/****************************************************************************** 689193267Sjkim * 690193267Sjkim * FUNCTION: AcpiOsSignalSemaphore 691193267Sjkim * 692193267Sjkim * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 693193267Sjkim * Units - Number of units to send 694193267Sjkim * 695193267Sjkim * RETURN: Status 696193267Sjkim * 697193267Sjkim * DESCRIPTION: Send units 698193267Sjkim * 699193267Sjkim *****************************************************************************/ 700193267Sjkim 701193267SjkimACPI_STATUS 702193267SjkimAcpiOsSignalSemaphore ( 703193267Sjkim ACPI_HANDLE Handle, 704193267Sjkim UINT32 Units) 705193267Sjkim{ 706193267Sjkim sem_t *Sem = (sem_t *)Handle; 707193267Sjkim 708193267Sjkim 709193267Sjkim if (!Sem) 710193267Sjkim { 711193267Sjkim return (AE_BAD_PARAMETER); 712193267Sjkim } 713193267Sjkim 714193267Sjkim if (sem_post (Sem) == -1) 715193267Sjkim { 716193267Sjkim return (AE_LIMIT); 717193267Sjkim } 718193267Sjkim 719193267Sjkim return (AE_OK); 720193267Sjkim} 721193267Sjkim 722193267Sjkim 723193267Sjkim/****************************************************************************** 724193267Sjkim * 725193267Sjkim * FUNCTION: Spinlock interfaces 726193267Sjkim * 727193267Sjkim * DESCRIPTION: Map these interfaces to semaphore interfaces 728193267Sjkim * 729193267Sjkim *****************************************************************************/ 730193267Sjkim 731193267SjkimACPI_STATUS 732193267SjkimAcpiOsCreateLock ( 733193267Sjkim ACPI_SPINLOCK *OutHandle) 734193267Sjkim{ 735193267Sjkim 736193267Sjkim return (AcpiOsCreateSemaphore (1, 1, OutHandle)); 737193267Sjkim} 738193267Sjkim 739193267Sjkim 740193267Sjkimvoid 741193267SjkimAcpiOsDeleteLock ( 742193267Sjkim ACPI_SPINLOCK Handle) 743193267Sjkim{ 744193267Sjkim AcpiOsDeleteSemaphore (Handle); 745193267Sjkim} 746193267Sjkim 747193267Sjkim 748193267SjkimACPI_CPU_FLAGS 749193267SjkimAcpiOsAcquireLock ( 750193267Sjkim ACPI_HANDLE Handle) 751193267Sjkim{ 752193267Sjkim AcpiOsWaitSemaphore (Handle, 1, 0xFFFF); 753193267Sjkim return (0); 754193267Sjkim} 755193267Sjkim 756193267Sjkim 757193267Sjkimvoid 758193267SjkimAcpiOsReleaseLock ( 759193267Sjkim ACPI_SPINLOCK Handle, 760193267Sjkim ACPI_CPU_FLAGS Flags) 761193267Sjkim{ 762193267Sjkim AcpiOsSignalSemaphore (Handle, 1); 763193267Sjkim} 764193267Sjkim 765193267Sjkim 766193267Sjkim/****************************************************************************** 767193267Sjkim * 768193267Sjkim * FUNCTION: AcpiOsInstallInterruptHandler 769193267Sjkim * 770193267Sjkim * PARAMETERS: InterruptNumber Level handler should respond to. 771193267Sjkim * Isr Address of the ACPI interrupt handler 772193267Sjkim * ExceptPtr Where status is returned 773193267Sjkim * 774193267Sjkim * RETURN: Handle to the newly installed handler. 775193267Sjkim * 776193267Sjkim * DESCRIPTION: Install an interrupt handler. Used to install the ACPI 777193267Sjkim * OS-independent handler. 778193267Sjkim * 779193267Sjkim *****************************************************************************/ 780193267Sjkim 781193267SjkimUINT32 782193267SjkimAcpiOsInstallInterruptHandler ( 783193267Sjkim UINT32 InterruptNumber, 784193267Sjkim ACPI_OSD_HANDLER ServiceRoutine, 785193267Sjkim void *Context) 786193267Sjkim{ 787193267Sjkim 788193267Sjkim return (AE_OK); 789193267Sjkim} 790193267Sjkim 791193267Sjkim 792193267Sjkim/****************************************************************************** 793193267Sjkim * 794193267Sjkim * FUNCTION: AcpiOsRemoveInterruptHandler 795193267Sjkim * 796193267Sjkim * PARAMETERS: Handle Returned when handler was installed 797193267Sjkim * 798193267Sjkim * RETURN: Status 799193267Sjkim * 800193267Sjkim * DESCRIPTION: Uninstalls an interrupt handler. 801193267Sjkim * 802193267Sjkim *****************************************************************************/ 803193267Sjkim 804193267SjkimACPI_STATUS 805193267SjkimAcpiOsRemoveInterruptHandler ( 806193267Sjkim UINT32 InterruptNumber, 807193267Sjkim ACPI_OSD_HANDLER ServiceRoutine) 808193267Sjkim{ 809193267Sjkim 810193267Sjkim return (AE_OK); 811193267Sjkim} 812193267Sjkim 813193267Sjkim 814193267Sjkim/****************************************************************************** 815193267Sjkim * 816193267Sjkim * FUNCTION: AcpiOsExecute 817193267Sjkim * 818193267Sjkim * PARAMETERS: Type - Type of execution 819193267Sjkim * Function - Address of the function to execute 820193267Sjkim * Context - Passed as a parameter to the function 821193267Sjkim * 822193267Sjkim * RETURN: Status. 823193267Sjkim * 824193267Sjkim * DESCRIPTION: Execute a new thread 825193267Sjkim * 826193267Sjkim *****************************************************************************/ 827193267Sjkim 828193267SjkimACPI_STATUS 829193267SjkimAcpiOsExecute ( 830193267Sjkim ACPI_EXECUTE_TYPE Type, 831193267Sjkim ACPI_OSD_EXEC_CALLBACK Function, 832193267Sjkim void *Context) 833193267Sjkim{ 834193267Sjkim pthread_t thread; 835193267Sjkim int ret; 836193267Sjkim 837193267Sjkim 838193267Sjkim ret = pthread_create (&thread, NULL, (PTHREAD_CALLBACK) Function, Context); 839193267Sjkim if (ret) 840193267Sjkim { 841193267Sjkim AcpiOsPrintf("Create thread failed"); 842193267Sjkim } 843193267Sjkim return (0); 844193267Sjkim} 845193267Sjkim 846193267Sjkim 847193267Sjkim/****************************************************************************** 848193267Sjkim * 849193267Sjkim * FUNCTION: AcpiOsStall 850193267Sjkim * 851193267Sjkim * PARAMETERS: microseconds To sleep 852193267Sjkim * 853193267Sjkim * RETURN: Blocks until sleep is completed. 854193267Sjkim * 855193267Sjkim * DESCRIPTION: Sleep at microsecond granularity 856193267Sjkim * 857193267Sjkim *****************************************************************************/ 858193267Sjkim 859193267Sjkimvoid 860193267SjkimAcpiOsStall ( 861193267Sjkim UINT32 microseconds) 862193267Sjkim{ 863193267Sjkim 864193267Sjkim if (microseconds) 865193267Sjkim { 866193267Sjkim usleep (microseconds); 867193267Sjkim } 868193267Sjkim} 869193267Sjkim 870193267Sjkim 871193267Sjkim/****************************************************************************** 872193267Sjkim * 873193267Sjkim * FUNCTION: AcpiOsSleep 874193267Sjkim * 875193267Sjkim * PARAMETERS: milliseconds To sleep 876193267Sjkim * 877193267Sjkim * RETURN: Blocks until sleep is completed. 878193267Sjkim * 879193267Sjkim * DESCRIPTION: Sleep at millisecond granularity 880193267Sjkim * 881193267Sjkim *****************************************************************************/ 882193267Sjkim 883193267Sjkimvoid 884193267SjkimAcpiOsSleep ( 885202766Sjkim UINT64 milliseconds) 886193267Sjkim{ 887193267Sjkim 888193267Sjkim sleep (milliseconds / 1000); /* Sleep for whole seconds */ 889193267Sjkim 890193267Sjkim /* 891193267Sjkim * Arg to usleep() must be less than 1,000,000 (1 second) 892193267Sjkim */ 893193267Sjkim usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ 894193267Sjkim} 895193267Sjkim 896193267Sjkim/****************************************************************************** 897193267Sjkim * 898193267Sjkim * FUNCTION: AcpiOsGetTimer 899193267Sjkim * 900193267Sjkim * PARAMETERS: None 901193267Sjkim * 902193267Sjkim * RETURN: Current time in 100 nanosecond units 903193267Sjkim * 904193267Sjkim * DESCRIPTION: Get the current system time 905193267Sjkim * 906193267Sjkim *****************************************************************************/ 907193267Sjkim 908193267SjkimUINT64 909193267SjkimAcpiOsGetTimer (void) 910193267Sjkim{ 911193267Sjkim struct timeval time; 912193267Sjkim 913193267Sjkim 914193267Sjkim gettimeofday (&time, NULL); 915193267Sjkim 916193267Sjkim /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */ 917193267Sjkim 918193267Sjkim return (((UINT64) time.tv_sec * 10000000) + ((UINT64) time.tv_usec * 10)); 919193267Sjkim} 920193267Sjkim 921193267Sjkim 922193267Sjkim/****************************************************************************** 923193267Sjkim * 924193267Sjkim * FUNCTION: AcpiOsReadPciConfiguration 925193267Sjkim * 926193267Sjkim * PARAMETERS: PciId Seg/Bus/Dev 927193267Sjkim * Register Device Register 928193267Sjkim * Value Buffer where value is placed 929193267Sjkim * Width Number of bits 930193267Sjkim * 931193267Sjkim * RETURN: Status 932193267Sjkim * 933193267Sjkim * DESCRIPTION: Read data from PCI configuration space 934193267Sjkim * 935193267Sjkim *****************************************************************************/ 936193267Sjkim 937193267SjkimACPI_STATUS 938193267SjkimAcpiOsReadPciConfiguration ( 939193267Sjkim ACPI_PCI_ID *PciId, 940193267Sjkim UINT32 Register, 941210944Sjkim UINT64 *Value, 942193267Sjkim UINT32 Width) 943193267Sjkim{ 944193267Sjkim 945193267Sjkim return (AE_OK); 946193267Sjkim} 947193267Sjkim 948193267Sjkim 949193267Sjkim/****************************************************************************** 950193267Sjkim * 951193267Sjkim * FUNCTION: AcpiOsWritePciConfiguration 952193267Sjkim * 953193267Sjkim * PARAMETERS: PciId Seg/Bus/Dev 954193267Sjkim * Register Device Register 955193267Sjkim * Value Value to be written 956193267Sjkim * Width Number of bits 957193267Sjkim * 958193267Sjkim * RETURN: Status. 959193267Sjkim * 960193267Sjkim * DESCRIPTION: Write data to PCI configuration space 961193267Sjkim * 962193267Sjkim *****************************************************************************/ 963193267Sjkim 964193267SjkimACPI_STATUS 965193267SjkimAcpiOsWritePciConfiguration ( 966193267Sjkim ACPI_PCI_ID *PciId, 967193267Sjkim UINT32 Register, 968202766Sjkim UINT64 Value, 969193267Sjkim UINT32 Width) 970193267Sjkim{ 971193267Sjkim 972193267Sjkim return (AE_OK); 973193267Sjkim} 974193267Sjkim 975193267Sjkim 976193267Sjkim/****************************************************************************** 977193267Sjkim * 978193267Sjkim * FUNCTION: AcpiOsReadPort 979193267Sjkim * 980193267Sjkim * PARAMETERS: Address Address of I/O port/register to read 981193267Sjkim * Value Where value is placed 982193267Sjkim * Width Number of bits 983193267Sjkim * 984193267Sjkim * RETURN: Value read from port 985193267Sjkim * 986193267Sjkim * DESCRIPTION: Read data from an I/O port or register 987193267Sjkim * 988193267Sjkim *****************************************************************************/ 989193267Sjkim 990193267SjkimACPI_STATUS 991193267SjkimAcpiOsReadPort ( 992193267Sjkim ACPI_IO_ADDRESS Address, 993193267Sjkim UINT32 *Value, 994193267Sjkim UINT32 Width) 995193267Sjkim{ 996193267Sjkim 997193267Sjkim switch (Width) 998193267Sjkim { 999193267Sjkim case 8: 1000193267Sjkim *Value = 0xFF; 1001193267Sjkim break; 1002193267Sjkim 1003193267Sjkim case 16: 1004193267Sjkim *Value = 0xFFFF; 1005193267Sjkim break; 1006193267Sjkim 1007193267Sjkim case 32: 1008193267Sjkim *Value = 0xFFFFFFFF; 1009193267Sjkim break; 1010193267Sjkim 1011193267Sjkim default: 1012193267Sjkim return (AE_BAD_PARAMETER); 1013193267Sjkim } 1014193267Sjkim 1015193267Sjkim return (AE_OK); 1016193267Sjkim} 1017193267Sjkim 1018193267Sjkim 1019193267Sjkim/****************************************************************************** 1020193267Sjkim * 1021193267Sjkim * FUNCTION: AcpiOsWritePort 1022193267Sjkim * 1023193267Sjkim * PARAMETERS: Address Address of I/O port/register to write 1024193267Sjkim * Value Value to write 1025193267Sjkim * Width Number of bits 1026193267Sjkim * 1027193267Sjkim * RETURN: None 1028193267Sjkim * 1029193267Sjkim * DESCRIPTION: Write data to an I/O port or register 1030193267Sjkim * 1031193267Sjkim *****************************************************************************/ 1032193267Sjkim 1033193267SjkimACPI_STATUS 1034193267SjkimAcpiOsWritePort ( 1035193267Sjkim ACPI_IO_ADDRESS Address, 1036193267Sjkim UINT32 Value, 1037193267Sjkim UINT32 Width) 1038193267Sjkim{ 1039193267Sjkim 1040193267Sjkim return (AE_OK); 1041193267Sjkim} 1042193267Sjkim 1043193267Sjkim 1044193267Sjkim/****************************************************************************** 1045193267Sjkim * 1046193267Sjkim * FUNCTION: AcpiOsReadMemory 1047193267Sjkim * 1048193267Sjkim * PARAMETERS: Address Physical Memory Address to read 1049193267Sjkim * Value Where value is placed 1050193267Sjkim * Width Number of bits 1051193267Sjkim * 1052193267Sjkim * RETURN: Value read from physical memory address 1053193267Sjkim * 1054193267Sjkim * DESCRIPTION: Read data from a physical memory address 1055193267Sjkim * 1056193267Sjkim *****************************************************************************/ 1057193267Sjkim 1058193267SjkimACPI_STATUS 1059193267SjkimAcpiOsReadMemory ( 1060193267Sjkim ACPI_PHYSICAL_ADDRESS Address, 1061193267Sjkim UINT32 *Value, 1062193267Sjkim UINT32 Width) 1063193267Sjkim{ 1064193267Sjkim 1065193267Sjkim switch (Width) 1066193267Sjkim { 1067193267Sjkim case 8: 1068193267Sjkim case 16: 1069193267Sjkim case 32: 1070193267Sjkim *Value = 0; 1071193267Sjkim break; 1072193267Sjkim 1073193267Sjkim default: 1074193267Sjkim return (AE_BAD_PARAMETER); 1075193267Sjkim } 1076193267Sjkim return (AE_OK); 1077193267Sjkim} 1078193267Sjkim 1079193267Sjkim 1080193267Sjkim/****************************************************************************** 1081193267Sjkim * 1082193267Sjkim * FUNCTION: AcpiOsWriteMemory 1083193267Sjkim * 1084193267Sjkim * PARAMETERS: Address Physical Memory Address to write 1085193267Sjkim * Value Value to write 1086193267Sjkim * Width Number of bits 1087193267Sjkim * 1088193267Sjkim * RETURN: None 1089193267Sjkim * 1090193267Sjkim * DESCRIPTION: Write data to a physical memory address 1091193267Sjkim * 1092193267Sjkim *****************************************************************************/ 1093193267Sjkim 1094193267SjkimACPI_STATUS 1095193267SjkimAcpiOsWriteMemory ( 1096193267Sjkim ACPI_PHYSICAL_ADDRESS Address, 1097193267Sjkim UINT32 Value, 1098193267Sjkim UINT32 Width) 1099193267Sjkim{ 1100193267Sjkim 1101193267Sjkim return (AE_OK); 1102193267Sjkim} 1103193267Sjkim 1104193267Sjkim 1105193267Sjkim/****************************************************************************** 1106193267Sjkim * 1107193267Sjkim * FUNCTION: AcpiOsReadable 1108193267Sjkim * 1109193267Sjkim * PARAMETERS: Pointer - Area to be verified 1110193267Sjkim * Length - Size of area 1111193267Sjkim * 1112193267Sjkim * RETURN: TRUE if readable for entire length 1113193267Sjkim * 1114193267Sjkim * DESCRIPTION: Verify that a pointer is valid for reading 1115193267Sjkim * 1116193267Sjkim *****************************************************************************/ 1117193267Sjkim 1118193267SjkimBOOLEAN 1119193267SjkimAcpiOsReadable ( 1120193267Sjkim void *Pointer, 1121193267Sjkim ACPI_SIZE Length) 1122193267Sjkim{ 1123193267Sjkim 1124193267Sjkim return (TRUE); 1125193267Sjkim} 1126193267Sjkim 1127193267Sjkim 1128193267Sjkim/****************************************************************************** 1129193267Sjkim * 1130193267Sjkim * FUNCTION: AcpiOsWritable 1131193267Sjkim * 1132193267Sjkim * PARAMETERS: Pointer - Area to be verified 1133193267Sjkim * Length - Size of area 1134193267Sjkim * 1135193267Sjkim * RETURN: TRUE if writable for entire length 1136193267Sjkim * 1137193267Sjkim * DESCRIPTION: Verify that a pointer is valid for writing 1138193267Sjkim * 1139193267Sjkim *****************************************************************************/ 1140193267Sjkim 1141193267SjkimBOOLEAN 1142193267SjkimAcpiOsWritable ( 1143193267Sjkim void *Pointer, 1144193267Sjkim ACPI_SIZE Length) 1145193267Sjkim{ 1146193267Sjkim 1147193267Sjkim return (TRUE); 1148193267Sjkim} 1149193267Sjkim 1150193267Sjkim 1151193267Sjkim/****************************************************************************** 1152193267Sjkim * 1153193267Sjkim * FUNCTION: AcpiOsGetThreadId 1154193267Sjkim * 1155193267Sjkim * PARAMETERS: None 1156193267Sjkim * 1157193267Sjkim * RETURN: Id of the running thread 1158193267Sjkim * 1159193267Sjkim * DESCRIPTION: Get the Id of the current (running) thread 1160193267Sjkim * 1161193267Sjkim *****************************************************************************/ 1162193267Sjkim 1163193267SjkimACPI_THREAD_ID 1164212700SjkimAcpiOsGetThreadId ( 1165212700Sjkim void) 1166193267Sjkim{ 1167193267Sjkim 1168212700Sjkim return (ACPI_CAST_PTHREAD_T (pthread_self())); 1169193267Sjkim} 1170193267Sjkim 1171193267Sjkim 1172193267Sjkim/****************************************************************************** 1173193267Sjkim * 1174193267Sjkim * FUNCTION: AcpiOsSignal 1175193267Sjkim * 1176193267Sjkim * PARAMETERS: Function ACPI CA signal function code 1177193267Sjkim * Info Pointer to function-dependent structure 1178193267Sjkim * 1179193267Sjkim * RETURN: Status 1180193267Sjkim * 1181193267Sjkim * DESCRIPTION: Miscellaneous functions. Example implementation only. 1182193267Sjkim * 1183193267Sjkim *****************************************************************************/ 1184193267Sjkim 1185193267SjkimACPI_STATUS 1186193267SjkimAcpiOsSignal ( 1187193267Sjkim UINT32 Function, 1188193267Sjkim void *Info) 1189193267Sjkim{ 1190193267Sjkim 1191193267Sjkim switch (Function) 1192193267Sjkim { 1193193267Sjkim case ACPI_SIGNAL_FATAL: 1194193267Sjkim break; 1195193267Sjkim 1196193267Sjkim case ACPI_SIGNAL_BREAKPOINT: 1197193267Sjkim break; 1198193267Sjkim 1199193267Sjkim default: 1200193267Sjkim break; 1201193267Sjkim } 1202193267Sjkim 1203193267Sjkim return (AE_OK); 1204193267Sjkim} 1205193267Sjkim 1206193267Sjkim 1207