From 8010b4aa01acb0b2b3fc378fa746e7a44e547b8e Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 3 Sep 1999 19:10:56 +0000 Subject: 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. --- sys/dev/ed/if_ed_pci.c | 82 ++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 40 deletions(-) (limited to 'sys/dev/ed/if_ed_pci.c') 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 #include -#include +#include #include +#include +#include +#include + #include #include -#include "ed.h" +#include +#include +#include + +#include 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); -- cgit v1.1