blob: 958c48d8905c4f4c6ce7cc7c45545b53eff13e2e [file] [log] [blame]
Anton Vorontsov060287b2012-07-09 17:10:41 -07001#ifndef __PSTORE_INTERNAL_H__
2#define __PSTORE_INTERNAL_H__
3
4#include <linux/pstore.h>
5
6#if NR_CPUS <= 2 && defined(CONFIG_ARM_THUMB)
7#define PSTORE_CPU_IN_IP 0x1
8#elif NR_CPUS <= 4 && defined(CONFIG_ARM)
9#define PSTORE_CPU_IN_IP 0x3
10#endif
11
12struct pstore_ftrace_record {
13 unsigned long ip;
14 unsigned long parent_ip;
15#ifndef PSTORE_CPU_IN_IP
16 unsigned int cpu;
17#endif
18};
19
20static inline void
21pstore_ftrace_encode_cpu(struct pstore_ftrace_record *rec, unsigned int cpu)
22{
23#ifndef PSTORE_CPU_IN_IP
24 rec->cpu = cpu;
25#else
26 rec->ip |= cpu;
27#endif
28}
29
30static inline unsigned int
31pstore_ftrace_decode_cpu(struct pstore_ftrace_record *rec)
32{
33#ifndef PSTORE_CPU_IN_IP
34 return rec->cpu;
35#else
36 return rec->ip & PSTORE_CPU_IN_IP;
37#endif
38}
39
40extern struct pstore_info *psinfo;
41
Luck, Tony366f7e72011-03-18 15:33:43 -070042extern void pstore_set_kmsg_bytes(int);
Luck, Tony6dda9262011-08-11 15:14:39 -070043extern void pstore_get_records(int);
Tony Luckca01d6d2010-12-28 14:25:21 -080044extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id,
45 char *data, size_t size,
Matthew Garrett638c1fd2011-07-21 16:57:52 -040046 struct timespec time, struct pstore_info *psi);
Tony Luckca01d6d2010-12-28 14:25:21 -080047extern int pstore_is_mounted(void);
Anton Vorontsov060287b2012-07-09 17:10:41 -070048
49#endif