Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/drivers/firmware/broadcom/bcm47xx_nvram.c 2023-02-05 13:19:33.299888563 +0100
- +++ b/drivers/firmware/broadcom/bcm47xx_nvram.c 2023-02-05 13:22:28.556220624 +0100
- @@ -164,6 +164,20 @@
- 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;
- --- a/include/linux/bcm47xx_nvram.h 2023-02-05 13:03:29.604243964 +0100
- +++ b/include/linux/bcm47xx_nvram.h 2023-02-05 13:18:34.899663357 +0100
- @@ -20,6 +20,7 @@
- {
- 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 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 */
- --- a/drivers/nvmem/brcm_nvram.c 2023-02-05 14:58:33.089372758 +0100
- +++ b/drivers/nvmem/brcm_nvram.c 2023-02-05 15:03:03.862249690 +0100
- @@ -12,6 +12,7 @@
- #include <linux/of.h>
- #include <linux/platform_device.h>
- #include <linux/slab.h>
- +#include <linux/vmalloc.h>
- #define NVRAM_MAGIC "FLSH"
- @@ -30,9 +31,17 @@
- __le32 config_ncdl; /* ncdl values for memc */
- };
- +int bcm47xx_nvram_read(unsigned int offset, char *val, size_t val_len);
- +
- static int brcm_nvram_read(void *context, unsigned int offset, void *val,
- size_t bytes)
- {
- +#ifdef CONFIG_BCM47XX_NVRAM
- +
- + return bcm47xx_nvram_read(offset, val, bytes);
- +
- +#else
- +
- struct brcm_nvram *priv = context;
- u8 *dst = val;
- @@ -40,6 +49,8 @@
- *dst++ = readb(priv->base + offset++);
- return 0;
- +
- +#endif
- }
- static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement