grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / devs / AHI / Drivers / EMU10kx / pci_openpci.c
blobc1c5485c5ae97fb513778c3d2658b38285bb327d
2 #include <config.h>
4 #include <utility/hooks.h>
5 #include <exec/interrupts.h>
7 #include <libraries/openpci.h>
8 #include <proto/openpci.h>
9 #include <clib/alib_protos.h>
11 #include "library.h"
12 #include "DriverData.h"
13 #include "pci_wrapper.h"
15 struct Library *OpenPciBase;
17 BOOL ahi_pci_init(struct DriverBase* AHIsubBase)
19 struct EMU10kxBase* EMU10kxBase = (struct EMU10kxBase*) AHIsubBase;
21 OpenPciBase = OpenLibrary( "openpci.library", 1 );
23 if( OpenPciBase == NULL )
25 Req( "Unable to open 'openpci.library' version 1.\n" );
26 return FALSE;
29 EMU10kxBase->flush_caches = pci_bus() & ( GrexA1200Bus | GrexA4000Bus );
31 return TRUE;
34 void ahi_pci_exit(void)
36 CloseLibrary(OpenPciBase);
39 APTR ahi_pci_find_device(ULONG vendorid, ULONG deviceid, APTR dev)
41 return pci_find_device( vendorid, deviceid, dev );
44 ULONG ahi_pci_inl(ULONG addr, APTR dev)
46 return SWAPLONG(pci_inl(addr));
49 UWORD ahi_pci_inw(ULONG addr, APTR dev)
51 return SWAPWORD(pci_inw(addr));
54 UBYTE ahi_pci_inb(ULONG addr, APTR dev)
56 return pci_inb(addr);
59 void ahi_pci_outl(ULONG value, ULONG addr, APTR dev)
61 pci_outl(SWAPLONG(value), addr);
64 void ahi_pci_outw(UWORD value, ULONG addr, APTR dev)
66 pci_outw(SWAPWORD(value), addr);
69 void ahi_pci_outb(UBYTE value, ULONG addr, APTR dev)
71 pci_outb(value, addr);
74 ULONG ahi_pci_read_config_long(UBYTE reg, APTR dev)
76 return pci_read_config_long(reg, dev);
79 UWORD ahi_pci_read_config_word(UBYTE reg, APTR dev)
81 return pci_read_config_word(reg, dev);
84 UBYTE ahi_pci_read_config_byte(UBYTE reg, APTR dev)
86 return pci_read_config_byte(reg, dev);
89 void ahi_pci_write_config_long(UBYTE reg, ULONG val, APTR dev)
91 pci_write_config_long(reg, val, dev);
94 void ahi_pci_write_config_word(UBYTE reg, UWORD val, APTR dev)
96 pci_write_config_word(reg, val, dev);
99 void ahi_pci_write_config_byte(UBYTE reg, UBYTE val, APTR dev)
101 pci_write_config_byte(reg, val, dev);
104 ULONG ahi_pci_get_irq(APTR dev)
106 return ((struct pci_dev *)dev)->irq;
109 BOOL ahi_pci_add_intserver(struct Interrupt *i, APTR dev)
111 return pci_add_intserver(i, dev);
114 void ahi_pci_rem_intserver(struct Interrupt *i, APTR dev)
116 pci_rem_intserver(i, dev);
119 APTR ahi_pci_logic_to_physic_addr(APTR addr, APTR dev)
121 return pci_logic_to_physic_addr(addr, dev);
124 APTR ahi_pci_get_base_address(WORD which, APTR dev)
126 return (APTR) ((struct pci_dev *)dev)->base_address[which];
129 ULONG ahi_pci_get_base_size(WORD which, APTR dev)
131 return ((struct pci_dev *)dev)->base_size[which];