0001
0002
0003
0004
0005 #ifndef _ASM_POWERPC_NVRAM_H
0006 #define _ASM_POWERPC_NVRAM_H
0007
0008 #include <linux/types.h>
0009 #include <linux/errno.h>
0010 #include <linux/list.h>
0011 #include <uapi/asm/nvram.h>
0012
0013
0014
0015
0016
0017
0018 #define OOPS_HDR_VERSION 5000
0019
0020 struct err_log_info {
0021 __be32 error_type;
0022 __be32 seq_num;
0023 };
0024
0025 struct nvram_os_partition {
0026 const char *name;
0027 int req_size;
0028 int min_size;
0029 long size;
0030 long index;
0031 bool os_partition;
0032 };
0033
0034 struct oops_log_info {
0035 __be16 version;
0036 __be16 report_length;
0037 __be64 timestamp;
0038 } __attribute__((packed));
0039
0040 extern struct nvram_os_partition oops_log_partition;
0041
0042 #ifdef CONFIG_PPC_PSERIES
0043 extern struct nvram_os_partition rtas_log_partition;
0044
0045 extern int nvram_write_error_log(char * buff, int length,
0046 unsigned int err_type, unsigned int err_seq);
0047 extern int nvram_read_error_log(char * buff, int length,
0048 unsigned int * err_type, unsigned int *err_seq);
0049 extern int nvram_clear_error_log(void);
0050 extern int pSeries_nvram_init(void);
0051 #endif
0052
0053 #ifdef CONFIG_MMIO_NVRAM
0054 extern int mmio_nvram_init(void);
0055 #else
0056 static inline int mmio_nvram_init(void)
0057 {
0058 return -ENODEV;
0059 }
0060 #endif
0061
0062 extern int __init nvram_scan_partitions(void);
0063 extern loff_t nvram_create_partition(const char *name, int sig,
0064 int req_size, int min_size);
0065 extern int nvram_remove_partition(const char *name, int sig,
0066 const char *exceptions[]);
0067 extern int nvram_get_partition_size(loff_t data_index);
0068 extern loff_t nvram_find_partition(const char *name, int sig, int *out_size);
0069
0070
0071 extern int pmac_get_partition(int partition);
0072
0073
0074 extern u8 pmac_xpram_read(int xpaddr);
0075 extern void pmac_xpram_write(int xpaddr, u8 data);
0076
0077
0078 extern int __init nvram_init_os_partition(struct nvram_os_partition *part);
0079
0080
0081 extern void __init nvram_init_oops_partition(int rtas_partition_exists);
0082
0083
0084 extern int nvram_read_partition(struct nvram_os_partition *part, char *buff,
0085 int length, unsigned int *err_type,
0086 unsigned int *error_log_cnt);
0087
0088
0089 extern int nvram_write_os_partition(struct nvram_os_partition *part,
0090 char *buff, int length,
0091 unsigned int err_type,
0092 unsigned int error_log_cnt);
0093
0094 #endif