diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2017-02-02 06:33:03 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-02-08 08:13:21 -0500 |
commit | f694bb3a36a8113addd31817e4b5aca42326353d (patch) | |
tree | ea99bbb43adba384a822788b6bf0067c9a6b7405 | |
parent | 02407baaebdef86571e4e939ddbd3b32d9b5d389 (diff) |
s390/sclp: get rid of common response code handling
Get rid of common response code handling. Each command requires its
own response code handling anyway. Also the retry in case of -EBUSY
does not work and can be simply removed.
Reviewed-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r-- | drivers/s390/char/sclp.h | 1 | ||||
-rw-r--r-- | drivers/s390/char/sclp_early.c | 27 | ||||
-rw-r--r-- | drivers/s390/char/sclp_early_core.c | 22 |
3 files changed, 17 insertions, 33 deletions
diff --git a/drivers/s390/char/sclp.h b/drivers/s390/char/sclp.h index 78d5f542d979..53b5d1b9761a 100644 --- a/drivers/s390/char/sclp.h +++ b/drivers/s390/char/sclp.h | |||
@@ -224,7 +224,6 @@ extern unsigned long sclp_console_full; | |||
224 | extern char sclp_early_sccb[PAGE_SIZE]; | 224 | extern char sclp_early_sccb[PAGE_SIZE]; |
225 | 225 | ||
226 | void sclp_early_wait_irq(void); | 226 | void sclp_early_wait_irq(void); |
227 | int sclp_early_cmd_sync(sclp_cmdw_t cmd, void *sccb); | ||
228 | int sclp_early_cmd(sclp_cmdw_t cmd, void *sccb); | 227 | int sclp_early_cmd(sclp_cmdw_t cmd, void *sccb); |
229 | unsigned int sclp_early_con_check_linemode(struct init_sccb *sccb); | 228 | unsigned int sclp_early_con_check_linemode(struct init_sccb *sccb); |
230 | int sclp_early_set_event_mask(struct init_sccb *sccb, | 229 | int sclp_early_set_event_mask(struct init_sccb *sccb, |
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c index 2f9e50379e64..519ec1787117 100644 --- a/drivers/s390/char/sclp_early.c +++ b/drivers/s390/char/sclp_early.c | |||
@@ -62,20 +62,16 @@ EXPORT_SYMBOL(sclp); | |||
62 | 62 | ||
63 | static int __init sclp_early_read_info(struct read_info_sccb *sccb) | 63 | static int __init sclp_early_read_info(struct read_info_sccb *sccb) |
64 | { | 64 | { |
65 | int rc, i; | 65 | int i; |
66 | sclp_cmdw_t commands[] = {SCLP_CMDW_READ_SCP_INFO_FORCED, | 66 | sclp_cmdw_t commands[] = {SCLP_CMDW_READ_SCP_INFO_FORCED, |
67 | SCLP_CMDW_READ_SCP_INFO}; | 67 | SCLP_CMDW_READ_SCP_INFO}; |
68 | 68 | ||
69 | for (i = 0; i < ARRAY_SIZE(commands); i++) { | 69 | for (i = 0; i < ARRAY_SIZE(commands); i++) { |
70 | do { | 70 | memset(sccb, 0, sizeof(*sccb)); |
71 | memset(sccb, 0, sizeof(*sccb)); | 71 | sccb->header.length = sizeof(*sccb); |
72 | sccb->header.length = sizeof(*sccb); | 72 | sccb->header.function_code = 0x80; |
73 | sccb->header.function_code = 0x80; | 73 | sccb->header.control_mask[2] = 0x80; |
74 | sccb->header.control_mask[2] = 0x80; | 74 | if (sclp_early_cmd(commands[i], sccb)) |
75 | rc = sclp_early_cmd_sync(commands[i], sccb); | ||
76 | } while (rc == -EBUSY); | ||
77 | |||
78 | if (rc) | ||
79 | break; | 75 | break; |
80 | if (sccb->header.response_code == 0x10) | 76 | if (sccb->header.response_code == 0x10) |
81 | return 0; | 77 | return 0; |
@@ -167,16 +163,11 @@ static int sclp_early_core_info_valid __initdata; | |||
167 | 163 | ||
168 | static void __init sclp_early_init_core_info(struct read_cpu_info_sccb *sccb) | 164 | static void __init sclp_early_init_core_info(struct read_cpu_info_sccb *sccb) |
169 | { | 165 | { |
170 | int rc; | ||
171 | |||
172 | if (!SCLP_HAS_CPU_INFO) | 166 | if (!SCLP_HAS_CPU_INFO) |
173 | return; | 167 | return; |
174 | memset(sccb, 0, sizeof(*sccb)); | 168 | memset(sccb, 0, sizeof(*sccb)); |
175 | sccb->header.length = sizeof(*sccb); | 169 | sccb->header.length = sizeof(*sccb); |
176 | do { | 170 | if (sclp_early_cmd(SCLP_CMDW_READ_CPU_INFO, sccb)) |
177 | rc = sclp_early_cmd_sync(SCLP_CMDW_READ_CPU_INFO, sccb); | ||
178 | } while (rc == -EBUSY); | ||
179 | if (rc) | ||
180 | return; | 171 | return; |
181 | if (sccb->header.response_code != 0x0010) | 172 | if (sccb->header.response_code != 0x0010) |
182 | return; | 173 | return; |
@@ -204,6 +195,8 @@ static long __init sclp_early_hsa_size_init(struct sdias_sccb *sccb) | |||
204 | sccb->evbuf.dbs = 1; | 195 | sccb->evbuf.dbs = 1; |
205 | if (sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_DATA, sccb)) | 196 | if (sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_DATA, sccb)) |
206 | return -EIO; | 197 | return -EIO; |
198 | if (sccb->hdr.response_code != 0x20) | ||
199 | return -EIO; | ||
207 | if (sccb->evbuf.blk_cnt == 0) | 200 | if (sccb->evbuf.blk_cnt == 0) |
208 | return 0; | 201 | return 0; |
209 | return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE; | 202 | return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE; |
@@ -215,6 +208,8 @@ static long __init sclp_early_hsa_copy_wait(struct sdias_sccb *sccb) | |||
215 | sccb->hdr.length = PAGE_SIZE; | 208 | sccb->hdr.length = PAGE_SIZE; |
216 | if (sclp_early_cmd(SCLP_CMDW_READ_EVENT_DATA, sccb)) | 209 | if (sclp_early_cmd(SCLP_CMDW_READ_EVENT_DATA, sccb)) |
217 | return -EIO; | 210 | return -EIO; |
211 | if ((sccb->hdr.response_code != 0x20) && (sccb->hdr.response_code != 0x220)) | ||
212 | return -EIO; | ||
218 | if (sccb->evbuf.blk_cnt == 0) | 213 | if (sccb->evbuf.blk_cnt == 0) |
219 | return 0; | 214 | return 0; |
220 | return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE; | 215 | return (sccb->evbuf.blk_cnt - 1) * PAGE_SIZE; |
diff --git a/drivers/s390/char/sclp_early_core.c b/drivers/s390/char/sclp_early_core.c index cc3ad8c69a7a..5029cc87e80f 100644 --- a/drivers/s390/char/sclp_early_core.c +++ b/drivers/s390/char/sclp_early_core.c | |||
@@ -50,7 +50,7 @@ void sclp_early_wait_irq(void) | |||
50 | __ctl_load(cr0.val, 0, 0); | 50 | __ctl_load(cr0.val, 0, 0); |
51 | } | 51 | } |
52 | 52 | ||
53 | int sclp_early_cmd_sync(sclp_cmdw_t cmd, void *sccb) | 53 | int sclp_early_cmd(sclp_cmdw_t cmd, void *sccb) |
54 | { | 54 | { |
55 | unsigned long flags; | 55 | unsigned long flags; |
56 | int rc; | 56 | int rc; |
@@ -65,20 +65,6 @@ out: | |||
65 | return rc; | 65 | return rc; |
66 | } | 66 | } |
67 | 67 | ||
68 | int sclp_early_cmd(sclp_cmdw_t cmd, void *sccb) | ||
69 | { | ||
70 | int rc; | ||
71 | |||
72 | do { | ||
73 | rc = sclp_early_cmd_sync(cmd, sccb); | ||
74 | } while (rc == -EBUSY); | ||
75 | if (rc) | ||
76 | return -EIO; | ||
77 | if (((struct sccb_header *) sccb)->response_code != 0x0020) | ||
78 | return -EIO; | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | struct write_sccb { | 68 | struct write_sccb { |
83 | struct sccb_header header; | 69 | struct sccb_header header; |
84 | struct msg_buf msg; | 70 | struct msg_buf msg; |
@@ -163,7 +149,11 @@ int sclp_early_set_event_mask(struct init_sccb *sccb, | |||
163 | sccb->mask_length = sizeof(sccb_mask_t); | 149 | sccb->mask_length = sizeof(sccb_mask_t); |
164 | sccb->receive_mask = receive_mask; | 150 | sccb->receive_mask = receive_mask; |
165 | sccb->send_mask = send_mask; | 151 | sccb->send_mask = send_mask; |
166 | return sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_MASK, sccb); | 152 | if (sclp_early_cmd(SCLP_CMDW_WRITE_EVENT_MASK, sccb)) |
153 | return -EIO; | ||
154 | if (sccb->header.response_code != 0x20) | ||
155 | return -EIO; | ||
156 | return 0; | ||
167 | } | 157 | } |
168 | 158 | ||
169 | unsigned int sclp_early_con_check_linemode(struct init_sccb *sccb) | 159 | unsigned int sclp_early_con_check_linemode(struct init_sccb *sccb) |