1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
--- a/driver/bcmsrom.c
+++ b/driver/bcmsrom.c
@@ -39,6 +39,10 @@
#include <sbsdpcmdev.h>
#endif
+#ifdef CONFIG_SSB
+#include <linux/ssb/ssb.h>
+#endif
+
#ifdef WLTEST
#include <sbsprom.h>
#endif /* WLTEST */
@@ -2058,6 +2062,11 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
bool flash = FALSE;
int err = 0;
+#ifdef CONFIG_SSB
+ struct ssb_sprom *fbrom;
+ char eabuf[18];
+#endif
+
/*
* Apply CRC over SROM content regardless SROM is present or not,
* and use variable <devpath>sromrev's existance in flash to decide
@@ -2120,6 +2129,62 @@ BCMATTACHFN(initvars_srom_pci)(si_t *sih
goto varscont;
}
+#ifdef CONFIG_SSB
+ base = vp = MALLOC(osh, MAXSZ_NVRAM_VARS);
+
+ if( base != NULL )
+ {
+ varbuf_init(&b, base, MAXSZ_NVRAM_VARS);
+
+ /* Try to load ssb fallback sprom */
+ if ((fbrom = ssb_get_fallback_sprom()) != NULL)
+ {
+ printk("Got version %i SPROM from SSB\n", fbrom->revision);
+
+ varbuf_append(&b, vstr_sromrev, fbrom->revision);
+ varbuf_append(&b, vstr_boardrev, fbrom->board_rev);
+
+ /* ToDo: map fbrom->country_code */
+ varbuf_append(&b, vstr_noccode);
+
+ varbuf_append(&b, vstr_aa2g, fbrom->ant_available_bg);
+
+ varbuf_append(&b, vstr_pa0b[0], fbrom->pa0b0);
+ varbuf_append(&b, vstr_pa1b[0], fbrom->pa1b0);
+ varbuf_append(&b, vstr_pa0b[1], fbrom->pa0b1);
+ varbuf_append(&b, vstr_pa1b[1], fbrom->pa1b1);
+ varbuf_append(&b, vstr_pa0b[2], fbrom->pa0b2);
+ varbuf_append(&b, vstr_pa1b[2], fbrom->pa1b2);
+
+ varbuf_append(&b, vstr_pa0maxpwr, fbrom->maxpwr_bg);
+ varbuf_append(&b, vstr_pa0itssit, fbrom->itssi_bg);
+
+ varbuf_append(&b, vstr_boardflags, (fbrom->boardflags_hi << 16) | fbrom->boardflags_lo);
+ varbuf_append(&b, vstr_boardflags2, (fbrom->boardflags2_hi << 16) | fbrom->boardflags2_lo);
+
+ snprintf(eabuf, sizeof(eabuf), "%02x:%02x:%02x:%02x:%02x:%02x",
+ fbrom->il0mac[0], fbrom->il0mac[1], fbrom->il0mac[2],
+ fbrom->il0mac[3], fbrom->il0mac[4], fbrom->il0mac[5]
+ );
+
+ varbuf_append(&b, vstr_macaddr, eabuf);
+ }
+
+ /* final nullbyte terminator */
+ ASSERT(b.size >= 1);
+ vp = b.buf;
+ *vp++ = '\0';
+
+ ASSERT((vp - base) <= MAXSZ_NVRAM_VARS);
+ goto varsdone;
+ }
+ else
+ {
+ err = -2;
+ goto errout;
+ }
+#endif
+
BS_ERROR(("SROM CRC Error\n"));
#if defined(WLTEST)
|