Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef S390_CHSC_H |
| 2 | #define S390_CHSC_H |
| 3 | |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 4 | #include <linux/types.h> |
| 5 | #include <linux/device.h> |
Sebastian Ott | 382b736 | 2012-08-28 16:43:36 +0200 | [diff] [blame] | 6 | #include <asm/css_chars.h> |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 7 | #include <asm/chpid.h> |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 8 | #include <asm/chsc.h> |
| 9 | #include <asm/schid.h> |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 10 | |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 11 | #define CHSC_SDA_OC_MSS 0x2 |
| 12 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | struct chsc_header { |
| 14 | u16 length; |
| 15 | u16 code; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 16 | } __attribute__ ((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 18 | #define NR_MEASUREMENT_CHARS 5 |
| 19 | struct cmg_chars { |
| 20 | u32 values[NR_MEASUREMENT_CHARS]; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 21 | } __attribute__ ((packed)); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 22 | |
| 23 | #define NR_MEASUREMENT_ENTRIES 8 |
| 24 | struct cmg_entry { |
| 25 | u32 values[NR_MEASUREMENT_ENTRIES]; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 26 | } __attribute__ ((packed)); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 27 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | struct channel_path_desc { |
| 29 | u8 flags; |
| 30 | u8 lsn; |
| 31 | u8 desc; |
| 32 | u8 chpid; |
| 33 | u8 swla; |
| 34 | u8 zeroes; |
| 35 | u8 chla; |
| 36 | u8 chpp; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 37 | } __attribute__ ((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 39 | struct channel_path_desc_fmt1 { |
| 40 | u8 flags; |
| 41 | u8 lsn; |
| 42 | u8 desc; |
| 43 | u8 chpid; |
| 44 | u32:24; |
| 45 | u8 chpp; |
Peter Oberparleiter | ba54229 | 2013-05-15 13:43:29 +0200 | [diff] [blame] | 46 | u32 unused[2]; |
| 47 | u16 chid; |
| 48 | u32:16; |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 49 | u16 mdc; |
| 50 | u16:13; |
| 51 | u8 r:1; |
| 52 | u8 s:1; |
| 53 | u8 f:1; |
| 54 | u32 zeros[2]; |
| 55 | } __attribute__ ((packed)); |
| 56 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 57 | struct channel_path; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | struct css_chsc_char { |
| 60 | u64 res; |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 61 | u64 : 20; |
| 62 | u32 secm : 1; /* bit 84 */ |
| 63 | u32 : 1; |
| 64 | u32 scmc : 1; /* bit 86 */ |
| 65 | u32 : 20; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 66 | u32 scssc : 1; /* bit 107 */ |
| 67 | u32 scsscf : 1; /* bit 108 */ |
| 68 | u32 : 19; |
| 69 | }__attribute__((packed)); |
| 70 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | extern struct css_chsc_char css_chsc_characteristics; |
| 72 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 73 | struct chsc_ssd_info { |
| 74 | u8 path_mask; |
| 75 | u8 fla_valid_mask; |
| 76 | struct chp_id chpid[8]; |
| 77 | u16 fla[8]; |
| 78 | }; |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 79 | |
| 80 | struct chsc_scpd { |
| 81 | struct chsc_header request; |
| 82 | u32:2; |
| 83 | u32 m:1; |
| 84 | u32 c:1; |
| 85 | u32 fmt:4; |
| 86 | u32 cssid:8; |
| 87 | u32:4; |
| 88 | u32 rfmt:4; |
| 89 | u32 first_chpid:8; |
| 90 | u32:24; |
| 91 | u32 last_chpid:8; |
| 92 | u32 zeroes1; |
| 93 | struct chsc_header response; |
| 94 | u8 data[PAGE_SIZE - 20]; |
| 95 | } __attribute__ ((packed)); |
| 96 | |
| 97 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 98 | extern int chsc_get_ssd_info(struct subchannel_id schid, |
| 99 | struct chsc_ssd_info *ssd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | extern int chsc_determine_css_characteristics(void); |
Sebastian Ott | 34aec07 | 2010-10-25 16:10:28 +0200 | [diff] [blame] | 101 | extern int chsc_init(void); |
| 102 | extern void chsc_init_cleanup(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 104 | extern int chsc_enable_facility(int); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 105 | struct channel_subsystem; |
| 106 | extern int chsc_secm(struct channel_subsystem *, int); |
Sebastian Ott | 34196f8 | 2010-10-25 16:10:29 +0200 | [diff] [blame] | 107 | int __chsc_do_secm(struct channel_subsystem *css, int enable); |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 108 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 109 | int chsc_chp_vary(struct chp_id chpid, int on); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 110 | int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt, |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 111 | int c, int m, void *page); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 112 | int chsc_determine_base_channel_path_desc(struct chp_id chpid, |
| 113 | struct channel_path_desc *desc); |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 114 | int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, |
| 115 | struct channel_path_desc_fmt1 *desc); |
Peter Oberparleiter | 83b3370 | 2007-04-27 16:01:34 +0200 | [diff] [blame] | 116 | void chsc_chp_online(struct chp_id chpid); |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 117 | void chsc_chp_offline(struct chp_id chpid); |
| 118 | int chsc_get_channel_measurement_chars(struct channel_path *chp); |
Cornelia Huck | a28c694 | 2006-01-06 00:19:23 -0800 | [diff] [blame] | 119 | |
Cornelia Huck | dae3984 | 2008-07-17 17:16:47 +0200 | [diff] [blame] | 120 | int chsc_error_from_response(int response); |
| 121 | |
Michael Ernst | fd0457a | 2010-08-09 18:12:50 +0200 | [diff] [blame] | 122 | int chsc_siosl(struct subchannel_id schid); |
| 123 | |
Sebastian Ott | 184b08a | 2012-08-28 16:45:42 +0200 | [diff] [blame] | 124 | /* Functions and definitions to query storage-class memory. */ |
| 125 | struct sale { |
| 126 | u64 sa; |
| 127 | u32 p:4; |
| 128 | u32 op_state:4; |
| 129 | u32 data_state:4; |
| 130 | u32 rank:4; |
| 131 | u32 r:1; |
| 132 | u32:7; |
| 133 | u32 rid:8; |
| 134 | u32:32; |
| 135 | } __packed; |
| 136 | |
| 137 | struct chsc_scm_info { |
| 138 | struct chsc_header request; |
| 139 | u32:32; |
| 140 | u64 reqtok; |
| 141 | u32 reserved1[4]; |
| 142 | struct chsc_header response; |
| 143 | u64:56; |
| 144 | u8 rq; |
| 145 | u32 mbc; |
| 146 | u64 msa; |
| 147 | u16 is; |
| 148 | u16 mmc; |
| 149 | u32 mci; |
| 150 | u64 nr_scm_ini; |
| 151 | u64 nr_scm_unini; |
| 152 | u32 reserved2[10]; |
| 153 | u64 restok; |
| 154 | struct sale scmal[248]; |
| 155 | } __packed; |
| 156 | |
| 157 | int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); |
| 158 | |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 159 | #ifdef CONFIG_SCM_BUS |
| 160 | int scm_update_information(void); |
Sebastian Ott | aebfa66 | 2013-02-28 12:07:55 +0100 | [diff] [blame] | 161 | int scm_process_availability_information(void); |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 162 | #else /* CONFIG_SCM_BUS */ |
Sebastian Ott | 58fece7 | 2013-01-28 19:34:26 +0100 | [diff] [blame] | 163 | static inline int scm_update_information(void) { return 0; } |
Sebastian Ott | aebfa66 | 2013-02-28 12:07:55 +0100 | [diff] [blame] | 164 | static inline int scm_process_availability_information(void) { return 0; } |
Sebastian Ott | 40ff4cc | 2012-08-28 16:47:02 +0200 | [diff] [blame] | 165 | #endif /* CONFIG_SCM_BUS */ |
| 166 | |
| 167 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | #endif |