1 | /*
|
---|
2 | ** THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED ONLY
|
---|
3 | ** PURSUANT TO THE 3DFX GLIDE GENERAL PUBLIC LICENSE. THERE IS NO RIGHT
|
---|
4 | ** TO USE THE GLIDE TRADEMARK WITHOUT PRIOR WRITTEN PERMISSION OF 3DFX
|
---|
5 | ** INTERACTIVE, INC. A COPY OF THIS LICENSE MAY BE OBTAINED FROM THE
|
---|
6 | ** DISTRIBUTOR OR BY CONTACTING 3DFX INTERACTIVE INC(info@3dfx.com).
|
---|
7 | ** THIS PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
---|
8 | ** EXPRESSED OR IMPLIED. SEE THE 3DFX GLIDE GENERAL PUBLIC LICENSE FOR A
|
---|
9 | ** FULL TEXT OF THE NON-WARRANTY PROVISIONS.
|
---|
10 | **
|
---|
11 | ** USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
|
---|
12 | ** RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS IN
|
---|
13 | ** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
|
---|
14 | ** AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
|
---|
15 | ** SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
|
---|
16 | ** THE UNITED STATES.
|
---|
17 | **
|
---|
18 | ** COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED
|
---|
19 | **
|
---|
20 | **
|
---|
21 | ** $Revision: 1.1 $
|
---|
22 | ** $Date: 2000-02-25 00:33:56 $
|
---|
23 | **
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef _FXPCI_H_
|
---|
27 | #define _FXPCI_H_
|
---|
28 |
|
---|
29 | #ifdef __cplusplus
|
---|
30 | extern "C" {
|
---|
31 | #endif
|
---|
32 |
|
---|
33 | #define _3DFX_PCI_ID 0x121A
|
---|
34 |
|
---|
35 | /* jeske - 10/14/98
|
---|
36 | * This old assumption dosn't work anymore, because now a device_number
|
---|
37 | * is defined as:
|
---|
38 | *
|
---|
39 | * device_number[0:4] = slot
|
---|
40 | * device_number[5:12] = bus
|
---|
41 | * device_number[13:15] = function
|
---|
42 | *
|
---|
43 | * OLD ASSUMPTION:
|
---|
44 | * 16 Busses ( of possible 256, I am making the
|
---|
45 | * assumption that busses are numbered
|
---|
46 | * in increasing order and that no
|
---|
47 | * PC will have more than 16 busses )
|
---|
48 | * 32 Slots Per Bus
|
---|
49 | *
|
---|
50 | * Device Number = Bus Number * 32 + Slot Number <== wrong, see above....
|
---|
51 | */
|
---|
52 | # define MAX_PCI_DEVICES 512
|
---|
53 |
|
---|
54 | /* baseAddr0, baseAddr1, ioBaseAddr, romBaseAddr */
|
---|
55 | #define MAX_PCI_BASEADDRESSES 4
|
---|
56 |
|
---|
57 | typedef int PciMemType;
|
---|
58 | #define PciMemTypeUncacheable 0
|
---|
59 | #define PciMemTypeWriteCombining 1
|
---|
60 | #define PciMemTypeWriteThrough 4
|
---|
61 | #define PciMemTypeWriteProtected 5
|
---|
62 | #define PciMemTypeWriteback 6
|
---|
63 |
|
---|
64 | typedef enum {
|
---|
65 | READ_ONLY,
|
---|
66 | WRITE_ONLY,
|
---|
67 | READ_WRITE
|
---|
68 | } PciIOFlag;
|
---|
69 |
|
---|
70 | typedef struct {
|
---|
71 | FxU32 regAddress;
|
---|
72 | FxU32 sizeInBytes;
|
---|
73 | PciIOFlag rwFlag;
|
---|
74 | } PciRegister;
|
---|
75 |
|
---|
76 | #ifndef KERNEL
|
---|
77 | extern PciRegister PCI_VENDOR_ID;
|
---|
78 | extern PciRegister PCI_DEVICE_ID;
|
---|
79 | extern PciRegister PCI_COMMAND;
|
---|
80 | extern PciRegister PCI_STATUS;
|
---|
81 | extern PciRegister PCI_REVISION_ID;
|
---|
82 | extern PciRegister PCI_CLASS_CODE;
|
---|
83 | extern PciRegister PCI_CACHE_LINE_SIZE;
|
---|
84 | extern PciRegister PCI_LATENCY_TIMER;
|
---|
85 | extern PciRegister PCI_HEADER_TYPE;
|
---|
86 | extern PciRegister PCI_BIST;
|
---|
87 | extern PciRegister PCI_BASE_ADDRESS_0;
|
---|
88 | extern PciRegister PCI_BASE_ADDRESS_1;
|
---|
89 | extern PciRegister PCI_IO_BASE_ADDRESS;
|
---|
90 | extern PciRegister PCI_SUBVENDOR_ID;
|
---|
91 | extern PciRegister PCI_SUBSYSTEM_ID;
|
---|
92 | extern PciRegister PCI_ROM_BASE_ADDRESS;
|
---|
93 | extern PciRegister PCI_CAP_PTR;
|
---|
94 | extern PciRegister PCI_INTERRUPT_LINE;
|
---|
95 | extern PciRegister PCI_INTERRUPT_PIN;
|
---|
96 | extern PciRegister PCI_MIN_GNT;
|
---|
97 | extern PciRegister PCI_MAX_LAT;
|
---|
98 | extern PciRegister PCI_FAB_ID;
|
---|
99 | extern PciRegister PCI_CONFIG_STATUS;
|
---|
100 | extern PciRegister PCI_CONFIG_SCRATCH;
|
---|
101 | extern PciRegister PCI_AGP_CAP_ID;
|
---|
102 | extern PciRegister PCI_AGP_STATUS;
|
---|
103 | extern PciRegister PCI_AGP_CMD;
|
---|
104 | extern PciRegister PCI_ACPI_CAP_ID;
|
---|
105 | extern PciRegister PCI_CNTRL_STATUS;
|
---|
106 |
|
---|
107 | extern PciRegister PCI_SST1_INIT_ENABLE; // 0x40
|
---|
108 | extern PciRegister PCI_SST1_BUS_SNOOP_0; // 0x44
|
---|
109 | extern PciRegister PCI_SST1_BUS_SNOOP_1; // 0x48
|
---|
110 | extern PciRegister PCI_SST1_CFG_STATUS; // 0x4C
|
---|
111 |
|
---|
112 | #endif /* #ifndef KERNEL */
|
---|
113 |
|
---|
114 | /* a structure that contains callback procs */
|
---|
115 | typedef struct {
|
---|
116 | FxBool doHW;
|
---|
117 | FxU8 (*pioInByte) (FxU16 port);
|
---|
118 | FxU16 (*pioInWord) (FxU16 port);
|
---|
119 | FxU32 (*pioInLong) (FxU16 port);
|
---|
120 | void (*pioOutByte) (FxU16 port,FxU8 data);
|
---|
121 | void (*pioOutWord) (FxU16 port,FxU16 data);
|
---|
122 | void (*pioOutLong) (FxU16 port,FxU32 data);
|
---|
123 | } PciHwcCallbacks;
|
---|
124 |
|
---|
125 | FX_ENTRY const char * FX_CALL
|
---|
126 | pciGetErrorString( void );
|
---|
127 |
|
---|
128 | FX_ENTRY FxU32 FX_CALL
|
---|
129 | pciGetErrorCode( void );
|
---|
130 |
|
---|
131 | FX_ENTRY FxU8 FX_CALL
|
---|
132 | pioInByte ( unsigned short port ); /* inp */
|
---|
133 |
|
---|
134 | FX_ENTRY FxU16 FX_CALL
|
---|
135 | pioInWord ( unsigned short port ); /* inpw */
|
---|
136 |
|
---|
137 | FX_ENTRY FxU32 FX_CALL
|
---|
138 | pioInLong ( unsigned short port ); /* inpd */
|
---|
139 |
|
---|
140 | FX_ENTRY FxBool FX_CALL
|
---|
141 | pioOutByte ( unsigned short port, FxU8 data ); /* outp */
|
---|
142 |
|
---|
143 | FX_ENTRY FxBool FX_CALL
|
---|
144 | pioOutWord ( unsigned short port, FxU16 data ); /* outpw */
|
---|
145 |
|
---|
146 | FX_ENTRY FxBool FX_CALL
|
---|
147 | pioOutLong ( unsigned short port, FxU32 data ); /* outpd */
|
---|
148 |
|
---|
149 |
|
---|
150 | FX_ENTRY FxBool FX_CALL
|
---|
151 | pciOpen( void );
|
---|
152 |
|
---|
153 | FX_ENTRY FxBool FX_CALL
|
---|
154 | pciOpenEx( PciHwcCallbacks * );
|
---|
155 |
|
---|
156 | FX_ENTRY FxBool FX_CALL
|
---|
157 | pciClose( void );
|
---|
158 |
|
---|
159 | FX_ENTRY FxBool FX_CALL
|
---|
160 | pciDeviceExists( FxU32 device_number );
|
---|
161 |
|
---|
162 | FX_ENTRY FxBool FX_CALL
|
---|
163 | pciGetConfigData( PciRegister reg, FxU32 device_number, FxU32 *data );
|
---|
164 |
|
---|
165 | FX_ENTRY FxBool FX_CALL
|
---|
166 | pciSetConfigData( PciRegister reg, FxU32 device_number, FxU32 *data );
|
---|
167 |
|
---|
168 | /* NB: This routine makes the implicit assumption that the device was
|
---|
169 | * on bus0 which would not work across pci bridges or on agp devices.
|
---|
170 | */
|
---|
171 | FX_ENTRY FxBool FX_CALL
|
---|
172 | pciMapPhysicalToLinear(FxU32 *linear_addr, FxU32 physical_addr,FxU32 *length);
|
---|
173 |
|
---|
174 | FX_ENTRY FxBool FX_CALL
|
---|
175 | pciMapPhysicalDeviceToLinear(FxU32 *linear_addr,
|
---|
176 | FxU32 busNumber, FxU32 physical_addr,
|
---|
177 | FxU32 *length);
|
---|
178 |
|
---|
179 | FX_ENTRY void FX_CALL
|
---|
180 | pciUnmapPhysical( FxU32 linear_addr, FxU32 length );
|
---|
181 |
|
---|
182 | const char *
|
---|
183 | pciGetVendorName( FxU16 vendor_id );
|
---|
184 | const char *
|
---|
185 | pciGetClassName( FxU32 class_code , FxU32 deviceID);
|
---|
186 |
|
---|
187 | FX_ENTRY FxBool FX_CALL
|
---|
188 | pciFindCard(FxU32 vendorID, FxU32 deviceID, FxU32 *devNum);
|
---|
189 |
|
---|
190 | FX_ENTRY FxBool FX_CALL
|
---|
191 | pciFindCardMulti(FxU32 vID, FxU32 dID, FxU32 *devNum, FxU32 cardNum);
|
---|
192 |
|
---|
193 | FX_ENTRY FxU32 * FX_CALL
|
---|
194 | pciMapCard(FxU32 vID, FxU32 dID, FxI32 len, FxU32 *devNo, FxU32 addrNo);
|
---|
195 |
|
---|
196 | FX_ENTRY FxU32 * FX_CALL
|
---|
197 | pciMapCardMulti(FxU32 vID,FxU32 dID,FxI32 l,FxU32 *dNo,FxU32 cNo,FxU32 aNo);
|
---|
198 |
|
---|
199 | FX_ENTRY FxBool FX_CALL
|
---|
200 | pciFindMTRRMatch(FxU32 pBaseAddrs, FxU32 psz, PciMemType type, FxU32 *mtrrNum);
|
---|
201 |
|
---|
202 | FX_ENTRY FxBool FX_CALL
|
---|
203 | pciFindFreeMTRR(FxU32 *mtrrNum);
|
---|
204 |
|
---|
205 | FX_ENTRY FxBool FX_CALL
|
---|
206 | pciSetMTRR(FxU32 mtrrNo, FxU32 pBaseAddr, FxU32 psz, PciMemType type);
|
---|
207 |
|
---|
208 | FX_ENTRY FxBool FX_CALL
|
---|
209 | pciSetMTRRAmdK6(FxU32 mtrrNo, FxU32 pBaseAddr, FxU32 psz, PciMemType type);
|
---|
210 |
|
---|
211 | FX_ENTRY FxBool FX_CALL
|
---|
212 | pciSetPassThroughBase(FxU32* pBaseAddr, FxU32 baseAddrLen);
|
---|
213 |
|
---|
214 | FX_ENTRY FxBool FX_CALL
|
---|
215 | pciOutputDebugString(const char* debugMsg);
|
---|
216 |
|
---|
217 | FX_ENTRY FxBool FX_CALL
|
---|
218 | pciLinearRangeSetPermission(const FxU32 addrBase, const FxU32 addrLen, const FxBool writeableP);
|
---|
219 |
|
---|
220 | #define PCI_ERR_NOERR 0
|
---|
221 | #define PCI_ERR_WINRTINIT 1
|
---|
222 | #define PCI_ERR_MEMMAPVXD 2
|
---|
223 | #define PCI_ERR_MAPMEMDRV 3
|
---|
224 | #define PCI_ERR_GENPORT 4
|
---|
225 | #define PCI_ERR_NO_BUS 5
|
---|
226 | #define PCI_ERR_NOTOPEN 6
|
---|
227 | #define PCI_ERR_NOTOPEN2 7
|
---|
228 | #define PCI_ERR_NOTOPEN3 8
|
---|
229 | #define PCI_ERR_OUTOFRANGE 9
|
---|
230 | #define PCI_ERR_NODEV 10
|
---|
231 | #define PCI_ERR_NODEV2 11
|
---|
232 | #define PCI_ERR_WRITEONLY 12
|
---|
233 | #define PCI_ERR_READONLY 13
|
---|
234 | #define PCI_ERR_PHARLAP 14
|
---|
235 | #define PCI_ERR_WRONGVXD 15
|
---|
236 | #define PCI_ERR_MEMMAP 16
|
---|
237 | #define PCI_ERR_MAPMEM 17
|
---|
238 | #define PCI_ERR_WINRT 18
|
---|
239 | #define PCI_ERR_VXDINUSE 19
|
---|
240 | #define PCI_ERR_NO_IO_PERM 20
|
---|
241 | #define PCI_ERR_NO_MEM_PERM 21
|
---|
242 |
|
---|
243 | #ifdef __cplusplus
|
---|
244 | }
|
---|
245 | #endif
|
---|
246 |
|
---|
247 | #endif /* _FXPCI_H_ */
|
---|