[PATCH 8/9] staging: brcm80211: remove support functions for older chipsets from bcmsrom

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The source file contained functions for both older and current chipsets
but the brcmsmac driver does not support the older chipsets so those
functions are removed.

Reviewed-by: Henry Ptasinski <henryp@xxxxxxxxxxxx>
Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
---
 drivers/staging/brcm80211/util/bcmsrom.c | 1210 ------------------------------
 1 files changed, 0 insertions(+), 1210 deletions(-)

diff --git a/drivers/staging/brcm80211/util/bcmsrom.c b/drivers/staging/brcm80211/util/bcmsrom.c
index b029ecd..d93f1c0 100644
--- a/drivers/staging/brcm80211/util/bcmsrom.c
+++ b/drivers/staging/brcm80211/util/bcmsrom.c
@@ -164,1216 +164,6 @@ int srom_var_init(si_t *sih, uint bustype, void *curmap,
 	return -1;
 }
 
-/* support only 16-bit word read from srom */
-int
-srom_read(si_t *sih, uint bustype, void *curmap,
-	  uint byteoff, uint nbytes, u16 *buf, bool check_crc)
-{
-	uint off, nw;
-#ifdef BCMSDIO
-	uint i;
-#endif				/* BCMSDIO */
-
-	ASSERT(bustype == bustype);
-
-	/* check input - 16-bit access only */
-	if (byteoff & 1 || nbytes & 1 || (byteoff + nbytes) > SROM_MAX)
-		return 1;
-
-	off = byteoff / 2;
-	nw = nbytes / 2;
-
-	if (bustype == PCI_BUS) {
-		if (!curmap)
-			return 1;
-
-		if (si_is_sprom_available(sih)) {
-			u16 *srom;
-
-			srom = (u16 *) SROM_OFFSET(sih);
-			if (srom == NULL)
-				return 1;
-
-			if (sprom_read_pci
-			    (sih, srom, off, buf, nw, check_crc))
-				return 1;
-		}
-#if defined(BCMNVRAMR)
-		else {
-			if (otp_read_pci(sih, buf, SROM_MAX))
-				return 1;
-		}
-#endif
-#ifdef BCMSDIO
-	} else if (bustype == SDIO_BUS) {
-		off = byteoff / 2;
-		nw = nbytes / 2;
-		for (i = 0; i < nw; i++) {
-			if (sprom_read_sdio
-			    ((u16) (off + i), (u16 *) (buf + i)))
-				return 1;
-		}
-#endif				/* BCMSDIO */
-	} else if (bustype == SI_BUS) {
-		return 1;
-	} else {
-		return 1;
-	}
-
-	return 0;
-}
-
-static const char vstr_manf[] = "manf=%s";
-static const char vstr_productname[] = "productname=%s";
-static const char vstr_manfid[] = "manfid=0x%x";
-static const char vstr_prodid[] = "prodid=0x%x";
-#ifdef BCMSDIO
-static const char vstr_sdmaxspeed[] = "sdmaxspeed=%d";
-static const char vstr_sdmaxblk[][13] = {
-"sdmaxblk0=%d", "sdmaxblk1=%d", "sdmaxblk2=%d"};
-#endif
-static const char vstr_regwindowsz[] = "regwindowsz=%d";
-static const char vstr_sromrev[] = "sromrev=%d";
-static const char vstr_chiprev[] = "chiprev=%d";
-static const char vstr_subvendid[] = "subvendid=0x%x";
-static const char vstr_subdevid[] = "subdevid=0x%x";
-static const char vstr_boardrev[] = "boardrev=0x%x";
-static const char vstr_aa2g[] = "aa2g=0x%x";
-static const char vstr_aa5g[] = "aa5g=0x%x";
-static const char vstr_ag[] = "ag%d=0x%x";
-static const char vstr_cc[] = "cc=%d";
-static const char vstr_opo[] = "opo=%d";
-static const char vstr_pa0b[][9] = {
-"pa0b0=%d", "pa0b1=%d", "pa0b2=%d"};
-
-static const char vstr_pa0itssit[] = "pa0itssit=%d";
-static const char vstr_pa0maxpwr[] = "pa0maxpwr=%d";
-static const char vstr_pa1b[][9] = {
-"pa1b0=%d", "pa1b1=%d", "pa1b2=%d"};
-
-static const char vstr_pa1lob[][11] = {
-"pa1lob0=%d", "pa1lob1=%d", "pa1lob2=%d"};
-
-static const char vstr_pa1hib[][11] = {
-"pa1hib0=%d", "pa1hib1=%d", "pa1hib2=%d"};
-
-static const char vstr_pa1itssit[] = "pa1itssit=%d";
-static const char vstr_pa1maxpwr[] = "pa1maxpwr=%d";
-static const char vstr_pa1lomaxpwr[] = "pa1lomaxpwr=%d";
-static const char vstr_pa1himaxpwr[] = "pa1himaxpwr=%d";
-static const char vstr_oem[] =
-    "oem=%02x%02x%02x%02x%02x%02x%02x%02x";
-static const char vstr_boardflags[] = "boardflags=0x%x";
-static const char vstr_boardflags2[] = "boardflags2=0x%x";
-static const char vstr_ledbh[] = "ledbh%d=0x%x";
-static const char vstr_noccode[] = "ccode=0x0";
-static const char vstr_ccode[] = "ccode=%c%c";
-static const char vstr_cctl[] = "cctl=0x%x";
-static const char vstr_cckpo[] = "cckpo=0x%x";
-static const char vstr_ofdmpo[] = "ofdmpo=0x%x";
-static const char vstr_rdlid[] = "rdlid=0x%x";
-static const char vstr_rdlrndis[] = "rdlrndis=%d";
-static const char vstr_rdlrwu[] = "rdlrwu=%d";
-static const char vstr_usbfs[] = "usbfs=%d";
-static const char vstr_wpsgpio[] = "wpsgpio=%d";
-static const char vstr_wpsled[] = "wpsled=%d";
-static const char vstr_rdlsn[] = "rdlsn=%d";
-static const char vstr_rssismf2g[] = "rssismf2g=%d";
-static const char vstr_rssismc2g[] = "rssismc2g=%d";
-static const char vstr_rssisav2g[] = "rssisav2g=%d";
-static const char vstr_bxa2g[] = "bxa2g=%d";
-static const char vstr_rssismf5g[] = "rssismf5g=%d";
-static const char vstr_rssismc5g[] = "rssismc5g=%d";
-static const char vstr_rssisav5g[] = "rssisav5g=%d";
-static const char vstr_bxa5g[] = "bxa5g=%d";
-static const char vstr_tri2g[] = "tri2g=%d";
-static const char vstr_tri5gl[] = "tri5gl=%d";
-static const char vstr_tri5g[] = "tri5g=%d";
-static const char vstr_tri5gh[] = "tri5gh=%d";
-static const char vstr_rxpo2g[] = "rxpo2g=%d";
-static const char vstr_rxpo5g[] = "rxpo5g=%d";
-static const char vstr_boardtype[] = "boardtype=0x%x";
-static const char vstr_leddc[] = "leddc=0x%04x";
-static const char vstr_vendid[] = "vendid=0x%x";
-static const char vstr_devid[] = "devid=0x%x";
-static const char vstr_xtalfreq[] = "xtalfreq=%d";
-static const char vstr_txchain[] = "txchain=0x%x";
-static const char vstr_rxchain[] = "rxchain=0x%x";
-static const char vstr_antswitch[] = "antswitch=0x%x";
-static const char vstr_regrev[] = "regrev=0x%x";
-static const char vstr_antswctl2g[] = "antswctl2g=0x%x";
-static const char vstr_triso2g[] = "triso2g=0x%x";
-static const char vstr_pdetrange2g[] = "pdetrange2g=0x%x";
-static const char vstr_extpagain2g[] = "extpagain2g=0x%x";
-static const char vstr_tssipos2g[] = "tssipos2g=0x%x";
-static const char vstr_antswctl5g[] = "antswctl5g=0x%x";
-static const char vstr_triso5g[] = "triso5g=0x%x";
-static const char vstr_pdetrange5g[] = "pdetrange5g=0x%x";
-static const char vstr_extpagain5g[] = "extpagain5g=0x%x";
-static const char vstr_tssipos5g[] = "tssipos5g=0x%x";
-static const char vstr_maxp2ga0[] = "maxp2ga0=0x%x";
-static const char vstr_itt2ga0[] = "itt2ga0=0x%x";
-static const char vstr_pa[] = "pa%dgw%da%d=0x%x";
-static const char vstr_pahl[] = "pa%dg%cw%da%d=0x%x";
-static const char vstr_maxp5ga0[] = "maxp5ga0=0x%x";
-static const char vstr_itt5ga0[] = "itt5ga0=0x%x";
-static const char vstr_maxp5gha0[] = "maxp5gha0=0x%x";
-static const char vstr_maxp5gla0[] = "maxp5gla0=0x%x";
-static const char vstr_maxp2ga1[] = "maxp2ga1=0x%x";
-static const char vstr_itt2ga1[] = "itt2ga1=0x%x";
-static const char vstr_maxp5ga1[] = "maxp5ga1=0x%x";
-static const char vstr_itt5ga1[] = "itt5ga1=0x%x";
-static const char vstr_maxp5gha1[] = "maxp5gha1=0x%x";
-static const char vstr_maxp5gla1[] = "maxp5gla1=0x%x";
-static const char vstr_cck2gpo[] = "cck2gpo=0x%x";
-static const char vstr_ofdm2gpo[] = "ofdm2gpo=0x%x";
-static const char vstr_ofdm5gpo[] = "ofdm5gpo=0x%x";
-static const char vstr_ofdm5glpo[] = "ofdm5glpo=0x%x";
-static const char vstr_ofdm5ghpo[] = "ofdm5ghpo=0x%x";
-static const char vstr_cddpo[] = "cddpo=0x%x";
-static const char vstr_stbcpo[] = "stbcpo=0x%x";
-static const char vstr_bw40po[] = "bw40po=0x%x";
-static const char vstr_bwduppo[] = "bwduppo=0x%x";
-static const char vstr_mcspo[] = "mcs%dgpo%d=0x%x";
-static const char vstr_mcspohl[] = "mcs%dg%cpo%d=0x%x";
-static const char vstr_custom[] = "customvar%d=0x%x";
-static const char vstr_cckdigfilttype[] = "cckdigfilttype=%d";
-static const char vstr_boardnum[] = "boardnum=%d";
-static const char vstr_macaddr[] = "macaddr=%s";
-static const char vstr_usbepnum[] = "usbepnum=0x%x";
-static const char vstr_end[] = "END\0";
-
-u8 patch_pair;
-
-/* For dongle HW, accept partial calibration parameters */
-#define BCMDONGLECASE(n)
-
-int srom_parsecis(u8 *pcis[], uint ciscnt, char **vars,
-		  uint *count)
-{
-	char eabuf[32];
-	char *base;
-	varbuf_t b;
-	u8 *cis, tup, tlen, sromrev = 1;
-	int i, j;
-	bool ag_init = false;
-	u32 w32;
-	uint funcid;
-	uint cisnum;
-	s32 boardnum;
-	int err;
-	bool standard_cis;
-
-	ASSERT(vars != NULL);
-	ASSERT(count != NULL);
-
-	boardnum = -1;
-
-	base = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC);
-	ASSERT(base != NULL);
-	if (!base)
-		return -2;
-
-	varbuf_init(&b, base, MAXSZ_NVRAM_VARS);
-	memset(base, 0, MAXSZ_NVRAM_VARS);
-	eabuf[0] = '\0';
-	for (cisnum = 0; cisnum < ciscnt; cisnum++) {
-		cis = *pcis++;
-		i = 0;
-		funcid = 0;
-		standard_cis = true;
-		do {
-			if (standard_cis) {
-				tup = cis[i++];
-				if (tup == CISTPL_NULL || tup == CISTPL_END)
-					tlen = 0;
-				else
-					tlen = cis[i++];
-			} else {
-				if (cis[i] == CISTPL_NULL
-				    || cis[i] == CISTPL_END) {
-					tlen = 0;
-					tup = cis[i];
-				} else {
-					tlen = cis[i];
-					tup = CISTPL_BRCM_HNBU;
-				}
-				++i;
-			}
-			if ((i + tlen) >= CIS_SIZE)
-				break;
-
-			switch (tup) {
-			case CISTPL_VERS_1:
-				/* assume the strings are good if the version field checks out */
-				if (((cis[i + 1] << 8) + cis[i]) >= 0x0008) {
-					varbuf_append(&b, vstr_manf,
-						      &cis[i + 2]);
-					varbuf_append(&b, vstr_productname,
-						      &cis[i + 3 +
-							   strlen((char *)
-								  &cis[i +
-								       2])]);
-					break;
-				}
-
-			case CISTPL_MANFID:
-				varbuf_append(&b, vstr_manfid,
-					      (cis[i + 1] << 8) + cis[i]);
-				varbuf_append(&b, vstr_prodid,
-					      (cis[i + 3] << 8) + cis[i + 2]);
-				break;
-
-			case CISTPL_FUNCID:
-				funcid = cis[i];
-				break;
-
-			case CISTPL_FUNCE:
-				switch (funcid) {
-				case CISTPL_FID_SDIO:
-#ifdef BCMSDIO
-					if (cis[i] == 0) {
-						u8 spd = cis[i + 3];
-						static int base[] = {
-							-1, 10, 12, 13, 15, 20,
-							    25, 30,
-							35, 40, 45, 50, 55, 60,
-							    70, 80
-						};
-						static int mult[] = {
-							10, 100, 1000, 10000,
-							-1, -1, -1, -1
-						};
-						ASSERT((mult[spd & 0x7] != -1)
-						       &&
-						       (base
-							[(spd >> 3) & 0x0f]));
-						varbuf_append(&b,
-							      vstr_sdmaxblk[0],
-							      (cis[i + 2] << 8)
-							      + cis[i + 1]);
-						varbuf_append(&b,
-							      vstr_sdmaxspeed,
-							      (mult[spd & 0x7] *
-							       base[(spd >> 3) &
-								    0x0f]));
-					} else if (cis[i] == 1) {
-						varbuf_append(&b,
-							      vstr_sdmaxblk
-							      [cisnum],
-							      (cis[i + 13] << 8)
-							      | cis[i + 12]);
-					}
-#endif				/* BCMSDIO */
-					funcid = 0;
-					break;
-				default:
-					/* set macaddr if HNBU_MACADDR not seen yet */
-					if (eabuf[0] == '\0' &&
-					    cis[i] == LAN_NID &&
-					    !is_zero_ether_addr(&cis[i + 2]) &&
-					    !is_multicast_ether_addr(&cis[i + 2])) {
-						ASSERT(cis[i + 1] ==
-						       ETH_ALEN);
-						snprintf(eabuf, sizeof(eabuf),
-							"%pM", &cis[i + 2]);
-
-						/* set boardnum if HNBU_BOARDNUM not seen yet */
-						if (boardnum == -1)
-							boardnum =
-							    (cis[i + 6] << 8) +
-							    cis[i + 7];
-					}
-					break;
-				}
-				break;
-
-			case CISTPL_CFTABLE:
-				varbuf_append(&b, vstr_regwindowsz,
-					      (cis[i + 7] << 8) | cis[i + 6]);
-				break;
-
-			case CISTPL_BRCM_HNBU:
-				switch (cis[i]) {
-				case HNBU_SROMREV:
-					sromrev = cis[i + 1];
-					varbuf_append(&b, vstr_sromrev,
-						      sromrev);
-					break;
-
-				case HNBU_XTALFREQ:
-					varbuf_append(&b, vstr_xtalfreq,
-						      (cis[i + 4] << 24) |
-						      (cis[i + 3] << 16) |
-						      (cis[i + 2] << 8) |
-						      cis[i + 1]);
-					break;
-
-				case HNBU_CHIPID:
-					varbuf_append(&b, vstr_vendid,
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_devid,
-						      (cis[i + 4] << 8) +
-						      cis[i + 3]);
-					if (tlen >= 7) {
-						varbuf_append(&b, vstr_chiprev,
-							      (cis[i + 6] << 8)
-							      + cis[i + 5]);
-					}
-					if (tlen >= 9) {
-						varbuf_append(&b,
-							      vstr_subvendid,
-							      (cis[i + 8] << 8)
-							      + cis[i + 7]);
-					}
-					if (tlen >= 11) {
-						varbuf_append(&b, vstr_subdevid,
-							      (cis[i + 10] << 8)
-							      + cis[i + 9]);
-						/* subdevid doubles for boardtype */
-						varbuf_append(&b,
-							      vstr_boardtype,
-							      (cis[i + 10] << 8)
-							      + cis[i + 9]);
-					}
-					break;
-
-				case HNBU_BOARDNUM:
-					boardnum =
-					    (cis[i + 2] << 8) + cis[i + 1];
-					break;
-
-				case HNBU_PATCH:
-					{
-						char vstr_paddr[16];
-						char vstr_pdata[16];
-
-						/* retrieve the patch pairs
-						 * from tlen/6; where 6 is
-						 * sizeof(patch addr(2)) +
-						 * sizeof(patch data(4)).
-						 */
-						patch_pair = tlen / 6;
-
-						for (j = 0; j < patch_pair; j++) {
-							snprintf(vstr_paddr,
-								 sizeof
-								 (vstr_paddr),
-								 "pa%d=0x%%x",
-								 j);
-							snprintf(vstr_pdata,
-								 sizeof
-								 (vstr_pdata),
-								 "pd%d=0x%%x",
-								 j);
-
-							varbuf_append(&b,
-								      vstr_paddr,
-								      (cis
-								       [i +
-									(j *
-									 6) +
-									2] << 8)
-								      | cis[i +
-									    (j *
-									     6)
-									    +
-									    1]);
-
-							varbuf_append(&b,
-								      vstr_pdata,
-								      (cis
-								       [i +
-									(j *
-									 6) +
-									6] <<
-								       24) |
-								      (cis
-								       [i +
-									(j *
-									 6) +
-									5] <<
-								       16) |
-								      (cis
-								       [i +
-									(j *
-									 6) +
-									4] << 8)
-								      | cis[i +
-									    (j *
-									     6)
-									    +
-									    3]);
-						}
-					}
-					break;
-
-				case HNBU_BOARDREV:
-					if (tlen == 2)
-						varbuf_append(&b, vstr_boardrev,
-							      cis[i + 1]);
-					else
-						varbuf_append(&b, vstr_boardrev,
-							      (cis[i + 2] << 8)
-							      + cis[i + 1]);
-					break;
-
-				case HNBU_BOARDFLAGS:
-					w32 = (cis[i + 2] << 8) + cis[i + 1];
-					if (tlen >= 5)
-						w32 |=
-						    ((cis[i + 4] << 24) +
-						     (cis[i + 3] << 16));
-					varbuf_append(&b, vstr_boardflags, w32);
-
-					if (tlen >= 7) {
-						w32 =
-						    (cis[i + 6] << 8) + cis[i +
-									    5];
-						if (tlen >= 9)
-							w32 |=
-							    ((cis[i + 8] << 24)
-							     +
-							     (cis[i + 7] <<
-							      16));
-						varbuf_append(&b,
-							      vstr_boardflags2,
-							      w32);
-					}
-					break;
-
-				case HNBU_USBFS:
-					varbuf_append(&b, vstr_usbfs,
-						      cis[i + 1]);
-					break;
-
-				case HNBU_BOARDTYPE:
-					varbuf_append(&b, vstr_boardtype,
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					break;
-
-				case HNBU_HNBUCIS:
-					/*
-					 * what follows is a nonstandard HNBU CIS
-					 * that lacks CISTPL_BRCM_HNBU tags
-					 *
-					 * skip 0xff (end of standard CIS)
-					 * after this tuple
-					 */
-					tlen++;
-					standard_cis = false;
-					break;
-
-				case HNBU_USBEPNUM:
-					varbuf_append(&b, vstr_usbepnum,
-						      (cis[i + 2] << 8) | cis[i
-									      +
-									      1]);
-					break;
-
-				case HNBU_AA:
-					varbuf_append(&b, vstr_aa2g,
-						      cis[i + 1]);
-					if (tlen >= 3)
-						varbuf_append(&b, vstr_aa5g,
-							      cis[i + 2]);
-					break;
-
-				case HNBU_AG:
-					varbuf_append(&b, vstr_ag, 0,
-						      cis[i + 1]);
-					if (tlen >= 3)
-						varbuf_append(&b, vstr_ag, 1,
-							      cis[i + 2]);
-					if (tlen >= 4)
-						varbuf_append(&b, vstr_ag, 2,
-							      cis[i + 3]);
-					if (tlen >= 5)
-						varbuf_append(&b, vstr_ag, 3,
-							      cis[i + 4]);
-					ag_init = true;
-					break;
-
-				case HNBU_ANT5G:
-					varbuf_append(&b, vstr_aa5g,
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_ag, 1,
-						      cis[i + 2]);
-					break;
-
-				case HNBU_CC:
-					ASSERT(sromrev == 1);
-					varbuf_append(&b, vstr_cc, cis[i + 1]);
-					break;
-
-				case HNBU_PAPARMS:
-					switch (tlen) {
-					case 2:
-						ASSERT(sromrev == 1);
-						varbuf_append(&b,
-							      vstr_pa0maxpwr,
-							      cis[i + 1]);
-						break;
-					case 10:
-						ASSERT(sromrev >= 2);
-						varbuf_append(&b, vstr_opo,
-							      cis[i + 9]);
-						/* FALLTHROUGH */
-					case 9:
-						varbuf_append(&b,
-							      vstr_pa0maxpwr,
-							      cis[i + 8]);
-						/* FALLTHROUGH */
-						BCMDONGLECASE(8)
-						    varbuf_append(&b,
-								  vstr_pa0itssit,
-								  cis[i + 7]);
-						/* FALLTHROUGH */
-						BCMDONGLECASE(7)
-						    for (j = 0; j < 3; j++) {
-							varbuf_append(&b,
-								      vstr_pa0b
-								      [j],
-								      (cis
-								       [i +
-									(j *
-									 2) +
-									2] << 8)
-								      + cis[i +
-									    (j *
-									     2)
-									    +
-									    1]);
-						}
-						break;
-					default:
-						ASSERT((tlen == 2)
-						       || (tlen == 9)
-						       || (tlen == 10));
-						break;
-					}
-					break;
-
-				case HNBU_PAPARMS5G:
-					ASSERT((sromrev == 2)
-					       || (sromrev == 3));
-					switch (tlen) {
-					case 23:
-						varbuf_append(&b,
-							      vstr_pa1himaxpwr,
-							      cis[i + 22]);
-						varbuf_append(&b,
-							      vstr_pa1lomaxpwr,
-							      cis[i + 21]);
-						varbuf_append(&b,
-							      vstr_pa1maxpwr,
-							      cis[i + 20]);
-						/* FALLTHROUGH */
-					case 20:
-						varbuf_append(&b,
-							      vstr_pa1itssit,
-							      cis[i + 19]);
-						/* FALLTHROUGH */
-					case 19:
-						for (j = 0; j < 3; j++) {
-							varbuf_append(&b,
-								      vstr_pa1b
-								      [j],
-								      (cis
-								       [i +
-									(j *
-									 2) +
-									2] << 8)
-								      + cis[i +
-									    (j *
-									     2)
-									    +
-									    1]);
-						}
-						for (j = 3; j < 6; j++) {
-							varbuf_append(&b,
-								      vstr_pa1lob
-								      [j - 3],
-								      (cis
-								       [i +
-									(j *
-									 2) +
-									2] << 8)
-								      + cis[i +
-									    (j *
-									     2)
-									    +
-									    1]);
-						}
-						for (j = 6; j < 9; j++) {
-							varbuf_append(&b,
-								      vstr_pa1hib
-								      [j - 6],
-								      (cis
-								       [i +
-									(j *
-									 2) +
-									2] << 8)
-								      + cis[i +
-									    (j *
-									     2)
-									    +
-									    1]);
-						}
-						break;
-					default:
-						ASSERT((tlen == 19) ||
-						       (tlen == 20)
-						       || (tlen == 23));
-						break;
-					}
-					break;
-
-				case HNBU_OEM:
-					ASSERT(sromrev == 1);
-					varbuf_append(&b, vstr_oem,
-						      cis[i + 1], cis[i + 2],
-						      cis[i + 3], cis[i + 4],
-						      cis[i + 5], cis[i + 6],
-						      cis[i + 7], cis[i + 8]);
-					break;
-
-				case HNBU_LEDS:
-					for (j = 1; j <= 4; j++) {
-						if (cis[i + j] != 0xff) {
-							varbuf_append(&b,
-								      vstr_ledbh,
-								      j - 1,
-								      cis[i +
-									  j]);
-						}
-					}
-					break;
-
-				case HNBU_CCODE:
-					ASSERT(sromrev > 1);
-					if ((cis[i + 1] == 0)
-					    || (cis[i + 2] == 0))
-						varbuf_append(&b, vstr_noccode);
-					else
-						varbuf_append(&b, vstr_ccode,
-							      cis[i + 1],
-							      cis[i + 2]);
-					varbuf_append(&b, vstr_cctl,
-						      cis[i + 3]);
-					break;
-
-				case HNBU_CCKPO:
-					ASSERT(sromrev > 2);
-					varbuf_append(&b, vstr_cckpo,
-						      (cis[i + 2] << 8) | cis[i
-									      +
-									      1]);
-					break;
-
-				case HNBU_OFDMPO:
-					ASSERT(sromrev > 2);
-					varbuf_append(&b, vstr_ofdmpo,
-						      (cis[i + 4] << 24) |
-						      (cis[i + 3] << 16) |
-						      (cis[i + 2] << 8) |
-						      cis[i + 1]);
-					break;
-
-				case HNBU_WPS:
-					varbuf_append(&b, vstr_wpsgpio,
-						      cis[i + 1]);
-					if (tlen >= 3)
-						varbuf_append(&b, vstr_wpsled,
-							      cis[i + 2]);
-					break;
-
-				case HNBU_RSSISMBXA2G:
-					ASSERT(sromrev == 3);
-					varbuf_append(&b, vstr_rssismf2g,
-						      cis[i + 1] & 0xf);
-					varbuf_append(&b, vstr_rssismc2g,
-						      (cis[i + 1] >> 4) & 0xf);
-					varbuf_append(&b, vstr_rssisav2g,
-						      cis[i + 2] & 0x7);
-					varbuf_append(&b, vstr_bxa2g,
-						      (cis[i + 2] >> 3) & 0x3);
-					break;
-
-				case HNBU_RSSISMBXA5G:
-					ASSERT(sromrev == 3);
-					varbuf_append(&b, vstr_rssismf5g,
-						      cis[i + 1] & 0xf);
-					varbuf_append(&b, vstr_rssismc5g,
-						      (cis[i + 1] >> 4) & 0xf);
-					varbuf_append(&b, vstr_rssisav5g,
-						      cis[i + 2] & 0x7);
-					varbuf_append(&b, vstr_bxa5g,
-						      (cis[i + 2] >> 3) & 0x3);
-					break;
-
-				case HNBU_TRI2G:
-					ASSERT(sromrev == 3);
-					varbuf_append(&b, vstr_tri2g,
-						      cis[i + 1]);
-					break;
-
-				case HNBU_TRI5G:
-					ASSERT(sromrev == 3);
-					varbuf_append(&b, vstr_tri5gl,
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_tri5g,
-						      cis[i + 2]);
-					varbuf_append(&b, vstr_tri5gh,
-						      cis[i + 3]);
-					break;
-
-				case HNBU_RXPO2G:
-					ASSERT(sromrev == 3);
-					varbuf_append(&b, vstr_rxpo2g,
-						      cis[i + 1]);
-					break;
-
-				case HNBU_RXPO5G:
-					ASSERT(sromrev == 3);
-					varbuf_append(&b, vstr_rxpo5g,
-						      cis[i + 1]);
-					break;
-
-				case HNBU_MACADDR:
-					if (!is_zero_ether_addr(&cis[i + 1]) &&
-					    !is_multicast_ether_addr(&cis[i + 1])) {
-						snprintf(eabuf, sizeof(eabuf),
-							"%pM", &cis[i + 1]);
-
-						/* set boardnum if HNBU_BOARDNUM not seen yet */
-						if (boardnum == -1)
-							boardnum =
-							    (cis[i + 5] << 8) +
-							    cis[i + 6];
-					}
-					break;
-
-				case HNBU_LEDDC:
-					/* CIS leddc only has 16bits, convert it to 32bits */
-					w32 = ((cis[i + 2] << 24) |	/* oncount */
-					       (cis[i + 1] << 8));	/* offcount */
-					varbuf_append(&b, vstr_leddc, w32);
-					break;
-
-				case HNBU_CHAINSWITCH:
-					varbuf_append(&b, vstr_txchain,
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_rxchain,
-						      cis[i + 2]);
-					varbuf_append(&b, vstr_antswitch,
-						      (cis[i + 4] << 8) +
-						      cis[i + 3]);
-					break;
-
-				case HNBU_REGREV:
-					varbuf_append(&b, vstr_regrev,
-						      cis[i + 1]);
-					break;
-
-				case HNBU_FEM:{
-						u16 fem =
-						    (cis[i + 2] << 8) + cis[i +
-									    1];
-						varbuf_append(&b,
-							      vstr_antswctl2g,
-							      (fem &
-							       SROM8_FEM_ANTSWLUT_MASK)
-							      >>
-							      SROM8_FEM_ANTSWLUT_SHIFT);
-						varbuf_append(&b, vstr_triso2g,
-							      (fem &
-							       SROM8_FEM_TR_ISO_MASK)
-							      >>
-							      SROM8_FEM_TR_ISO_SHIFT);
-						varbuf_append(&b,
-							      vstr_pdetrange2g,
-							      (fem &
-							       SROM8_FEM_PDET_RANGE_MASK)
-							      >>
-							      SROM8_FEM_PDET_RANGE_SHIFT);
-						varbuf_append(&b,
-							      vstr_extpagain2g,
-							      (fem &
-							       SROM8_FEM_EXTPA_GAIN_MASK)
-							      >>
-							      SROM8_FEM_EXTPA_GAIN_SHIFT);
-						varbuf_append(&b,
-							      vstr_tssipos2g,
-							      (fem &
-							       SROM8_FEM_TSSIPOS_MASK)
-							      >>
-							      SROM8_FEM_TSSIPOS_SHIFT);
-						if (tlen < 5)
-							break;
-
-						fem =
-						    (cis[i + 4] << 8) + cis[i +
-									    3];
-						varbuf_append(&b,
-							      vstr_antswctl5g,
-							      (fem &
-							       SROM8_FEM_ANTSWLUT_MASK)
-							      >>
-							      SROM8_FEM_ANTSWLUT_SHIFT);
-						varbuf_append(&b, vstr_triso5g,
-							      (fem &
-							       SROM8_FEM_TR_ISO_MASK)
-							      >>
-							      SROM8_FEM_TR_ISO_SHIFT);
-						varbuf_append(&b,
-							      vstr_pdetrange5g,
-							      (fem &
-							       SROM8_FEM_PDET_RANGE_MASK)
-							      >>
-							      SROM8_FEM_PDET_RANGE_SHIFT);
-						varbuf_append(&b,
-							      vstr_extpagain5g,
-							      (fem &
-							       SROM8_FEM_EXTPA_GAIN_MASK)
-							      >>
-							      SROM8_FEM_EXTPA_GAIN_SHIFT);
-						varbuf_append(&b,
-							      vstr_tssipos5g,
-							      (fem &
-							       SROM8_FEM_TSSIPOS_MASK)
-							      >>
-							      SROM8_FEM_TSSIPOS_SHIFT);
-						break;
-					}
-
-				case HNBU_PAPARMS_C0:
-					varbuf_append(&b, vstr_maxp2ga0,
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_itt2ga0,
-						      cis[i + 2]);
-					varbuf_append(&b, vstr_pa, 2, 0, 0,
-						      (cis[i + 4] << 8) +
-						      cis[i + 3]);
-					varbuf_append(&b, vstr_pa, 2, 1, 0,
-						      (cis[i + 6] << 8) +
-						      cis[i + 5]);
-					varbuf_append(&b, vstr_pa, 2, 2, 0,
-						      (cis[i + 8] << 8) +
-						      cis[i + 7]);
-					if (tlen < 31)
-						break;
-
-					varbuf_append(&b, vstr_maxp5ga0,
-						      cis[i + 9]);
-					varbuf_append(&b, vstr_itt5ga0,
-						      cis[i + 10]);
-					varbuf_append(&b, vstr_maxp5gha0,
-						      cis[i + 11]);
-					varbuf_append(&b, vstr_maxp5gla0,
-						      cis[i + 12]);
-					varbuf_append(&b, vstr_pa, 5, 0, 0,
-						      (cis[i + 14] << 8) +
-						      cis[i + 13]);
-					varbuf_append(&b, vstr_pa, 5, 1, 0,
-						      (cis[i + 16] << 8) +
-						      cis[i + 15]);
-					varbuf_append(&b, vstr_pa, 5, 2, 0,
-						      (cis[i + 18] << 8) +
-						      cis[i + 17]);
-					varbuf_append(&b, vstr_pahl, 5, 'l', 0,
-						      0,
-						      (cis[i + 20] << 8) +
-						      cis[i + 19]);
-					varbuf_append(&b, vstr_pahl, 5, 'l', 1,
-						      0,
-						      (cis[i + 22] << 8) +
-						      cis[i + 21]);
-					varbuf_append(&b, vstr_pahl, 5, 'l', 2,
-						      0,
-						      (cis[i + 24] << 8) +
-						      cis[i + 23]);
-					varbuf_append(&b, vstr_pahl, 5, 'h', 0,
-						      0,
-						      (cis[i + 26] << 8) +
-						      cis[i + 25]);
-					varbuf_append(&b, vstr_pahl, 5, 'h', 1,
-						      0,
-						      (cis[i + 28] << 8) +
-						      cis[i + 27]);
-					varbuf_append(&b, vstr_pahl, 5, 'h', 2,
-						      0,
-						      (cis[i + 30] << 8) +
-						      cis[i + 29]);
-					break;
-
-				case HNBU_PAPARMS_C1:
-					varbuf_append(&b, vstr_maxp2ga1,
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_itt2ga1,
-						      cis[i + 2]);
-					varbuf_append(&b, vstr_pa, 2, 0, 1,
-						      (cis[i + 4] << 8) +
-						      cis[i + 3]);
-					varbuf_append(&b, vstr_pa, 2, 1, 1,
-						      (cis[i + 6] << 8) +
-						      cis[i + 5]);
-					varbuf_append(&b, vstr_pa, 2, 2, 1,
-						      (cis[i + 8] << 8) +
-						      cis[i + 7]);
-					if (tlen < 31)
-						break;
-
-					varbuf_append(&b, vstr_maxp5ga1,
-						      cis[i + 9]);
-					varbuf_append(&b, vstr_itt5ga1,
-						      cis[i + 10]);
-					varbuf_append(&b, vstr_maxp5gha1,
-						      cis[i + 11]);
-					varbuf_append(&b, vstr_maxp5gla1,
-						      cis[i + 12]);
-					varbuf_append(&b, vstr_pa, 5, 0, 1,
-						      (cis[i + 14] << 8) +
-						      cis[i + 13]);
-					varbuf_append(&b, vstr_pa, 5, 1, 1,
-						      (cis[i + 16] << 8) +
-						      cis[i + 15]);
-					varbuf_append(&b, vstr_pa, 5, 2, 1,
-						      (cis[i + 18] << 8) +
-						      cis[i + 17]);
-					varbuf_append(&b, vstr_pahl, 5, 'l', 0,
-						      1,
-						      (cis[i + 20] << 8) +
-						      cis[i + 19]);
-					varbuf_append(&b, vstr_pahl, 5, 'l', 1,
-						      1,
-						      (cis[i + 22] << 8) +
-						      cis[i + 21]);
-					varbuf_append(&b, vstr_pahl, 5, 'l', 2,
-						      1,
-						      (cis[i + 24] << 8) +
-						      cis[i + 23]);
-					varbuf_append(&b, vstr_pahl, 5, 'h', 0,
-						      1,
-						      (cis[i + 26] << 8) +
-						      cis[i + 25]);
-					varbuf_append(&b, vstr_pahl, 5, 'h', 1,
-						      1,
-						      (cis[i + 28] << 8) +
-						      cis[i + 27]);
-					varbuf_append(&b, vstr_pahl, 5, 'h', 2,
-						      1,
-						      (cis[i + 30] << 8) +
-						      cis[i + 29]);
-					break;
-
-				case HNBU_PO_CCKOFDM:
-					varbuf_append(&b, vstr_cck2gpo,
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_ofdm2gpo,
-						      (cis[i + 6] << 24) +
-						      (cis[i + 5] << 16) +
-						      (cis[i + 4] << 8) +
-						      cis[i + 3]);
-					if (tlen < 19)
-						break;
-
-					varbuf_append(&b, vstr_ofdm5gpo,
-						      (cis[i + 10] << 24) +
-						      (cis[i + 9] << 16) +
-						      (cis[i + 8] << 8) +
-						      cis[i + 7]);
-					varbuf_append(&b, vstr_ofdm5glpo,
-						      (cis[i + 14] << 24) +
-						      (cis[i + 13] << 16) +
-						      (cis[i + 12] << 8) +
-						      cis[i + 11]);
-					varbuf_append(&b, vstr_ofdm5ghpo,
-						      (cis[i + 18] << 24) +
-						      (cis[i + 17] << 16) +
-						      (cis[i + 16] << 8) +
-						      cis[i + 15]);
-					break;
-
-				case HNBU_PO_MCS2G:
-					for (j = 0; j <= (tlen / 2); j++) {
-						varbuf_append(&b, vstr_mcspo, 2,
-							      j,
-							      (cis
-							       [i + 2 +
-								2 * j] << 8) +
-							      cis[i + 1 +
-								  2 * j]);
-					}
-					break;
-
-				case HNBU_PO_MCS5GM:
-					for (j = 0; j <= (tlen / 2); j++) {
-						varbuf_append(&b, vstr_mcspo, 5,
-							      j,
-							      (cis
-							       [i + 2 +
-								2 * j] << 8) +
-							      cis[i + 1 +
-								  2 * j]);
-					}
-					break;
-
-				case HNBU_PO_MCS5GLH:
-					for (j = 0; j <= (tlen / 4); j++) {
-						varbuf_append(&b, vstr_mcspohl,
-							      5, 'l', j,
-							      (cis
-							       [i + 2 +
-								2 * j] << 8) +
-							      cis[i + 1 +
-								  2 * j]);
-					}
-
-					for (j = 0; j <= (tlen / 4); j++) {
-						varbuf_append(&b, vstr_mcspohl,
-							      5, 'h', j,
-							      (cis
-							       [i +
-								((tlen / 2) +
-								 2) +
-								2 * j] << 8) +
-							      cis[i +
-								  ((tlen / 2) +
-								   1) + 2 * j]);
-					}
-
-					break;
-
-				case HNBU_PO_CDD:
-					varbuf_append(&b, vstr_cddpo,
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					break;
-
-				case HNBU_PO_STBC:
-					varbuf_append(&b, vstr_stbcpo,
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					break;
-
-				case HNBU_PO_40M:
-					varbuf_append(&b, vstr_bw40po,
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					break;
-
-				case HNBU_PO_40MDUP:
-					varbuf_append(&b, vstr_bwduppo,
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					break;
-
-				case HNBU_OFDMPO5G:
-					varbuf_append(&b, vstr_ofdm5gpo,
-						      (cis[i + 4] << 24) +
-						      (cis[i + 3] << 16) +
-						      (cis[i + 2] << 8) +
-						      cis[i + 1]);
-					varbuf_append(&b, vstr_ofdm5glpo,
-						      (cis[i + 8] << 24) +
-						      (cis[i + 7] << 16) +
-						      (cis[i + 6] << 8) +
-						      cis[i + 5]);
-					varbuf_append(&b, vstr_ofdm5ghpo,
-						      (cis[i + 12] << 24) +
-						      (cis[i + 11] << 16) +
-						      (cis[i + 10] << 8) +
-						      cis[i + 9]);
-					break;
-
-				case HNBU_CUSTOM1:
-					varbuf_append(&b, vstr_custom, 1,
-						      ((cis[i + 4] << 24) +
-						       (cis[i + 3] << 16) +
-						       (cis[i + 2] << 8) +
-						       cis[i + 1]));
-					break;
-
-#if defined(BCMSDIO)
-				case HNBU_SROM3SWRGN:
-					if (tlen >= 73) {
-						u16 srom[35];
-						u8 srev = cis[i + 1 + 70];
-						ASSERT(srev == 3);
-						/* make tuple value 16-bit aligned and parse it */
-						memcpy(srom, &cis[i + 1],
-						       sizeof(srom));
-						_initvars_srom_pci(srev, srom,
-								   SROM3_SWRGN_OFF,
-								   &b);
-						/* 2.4G antenna gain is included in SROM */
-						ag_init = true;
-						/* Ethernet MAC address is included in SROM */
-						eabuf[0] = 0;
-						boardnum = -1;
-					}
-					/* create extra variables */
-					if (tlen >= 75)
-						varbuf_append(&b, vstr_vendid,
-							      (cis[i + 1 + 73]
-							       << 8) + cis[i +
-									   1 +
-									   72]);
-					if (tlen >= 77)
-						varbuf_append(&b, vstr_devid,
-							      (cis[i + 1 + 75]
-							       << 8) + cis[i +
-									   1 +
-									   74]);
-					if (tlen >= 79)
-						varbuf_append(&b, vstr_xtalfreq,
-							      (cis[i + 1 + 77]
-							       << 8) + cis[i +
-									   1 +
-									   76]);
-					break;
-#endif				/* defined(BCMSDIO) */
-
-				case HNBU_CCKFILTTYPE:
-					varbuf_append(&b, vstr_cckdigfilttype,
-						      (cis[i + 1]));
-					break;
-				}
-
-				break;
-			}
-			i += tlen;
-		} while (tup != CISTPL_END);
-	}
-
-	if (boardnum != -1) {
-		varbuf_append(&b, vstr_boardnum, boardnum);
-	}
-
-	if (eabuf[0]) {
-		varbuf_append(&b, vstr_macaddr, eabuf);
-	}
-
-	/* if there is no antenna gain field, set default */
-	if (getvar(NULL, "ag0") == NULL && ag_init == false) {
-		varbuf_append(&b, vstr_ag, 0, 0xff);
-	}
-
-	/* final nullbyte terminator */
-	ASSERT(b.size >= 1);
-	*b.buf++ = '\0';
-
-	ASSERT(b.buf - base <= MAXSZ_NVRAM_VARS);
-	err = initvars_table(base, b.buf, vars, count);
-
-	kfree(base);
-	return err;
-}
-
 /* In chips with chipcommon rev 32 and later, the srom is in chipcommon,
  * not in the bus cores.
  */
-- 
1.7.1


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux