1 /****************************************************************************** 2 * 3 * Module Name: osminixxf - MINIX3 OSL interfaces 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2014, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #include <stdio.h> 45 #include <stdlib.h> 46 #include <unistd.h> 47 #include <sys/time.h> 48 49 #include "acpi.h" 50 #include "accommon.h" 51 #include "amlcode.h" 52 #include "acparser.h" 53 #include "acdebug.h" 54 55 #include <minix/driver.h> 56 #include <machine/pci_intel.h> 57 58 extern struct machine machine; 59 60 61 static u32_t pci_inb(u16_t port) { 62 u32_t value; 63 int s; 64 if ((s=sys_inb(port, &value)) !=OK) 65 printf("ACPI: warning, sys_inb failed: %d\n", s); 66 return value; 67 } 68 69 static u32_t pci_inw(u16_t port) { 70 u32_t value; 71 int s; 72 if ((s=sys_inw(port, &value)) !=OK) 73 printf("ACPI: warning, sys_inw failed: %d\n", s); 74 return value; 75 } 76 77 static u32_t pci_inl(u16_t port) { 78 u32_t value; 79 int s; 80 if ((s=sys_inl(port, &value)) !=OK) 81 printf("ACPI: warning, sys_inl failed: %d\n", s); 82 return value; 83 } 84 85 static void pci_outb(u16_t port, u8_t value) { 86 int s; 87 if ((s=sys_outb(port, value)) !=OK) 88 printf("ACPI: warning, sys_outb failed: %d\n", s); 89 } 90 91 static void pci_outw(u16_t port, u16_t value) { 92 int s; 93 if ((s=sys_outw(port, value)) !=OK) 94 printf("ACPI: warning, sys_outw failed: %d\n", s); 95 } 96 97 static void pci_outl(u16_t port, u32_t value) { 98 int s; 99 if ((s=sys_outl(port, value)) !=OK) 100 printf("ACPI: warning, sys_outl failed: %d\n", s); 101 } 102 103 /****************************************************************************** 104 * 105 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate 106 * 107 * PARAMETERS: None 108 * 109 * RETURN: Status 110 * 111 * DESCRIPTION: Init and terminate. Nothing to do. 112 * 113 *****************************************************************************/ 114 115 ACPI_STATUS 116 AcpiOsInitialize (void) 117 { 118 return AE_OK; 119 } 120 121 122 ACPI_STATUS 123 AcpiOsTerminate (void) 124 { 125 return AE_OK; 126 } 127 128 129 /****************************************************************************** 130 * 131 * FUNCTION: AcpiOsPredefinedOverride 132 * 133 * PARAMETERS: InitVal - Initial value of the predefined object 134 * NewVal - The new value for the object 135 * 136 * RETURN: Status, pointer to value. Null pointer returned if not 137 * overriding. 138 * 139 * DESCRIPTION: Allow the OS to override predefined names 140 * 141 *****************************************************************************/ 142 143 ACPI_STATUS 144 AcpiOsPredefinedOverride ( 145 const ACPI_PREDEFINED_NAMES *InitVal, 146 ACPI_STRING *NewVal) 147 { 148 *NewVal = NULL; 149 return (AE_OK); 150 } 151 152 153 /****************************************************************************** 154 * 155 * FUNCTION: AcpiOsTableOverride 156 * 157 * PARAMETERS: ExistingTable - Header of current table (probably firmware) 158 * NewTable - Where an entire new table is returned. 159 * 160 * RETURN: Status, pointer to new table. Null pointer returned if no 161 * table is available to override 162 * 163 * DESCRIPTION: Return a different version of a table if one is available 164 * 165 *****************************************************************************/ 166 167 ACPI_STATUS 168 AcpiOsTableOverride ( 169 ACPI_TABLE_HEADER *ExistingTable, 170 ACPI_TABLE_HEADER **NewTable) 171 { 172 *NewTable = NULL; 173 return (AE_OK); 174 } 175 176 177 /****************************************************************************** 178 * 179 * FUNCTION: AcpiOsReadable 180 * 181 * PARAMETERS: Pointer - Area to be verified 182 * Length - Size of area 183 * 184 * RETURN: TRUE if readable for entire length 185 * 186 * DESCRIPTION: Verify that a pointer is valid for reading 187 * 188 *****************************************************************************/ 189 190 BOOLEAN 191 AcpiOsReadable ( 192 void *Pointer, 193 ACPI_SIZE Length) 194 { 195 panic("NOTIMPLEMENTED %s\n", __func__); 196 197 return (TRUE); 198 } 199 200 201 /****************************************************************************** 202 * 203 * FUNCTION: AcpiOsWritable 204 * 205 * PARAMETERS: Pointer - Area to be verified 206 * Length - Size of area 207 * 208 * RETURN: TRUE if writable for entire length 209 * 210 * DESCRIPTION: Verify that a pointer is valid for writing 211 * 212 *****************************************************************************/ 213 214 BOOLEAN 215 AcpiOsWritable ( 216 void *Pointer, 217 ACPI_SIZE Length) 218 { 219 panic("NOTIMPLEMENTED %s\n", __func__); 220 221 return (TRUE); 222 } 223 224 225 /****************************************************************************** 226 * 227 * FUNCTION: AcpiOsPhysicalTableOverride 228 * 229 * PARAMETERS: ExistingTable - Header of current table (probably firmware) 230 * NewAddress - Where new table address is returned 231 * (Physical address) 232 * NewTableLength - Where new table length is returned 233 * 234 * RETURN: Status, address/length of new table. Null pointer returned 235 * if no table is available to override. 236 * 237 *****************************************************************************/ 238 239 ACPI_STATUS 240 AcpiOsPhysicalTableOverride ( 241 ACPI_TABLE_HEADER *ExistingTable, 242 ACPI_PHYSICAL_ADDRESS *NewAddress, 243 UINT32 *NewTableLength) 244 { 245 *NewAddress = 0; 246 return (AE_OK); 247 } 248 249 250 /****************************************************************************** 251 * 252 * FUNCTION: AcpiOsRedirectOutput 253 * 254 * PARAMETERS: Destination - An open file handle/pointer 255 * 256 * RETURN: None 257 * 258 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf 259 * 260 *****************************************************************************/ 261 262 void 263 AcpiOsRedirectOutput ( 264 void *Destination) 265 { 266 panic("NOTIMPLEMENTED %s\n", __func__); 267 } 268 269 270 /****************************************************************************** 271 * 272 * FUNCTION: AcpiOsPrintf 273 * 274 * PARAMETERS: fmt, ... Standard printf format 275 * 276 * RETURN: None 277 * 278 * DESCRIPTION: Formatted output 279 * 280 *****************************************************************************/ 281 282 void ACPI_INTERNAL_VAR_XFACE 283 AcpiOsPrintf ( 284 const char *Fmt, 285 ...) 286 { 287 va_list Args; 288 289 290 va_start (Args, Fmt); 291 292 #ifdef ACPI_BF_DEBUG 293 AcpiOsVprintf (Fmt, Args); 294 #endif 295 296 va_end (Args); 297 return; 298 } 299 300 301 /****************************************************************************** 302 * 303 * FUNCTION: AcpiOsVprintf 304 * 305 * PARAMETERS: fmt Standard printf format 306 * args Argument list 307 * 308 * RETURN: None 309 * 310 * DESCRIPTION: Formatted output with argument list pointer 311 * 312 *****************************************************************************/ 313 314 void 315 AcpiOsVprintf ( 316 const char *Fmt, 317 va_list Args) 318 { 319 320 printf("ACPI: "); 321 vprintf (Fmt, Args); 322 printf("\n"); 323 } 324 325 326 /****************************************************************************** 327 * 328 * FUNCTION: AcpiOsGetLine 329 * 330 * PARAMETERS: Buffer - Where to return the command line 331 * BufferLength - Maximum length of Buffer 332 * BytesRead - Where the actual byte count is returned 333 * 334 * RETURN: Status and actual bytes read 335 * 336 * DESCRIPTION: Get the next input line from the terminal. NOTE: For the 337 * AcpiExec utility, we use the acgetline module instead to 338 * provide line-editing and history support. 339 * 340 *****************************************************************************/ 341 342 ACPI_STATUS 343 AcpiOsGetLine ( 344 char *Buffer, 345 UINT32 BufferLength, 346 UINT32 *BytesRead) 347 { 348 panic("NOTIMPLEMENTED %s\n", __func__); 349 return 0; 350 } 351 352 /****************************************************************************** 353 * 354 * FUNCTION: AcpiOsMapMemory 355 * 356 * PARAMETERS: where Physical address of memory to be mapped 357 * length How much memory to map 358 * 359 * RETURN: Pointer to mapped memory. Null on error. 360 * 361 * DESCRIPTION: Map physical memory into caller's address space 362 * 363 *****************************************************************************/ 364 365 void * 366 AcpiOsMapMemory ( 367 ACPI_PHYSICAL_ADDRESS where, /* not page aligned */ 368 ACPI_SIZE length) /* in bytes, not page-aligned */ 369 { 370 return vm_map_phys(SELF, (void *) where, length); 371 } 372 373 374 /****************************************************************************** 375 * 376 * FUNCTION: AcpiOsUnmapMemory 377 * 378 * PARAMETERS: where Logical address of memory to be unmapped 379 * length How much memory to unmap 380 * 381 * RETURN: None. 382 * 383 * DESCRIPTION: Delete a previously created mapping. Where and Length must 384 * correspond to a previous mapping exactly. 385 * 386 *****************************************************************************/ 387 388 void 389 AcpiOsUnmapMemory ( 390 void *where, 391 ACPI_SIZE length) 392 { 393 vm_unmap_phys(SELF, where, length); 394 } 395 396 397 /****************************************************************************** 398 * 399 * FUNCTION: AcpiOsAllocate 400 * 401 * PARAMETERS: Size Amount to allocate, in bytes 402 * 403 * RETURN: Pointer to the new allocation. Null on error. 404 * 405 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. 406 * 407 *****************************************************************************/ 408 409 void * 410 AcpiOsAllocate ( 411 ACPI_SIZE size) 412 { 413 void *Mem; 414 415 416 Mem = (void *) malloc ((size_t) size); 417 if (Mem == NULL) 418 printf("AcpiOsAllocate out of memory\n"); 419 420 return Mem; 421 } 422 423 424 /****************************************************************************** 425 * 426 * FUNCTION: AcpiOsFree 427 * 428 * PARAMETERS: mem Pointer to previously allocated memory 429 * 430 * RETURN: None. 431 * 432 * DESCRIPTION: Free memory allocated via AcpiOsAllocate 433 * 434 *****************************************************************************/ 435 436 void 437 AcpiOsFree ( 438 void *mem) 439 { 440 free(mem); 441 } 442 443 444 /****************************************************************************** 445 * 446 * FUNCTION: AcpiOsCreateSemaphore 447 * 448 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore 449 * OutHandle - Where a handle will be returned 450 * 451 * RETURN: Status 452 * 453 * DESCRIPTION: Create an OS semaphore 454 * 455 *****************************************************************************/ 456 457 ACPI_STATUS 458 AcpiOsCreateSemaphore ( 459 UINT32 MaxUnits, 460 UINT32 InitialUnits, 461 ACPI_HANDLE *OutHandle) 462 { 463 *OutHandle = NULL; 464 return AE_OK; 465 } 466 467 /****************************************************************************** 468 * 469 * FUNCTION: AcpiOsDeleteSemaphore 470 * 471 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 472 * 473 * RETURN: Status 474 * 475 * DESCRIPTION: Delete an OS semaphore 476 * 477 *****************************************************************************/ 478 479 ACPI_STATUS 480 AcpiOsDeleteSemaphore ( 481 ACPI_HANDLE Handle) 482 { 483 return AE_OK; 484 } 485 486 487 /****************************************************************************** 488 * 489 * FUNCTION: AcpiOsWaitSemaphore 490 * 491 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 492 * Units - How many units to wait for 493 * Timeout - How long to wait 494 * 495 * RETURN: Status 496 * 497 * DESCRIPTION: Wait for units 498 * 499 *****************************************************************************/ 500 501 ACPI_STATUS 502 AcpiOsWaitSemaphore ( 503 ACPI_HANDLE Handle, 504 UINT32 Units, 505 UINT16 Timeout) 506 { 507 return AE_OK; 508 } 509 510 511 /****************************************************************************** 512 * 513 * FUNCTION: AcpiOsSignalSemaphore 514 * 515 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore 516 * Units - Number of units to send 517 * 518 * RETURN: Status 519 * 520 * DESCRIPTION: Send units 521 * 522 *****************************************************************************/ 523 524 ACPI_STATUS 525 AcpiOsSignalSemaphore ( 526 ACPI_HANDLE Handle, 527 UINT32 Units) 528 { 529 return AE_OK; 530 } 531 532 533 ACPI_STATUS 534 AcpiOsCreateLock ( 535 ACPI_SPINLOCK *OutHandle) 536 { 537 *OutHandle = NULL; 538 return AE_OK; 539 } 540 541 void 542 AcpiOsDeleteLock ( 543 ACPI_SPINLOCK Handle) 544 { 545 } 546 547 548 ACPI_CPU_FLAGS 549 AcpiOsAcquireLock ( 550 ACPI_HANDLE Handle) 551 { 552 return (0); 553 } 554 555 556 void 557 AcpiOsReleaseLock ( 558 ACPI_SPINLOCK Handle, 559 ACPI_CPU_FLAGS Flags) 560 { 561 } 562 563 564 /****************************************************************************** 565 * 566 * FUNCTION: AcpiOsInstallInterruptHandler 567 * 568 * PARAMETERS: InterruptNumber Level handler should respond to. 569 * Isr Address of the ACPI interrupt handler 570 * ExceptPtr Where status is returned 571 * 572 * RETURN: Handle to the newly installed handler. 573 * 574 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI 575 * OS-independent handler. 576 * 577 *****************************************************************************/ 578 579 UINT32 580 AcpiOsInstallInterruptHandler ( 581 UINT32 InterruptNumber, 582 ACPI_OSD_HANDLER ServiceRoutine, 583 void *Context) 584 { 585 printf("ACPI: no support for power interrupt yet\n"); 586 return AE_OK; 587 } 588 589 590 /****************************************************************************** 591 * 592 * FUNCTION: AcpiOsRemoveInterruptHandler 593 * 594 * PARAMETERS: Handle Returned when handler was installed 595 * 596 * RETURN: Status 597 * 598 * DESCRIPTION: Uninstalls an interrupt handler. 599 * 600 *****************************************************************************/ 601 602 ACPI_STATUS 603 AcpiOsRemoveInterruptHandler ( 604 UINT32 InterruptNumber, 605 ACPI_OSD_HANDLER ServiceRoutine) 606 { 607 printf("ACPI: no support for power interrupt yet\n"); 608 return AE_OK; 609 } 610 611 612 /****************************************************************************** 613 * 614 * FUNCTION: AcpiOsExecute 615 * 616 * PARAMETERS: Type - Type of execution 617 * Function - Address of the function to execute 618 * Context - Passed as a parameter to the function 619 * 620 * RETURN: Status. 621 * 622 * DESCRIPTION: Execute a new thread 623 * 624 *****************************************************************************/ 625 626 ACPI_STATUS 627 AcpiOsExecute ( 628 ACPI_EXECUTE_TYPE Type, 629 ACPI_OSD_EXEC_CALLBACK Function, 630 void *Context) 631 { 632 panic("NOTIMPLEMENTED %s\n", __func__); 633 return AE_OK; 634 } 635 636 637 /****************************************************************************** 638 * 639 * FUNCTION: AcpiOsBreakpoint 640 * 641 * PARAMETERS: Msg Message to print 642 * 643 * RETURN: Status 644 * 645 * DESCRIPTION: Print a message and break to the debugger. 646 * 647 *****************************************************************************/ 648 649 ACPI_STATUS 650 AcpiOsBreakpoint ( 651 char *Msg) 652 { 653 panic("NOTIMPLEMENTED %s\n", __func__); 654 return AE_OK; 655 } 656 657 658 /****************************************************************************** 659 * 660 * FUNCTION: AcpiOsStall 661 * 662 * PARAMETERS: microseconds To sleep 663 * 664 * RETURN: Blocks until sleep is completed. 665 * 666 * DESCRIPTION: Sleep at microsecond granularity 667 * 668 *****************************************************************************/ 669 670 void 671 AcpiOsStall ( 672 UINT32 microseconds) 673 { 674 if (microseconds > 0) 675 usleep (microseconds); 676 677 return; 678 } 679 680 681 /****************************************************************************** 682 * 683 * FUNCTION: AcpiOsSleep 684 * 685 * PARAMETERS: milliseconds To sleep 686 * 687 * RETURN: Blocks until sleep is completed. 688 * 689 * DESCRIPTION: Sleep at millisecond granularity 690 * 691 *****************************************************************************/ 692 693 void 694 AcpiOsSleep ( 695 ACPI_INTEGER milliseconds) 696 { 697 if ((milliseconds / 1000) > 0) 698 sleep (milliseconds / 1000); 699 700 if ((milliseconds % 1000) > 0) 701 usleep ((milliseconds % 1000) * 1000); 702 703 return; 704 } 705 706 /****************************************************************************** 707 * 708 * FUNCTION: AcpiOsGetTimer 709 * 710 * PARAMETERS: None 711 * 712 * RETURN: Current time in 100 nanosecond units 713 * 714 * DESCRIPTION: Get the current system time 715 * 716 *****************************************************************************/ 717 718 UINT64 719 AcpiOsGetTimer (void) 720 { 721 struct timeval time; 722 723 gettimeofday (&time, NULL); 724 return (((UINT64) time.tv_sec * 10000000) + 725 ((UINT64) time.tv_usec * 10)); 726 } 727 728 729 /****************************************************************************** 730 * 731 * FUNCTION: AcpiOsValidateInterface 732 * 733 * PARAMETERS: Interface - Requested interface to be validated 734 * 735 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise 736 * 737 * DESCRIPTION: Match an interface string to the interfaces supported by the 738 * host. Strings originate from an AML call to the _OSI method. 739 * 740 *****************************************************************************/ 741 742 ACPI_STATUS 743 AcpiOsValidateInterface ( 744 char *Interface) 745 { 746 return (AE_SUPPORT); 747 } 748 749 750 /* TEMPORARY STUB FUNCTION */ 751 void 752 AcpiOsDerivePciId( 753 ACPI_HANDLE rhandle, 754 ACPI_HANDLE chandle, 755 ACPI_PCI_ID **PciId) 756 { 757 /* we do nothing here, we keep the PciId unchanged */ 758 } 759 760 761 /****************************************************************************** 762 * 763 * FUNCTION: AcpiOsReadPort 764 * 765 * PARAMETERS: Address Address of I/O port/register to read 766 * Value Where value is placed 767 * Width Number of bits 768 * 769 * RETURN: Value read from port 770 * 771 * DESCRIPTION: Read data from an I/O port or register 772 * 773 *****************************************************************************/ 774 775 ACPI_STATUS 776 AcpiOsReadPort ( 777 ACPI_IO_ADDRESS Address, 778 UINT32 *Value, 779 UINT32 Width) 780 { 781 *Value = 0; 782 switch (Width) { 783 case 8: 784 sys_inb(Address, Value); 785 break; 786 case 16: 787 sys_inw(Address, Value); 788 break; 789 case 32: 790 sys_inl(Address, Value); 791 break; 792 default: 793 panic("unsupported width: %d", Width); 794 } 795 return AE_OK; 796 } 797 798 799 /****************************************************************************** 800 * 801 * FUNCTION: AcpiOsWritePort 802 * 803 * PARAMETERS: Address Address of I/O port/register to write 804 * Value Value to write 805 * Width Number of bits 806 * 807 * RETURN: None 808 * 809 * DESCRIPTION: Write data to an I/O port or register 810 * 811 *****************************************************************************/ 812 813 ACPI_STATUS 814 AcpiOsWritePort ( 815 ACPI_IO_ADDRESS Address, 816 UINT32 Value, 817 UINT32 Width) 818 { 819 switch (Width) { 820 case 8: 821 sys_outb(Address, Value); 822 break; 823 case 16: 824 sys_outw(Address, Value); 825 break; 826 case 32: 827 sys_outl(Address, Value); 828 break; 829 default: 830 panic("unsupported width: %d", Width); 831 } 832 return AE_OK; 833 } 834 835 836 /****************************************************************************** 837 * 838 * FUNCTION: AcpiOsReadMemory 839 * 840 * PARAMETERS: Address Physical Memory Address to read 841 * Value Where value is placed 842 * Width Number of bits 843 * 844 * RETURN: Value read from physical memory address 845 * 846 * DESCRIPTION: Read data from a physical memory address 847 * 848 *****************************************************************************/ 849 850 ACPI_STATUS 851 AcpiOsReadMemory ( 852 ACPI_PHYSICAL_ADDRESS Address, 853 UINT64 *Value, 854 UINT32 Width) 855 { 856 /* FIXME this operation is ignored */ 857 *Value = 0; 858 859 return (AE_OK); 860 } 861 862 863 /****************************************************************************** 864 * 865 * FUNCTION: AcpiOsWriteMemory 866 * 867 * PARAMETERS: Address Physical Memory Address to write 868 * Value Value to write 869 * Width Number of bits 870 * 871 * RETURN: None 872 * 873 * DESCRIPTION: Write data to a physical memory address 874 * 875 *****************************************************************************/ 876 877 ACPI_STATUS 878 AcpiOsWriteMemory ( 879 ACPI_PHYSICAL_ADDRESS Address, 880 UINT64 Value, 881 UINT32 Width) 882 { 883 /* FIXME this operation is ignored */ 884 return (AE_OK); 885 } 886 887 888 ACPI_THREAD_ID 889 AcpiOsGetThreadId(void) 890 { 891 return (ACPI_THREAD_ID) 1; 892 } 893 894 895 /****************************************************************************** 896 * 897 * FUNCTION: AcpiOsSignal 898 * 899 * PARAMETERS: Function ACPI CA signal function code 900 * Info Pointer to function-dependent structure 901 * 902 * RETURN: Status 903 * 904 * DESCRIPTION: Miscellaneous functions 905 * 906 *****************************************************************************/ 907 908 ACPI_STATUS 909 AcpiOsSignal ( 910 UINT32 Function, 911 void *Info) 912 { 913 panic("NOTIMPLEMENTED %s\n", __func__); 914 return (AE_OK); 915 } 916 917 /****************************************************************************** 918 * 919 * FUNCTION: AcpiOsGetRootPointer 920 * 921 * PARAMETERS: None 922 * 923 * RETURN: RSDP physical address 924 * 925 * DESCRIPTION: Gets the root pointer (RSDP) 926 * 927 *****************************************************************************/ 928 929 ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer ( 930 void) 931 { 932 return machine.acpi_rsdp; 933 } 934 935 /****************************************************************************** 936 * 937 * FUNCTION: AcpiOsReadPciConfiguration 938 * 939 * PARAMETERS: PciId Seg/Bus/Dev 940 * Register Device Register 941 * Value Buffer where value is placed 942 * Width Number of bits 943 * 944 * RETURN: Status 945 * 946 * DESCRIPTION: Read data from PCI configuration space 947 * 948 *****************************************************************************/ 949 950 ACPI_STATUS 951 AcpiOsReadPciConfiguration ( 952 ACPI_PCI_ID *PciId, 953 UINT32 Register, 954 UINT64 *Value, 955 UINT32 Width) 956 { 957 int err; 958 959 switch (Width) { 960 case 8: 961 *(u8_t *)Value = PCII_RREG8_(PciId->Bus, PciId->Device, 962 PciId->Function, Register); 963 break; 964 case 16: 965 *(u16_t *)Value = PCII_RREG16_(PciId->Bus, PciId->Device, 966 PciId->Function, Register); 967 break; 968 case 32: 969 *(u32_t *)Value = PCII_RREG32_(PciId->Bus, PciId->Device, 970 PciId->Function, Register); 971 break; 972 default: 973 panic("NOT IMPLEMENTED\n"); 974 } 975 976 if (OK != (err = sys_outl(PCII_CONFADD, PCII_UNSEL))) 977 printf("ACPI: warning, sys_outl failed: %d\n", err); 978 979 return AE_OK; 980 } 981 982 983 /****************************************************************************** 984 * 985 * FUNCTION: AcpiOsWritePciConfiguration 986 * 987 * PARAMETERS: PciId Seg/Bus/Dev 988 * Register Device Register 989 * Value Value to be written 990 * Width Number of bits 991 * 992 * RETURN: Status. 993 * 994 * DESCRIPTION: Write data to PCI configuration space 995 * 996 *****************************************************************************/ 997 998 ACPI_STATUS 999 AcpiOsWritePciConfiguration ( 1000 ACPI_PCI_ID *PciId, 1001 UINT32 Register, 1002 ACPI_INTEGER Value, 1003 UINT32 Width) 1004 { 1005 int err; 1006 1007 switch (Width) { 1008 case 8: 1009 PCII_WREG8_(PciId->Bus, PciId->Device, 1010 PciId->Function, Register, Value); 1011 break; 1012 case 16: 1013 PCII_WREG16_(PciId->Bus, PciId->Device, 1014 PciId->Function, Register, Value); 1015 break; 1016 case 32: 1017 PCII_WREG32_(PciId->Bus, PciId->Device, 1018 PciId->Function, Register, Value); 1019 break; 1020 default: 1021 panic("NOT IMPLEMENTED\n"); 1022 } 1023 1024 if (OK != (err = sys_outl(PCII_CONFADD, PCII_UNSEL))) 1025 printf("ACPI: warning, sys_outl failed: %d\n", err); 1026 1027 return AE_OK; 1028 } 1029 1030 1031 /****************************************************************************** 1032 * 1033 * FUNCTION: AcpiOsWaitEventsComplete 1034 * 1035 * PARAMETERS: None 1036 * 1037 * RETURN: None 1038 * 1039 * DESCRIPTION: Wait for all asynchronous events to complete. This 1040 * implementation does nothing. 1041 * 1042 *****************************************************************************/ 1043 1044 void 1045 AcpiOsWaitEventsComplete ( 1046 void) 1047 { 1048 return; 1049 } 1050