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 s390_reset_system(void);
  76. extern void ipl_store_parameters(void);
  77. extern size_t append_ipl_vmparm(char *, size_t);
  78. extern size_t append_ipl_scpdata(char *, size_t);
  79. enum ipl_type {
  80. IPL_TYPE_UNKNOWN = 1,
  81. IPL_TYPE_CCW = 2,
  82. IPL_TYPE_FCP = 4,
  83. IPL_TYPE_FCP_DUMP = 8,
  84. IPL_TYPE_NSS = 16,
  85. };
  86. struct ipl_info
  87. {
  88. enum ipl_type type;
  89. union {
  90. struct {
  91. struct ccw_dev_id dev_id;
  92. } ccw;
  93. struct {
  94. struct ccw_dev_id dev_id;
  95. u64 wwpn;
  96. u64 lun;
  97. } fcp;
  98. struct {
  99. char name[NSS_NAME_SIZE + 1];
  100. } nss;
  101. } data;
  102. };
  103. extern struct ipl_info ipl_info;
  104. extern void setup_ipl(void);
  105. extern void set_os_info_reipl_block(void);
  106. /*
  107. * DIAG 308 support
  108. */
  109. enum diag308_subcode {
  110. DIAG308_REL_HSA = 2,
  111. DIAG308_LOAD_CLEAR = 3,
  112. DIAG308_LOAD_NORMAL_DUMP = 4,
  113. DIAG308_SET = 5,
  114. DIAG308_STORE = 6,
  115. };
  116. enum diag308_ipl_type {
  117. DIAG308_IPL_TYPE_FCP = 0,
  118. DIAG308_IPL_TYPE_CCW = 2,
  119. };
  120. enum diag308_opt {
  121. DIAG308_IPL_OPT_IPL = 0x10,
  122. DIAG308_IPL_OPT_DUMP = 0x20,
  123. };
  124. enum diag308_flags {
  125. DIAG308_FLAGS_LP_VALID = 0x80,
  126. };
  127. enum diag308_vm_flags {
  128. DIAG308_VM_FLAGS_NSS_VALID = 0x80,
  129. DIAG308_VM_FLAGS_VP_VALID = 0x40,
  130. };
  131. enum diag308_rc {
  132. DIAG308_RC_OK = 0x0001,
  133. DIAG308_RC_NOCONFIG = 0x0102,
  134. };
  135. extern int diag308(unsigned long subcode, void *addr);
  136. extern void diag308_reset(void);
  137. extern void store_status(void (*fn)(void *), void *data);
  138. extern void lgr_info_log(void);
  139. #endif /* _ASM_S390_IPL_H */