diff options
author | peter <peter@FreeBSD.org> | 1999-09-03 19:10:56 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-09-03 19:10:56 +0000 |
commit | 8010b4aa01acb0b2b3fc378fa746e7a44e547b8e (patch) | |
tree | f4f15bb50f1962880dec16b2eaa10f85a1559120 /sys/dev/ed/if_ed_pci.c | |
parent | 6ea78090c5694d5a98d96b43f49b62f751f37955 (diff) | |
download | FreeBSD-src-8010b4aa01acb0b2b3fc378fa746e7a44e547b8e.zip FreeBSD-src-8010b4aa01acb0b2b3fc378fa746e7a44e547b8e.tar.gz |
Commit a checkpoint of an updated if_ed driver. This is pretty much
Doug Rabson's work, with a few tweaks from Warner Losh and I. There are
still some quirks to resolve, but the old driver is presently breaking
the build.
Diffstat (limited to 'sys/dev/ed/if_ed_pci.c')
-rw-r--r-- | sys/dev/ed/if_ed_pci.c | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/sys/dev/ed/if_ed_pci.c b/sys/dev/ed/if_ed_pci.c index 023457e..e7df453 100644 --- a/sys/dev/ed/if_ed_pci.c +++ b/sys/dev/ed/if_ed_pci.c @@ -22,17 +22,25 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/malloc.h> +#include <sys/socket.h> #include <sys/kernel.h> +#include <sys/module.h> +#include <sys/bus.h> +#include <machine/bus.h> + #include <pci/pcireg.h> #include <pci/pcivar.h> -#include "ed.h" +#include <net/if.h> +#include <net/if_arp.h> +#include <net/if_mib.h> + +#include <i386/isa/if_edvar.h> static struct _pcsid { - pcidi_t type; - char *desc; + u_int32_t type; + const char *desc; } pci_ids[] = { { 0x802910ec, "NE2000 PCI Ethernet (RealTek 8029)" }, @@ -46,53 +54,47 @@ static struct _pcsid { 0x00000000, NULL } }; -extern void *ed_attach_NE2000_pci __P((int, int)); - -static const char* ed_pci_probe __P((pcici_t tag, pcidi_t type)); -static void ed_pci_attach __P((pcici_t config_id, int unit)); - -static u_long ed_pci_count = NED; +extern int ed_attach_NE2000_pci __P((device_t dev, int)); -static struct pci_device ed_pci_driver = { - "ed", - ed_pci_probe, - ed_pci_attach, - &ed_pci_count, - NULL -}; +static int ed_pci_probe __P((device_t)); +static int ed_pci_attach __P((device_t)); -COMPAT_PCI_DRIVER (ed_pci, ed_pci_driver); - -static const char* -ed_pci_probe (pcici_t tag, pcidi_t type) +static int +ed_pci_probe (device_t dev) { + u_int32_t type = pci_get_devid(dev); struct _pcsid *ep =pci_ids; while (ep->type && ep->type != type) ++ep; - return (ep->desc); + if (ep->desc) { + device_set_desc(dev, ep->desc); + return 0; + } else { + return ENXIO; + } } -void edintr_sc (void*); - -static void -ed_pci_attach(config_id, unit) - pcici_t config_id; - int unit; +static int +ed_pci_attach(device_t dev) { - int io_port; - void *ed; /* device specific data ... */ + return ed_attach_NE2000_pci(dev, PCIR_MAPS); +} - io_port = pci_conf_read(config_id, PCI_MAP_REG_START) & ~PCI_MAP_IO; +static device_method_t ed_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, ed_pci_probe), + DEVMETHOD(device_attach, ed_pci_attach), - ed = ed_attach_NE2000_pci(unit, io_port); - if (!ed) - return; + { 0, 0 } +}; - if(!(pci_map_int(config_id, edintr_sc, (void *)ed, &net_imask))) { - free (ed, M_DEVBUF); - return; - } +static driver_t ed_pci_driver = { + "ed", + ed_pci_methods, + sizeof(struct ed_softc), +}; - return; -} +static devclass_t ed_devclass; + +DRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, 0, 0); |