ipl.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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) + 8)
  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) + 8)
  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. } __attribute__((packed));
  32. struct ipl_block_fcp {
  33. u8 reserved1[313-1];
  34. u8 opt;
  35. u8 reserved2[3];
  36. u16 reserved3;
  37. u16 devno;
  38. u8 reserved4[4];
  39. u64 wwpn;
  40. u64 lun;
  41. u32 bootprog;
  42. u8 reserved5[12];
  43. u64 br_lba;
  44. u32 scp_data_len;
  45. u8 reserved6[260];
  46. u8 scp_data[];
  47. } __attribute__((packed));
  48. #define DIAG308_VMPARM_SIZE 64
  49. #define DIAG308_SCPDATA_SIZE (PAGE_SIZE - (sizeof(struct ipl_list_hdr) + \
  50. offsetof(struct ipl_block_fcp, scp_data)))
  51. struct ipl_block_ccw {
  52. u8 load_parm[8];
  53. u8 reserved1[84];
  54. u8 reserved2[2];
  55. u16 devno;
  56. u8 vm_flags;
  57. u8 reserved3[3];
  58. u32 vm_parm_len;
  59. u8 nss_name[8];
  60. u8 vm_parm[DIAG308_VMPARM_SIZE];
  61. u8 reserved4[8];
  62. } __attribute__((packed));
  63. struct ipl_parameter_block {
  64. struct ipl_list_hdr hdr;
  65. union {
  66. struct ipl_block_fcp fcp;
  67. struct ipl_block_ccw ccw;
  68. } ipl_info;
  69. } __attribute__((packed,aligned(4096)));
  70. /*
  71. * IPL validity flags
  72. */
  73. extern u32 ipl_flags;
  74. extern u32 dump_prefix_page;
  75. struct dump_save_areas {
  76. struct save_area **areas;
  77. int count;
  78. };
  79. extern struct dump_save_areas dump_save_areas;
  80. struct save_area *dump_save_area_create(int cpu);
  81. extern void do_reipl(void);
  82. extern void do_halt(void);
  83. extern void do_poff(void);
  84. extern void ipl_save_parameters(void);
  85. extern void ipl_update_parameters(void);
  86. extern size_t append_ipl_vmparm(char *, size_t);
  87. extern size_t append_ipl_scpdata(char *, size_t);
  88. enum {
  89. IPL_DEVNO_VALID = 1,
  90. IPL_PARMBLOCK_VALID = 2,
  91. IPL_NSS_VALID = 4,
  92. };
  93. enum ipl_type {
  94. IPL_TYPE_UNKNOWN = 1,
  95. IPL_TYPE_CCW = 2,
  96. IPL_TYPE_FCP = 4,
  97. IPL_TYPE_FCP_DUMP = 8,
  98. IPL_TYPE_NSS = 16,
  99. };
  100. struct ipl_info
  101. {
  102. enum ipl_type type;
  103. union {
  104. struct {
  105. struct ccw_dev_id dev_id;
  106. } ccw;
  107. struct {
  108. struct ccw_dev_id dev_id;
  109. u64 wwpn;
  110. u64 lun;
  111. } fcp;
  112. struct {
  113. char name[NSS_NAME_SIZE + 1];
  114. } nss;
  115. } data;
  116. };
  117. extern struct ipl_info ipl_info;
  118. extern void setup_ipl(void);
  119. /*
  120. * DIAG 308 support
  121. */
  122. enum diag308_subcode {
  123. DIAG308_REL_HSA = 2,
  124. DIAG308_IPL = 3,
  125. DIAG308_DUMP = 4,
  126. DIAG308_SET = 5,
  127. DIAG308_STORE = 6,
  128. };
  129. enum diag308_ipl_type {
  130. DIAG308_IPL_TYPE_FCP = 0,
  131. DIAG308_IPL_TYPE_CCW = 2,
  132. };
  133. enum diag308_opt {
  134. DIAG308_IPL_OPT_IPL = 0x10,
  135. DIAG308_IPL_OPT_DUMP = 0x20,
  136. };
  137. enum diag308_flags {
  138. DIAG308_FLAGS_LP_VALID = 0x80,
  139. };
  140. enum diag308_vm_flags {
  141. DIAG308_VM_FLAGS_NSS_VALID = 0x80,
  142. DIAG308_VM_FLAGS_VP_VALID = 0x40,
  143. };
  144. enum diag308_rc {
  145. DIAG308_RC_OK = 0x0001,
  146. DIAG308_RC_NOCONFIG = 0x0102,
  147. };
  148. extern int diag308(unsigned long subcode, void *addr);
  149. extern void diag308_reset(void);
  150. extern void store_status(void);
  151. extern void lgr_info_log(void);
  152. #endif /* _ASM_S390_IPL_H */