nvram.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * NVRAM definitions and access functions.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #ifndef _ASM_POWERPC_NVRAM_H
  10. #define _ASM_POWERPC_NVRAM_H
  11. #include <linux/errno.h>
  12. #include <linux/list.h>
  13. #include <uapi/asm/nvram.h>
  14. #ifdef CONFIG_PPC_PSERIES
  15. extern int nvram_write_error_log(char * buff, int length,
  16. unsigned int err_type, unsigned int err_seq);
  17. extern int nvram_read_error_log(char * buff, int length,
  18. unsigned int * err_type, unsigned int *err_seq);
  19. extern int nvram_clear_error_log(void);
  20. extern int pSeries_nvram_init(void);
  21. #endif /* CONFIG_PPC_PSERIES */
  22. #ifdef CONFIG_MMIO_NVRAM
  23. extern int mmio_nvram_init(void);
  24. #else
  25. static inline int mmio_nvram_init(void)
  26. {
  27. return -ENODEV;
  28. }
  29. #endif
  30. extern int __init nvram_scan_partitions(void);
  31. extern loff_t nvram_create_partition(const char *name, int sig,
  32. int req_size, int min_size);
  33. extern int nvram_remove_partition(const char *name, int sig,
  34. const char *exceptions[]);
  35. extern int nvram_get_partition_size(loff_t data_index);
  36. extern loff_t nvram_find_partition(const char *name, int sig, int *out_size);
  37. /* Return partition offset in nvram */
  38. extern int pmac_get_partition(int partition);
  39. /* Direct access to XPRAM on PowerMacs */
  40. extern u8 pmac_xpram_read(int xpaddr);
  41. extern void pmac_xpram_write(int xpaddr, u8 data);
  42. /* Synchronize NVRAM */
  43. extern void nvram_sync(void);
  44. /* Determine NVRAM size */
  45. extern ssize_t nvram_get_size(void);
  46. /* Normal access to NVRAM */
  47. extern unsigned char nvram_read_byte(int i);
  48. extern void nvram_write_byte(unsigned char c, int i);
  49. #endif /* _ASM_POWERPC_NVRAM_H */