blob: e7ef2a683b8fbc617368ad855f4f18d6832b3eb6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef S390_CHSC_H
2#define S390_CHSC_H
3
Peter Oberparleiterf86635f2007-04-27 16:01:26 +02004#include <linux/types.h>
5#include <linux/device.h>
Sebastian Ott382b7362012-08-28 16:43:36 +02006#include <asm/css_chars.h>
Peter Oberparleitere5854a52007-04-27 16:01:31 +02007#include <asm/chpid.h>
Cornelia Huck9d92a7e2008-07-14 09:59:05 +02008#include <asm/chsc.h>
9#include <asm/schid.h>
Peter Oberparleiterf86635f2007-04-27 16:01:26 +020010
Cornelia Huckfb6958a2006-01-06 00:19:25 -080011#define CHSC_SDA_OC_MSS 0x2
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013struct chsc_header {
14 u16 length;
15 u16 code;
Peter Oberparleiter0f008aa2007-02-05 21:17:40 +010016} __attribute__ ((packed));
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Cornelia Huck495a5b42006-03-24 03:15:14 -080018#define NR_MEASUREMENT_CHARS 5
19struct cmg_chars {
20 u32 values[NR_MEASUREMENT_CHARS];
Peter Oberparleiter0f008aa2007-02-05 21:17:40 +010021} __attribute__ ((packed));
Cornelia Huck495a5b42006-03-24 03:15:14 -080022
23#define NR_MEASUREMENT_ENTRIES 8
24struct cmg_entry {
25 u32 values[NR_MEASUREMENT_ENTRIES];
Peter Oberparleiter0f008aa2007-02-05 21:17:40 +010026} __attribute__ ((packed));
Cornelia Huck495a5b42006-03-24 03:15:14 -080027
Linus Torvalds1da177e2005-04-16 15:20:36 -070028struct 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 Oberparleiter0f008aa2007-02-05 21:17:40 +010037} __attribute__ ((packed));
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Sebastian Ottce322cc2011-01-05 12:47:56 +010039struct channel_path_desc_fmt1 {
40 u8 flags;
41 u8 lsn;
42 u8 desc;
43 u8 chpid;
44 u32:24;
45 u8 chpp;
Peter Oberparleiterba542292013-05-15 13:43:29 +020046 u32 unused[2];
47 u16 chid;
48 u32:16;
Sebastian Ottce322cc2011-01-05 12:47:56 +010049 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 Oberparleitere6b6e102007-04-27 16:01:28 +020057struct channel_path;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058
Linus Torvalds1da177e2005-04-16 15:20:36 -070059struct css_chsc_char {
60 u64 res;
Cornelia Huck495a5b42006-03-24 03:15:14 -080061 u64 : 20;
62 u32 secm : 1; /* bit 84 */
63 u32 : 1;
64 u32 scmc : 1; /* bit 86 */
65 u32 : 20;
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 u32 scssc : 1; /* bit 107 */
67 u32 scsscf : 1; /* bit 108 */
68 u32 : 19;
69}__attribute__((packed));
70
Linus Torvalds1da177e2005-04-16 15:20:36 -070071extern struct css_chsc_char css_chsc_characteristics;
72
Peter Oberparleiter7ad6a242007-04-27 16:01:35 +020073struct chsc_ssd_info {
74 u8 path_mask;
75 u8 fla_valid_mask;
76 struct chp_id chpid[8];
77 u16 fla[8];
78};
Sebastian Ott906c9762010-10-25 16:10:30 +020079
80struct 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 Oberparleiter7ad6a242007-04-27 16:01:35 +020098extern int chsc_get_ssd_info(struct subchannel_id schid,
99 struct chsc_ssd_info *ssd);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100extern int chsc_determine_css_characteristics(void);
Sebastian Ott34aec072010-10-25 16:10:28 +0200101extern int chsc_init(void);
102extern void chsc_init_cleanup(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Cornelia Huckfb6958a2006-01-06 00:19:25 -0800104extern int chsc_enable_facility(int);
Cornelia Huck495a5b42006-03-24 03:15:14 -0800105struct channel_subsystem;
106extern int chsc_secm(struct channel_subsystem *, int);
Sebastian Ott34196f82010-10-25 16:10:29 +0200107int __chsc_do_secm(struct channel_subsystem *css, int enable);
Cornelia Huckfb6958a2006-01-06 00:19:25 -0800108
Peter Oberparleitere6b6e102007-04-27 16:01:28 +0200109int chsc_chp_vary(struct chp_id chpid, int on);
Cornelia Huck9d92a7e2008-07-14 09:59:05 +0200110int chsc_determine_channel_path_desc(struct chp_id chpid, int fmt, int rfmt,
Sebastian Ott906c9762010-10-25 16:10:30 +0200111 int c, int m, void *page);
Cornelia Huck9d92a7e2008-07-14 09:59:05 +0200112int chsc_determine_base_channel_path_desc(struct chp_id chpid,
113 struct channel_path_desc *desc);
Sebastian Ottce322cc2011-01-05 12:47:56 +0100114int chsc_determine_fmt1_channel_path_desc(struct chp_id chpid,
115 struct channel_path_desc_fmt1 *desc);
Peter Oberparleiter83b33702007-04-27 16:01:34 +0200116void chsc_chp_online(struct chp_id chpid);
Peter Oberparleitere6b6e102007-04-27 16:01:28 +0200117void chsc_chp_offline(struct chp_id chpid);
118int chsc_get_channel_measurement_chars(struct channel_path *chp);
Cornelia Hucka28c6942006-01-06 00:19:23 -0800119
Cornelia Huckdae39842008-07-17 17:16:47 +0200120int chsc_error_from_response(int response);
121
Michael Ernstfd0457a2010-08-09 18:12:50 +0200122int chsc_siosl(struct subchannel_id schid);
123
Sebastian Ott184b08a2012-08-28 16:45:42 +0200124/* Functions and definitions to query storage-class memory. */
125struct 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
137struct 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
157int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token);
158
Sebastian Ott40ff4cc2012-08-28 16:47:02 +0200159#ifdef CONFIG_SCM_BUS
160int scm_update_information(void);
Sebastian Ottaebfa662013-02-28 12:07:55 +0100161int scm_process_availability_information(void);
Sebastian Ott40ff4cc2012-08-28 16:47:02 +0200162#else /* CONFIG_SCM_BUS */
Sebastian Ott58fece72013-01-28 19:34:26 +0100163static inline int scm_update_information(void) { return 0; }
Sebastian Ottaebfa662013-02-28 12:07:55 +0100164static inline int scm_process_availability_information(void) { return 0; }
Sebastian Ott40ff4cc2012-08-28 16:47:02 +0200165#endif /* CONFIG_SCM_BUS */
166
167
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168#endif