From: Joerg Sonnenberger Date: Thu, 30 Jun 2005 16:05:14 +0000 (+0000) Subject: Remove now unnecessary messing with PCI command register. X-Git-Tag: v2.0.1~6766 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/98036ca160b74ee30763b75fe0b1d6f5406544c1 Remove now unnecessary messing with PCI command register. Submitted-by: Sepherosa Ziehau Change wi_pci_probe to common style (different patch from submission). --- diff --git a/sys/dev/netif/wi/if_wi_pci.c b/sys/dev/netif/wi/if_wi_pci.c index df72be9bd5..87ff04e358 100644 --- a/sys/dev/netif/wi/if_wi_pci.c +++ b/sys/dev/netif/wi/if_wi_pci.c @@ -30,7 +30,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/wi/if_wi_pci.c,v 1.22 2004/03/17 17:50:48 njl Exp $ - * $DragonFly: src/sys/dev/netif/wi/if_wi_pci.c,v 1.5 2004/09/06 13:52:24 joerg Exp $ + * $DragonFly: src/sys/dev/netif/wi/if_wi_pci.c,v 1.6 2005/06/30 16:05:14 joerg Exp $ */ /* @@ -93,11 +93,11 @@ static driver_t wi_pci_driver = { sizeof(struct wi_softc) }; -static struct { +static struct wi_pci_card { unsigned int vendor,device; int bus_type; char *desc; -} pci_ids[] = { +} wi_pci_cards[] = { /* Sorted by description */ {0x10b7, 0x7770, WI_BUS_PCI_PLX, "3Com Airconnect"}, {0x16ab, 0x1101, WI_BUS_PCI_PLX, "GLPRISM2 WaveLAN"}, @@ -118,18 +118,19 @@ MODULE_DEPEND(wi, pci, 1, 1, 1); MODULE_DEPEND(wi, wlan, 1, 1, 1); static int -wi_pci_probe(dev) - device_t dev; +wi_pci_probe(device_t dev) { - struct wi_softc *sc; - int i; - - sc = device_get_softc(dev); - for(i=0; pci_ids[i].vendor != 0; i++) { - if ((pci_get_vendor(dev) == pci_ids[i].vendor) && - (pci_get_device(dev) == pci_ids[i].device)) { - sc->wi_bus_type = pci_ids[i].bus_type; - device_set_desc(dev, pci_ids[i].desc); + struct wi_softc *sc; + struct wi_pci_card *p; + uint16_t vendor, device; + + vendor = pci_get_vendor(dev); + device = pci_get_device(dev); + for (p = wi_pci_cards; p->vendor != NULL; p++) { + if (vendor == p->vendor && device == p->device) { + sc = device_get_softc(dev); + sc->wi_bus_type = p->bus_type; + device_set_desc(dev, p->desc); return (0); } } @@ -140,24 +141,14 @@ static int wi_pci_attach(device_t dev) { struct wi_softc *sc; - u_int32_t command, wanted; u_int16_t reg; int error; - int timeout; sc = device_get_softc(dev); - command = pci_read_config(dev, PCIR_COMMAND, 4); - wanted = PCIM_CMD_PORTEN|PCIM_CMD_MEMEN; - command |= wanted; - pci_write_config(dev, PCIR_COMMAND, command, 4); - command = pci_read_config(dev, PCIR_COMMAND, 4); - if ((command & wanted) != wanted) { - device_printf(dev, "wi_pci_attach() failed to enable pci!\n"); - return (ENXIO); - } - if (sc->wi_bus_type != WI_BUS_PCI_NATIVE) { + uint32_t command; + error = wi_alloc(dev, WI_PCI_IORES); if (error) return (error); @@ -207,6 +198,8 @@ wi_pci_attach(device_t dev) return (ENXIO); } } else { + int timeout; + error = wi_alloc(dev, WI_PCI_LMEMRES); if (error) return (error);