ipl.h 3.6 KB

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