osunixxf.c revision 138296
1/****************************************************************************** 2 * 3 * Module Name: osunixxf - UNIX OSL interfaces 4 * 5 *****************************************************************************/ 6 7/****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 *****************************************************************************/ 115 116 117/* 118 * These interfaces are required in order to compile the ASL compiler under 119 * Linux. 120 */ 121 122#include <stdio.h> 123#include <stdlib.h> 124#include <stdarg.h> 125#include <unistd.h> 126#include <sys/time.h> 127 128#include "acpi.h" 129#include "amlcode.h" 130#include "acparser.h" 131#include "acdebug.h" 132 133#define _COMPONENT ACPI_OS_SERVICES 134 ACPI_MODULE_NAME ("osunixxf") 135 136 137extern FILE *AcpiGbl_DebugFile; 138FILE *AcpiGbl_OutputFile; 139 140 141/****************************************************************************** 142 * 143 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate 144 * 145 * PARAMETERS: None 146 * 147 * RETURN: Status 148 * 149 * DESCRIPTION: Init and terminate. Nothing to do. 150 * 151 *****************************************************************************/ 152 153ACPI_STATUS 154AcpiOsInitialize (void) 155{ 156 AcpiGbl_OutputFile = stdout; 157 158 return AE_OK; 159} 160 161 162ACPI_STATUS 163AcpiOsTerminate (void) 164{ 165 return AE_OK; 166} 167 168 169/****************************************************************************** 170 * 171 * FUNCTION: AcpiOsGetRootPointer 172 * 173 * PARAMETERS: Flags - Logical or physical addressing mode 174 * Address - Where the address is returned 175 * 176 * RETURN: Status 177 * 178 * DESCRIPTION: Gets the root pointer (RSDP) 179 * 180 *****************************************************************************/ 181 182ACPI_STATUS 183AcpiOsGetRootPointer ( 184 UINT32 Flags, 185 ACPI_POINTER *Address) 186{ 187 188#if 0 189 /* The supporting code for this is not yet available. 190 * Return to the old situation for now. 191 */ 192 return (AeLocalGetRootPointer(Flags, (ACPI_PHYSICAL_ADDRESS *)Address)); 193#else 194 return (AE_OK); 195#endif 196 197} 198 199 200/****************************************************************************** 201 * 202 * FUNCTION: AcpiOsPredefinedOverride 203 * 204 * PARAMETERS: InitVal - Initial value of the predefined object 205 * NewVal - The new value for the object 206 * 207 * RETURN: Status, pointer to value. Null pointer returned if not 208 * overriding. 209 * 210 * DESCRIPTION: Allow the OS to override predefined names 211 * 212 *****************************************************************************/ 213 214ACPI_STATUS 215AcpiOsPredefinedOverride ( 216 const ACPI_PREDEFINED_NAMES *InitVal, 217 ACPI_STRING *NewVal) 218{ 219 220 if (!InitVal || !NewVal) 221 { 222 return (AE_BAD_PARAMETER); 223 } 224 225 *NewVal = NULL; 226 return (AE_OK); 227} 228 229 230/****************************************************************************** 231 * 232 * FUNCTION: AcpiOsTableOverride 233 * 234 * PARAMETERS: ExistingTable - Header of current table (probably firmware) 235 * NewTable - Where an entire new table is returned. 236 * 237 * RETURN: Status, pointer to new table. Null pointer returned if no 238 * table is available to override 239 * 240 * DESCRIPTION: Return a different version of a table if one is available 241 * 242 *****************************************************************************/ 243 244ACPI_STATUS 245AcpiOsTableOverride ( 246 ACPI_TABLE_HEADER *ExistingTable, 247 ACPI_TABLE_HEADER **NewTable) 248{ 249 250 if (!ExistingTable || !NewTable) 251 { 252 return (AE_BAD_PARAMETER); 253 } 254 255 *NewTable = NULL; 256 257#ifdef _ACPI_EXEC_APP 258 259 /* This code exercises the table override mechanism in the core */ 260 261 if (!ACPI_STRNCMP (ExistingTable->Signature, DSDT_SIG, ACPI_NAME_SIZE)) 262 { 263 /* override DSDT with itself */ 264 265 *NewTable = AcpiGbl_DbTablePtr; 266 } 267 return (AE_OK); 268#else 269 return AE_NO_ACPI_TABLES; 270#endif 271} 272 273 274/****************************************************************************** 275 * 276 * FUNCTION: AcpiOsReadable 277 * 278 * PARAMETERS: Pointer - Area to be verified 279 * Length - Size of area 280 * 281 * RETURN: TRUE if readable for entire length 282 * 283 * DESCRIPTION: Verify that a pointer is valid for reading 284 * 285 *****************************************************************************/ 286 287BOOLEAN 288AcpiOsReadable ( 289 void *Pointer, 290 ACPI_SIZE Length) 291{ 292 293 return (TRUE); 294} 295 296 297/****************************************************************************** 298 * 299 * FUNCTION: AcpiOsWritable 300 * 301 * PARAMETERS: Pointer - Area to be verified 302 * Length - Size of area 303 * 304 * RETURN: TRUE if writable for entire length 305 * 306 * DESCRIPTION: Verify that a pointer is valid for writing 307 * 308 *****************************************************************************/ 309 310BOOLEAN 311AcpiOsWritable ( 312 void *Pointer, 313 ACPI_SIZE Length) 314{ 315 316 return (TRUE); 317} 318 319 320/****************************************************************************** 321 * 322 * FUNCTION: AcpiOsRedirectOutput 323 * 324 * PARAMETERS: Destination - An open file handle/pointer 325 * 326 * RETURN: None 327 * 328 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf 329 * 330 *****************************************************************************/ 331 332void 333AcpiOsRedirectOutput ( 334 void *Destination) 335{ 336 337 AcpiGbl_OutputFile = Destination; 338} 339 340 341/****************************************************************************** 342 * 343 * FUNCTION: AcpiOsPrintf 344 * 345 * PARAMETERS: fmt, ... Standard printf format 346 * 347 * RETURN: None 348 * 349 * DESCRIPTION: Formatted output 350 * 351 *****************************************************************************/ 352 353void ACPI_INTERNAL_VAR_XFACE 354AcpiOsPrintf ( 355 const char *Fmt, 356 ...) 357{ 358 va_list Args; 359 360 361 va_start (Args, Fmt); 362 363 AcpiOsVprintf (Fmt, Args); 364 365 va_end (Args); 366 return; 367} 368 369 370/****************************************************************************** 371 * 372 * FUNCTION: AcpiOsVprintf 373 * 374 * PARAMETERS: fmt Standard printf format 375 * args Argument list 376 * 377 * RETURN: None 378 * 379 * DESCRIPTION: Formatted output with argument list pointer 380 * 381 *****************************************************************************/ 382 383void 384AcpiOsVprintf ( 385 const char *Fmt, 386 va_list Args) 387{ 388 INT32 Count = 0; 389 UINT8 Flags; 390 391 392 Flags = AcpiGbl_DbOutputFlags; 393 if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) 394 { 395 /* Output is directable to either a file (if open) or the console */ 396 397 if (AcpiGbl_DebugFile) 398 { 399 /* Output file is open, send the output there */ 400 401 Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args); 402 } 403 else 404 { 405 /* No redirection, send output to console (once only!) */ 406 407 Flags |= ACPI_DB_CONSOLE_OUTPUT; 408 } 409 } 410 411 if (Flags & ACPI_DB_CONSOLE_OUTPUT) 412 { 413 Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args); 414 } 415 416 return; 417} 418 419 420/****************************************************************************** 421 * 422 * FUNCTION: AcpiOsGetLine 423 * 424 * PARAMETERS: fmt Standard printf format 425 * args Argument list 426 * 427 * RETURN: Actual bytes read 428 * 429 * DESCRIPTION: Formatted input with argument list pointer 430 * 431 *****************************************************************************/ 432 433UINT32 434AcpiOsGetLine ( 435 char *Buffer) 436{ 437 UINT8 Temp; 438 UINT32 i; 439 440 441 for (i = 0; ; i++) 442 { 443 scanf ("%1c", &Temp); 444 if (!Temp || Temp == '\n') 445 { 446 break; 447 } 448 449 Buffer [i] = Temp; 450 } 451 452 /* Null terminate the buffer */ 453 454 Buffer [i] = 0; 455 456 /* Return the number of bytes in the string */ 457 458 return (i); 459} 460 461/****************************************************************************** 462 * 463 * FUNCTION: AcpiOsMapMemory 464 * 465 * PARAMETERS: where Physical address of memory to be mapped 466 * length How much memory to map 467 * there Logical address of mapped memory 468 * 469 * RETURN: Pointer to mapped memory. Null on error. 470 * 471 * DESCRIPTION: Map physical memory into caller's address space 472 * 473 *****************************************************************************/ 474 475ACPI_STATUS 476AcpiOsMapMemory ( 477 ACPI_PHYSICAL_ADDRESS where, 478 ACPI_SIZE length, 479 void **there) 480{ 481 *there = ACPI_TO_POINTER (where); 482 483 return AE_OK; 484} 485 486 487/****************************************************************************** 488 * 489 * FUNCTION: AcpiOsUnmapMemory 490 * 491 * PARAMETERS: where Logical address of memory to be unmapped 492 * length How much memory to unmap 493 * 494 * RETURN: None. 495 * 496 * DESCRIPTION: Delete a previously created mapping. Where and Length must 497 * correspond to a previous mapping exactly. 498 * 499 *****************************************************************************/ 500 501void 502AcpiOsUnmapMemory ( 503 void *where, 504 ACPI_SIZE length) 505{ 506 507 return; 508} 509 510 511/****************************************************************************** 512 * 513 * FUNCTION: AcpiOsAllocate 514 * 515 * PARAMETERS: Size Amount to allocate, in bytes 516 * 517 * RETURN: Pointer to the new allocation. Null on error. 518 * 519 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. 520 * 521 *****************************************************************************/ 522 523void * 524AcpiOsAllocate ( 525 ACPI_SIZE size) 526{ 527 void *Mem; 528 529 530 Mem = (void *) malloc ((size_t) size); 531 532 return Mem; 533} 534 535 536/****************************************************************************** 537 * 538 * FUNCTION: AcpiOsFree 539 * 540 * PARAMETERS: mem Pointer to previously allocated memory 541 * 542 * RETURN: None. 543 * 544 * DESCRIPTION: Free memory allocated via AcpiOsAllocate 545 * 546 *****************************************************************************/ 547 548void 549AcpiOsFree ( 550 void *mem) 551{ 552 553 554 free (mem); 555} 556 557 558/****************************************************************************** 559 * 560 * FUNCTION: AcpiOsCreateSemaphore 561 * 562 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore 563 * OutHandle - Where a handle will be returned 564 * 565 * RETURN: Status 566 * 567 * DESCRIPTION: Create an OS semaphore 568 * 569 *****************************************************************************/ 570 571ACPI_STATUS 572AcpiOsCreateSemaphore ( 573 UINT32 MaxUnits, 574 UINT32 InitialUnits, 575 ACPI_HANDLE *OutHandle) 576{ 577 578 579 *OutHandle = (ACPI_HANDLE) 1; 580 return AE_OK; 581} 582 583/****************************************************************************** 584 * 585 * FUNCTION: AcpiOsDeleteSemaphore 586 * 587 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 588 * 589 * RETURN: Status 590 * 591 * DESCRIPTION: Delete an OS semaphore 592 * 593 *****************************************************************************/ 594 595ACPI_STATUS 596AcpiOsDeleteSemaphore ( 597 ACPI_HANDLE Handle) 598{ 599 600 if (!Handle) 601 { 602 return AE_BAD_PARAMETER; 603 } 604 605 return AE_OK; 606} 607 608 609/****************************************************************************** 610 * 611 * FUNCTION: AcpiOsWaitSemaphore 612 * 613 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 614 * Units - How many units to wait for 615 * Timeout - How long to wait 616 * 617 * RETURN: Status 618 * 619 * DESCRIPTION: Wait for units 620 * 621 *****************************************************************************/ 622 623ACPI_STATUS 624AcpiOsWaitSemaphore ( 625 ACPI_HANDLE Handle, 626 UINT32 Units, 627 UINT16 Timeout) 628{ 629 630 631 return AE_OK; 632} 633 634 635/****************************************************************************** 636 * 637 * FUNCTION: AcpiOsSignalSemaphore 638 * 639 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 640 * Units - Number of units to send 641 * 642 * RETURN: Status 643 * 644 * DESCRIPTION: Send units 645 * 646 *****************************************************************************/ 647 648ACPI_STATUS 649AcpiOsSignalSemaphore ( 650 ACPI_HANDLE Handle, 651 UINT32 Units) 652{ 653 654 655 return AE_OK; 656} 657 658 659ACPI_STATUS 660AcpiOsCreateLock ( 661 ACPI_HANDLE *OutHandle) 662{ 663 664 return (AcpiOsCreateSemaphore (1, 1, OutHandle)); 665} 666 667void 668AcpiOsDeleteLock ( 669 ACPI_HANDLE Handle) 670{ 671 AcpiOsDeleteSemaphore (Handle); 672} 673 674 675void 676AcpiOsAcquireLock ( 677 ACPI_HANDLE Handle, 678 UINT32 Flags) 679{ 680 AcpiOsWaitSemaphore (Handle, 1, 0xFFFF); 681} 682 683 684void 685AcpiOsReleaseLock ( 686 ACPI_HANDLE Handle, 687 UINT32 Flags) 688{ 689 AcpiOsSignalSemaphore (Handle, 1); 690} 691 692 693/****************************************************************************** 694 * 695 * FUNCTION: AcpiOsInstallInterruptHandler 696 * 697 * PARAMETERS: InterruptNumber Level handler should respond to. 698 * Isr Address of the ACPI interrupt handler 699 * ExceptPtr Where status is returned 700 * 701 * RETURN: Handle to the newly installed handler. 702 * 703 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI 704 * OS-independent handler. 705 * 706 *****************************************************************************/ 707 708UINT32 709AcpiOsInstallInterruptHandler ( 710 UINT32 InterruptNumber, 711 ACPI_OSD_HANDLER ServiceRoutine, 712 void *Context) 713{ 714 715 716 return AE_OK; 717} 718 719 720/****************************************************************************** 721 * 722 * FUNCTION: AcpiOsRemoveInterruptHandler 723 * 724 * PARAMETERS: Handle Returned when handler was installed 725 * 726 * RETURN: Status 727 * 728 * DESCRIPTION: Uninstalls an interrupt handler. 729 * 730 *****************************************************************************/ 731 732ACPI_STATUS 733AcpiOsRemoveInterruptHandler ( 734 UINT32 InterruptNumber, 735 ACPI_OSD_HANDLER ServiceRoutine) 736{ 737 738 return AE_OK; 739} 740 741 742/****************************************************************************** 743 * 744 * FUNCTION: AcpiOsQueueForExecution 745 * 746 * PARAMETERS: Priority - Requested execution priority 747 * Function - Address of the function to execute 748 * Context - Passed as a parameter to the function 749 * 750 * RETURN: Status. 751 * 752 * DESCRIPTION: Sleep at microsecond granularity 753 * 754 *****************************************************************************/ 755 756ACPI_STATUS 757AcpiOsQueueForExecution ( 758 UINT32 Priority, 759 ACPI_OSD_EXEC_CALLBACK Function, 760 void *Context) 761{ 762 763// _beginthread (Function, (unsigned) 0, Context); 764 return 0; 765} 766 767 768/****************************************************************************** 769 * 770 * FUNCTION: AcpiOsBreakpoint 771 * 772 * PARAMETERS: Msg Message to print 773 * 774 * RETURN: Status 775 * 776 * DESCRIPTION: Print a message and break to the debugger. 777 * 778 *****************************************************************************/ 779 780ACPI_STATUS 781AcpiOsBreakpoint ( 782 char *Msg) 783{ 784 785 /* Print the message and do an INT 3 */ 786 787 if (Msg) 788 { 789 AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg); 790 } 791 else 792 { 793 AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); 794 } 795 796 797 return AE_OK; 798} 799 800 801/****************************************************************************** 802 * 803 * FUNCTION: AcpiOsStall 804 * 805 * PARAMETERS: microseconds To sleep 806 * 807 * RETURN: Blocks until sleep is completed. 808 * 809 * DESCRIPTION: Sleep at microsecond granularity 810 * 811 *****************************************************************************/ 812 813void 814AcpiOsStall ( 815 UINT32 microseconds) 816{ 817 818 if (microseconds) 819 { 820 usleep (microseconds); 821 } 822 return; 823} 824 825 826/****************************************************************************** 827 * 828 * FUNCTION: AcpiOsSleep 829 * 830 * PARAMETERS: milliseconds To sleep 831 * 832 * RETURN: Blocks until sleep is completed. 833 * 834 * DESCRIPTION: Sleep at millisecond granularity 835 * 836 *****************************************************************************/ 837 838void 839AcpiOsSleep ( 840 ACPI_INTEGER milliseconds) 841{ 842 843 sleep (milliseconds / 1000); /* Sleep for whole seconds */ 844 845 /* 846 * Arg to usleep() must be less than 1,000,000 (1 second) 847 */ 848 usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ 849 850 return; 851} 852 853/****************************************************************************** 854 * 855 * FUNCTION: AcpiOsGetTimer 856 * 857 * PARAMETERS: None 858 * 859 * RETURN: Current time in 100 nanosecond units 860 * 861 * DESCRIPTION: Get the current system time 862 * 863 *****************************************************************************/ 864 865UINT64 866AcpiOsGetTimer (void) 867{ 868 struct timeval time; 869 870 gettimeofday(&time, NULL); 871 872 /* Seconds * 10^7 = 100ns(10^-7), Microseconds(10^-6) * 10^1 = 100ns */ 873 874 return (((UINT64) time.tv_sec * 10000000) + ((UINT64) time.tv_usec * 10)); 875} 876 877 878/****************************************************************************** 879 * 880 * FUNCTION: AcpiOsReadPciConfiguration 881 * 882 * PARAMETERS: PciId Seg/Bus/Dev 883 * Register Device Register 884 * Value Buffer where value is placed 885 * Width Number of bits 886 * 887 * RETURN: Status 888 * 889 * DESCRIPTION: Read data from PCI configuration space 890 * 891 *****************************************************************************/ 892 893ACPI_STATUS 894AcpiOsReadPciConfiguration ( 895 ACPI_PCI_ID *PciId, 896 UINT32 Register, 897 void *Value, 898 UINT32 Width) 899{ 900 901 return (AE_OK); 902} 903 904 905/****************************************************************************** 906 * 907 * FUNCTION: AcpiOsWritePciConfiguration 908 * 909 * PARAMETERS: PciId Seg/Bus/Dev 910 * Register Device Register 911 * Value Value to be written 912 * Width Number of bits 913 * 914 * RETURN: Status. 915 * 916 * DESCRIPTION: Write data to PCI configuration space 917 * 918 *****************************************************************************/ 919 920ACPI_STATUS 921AcpiOsWritePciConfiguration ( 922 ACPI_PCI_ID *PciId, 923 UINT32 Register, 924 ACPI_INTEGER Value, 925 UINT32 Width) 926{ 927 928 return (AE_OK); 929} 930 931/* TEMPORARY STUB FUNCTION */ 932void 933AcpiOsDerivePciId( 934 ACPI_HANDLE rhandle, 935 ACPI_HANDLE chandle, 936 ACPI_PCI_ID **PciId) 937{ 938 939} 940 941 942/****************************************************************************** 943 * 944 * FUNCTION: AcpiOsReadPort 945 * 946 * PARAMETERS: Address Address of I/O port/register to read 947 * Value Where value is placed 948 * Width Number of bits 949 * 950 * RETURN: Value read from port 951 * 952 * DESCRIPTION: Read data from an I/O port or register 953 * 954 *****************************************************************************/ 955 956ACPI_STATUS 957AcpiOsReadPort ( 958 ACPI_IO_ADDRESS Address, 959 UINT32 *Value, 960 UINT32 Width) 961{ 962 963 switch (Width) 964 { 965 case 8: 966 *Value = 0xFF; 967 break; 968 969 case 16: 970 *Value = 0xFFFF; 971 break; 972 973 case 32: 974 *Value = 0xFFFFFFFF; 975 break; 976 } 977 978 return (AE_OK); 979} 980 981 982/****************************************************************************** 983 * 984 * FUNCTION: AcpiOsWritePort 985 * 986 * PARAMETERS: Address Address of I/O port/register to write 987 * Value Value to write 988 * Width Number of bits 989 * 990 * RETURN: None 991 * 992 * DESCRIPTION: Write data to an I/O port or register 993 * 994 *****************************************************************************/ 995 996ACPI_STATUS 997AcpiOsWritePort ( 998 ACPI_IO_ADDRESS Address, 999 UINT32 Value, 1000 UINT32 Width) 1001{ 1002 1003 return (AE_OK); 1004} 1005 1006 1007/****************************************************************************** 1008 * 1009 * FUNCTION: AcpiOsReadMemory 1010 * 1011 * PARAMETERS: Address Physical Memory Address to read 1012 * Value Where value is placed 1013 * Width Number of bits 1014 * 1015 * RETURN: Value read from physical memory address 1016 * 1017 * DESCRIPTION: Read data from a physical memory address 1018 * 1019 *****************************************************************************/ 1020 1021ACPI_STATUS 1022AcpiOsReadMemory ( 1023 ACPI_PHYSICAL_ADDRESS Address, 1024 UINT32 *Value, 1025 UINT32 Width) 1026{ 1027 1028 switch (Width) 1029 { 1030 case 8: 1031 case 16: 1032 case 32: 1033 *Value = 0; 1034 break; 1035 1036 default: 1037 return (AE_BAD_PARAMETER); 1038 break; 1039 } 1040 return (AE_OK); 1041} 1042 1043 1044/****************************************************************************** 1045 * 1046 * FUNCTION: AcpiOsWriteMemory 1047 * 1048 * PARAMETERS: Address Physical Memory Address to write 1049 * Value Value to write 1050 * Width Number of bits 1051 * 1052 * RETURN: None 1053 * 1054 * DESCRIPTION: Write data to a physical memory address 1055 * 1056 *****************************************************************************/ 1057 1058ACPI_STATUS 1059AcpiOsWriteMemory ( 1060 ACPI_PHYSICAL_ADDRESS Address, 1061 UINT32 Value, 1062 UINT32 Width) 1063{ 1064 1065 return (AE_OK); 1066} 1067 1068 1069UINT32 1070AcpiOsGetThreadId(void) 1071{ 1072 return getpid(); 1073} 1074 1075 1076/****************************************************************************** 1077 * 1078 * FUNCTION: AcpiOsSignal 1079 * 1080 * PARAMETERS: Function ACPI CA signal function code 1081 * Info Pointer to function-dependent structure 1082 * 1083 * RETURN: Status 1084 * 1085 * DESCRIPTION: Miscellaneous functions 1086 * 1087 *****************************************************************************/ 1088 1089ACPI_STATUS 1090AcpiOsSignal ( 1091 UINT32 Function, 1092 void *Info) 1093{ 1094 1095 switch (Function) 1096 { 1097 case ACPI_SIGNAL_FATAL: 1098 break; 1099 1100 case ACPI_SIGNAL_BREAKPOINT: 1101 1102 if (Info) 1103 { 1104 AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info); 1105 } 1106 else 1107 { 1108 AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); 1109 } 1110 1111 break; 1112 } 1113 1114 1115 return (AE_OK); 1116} 1117 1118 1119