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> |
Peter Oberparleiter | e5854a5 | 2007-04-27 16:01:31 +0200 | [diff] [blame] | 6 | #include <asm/chpid.h> |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 7 | #include <asm/chsc.h> |
| 8 | #include <asm/schid.h> |
Peter Oberparleiter | f86635f | 2007-04-27 16:01:26 +0200 | [diff] [blame] | 9 | |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 10 | #define CHSC_SDA_OC_MSS 0x2 |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | struct chsc_header { |
| 13 | u16 length; |
| 14 | u16 code; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 15 | } __attribute__ ((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 17 | #define NR_MEASUREMENT_CHARS 5 |
| 18 | struct cmg_chars { |
| 19 | u32 values[NR_MEASUREMENT_CHARS]; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 20 | } __attribute__ ((packed)); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 21 | |
| 22 | #define NR_MEASUREMENT_ENTRIES 8 |
| 23 | struct cmg_entry { |
| 24 | u32 values[NR_MEASUREMENT_ENTRIES]; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 25 | } __attribute__ ((packed)); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 26 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | struct channel_path_desc { |
| 28 | u8 flags; |
| 29 | u8 lsn; |
| 30 | u8 desc; |
| 31 | u8 chpid; |
| 32 | u8 swla; |
| 33 | u8 zeroes; |
| 34 | u8 chla; |
| 35 | u8 chpp; |
Peter Oberparleiter | 0f008aa | 2007-02-05 21:17:40 +0100 | [diff] [blame] | 36 | } __attribute__ ((packed)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 38 | struct channel_path_desc_fmt1 { |
| 39 | u8 flags; |
| 40 | u8 lsn; |
| 41 | u8 desc; |
| 42 | u8 chpid; |
| 43 | u32:24; |
| 44 | u8 chpp; |
| 45 | u32 unused[3]; |
| 46 | u16 mdc; |
| 47 | u16:13; |
| 48 | u8 r:1; |
| 49 | u8 s:1; |
| 50 | u8 f:1; |
| 51 | u32 zeros[2]; |
| 52 | } __attribute__ ((packed)); |
| 53 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 54 | struct channel_path; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | struct css_chsc_char { |
| 57 | u64 res; |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 58 | u64 : 20; |
| 59 | u32 secm : 1; /* bit 84 */ |
| 60 | u32 : 1; |
| 61 | u32 scmc : 1; /* bit 86 */ |
| 62 | u32 : 20; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | u32 scssc : 1; /* bit 107 */ |
| 64 | u32 scsscf : 1; /* bit 108 */ |
| 65 | u32 : 19; |
| 66 | }__attribute__((packed)); |
| 67 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | extern struct css_chsc_char css_chsc_characteristics; |
| 69 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 70 | struct chsc_ssd_info { |
| 71 | u8 path_mask; |
| 72 | u8 fla_valid_mask; |
| 73 | struct chp_id chpid[8]; |
| 74 | u16 fla[8]; |
| 75 | }; |
Sebastian Ott | 906c976 | 2010-10-25 16:10:30 +0200 | [diff] [blame] | 76 | |
| 77 | struct chsc_scpd { |
| 78 | struct chsc_header request; |
| 79 | u32:2; |
| 80 | u32 m:1; |
| 81 | u32 c:1; |
| 82 | u32 fmt:4; |
| 83 | u32 cssid:8; |
| 84 | u32:4; |
| 85 | u32 rfmt:4; |
| 86 | u32 first_chpid:8; |
| 87 | u32:24; |
| 88 | u32 last_chpid:8; |
| 89 | u32 zeroes1; |
| 90 | struct chsc_header response; |
| 91 | u8 data[PAGE_SIZE - 20]; |
| 92 | } __attribute__ ((packed)); |
| 93 | |
| 94 | |
Peter Oberparleiter | 7ad6a24 | 2007-04-27 16:01:35 +0200 | [diff] [blame] | 95 | extern int chsc_get_ssd_info(struct subchannel_id schid, |
| 96 | struct chsc_ssd_info *ssd); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | extern int chsc_determine_css_characteristics(void); |
Sebastian Ott | 34aec07 | 2010-10-25 16:10:28 +0200 | [diff] [blame] | 98 | extern int chsc_init(void); |
| 99 | extern void chsc_init_cleanup(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 101 | extern int chsc_enable_facility(int); |
Cornelia Huck | 495a5b4 | 2006-03-24 03:15:14 -0800 | [diff] [blame] | 102 | struct channel_subsystem; |
| 103 | extern int chsc_secm(struct channel_subsystem *, int); |
Sebastian Ott | 34196f8 | 2010-10-25 16:10:29 +0200 | [diff] [blame] | 104 | int __chsc_do_secm(struct channel_subsystem *css, int enable); |
Cornelia Huck | fb6958a | 2006-01-06 00:19:25 -0800 | [diff] [blame] | 105 | |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 106 | int chsc_chp_vary(struct chp_id chpid, int on); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 107 | 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] | 108 | int c, int m, void *page); |
Cornelia Huck | 9d92a7e | 2008-07-14 09:59:05 +0200 | [diff] [blame] | 109 | int chsc_determine_base_channel_path_desc(struct chp_id chpid, |
| 110 | struct channel_path_desc *desc); |
Sebastian Ott | ce322cc | 2011-01-05 12:47:56 +0100 | [diff] [blame] | 111 | int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid, |
| 112 | struct channel_path_desc_fmt1 *desc); |
Peter Oberparleiter | 83b3370 | 2007-04-27 16:01:34 +0200 | [diff] [blame] | 113 | void chsc_chp_online(struct chp_id chpid); |
Peter Oberparleiter | e6b6e10 | 2007-04-27 16:01:28 +0200 | [diff] [blame] | 114 | void chsc_chp_offline(struct chp_id chpid); |
| 115 | int chsc_get_channel_measurement_chars(struct channel_path *chp); |
Cornelia Huck | a28c694 | 2006-01-06 00:19:23 -0800 | [diff] [blame] | 116 | |
Cornelia Huck | dae3984 | 2008-07-17 17:16:47 +0200 | [diff] [blame] | 117 | int chsc_error_from_response(int response); |
| 118 | |
Michael Ernst | fd0457a | 2010-08-09 18:12:50 +0200 | [diff] [blame] | 119 | int chsc_siosl(struct subchannel_id schid); |
| 120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | #endif |