Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Paul Mackerras | c55377e | 2005-11-14 17:22:01 +1100 | [diff] [blame] | 2 | * NVRAM definitions and access functions. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | */ |
Paul Mackerras | c55377e | 2005-11-14 17:22:01 +1100 | [diff] [blame] | 9 | #ifndef _ASM_POWERPC_NVRAM_H |
| 10 | #define _ASM_POWERPC_NVRAM_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | |
Andrew Morton | 134d495 | 2008-02-04 22:27:31 -0800 | [diff] [blame] | 12 | |
Benjamin Herrenschmidt | 74d51d0 | 2010-07-29 14:45:24 +1000 | [diff] [blame] | 13 | #include <linux/errno.h> |
Andrew Morton | 134d495 | 2008-02-04 22:27:31 -0800 | [diff] [blame] | 14 | #include <linux/list.h> |
David Howells | c3617f7 | 2012-10-09 09:47:26 +0100 | [diff] [blame^] | 15 | #include <uapi/asm/nvram.h> |
Andrew Morton | 134d495 | 2008-02-04 22:27:31 -0800 | [diff] [blame] | 16 | |
Benjamin Herrenschmidt | edc79a2 | 2010-08-02 11:18:09 +1000 | [diff] [blame] | 17 | #ifdef CONFIG_PPC_PSERIES |
Linas Vepstas | 0f2342c | 2007-08-10 06:56:41 +1000 | [diff] [blame] | 18 | extern int nvram_write_error_log(char * buff, int length, |
| 19 | unsigned int err_type, unsigned int err_seq); |
| 20 | extern int nvram_read_error_log(char * buff, int length, |
| 21 | unsigned int * err_type, unsigned int *err_seq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | extern int nvram_clear_error_log(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | extern int pSeries_nvram_init(void); |
Benjamin Herrenschmidt | edc79a2 | 2010-08-02 11:18:09 +1000 | [diff] [blame] | 24 | #endif /* CONFIG_PPC_PSERIES */ |
Ishizaki Kou | 4751505 | 2007-12-13 21:11:36 +1100 | [diff] [blame] | 25 | |
| 26 | #ifdef CONFIG_MMIO_NVRAM |
Arnd Bergmann | f3f66f5 | 2005-10-31 20:08:37 -0500 | [diff] [blame] | 27 | extern int mmio_nvram_init(void); |
Ishizaki Kou | 4751505 | 2007-12-13 21:11:36 +1100 | [diff] [blame] | 28 | #else |
| 29 | static inline int mmio_nvram_init(void) |
| 30 | { |
| 31 | return -ENODEV; |
| 32 | } |
| 33 | #endif |
| 34 | |
Benjamin Herrenschmidt | edc79a2 | 2010-08-02 11:18:09 +1000 | [diff] [blame] | 35 | extern int __init nvram_scan_partitions(void); |
| 36 | extern loff_t nvram_create_partition(const char *name, int sig, |
| 37 | int req_size, int min_size); |
Jim Keniston | 0f4ac13 | 2011-02-09 12:43:13 +0000 | [diff] [blame] | 38 | extern int nvram_remove_partition(const char *name, int sig, |
| 39 | const char *exceptions[]); |
Benjamin Herrenschmidt | edc79a2 | 2010-08-02 11:18:09 +1000 | [diff] [blame] | 40 | extern int nvram_get_partition_size(loff_t data_index); |
| 41 | extern loff_t nvram_find_partition(const char *name, int sig, int *out_size); |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* Return partition offset in nvram */ |
| 44 | extern int pmac_get_partition(int partition); |
| 45 | |
| 46 | /* Direct access to XPRAM on PowerMacs */ |
| 47 | extern u8 pmac_xpram_read(int xpaddr); |
| 48 | extern void pmac_xpram_write(int xpaddr, u8 data); |
| 49 | |
| 50 | /* Synchronize NVRAM */ |
Paul Mackerras | c55377e | 2005-11-14 17:22:01 +1100 | [diff] [blame] | 51 | extern void nvram_sync(void); |
| 52 | |
Martyn Welch | d331d83 | 2009-08-13 09:03:02 +0100 | [diff] [blame] | 53 | /* Determine NVRAM size */ |
| 54 | extern ssize_t nvram_get_size(void); |
| 55 | |
Paul Mackerras | c55377e | 2005-11-14 17:22:01 +1100 | [diff] [blame] | 56 | /* Normal access to NVRAM */ |
| 57 | extern unsigned char nvram_read_byte(int i); |
| 58 | extern void nvram_write_byte(unsigned char c, int i); |
Paul Mackerras | c55377e | 2005-11-14 17:22:01 +1100 | [diff] [blame] | 59 | #endif /* _ASM_POWERPC_NVRAM_H */ |