diff options
Diffstat (limited to 'sys/dev/sn')
-rw-r--r-- | sys/dev/sn/if_sn.c | 30 | ||||
-rw-r--r-- | sys/dev/sn/if_sn_isa.c | 2 | ||||
-rw-r--r-- | sys/dev/sn/if_sn_pccard.c | 31 |
3 files changed, 41 insertions, 22 deletions
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index 2794442..f1d2840 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -78,8 +78,7 @@ * Multicast support by Kei TANAKA <kei@pal.xerox.com> * Special thanks to itojun@itojun.org */ - -#undef SN_DEBUG /* (by hosokawa) */ +#define SN_DEBUG #include <sys/param.h> #include <sys/systm.h> @@ -361,6 +360,7 @@ snstart(struct ifnet *ifp) u_short numPages; u_char packet_no; int time_out; + int junk = 0; s = splimp(); @@ -443,7 +443,7 @@ startagain: break; } while (--time_out); - if (!time_out) { + if (!time_out || junk > 10) { /* * No memory now. Oh well, wait until the chip finds memory @@ -469,7 +469,8 @@ startagain: */ packet_no = inb(BASE + ALLOC_RESULT_REG_B); if (packet_no & ARR_FAILED) { - printf("sn%d: Memory allocation failed\n", ifp->if_unit); + if (junk++ > 10) + printf("sn%d: Memory allocation failed\n", ifp->if_unit); goto startagain; } /* @@ -1243,9 +1244,8 @@ sn_activate(device_t dev) sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, 0, ~0, SMC_IO_EXTENT, RF_ACTIVE); if (!sc->port_res) { -#ifdef SN_DEBUG - device_printf(dev, "Cannot allocate ioport\n"); -#endif + if (bootverbose) + device_printf(dev, "Cannot allocate ioport\n"); return ENOMEM; } @@ -1253,9 +1253,8 @@ sn_activate(device_t dev) sc->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->irq_rid, 0, ~0, 1, RF_ACTIVE); if (!sc->irq_res) { -#ifdef SN_DEBUG - device_printf(dev, "Cannot allocate irq\n"); -#endif + if (bootverbose) + device_printf(dev, "Cannot allocate irq\n"); sn_deactivate(dev); return ENOMEM; } @@ -1317,7 +1316,9 @@ sn_probe(device_t dev, int pccard) return err; ioaddr = sc->sn_io_addr; - +#ifdef SN_DEBUG + device_printf(dev, "ioaddr is 0x%x\n", ioaddr); +#endif /* * First, see if the high byte is 0x33 */ @@ -1361,11 +1362,6 @@ sn_probe(device_t dev, int pccard) * Well, the base address register didn't match. Must not * have been a SMC chip after all. */ - /* - * printf("sn: ioaddr %x doesn't match card configuration - * (%x)\n", ioaddr, base_address_register >> 3 & 0x3E0 ); - */ - #ifdef SN_DEBUG device_printf(dev, "test3 failed ioaddr = 0x%x, " "base_address_register = 0x%x\n", ioaddr, @@ -1373,6 +1369,7 @@ sn_probe(device_t dev, int pccard) #endif goto error; } + /* * Check if the revision register is something that I recognize. * These might need to be added to later, as future revisions could @@ -1390,6 +1387,7 @@ sn_probe(device_t dev, int pccard) #endif goto error; } + /* * at this point I'll assume that the chip is an SMC9xxx. It might be * prudent to check a listing of MAC addresses against the hardware diff --git a/sys/dev/sn/if_sn_isa.c b/sys/dev/sn/if_sn_isa.c index e32b1bb..78d9bd0 100644 --- a/sys/dev/sn/if_sn_isa.c +++ b/sys/dev/sn/if_sn_isa.c @@ -96,4 +96,4 @@ static driver_t sn_isa_driver = { extern devclass_t sn_devclass; -DRIVER_MODULE(sn, isa, sn_isa_driver, sn_devclass, 0, 0); +DRIVER_MODULE(if_sn, isa, sn_isa_driver, sn_devclass, 0, 0); diff --git a/sys/dev/sn/if_sn_pccard.c b/sys/dev/sn/if_sn_pccard.c index 4220dea..5e41bec 100644 --- a/sys/dev/sn/if_sn_pccard.c +++ b/sys/dev/sn/if_sn_pccard.c @@ -55,13 +55,22 @@ #include <dev/sn/if_snvar.h> #include <dev/pccard/pccardvar.h> +#include <dev/pccard/pccarddevs.h> + +#include "card_if.h" + /* * Initialize the device - called from Slot manager. */ static int sn_pccard_probe(device_t dev) { - return (sn_probe(dev, 1)); + int err; + + printf ("Probing sn driver\n"); + err = sn_probe(dev, 1); + printf("sn_probe says %d\n", err); + return (err); } static int @@ -80,7 +89,6 @@ sn_pccard_attach(device_t dev) sc->pccard_enaddr = 1; bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); } - return (sn_attach(dev)); } @@ -95,12 +103,23 @@ sn_pccard_detach(device_t dev) return 0; } +static int +sn_pccard_match(device_t dev) +{ + return EIO; +} + static device_method_t sn_pccard_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, sn_pccard_probe), - DEVMETHOD(device_attach, sn_pccard_attach), + DEVMETHOD(device_probe, pccard_compat_probe), + DEVMETHOD(device_attach, pccard_compat_attach), DEVMETHOD(device_detach, sn_pccard_detach), + /* Card interface */ + DEVMETHOD(card_compat_match, sn_pccard_match), + DEVMETHOD(card_compat_probe, sn_pccard_probe), + DEVMETHOD(card_compat_attach, sn_pccard_attach), + { 0, 0 } }; @@ -112,4 +131,6 @@ static driver_t sn_pccard_driver = { extern devclass_t sn_devclass; -DRIVER_MODULE(sn, pccard, sn_pccard_driver, sn_devclass, 0, 0); +DRIVER_MODULE(if_sn, pccard, sn_pccard_driver, sn_devclass, 0, 0); +MODULE_DEPEND(if_sn, pccard, 1, 1, 1); +MODULE_DEPEND(if_sn, pcic, 1, 1, 1); /* XXX */ |