pstore_ram.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 persistent_ram_descriptor {
  25. const char *name;
  26. phys_addr_t size;
  27. };
  28. struct persistent_ram {
  29. phys_addr_t start;
  30. phys_addr_t size;
  31. int num_descs;
  32. struct persistent_ram_descriptor *descs;
  33. struct list_head node;
  34. };
  35. struct persistent_ram_zone {
  36. phys_addr_t paddr;
  37. size_t size;
  38. void *vaddr;
  39. struct persistent_ram_buffer *buffer;
  40. size_t buffer_size;
  41. /* ECC correction */
  42. bool ecc;
  43. char *par_buffer;
  44. char *par_header;
  45. struct rs_control *rs_decoder;
  46. int corrected_bytes;
  47. int bad_blocks;
  48. int ecc_block_size;
  49. int ecc_size;
  50. int ecc_symsize;
  51. int ecc_poly;
  52. char *old_log;
  53. size_t old_log_size;
  54. };
  55. int persistent_ram_early_init(struct persistent_ram *ram);
  56. struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start,
  57. size_t size,
  58. bool ecc);
  59. void persistent_ram_free(struct persistent_ram_zone *prz);
  60. struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev,
  61. bool ecc);
  62. int persistent_ram_write(struct persistent_ram_zone *prz, const void *s,
  63. unsigned int count);
  64. size_t persistent_ram_old_size(struct persistent_ram_zone *prz);
  65. void *persistent_ram_old(struct persistent_ram_zone *prz);
  66. void persistent_ram_free_old(struct persistent_ram_zone *prz);
  67. ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz,
  68. char *str, size_t len);
  69. /*
  70. * Ramoops platform data
  71. * @mem_size memory size for ramoops
  72. * @mem_address physical memory address to contain ramoops
  73. */
  74. struct ramoops_platform_data {
  75. unsigned long mem_size;
  76. unsigned long mem_address;
  77. unsigned long record_size;
  78. int dump_oops;
  79. };
  80. #endif