ipl.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. #define NSS_NAME_SIZE 8
  14. #define IPL_PARM_BLK_FCP_LEN (sizeof(struct ipl_list_hdr) + \
  15. sizeof(struct ipl_block_fcp))
  16. #define IPL_PARM_BLK0_FCP_LEN (sizeof(struct ipl_block_fcp) + 16)
  17. #define IPL_PARM_BLK_CCW_LEN (sizeof(struct ipl_list_hdr) + \
  18. sizeof(struct ipl_block_ccw))
  19. #define IPL_PARM_BLK0_CCW_LEN (sizeof(struct ipl_block_ccw) + 16)
  20. #define IPL_MAX_SUPPORTED_VERSION (0)
  21. struct ipl_list_hdr {
  22. u32 len;
  23. u8 reserved1[3];
  24. u8 version;
  25. u32 blk0_len;
  26. u8 pbt;
  27. u8 flags;
  28. u16 reserved2;
  29. u8 loadparm[8];
  30. } __attribute__((packed));
  31. struct ipl_block_fcp {
  32. u8 reserved1[305-1];
  33. u8 opt;
  34. u8 reserved2[3];
  35. u16 reserved3;
  36. u16 devno;
  37. u8 reserved4[4];
  38. u64 wwpn;
  39. u64 lun;
  40. u32 bootprog;
  41. u8 reserved5[12];
  42. u64 br_lba;
  43. u32 scp_data_len;
  44. u8 reserved6[260];
  45. u8 scp_data[];
  46. } __attribute__((packed));
  47. #define DIAG308_VMPARM_SIZE 64
  48. #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - (sizeof(struct ipl_list_hdr) + \
  49. offsetof(struct ipl_block_fcp, scp_data)))
  50. struct ipl_block_ccw {
  51. u8 reserved1[84];
  52. u16 reserved2 : 13;
  53. u8 ssid : 3;
  54. u16 devno;
  55. u8 vm_flags;
  56. u8 reserved3[3];
  57. u32 vm_parm_len;
  58. u8 nss_name[8];
  59. u8 vm_parm[DIAG308_VMPARM_SIZE];
  60. u8 reserved4[8];
  61. } __attribute__((packed));
  62. struct ipl_parameter_block {
  63. struct ipl_list_hdr hdr;
  64. union {
  65. struct ipl_block_fcp fcp;
  66. struct ipl_block_ccw ccw;
  67. char raw[PAGE_SIZE - sizeof(struct ipl_list_hdr)];
  68. } ipl_info;
  69. } __packed __aligned(PAGE_SIZE);
  70. struct save_area;
  71. struct save_area * __init save_area_alloc(bool is_boot_cpu);
  72. struct save_area * __init save_area_boot_cpu(void);
  73. void __init save_area_add_regs(struct save_area *, void *regs);
  74. void __init save_area_add_vxrs(struct save_area *, __vector128 *vxrs);
  75. extern void do_reipl(void);
  76. extern void do_halt(void);
  77. extern void do_poff(void);
  78. extern void ipl_store_parameters(void);
  79. extern size_t append_ipl_vmparm(char *, size_t);
  80. extern size_t append_ipl_scpdata(char *, size_t);
  81. enum ipl_type {
  82. IPL_TYPE_UNKNOWN = 1,
  83. IPL_TYPE_CCW = 2,
  84. IPL_TYPE_FCP = 4,
  85. IPL_TYPE_FCP_DUMP = 8,
  86. IPL_TYPE_NSS = 16,
  87. };
  88. struct ipl_info
  89. {
  90. enum ipl_type type;
  91. union {
  92. struct {
  93. struct ccw_dev_id dev_id;
  94. } ccw;
  95. struct {
  96. struct ccw_dev_id dev_id;
  97. u64 wwpn;
  98. u64 lun;
  99. } fcp;
  100. struct {
  101. char name[NSS_NAME_SIZE + 1];
  102. } nss;
  103. } data;
  104. };
  105. extern struct ipl_info ipl_info;
  106. extern void setup_ipl(void);
  107. /*
  108. * DIAG 308 support
  109. */
  110. enum diag308_subcode {
  111. DIAG308_REL_HSA = 2,
  112. DIAG308_LOAD_CLEAR = 3,
  113. DIAG308_LOAD_NORMAL_DUMP = 4,
  114. DIAG308_SET = 5,
  115. DIAG308_STORE = 6,
  116. };
  117. enum diag308_ipl_type {
  118. DIAG308_IPL_TYPE_FCP = 0,
  119. DIAG308_IPL_TYPE_CCW = 2,
  120. };
  121. enum diag308_opt {
  122. DIAG308_IPL_OPT_IPL = 0x10,
  123. DIAG308_IPL_OPT_DUMP = 0x20,
  124. };
  125. enum diag308_flags {
  126. DIAG308_FLAGS_LP_VALID = 0x80,
  127. };
  128. enum diag308_vm_flags {
  129. DIAG308_VM_FLAGS_NSS_VALID = 0x80,
  130. DIAG308_VM_FLAGS_VP_VALID = 0x40,
  131. };
  132. enum diag308_rc {
  133. DIAG308_RC_OK = 0x0001,
  134. DIAG308_RC_NOCONFIG = 0x0102,
  135. };
  136. extern int diag308(unsigned long subcode, void *addr);
  137. extern void diag308_reset(void);
  138. extern void store_status(void (*fn)(void *), void *data);
  139. extern void lgr_info_log(void);
  140. #endif /* _ASM_S390_IPL_H */