diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2008-07-14 03:59:05 -0400 |
---|---|---|
committer | Heiko Carstens <heiko.carstens@de.ibm.com> | 2008-07-14 04:02:12 -0400 |
commit | 9d92a7e1b0d095c8be96ce5e592c6c5541684631 (patch) | |
tree | 22cfca810de07a7d7f87f17a89de0ae10d462038 /include | |
parent | 683c5418e6ac9f40f925dab6f547a5b0a4ad43c6 (diff) |
[S390] cio: Add chsc subchannel driver.
This patch adds a driver for subchannels of type chsc.
A device /dev/chsc is created which may be used to issue ioctls to:
- obtain information about the machine's I/O configuration
- dynamically change the machine's I/O configuration via
asynchronous chsc commands
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-s390/Kbuild | 3 | ||||
-rw-r--r-- | include/asm-s390/chpid.h | 5 | ||||
-rw-r--r-- | include/asm-s390/chsc.h | 127 | ||||
-rw-r--r-- | include/asm-s390/isc.h | 1 | ||||
-rw-r--r-- | include/asm-s390/schid.h | 28 |
5 files changed, 163 insertions, 1 deletions
diff --git a/include/asm-s390/Kbuild b/include/asm-s390/Kbuild index 13c9805349f1..09f312501eb5 100644 --- a/include/asm-s390/Kbuild +++ b/include/asm-s390/Kbuild | |||
@@ -8,6 +8,9 @@ header-y += ucontext.h | |||
8 | header-y += vtoc.h | 8 | header-y += vtoc.h |
9 | header-y += zcrypt.h | 9 | header-y += zcrypt.h |
10 | header-y += kvm.h | 10 | header-y += kvm.h |
11 | header-y += schid.h | ||
12 | header-y += chsc.h | ||
11 | 13 | ||
12 | unifdef-y += cmb.h | 14 | unifdef-y += cmb.h |
13 | unifdef-y += debug.h | 15 | unifdef-y += debug.h |
16 | unifdef-y += chpid.h | ||
diff --git a/include/asm-s390/chpid.h b/include/asm-s390/chpid.h index b203336fd892..606844d0a5c3 100644 --- a/include/asm-s390/chpid.h +++ b/include/asm-s390/chpid.h | |||
@@ -10,7 +10,6 @@ | |||
10 | 10 | ||
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <asm/types.h> | 12 | #include <asm/types.h> |
13 | #include <asm/cio.h> | ||
14 | 13 | ||
15 | #define __MAX_CHPID 255 | 14 | #define __MAX_CHPID 255 |
16 | 15 | ||
@@ -41,6 +40,9 @@ static inline void chp_id_next(struct chp_id *chpid) | |||
41 | } | 40 | } |
42 | } | 41 | } |
43 | 42 | ||
43 | #ifdef __KERNEL__ | ||
44 | #include <asm/cio.h> | ||
45 | |||
44 | static inline int chp_id_is_valid(struct chp_id *chpid) | 46 | static inline int chp_id_is_valid(struct chp_id *chpid) |
45 | { | 47 | { |
46 | return (chpid->cssid <= __MAX_CSSID); | 48 | return (chpid->cssid <= __MAX_CSSID); |
@@ -49,5 +51,6 @@ static inline int chp_id_is_valid(struct chp_id *chpid) | |||
49 | 51 | ||
50 | #define chp_id_for_each(c) \ | 52 | #define chp_id_for_each(c) \ |
51 | for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c)) | 53 | for (chp_id_init(c); chp_id_is_valid(c); chp_id_next(c)) |
54 | #endif /* __KERNEL */ | ||
52 | 55 | ||
53 | #endif /* _ASM_S390_CHPID_H */ | 56 | #endif /* _ASM_S390_CHPID_H */ |
diff --git a/include/asm-s390/chsc.h b/include/asm-s390/chsc.h new file mode 100644 index 000000000000..d38d0cf62d4b --- /dev/null +++ b/include/asm-s390/chsc.h | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * ioctl interface for /dev/chsc | ||
3 | * | ||
4 | * Copyright 2008 IBM Corp. | ||
5 | * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> | ||
6 | */ | ||
7 | |||
8 | #ifndef _ASM_CHSC_H | ||
9 | #define _ASM_CHSC_H | ||
10 | |||
11 | #include <asm/chpid.h> | ||
12 | #include <asm/schid.h> | ||
13 | |||
14 | struct chsc_async_header { | ||
15 | __u16 length; | ||
16 | __u16 code; | ||
17 | __u32 cmd_dependend; | ||
18 | __u32 key : 4; | ||
19 | __u32 : 28; | ||
20 | struct subchannel_id sid; | ||
21 | } __attribute__ ((packed)); | ||
22 | |||
23 | struct chsc_async_area { | ||
24 | struct chsc_async_header header; | ||
25 | __u8 data[PAGE_SIZE - 16 /* size of chsc_async_header */]; | ||
26 | } __attribute__ ((packed)); | ||
27 | |||
28 | |||
29 | struct chsc_response_struct { | ||
30 | __u16 length; | ||
31 | __u16 code; | ||
32 | __u32 parms; | ||
33 | __u8 data[PAGE_SIZE - 8]; | ||
34 | } __attribute__ ((packed)); | ||
35 | |||
36 | struct chsc_chp_cd { | ||
37 | struct chp_id chpid; | ||
38 | int m; | ||
39 | int fmt; | ||
40 | struct chsc_response_struct cpcb; | ||
41 | }; | ||
42 | |||
43 | struct chsc_cu_cd { | ||
44 | __u16 cun; | ||
45 | __u8 cssid; | ||
46 | int m; | ||
47 | int fmt; | ||
48 | struct chsc_response_struct cucb; | ||
49 | }; | ||
50 | |||
51 | struct chsc_sch_cud { | ||
52 | struct subchannel_id schid; | ||
53 | int fmt; | ||
54 | struct chsc_response_struct scub; | ||
55 | }; | ||
56 | |||
57 | struct conf_id { | ||
58 | int m; | ||
59 | __u8 cssid; | ||
60 | __u8 ssid; | ||
61 | }; | ||
62 | |||
63 | struct chsc_conf_info { | ||
64 | struct conf_id id; | ||
65 | int fmt; | ||
66 | struct chsc_response_struct scid; | ||
67 | }; | ||
68 | |||
69 | struct ccl_parm_chpid { | ||
70 | int m; | ||
71 | struct chp_id chp; | ||
72 | }; | ||
73 | |||
74 | struct ccl_parm_cssids { | ||
75 | __u8 f_cssid; | ||
76 | __u8 l_cssid; | ||
77 | }; | ||
78 | |||
79 | struct chsc_comp_list { | ||
80 | struct { | ||
81 | enum { | ||
82 | CCL_CU_ON_CHP = 1, | ||
83 | CCL_CHP_TYPE_CAP = 2, | ||
84 | CCL_CSS_IMG = 4, | ||
85 | CCL_CSS_IMG_CONF_CHAR = 5, | ||
86 | CCL_IOP_CHP = 6, | ||
87 | } ctype; | ||
88 | int fmt; | ||
89 | struct ccl_parm_chpid chpid; | ||
90 | struct ccl_parm_cssids cssids; | ||
91 | } req; | ||
92 | struct chsc_response_struct sccl; | ||
93 | }; | ||
94 | |||
95 | struct chsc_dcal { | ||
96 | struct { | ||
97 | enum { | ||
98 | DCAL_CSS_IID_PN = 4, | ||
99 | } atype; | ||
100 | __u32 list_parm[2]; | ||
101 | int fmt; | ||
102 | } req; | ||
103 | struct chsc_response_struct sdcal; | ||
104 | }; | ||
105 | |||
106 | struct chsc_cpd_info { | ||
107 | struct chp_id chpid; | ||
108 | int m; | ||
109 | int fmt; | ||
110 | int rfmt; | ||
111 | int c; | ||
112 | struct chsc_response_struct chpdb; | ||
113 | }; | ||
114 | |||
115 | #define CHSC_IOCTL_MAGIC 'c' | ||
116 | |||
117 | #define CHSC_START _IOWR(CHSC_IOCTL_MAGIC, 0x81, struct chsc_async_area) | ||
118 | #define CHSC_INFO_CHANNEL_PATH _IOWR(CHSC_IOCTL_MAGIC, 0x82, \ | ||
119 | struct chsc_chp_cd) | ||
120 | #define CHSC_INFO_CU _IOWR(CHSC_IOCTL_MAGIC, 0x83, struct chsc_cu_cd) | ||
121 | #define CHSC_INFO_SCH_CU _IOWR(CHSC_IOCTL_MAGIC, 0x84, struct chsc_sch_cud) | ||
122 | #define CHSC_INFO_CI _IOWR(CHSC_IOCTL_MAGIC, 0x85, struct chsc_conf_info) | ||
123 | #define CHSC_INFO_CCL _IOWR(CHSC_IOCTL_MAGIC, 0x86, struct chsc_comp_list) | ||
124 | #define CHSC_INFO_CPD _IOWR(CHSC_IOCTL_MAGIC, 0x87, struct chsc_cpd_info) | ||
125 | #define CHSC_INFO_DCAL _IOWR(CHSC_IOCTL_MAGIC, 0x88, struct chsc_dcal) | ||
126 | |||
127 | #endif | ||
diff --git a/include/asm-s390/isc.h b/include/asm-s390/isc.h index fe56f7b445ea..34bb8916db4f 100644 --- a/include/asm-s390/isc.h +++ b/include/asm-s390/isc.h | |||
@@ -14,6 +14,7 @@ | |||
14 | /* Regular I/O interrupts. */ | 14 | /* Regular I/O interrupts. */ |
15 | #define IO_SCH_ISC 3 /* regular I/O subchannels */ | 15 | #define IO_SCH_ISC 3 /* regular I/O subchannels */ |
16 | #define CONSOLE_ISC 1 /* console I/O subchannel */ | 16 | #define CONSOLE_ISC 1 /* console I/O subchannel */ |
17 | #define CHSC_SCH_ISC 7 /* CHSC subchannels */ | ||
17 | /* Adapter interrupts. */ | 18 | /* Adapter interrupts. */ |
18 | #define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */ | 19 | #define QDIO_AIRQ_ISC IO_SCH_ISC /* I/O subchannel in qdio mode */ |
19 | 20 | ||
diff --git a/include/asm-s390/schid.h b/include/asm-s390/schid.h new file mode 100644 index 000000000000..5017ffa78e04 --- /dev/null +++ b/include/asm-s390/schid.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef ASM_SCHID_H | ||
2 | #define ASM_SCHID_H | ||
3 | |||
4 | struct subchannel_id { | ||
5 | __u32 cssid : 8; | ||
6 | __u32 : 4; | ||
7 | __u32 m : 1; | ||
8 | __u32 ssid : 2; | ||
9 | __u32 one : 1; | ||
10 | __u32 sch_no : 16; | ||
11 | } __attribute__ ((packed, aligned(4))); | ||
12 | |||
13 | |||
14 | /* Helper function for sane state of pre-allocated subchannel_id. */ | ||
15 | static inline void | ||
16 | init_subchannel_id(struct subchannel_id *schid) | ||
17 | { | ||
18 | memset(schid, 0, sizeof(struct subchannel_id)); | ||
19 | schid->one = 1; | ||
20 | } | ||
21 | |||
22 | static inline int | ||
23 | schid_equal(struct subchannel_id *schid1, struct subchannel_id *schid2) | ||
24 | { | ||
25 | return !memcmp(schid1, schid2, sizeof(struct subchannel_id)); | ||
26 | } | ||
27 | |||
28 | #endif /* ASM_SCHID_H */ | ||