pstore_ram.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com>
  3. * Copyright (C) 2011 Kees Cook <keescook@chromium.org>
  4. * Copyright (C) 2011 Google, Inc.
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. */
  16. #ifndef __LINUX_PSTORE_RAM_H__
  17. #define __LINUX_PSTORE_RAM_H__
  18. #include <linux/device.h>
  19. #include <linux/kernel.h>
  20. #include <linux/list.h>
  21. #include <linux/types.h>
  22. #include <linux/init.h>
  23. struct persistent_ram_buffer;
  24. struct rs_control;
  25. struct persistent_ram_ecc_info {
  26. int block_size;
  27. int ecc_size;
  28. int symsize;
  29. int poly;
  30. };
  31. struct persistent_ram_zone {
  32. phys_addr_t paddr;
  33. size_t size;
  34. void *vaddr;
  35. struct persistent_ram_buffer *buffer;
  36. size_t buffer_size;
  37. /* ECC correction */
  38. char *par_buffer;
  39. char *par_header;
  40. struct rs_control *rs_decoder;
  41. int corrected_bytes;
  42. int bad_blocks;
  43. struct persistent_ram_ecc_info ecc_info;
  44. char *old_log;
  45. size_t old_log_size;
  46. };
  47. struct persistent_ram_zone *persistent_ram_new(phys_addr_t start, size_t size,
  48. u32 sig, struct persistent_ram_ecc_info *ecc_info,
  49. unsigned int memtype);
  50. void persistent_ram_free(struct persistent_ram_zone *prz);
  51. void persistent_ram_zap(struct persistent_ram_zone *prz);
  52. int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
  53. unsigned int count);
  54. void persistent_ram_save_old(struct persistent_ram_zone *prz);
  55. size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
  56. void *persistent_ram_old(struct persistent_ram_zone *prz);
  57. void persistent_ram_free_old(struct persistent_ram_zone *prz);
  58. ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
  59. char *str, size_t len);
  60. void ramoops_console_write_buf(const char *buf, size_t size);
  61. /*
  62. * Ramoops platform data
  63. * @mem_size memory size for ramoops
  64. * @mem_address physical memory address to contain ramoops
  65. */
  66. struct ramoops_platform_data {
  67. unsigned long mem_size;
  68. unsigned long mem_address;
  69. unsigned int mem_type;
  70. unsigned long record_size;
  71. unsigned long console_size;
  72. unsigned long ftrace_size;
  73. unsigned long pmsg_size;
  74. int dump_oops;
  75. struct persistent_ram_ecc_info ecc_info;
  76. };
  77. #endif