1
2
3
4
5
6
7
8
9#ifndef _ASM_POWERPC_NVRAM_H
10#define _ASM_POWERPC_NVRAM_H
11
12#include <linux/types.h>
13#include <linux/errno.h>
14#include <linux/list.h>
15#include <uapi/asm/nvram.h>
16
17
18
19
20
21
22#define OOPS_HDR_VERSION 5000
23
24struct err_log_info {
25 __be32 error_type;
26 __be32 seq_num;
27};
28
29struct nvram_os_partition {
30 const char *name;
31 int req_size;
32 int min_size;
33 long size;
34 long index;
35 bool os_partition;
36};
37
38struct oops_log_info {
39 __be16 version;
40 __be16 report_length;
41 __be64 timestamp;
42} __attribute__((packed));
43
44extern struct nvram_os_partition oops_log_partition;
45
46#ifdef CONFIG_PPC_PSERIES
47extern struct nvram_os_partition rtas_log_partition;
48
49extern int nvram_write_error_log(char * buff, int length,
50 unsigned int err_type, unsigned int err_seq);
51extern int nvram_read_error_log(char * buff, int length,
52 unsigned int * err_type, unsigned int *err_seq);
53extern int nvram_clear_error_log(void);
54extern int pSeries_nvram_init(void);
55#endif
56
57#ifdef CONFIG_MMIO_NVRAM
58extern int mmio_nvram_init(void);
59#else
60static inline int mmio_nvram_init(void)
61{
62 return -ENODEV;
63}
64#endif
65
66extern int __init nvram_scan_partitions(void);
67extern loff_t nvram_create_partition(const char *name, int sig,
68 int req_size, int min_size);
69extern int nvram_remove_partition(const char *name, int sig,
70 const char *exceptions[]);
71extern int nvram_get_partition_size(loff_t data_index);
72extern loff_t nvram_find_partition(const char *name, int sig, int *out_size);
73
74
75extern int pmac_get_partition(int partition);
76
77
78extern u8 pmac_xpram_read(int xpaddr);
79extern void pmac_xpram_write(int xpaddr, u8 data);
80
81
82extern void nvram_sync(void);
83
84
85extern int __init nvram_init_os_partition(struct nvram_os_partition *part);
86
87
88extern void __init nvram_init_oops_partition(int rtas_partition_exists);
89
90
91extern int nvram_read_partition(struct nvram_os_partition *part, char *buff,
92 int length, unsigned int *err_type,
93 unsigned int *error_log_cnt);
94
95
96extern int nvram_write_os_partition(struct nvram_os_partition *part,
97 char *buff, int length,
98 unsigned int err_type,
99 unsigned int error_log_cnt);
100
101
102extern ssize_t nvram_get_size(void);
103
104
105extern unsigned char nvram_read_byte(int i);
106extern void nvram_write_byte(unsigned char c, int i);
107#endif
108