csu: restore crt1.o symlink
[minix.git] / drivers / acpi / osminixxf.c
blob3d35e964c623e8f0b1d09a8437c55697f2a68ff0
1 /******************************************************************************
3 * 1. Copyright Notice
5 * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp.
6 * All rights reserved.
8 * 2. License
10 * 2.1. This is your license from Intel Corp. under its intellectual property
11 * rights. You may have additional license terms from the party that provided
12 * you this software, covering your right to use that party's intellectual
13 * property rights.
15 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
16 * copy of the source code appearing in this file ("Covered Code") an
17 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
18 * base code distributed originally by Intel ("Original Intel Code") to copy,
19 * make derivatives, distribute, use and display any portion of the Covered
20 * Code in any form, with the right to sublicense such rights; and
22 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
23 * license (with the right to sublicense), under only those claims of Intel
24 * patents that are infringed by the Original Intel Code, to make, use, sell,
25 * offer to sell, and import the Covered Code and derivative works thereof
26 * solely to the minimum extent necessary to exercise the above copyright
27 * license, and in no event shall the patent license extend to any additions
28 * to or modifications of the Original Intel Code. No other license or right
29 * is granted directly or by implication, estoppel or otherwise;
31 * The above copyright and patent license is granted only if the following
32 * conditions are met:
34 * 3. Conditions
36 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
37 * Redistribution of source code of any substantial portion of the Covered
38 * Code or modification with rights to further distribute source must include
39 * the above Copyright Notice, the above License, this list of Conditions,
40 * and the following Disclaimer and Export Compliance provision. In addition,
41 * Licensee must cause all Covered Code to which Licensee contributes to
42 * contain a file documenting the changes Licensee made to create that Covered
43 * Code and the date of any change. Licensee must include in that file the
44 * documentation of any changes made by any predecessor Licensee. Licensee
45 * must include a prominent statement that the modification is derived,
46 * directly or indirectly, from Original Intel Code.
48 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
49 * Redistribution of source code of any substantial portion of the Covered
50 * Code or modification without rights to further distribute source must
51 * include the following Disclaimer and Export Compliance provision in the
52 * documentation and/or other materials provided with distribution. In
53 * addition, Licensee may not authorize further sublicense of source of any
54 * portion of the Covered Code, and must include terms to the effect that the
55 * license from Licensee to its licensee is limited to the intellectual
56 * property embodied in the software Licensee provides to its licensee, and
57 * not to intellectual property embodied in modifications its licensee may
58 * make.
60 * 3.3. Redistribution of Executable. Redistribution in executable form of any
61 * substantial portion of the Covered Code or modification must reproduce the
62 * above Copyright Notice, and the following Disclaimer and Export Compliance
63 * provision in the documentation and/or other materials provided with the
64 * distribution.
66 * 3.4. Intel retains all right, title, and interest in and to the Original
67 * Intel Code.
69 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
70 * Intel shall be used in advertising or otherwise to promote the sale, use or
71 * other dealings in products derived from or relating to the Covered Code
72 * without prior written authorization from Intel.
74 * 4. Disclaimer and Export Compliance
76 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
77 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
78 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
79 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
80 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
81 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
82 * PARTICULAR PURPOSE.
84 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
85 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
86 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
87 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
88 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
89 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
90 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
91 * LIMITED REMEDY.
93 * 4.3. Licensee shall not export, either directly or indirectly, any of this
94 * software or system incorporating such software without first obtaining any
95 * required license or other approval from the U. S. Department of Commerce or
96 * any other agency or department of the United States Government. In the
97 * event Licensee exports any such software from the United States or
98 * re-exports any such software from a foreign destination, Licensee shall
99 * ensure that the distribution and export/re-export of the software is in
100 * compliance with all laws, regulations, orders, or other restrictions of the
101 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
102 * any of its subsidiaries will export/re-export any technical data, process,
103 * software, or service, directly or indirectly, to any country for which the
104 * United States government or any agency thereof requires an export license,
105 * other governmental approval, or letter of assurance, without first obtaining
106 * such license, approval or letter.
108 *****************************************************************************/
110 #include <stdio.h>
111 #include <stdlib.h>
112 #include <unistd.h>
113 #include <sys/time.h>
115 #include "acpi.h"
116 #include "accommon.h"
117 #include "amlcode.h"
118 #include "acparser.h"
119 #include "acdebug.h"
121 #include <minix/driver.h>
122 #include <machine/pci_intel.h>
124 extern struct machine machine;
127 static u32_t pci_inb(u16_t port) {
128 u32_t value;
129 int s;
130 if ((s=sys_inb(port, &value)) !=OK)
131 printf("ACPI: warning, sys_inb failed: %d\n", s);
132 return value;
135 static u32_t pci_inw(u16_t port) {
136 u32_t value;
137 int s;
138 if ((s=sys_inw(port, &value)) !=OK)
139 printf("ACPI: warning, sys_inw failed: %d\n", s);
140 return value;
143 static u32_t pci_inl(u16_t port) {
144 u32_t value;
145 int s;
146 if ((s=sys_inl(port, &value)) !=OK)
147 printf("ACPI: warning, sys_inl failed: %d\n", s);
148 return value;
151 static void pci_outb(u16_t port, u8_t value) {
152 int s;
153 if ((s=sys_outb(port, value)) !=OK)
154 printf("ACPI: warning, sys_outb failed: %d\n", s);
157 static void pci_outw(u16_t port, u16_t value) {
158 int s;
159 if ((s=sys_outw(port, value)) !=OK)
160 printf("ACPI: warning, sys_outw failed: %d\n", s);
163 static void pci_outl(u16_t port, u32_t value) {
164 int s;
165 if ((s=sys_outl(port, value)) !=OK)
166 printf("ACPI: warning, sys_outl failed: %d\n", s);
169 /******************************************************************************
171 * FUNCTION: AcpiOsInitialize, AcpiOsTerminate
173 * PARAMETERS: None
175 * RETURN: Status
177 * DESCRIPTION: Init and terminate. Nothing to do.
179 *****************************************************************************/
181 ACPI_STATUS
182 AcpiOsInitialize (void)
184 return AE_OK;
188 ACPI_STATUS
189 AcpiOsTerminate (void)
191 return AE_OK;
195 /******************************************************************************
197 * FUNCTION: AcpiOsPredefinedOverride
199 * PARAMETERS: InitVal - Initial value of the predefined object
200 * NewVal - The new value for the object
202 * RETURN: Status, pointer to value. Null pointer returned if not
203 * overriding.
205 * DESCRIPTION: Allow the OS to override predefined names
207 *****************************************************************************/
209 ACPI_STATUS
210 AcpiOsPredefinedOverride (
211 const ACPI_PREDEFINED_NAMES *InitVal,
212 ACPI_STRING *NewVal)
214 *NewVal = NULL;
215 return (AE_OK);
219 /******************************************************************************
221 * FUNCTION: AcpiOsTableOverride
223 * PARAMETERS: ExistingTable - Header of current table (probably firmware)
224 * NewTable - Where an entire new table is returned.
226 * RETURN: Status, pointer to new table. Null pointer returned if no
227 * table is available to override
229 * DESCRIPTION: Return a different version of a table if one is available
231 *****************************************************************************/
233 ACPI_STATUS
234 AcpiOsTableOverride (
235 ACPI_TABLE_HEADER *ExistingTable,
236 ACPI_TABLE_HEADER **NewTable)
238 *NewTable = NULL;
239 return (AE_OK);
243 /******************************************************************************
245 * FUNCTION: AcpiOsReadable
247 * PARAMETERS: Pointer - Area to be verified
248 * Length - Size of area
250 * RETURN: TRUE if readable for entire length
252 * DESCRIPTION: Verify that a pointer is valid for reading
254 *****************************************************************************/
256 BOOLEAN
257 AcpiOsReadable (
258 void *Pointer,
259 ACPI_SIZE Length)
261 panic("NOTIMPLEMENTED %s\n", __func__);
263 return (TRUE);
267 /******************************************************************************
269 * FUNCTION: AcpiOsWritable
271 * PARAMETERS: Pointer - Area to be verified
272 * Length - Size of area
274 * RETURN: TRUE if writable for entire length
276 * DESCRIPTION: Verify that a pointer is valid for writing
278 *****************************************************************************/
280 BOOLEAN
281 AcpiOsWritable (
282 void *Pointer,
283 ACPI_SIZE Length)
285 panic("NOTIMPLEMENTED %s\n", __func__);
287 return (TRUE);
291 /******************************************************************************
293 * FUNCTION: AcpiOsRedirectOutput
295 * PARAMETERS: Destination - An open file handle/pointer
297 * RETURN: None
299 * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf
301 *****************************************************************************/
303 void
304 AcpiOsRedirectOutput (
305 void *Destination)
307 panic("NOTIMPLEMENTED %s\n", __func__);
311 /******************************************************************************
313 * FUNCTION: AcpiOsPrintf
315 * PARAMETERS: fmt, ... Standard printf format
317 * RETURN: None
319 * DESCRIPTION: Formatted output
321 *****************************************************************************/
323 void ACPI_INTERNAL_VAR_XFACE
324 AcpiOsPrintf (
325 const char *Fmt,
326 ...)
328 va_list Args;
331 va_start (Args, Fmt);
333 #ifdef ACPI_BF_DEBUG
334 AcpiOsVprintf (Fmt, Args);
335 #endif
337 va_end (Args);
338 return;
342 /******************************************************************************
344 * FUNCTION: AcpiOsVprintf
346 * PARAMETERS: fmt Standard printf format
347 * args Argument list
349 * RETURN: None
351 * DESCRIPTION: Formatted output with argument list pointer
353 *****************************************************************************/
355 void
356 AcpiOsVprintf (
357 const char *Fmt,
358 va_list Args)
361 vprintf (Fmt, Args);
362 printf("\n");
366 /******************************************************************************
368 * FUNCTION: AcpiOsGetLine
370 * PARAMETERS: fmt Standard printf format
371 * args Argument list
373 * RETURN: Actual bytes read
375 * DESCRIPTION: Formatted input with argument list pointer
377 *****************************************************************************/
379 UINT32
380 AcpiOsGetLine (
381 char *Buffer)
383 panic("NOTIMPLEMENTED %s\n", __func__);
384 return 0;
387 /******************************************************************************
389 * FUNCTION: AcpiOsMapMemory
391 * PARAMETERS: where Physical address of memory to be mapped
392 * length How much memory to map
394 * RETURN: Pointer to mapped memory. Null on error.
396 * DESCRIPTION: Map physical memory into caller's address space
398 *****************************************************************************/
400 void *
401 AcpiOsMapMemory (
402 ACPI_PHYSICAL_ADDRESS where, /* not page aligned */
403 ACPI_SIZE length) /* in bytes, not page-aligned */
405 ACPI_PHYSICAL_ADDRESS addr;
406 void * vir;
407 unsigned sdiff;
409 addr = where & ~0xfff; /* align to 4k */
410 sdiff = where - addr;
411 vir = vm_map_phys(SELF, (void *) addr, length + sdiff);
413 return (void *) ((char *)vir + sdiff);
417 /******************************************************************************
419 * FUNCTION: AcpiOsUnmapMemory
421 * PARAMETERS: where Logical address of memory to be unmapped
422 * length How much memory to unmap
424 * RETURN: None.
426 * DESCRIPTION: Delete a previously created mapping. Where and Length must
427 * correspond to a previous mapping exactly.
429 *****************************************************************************/
431 void
432 AcpiOsUnmapMemory (
433 void *where,
434 ACPI_SIZE length)
439 /******************************************************************************
441 * FUNCTION: AcpiOsAllocate
443 * PARAMETERS: Size Amount to allocate, in bytes
445 * RETURN: Pointer to the new allocation. Null on error.
447 * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS.
449 *****************************************************************************/
451 void *
452 AcpiOsAllocate (
453 ACPI_SIZE size)
455 void *Mem;
458 Mem = (void *) malloc ((size_t) size);
459 if (Mem == NULL)
460 printf("AcpiOsAllocate out of memory\n");
462 return Mem;
466 /******************************************************************************
468 * FUNCTION: AcpiOsFree
470 * PARAMETERS: mem Pointer to previously allocated memory
472 * RETURN: None.
474 * DESCRIPTION: Free memory allocated via AcpiOsAllocate
476 *****************************************************************************/
478 void
479 AcpiOsFree (
480 void *mem)
482 free(mem);
486 /******************************************************************************
488 * FUNCTION: AcpiOsCreateSemaphore
490 * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore
491 * OutHandle - Where a handle will be returned
493 * RETURN: Status
495 * DESCRIPTION: Create an OS semaphore
497 *****************************************************************************/
499 ACPI_STATUS
500 AcpiOsCreateSemaphore (
501 UINT32 MaxUnits,
502 UINT32 InitialUnits,
503 ACPI_HANDLE *OutHandle)
505 *OutHandle = NULL;
506 return AE_OK;
509 /******************************************************************************
511 * FUNCTION: AcpiOsDeleteSemaphore
513 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
515 * RETURN: Status
517 * DESCRIPTION: Delete an OS semaphore
519 *****************************************************************************/
521 ACPI_STATUS
522 AcpiOsDeleteSemaphore (
523 ACPI_HANDLE Handle)
525 return AE_OK;
529 /******************************************************************************
531 * FUNCTION: AcpiOsWaitSemaphore
533 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
534 * Units - How many units to wait for
535 * Timeout - How long to wait
537 * RETURN: Status
539 * DESCRIPTION: Wait for units
541 *****************************************************************************/
543 ACPI_STATUS
544 AcpiOsWaitSemaphore (
545 ACPI_HANDLE Handle,
546 UINT32 Units,
547 UINT16 Timeout)
549 return AE_OK;
553 /******************************************************************************
555 * FUNCTION: AcpiOsSignalSemaphore
557 * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore
558 * Units - Number of units to send
560 * RETURN: Status
562 * DESCRIPTION: Send units
564 *****************************************************************************/
566 ACPI_STATUS
567 AcpiOsSignalSemaphore (
568 ACPI_HANDLE Handle,
569 UINT32 Units)
571 return AE_OK;
575 ACPI_STATUS
576 AcpiOsCreateLock (
577 ACPI_SPINLOCK *OutHandle)
579 *OutHandle = NULL;
580 return AE_OK;
583 void
584 AcpiOsDeleteLock (
585 ACPI_SPINLOCK Handle)
590 ACPI_CPU_FLAGS
591 AcpiOsAcquireLock (
592 ACPI_HANDLE Handle)
594 return (0);
598 void
599 AcpiOsReleaseLock (
600 ACPI_SPINLOCK Handle,
601 ACPI_CPU_FLAGS Flags)
606 /******************************************************************************
608 * FUNCTION: AcpiOsInstallInterruptHandler
610 * PARAMETERS: InterruptNumber Level handler should respond to.
611 * Isr Address of the ACPI interrupt handler
612 * ExceptPtr Where status is returned
614 * RETURN: Handle to the newly installed handler.
616 * DESCRIPTION: Install an interrupt handler. Used to install the ACPI
617 * OS-independent handler.
619 *****************************************************************************/
621 UINT32
622 AcpiOsInstallInterruptHandler (
623 UINT32 InterruptNumber,
624 ACPI_OSD_HANDLER ServiceRoutine,
625 void *Context)
627 printf("AcpiOsInstallInterruptHandler NOT SUPPORTED\n");
628 return AE_OK;
632 /******************************************************************************
634 * FUNCTION: AcpiOsRemoveInterruptHandler
636 * PARAMETERS: Handle Returned when handler was installed
638 * RETURN: Status
640 * DESCRIPTION: Uninstalls an interrupt handler.
642 *****************************************************************************/
644 ACPI_STATUS
645 AcpiOsRemoveInterruptHandler (
646 UINT32 InterruptNumber,
647 ACPI_OSD_HANDLER ServiceRoutine)
649 printf("AcpiOsRemoveInterruptHandler NOT SUPPORTED\n");
650 return AE_OK;
654 /******************************************************************************
656 * FUNCTION: AcpiOsExecute
658 * PARAMETERS: Type - Type of execution
659 * Function - Address of the function to execute
660 * Context - Passed as a parameter to the function
662 * RETURN: Status.
664 * DESCRIPTION: Execute a new thread
666 *****************************************************************************/
668 ACPI_STATUS
669 AcpiOsExecute (
670 ACPI_EXECUTE_TYPE Type,
671 ACPI_OSD_EXEC_CALLBACK Function,
672 void *Context)
674 panic("NOTIMPLEMENTED %s\n", __func__);
675 return AE_OK;
679 /******************************************************************************
681 * FUNCTION: AcpiOsBreakpoint
683 * PARAMETERS: Msg Message to print
685 * RETURN: Status
687 * DESCRIPTION: Print a message and break to the debugger.
689 *****************************************************************************/
691 ACPI_STATUS
692 AcpiOsBreakpoint (
693 char *Msg)
695 panic("NOTIMPLEMENTED %s\n", __func__);
696 return AE_OK;
700 /******************************************************************************
702 * FUNCTION: AcpiOsStall
704 * PARAMETERS: microseconds To sleep
706 * RETURN: Blocks until sleep is completed.
708 * DESCRIPTION: Sleep at microsecond granularity
710 *****************************************************************************/
712 void
713 AcpiOsStall (
714 UINT32 microseconds)
716 if (microseconds > 0)
717 usleep (microseconds);
719 return;
723 /******************************************************************************
725 * FUNCTION: AcpiOsSleep
727 * PARAMETERS: milliseconds To sleep
729 * RETURN: Blocks until sleep is completed.
731 * DESCRIPTION: Sleep at millisecond granularity
733 *****************************************************************************/
735 void
736 AcpiOsSleep (
737 ACPI_INTEGER milliseconds)
739 if ((milliseconds / 1000) > 0)
740 sleep (milliseconds / 1000);
742 if ((milliseconds % 1000) > 0)
743 usleep ((milliseconds % 1000) * 1000);
745 return;
748 /******************************************************************************
750 * FUNCTION: AcpiOsGetTimer
752 * PARAMETERS: None
754 * RETURN: Current time in 100 nanosecond units
756 * DESCRIPTION: Get the current system time
758 *****************************************************************************/
760 UINT64
761 AcpiOsGetTimer (void)
763 struct timeval time;
765 gettimeofday (&time, NULL);
766 return (((UINT64) time.tv_sec * 10000000) +
767 ((UINT64) time.tv_usec * 10));
771 /******************************************************************************
773 * FUNCTION: AcpiOsValidateInterface
775 * PARAMETERS: Interface - Requested interface to be validated
777 * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
779 * DESCRIPTION: Match an interface string to the interfaces supported by the
780 * host. Strings originate from an AML call to the _OSI method.
782 *****************************************************************************/
784 ACPI_STATUS
785 AcpiOsValidateInterface (
786 char *Interface)
788 return (AE_SUPPORT);
792 /* TEMPORARY STUB FUNCTION */
793 void
794 AcpiOsDerivePciId(
795 ACPI_HANDLE rhandle,
796 ACPI_HANDLE chandle,
797 ACPI_PCI_ID **PciId)
799 /* we do nothing here, we keep the PciId unchanged */
803 /******************************************************************************
805 * FUNCTION: AcpiOsReadPort
807 * PARAMETERS: Address Address of I/O port/register to read
808 * Value Where value is placed
809 * Width Number of bits
811 * RETURN: Value read from port
813 * DESCRIPTION: Read data from an I/O port or register
815 *****************************************************************************/
817 ACPI_STATUS
818 AcpiOsReadPort (
819 ACPI_IO_ADDRESS Address,
820 UINT32 *Value,
821 UINT32 Width)
823 *Value = 0;
824 switch (Width) {
825 case 8:
826 sys_inb(Address, Value);
827 break;
828 case 16:
829 sys_inw(Address, Value);
830 break;
831 case 32:
832 sys_inl(Address, Value);
833 break;
835 return AE_OK;
839 /******************************************************************************
841 * FUNCTION: AcpiOsWritePort
843 * PARAMETERS: Address Address of I/O port/register to write
844 * Value Value to write
845 * Width Number of bits
847 * RETURN: None
849 * DESCRIPTION: Write data to an I/O port or register
851 *****************************************************************************/
853 ACPI_STATUS
854 AcpiOsWritePort (
855 ACPI_IO_ADDRESS Address,
856 UINT32 Value,
857 UINT32 Width)
859 switch (Width) {
860 case 8:
861 sys_outb(Address, Value);
862 break;
863 case 16:
864 sys_outw(Address, Value);
865 break;
866 case 32:
867 sys_outl(Address, Value);
868 break;
870 return AE_OK;
871 return AE_OK;
875 /******************************************************************************
877 * FUNCTION: AcpiOsReadMemory
879 * PARAMETERS: Address Physical Memory Address to read
880 * Value Where value is placed
881 * Width Number of bits
883 * RETURN: Value read from physical memory address
885 * DESCRIPTION: Read data from a physical memory address
887 *****************************************************************************/
889 ACPI_STATUS
890 AcpiOsReadMemory (
891 ACPI_PHYSICAL_ADDRESS Address,
892 UINT32 *Value,
893 UINT32 Width)
895 /* FIXME this operation is ignored */
896 *Value = 0;
898 return (AE_OK);
902 /******************************************************************************
904 * FUNCTION: AcpiOsWriteMemory
906 * PARAMETERS: Address Physical Memory Address to write
907 * Value Value to write
908 * Width Number of bits
910 * RETURN: None
912 * DESCRIPTION: Write data to a physical memory address
914 *****************************************************************************/
916 ACPI_STATUS
917 AcpiOsWriteMemory (
918 ACPI_PHYSICAL_ADDRESS Address,
919 UINT32 Value,
920 UINT32 Width)
922 /* FIXME this operation is ignored */
923 return (AE_OK);
927 ACPI_THREAD_ID
928 AcpiOsGetThreadId(void)
930 return (ACPI_THREAD_ID) 1;
934 /******************************************************************************
936 * FUNCTION: AcpiOsSignal
938 * PARAMETERS: Function ACPI CA signal function code
939 * Info Pointer to function-dependent structure
941 * RETURN: Status
943 * DESCRIPTION: Miscellaneous functions
945 *****************************************************************************/
947 ACPI_STATUS
948 AcpiOsSignal (
949 UINT32 Function,
950 void *Info)
952 panic("NOTIMPLEMENTED %s\n", __func__);
953 return (AE_OK);
956 /******************************************************************************
958 * FUNCTION: AcpiOsGetRootPointer
960 * PARAMETERS: None
962 * RETURN: RSDP physical address
964 * DESCRIPTION: Gets the root pointer (RSDP)
966 *****************************************************************************/
968 ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer (
969 void)
971 return machine.acpi_rsdp;
974 /******************************************************************************
976 * FUNCTION: AcpiOsReadPciConfiguration
978 * PARAMETERS: PciId Seg/Bus/Dev
979 * Register Device Register
980 * Value Buffer where value is placed
981 * Width Number of bits
983 * RETURN: Status
985 * DESCRIPTION: Read data from PCI configuration space
987 *****************************************************************************/
989 ACPI_STATUS
990 AcpiOsReadPciConfiguration (
991 ACPI_PCI_ID *PciId,
992 UINT32 Register,
993 void *Value,
994 UINT32 Width)
996 int err;
998 switch (Width) {
999 case 8:
1000 *(u8_t *)Value = PCII_RREG8_(PciId->Bus, PciId->Device,
1001 PciId->Function, Register);
1002 break;
1003 case 16:
1004 *(u16_t *)Value = PCII_RREG16_(PciId->Bus, PciId->Device,
1005 PciId->Function, Register);
1006 break;
1007 case 32:
1008 *(u32_t *)Value = PCII_RREG32_(PciId->Bus, PciId->Device,
1009 PciId->Function, Register);
1010 break;
1011 default:
1012 panic("NOT IMPLEMENTED\n");
1015 if (OK != (err = sys_outl(PCII_CONFADD, PCII_UNSEL)))
1016 printf("ACPI: warning, sys_outl failed: %d\n", err);
1018 return AE_OK;
1022 /******************************************************************************
1024 * FUNCTION: AcpiOsWritePciConfiguration
1026 * PARAMETERS: PciId Seg/Bus/Dev
1027 * Register Device Register
1028 * Value Value to be written
1029 * Width Number of bits
1031 * RETURN: Status.
1033 * DESCRIPTION: Write data to PCI configuration space
1035 *****************************************************************************/
1037 ACPI_STATUS
1038 AcpiOsWritePciConfiguration (
1039 ACPI_PCI_ID *PciId,
1040 UINT32 Register,
1041 ACPI_INTEGER Value,
1042 UINT32 Width)
1044 int err;
1046 switch (Width) {
1047 case 8:
1048 PCII_WREG8_(PciId->Bus, PciId->Device,
1049 PciId->Function, Register, Value);
1050 break;
1051 case 16:
1052 PCII_WREG16_(PciId->Bus, PciId->Device,
1053 PciId->Function, Register, Value);
1054 break;
1055 case 32:
1056 PCII_WREG32_(PciId->Bus, PciId->Device,
1057 PciId->Function, Register, Value);
1058 break;
1059 default:
1060 panic("NOT IMPLEMENTED\n");
1063 if (OK != (err = sys_outl(PCII_CONFADD, PCII_UNSEL)))
1064 printf("ACPI: warning, sys_outl failed: %d\n", err);
1066 return AE_OK;