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