bcm47xx_nvram.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. */
  4. #ifndef __BCM47XX_NVRAM_H
  5. #define __BCM47XX_NVRAM_H
  6. #include <linux/errno.h>
  7. #include <linux/types.h>
  8. #include <linux/kernel.h>
  9. #include <linux/vmalloc.h>
  10. #ifdef CONFIG_BCM47XX_NVRAM
  11. int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
  12. int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
  13. int bcm47xx_nvram_gpio_pin(const char *name);
  14. char *bcm47xx_nvram_get_contents(size_t *val_len);
  15. static inline void bcm47xx_nvram_release_contents(char *nvram)
  16. {
  17. vfree(nvram);
  18. };
  19. #else
  20. static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
  21. {
  22. return -ENOTSUPP;
  23. };
  24. static inline int bcm47xx_nvram_getenv(const char *name, char *val,
  25. size_t val_len)
  26. {
  27. return -ENOTSUPP;
  28. };
  29. static inline int bcm47xx_nvram_gpio_pin(const char *name)
  30. {
  31. return -ENOTSUPP;
  32. };
  33. static inline char *bcm47xx_nvram_get_contents(size_t *val_len)
  34. {
  35. return NULL;
  36. };
  37. static inline void bcm47xx_nvram_release_contents(char *nvram)
  38. {
  39. };
  40. #endif
  41. #endif /* __BCM47XX_NVRAM_H */