ipl.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * s390 (re)ipl support
  4. *
  5. * Copyright IBM Corp. 2007
  6. */
  7. #ifndef _ASM_S390_IPL_H
  8. #define _ASM_S390_IPL_H
  9. #include <asm/lowcore.h>
  10. #include <asm/types.h>
  11. #include <asm/cio.h>
  12. #include <asm/setup.h>
  13. #include <asm/page.h>
  14. #include <uapi/asm/ipl.h>
  15. struct ipl_parameter_block {
  16. struct ipl_pl_hdr hdr;
  17. union {
  18. struct ipl_pb_hdr pb0_hdr;
  19. struct ipl_pb0_common common;
  20. struct ipl_pb0_fcp fcp;
  21. struct ipl_pb0_ccw ccw;
  22. struct ipl_pb0_nvme nvme;
  23. char raw[PAGE_SIZE - sizeof(struct ipl_pl_hdr)];
  24. };
  25. } __packed __aligned(PAGE_SIZE);
  26. #define NSS_NAME_SIZE 8
  27. #define IPL_BP_FCP_LEN (sizeof(struct ipl_pl_hdr) + \
  28. sizeof(struct ipl_pb0_fcp))
  29. #define IPL_BP0_FCP_LEN (sizeof(struct ipl_pb0_fcp))
  30. #define IPL_BP_NVME_LEN (sizeof(struct ipl_pl_hdr) + \
  31. sizeof(struct ipl_pb0_nvme))
  32. #define IPL_BP0_NVME_LEN (sizeof(struct ipl_pb0_nvme))
  33. #define IPL_BP_CCW_LEN (sizeof(struct ipl_pl_hdr) + \
  34. sizeof(struct ipl_pb0_ccw))
  35. #define IPL_BP0_CCW_LEN (sizeof(struct ipl_pb0_ccw))
  36. #define IPL_MAX_SUPPORTED_VERSION (0)
  37. #define IPL_RB_CERT_UNKNOWN ((unsigned short)-1)
  38. #define DIAG308_VMPARM_SIZE (64)
  39. #define DIAG308_SCPDATA_OFFSET offsetof(struct ipl_parameter_block, \
  40. fcp.scp_data)
  41. #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - DIAG308_SCPDATA_OFFSET)
  42. struct save_area;
  43. struct save_area * __init save_area_alloc(bool is_boot_cpu);
  44. struct save_area * __init save_area_boot_cpu(void);
  45. void __init save_area_add_regs(struct save_area *, void *regs);
  46. void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
  47. extern void s390_reset_system(void);
  48. extern size_t ipl_block_get_ascii_vmparm(char *dest, size_t size,
  49. const struct ipl_parameter_block *ipb);
  50. enum ipl_type {
  51. IPL_TYPE_UNKNOWN = 1,
  52. IPL_TYPE_CCW = 2,
  53. IPL_TYPE_FCP = 4,
  54. IPL_TYPE_FCP_DUMP = 8,
  55. IPL_TYPE_NSS = 16,
  56. IPL_TYPE_NVME = 32,
  57. IPL_TYPE_NVME_DUMP = 64,
  58. };
  59. struct ipl_info
  60. {
  61. enum ipl_type type;
  62. union {
  63. struct {
  64. struct ccw_dev_id dev_id;
  65. } ccw;
  66. struct {
  67. struct ccw_dev_id dev_id;
  68. u64 wwpn;
  69. u64 lun;
  70. } fcp;
  71. struct {
  72. u32 fid;
  73. u32 nsid;
  74. } nvme;
  75. struct {
  76. char name[NSS_NAME_SIZE + 1];
  77. } nss;
  78. } data;
  79. };
  80. extern struct ipl_info ipl_info;
  81. extern void setup_ipl(void);
  82. extern void set_os_info_reipl_block(void);
  83. static inline bool is_ipl_type_dump(void)
  84. {
  85. return (ipl_info.type == IPL_TYPE_FCP_DUMP) ||
  86. (ipl_info.type == IPL_TYPE_NVME_DUMP);
  87. }
  88. struct ipl_report {
  89. struct ipl_parameter_block *ipib;
  90. struct list_head components;
  91. struct list_head certificates;
  92. size_t size;
  93. };
  94. struct ipl_report_component {
  95. struct list_head list;
  96. struct ipl_rb_component_entry entry;
  97. };
  98. struct ipl_report_certificate {
  99. struct list_head list;
  100. struct ipl_rb_certificate_entry entry;
  101. void *key;
  102. };
  103. struct kexec_buf;
  104. struct ipl_report *ipl_report_init(struct ipl_parameter_block *ipib);
  105. void *ipl_report_finish(struct ipl_report *report);
  106. int ipl_report_free(struct ipl_report *report);
  107. int ipl_report_add_component(struct ipl_report *report, struct kexec_buf *kbuf,
  108. unsigned char flags, unsigned short cert);
  109. int ipl_report_add_certificate(struct ipl_report *report, void *key,
  110. unsigned long addr, unsigned long len);
  111. /*
  112. * DIAG 308 support
  113. */
  114. enum diag308_subcode {
  115. DIAG308_CLEAR_RESET = 0,
  116. DIAG308_LOAD_NORMAL_RESET = 1,
  117. DIAG308_REL_HSA = 2,
  118. DIAG308_LOAD_CLEAR = 3,
  119. DIAG308_LOAD_NORMAL_DUMP = 4,
  120. DIAG308_SET = 5,
  121. DIAG308_STORE = 6,
  122. DIAG308_LOAD_NORMAL = 7,
  123. };
  124. enum diag308_subcode_flags {
  125. DIAG308_FLAG_EI = 1UL << 16,
  126. };
  127. enum diag308_rc {
  128. DIAG308_RC_OK = 0x0001,
  129. DIAG308_RC_NOCONFIG = 0x0102,
  130. };
  131. extern int diag308(unsigned long subcode, void *addr);
  132. extern void store_status(void (*fn)(void *), void *data);
  133. extern void lgr_info_log(void);
  134. #endif /* _ASM_S390_IPL_H */