powerpc/mm: Fixup tlbie vs mtpidr/mtlpidr ordering issue on POWER9
[linux-2.6-block.git] / arch / powerpc / include / asm / nvram.h
CommitLineData
2874c5fd 1/* SPDX-License-Identifier: GPL-2.0-or-later */
1da177e4 2/*
c55377ee 3 * NVRAM definitions and access functions.
1da177e4 4 */
c55377ee
PM
5#ifndef _ASM_POWERPC_NVRAM_H
6#define _ASM_POWERPC_NVRAM_H
1da177e4 7
78989f0a 8#include <linux/types.h>
74d51d02 9#include <linux/errno.h>
134d4956 10#include <linux/list.h>
c3617f72 11#include <uapi/asm/nvram.h>
134d4956 12
78989f0a
HB
13/*
14 * Set oops header version to distinguish between old and new format header.
15 * lnx,oops-log partition max size is 4000, header version > 4000 will
16 * help in identifying new header.
17 */
18#define OOPS_HDR_VERSION 5000
19
20struct err_log_info {
21 __be32 error_type;
22 __be32 seq_num;
23};
24
25struct nvram_os_partition {
26 const char *name;
27 int req_size; /* desired size, in bytes */
28 int min_size; /* minimum acceptable size (0 means req_size) */
29 long size; /* size of data portion (excluding err_log_info) */
30 long index; /* offset of data portion of partition */
31 bool os_partition; /* partition initialized by OS, not FW */
32};
33
34struct oops_log_info {
35 __be16 version;
36 __be16 report_length;
37 __be64 timestamp;
38} __attribute__((packed));
39
40extern struct nvram_os_partition oops_log_partition;
41
edc79a2f 42#ifdef CONFIG_PPC_PSERIES
78989f0a
HB
43extern struct nvram_os_partition rtas_log_partition;
44
0f2342c8
LV
45extern int nvram_write_error_log(char * buff, int length,
46 unsigned int err_type, unsigned int err_seq);
47extern int nvram_read_error_log(char * buff, int length,
48 unsigned int * err_type, unsigned int *err_seq);
1da177e4 49extern int nvram_clear_error_log(void);
1da177e4 50extern int pSeries_nvram_init(void);
edc79a2f 51#endif /* CONFIG_PPC_PSERIES */
4751505c
IK
52
53#ifdef CONFIG_MMIO_NVRAM
f3f66f59 54extern int mmio_nvram_init(void);
4751505c
IK
55#else
56static inline int mmio_nvram_init(void)
57{
58 return -ENODEV;
59}
60#endif
61
edc79a2f
BH
62extern int __init nvram_scan_partitions(void);
63extern loff_t nvram_create_partition(const char *name, int sig,
64 int req_size, int min_size);
0f4ac132
JK
65extern int nvram_remove_partition(const char *name, int sig,
66 const char *exceptions[]);
edc79a2f
BH
67extern int nvram_get_partition_size(loff_t data_index);
68extern loff_t nvram_find_partition(const char *name, int sig, int *out_size);
69
1da177e4
LT
70/* Return partition offset in nvram */
71extern int pmac_get_partition(int partition);
72
73/* Direct access to XPRAM on PowerMacs */
74extern u8 pmac_xpram_read(int xpaddr);
75extern void pmac_xpram_write(int xpaddr, u8 data);
76
78989f0a
HB
77/* Initialize NVRAM OS partition */
78extern int __init nvram_init_os_partition(struct nvram_os_partition *part);
79
80/* Initialize NVRAM oops partition */
81extern void __init nvram_init_oops_partition(int rtas_partition_exists);
82
83/* Read a NVRAM partition */
84extern int nvram_read_partition(struct nvram_os_partition *part, char *buff,
85 int length, unsigned int *err_type,
86 unsigned int *error_log_cnt);
87
88/* Write to NVRAM OS partition */
89extern int nvram_write_os_partition(struct nvram_os_partition *part,
90 char *buff, int length,
91 unsigned int err_type,
92 unsigned int error_log_cnt);
93
c55377ee 94#endif /* _ASM_POWERPC_NVRAM_H */