pci_pir.c (11378) | pci_pir.c (11524) |
---|---|
1/************************************************************************** 2** | 1/************************************************************************** 2** |
3** $Id: pcibus.c,v 1.15 1995/09/22 19:10:54 se Exp $ | 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 | 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 0x80000000ul | 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{ | 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,oldval; 185 unsigned char mode2res; | 184 unsigned long mode1res,oldval1; 185 unsigned char mode2res,oldval2; |
186 | 186 |
187 oldval = inl (CONF1_ADDR_PORT); 188 outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK); 189 outb (CONF2_ENABLE_PORT, CONF2_ENABLE_CHK); 190 mode1res = inl(CONF1_ADDR_PORT); 191 mode2res = inb(CONF2_ENABLE_PORT); 192 outb (CONF2_ENABLE_PORT, 0); 193 outl (CONF1_ADDR_PORT, oldval); | 187 oldval1 = inl (CONF1_ADDR_PORT); |
194 195 if (bootverbose) { | 188 189 if (bootverbose) { |
196 printf ("pcibus_setup(1):\tmode1res=0x%08lx (0x%08lx), " 197 "mode2res=0x%02x (0x%02x)\n", 198 mode1res,CONF1_ENABLE_CHK, 199 (int)mode2res,CONF2_ENABLE_CHK); | 190 printf ("pcibus_setup(1):\tmode1 addr port (0x0cf8) is 0x%08lx\n", oldval1); |
200 } 201 202 /*--------------------------------------- | 191 } 192 193 /*--------------------------------------- |
203 ** No PCI, if neither mode1res nor mode2res could be read back 204 **--------------------------------------- 205 */ 206 207 if ((mode1res != CONF1_ENABLE_CHK) && (mode2res != CONF2_ENABLE_CHK)) { 208 return; 209 } 210 211 /*--------------------------------------- | |
212 ** Assume configuration mechanism 1 for now ... 213 **--------------------------------------- 214 */ 215 | 194 ** Assume configuration mechanism 1 for now ... 195 **--------------------------------------- 196 */ 197 |
216 pci_mechanism = 1; 217 pci_maxdevice = 32; | 198 if ((oldval1 & CONF1_ENABLE) == 0) { |
218 | 199 |
219 outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK); 220 outb (CONF1_ADDR_PORT +3, 0); 221 mode1res = inl (CONF1_ADDR_PORT); 222 outl (CONF1_ADDR_PORT, oldval); | 200 pci_mechanism = 1; 201 pci_maxdevice = 32; |
223 | 202 |
224 if (bootverbose) 225 printf ("pcibus_setup(2):\tmode1res=0x%08lx (0x%08lx)\n", 226 mode1res, CONF1_ENABLE_CHK); | 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); |
227 | 207 |
228 if (mode1res) { 229 if (pcibus_check()) 230 return; 231 }; | 208 if (bootverbose) 209 printf ("pcibus_setup(1a):\tmode1res=0x%08lx (0x%08lx)\n", 210 mode1res, CONF1_ENABLE_CHK); |
232 | 211 |
233 outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK1); 234 outl (CONF1_DATA_PORT, 0); 235 mode1res = inl(CONF1_ADDR_PORT); 236 outl (CONF1_ADDR_PORT, oldval); | 212 if (mode1res) { 213 if (pcibus_check()) 214 return; 215 }; |
237 | 216 |
238 if (bootverbose) 239 printf ("pcibus_setup(3):\tmode1res=0x%08lx (0x%08lx)\n", 240 mode1res, CONF1_ENABLE_CHK1); | 217 outl (CONF1_ADDR_PORT, CONF1_ENABLE_CHK1); 218 mode1res = inl(CONF1_ADDR_PORT); 219 outl (CONF1_ADDR_PORT, oldval1); |
241 | 220 |
242 if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) { 243 if (pcibus_check()) 244 return; 245 }; | 221 if (bootverbose) 222 printf ("pcibus_setup(1b):\tmode1res=0x%08lx (0x%08lx)\n", 223 mode1res, CONF1_ENABLE_CHK1); |
246 | 224 |
225 if ((mode1res & CONF1_ENABLE_MSK1) == CONF1_ENABLE_RES1) { 226 if (pcibus_check()) 227 return; 228 }; 229 } 230 |
|
247 /*--------------------------------------- 248 ** Try configuration mechanism 2 ... 249 **--------------------------------------- 250 */ 251 | 231 /*--------------------------------------- 232 ** Try configuration mechanism 2 ... 233 **--------------------------------------- 234 */ 235 |
252 if (bootverbose) 253 printf ("pcibus_setup(4):\tnow trying mechanism 2\n"); | 236 oldval2 = inb (CONF2_ENABLE_PORT); |
254 | 237 |
255 pci_mechanism = 2; 256 pci_maxdevice = 16; | 238 if (bootverbose) { 239 printf ("pcibus_setup(2):\tmode 2 enable port (0x0cf8) is 0x%02x\n", oldval2); 240 } |
257 | 241 |
258 if (pcibus_check()) 259 return; | 242 if ((oldval2 & 0xf0) == 0) { |
260 | 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 |
|
261 /*--------------------------------------- 262 ** No PCI bus host bridge found 263 **--------------------------------------- 264 */ 265 266 pci_mechanism = 0; 267 pci_maxdevice = 0; 268} --- 226 unchanged lines hidden --- | 264 /*--------------------------------------- 265 ** No PCI bus host bridge found 266 **--------------------------------------- 267 */ 268 269 pci_mechanism = 0; 270 pci_maxdevice = 0; 271} --- 226 unchanged lines hidden --- |