fadump.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Firmware Assisted dump header file.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. *
  18. * Copyright 2011 IBM Corporation
  19. * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
  20. */
  21. #ifndef __PPC64_FA_DUMP_H__
  22. #define __PPC64_FA_DUMP_H__
  23. #ifdef CONFIG_FA_DUMP
  24. /*
  25. * The RMA region will be saved for later dumping when kernel crashes.
  26. * RMA is Real Mode Area, the first block of logical memory address owned
  27. * by logical partition, containing the storage that may be accessed with
  28. * translate off.
  29. */
  30. #define RMA_START 0x0
  31. #define RMA_END (ppc64_rma_size)
  32. /*
  33. * On some Power systems where RMO is 128MB, it still requires minimum of
  34. * 256MB for kernel to boot successfully. When kdump infrastructure is
  35. * configured to save vmcore over network, we run into OOM issue while
  36. * loading modules related to network setup. Hence we need aditional 64M
  37. * of memory to avoid OOM issue.
  38. */
  39. #define MIN_BOOT_MEM (((RMA_END < (0x1UL << 28)) ? (0x1UL << 28) : RMA_END) \
  40. + (0x1UL << 26))
  41. /* Firmware provided dump sections */
  42. #define FADUMP_CPU_STATE_DATA 0x0001
  43. #define FADUMP_HPTE_REGION 0x0002
  44. #define FADUMP_REAL_MODE_REGION 0x0011
  45. /* Dump request flag */
  46. #define FADUMP_REQUEST_FLAG 0x00000001
  47. /* FAD commands */
  48. #define FADUMP_REGISTER 1
  49. #define FADUMP_UNREGISTER 2
  50. #define FADUMP_INVALIDATE 3
  51. /* Kernel Dump section info */
  52. struct fadump_section {
  53. u32 request_flag;
  54. u16 source_data_type;
  55. u16 error_flags;
  56. u64 source_address;
  57. u64 source_len;
  58. u64 bytes_dumped;
  59. u64 destination_address;
  60. };
  61. /* ibm,configure-kernel-dump header. */
  62. struct fadump_section_header {
  63. u32 dump_format_version;
  64. u16 dump_num_sections;
  65. u16 dump_status_flag;
  66. u32 offset_first_dump_section;
  67. /* Fields for disk dump option. */
  68. u32 dd_block_size;
  69. u64 dd_block_offset;
  70. u64 dd_num_blocks;
  71. u32 dd_offset_disk_path;
  72. /* Maximum time allowed to prevent an automatic dump-reboot. */
  73. u32 max_time_auto;
  74. };
  75. /*
  76. * Firmware Assisted dump memory structure. This structure is required for
  77. * registering future kernel dump with power firmware through rtas call.
  78. *
  79. * No disk dump option. Hence disk dump path string section is not included.
  80. */
  81. struct fadump_mem_struct {
  82. struct fadump_section_header header;
  83. /* Kernel dump sections */
  84. struct fadump_section cpu_state_data;
  85. struct fadump_section hpte_region;
  86. struct fadump_section rmr_region;
  87. };
  88. /* Firmware-assisted dump configuration details. */
  89. struct fw_dump {
  90. unsigned long cpu_state_data_size;
  91. unsigned long hpte_region_size;
  92. unsigned long boot_memory_size;
  93. unsigned long reserve_dump_area_start;
  94. unsigned long reserve_dump_area_size;
  95. /* cmd line option during boot */
  96. unsigned long reserve_bootvar;
  97. int ibm_configure_kernel_dump;
  98. unsigned long fadump_enabled:1;
  99. unsigned long fadump_supported:1;
  100. unsigned long dump_active:1;
  101. unsigned long dump_registered:1;
  102. };
  103. extern int early_init_dt_scan_fw_dump(unsigned long node,
  104. const char *uname, int depth, void *data);
  105. extern int fadump_reserve_mem(void);
  106. extern int setup_fadump(void);
  107. extern int is_fadump_active(void);
  108. #else /* CONFIG_FA_DUMP */
  109. static inline int is_fadump_active(void) { return 0; }
  110. #endif
  111. #endif