2 Copyright © 2004-2016, The AROS Development Team. All rights reserved.
10 # include <exec/types.h>
13 #include "DriverData.h"
17 #undef PCI_COMMAND_MEMORY
18 #undef PCI_COMMAND_MASTER
19 #undef PCI_BASE_ADDRESS_IO_MASK
20 #undef PCI_REVISION_ID
21 #undef PCI_SUBSYSTEM_ID
23 #undef PCI_SUBSYSTEM_VENDOR_ID
27 #define PCI_COMMAND_IO 1
28 #define PCI_COMMAND_MEMORY 2
29 #define PCI_COMMAND_MASTER 4
31 #define PCI_BASE_ADDRESS_0 0x10
33 #define PCI_BASE_ADDRESS_IO_MASK (~0x3UL)
35 #define PCI_REVISION_ID 8
36 #define PCI_SUBSYSTEM_ID 0x2e
37 #define PCI_DEVICE_ID 2
38 #define PCI_SUBSYSTEM_VENDOR_ID 0x2c
41 #define ALLOCVEC IExec->AllocVec
42 #define FREEVEC IExec->FreeVec
43 #define DEBUGPRINTF IExec->DebugPrintF
44 #define CAUSE IExec->Cause
45 #define CALLHOOK IUtility->CallHookPkt
46 #define INITSEMAPHORE IExec->InitSemaphore
47 #define OBTAINSEMAPHORE IExec->ObtainSemaphore
48 #define RELEASESEMAPHORE IExec->ReleaseSemaphore
49 #define CREATEPORT(a, b) IExec->CreatePort(a, b)
50 #define CREATEIOREQUEST IExec->CreateIORequest
51 #define OPENDEVICE IExec->OpenDevice
52 #define DOIO IExec->DoIO
53 #define DELETEIOREQUEST IExec->DeleteIORequest
54 #define CLOSEDEVICE IExec->CloseDevice
55 #define DELETEPORT IExec->DeletePort
56 #define GETTAGDATA IUtility->GetTagData
57 #define IRQTYPE INTERRUPT_NODE_TYPE
58 #define DELAY IDOS->Delay
60 #include <aros/debug.h>
61 #define ALLOCVEC AllocVec
62 #define FREEVEC FreeVec
63 #define DEBUGPRINTF kprintf
65 #define CALLHOOK CallHookA
66 #define INITSEMAPHORE InitSemaphore
67 #define OBTAINSEMAPHORE ObtainSemaphore
68 #define RELEASESEMAPHORE ReleaseSemaphore
69 #define CREATEPORT(a, b) CreateMsgPort()
70 #define CREATEIOREQUEST CreateIORequest
71 #define OPENDEVICE OpenDevice
73 #define DELETEIOREQUEST DeleteIORequest
74 #define CLOSEDEVICE CloseDevice
75 #define DELETEPORT DeleteMsgPort
76 #define GETTAGDATA GetTagData
77 #define IRQTYPE NT_INTERRUPT
80 #include <clib/debug_protos.h>
81 #define ALLOCVEC AllocVec
82 #define FREEVEC FreeVec
83 #define DEBUGPRINTF kprintf
85 #define CALLHOOK CallHookPkt
86 #define INITSEMAPHORE InitSemaphore
87 #define OBTAINSEMAPHORE ObtainSemaphore
88 #define RELEASESEMAPHORE ReleaseSemaphore
89 #define CREATEPORT(a, b) CreateMsgPort()
90 #define CREATEIOREQUEST CreateIORequest
91 #define OPENDEVICE OpenDevice
93 #define DELETEIOREQUEST DeleteIORequest
94 #define CLOSEDEVICE CloseDevice
95 #define DELETEPORT DeleteMsgPort
96 #define GETTAGDATA GetTagData
97 #define IRQTYPE INTERRUPT_NODE_TYPE
103 #define INBYTE(a) pci_inb((a), card)
104 #define INWORD(a) pci_inw((a), card)
105 #define INLONG(a) pci_inl((a), card)
106 #define OUTBYTE(addr, val) pci_outb((val), (addr), card)
107 #define OUTWORD(addr, val) pci_outw((val), (addr), card)
108 #define OUTLONG(addr, val) pci_outl((val), (addr), card)
110 #define INBYTE(a) ahi_pci_inb((a), 0)
111 #define INWORD(a) ahi_pci_inw((a), 0)
112 #define INLONG(a) ahi_pci_inl((a), 0)
113 #define OUTBYTE(addr, val) ahi_pci_outb((val), (addr), 0)
114 #define OUTWORD(addr, val) ahi_pci_outw((val), (addr), 0)
115 #define OUTLONG(addr, val) ahi_pci_outl((val), (addr), 0)
118 #define READCONFIGBYTE(reg) inb_config((reg), dev)
119 #define READCONFIGWORD(reg) inw_config((reg), dev)
121 #define WRITECONFIGWORD(reg, val) outw_config((reg), (val), dev)
123 BOOL
ahi_pci_init(struct DriverBase
* AHIsubBase
);
124 void ahi_pci_exit(void);
126 APTR
ahi_pci_find_device(ULONG vendorid
, ULONG deviceid
, APTR dev
);
129 ULONG
pci_inl(ULONG addr
, struct CardData
*card
);
130 UWORD
pci_inw(ULONG addr
, struct CardData
*card
);
131 UBYTE
pci_inb(ULONG addr
, struct CardData
*card
);
133 void pci_outl(ULONG value
, ULONG addr
, struct CardData
*card
);
134 void pci_outw(UWORD value
, ULONG addr
, struct CardData
*card
);
135 void pci_outb(UBYTE value
, ULONG addr
, struct CardData
*card
);
137 ULONG
pci_inl_mt(ULONG addr
, struct CardData
*card
);
138 UWORD
pci_inw_mt(ULONG addr
, struct CardData
*card
);
139 UBYTE
pci_inb_mt(ULONG addr
, struct CardData
*card
);
141 void pci_outl_mt(ULONG value
, ULONG addr
, struct CardData
*card
);
142 void pci_outw_mt(UWORD value
, ULONG addr
, struct CardData
*card
);
143 void pci_outb_mt(UBYTE value
, ULONG addr
, struct CardData
*card
);
145 ULONG
ahi_pci_inl(ULONG addr
, APTR dev
);
146 UWORD
ahi_pci_inw(ULONG addr
, APTR dev
);
147 UBYTE
ahi_pci_inb(ULONG addr
, APTR dev
);
148 void ahi_pci_outl(ULONG value
, ULONG addr
, APTR dev
);
149 void ahi_pci_outw(UWORD value
, ULONG addr
, APTR dev
);
150 void ahi_pci_outb(UBYTE value
, ULONG addr
, APTR dev
);
153 void outb_setbits(UBYTE value
, ULONG addr
, struct CardData
*card
);
154 void outw_setbits(UWORD value
, ULONG addr
, struct CardData
*card
);
155 void outl_setbits(ULONG value
, ULONG addr
, struct CardData
*card
);
156 void outb_clearbits(UBYTE value
, ULONG addr
, struct CardData
*card
);
157 void outw_clearbits(UWORD value
, ULONG addr
, struct CardData
*card
);
158 void outl_clearbits(ULONG value
, ULONG addr
, struct CardData
*card
);
160 ULONG
inl_config(UBYTE reg
, APTR dev
);
161 UWORD
inw_config(UBYTE reg
, APTR dev
);
162 UBYTE
inb_config(UBYTE reg
, APTR dev
);
164 void outl_config(UBYTE reg
, ULONG val
, APTR dev
);
165 void outw_config(UBYTE reg
, UWORD val
, APTR dev
);
166 void outb_config(UBYTE reg
, UBYTE val
, APTR dev
);
168 ULONG
ahi_pci_get_irq(APTR dev
);
170 BOOL
ahi_pci_add_intserver(struct Interrupt
*i
, APTR dev
);
171 void ahi_pci_rem_intserver(struct Interrupt
*i
, APTR dev
);
173 APTR
ahi_pci_logic_to_physic_addr(APTR addr
, APTR dev
);
175 APTR
ahi_pci_get_base_address(WORD which
, APTR dev
);
176 ULONG
ahi_pci_get_base_size(WORD which
, APTR dev
);
177 ULONG
ahi_pci_get_type(WORD which
, APTR dev
);
178 ULONG
ahi_pci_mem_map(APTR addr
, APTR dev
);
181 #include <aros/debug.h>
182 #define DebugPrintF bug
183 #define NT_EXTINTERRUPT NT_INTERRUPT