@@ -182,6 +182,20 @@ static int nvram_init(void)
return -ENXIO;
}
+int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len)
+{
+ if (!nvram_len)
+ return -ENXIO;
+
+ if ((offset+val_len) > nvram_len)
+ return -EINVAL;
+
+ while (val_len--)
+ *val++ = nvram_buf[offset++];
+
+ return 0;
+}
+
int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
{
char *var, *value, *end, *eq;
@@ -20,6 +20,7 @@ static inline void bcm47xx_nvram_release_contents(char *nvram)
{
vfree(nvram);
};
+int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len);
#else
static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start,
size_t res_size)
@@ -48,6 +49,11 @@ static inline char *bcm47xx_nvram_get_contents(size_t *val_len)
static inline void bcm47xx_nvram_release_contents(char *nvram)
{
};
+
+static inline int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len)
+{
+ return -ENOTSUPP;
+}:
#endif
#endif /* __BCM47XX_NVRAM_H */