internal.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. #ifdef CONFIG_PSTORE_FTRACE
  37. extern void pstore_register_ftrace(void);
  38. extern void pstore_unregister_ftrace(void);
  39. #else
  40. static inline void pstore_register_ftrace(void) {}
  41. static inline void pstore_unregister_ftrace(void) {}
  42. #endif
  43. #ifdef CONFIG_PSTORE_PMSG
  44. extern void pstore_register_pmsg(void);
  45. extern void pstore_unregister_pmsg(void);
  46. #else
  47. static inline void pstore_register_pmsg(void) {}
  48. static inline void pstore_unregister_pmsg(void) {}
  49. #endif
  50. extern struct pstore_info *psinfo;
  51. extern void pstore_set_kmsg_bytes(int);
  52. extern void pstore_get_records(int);
  53. extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id,
  54. int count, char *data, bool compressed,
  55. size_t size, struct timespec time,
  56. struct pstore_info *psi);
  57. extern bool pstore_is_mounted(void);
  58. #endif