diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2012-08-28 10:45:42 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2012-09-26 09:44:58 -0400 |
commit | 184b08afb5eab8a43d75f4aa0a0f912653f797d7 (patch) | |
tree | 67bf2ce49c623d899335d44a2783c5bad815f81d /drivers/s390 | |
parent | d2fc439b99820cccd6978918c260730dd97bf373 (diff) |
s390/chsc: implement store SCM information
chsc_scm_info will be used to detect all available increments of
storage class memory.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/cio/chsc.c | 35 | ||||
-rw-r--r-- | drivers/s390/cio/chsc.h | 35 |
2 files changed, 70 insertions, 0 deletions
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index cfe0c087fe5c..121865385c05 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -52,6 +52,11 @@ int chsc_error_from_response(int response) | |||
52 | return -EINVAL; | 52 | return -EINVAL; |
53 | case 0x0004: | 53 | case 0x0004: |
54 | return -EOPNOTSUPP; | 54 | return -EOPNOTSUPP; |
55 | case 0x000b: | ||
56 | return -EBUSY; | ||
57 | case 0x0100: | ||
58 | case 0x0102: | ||
59 | return -ENOMEM; | ||
55 | default: | 60 | default: |
56 | return -EIO; | 61 | return -EIO; |
57 | } | 62 | } |
@@ -1047,3 +1052,33 @@ out: | |||
1047 | return rc; | 1052 | return rc; |
1048 | } | 1053 | } |
1049 | EXPORT_SYMBOL_GPL(chsc_siosl); | 1054 | EXPORT_SYMBOL_GPL(chsc_siosl); |
1055 | |||
1056 | /** | ||
1057 | * chsc_scm_info() - store SCM information (SSI) | ||
1058 | * @scm_area: request and response block for SSI | ||
1059 | * @token: continuation token | ||
1060 | * | ||
1061 | * Returns 0 on success. | ||
1062 | */ | ||
1063 | int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token) | ||
1064 | { | ||
1065 | int ccode, ret; | ||
1066 | |||
1067 | memset(scm_area, 0, sizeof(*scm_area)); | ||
1068 | scm_area->request.length = 0x0020; | ||
1069 | scm_area->request.code = 0x004C; | ||
1070 | scm_area->reqtok = token; | ||
1071 | |||
1072 | ccode = chsc(scm_area); | ||
1073 | if (ccode > 0) { | ||
1074 | ret = (ccode == 3) ? -ENODEV : -EBUSY; | ||
1075 | goto out; | ||
1076 | } | ||
1077 | ret = chsc_error_from_response(scm_area->response.code); | ||
1078 | if (ret != 0) | ||
1079 | CIO_MSG_EVENT(2, "chsc: scm info failed (rc=%04x)\n", | ||
1080 | scm_area->response.code); | ||
1081 | out: | ||
1082 | return ret; | ||
1083 | } | ||
1084 | EXPORT_SYMBOL_GPL(chsc_scm_info); | ||
diff --git a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h index b5261f318fe8..3aa94fe7a676 100644 --- a/drivers/s390/cio/chsc.h +++ b/drivers/s390/cio/chsc.h | |||
@@ -119,4 +119,39 @@ int chsc_error_from_response(int response); | |||
119 | 119 | ||
120 | int chsc_siosl(struct subchannel_id schid); | 120 | int chsc_siosl(struct subchannel_id schid); |
121 | 121 | ||
122 | /* Functions and definitions to query storage-class memory. */ | ||
123 | struct sale { | ||
124 | u64 sa; | ||
125 | u32 p:4; | ||
126 | u32 op_state:4; | ||
127 | u32 data_state:4; | ||
128 | u32 rank:4; | ||
129 | u32 r:1; | ||
130 | u32:7; | ||
131 | u32 rid:8; | ||
132 | u32:32; | ||
133 | } __packed; | ||
134 | |||
135 | struct chsc_scm_info { | ||
136 | struct chsc_header request; | ||
137 | u32:32; | ||
138 | u64 reqtok; | ||
139 | u32 reserved1[4]; | ||
140 | struct chsc_header response; | ||
141 | u64:56; | ||
142 | u8 rq; | ||
143 | u32 mbc; | ||
144 | u64 msa; | ||
145 | u16 is; | ||
146 | u16 mmc; | ||
147 | u32 mci; | ||
148 | u64 nr_scm_ini; | ||
149 | u64 nr_scm_unini; | ||
150 | u32 reserved2[10]; | ||
151 | u64 restok; | ||
152 | struct sale scmal[248]; | ||
153 | } __packed; | ||
154 | |||
155 | int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); | ||
156 | |||
122 | #endif | 157 | #endif |