1 --- a/arch/mips/bcm47xx/setup.c
2 +++ b/arch/mips/bcm47xx/setup.c
3 @@ -59,10 +59,23 @@ static void bcm47xx_machine_halt(void)
6 #define READ_FROM_NVRAM(_outvar, name, buf) \
7 - if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\
8 + if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
9 sprom->_outvar = simple_strtoul(buf, NULL, 0);
11 -static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
12 +static inline int nvram_getprefix(const char *prefix, char *name,
18 + snprintf(key, sizeof(key), "%s%s", prefix, name);
19 + return nvram_getenv(key, buf, len);
22 + return nvram_getenv(name, buf, len);
25 +static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
29 @@ -71,11 +84,11 @@ static void bcm47xx_fill_sprom(struct ss
31 sprom->revision = 1; /* Fallback: Old hardware does not define this. */
32 READ_FROM_NVRAM(revision, "sromrev", buf);
33 - if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
34 + if (nvram_getprefix(prefix, "il0macaddr", buf, sizeof(buf)) >= 0)
35 nvram_parse_macaddr(buf, sprom->il0mac);
36 - if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
37 + if (nvram_getprefix(prefix, "et0macaddr", buf, sizeof(buf)) >= 0)
38 nvram_parse_macaddr(buf, sprom->et0mac);
39 - if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
40 + if (nvram_getprefix(prefix, "et1macaddr", buf, sizeof(buf)) >= 0)
41 nvram_parse_macaddr(buf, sprom->et1mac);
42 READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf);
43 READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf);
44 @@ -127,14 +140,14 @@ static void bcm47xx_fill_sprom(struct ss
45 READ_FROM_NVRAM(ofdm5gpo, "ofdm5gpo", buf);
46 READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf);
48 - if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0) {
49 + if (nvram_getprefix(prefix, "boardflags", buf, sizeof(buf)) >= 0) {
50 boardflags = simple_strtoul(buf, NULL, 0);
52 sprom->boardflags_lo = (boardflags & 0x0000FFFFU);
53 sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16;
56 - if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0) {
57 + if (nvram_getprefix(prefix, "boardflags2", buf, sizeof(buf)) >= 0) {
58 boardflags = simple_strtoul(buf, NULL, 0);
60 sprom->boardflags2_lo = (boardflags & 0x0000FFFFU);
61 @@ -160,7 +173,7 @@ static int bcm47xx_get_invariants(struct
62 if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
63 iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
65 - bcm47xx_fill_sprom(&iv->sprom);
66 + bcm47xx_fill_sprom(&iv->sprom, NULL);
68 if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
69 iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);