Date: Sat, 02 Mar 2002 17:07:00 -0700 (MST) From: "M. Warner Losh" <imp@village.org> To: simond@irrelevant.org Cc: freebsd-mobile@FreeBSD.ORG Subject: Re: Ideas on getting a Symbol CF 802.11b card working Message-ID: <20020302.170700.133587807.imp@village.org> In-Reply-To: <20020302102616.GD355@irrelevant.org> References: <20020302102616.GD355@irrelevant.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20020302102616.GD355@irrelevant.org>
Simon Dick <simond@irrelevant.org> writes:
: Anyone got any idea how I can get this working using NEWCARD? I've
: included the dmesg -v output below if it helps.
:
: pccard0: CIS version PC Card Standard 5.0
: pccard0: CIS info: Symbol, Spectrum24 LA4100 Series WLAN PC Card, 1.00
: pccard0: Manufacturer code 0x26c, product 0x1
: pccard0: function 0: network adapter, ccr addr 3e0 mask 7
: pccard0: function 0, config table entry 1: I/O card; irq mask ffff; iomask 7, iospace 0-47; mwait_required rdy
:
: (If it doesn't work, I'm not all that bothered, I'm only trying it in
: my laptop to see if it worked or not)
You might try my current set of diffs for the wi driver.
Warner
Index: if_wi.c
===================================================================
RCS file: /cache/ncvs/src/sys/dev/wi/if_wi.c,v
retrieving revision 1.76
diff -u -r1.76 if_wi.c
--- if_wi.c 2 Mar 2002 00:06:23 -0000 1.76
+++ if_wi.c 3 Mar 2002 00:04:26 -0000
@@ -129,55 +129,53 @@
*/
#define LE16TOH(a) ((a) = le16toh((a)))
-static void wi_intr __P((void *));
-static void wi_reset __P((struct wi_softc *));
-static int wi_ioctl __P((struct ifnet *, u_long, caddr_t));
-static void wi_init __P((void *));
-static void wi_start __P((struct ifnet *));
-static void wi_stop __P((struct wi_softc *));
-static void wi_watchdog __P((struct ifnet *));
-static void wi_rxeof __P((struct wi_softc *));
-static void wi_txeof __P((struct wi_softc *, int));
-static void wi_update_stats __P((struct wi_softc *));
-static void wi_setmulti __P((struct wi_softc *));
-
-static int wi_cmd __P((struct wi_softc *, int, int));
-static int wi_read_record __P((struct wi_softc *, struct wi_ltv_gen *));
-static int wi_write_record __P((struct wi_softc *, struct wi_ltv_gen *));
-static int wi_read_data __P((struct wi_softc *, int,
- int, caddr_t, int));
-static int wi_write_data __P((struct wi_softc *, int,
- int, caddr_t, int));
-static int wi_seek __P((struct wi_softc *, int, int, int));
-static int wi_alloc_nicmem __P((struct wi_softc *, int, int *));
-static void wi_inquire __P((void *));
-static void wi_setdef __P((struct wi_softc *, struct wi_req *));
-static int wi_mgmt_xmit __P((struct wi_softc *, caddr_t, int));
+static void wi_intr(void *);
+static void wi_reset(struct wi_softc *);
+static int wi_ioctl(struct ifnet *, u_long, caddr_t);
+static void wi_init(void *);
+static void wi_start(struct ifnet *);
+static void wi_stop(struct wi_softc *);
+static void wi_watchdog(struct ifnet *);
+static void wi_rxeof(struct wi_softc *);
+static void wi_txeof(struct wi_softc *, int);
+static void wi_update_stats(struct wi_softc *);
+static void wi_setmulti(struct wi_softc *);
+
+static int wi_cmd(struct wi_softc *, int, int);
+static int wi_read_record(struct wi_softc *, struct wi_ltv_gen *);
+static int wi_write_record(struct wi_softc *, struct wi_ltv_gen *);
+static int wi_read_data(struct wi_softc *, int, int, caddr_t, int);
+static int wi_write_data(struct wi_softc *, int, int, caddr_t, int);
+static int wi_seek(struct wi_softc *, int, int, int);
+static int wi_alloc_nicmem(struct wi_softc *, int, int *);
+static void wi_inquire(void *);
+static void wi_setdef(struct wi_softc *, struct wi_req *);
+static int wi_mgmt_xmit(struct wi_softc *, caddr_t, int);
#ifdef WICACHE
static
-void wi_cache_store __P((struct wi_softc *, struct ether_header *,
- struct mbuf *, unsigned short));
+void wi_cache_store (struct wi_softc *, struct ether_header *,
+ struct mbuf *, unsigned short);
#endif
-static int wi_generic_attach __P((device_t));
-static int wi_pccard_match __P((device_t));
-static int wi_pccard_probe __P((device_t));
-static int wi_pccard_attach __P((device_t));
+static int wi_generic_attach(device_t);
+static int wi_pccard_match(device_t);
+static int wi_pccard_probe(device_t);
+static int wi_pccard_attach(device_t);
#if NPCI > 0
-static int wi_pci_probe __P((device_t));
-static int wi_pci_attach __P((device_t));
+static int wi_pci_probe(device_t);
+static int wi_pci_attach(device_t);
#endif
-static int wi_pccard_detach __P((device_t));
-static void wi_shutdown __P((device_t));
+static int wi_pccard_detach(device_t);
+static void wi_shutdown(device_t);
-static int wi_alloc __P((device_t, int));
-static void wi_free __P((device_t));
+static int wi_alloc(device_t, int);
+static void wi_free(device_t);
-static int wi_get_cur_ssid __P((struct wi_softc *, char *, int *));
-static void wi_get_id __P((struct wi_softc *, device_t));
-static int wi_media_change __P((struct ifnet *));
-static void wi_media_status __P((struct ifnet *, struct ifmediareq *));
+static int wi_get_cur_ssid(struct wi_softc *, char *, int *);
+static void wi_get_id(struct wi_softc *, device_t);
+static int wi_media_change(struct ifnet *);
+static void wi_media_status(struct ifnet *, struct ifmediareq *);
static device_method_t wi_pccard_methods[] = {
/* Device interface */
@@ -252,10 +250,12 @@
PCMCIA_CARD(ELSA, XI300_IEEE, 0),
PCMCIA_CARD(ELSA, XI800_IEEE, 0),
PCMCIA_CARD(EMTAC, WLAN, 0),
+ PCMCIA_CARD(ERICSSON, WIRELESSLAN, 0),
PCMCIA_CARD(GEMTEK, WLAN, 0),
PCMCIA_CARD(INTEL, PRO_WLAN_2011, 0),
PCMCIA_CARD(INTERSIL, PRISM2, 0),
PCMCIA_CARD(IODATA2, WNB11PCM, 0),
+ /* Now that we do PRISM detection, I don't think we need these - imp */
PCMCIA_CARD2(LUCENT, WAVELAN_IEEE, NANOSPEED_PRISM2, 0),
PCMCIA_CARD2(LUCENT, WAVELAN_IEEE, NEC_CMZ_RT_WP, 0),
PCMCIA_CARD2(LUCENT, WAVELAN_IEEE, NTT_ME_WLAN, 0),
@@ -264,13 +264,14 @@
PCMCIA_CARD(LUCENT, WAVELAN_IEEE, 0),
PCMCIA_CARD(LINKSYS2, IWN, 0),
PCMCIA_CARD(SAMSUNG, SWL_2000N, 0),
+ PCMCIA_CARD(SIMPLETECH, SPECTRUM24_ALT, 0),
+ PCMCIA_CARD(SOCKET, LP_WLAN_CF, 0),
PCMCIA_CARD(TDK, LAK_CD011WL, 0),
{ NULL }
};
static int
-wi_pccard_match(dev)
- device_t dev;
+wi_pccard_match(device_t dev)
{
const struct pccard_product *pp;
@@ -283,8 +284,7 @@
}
static int
-wi_pccard_probe(dev)
- device_t dev;
+wi_pccard_probe(device_t dev)
{
struct wi_softc *sc;
int error;
@@ -308,8 +308,7 @@
#if NPCI > 0
static int
-wi_pci_probe(dev)
- device_t dev;
+wi_pci_probe(device_t dev)
{
struct wi_softc *sc;
int i;
@@ -329,8 +328,7 @@
#endif
static int
-wi_pccard_detach(dev)
- device_t dev;
+wi_pccard_detach(device_t dev)
{
struct wi_softc *sc;
struct ifnet *ifp;
@@ -571,6 +569,8 @@
sc->wi_create_ibss = WI_DEFAULT_CREATE_IBSS;
sc->wi_pm_enabled = WI_DEFAULT_PM_ENABLED;
sc->wi_max_sleep = WI_DEFAULT_MAX_SLEEP;
+ sc->wi_roaming = WI_DEFAULT_ROAMING;
+ sc->wi_authtype = WI_DEFAULT_AUTHTYPE;
/*
* Read the default channel from the NIC. This may vary
@@ -636,9 +636,7 @@
}
static void
-wi_get_id(sc, dev)
- struct wi_softc *sc;
- device_t dev;
+wi_get_id(struct wi_softc *sc, device_t dev)
{
struct wi_ltv_ver ver;
@@ -710,8 +708,7 @@
}
static void
-wi_rxeof(sc)
- struct wi_softc *sc;
+wi_rxeof(struct wi_softc *sc)
{
struct ifnet *ifp;
struct ether_header *eh;
@@ -822,9 +819,7 @@
}
static void
-wi_txeof(sc, status)
- struct wi_softc *sc;
- int status;
+wi_txeof(struct wi_softc *sc, int status)
{
struct ifnet *ifp;
@@ -842,8 +837,7 @@
}
void
-wi_inquire(xsc)
- void *xsc;
+wi_inquire(void *xsc)
{
struct wi_softc *sc;
struct ifnet *ifp;
@@ -863,8 +857,7 @@
}
void
-wi_update_stats(sc)
- struct wi_softc *sc;
+wi_update_stats(struct wi_softc *sc)
{
struct wi_ltv_gen gen;
u_int16_t id;
@@ -903,8 +896,7 @@
}
static void
-wi_intr(xsc)
- void *xsc;
+wi_intr(void *xsc)
{
struct wi_softc *sc = xsc;
struct ifnet *ifp;
@@ -973,10 +965,7 @@
}
static int
-wi_cmd(sc, cmd, val)
- struct wi_softc *sc;
- int cmd;
- int val;
+wi_cmd(struct wi_softc *sc, int cmd, int val)
{
int i, s = 0;
@@ -1028,8 +1017,7 @@
}
static void
-wi_reset(sc)
- struct wi_softc *sc;
+wi_reset(struct wi_softc *sc)
{
#define WI_INIT_TRIES 5
int i;
@@ -1055,9 +1043,7 @@
* Read an LTV record from the NIC.
*/
static int
-wi_read_record(sc, ltv)
- struct wi_softc *sc;
- struct wi_ltv_gen *ltv;
+wi_read_record(struct wi_softc *sc, struct wi_ltv_gen *ltv)
{
u_int16_t *ptr;
int i, len, code;
@@ -1133,6 +1119,13 @@
oltv->wi_len = 2;
oltv->wi_val = ltv->wi_val;
break;
+ case WI_RID_AUTH_CNTL:
+ oltv->wi_len = 2;
+ if (le16toh(ltv->wi_val) & 0x01)
+ oltv->wi_val = htole16(1);
+ else if (le16toh(ltv->wi_val) & 0x02)
+ oltv->wi_val = htole16(2);
+ break;
}
}
@@ -1143,9 +1136,7 @@
* Same as read, except we inject data instead of reading it.
*/
static int
-wi_write_record(sc, ltv)
- struct wi_softc *sc;
- struct wi_ltv_gen *ltv;
+wi_write_record(struct wi_softc *sc, struct wi_ltv_gen *ltv)
{
u_int16_t *ptr;
int i;
@@ -1206,6 +1197,15 @@
}
return 0;
}
+ case WI_RID_AUTH_CNTL:
+ p2ltv.wi_type = WI_RID_AUTH_CNTL;
+ p2ltv.wi_len = 2;
+ if (le16toh(ltv->wi_val) == 1)
+ p2ltv.wi_val = htole16(0x01);
+ else if (le16toh(ltv->wi_val) == 2)
+ p2ltv.wi_val = htole16(0x02);
+ ltv = &p2ltv;
+ break;
}
}
@@ -1226,9 +1226,7 @@
}
static int
-wi_seek(sc, id, off, chan)
- struct wi_softc *sc;
- int id, off, chan;
+wi_seek(struct wi_softc *sc, int id, int off, int chan)
{
int i;
int selreg, offreg;
@@ -1268,11 +1266,7 @@
}
static int
-wi_read_data(sc, id, off, buf, len)
- struct wi_softc *sc;
- int id, off;
- caddr_t buf;
- int len;
+wi_read_data(struct wi_softc *sc, int id, int off, caddr_t buf, int len)
{
int i;
u_int16_t *ptr;
@@ -1300,11 +1294,7 @@
* we expect them, we preform the transfer over again.
*/
static int
-wi_write_data(sc, id, off, buf, len)
- struct wi_softc *sc;
- int id, off;
- caddr_t buf;
- int len;
+wi_write_data(struct wi_softc *sc, int id, int off, caddr_t buf, int len)
{
int i;
u_int16_t *ptr;
@@ -1346,10 +1336,7 @@
* it out.
*/
static int
-wi_alloc_nicmem(sc, len, id)
- struct wi_softc *sc;
- int len;
- int *id;
+wi_alloc_nicmem(struct wi_softc *sc, int len, int *id)
{
int i;
@@ -1385,8 +1372,7 @@
}
static void
-wi_setmulti(sc)
- struct wi_softc *sc;
+wi_setmulti(struct wi_softc *sc)
{
struct ifnet *ifp;
int i = 0;
@@ -1425,9 +1411,7 @@
}
static void
-wi_setdef(sc, wreq)
- struct wi_softc *sc;
- struct wi_req *wreq;
+wi_setdef(struct wi_softc *sc, struct wi_req *wreq)
{
struct sockaddr_dl *sdl;
struct ifaddr *ifa;
@@ -1444,25 +1428,25 @@
bcopy((char *)&wreq->wi_val, LLADDR(sdl), ETHER_ADDR_LEN);
break;
case WI_RID_PORTTYPE:
- sc->wi_ptype = wreq->wi_val[0];
+ sc->wi_ptype = le16toh(wreq->wi_val[0]);
break;
case WI_RID_TX_RATE:
- sc->wi_tx_rate = wreq->wi_val[0];
+ sc->wi_tx_rate = le16toh(wreq->wi_val[0]);
break;
case WI_RID_MAX_DATALEN:
- sc->wi_max_data_len = wreq->wi_val[0];
+ sc->wi_max_data_len = le16toh(wreq->wi_val[0]);
break;
case WI_RID_RTS_THRESH:
- sc->wi_rts_thresh = wreq->wi_val[0];
+ sc->wi_rts_thresh = le16toh(wreq->wi_val[0]);
break;
case WI_RID_SYSTEM_SCALE:
- sc->wi_ap_density = wreq->wi_val[0];
+ sc->wi_ap_density = le16toh(wreq->wi_val[0]);
break;
case WI_RID_CREATE_IBSS:
- sc->wi_create_ibss = wreq->wi_val[0];
+ sc->wi_create_ibss = le16toh(wreq->wi_val[0]);
break;
case WI_RID_OWN_CHNL:
- sc->wi_channel = wreq->wi_val[0];
+ sc->wi_channel = le16toh(wreq->wi_val[0]);
break;
case WI_RID_NODENAME:
bzero(sc->wi_node_name, sizeof(sc->wi_node_name));
@@ -1477,16 +1461,25 @@
bcopy((char *)&wreq->wi_val[1], sc->wi_ibss_name, 30);
break;
case WI_RID_PM_ENABLED:
- sc->wi_pm_enabled = wreq->wi_val[0];
+ sc->wi_pm_enabled = le16toh(wreq->wi_val[0]);
+ break;
+ case WI_RID_MICROWAVE_OVEN:
+ sc->wi_mor_enabled = le16toh(wreq->wi_val[0]);
break;
case WI_RID_MAX_SLEEP:
- sc->wi_max_sleep = wreq->wi_val[0];
+ sc->wi_max_sleep = le16toh(wreq->wi_val[0]);
+ break;
+ case WI_RID_AUTH_CNTL:
+ sc->wi_authtype = le16toh(wreq->wi_val[0]);
+ break;
+ case WI_RID_ROAMING_MODE:
+ sc->wi_roaming = le16toh(wreq->wi_val[0]);
break;
case WI_RID_ENCRYPTION:
- sc->wi_use_wep = wreq->wi_val[0];
+ sc->wi_use_wep = le16toh(wreq->wi_val[0]);
break;
case WI_RID_TX_CRYPT_KEY:
- sc->wi_tx_key = wreq->wi_val[0];
+ sc->wi_tx_key = le16toh(wreq->wi_val[0]);
break;
case WI_RID_DEFLT_CRYPT_KEYS:
bcopy((char *)wreq, (char *)&sc->wi_keys,
@@ -1503,10 +1496,7 @@
}
static int
-wi_ioctl(ifp, command, data)
- struct ifnet *ifp;
- u_long command;
- caddr_t data;
+wi_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
{
int error = 0;
int len;
@@ -1827,8 +1817,7 @@
}
static void
-wi_init(xsc)
- void *xsc;
+wi_init(void *xsc)
{
struct wi_softc *sc = xsc;
struct ifnet *ifp = &sc->arpcom.ac_if;
@@ -1871,6 +1860,9 @@
/* Power Managment Max Sleep */
WI_SETVAL(WI_RID_MAX_SLEEP, sc->wi_max_sleep);
+ /* Roaming type */
+ WI_SETVAL(WI_RID_ROAMING_MODE, sc->wi_roaming);
+
/* Specify the IBSS name */
WI_SETSTR(WI_RID_OWN_SSID, sc->wi_ibss_name);
@@ -1897,6 +1889,22 @@
sc->wi_keys.wi_len = (sizeof(struct wi_ltv_keys) / 2) + 1;
sc->wi_keys.wi_type = WI_RID_DEFLT_CRYPT_KEYS;
wi_write_record(sc, (struct wi_ltv_gen *)&sc->wi_keys);
+ if (sc->wi_prism2 && sc->wi_use_wep) {
+ /*
+ * ONLY HWB3163 EVAL-CARD Firmware version
+ * less than 0.8 variant3
+ *
+ * If promiscuous mode disable, Prism2 chip
+ * does not work with WEP .
+ * It is under investigation for details.
+ * (ichiro@netbsd.org)
+ */
+ if (sc->wi_prism2_ver < 83 ) {
+ /* firm ver < 0.8 variant 3 */
+ WI_SETVAL(WI_RID_PROMISC, 1);
+ }
+ WI_SETVAL(WI_RID_AUTH_CNTL, sc->wi_authtype);
+ }
}
/* Initialize promisc mode. */
@@ -1910,7 +1918,7 @@
wi_setmulti(sc);
/* Enable desired port */
- wi_cmd(sc, WI_CMD_ENABLE|sc->wi_portnum, 0);
+ wi_cmd(sc, WI_CMD_ENABLE | sc->wi_portnum, 0);
if (wi_alloc_nicmem(sc, ETHER_MAX_LEN + sizeof(struct wi_frame) + 8, &id))
device_printf(sc->dev, "tx buffer allocation failed\n");
@@ -1933,8 +1941,7 @@
}
static void
-wi_start(ifp)
- struct ifnet *ifp;
+wi_start(struct ifnet *ifp)
{
struct wi_softc *sc;
struct mbuf *m0;
@@ -2030,10 +2037,7 @@
}
static int
-wi_mgmt_xmit(sc, data, len)
- struct wi_softc *sc;
- caddr_t data;
- int len;
+wi_mgmt_xmit(struct wi_softc *sc, caddr_t data, int len)
{
struct wi_frame tx_frame;
int id;
@@ -2068,8 +2072,7 @@
}
static void
-wi_stop(sc)
- struct wi_softc *sc;
+wi_stop(struct wi_softc *sc)
{
struct ifnet *ifp;
@@ -2101,8 +2104,7 @@
}
static void
-wi_watchdog(ifp)
- struct ifnet *ifp;
+wi_watchdog(struct ifnet *ifp)
{
struct wi_softc *sc;
@@ -2118,9 +2120,7 @@
}
static int
-wi_alloc(dev, rid)
- device_t dev;
- int rid;
+wi_alloc(device_t dev, int rid)
{
struct wi_softc *sc = device_get_softc(dev);
@@ -2192,8 +2192,7 @@
}
static void
-wi_shutdown(dev)
- device_t dev;
+wi_shutdown(device_t dev)
{
struct wi_softc *sc;
@@ -2411,10 +2410,7 @@
#endif
static int
-wi_get_cur_ssid(sc, ssid, len)
- struct wi_softc *sc;
- char *ssid;
- int *len;
+wi_get_cur_ssid(struct wi_softc *sc, char *ssid, int *len)
{
int error = 0;
struct wi_req wreq;
@@ -2464,8 +2460,7 @@
}
static int
-wi_media_change(ifp)
- struct ifnet *ifp;
+wi_media_change(struct ifnet *ifp)
{
struct wi_softc *sc = ifp->if_softc;
int otype = sc->wi_ptype;
@@ -2502,9 +2497,7 @@
}
static void
-wi_media_status(ifp, imr)
- struct ifnet *ifp;
- struct ifmediareq *imr;
+wi_media_status(struct ifnet *ifp, struct ifmediareq *imr)
{
struct wi_req wreq;
struct wi_softc *sc = ifp->if_softc;
Index: if_wireg.h
===================================================================
RCS file: /cache/ncvs/src/sys/dev/wi/if_wireg.h,v
retrieving revision 1.18
diff -u -r1.18 if_wireg.h
--- if_wireg.h 12 Feb 2002 17:52:11 -0000 1.18
+++ if_wireg.h 13 Feb 2002 18:10:27 -0000
@@ -69,9 +69,11 @@
#define WI_RID_P2_TX_CRYPT_KEY 0xFC23
#define WI_RID_P2_CRYPT_KEY0 0xFC24
#define WI_RID_P2_CRYPT_KEY1 0xFC25
+#define WI_RID_MICROWAVE_OVEN 0xFC25
#define WI_RID_P2_CRYPT_KEY2 0xFC26
#define WI_RID_P2_CRYPT_KEY3 0xFC27
#define WI_RID_P2_ENCRYPTION 0xFC28
+#define WI_RID_ROAMING_MODE 0xFC2D
#define WI_RID_CUR_TX_RATE 0xFD44 /* current TX rate */
struct wi_key {
u_int16_t wi_keylen;
@@ -118,7 +120,11 @@
u_int16_t wi_create_ibss;
u_int16_t wi_channel;
u_int16_t wi_pm_enabled;
+ u_int16_t wi_mor_enabled;
u_int16_t wi_max_sleep;
+ u_int16_t wi_authtype;
+ u_int16_t wi_roaming;
+
char wi_node_name[32];
char wi_net_name[32];
char wi_ibss_name[32];
@@ -185,9 +191,23 @@
#define WI_DEFAULT_MAX_SLEEP 100
-#define WI_DEFAULT_NODENAME "FreeBSD WaveLAN/IEEE node"
+#define WI_DEFAULT_ROAMING 1
+
+#define WI_DEFAULT_AUTHTYPE 1
+
+#ifdef __NetBSD__
+#define OS_STRING_NAME "NetBSD"
+#endif
+#ifdef __FreeBSD__
+#define OS_STRING_NAME "FreeBSD"
+#endif
+#ifdef __OpenBSD__
+#define OS_STRING_NAME "OpenBSD"
+#endif
+
+#define WI_DEFAULT_NODENAME OS_STRING_NAME " WaveLAN/IEEE node"
-#define WI_DEFAULT_IBSS "FreeBSD IBSS"
+#define WI_DEFAULT_IBSS OS_STRING_NAME " IBSS"
#define WI_DEFAULT_CHAN 3
@@ -601,6 +621,8 @@
u_int16_t wi_type;
u_int16_t wi_nodename[17];
};
+
+#define WI_RID_AUTH_CNTL 0xFC2A
/*
* Multicast addresses to be put in filter. We're
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?20020302.170700.133587807.imp>
