Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/dev/pcmcia Pullup 802.11 stuff (approved by jhawk)
details: https://anonhg.NetBSD.org/src/rev/f68dffcb74b6
branches: netbsd-1-5
changeset: 488618:f68dffcb74b6
user: onoe <onoe%NetBSD.org@localhost>
date: Fri Jul 21 18:54:18 2000 +0000
description:
Pullup 802.11 stuff (approved by jhawk)
- add WEP support for PRISM2 cards
syssrc/sys/dev/pcmcia/if_wi.c 1.25
syssrc/sys/dev/pcmcia/if_wi_ieee.h 1.5
diffstat:
sys/dev/pcmcia/if_wi.c | 91 ++++++++++++++++++++++++++++++++++++++++++++-
sys/dev/pcmcia/if_wi_ieee.h | 8 +++-
2 files changed, 97 insertions(+), 2 deletions(-)
diffs (141 lines):
diff -r 7e71d63dee9c -r f68dffcb74b6 sys/dev/pcmcia/if_wi.c
--- a/sys/dev/pcmcia/if_wi.c Fri Jul 21 18:52:09 2000 +0000
+++ b/sys/dev/pcmcia/if_wi.c Fri Jul 21 18:54:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wi.c,v 1.21.2.3 2000/07/21 18:52:10 onoe Exp $ */
+/* $NetBSD: if_wi.c,v 1.21.2.4 2000/07/21 18:54:18 onoe Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -773,6 +773,41 @@
{
u_int16_t *ptr;
int i, len, code;
+ struct wi_ltv_gen *oltv, p2ltv;
+
+ if (sc->sc_prism2) {
+ oltv = ltv;
+ switch (ltv->wi_type) {
+ case WI_RID_ENCRYPTION:
+ p2ltv.wi_type = WI_RID_P2_ENCRYPTION;
+ p2ltv.wi_len = 2;
+ ltv = &p2ltv;
+ break;
+ case WI_RID_TX_CRYPT_KEY:
+ p2ltv.wi_type = WI_RID_P2_TX_CRYPT_KEY;
+ p2ltv.wi_len = 2;
+ ltv = &p2ltv;
+ break;
+ case WI_RID_DEFLT_CRYPT_KEYS:
+ {
+ int error;
+ struct wi_ltv_str ws;
+ struct wi_ltv_keys *wk = (struct wi_ltv_keys *)ltv;
+
+ for (i = 0; i < 4; i++) {
+ ws.wi_len = 4;
+ ws.wi_type = WI_RID_P2_CRYPT_KEY0 + i;
+ error = wi_read_record(sc,
+ (struct wi_ltv_gen *)&ws);
+ if (error)
+ return error;
+ memcpy(&wk->wi_keys[i].wi_keydat, ws.wi_str, 5);
+ wk->wi_keys[i].wi_keylen = 5;
+ }
+ return 0;
+ }
+ }
+ }
/* Tell the NIC to enter record read mode. */
if (wi_cmd(sc, WI_CMD_ACCESS|WI_ACCESS_READ, ltv->wi_type))
@@ -802,6 +837,22 @@
for (i = 0; i < ltv->wi_len - 1; i++)
ptr[i] = CSR_READ_2(sc, WI_DATA1);
+ if (sc->sc_prism2) {
+ switch (code) {
+ case WI_RID_P2_ENCRYPTION:
+ oltv->wi_len = 2;
+ if (ltv->wi_val & 0x01)
+ oltv->wi_val = 1;
+ else
+ oltv->wi_val = 0;
+ break;
+ case WI_RID_P2_TX_CRYPT_KEY:
+ oltv->wi_len = 2;
+ oltv->wi_val = ltv->wi_val;
+ break;
+ }
+ }
+
return(0);
}
@@ -814,6 +865,44 @@
{
u_int16_t *ptr;
int i;
+ struct wi_ltv_gen p2ltv;
+
+ if (sc->sc_prism2) {
+ switch (ltv->wi_type) {
+ case WI_RID_ENCRYPTION:
+ p2ltv.wi_type = WI_RID_P2_ENCRYPTION;
+ p2ltv.wi_len = 2;
+ if (ltv->wi_val)
+ p2ltv.wi_val = 0x03;
+ else
+ p2ltv.wi_val = 0x90;
+ ltv = &p2ltv;
+ break;
+ case WI_RID_TX_CRYPT_KEY:
+ p2ltv.wi_type = WI_RID_P2_TX_CRYPT_KEY;
+ p2ltv.wi_len = 2;
+ p2ltv.wi_val = ltv->wi_val;
+ ltv = &p2ltv;
+ break;
+ case WI_RID_DEFLT_CRYPT_KEYS:
+ {
+ int error;
+ struct wi_ltv_str ws;
+ struct wi_ltv_keys *wk = (struct wi_ltv_keys *)ltv;
+ for (i = 0; i < 4; i++) {
+ ws.wi_len = 4;
+ ws.wi_type = WI_RID_P2_CRYPT_KEY0 + i;
+ memcpy(ws.wi_str, &wk->wi_keys[i].wi_keydat, 5);
+ ws.wi_str[5] = '\0';
+ error = wi_write_record(sc,
+ (struct wi_ltv_gen *)&ws);
+ if (error)
+ return error;
+ }
+ return 0;
+ }
+ }
+ }
if (wi_seek(sc, ltv->wi_type, 0, WI_BAP1))
return(EIO);
diff -r 7e71d63dee9c -r f68dffcb74b6 sys/dev/pcmcia/if_wi_ieee.h
--- a/sys/dev/pcmcia/if_wi_ieee.h Fri Jul 21 18:52:09 2000 +0000
+++ b/sys/dev/pcmcia/if_wi_ieee.h Fri Jul 21 18:54:18 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wi_ieee.h,v 1.4 2000/02/04 07:48:29 explorer Exp $ */
+/* $NetBSD: if_wi_ieee.h,v 1.4.6.1 2000/07/21 18:54:19 onoe Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -230,6 +230,12 @@
#define WI_RID_MCAST_PM_BUF 0xFC17 /* PM buffering of mcast */
#define WI_RID_ENCRYPTION 0xFC20 /* enable/disable WEP */
#define WI_RID_AUTHTYPE 0xFC21 /* specify authentication type */
+#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_P2_CRYPT_KEY2 0xFC26
+#define WI_RID_P2_CRYPT_KEY3 0xFC27
+#define WI_RID_P2_ENCRYPTION 0xFC28
/*
* Network parameters, dynamic configuration entities
Home |
Main Index |
Thread Index |
Old Index