internal.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef __PSTORE_INTERNAL_H__
  2. #define __PSTORE_INTERNAL_H__
  3. #include <linux/types.h>
  4. #include <linux/time.h>
  5. #include <linux/pstore.h>
  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. struct pstore_ftrace_record {
  12. unsigned long ip;
  13. unsigned long parent_ip;
  14. #ifndef PSTORE_CPU_IN_IP
  15. unsigned int cpu;
  16. #endif
  17. };
  18. static inline void
  19. pstore_ftrace_encode_cpu(struct pstore_ftrace_record *rec, unsigned int cpu)
  20. {
  21. #ifndef PSTORE_CPU_IN_IP
  22. rec->cpu = cpu;
  23. #else
  24. rec->ip |= cpu;
  25. #endif
  26. }
  27. static inline unsigned int
  28. pstore_ftrace_decode_cpu(struct pstore_ftrace_record *rec)
  29. {
  30. #ifndef PSTORE_CPU_IN_IP
  31. return rec->cpu;
  32. #else
  33. return rec->ip & PSTORE_CPU_IN_IP;
  34. #endif
  35. }
  36. extern struct pstore_info *psinfo;
  37. extern void pstore_set_kmsg_bytes(int);
  38. extern void pstore_get_records(int);
  39. extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id,
  40. char *data, size_t size,
  41. struct timespec time, struct pstore_info *psi);
  42. extern int pstore_is_mounted(void);
  43. #endif