Deleted Added
full compact
if_ep_isa.c (119418) if_ep_isa.c (119572)
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_isa.c 119418 2003-08-24 17:55:58Z obrien $");
32__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_isa.c 119572 2003-08-30 08:10:58Z markm $");
33
34#include <sys/cdefs.h>
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_isa.c 119418 2003-08-24 17:55:58Z obrien $");
35__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_isa.c 119572 2003-08-30 08:10:58Z markm $");
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/socket.h>
41#include <sys/module.h>
42#include <sys/bus.h>
43

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

212 isa_id = (htons(data) << 16);
213 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_PROD_ID);
214 isa_id |= htons(data);
215
216 /* Find known ISA boards */
217 desc = ep_isa_match_id(isa_id, ep_isa_devs);
218 if (!desc) {
219 if (bootverbose)
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/socket.h>
41#include <sys/module.h>
42#include <sys/bus.h>
43

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

212 isa_id = (htons(data) << 16);
213 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_PROD_ID);
214 isa_id |= htons(data);
215
216 /* Find known ISA boards */
217 desc = ep_isa_match_id(isa_id, ep_isa_devs);
218 if (!desc) {
219 if (bootverbose)
220 device_printf(parent, "if_ep: unknown ID 0x%08x\n",
221 isa_id);
220 device_printf(parent,
221 "if_ep: unknown ID 0x%08x\n", isa_id);
222 continue;
223 }
224 /* Retreive IRQ */
225 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
226 irq = (data >> 12);
227
228 /* Retreive IOPORT */
229 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG);
230#ifdef PC98
231 ioport = (((data & ADDR_CFG_MASK) * 0x100) + 0x40d0);
232#else
233 ioport = (((data & ADDR_CFG_MASK) << 4) + 0x200);
234#endif
235
236 if ((data & ADDR_CFG_MASK) == ADDR_CFG_EISA) {
222 continue;
223 }
224 /* Retreive IRQ */
225 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
226 irq = (data >> 12);
227
228 /* Retreive IOPORT */
229 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG);
230#ifdef PC98
231 ioport = (((data & ADDR_CFG_MASK) * 0x100) + 0x40d0);
232#else
233 ioport = (((data & ADDR_CFG_MASK) << 4) + 0x200);
234#endif
235
236 if ((data & ADDR_CFG_MASK) == ADDR_CFG_EISA) {
237 device_printf(parent, "if_ep: <%s> at port 0x%03x in EISA mode!\n",
237 device_printf(parent,
238 "if_ep: <%s> at port 0x%03x in EISA mode!\n",
238 desc, ioport);
239 /*
240 * Set the adaptor tag so that the next card can be
241 * found.
242 */
243 outb(ELINK_ID_PORT, tag--);
244 continue;
245 }
246 /* Test for an adapter with PnP support. */
247 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_CAP);
248 if (data == CAP_ISA) {
239 desc, ioport);
240 /*
241 * Set the adaptor tag so that the next card can be
242 * found.
243 */
244 outb(ELINK_ID_PORT, tag--);
245 continue;
246 }
247 /* Test for an adapter with PnP support. */
248 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_CAP);
249 if (data == CAP_ISA) {
249 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_INT_CONFIG_1);
250 data = get_eeprom_data(ELINK_ID_PORT,
251 EEPROM_INT_CONFIG_1);
250 if (data & ICW1_IAS_PNP) {
251 if (bootverbose)
252 if (data & ICW1_IAS_PNP) {
253 if (bootverbose)
252 device_printf(parent, "if_ep: <%s> at 0x%03x in PnP mode!\n",
254 device_printf(parent,
255 "if_ep: <%s> at 0x%03x "
256 "in PnP mode!\n",
253 desc, ioport);
254 /*
255 * Set the adaptor tag so that the next card
256 * can be found.
257 */
258 outb(ELINK_ID_PORT, tag--);
259 continue;
260 }
261 }
262 /* Set the adaptor tag so that the next card can be found. */
263 outb(ELINK_ID_PORT, tag--);
264
265 /* Activate the adaptor at the EEPROM location. */
266 outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
267
268 /* Test for an adapter in TEST mode. */
269 outw(ioport + EP_COMMAND, WINDOW_SELECT | 0);
270 data = inw(ioport + EP_W0_EEPROM_COMMAND);
271 if (data & EEPROM_TST_MODE) {
257 desc, ioport);
258 /*
259 * Set the adaptor tag so that the next card
260 * can be found.
261 */
262 outb(ELINK_ID_PORT, tag--);
263 continue;
264 }
265 }
266 /* Set the adaptor tag so that the next card can be found. */
267 outb(ELINK_ID_PORT, tag--);
268
269 /* Activate the adaptor at the EEPROM location. */
270 outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
271
272 /* Test for an adapter in TEST mode. */
273 outw(ioport + EP_COMMAND, WINDOW_SELECT | 0);
274 data = inw(ioport + EP_W0_EEPROM_COMMAND);
275 if (data & EEPROM_TST_MODE) {
272 device_printf(parent, "if_ep: <%s> at port 0x%03x in TEST mode! Erase pencil mark.\n",
276 device_printf(parent,
277 "if_ep: <%s> at port 0x%03x in TEST mode!"
278 " Erase pencil mark.\n",
273 desc, ioport);
274 continue;
275 }
276 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
277 device_set_desc_copy(child, desc);
278 device_set_driver(child, driver);
279 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
280 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);
281
282 if (bootverbose)
279 desc, ioport);
280 continue;
281 }
282 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
283 device_set_desc_copy(child, desc);
284 device_set_driver(child, driver);
285 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
286 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);
287
288 if (bootverbose)
283 device_printf(parent, "if_ep: <%s> at port 0x%03x-0x%03x irq %d\n",
289 device_printf(parent,
290 "if_ep: <%s>"
291 " at port 0x%03x-0x%03x irq %d\n",
284 desc, ioport, ioport + EP_IOSIZE, irq);
285 found++;
286 }
287}
288#endif
289
290static int
291ep_isa_probe(device_t dev)

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

365 error = get_e(sc, i, &val);
366 if (error)
367 return (ENXIO);
368 switch (i) {
369 case 0x08:
370 case 0x09:
371 case 0x0d:
372 cksum_low ^= (u_int8_t) (val & 0x00ff) ^
292 desc, ioport, ioport + EP_IOSIZE, irq);
293 found++;
294 }
295}
296#endif
297
298static int
299ep_isa_probe(device_t dev)

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

373 error = get_e(sc, i, &val);
374 if (error)
375 return (ENXIO);
376 switch (i) {
377 case 0x08:
378 case 0x09:
379 case 0x0d:
380 cksum_low ^= (u_int8_t) (val & 0x00ff) ^
373 (u_int8_t) ((val & 0xff00) >> 8);
381 (u_int8_t)((val & 0xff00) >> 8);
374 break;
375 default:
376 cksum_high ^= (u_int8_t) (val & 0x00ff) ^
382 break;
383 default:
384 cksum_high ^= (u_int8_t) (val & 0x00ff) ^
377 (u_int8_t) ((val & 0xff00) >> 8);
385 (u_int8_t)((val & 0xff00) >> 8);
378 break;
379 }
380 }
386 break;
387 }
388 }
381 return (cksum != ((u_int16_t) cksum_low | (u_int16_t) (cksum_high << 8)));
389 return (cksum != ((u_int16_t)cksum_low | (u_int16_t)(cksum_high << 8)));
382}
383
384static device_method_t ep_isa_methods[] = {
385 /* Device interface */
386#ifdef __i386__
387 DEVMETHOD(device_identify, ep_isa_identify),
388#endif
389 DEVMETHOD(device_probe, ep_isa_probe),

--- 18 unchanged lines hidden ---
390}
391
392static device_method_t ep_isa_methods[] = {
393 /* Device interface */
394#ifdef __i386__
395 DEVMETHOD(device_identify, ep_isa_identify),
396#endif
397 DEVMETHOD(device_probe, ep_isa_probe),

--- 18 unchanged lines hidden ---