|
Lines 162-170
Link Here
|
| 162 |
struct mbuf *, unsigned short)); |
162 |
struct mbuf *, unsigned short)); |
| 163 |
#endif |
163 |
#endif |
| 164 |
|
164 |
|
|
|
165 |
static void an_dump_record __P((struct an_softc *,struct an_ltv_gen *, |
| 166 |
char *)); |
| 167 |
|
| 165 |
static int an_media_change __P((struct ifnet *)); |
168 |
static int an_media_change __P((struct ifnet *)); |
| 166 |
static void an_media_status __P((struct ifnet *, struct ifmediareq *)); |
169 |
static void an_media_status __P((struct ifnet *, struct ifmediareq *)); |
| 167 |
|
170 |
|
|
|
171 |
static int an_dump=0; |
| 172 |
static char an_conf[256]; |
| 168 |
/* |
173 |
/* |
| 169 |
* We probe for an Aironet 4500/4800 card by attempting to |
174 |
* We probe for an Aironet 4500/4800 card by attempting to |
| 170 |
* read the default SSID list. On reset, the first entry in |
175 |
* read the default SSID list. On reset, the first entry in |
|
Lines 511-517
Link Here
|
| 511 |
int status; |
516 |
int status; |
| 512 |
{ |
517 |
{ |
| 513 |
struct ifnet *ifp; |
518 |
struct ifnet *ifp; |
| 514 |
int id; |
519 |
int id, i; |
| 515 |
|
520 |
|
| 516 |
/* TX DONE enable lan monitor DJA |
521 |
/* TX DONE enable lan monitor DJA |
| 517 |
an_enable_sniff(); |
522 |
an_enable_sniff(); |
|
Lines 529-540
Link Here
|
| 529 |
} else |
534 |
} else |
| 530 |
ifp->if_opackets++; |
535 |
ifp->if_opackets++; |
| 531 |
|
536 |
|
| 532 |
if (id != sc->an_rdata.an_tx_ring[sc->an_rdata.an_tx_cons]) |
537 |
for (i = 0; i < AN_TX_RING_CNT; i++ ) { |
| 533 |
printf("an%d: id mismatch: expected %x, got %x\n", |
538 |
if (id == sc->an_rdata.an_tx_ring[i]) { |
| 534 |
sc->an_unit, |
539 |
sc->an_rdata.an_tx_ring[i] = 0; |
| 535 |
sc->an_rdata.an_tx_ring[sc->an_rdata.an_tx_cons], id); |
540 |
break; |
|
|
541 |
} |
| 542 |
} |
| 536 |
|
543 |
|
| 537 |
sc->an_rdata.an_tx_ring[sc->an_rdata.an_tx_cons] = 0; |
|
|
| 538 |
AN_INC(sc->an_rdata.an_tx_cons, AN_TX_RING_CNT); |
544 |
AN_INC(sc->an_rdata.an_tx_cons, AN_TX_RING_CNT); |
| 539 |
|
545 |
|
| 540 |
return; |
546 |
return; |
|
Lines 720-728
Link Here
|
| 720 |
struct an_ltv_gen *ltv; |
726 |
struct an_ltv_gen *ltv; |
| 721 |
{ |
727 |
{ |
| 722 |
u_int16_t *ptr; |
728 |
u_int16_t *ptr; |
|
|
729 |
u_int8_t *ptr2; |
| 723 |
int i, len; |
730 |
int i, len; |
| 724 |
|
731 |
|
| 725 |
if (ltv->an_len == 0 || ltv->an_type == 0) |
732 |
if (ltv->an_len <= 2 || ltv->an_type == 0) |
| 726 |
return(EINVAL); |
733 |
return(EINVAL); |
| 727 |
|
734 |
|
| 728 |
/* Tell the NIC to enter record read mode. */ |
735 |
/* Tell the NIC to enter record read mode. */ |
|
Lines 741-760
Link Here
|
| 741 |
* Read the length and record type and make sure they |
748 |
* Read the length and record type and make sure they |
| 742 |
* match what we expect (this verifies that we have enough |
749 |
* match what we expect (this verifies that we have enough |
| 743 |
* room to hold all of the returned data). |
750 |
* room to hold all of the returned data). |
|
|
751 |
* Length includes type but not length. |
| 744 |
*/ |
752 |
*/ |
| 745 |
len = CSR_READ_2(sc, AN_DATA1); |
753 |
len = CSR_READ_2(sc, AN_DATA1); |
| 746 |
if (len > (ltv->an_len - 2)) { |
754 |
if (len > (ltv->an_len-2)) { |
| 747 |
printf("an%d: record length mismatch -- expected %d, " |
755 |
printf("an%d: record length mismatch -- expected %d, " |
| 748 |
"got %d\n", sc->an_unit, (ltv->an_len - 2), len); |
756 |
"got %d for Rid %x\n", sc->an_unit, |
| 749 |
len = (ltv->an_len - 2); |
757 |
ltv->an_len-2, len, ltv->an_type); |
|
|
758 |
len = ltv->an_len -2; |
| 759 |
}else{ |
| 760 |
ltv->an_len = len +2; |
| 750 |
} |
761 |
} |
| 751 |
|
762 |
|
| 752 |
ltv->an_len = len; |
|
|
| 753 |
|
| 754 |
/* Now read the data. */ |
763 |
/* Now read the data. */ |
|
|
764 |
len -= 2; /* skip the type */ |
| 755 |
ptr = <v->an_val; |
765 |
ptr = <v->an_val; |
| 756 |
for (i = 0; i < (ltv->an_len - 2) >> 1; i++) |
766 |
for (i = len; i > 1; i-=2) |
| 757 |
ptr[i] = CSR_READ_2(sc, AN_DATA1); |
767 |
*ptr++ = CSR_READ_2(sc, AN_DATA1); |
|
|
768 |
if (i){ |
| 769 |
ptr2 = (u_int8_t *)ptr; |
| 770 |
*ptr2 = CSR_READ_1(sc, AN_DATA1); |
| 771 |
} |
| 772 |
if (an_dump) |
| 773 |
an_dump_record(sc, ltv, "Read"); |
| 758 |
|
774 |
|
| 759 |
return(0); |
775 |
return(0); |
| 760 |
} |
776 |
} |
|
Lines 767-785
Link Here
|
| 767 |
struct an_ltv_gen *ltv; |
783 |
struct an_ltv_gen *ltv; |
| 768 |
{ |
784 |
{ |
| 769 |
u_int16_t *ptr; |
785 |
u_int16_t *ptr; |
| 770 |
int i; |
786 |
u_int8_t *ptr2; |
|
|
787 |
int i, len; |
| 788 |
|
| 789 |
if (an_dump) |
| 790 |
an_dump_record(sc, ltv, "Write"); |
| 771 |
|
791 |
|
| 772 |
if (an_cmd(sc, AN_CMD_ACCESS|AN_ACCESS_READ, ltv->an_type)) |
792 |
if (an_cmd(sc, AN_CMD_ACCESS|AN_ACCESS_READ, ltv->an_type)) |
| 773 |
return(EIO); |
793 |
return(EIO); |
| 774 |
|
794 |
|
| 775 |
if (an_seek(sc, ltv->an_type, 0, AN_BAP1)) |
795 |
if (an_seek(sc, ltv->an_type, 0, AN_BAP1)) |
| 776 |
return(EIO); |
796 |
return(EIO); |
| 777 |
|
797 |
|
| 778 |
CSR_WRITE_2(sc, AN_DATA1, ltv->an_len-2); |
798 |
/* |
|
|
799 |
* Length includes type but not length. |
| 800 |
*/ |
| 801 |
len = ltv->an_len-2; |
| 802 |
CSR_WRITE_2(sc, AN_DATA1, len); |
| 779 |
|
803 |
|
|
|
804 |
len -= 2; /* skip the type */ |
| 780 |
ptr = <v->an_val; |
805 |
ptr = <v->an_val; |
| 781 |
for (i = 0; i < (ltv->an_len - 4) >> 1; i++) |
806 |
for (i=len; i > 1; i-=2) |
| 782 |
CSR_WRITE_2(sc, AN_DATA1, ptr[i]); |
807 |
CSR_WRITE_2(sc, AN_DATA1, *ptr++); |
|
|
808 |
if (i){ |
| 809 |
ptr2 = (u_int8_t *)ptr; |
| 810 |
CSR_WRITE_1(sc, AN_DATA0, *ptr2); |
| 811 |
} |
| 783 |
|
812 |
|
| 784 |
if (an_cmd(sc, AN_CMD_ACCESS|AN_ACCESS_WRITE, ltv->an_type)) |
813 |
if (an_cmd(sc, AN_CMD_ACCESS|AN_ACCESS_WRITE, ltv->an_type)) |
| 785 |
return(EIO); |
814 |
return(EIO); |
|
Lines 787-792
Link Here
|
| 787 |
return(0); |
816 |
return(0); |
| 788 |
} |
817 |
} |
| 789 |
|
818 |
|
|
|
819 |
static void an_dump_record(sc, ltv, string) |
| 820 |
struct an_softc *sc; |
| 821 |
struct an_ltv_gen *ltv; |
| 822 |
char *string; |
| 823 |
{ |
| 824 |
u_int8_t *ptr2; |
| 825 |
int len; |
| 826 |
int i; |
| 827 |
int count = 0; |
| 828 |
char buf[17], temp; |
| 829 |
|
| 830 |
len = ltv->an_len-4; |
| 831 |
printf("an%d: RID %4x, Length %4d, Mode %s\n", |
| 832 |
sc->an_unit, ltv->an_type, ltv->an_len-4, string); |
| 833 |
|
| 834 |
if(an_dump == 1 || (an_dump == ltv->an_type)){ |
| 835 |
printf("an%d:\t", sc->an_unit); |
| 836 |
bzero(buf,sizeof(buf)); |
| 837 |
|
| 838 |
ptr2 = (u_int8_t *)<v->an_val; |
| 839 |
for (i=len; i>0; i--){ |
| 840 |
printf("%02x ", *ptr2); |
| 841 |
|
| 842 |
temp=*ptr2++; |
| 843 |
if(temp>=' ' && temp <='~') |
| 844 |
buf[count]=temp; |
| 845 |
else if(temp>='A' && temp <='Z') |
| 846 |
buf[count]=temp; |
| 847 |
else |
| 848 |
buf[count]='.'; |
| 849 |
if(++count == 16){ |
| 850 |
count = 0; |
| 851 |
printf("%s\n",buf); |
| 852 |
printf("an%d:\t", sc->an_unit); |
| 853 |
bzero(buf,sizeof(buf)); |
| 854 |
} |
| 855 |
} |
| 856 |
for(; count != 16; count++){ |
| 857 |
printf(" "); |
| 858 |
} |
| 859 |
printf(" %s\n",buf); |
| 860 |
} |
| 861 |
} |
| 862 |
|
| 790 |
static int an_seek(sc, id, off, chan) |
863 |
static int an_seek(sc, id, off, chan) |
| 791 |
struct an_softc *sc; |
864 |
struct an_softc *sc; |
| 792 |
int id, off, chan; |
865 |
int id, off, chan; |
|
Lines 838-849
Link Here
|
| 838 |
} |
911 |
} |
| 839 |
|
912 |
|
| 840 |
ptr = (u_int16_t *)buf; |
913 |
ptr = (u_int16_t *)buf; |
| 841 |
for (i = 0; i < len / 2; i++) |
914 |
for (i = len; i > 1; i-=2) |
| 842 |
ptr[i] = CSR_READ_2(sc, AN_DATA1); |
915 |
*ptr++ = CSR_READ_2(sc, AN_DATA1); |
| 843 |
i*=2; |
916 |
if (i){ |
| 844 |
if (i<len){ |
917 |
ptr2 = (u_int8_t *)ptr; |
| 845 |
ptr2 = (u_int8_t *)buf; |
918 |
*ptr2 = CSR_READ_1(sc, AN_DATA1); |
| 846 |
ptr2[i] = CSR_READ_1(sc, AN_DATA1); |
|
|
| 847 |
} |
919 |
} |
| 848 |
|
920 |
|
| 849 |
return(0); |
921 |
return(0); |
|
Lines 865-876
Link Here
|
| 865 |
} |
937 |
} |
| 866 |
|
938 |
|
| 867 |
ptr = (u_int16_t *)buf; |
939 |
ptr = (u_int16_t *)buf; |
| 868 |
for (i = 0; i < (len / 2); i++) |
940 |
for (i = len; i > 1; i-=2) |
| 869 |
CSR_WRITE_2(sc, AN_DATA0, ptr[i]); |
941 |
CSR_WRITE_2(sc, AN_DATA0, *ptr++); |
| 870 |
i*=2; |
942 |
if (i){ |
| 871 |
if (i<len){ |
943 |
ptr2 = (u_int8_t *)ptr; |
| 872 |
ptr2 = (u_int8_t *)buf; |
944 |
CSR_WRITE_1(sc, AN_DATA0, *ptr2); |
| 873 |
CSR_WRITE_1(sc, AN_DATA0, ptr2[i]); |
|
|
| 874 |
} |
945 |
} |
| 875 |
|
946 |
|
| 876 |
return(0); |
947 |
return(0); |
|
Lines 1190-1205
Link Here
|
| 1190 |
len = 0; |
1261 |
len = 0; |
| 1191 |
if(ireq->i_val < 4) { |
1262 |
if(ireq->i_val < 4) { |
| 1192 |
areq.an_type = AN_RID_WEP_TEMP; |
1263 |
areq.an_type = AN_RID_WEP_TEMP; |
| 1193 |
for(i=0; i<4; i++) { |
1264 |
for(i=0; i<5; i++) { |
| 1194 |
areq.an_len = sizeof(areq); |
|
|
| 1195 |
if (an_read_record(sc, |
1265 |
if (an_read_record(sc, |
| 1196 |
(struct an_ltv_gen *)&areq)) { |
1266 |
(struct an_ltv_gen *)&areq)) { |
| 1197 |
error = EINVAL; |
1267 |
error = EINVAL; |
| 1198 |
break; |
1268 |
break; |
| 1199 |
} |
1269 |
} |
| 1200 |
len = key->klen; |
1270 |
if(key->kindex == 0xffff) |
| 1201 |
if(i == ireq->i_val) |
|
|
| 1202 |
break; |
1271 |
break; |
|
|
1272 |
if(key->kindex == ireq->i_val) |
| 1273 |
len = key->klen; |
| 1203 |
/* Required to get next entry */ |
1274 |
/* Required to get next entry */ |
| 1204 |
areq.an_type = AN_RID_WEP_PERM; |
1275 |
areq.an_type = AN_RID_WEP_PERM; |
| 1205 |
} |
1276 |
} |
|
Lines 1219-1224
Link Here
|
| 1219 |
ireq->i_val = 8; |
1290 |
ireq->i_val = 8; |
| 1220 |
break; |
1291 |
break; |
| 1221 |
case IEEE80211_IOC_WEPTXKEY: |
1292 |
case IEEE80211_IOC_WEPTXKEY: |
|
|
1293 |
/* |
| 1294 |
* For some strange reason, you have to read all |
| 1295 |
* keys before you can read the txkey. |
| 1296 |
*/ |
| 1297 |
areq.an_type = AN_RID_WEP_TEMP; |
| 1298 |
for(i=0; i<5; i++) { |
| 1299 |
if (an_read_record(sc, |
| 1300 |
(struct an_ltv_gen *)&areq)) { |
| 1301 |
error = EINVAL; |
| 1302 |
break; |
| 1303 |
} |
| 1304 |
if(key->kindex == 0xffff) |
| 1305 |
break; |
| 1306 |
/* Required to get next entry */ |
| 1307 |
areq.an_type = AN_RID_WEP_PERM; |
| 1308 |
} |
| 1309 |
if(error) |
| 1310 |
break; |
| 1311 |
|
| 1222 |
areq.an_type = AN_RID_WEP_PERM; |
1312 |
areq.an_type = AN_RID_WEP_PERM; |
| 1223 |
key->kindex = 0xffff; |
1313 |
key->kindex = 0xffff; |
| 1224 |
if (an_read_record(sc, |
1314 |
if (an_read_record(sc, |