Blame view
include/linux/pstore_ram.h
3.82 KB
9c92ab619
|
1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
cddb8751c
|
2 3 4 5 |
/* * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com> * Copyright (C) 2011 Kees Cook <keescook@chromium.org> * Copyright (C) 2011 Google, Inc. |
cddb8751c
|
6 |
*/ |
1894a253d
|
7 8 |
#ifndef __LINUX_PSTORE_RAM_H__ #define __LINUX_PSTORE_RAM_H__ |
c3b92ce9e
|
9 |
|
5bf6d1b92
|
10 |
#include <linux/compiler.h> |
cddb8751c
|
11 |
#include <linux/device.h> |
5bf6d1b92
|
12 |
#include <linux/init.h> |
cddb8751c
|
13 14 |
#include <linux/kernel.h> #include <linux/list.h> |
f0f23e546
|
15 |
#include <linux/pstore.h> |
cddb8751c
|
16 |
#include <linux/types.h> |
cddb8751c
|
17 |
|
663deb478
|
18 19 20 21 22 23 |
/* * Choose whether access to the RAM zone requires locking or not. If a zone * can be written to from different CPUs like with ftrace for example, then * PRZ_FLAG_NO_LOCK is used. For all other cases, locking is required. */ #define PRZ_FLAG_NO_LOCK BIT(0) |
c208f7d4b
|
24 25 26 27 |
/* * If a PRZ should only have a single-boot lifetime, this marks it as * getting wiped after its contents get copied out after boot. */ |
7684bd334
|
28 |
#define PRZ_FLAG_ZAP_OLD BIT(1) |
663deb478
|
29 |
|
cddb8751c
|
30 |
struct persistent_ram_buffer; |
67a101f57
|
31 |
struct rs_control; |
cddb8751c
|
32 |
|
c31ad081e
|
33 34 35 36 37 |
struct persistent_ram_ecc_info { int block_size; int ecc_size; int symsize; int poly; |
f2531f197
|
38 |
uint16_t *par; |
c31ad081e
|
39 |
}; |
c208f7d4b
|
40 41 42 43 44 45 46 |
/** * struct persistent_ram_zone - Details of a persistent RAM zone (PRZ) * used as a pstore backend * * @paddr: physical address of the mapped RAM area * @size: size of mapping * @label: unique name of this PRZ |
f0f23e546
|
47 |
* @type: frontend type for this PRZ |
c208f7d4b
|
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
* @flags: holds PRZ_FLAGS_* bits * * @buffer_lock: * locks access to @buffer "size" bytes and "start" offset * @buffer: * pointer to actual RAM area managed by this PRZ * @buffer_size: * bytes in @buffer->data (not including any trailing ECC bytes) * * @par_buffer: * pointer into @buffer->data containing ECC bytes for @buffer->data * @par_header: * pointer into @buffer->data containing ECC bytes for @buffer header * (i.e. all fields up to @data) * @rs_decoder: * RSLIB instance for doing ECC calculations * @corrected_bytes: * ECC corrected bytes accounting since boot * @bad_blocks: * ECC uncorrectable bytes accounting since boot * @ecc_info: * ECC configuration details * * @old_log: * saved copy of @buffer->data prior to most recent wipe * @old_log_size: * bytes contained in @old_log * */ |
cddb8751c
|
77 78 79 80 |
struct persistent_ram_zone { phys_addr_t paddr; size_t size; void *vaddr; |
1227daa43
|
81 |
char *label; |
f0f23e546
|
82 |
enum pstore_type_id type; |
663deb478
|
83 |
u32 flags; |
c208f7d4b
|
84 |
|
109704492
|
85 |
raw_spinlock_t buffer_lock; |
c208f7d4b
|
86 87 |
struct persistent_ram_buffer *buffer; size_t buffer_size; |
cddb8751c
|
88 |
|
cddb8751c
|
89 90 91 92 93 |
char *par_buffer; char *par_header; struct rs_control *rs_decoder; int corrected_bytes; int bad_blocks; |
c31ad081e
|
94 |
struct persistent_ram_ecc_info ecc_info; |
cddb8751c
|
95 96 97 98 |
char *old_log; size_t old_log_size; }; |
f568f6ca8
|
99 |
struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size, |
027bc8b08
|
100 |
u32 sig, struct persistent_ram_ecc_info *ecc_info, |
1227daa43
|
101 |
unsigned int memtype, u32 flags, char *label); |
cddb8751c
|
102 |
void persistent_ram_free(struct persistent_ram_zone *prz); |
fce397930
|
103 |
void persistent_ram_zap(struct persistent_ram_zone *prz); |
cddb8751c
|
104 105 |
int persistent_ram_write(struct persistent_ram_zone *prz, const void *s, |
5bf6d1b92
|
106 107 108 |
unsigned int count); int persistent_ram_write_user(struct persistent_ram_zone *prz, const void __user *s, unsigned int count); |
cddb8751c
|
109 |
|
201e4aca5
|
110 |
void persistent_ram_save_old(struct persistent_ram_zone *prz); |
cddb8751c
|
111 112 113 114 115 |
size_t persistent_ram_old_size(struct persistent_ram_zone *prz); void *persistent_ram_old(struct persistent_ram_zone *prz); void persistent_ram_free_old(struct persistent_ram_zone *prz); ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz, char *str, size_t len); |
c3b92ce9e
|
116 117 118 119 120 |
/* * Ramoops platform data * @mem_size memory size for ramoops * @mem_address physical memory address to contain ramoops */ |
a1cf53ac6
|
121 |
#define RAMOOPS_FLAG_FTRACE_PER_CPU BIT(0) |
c3b92ce9e
|
122 123 |
struct ramoops_platform_data { unsigned long mem_size; |
764fd639d
|
124 |
phys_addr_t mem_address; |
027bc8b08
|
125 |
unsigned int mem_type; |
3e5c4fadb
|
126 |
unsigned long record_size; |
b5d38e9bf
|
127 |
unsigned long console_size; |
a694d1b59
|
128 |
unsigned long ftrace_size; |
9d5438f46
|
129 |
unsigned long pmsg_size; |
791205e3e
|
130 |
int max_reason; |
a1cf53ac6
|
131 |
u32 flags; |
c31ad081e
|
132 |
struct persistent_ram_ecc_info ecc_info; |
c3b92ce9e
|
133 134 135 |
}; #endif |