Deleted Added
full compact
if_ep_isa.c (147607) if_ep_isa.c (147717)
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 147607 2005-06-26 04:19:45Z imp $");
32__FBSDID("$FreeBSD: head/sys/dev/ep/if_ep_isa.c 147717 2005-07-01 05:31:23Z imp $");
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/socket.h>
38#include <sys/module.h>
39#include <sys/bus.h>
40

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

210 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_PROD_ID);
211 isa_id |= htons(data);
212
213 /* Find known ISA boards */
214 desc = ep_isa_match_id(isa_id, ep_isa_devs);
215 if (!desc) {
216 if (bootverbose)
217 device_printf(parent,
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/socket.h>
38#include <sys/module.h>
39#include <sys/bus.h>
40

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

210 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_PROD_ID);
211 isa_id |= htons(data);
212
213 /* Find known ISA boards */
214 desc = ep_isa_match_id(isa_id, ep_isa_devs);
215 if (!desc) {
216 if (bootverbose)
217 device_printf(parent,
218 "if_ep: unknown ID 0x%08x\n", isa_id);
218 "unknown ID 0x%08x\n", isa_id);
219 continue;
220 }
221 /* Retreive IRQ */
222 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
223 irq = (data >> 12);
224
225 /* Retreive IOPORT */
226 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG);
227#ifdef PC98
228 ioport = (((data & ADDR_CFG_MASK) * 0x100) + 0x40d0);
229#else
230 ioport = (((data & ADDR_CFG_MASK) << 4) + 0x200);
231#endif
232
233 if ((data & ADDR_CFG_MASK) == ADDR_CFG_EISA) {
234 device_printf(parent,
219 continue;
220 }
221 /* Retreive IRQ */
222 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
223 irq = (data >> 12);
224
225 /* Retreive IOPORT */
226 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG);
227#ifdef PC98
228 ioport = (((data & ADDR_CFG_MASK) * 0x100) + 0x40d0);
229#else
230 ioport = (((data & ADDR_CFG_MASK) << 4) + 0x200);
231#endif
232
233 if ((data & ADDR_CFG_MASK) == ADDR_CFG_EISA) {
234 device_printf(parent,
235 "if_ep: <%s> at port 0x%03x in EISA mode!\n",
235 "<%s> at port 0x%03x in EISA mode!\n",
236 desc, ioport);
237 /*
238 * Set the adaptor tag so that the next card can be
239 * found.
240 */
241 outb(ELINK_ID_PORT, tag--);
242 continue;
243 }
244 /* Test for an adapter with PnP support. */
245 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_CAP);
246 if (data == CAP_ISA) {
247 data = get_eeprom_data(ELINK_ID_PORT,
248 EEPROM_INT_CONFIG_1);
249 if (data & ICW1_IAS_PNP) {
250 if (bootverbose)
251 device_printf(parent,
236 desc, ioport);
237 /*
238 * Set the adaptor tag so that the next card can be
239 * found.
240 */
241 outb(ELINK_ID_PORT, tag--);
242 continue;
243 }
244 /* Test for an adapter with PnP support. */
245 data = get_eeprom_data(ELINK_ID_PORT, EEPROM_CAP);
246 if (data == CAP_ISA) {
247 data = get_eeprom_data(ELINK_ID_PORT,
248 EEPROM_INT_CONFIG_1);
249 if (data & ICW1_IAS_PNP) {
250 if (bootverbose)
251 device_printf(parent,
252 "if_ep: <%s> at 0x%03x "
252 "<%s> at 0x%03x "
253 "in PnP mode!\n",
254 desc, ioport);
255 /*
256 * Set the adaptor tag so that the next card
257 * can be found.
258 */
259 outb(ELINK_ID_PORT, tag--);
260 continue;

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

266 /* Activate the adaptor at the EEPROM location. */
267 outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
268
269 /* Test for an adapter in TEST mode. */
270 outw(ioport + EP_COMMAND, WINDOW_SELECT | 0);
271 data = inw(ioport + EP_W0_EEPROM_COMMAND);
272 if (data & EEPROM_TST_MODE) {
273 device_printf(parent,
253 "in PnP mode!\n",
254 desc, ioport);
255 /*
256 * Set the adaptor tag so that the next card
257 * can be found.
258 */
259 outb(ELINK_ID_PORT, tag--);
260 continue;

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

266 /* Activate the adaptor at the EEPROM location. */
267 outb(ELINK_ID_PORT, ACTIVATE_ADAPTER_TO_CONFIG);
268
269 /* Test for an adapter in TEST mode. */
270 outw(ioport + EP_COMMAND, WINDOW_SELECT | 0);
271 data = inw(ioport + EP_W0_EEPROM_COMMAND);
272 if (data & EEPROM_TST_MODE) {
273 device_printf(parent,
274 "if_ep: <%s> at port 0x%03x in TEST mode!"
274 "<%s> at port 0x%03x in TEST mode!"
275 " Erase pencil mark.\n",
276 desc, ioport);
277 continue;
278 }
279 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
280 device_set_desc_copy(child, desc);
281 device_set_driver(child, driver);
282 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
283 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);
284
285 if (bootverbose)
286 device_printf(parent,
275 " Erase pencil mark.\n",
276 desc, ioport);
277 continue;
278 }
279 child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
280 device_set_desc_copy(child, desc);
281 device_set_driver(child, driver);
282 bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
283 bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);
284
285 if (bootverbose)
286 device_printf(parent,
287 "if_ep: <%s>"
287 "<%s>"
288 " at port 0x%03x-0x%03x irq %d\n",
289 desc, ioport, ioport + EP_IOSIZE, irq);
290 found++;
291 }
292}
293#endif
294
295static int

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

317}
318
319static int
320ep_isa_attach(device_t dev)
321{
322 struct ep_softc *sc = device_get_softc(dev);
323 int error = 0;
324
288 " at port 0x%03x-0x%03x irq %d\n",
289 desc, ioport, ioport + EP_IOSIZE, irq);
290 found++;
291 }
292}
293#endif
294
295static int

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

317}
318
319static int
320ep_isa_attach(device_t dev)
321{
322 struct ep_softc *sc = device_get_softc(dev);
323 int error = 0;
324
325 if ((error = ep_alloc(dev))) {
326 device_printf(dev, "ep_alloc() failed! (%d)\n", error);
325 if ((error = ep_alloc(dev)))
327 goto bad;
326 goto bad;
328 }
329 ep_get_media(sc);
330
331 GO_WINDOW(sc, 0);
332 SET_IRQ(sc, rman_get_start(sc->irq));
333
327 ep_get_media(sc);
328
329 GO_WINDOW(sc, 0);
330 SET_IRQ(sc, rman_get_start(sc->irq));
331
334 if ((error = ep_attach(sc))) {
335 device_printf(dev, "ep_attach() failed! (%d)\n", error);
332 if ((error = ep_attach(sc)))
336 goto bad;
333 goto bad;
337 }
338 error = ep_eeprom_cksum(sc);
339 if (error) {
340 device_printf(sc->dev, "Invalid EEPROM checksum!\n");
341 goto bad;
342 }
343 if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, ep_intr,
344 sc, &sc->ep_intrhand))) {
345 device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);

--- 67 unchanged lines hidden ---
334 error = ep_eeprom_cksum(sc);
335 if (error) {
336 device_printf(sc->dev, "Invalid EEPROM checksum!\n");
337 goto bad;
338 }
339 if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, ep_intr,
340 sc, &sc->ep_intrhand))) {
341 device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);

--- 67 unchanged lines hidden ---