Deleted Added
sdiff udiff text old ( 11378 ) new ( 11524 )
full compact
1/**************************************************************************
2**
3** $Id: pcibus.c,v 1.16 1995/10/09 21:56:24 se Exp $
4**
5** pci bus subroutines for i386 architecture.
6**
7** FreeBSD
8**
9**-------------------------------------------------------------------------
10**
11** Copyright (c) 1994 Wolfgang Stanglmeier. All rights reserved.

--- 130 unchanged lines hidden (view full) ---

142
143
144#define CONF1_ADDR_PORT 0x0cf8
145#define CONF1_DATA_PORT 0x0cfc
146
147#define CONF1_ENABLE 0x80000000ul
148#define CONF1_ENABLE_CHK 0x80000000ul
149#define CONF1_ENABLE_CHK1 0xFF000001ul
150#define CONF1_ENABLE_MSK1 0x80000001ul
151#define CONF1_ENABLE_RES1 0x80000000ul
152
153#define CONF2_ENABLE_PORT 0x0cf8
154#define CONF2_FORWARD_PORT 0x0cfa
155
156#define CONF2_ENABLE_CHK 0x0e
157#define CONF2_ENABLE_RES 0x0e
158

--- 17 unchanged lines hidden (view full) ---

176 if (bootverbose)
177 printf ("-- nothing found\n");
178 return 0;
179}
180
181static void
182pcibus_setup (void)
183{
184 unsigned long mode1res,oldval1;
185 unsigned char mode2res,oldval2;
186
187 oldval1 = inl (CONF1_ADDR_PORT);
188
189 if (bootverbose) {
190 printf ("pcibus_setup(1):\tmode1 addr port (0x0cf8) is 0x%08lx\n", oldval1);
191 }
192
193 /*---------------------------------------
194 ** Assume configuration mechanism 1 for now ...
195 **---------------------------------------
196 */
197
198 if ((oldval1 & CONF1_ENABLE) == 0) {
199
200 pci_mechanism = 1;
201 pci_maxdevice = 32;
202
203 outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK);
204 outb (CONF1_ADDR_PORT +3, 0);
205 mode1res = inl (CONF1_ADDR_PORT);
206 outl (CONF1_ADDR_PORT, oldval1);
207
208 if (bootverbose)
209 printf ("pcibus_setup(1a):\tmode1res=0x%08lx (0x%08lx)\n",
210 mode1res, CONF1_ENABLE_CHK);
211
212 if (mode1res) {
213 if (pcibus_check())
214 return;
215 };
216
217 outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK1);
218 mode1res = inl(CONF1_ADDR_PORT);
219 outl (CONF1_ADDR_PORT, oldval1);
220
221 if (bootverbose)
222 printf ("pcibus_setup(1b):\tmode1res=0x%08lx (0x%08lx)\n",
223 mode1res, CONF1_ENABLE_CHK1);
224
225 if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) {
226 if (pcibus_check())
227 return;
228 };
229 }
230
231 /*---------------------------------------
232 ** Try configuration mechanism 2 ...
233 **---------------------------------------
234 */
235
236 oldval2 = inb (CONF2_ENABLE_PORT);
237
238 if (bootverbose) {
239 printf ("pcibus_setup(2):\tmode 2 enable port (0x0cf8) is 0x%02x\n", oldval2);
240 }
241
242 if ((oldval2 & 0xf0) == 0) {
243
244 pci_mechanism = 2;
245 pci_maxdevice = 16;
246
247 outb (CONF2_ENABLE_PORT, CONF2_ENABLE_CHK);
248 mode2res = inb(CONF2_ENABLE_PORT);
249 outb (CONF2_ENABLE_PORT, oldval2);
250
251 if (bootverbose)
252 printf ("pcibus_setup(2a):\tmode2res=0x%02x (0x%02x)\n",
253 mode2res, CONF2_ENABLE_CHK);
254
255 if (mode2res == CONF2_ENABLE_RES) {
256 if (bootverbose)
257 printf ("pcibus_setup(2a):\tnow trying mechanism 2\n");
258
259 if (pcibus_check())
260 return;
261 }
262 }
263
264 /*---------------------------------------
265 ** No PCI bus host bridge found
266 **---------------------------------------
267 */
268
269 pci_mechanism = 0;
270 pci_maxdevice = 0;
271}

--- 226 unchanged lines hidden ---