using table driven for Prism2 family IDs/Names.

This commit is contained in:
ichiro 2002-04-04 07:06:16 +00:00
parent e340f273c4
commit 7fadd48a2f
3 changed files with 103 additions and 92 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wi.c,v 1.63 2002/04/03 15:43:14 ichiro Exp $ */
/* $NetBSD: wi.c,v 1.64 2002/04/04 07:06:16 ichiro Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.63 2002/04/03 15:43:14 ichiro Exp $");
__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.64 2002/04/04 07:06:16 ichiro Exp $");
#define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */
#define WI_HERMES_STATS_WAR /* Work around stats counter bug. */
@ -146,6 +146,34 @@ static int wi_sync_media __P((struct wi_softc *, int, int));
static int wi_set_pm(struct wi_softc *, struct ieee80211_power *);
static int wi_get_pm(struct wi_softc *, struct ieee80211_power *);
struct wi_card_ident wi_card_ident[] = {
/* CARD_ID CARD_NAME FIRM_TYPE */
{ WI_NIC_LUCENT_ID, WI_NIC_LUCENT_STR, WI_LUCENT },
{ WI_NIC_EVB2_ID, WI_NIC_EVB2_STR, WI_INTERSIL },
{ WI_NIC_HWB3763_ID, WI_NIC_HWB3763_STR, WI_INTERSIL },
{ WI_NIC_HWB3163_ID, WI_NIC_HWB3163_STR, WI_INTERSIL },
{ WI_NIC_HWB3163B_ID, WI_NIC_HWB3163B_STR, WI_INTERSIL },
{ WI_NIC_EVB3_ID, WI_NIC_EVB3_STR, WI_INTERSIL },
{ WI_NIC_HWB1153_ID, WI_NIC_HWB1153_STR, WI_INTERSIL },
{ WI_NIC_P2_SST_ID, WI_NIC_P2_SST_STR, WI_INTERSIL },
{ WI_NIC_EVB2_SST_ID, WI_NIC_EVB2_SST_STR, WI_INTERSIL },
{ WI_NIC_3842_EVA_ID, WI_NIC_3842_EVA_STR, WI_INTERSIL },
{ WI_NIC_3842_PCMCIA_AMD_ID, WI_NIC_3842_PCMCIA_STR, WI_INTERSIL },
{ WI_NIC_3842_PCMCIA_SST_ID, WI_NIC_3842_PCMCIA_STR, WI_INTERSIL },
{ WI_NIC_3842_PCMCIA_ATM_ID, WI_NIC_3842_PCMCIA_STR, WI_INTERSIL },
{ WI_NIC_3842_MINI_AMD_ID, WI_NIC_3842_MINI_STR, WI_INTERSIL },
{ WI_NIC_3842_MINI_SST_ID, WI_NIC_3842_MINI_STR, WI_INTERSIL },
{ WI_NIC_3842_MINI_ATM_ID, WI_NIC_3842_MINI_STR, WI_INTERSIL },
{ WI_NIC_3842_PCI_AMD_ID, WI_NIC_3842_PCI_STR, WI_INTERSIL },
{ WI_NIC_3842_PCI_SST_ID, WI_NIC_3842_PCI_STR, WI_INTERSIL },
{ WI_NIC_3842_PCI_ATM_ID, WI_NIC_3842_PCI_STR, WI_INTERSIL },
{ WI_NIC_P3_PCMCIA_AMD_ID, WI_NIC_P3_PCMCIA_STR, WI_INTERSIL },
{ WI_NIC_P3_PCMCIA_SST_ID, WI_NIC_P3_PCMCIA_STR, WI_INTERSIL },
{ WI_NIC_P3_MINI_AMD_ID, WI_NIC_P3_MINI_STR, WI_INTERSIL },
{ WI_NIC_P3_MINI_SST_ID, WI_NIC_P3_MINI_STR, WI_INTERSIL },
{ 0, NULL, 0 },
};
int
wi_attach(sc)
struct wi_softc *sc;
@ -1961,6 +1989,7 @@ wi_get_id(sc)
struct wi_softc *sc;
{
struct wi_ltv_ver ver;
struct wi_card_ident *id;
/* getting chip identity */
memset(&ver, 0, sizeof(ver));
@ -1968,70 +1997,16 @@ wi_get_id(sc)
ver.wi_len = 5;
wi_read_record(sc, (struct wi_ltv_gen *)&ver);
printf("%s: using ", sc->sc_dev.dv_xname);
switch (le16toh(ver.wi_ver[0])) {
case WI_NIC_EVB2:
printf("RF:PRISM2 MAC:HFA3841");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_HWB3763:
printf("RF:PRISM2 MAC:HFA3841 CARD:HWB3763 rev.B");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_HWB3163:
printf("RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.A");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_HWB3163B:
printf("RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.B");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_EVB3:
case WI_NIC_3842_EVA:
printf("RF:PRISM2 MAC:HFA3842 CARD:HFA3842 EVAL");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_HWB1153:
printf("RF:PRISM1 MAC:HFA3841 CARD:HWB1153");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_P2_SST:
case WI_NIC_EVB2_SST:
printf("RF:PRISM2 MAC:HFA3841 CARD:HWB3163-SST-flash");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_3842_PCMCIA_AMD:
case WI_NIC_3842_PCMCIA_SST:
case WI_NIC_3842_PCMCIA_ATM:
printf("RF:PRISM2.5 MAC:ISL3873");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_3842_MINI_AMD:
case WI_NIC_3842_MINI_SST:
case WI_NIC_3842_MINI_ATM:
printf("RF:PRISM2.5 MAC:ISL3874A(Mini-PCI)");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_3842_PCI_AMD:
case WI_NIC_3842_PCI_SST:
case WI_NIC_3842_PCI_ATM:
printf("RF:PRISM2.5 MAC:ISL3874A(PCI-bridge)");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_P3_PCMCIA_AMD:
case WI_NIC_P3_PCMCIA_SST:
printf("RF:PRISM3(PCMCIA)");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_P3_MINI_AMD:
case WI_NIC_P3_MINI_SST:
printf("RF:PRISM3(Mini-PCI)");
sc->sc_firmware_type = WI_INTERSIL;
break;
case WI_NIC_LUCENT:
printf("Lucent Technologies, WaveLAN/IEEE");
sc->sc_firmware_type = WI_LUCENT;
break;
default:
sc->sc_firmware_type = NULL;
for (id = wi_card_ident; id->card_name != NULL; id++) {
if (le16toh(ver.wi_ver[0]) == id->card_id) {
printf("%s", id->card_name);
sc->sc_firmware_type = id->firm_type;
break;
}
}
if (!sc->sc_firmware_type) {
if (le16toh(ver.wi_ver[0]) & 0x8000) {
printf("Unknown PRISM2 chip");
sc->sc_firmware_type = WI_INTERSIL;
@ -2039,7 +2014,6 @@ wi_get_id(sc)
printf("Unknown Lucent chip");
sc->sc_firmware_type = WI_LUCENT;
}
break;
}
/* get primary firmware version */

View File

@ -1,4 +1,4 @@
/* $NetBSD: wireg.h,v 1.27 2002/04/03 15:33:21 ichiro Exp $ */
/* $NetBSD: wireg.h,v 1.28 2002/04/04 07:06:17 ichiro Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@ -422,31 +422,62 @@ struct wi_ltv_ver {
u_int16_t wi_len;
u_int16_t wi_type;
u_int16_t wi_ver[4];
#define WI_NIC_LUCENT 0x0005
#define WI_NIC_EVB2 0x8000
#define WI_NIC_HWB3763 0x8001
#define WI_NIC_HWB3163 0x8002
#define WI_NIC_HWB3163B 0x8003
#define WI_NIC_EVB3 0x8004
#define WI_NIC_HWB1153 0x8007
#define WI_NIC_P2_SST 0x8008 /* Prism2 with SST flush */
#define WI_NIC_EVB2_SST 0x8009
#define WI_NIC_3842_EVA 0x800A /* 3842 Evaluation Board */
#define WI_NIC_3842_PCMCIA_AMD 0x800B /* Prism2.5 PCMCIA */
#define WI_NIC_3842_PCMCIA_SST 0x800C
#define WI_NIC_3842_PCMCIA_ATM 0x800D
#define WI_NIC_3842_MINI_AMD 0x8012 /* Prism2.5 Mini-PCI */
#define WI_NIC_3842_MINI_SST 0x8013
#define WI_NIC_3842_MINI_ATM 0x8014
#define WI_NIC_3842_PCI_AMD 0x8016 /* Prism2.5 PCI-bridge */
#define WI_NIC_3842_PCI_SST 0x8017
#define WI_NIC_3842_PCI_ATM 0x8018
#define WI_NIC_P3_PCMCIA_AMD 0x801A /* Prism3 PCMCIA */
#define WI_NIC_P3_PCMCIA_SST 0x801B
#define WI_NIC_P3_MINI_AMD 0x8021 /* Prism3 Mini-PCI */
#define WI_NIC_P3_MINI_SST 0x8022
};
/* define card ident */
#define WI_NIC_LUCENT_ID 0x0005
#define WI_NIC_LUCENT_STR "Lucent Technologies, WaveLAN/IEEE"
#define WI_NIC_EVB2_ID 0x8000
#define WI_NIC_EVB2_STR "RF:PRISM2 MAC:HFA3841"
#define WI_NIC_HWB3763_ID 0x8001
#define WI_NIC_HWB3763_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3763 rev.B"
#define WI_NIC_HWB3163_ID 0x8002
#define WI_NIC_HWB3163_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.A"
#define WI_NIC_HWB3163B_ID 0x8003
#define WI_NIC_HWB3163B_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.B"
#define WI_NIC_EVB3_ID 0x8004
#define WI_NIC_EVB3_STR "RF:PRISM2 MAC:HFA3842 CARD:HFA3842 EVAL"
#define WI_NIC_HWB1153_ID 0x8007
#define WI_NIC_HWB1153_STR "RF:PRISM1 MAC:HFA3841 CARD:HWB1153"
#define WI_NIC_P2_SST_ID 0x8008 /* Prism2 with SST flush */
#define WI_NIC_P2_SST_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163-SST-flash"
#define WI_NIC_EVB2_SST_ID 0x8009
#define WI_NIC_EVB2_SST_STR "RF:PRISM2 MAC:HFA3841 CARD:HWB3163-SST-flash"
#define WI_NIC_3842_EVA_ID 0x800A /* 3842 Evaluation Board */
#define WI_NIC_3842_EVA_STR "RF:PRISM2 MAC:HFA3842 CARD:HFA3842 EVAL"
#define WI_NIC_3842_PCMCIA_AMD_ID 0x800B /* Prism2.5 PCMCIA */
#define WI_NIC_3842_PCMCIA_SST_ID 0x800C
#define WI_NIC_3842_PCMCIA_ATM_ID 0x800D
#define WI_NIC_3842_PCMCIA_STR "RF:PRISM2.5 MAC:ISL3873"
#define WI_NIC_3842_MINI_AMD_ID 0x8012 /* Prism2.5 Mini-PCI */
#define WI_NIC_3842_MINI_SST_ID 0x8013
#define WI_NIC_3842_MINI_ATM_ID 0x8014
#define WI_NIC_3842_MINI_STR "RF:PRISM2.5 MAC:ISL3874A(Mini-PCI)"
#define WI_NIC_3842_PCI_AMD_ID 0x8016 /* Prism2.5 PCI-bridge */
#define WI_NIC_3842_PCI_SST_ID 0x8017
#define WI_NIC_3842_PCI_ATM_ID 0x8018
#define WI_NIC_3842_PCI_STR "RF:PRISM2.5 MAC:ISL3874A(PCI-bridge)"
#define WI_NIC_P3_PCMCIA_AMD_ID 0x801A /* Prism3 PCMCIA */
#define WI_NIC_P3_PCMCIA_SST_ID 0x801B
#define WI_NIC_P3_PCMCIA_STR "RF:PRISM3(PCMCIA)"
#define WI_NIC_P3_MINI_AMD_ID 0x8021 /* Prism3 Mini-PCI */
#define WI_NIC_P3_MINI_SST_ID 0x8022
#define WI_NIC_P3_MINI_STR "RF:PRISM3(Mini-PCI)"
/*
* List of intended regulatory domains (0xFD11).
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: wivar.h,v 1.11 2002/03/30 16:44:59 ichiro Exp $ */
/* $NetBSD: wivar.h,v 1.12 2002/04/04 07:06:17 ichiro Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@ -98,6 +98,12 @@ struct wi_softc {
int wi_scanning; /* scan mode */
};
struct wi_card_ident {
u_int16_t card_id;
char *card_name;
u_int8_t firm_type;
};
int wi_attach __P((struct wi_softc *));
int wi_detach __P((struct wi_softc *));
int wi_activate __P((struct device *, enum devact));