Date: Thu, 23 Aug 2001 19:19:21 -0700 From: Nick Sayer <nsayer@quack.kfu.com> To: Warner Losh <imp@harmony.village.org>, freebsd-mobile@freebsd.org Subject: Re: Netgear MA301 and other PIX based PrismII PCI adapters Message-ID: <3B85B9A9.2010809@quack.kfu.com> References: <3B857C01.10003@quack.kfu.com> <3220.216.101.175.66.998594555.squirrel@medusa.kfu.com> <200108230750.f7N7o9W82174@harmony.village.org> <200108232045.f7NKjWW88031@harmony.village.org> <200108232158.f7NLwIW88829@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------030209020904090207020500 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Will anyone in a position to do so please test this patch against RELENG_4 (or alternatively the driver now in -current) with an MA301 or any other Prism II based PCCard in a PLX based PCI adapter? I have tried it with an MA301, but more testing would be best. --------------030209020904090207020500 Content-Type: text/plain; name="ma301.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ma301.patch" Index: if_wi.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/Attic/if_wi.c,v retrieving revision 1.18.2.10 diff -u -r1.18.2.10 if_wi.c --- if_wi.c 2001/07/04 00:12:37 1.18.2.10 +++ if_wi.c 2001/08/24 02:16:36 @@ -197,6 +197,15 @@ sizeof(struct wi_softc) }; +static struct { + unsigned int vendor,device; + char *desc; +} pci_ids[] = { + {0x1638, 0x1100, "PRISM2STA PCI WaveLAN/IEEE 802.11"}, + {0x1385, 0x4100, "Netgear MA301 PCI IEEE 802.11b"}, + {0, 0, NULL} +}; + static devclass_t wi_pccard_devclass; static devclass_t wi_pci_devclass; @@ -233,14 +242,16 @@ device_t dev; { struct wi_softc *sc; + int i; sc = device_get_softc(dev); - if ((pci_get_vendor(dev) == WI_PCI_VENDOR_EUMITCOM) && - (pci_get_device(dev) == WI_PCI_DEVICE_PRISM2STA)) { + 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_prism2 = 1; - device_set_desc(dev, - "PRISM2STA PCI WaveLAN/IEEE 802.11"); + device_set_desc(dev, pci_ids[i].desc); return (0); + } } return(ENXIO); } @@ -346,6 +357,20 @@ CSR_WRITE_2(sc, WI_INT_EN, 0); CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF); + /* We have to do a magic PLX poke to enable interrupts */ + sc->local_rid = WI_PCI_LOCALRES; + sc->local = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->local_rid, + 0, ~0, 1, RF_ACTIVE); + sc->wi_localtag = rman_get_bustag(sc->local); + sc->wi_localhandle = rman_get_bushandle(sc->local); + command = bus_space_read_4(sc->wi_localtag, sc->wi_localhandle, + WI_LOCAL_INTCSR); + command |= WI_LOCAL_INTEN; + bus_space_write_4(sc->wi_localtag, sc->wi_localhandle, + WI_LOCAL_INTCSR, command); + bus_release_resource(dev, SYS_RES_IOPORT, sc->local_rid, sc->local); + sc->local = NULL; + sc->mem_rid = WI_PCI_MEMRES; sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &sc->mem_rid, 0, ~0, 1, RF_ACTIVE); @@ -365,6 +390,13 @@ */ CSM_WRITE_1(sc, WI_COR_OFFSET, WI_COR_VALUE); reg = CSM_READ_1(sc, WI_COR_OFFSET); + if (reg != WI_COR_VALUE) { + device_printf(dev, + "CSM_READ_1(WI_COR_OFFSET) " + "wanted %d, got %d\n", WI_COR_VALUE, reg); + wi_free(dev); + return (ENXIO); + } CSR_WRITE_2(sc, WI_HFA384X_SWSUPPORT0_OFF, WI_PRISM2STA_MAGIC); reg = CSR_READ_2(sc, WI_HFA384X_SWSUPPORT0_OFF); Index: if_wireg.h =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/Attic/if_wireg.h,v retrieving revision 1.8.2.1 diff -u -r1.8.2.1 if_wireg.h --- if_wireg.h 2001/04/22 00:50:49 1.8.2.1 +++ if_wireg.h 2001/08/24 02:16:36 @@ -90,12 +90,16 @@ struct ifmedia ifmedia; device_t dev; int wi_unit; + struct resource * local; + int local_rid; struct resource * iobase; int iobase_rid; struct resource * irq; int irq_rid; struct resource * mem; int mem_rid; + bus_space_handle_t wi_localhandle; + bus_space_tag_t wi_localtag; bus_space_handle_t wi_bhandle; bus_space_tag_t wi_btag; bus_space_handle_t wi_bmemhandle; @@ -143,11 +147,12 @@ #define WI_PORT4 4 #define WI_PORT5 5 -#define WI_PCI_MEMRES 0x18 -#define WI_PCI_IORES 0x1C +#define WI_PCI_LOCALRES 0x14 /* The PLX chip's local registers */ +#define WI_PCI_MEMRES 0x18 /* The PCCard's attribute memory */ +#define WI_PCI_IORES 0x1C /* The PCCard's I/O space */ -#define WI_PCI_VENDOR_EUMITCOM 0x1638 -#define WI_PCI_DEVICE_PRISM2STA 0x1100 +#define WI_LOCAL_INTCSR 0x4c +#define WI_LOCAL_INTEN 0x40 /* poke this into INTCSR */ #define WI_HFA384X_SWSUPPORT0_OFF 0x28 #define WI_PRISM2STA_MAGIC 0x4A2D --------------030209020904090207020500-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B85B9A9.2010809>