diff options
Diffstat (limited to 'drivers/s390/cio/qdio_setup.c')
-rw-r--r-- | drivers/s390/cio/qdio_setup.c | 145 |
1 files changed, 63 insertions, 82 deletions
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c index a0b6b46e7466..c08356b95bf5 100644 --- a/drivers/s390/cio/qdio_setup.c +++ b/drivers/s390/cio/qdio_setup.c | |||
@@ -117,17 +117,16 @@ static void setup_queues_misc(struct qdio_q *q, struct qdio_irq *irq_ptr, | |||
117 | q->mask = 1 << (31 - i); | 117 | q->mask = 1 << (31 - i); |
118 | q->nr = i; | 118 | q->nr = i; |
119 | q->handler = handler; | 119 | q->handler = handler; |
120 | spin_lock_init(&q->lock); | ||
120 | } | 121 | } |
121 | 122 | ||
122 | static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr, | 123 | static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr, |
123 | void **sbals_array, char *dbf_text, int i) | 124 | void **sbals_array, int i) |
124 | { | 125 | { |
125 | struct qdio_q *prev; | 126 | struct qdio_q *prev; |
126 | int j; | 127 | int j; |
127 | 128 | ||
128 | QDIO_DBF_TEXT0(0, setup, dbf_text); | 129 | DBF_HEX(&q, sizeof(void *)); |
129 | QDIO_DBF_HEX0(0, setup, &q, sizeof(void *)); | ||
130 | |||
131 | q->sl = (struct sl *)((char *)q->slib + PAGE_SIZE / 2); | 130 | q->sl = (struct sl *)((char *)q->slib + PAGE_SIZE / 2); |
132 | 131 | ||
133 | /* fill in sbal */ | 132 | /* fill in sbal */ |
@@ -150,31 +149,26 @@ static void setup_storage_lists(struct qdio_q *q, struct qdio_irq *irq_ptr, | |||
150 | for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) | 149 | for (j = 0; j < QDIO_MAX_BUFFERS_PER_Q; j++) |
151 | q->sl->element[j].sbal = (unsigned long)q->sbal[j]; | 150 | q->sl->element[j].sbal = (unsigned long)q->sbal[j]; |
152 | 151 | ||
153 | QDIO_DBF_TEXT2(0, setup, "sl-sb-b0"); | 152 | DBF_EVENT("sl-slsb-sbal"); |
154 | QDIO_DBF_HEX2(0, setup, q->sl, sizeof(void *)); | 153 | DBF_HEX(q->sl, sizeof(void *)); |
155 | QDIO_DBF_HEX2(0, setup, &q->slsb, sizeof(void *)); | 154 | DBF_HEX(&q->slsb, sizeof(void *)); |
156 | QDIO_DBF_HEX2(0, setup, q->sbal, sizeof(void *)); | 155 | DBF_HEX(q->sbal, sizeof(void *)); |
157 | } | 156 | } |
158 | 157 | ||
159 | static void setup_queues(struct qdio_irq *irq_ptr, | 158 | static void setup_queues(struct qdio_irq *irq_ptr, |
160 | struct qdio_initialize *qdio_init) | 159 | struct qdio_initialize *qdio_init) |
161 | { | 160 | { |
162 | char dbf_text[20]; | ||
163 | struct qdio_q *q; | 161 | struct qdio_q *q; |
164 | void **input_sbal_array = qdio_init->input_sbal_addr_array; | 162 | void **input_sbal_array = qdio_init->input_sbal_addr_array; |
165 | void **output_sbal_array = qdio_init->output_sbal_addr_array; | 163 | void **output_sbal_array = qdio_init->output_sbal_addr_array; |
166 | int i; | 164 | int i; |
167 | 165 | ||
168 | sprintf(dbf_text, "qset%4x", qdio_init->cdev->private->schid.sch_no); | ||
169 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
170 | |||
171 | for_each_input_queue(irq_ptr, q, i) { | 166 | for_each_input_queue(irq_ptr, q, i) { |
172 | sprintf(dbf_text, "in-q%4x", i); | 167 | DBF_EVENT("in-q:%1d", i); |
173 | setup_queues_misc(q, irq_ptr, qdio_init->input_handler, i); | 168 | setup_queues_misc(q, irq_ptr, qdio_init->input_handler, i); |
174 | 169 | ||
175 | q->is_input_q = 1; | 170 | q->is_input_q = 1; |
176 | spin_lock_init(&q->u.in.lock); | 171 | setup_storage_lists(q, irq_ptr, input_sbal_array, i); |
177 | setup_storage_lists(q, irq_ptr, input_sbal_array, dbf_text, i); | ||
178 | input_sbal_array += QDIO_MAX_BUFFERS_PER_Q; | 172 | input_sbal_array += QDIO_MAX_BUFFERS_PER_Q; |
179 | 173 | ||
180 | if (is_thinint_irq(irq_ptr)) | 174 | if (is_thinint_irq(irq_ptr)) |
@@ -186,12 +180,11 @@ static void setup_queues(struct qdio_irq *irq_ptr, | |||
186 | } | 180 | } |
187 | 181 | ||
188 | for_each_output_queue(irq_ptr, q, i) { | 182 | for_each_output_queue(irq_ptr, q, i) { |
189 | sprintf(dbf_text, "outq%4x", i); | 183 | DBF_EVENT("outq:%1d", i); |
190 | setup_queues_misc(q, irq_ptr, qdio_init->output_handler, i); | 184 | setup_queues_misc(q, irq_ptr, qdio_init->output_handler, i); |
191 | 185 | ||
192 | q->is_input_q = 0; | 186 | q->is_input_q = 0; |
193 | setup_storage_lists(q, irq_ptr, output_sbal_array, | 187 | setup_storage_lists(q, irq_ptr, output_sbal_array, i); |
194 | dbf_text, i); | ||
195 | output_sbal_array += QDIO_MAX_BUFFERS_PER_Q; | 188 | output_sbal_array += QDIO_MAX_BUFFERS_PER_Q; |
196 | 189 | ||
197 | tasklet_init(&q->tasklet, qdio_outbound_processing, | 190 | tasklet_init(&q->tasklet, qdio_outbound_processing, |
@@ -222,8 +215,6 @@ static void process_ac_flags(struct qdio_irq *irq_ptr, unsigned char qdioac) | |||
222 | static void check_and_setup_qebsm(struct qdio_irq *irq_ptr, | 215 | static void check_and_setup_qebsm(struct qdio_irq *irq_ptr, |
223 | unsigned char qdioac, unsigned long token) | 216 | unsigned char qdioac, unsigned long token) |
224 | { | 217 | { |
225 | char dbf_text[15]; | ||
226 | |||
227 | if (!(irq_ptr->qib.rflags & QIB_RFLAGS_ENABLE_QEBSM)) | 218 | if (!(irq_ptr->qib.rflags & QIB_RFLAGS_ENABLE_QEBSM)) |
228 | goto no_qebsm; | 219 | goto no_qebsm; |
229 | if (!(qdioac & AC1_SC_QEBSM_AVAILABLE) || | 220 | if (!(qdioac & AC1_SC_QEBSM_AVAILABLE) || |
@@ -232,33 +223,41 @@ static void check_and_setup_qebsm(struct qdio_irq *irq_ptr, | |||
232 | 223 | ||
233 | irq_ptr->sch_token = token; | 224 | irq_ptr->sch_token = token; |
234 | 225 | ||
235 | QDIO_DBF_TEXT0(0, setup, "V=V:1"); | 226 | DBF_EVENT("V=V:1"); |
236 | sprintf(dbf_text, "%8lx", irq_ptr->sch_token); | 227 | DBF_EVENT("%8lx", irq_ptr->sch_token); |
237 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
238 | return; | 228 | return; |
239 | 229 | ||
240 | no_qebsm: | 230 | no_qebsm: |
241 | irq_ptr->sch_token = 0; | 231 | irq_ptr->sch_token = 0; |
242 | irq_ptr->qib.rflags &= ~QIB_RFLAGS_ENABLE_QEBSM; | 232 | irq_ptr->qib.rflags &= ~QIB_RFLAGS_ENABLE_QEBSM; |
243 | QDIO_DBF_TEXT0(0, setup, "noV=V"); | 233 | DBF_EVENT("noV=V"); |
244 | } | 234 | } |
245 | 235 | ||
246 | static int __get_ssqd_info(struct qdio_irq *irq_ptr) | 236 | /* |
237 | * If there is a qdio_irq we use the chsc_page and store the information | ||
238 | * in the qdio_irq, otherwise we copy it to the specified structure. | ||
239 | */ | ||
240 | int qdio_setup_get_ssqd(struct qdio_irq *irq_ptr, | ||
241 | struct subchannel_id *schid, | ||
242 | struct qdio_ssqd_desc *data) | ||
247 | { | 243 | { |
248 | struct chsc_ssqd_area *ssqd; | 244 | struct chsc_ssqd_area *ssqd; |
249 | int rc; | 245 | int rc; |
250 | 246 | ||
251 | QDIO_DBF_TEXT0(0, setup, "getssqd"); | 247 | DBF_EVENT("getssqd:%4x", schid->sch_no); |
252 | ssqd = (struct chsc_ssqd_area *)irq_ptr->chsc_page; | 248 | if (irq_ptr != NULL) |
249 | ssqd = (struct chsc_ssqd_area *)irq_ptr->chsc_page; | ||
250 | else | ||
251 | ssqd = (struct chsc_ssqd_area *)__get_free_page(GFP_KERNEL); | ||
253 | memset(ssqd, 0, PAGE_SIZE); | 252 | memset(ssqd, 0, PAGE_SIZE); |
254 | 253 | ||
255 | ssqd->request = (struct chsc_header) { | 254 | ssqd->request = (struct chsc_header) { |
256 | .length = 0x0010, | 255 | .length = 0x0010, |
257 | .code = 0x0024, | 256 | .code = 0x0024, |
258 | }; | 257 | }; |
259 | ssqd->first_sch = irq_ptr->schid.sch_no; | 258 | ssqd->first_sch = schid->sch_no; |
260 | ssqd->last_sch = irq_ptr->schid.sch_no; | 259 | ssqd->last_sch = schid->sch_no; |
261 | ssqd->ssid = irq_ptr->schid.ssid; | 260 | ssqd->ssid = schid->ssid; |
262 | 261 | ||
263 | if (chsc(ssqd)) | 262 | if (chsc(ssqd)) |
264 | return -EIO; | 263 | return -EIO; |
@@ -268,27 +267,29 @@ static int __get_ssqd_info(struct qdio_irq *irq_ptr) | |||
268 | 267 | ||
269 | if (!(ssqd->qdio_ssqd.flags & CHSC_FLAG_QDIO_CAPABILITY) || | 268 | if (!(ssqd->qdio_ssqd.flags & CHSC_FLAG_QDIO_CAPABILITY) || |
270 | !(ssqd->qdio_ssqd.flags & CHSC_FLAG_VALIDITY) || | 269 | !(ssqd->qdio_ssqd.flags & CHSC_FLAG_VALIDITY) || |
271 | (ssqd->qdio_ssqd.sch != irq_ptr->schid.sch_no)) | 270 | (ssqd->qdio_ssqd.sch != schid->sch_no)) |
272 | return -EINVAL; | 271 | return -EINVAL; |
273 | 272 | ||
274 | memcpy(&irq_ptr->ssqd_desc, &ssqd->qdio_ssqd, | 273 | if (irq_ptr != NULL) |
275 | sizeof(struct qdio_ssqd_desc)); | 274 | memcpy(&irq_ptr->ssqd_desc, &ssqd->qdio_ssqd, |
275 | sizeof(struct qdio_ssqd_desc)); | ||
276 | else { | ||
277 | memcpy(data, &ssqd->qdio_ssqd, | ||
278 | sizeof(struct qdio_ssqd_desc)); | ||
279 | free_page((unsigned long)ssqd); | ||
280 | } | ||
276 | return 0; | 281 | return 0; |
277 | } | 282 | } |
278 | 283 | ||
279 | void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr) | 284 | void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr) |
280 | { | 285 | { |
281 | unsigned char qdioac; | 286 | unsigned char qdioac; |
282 | char dbf_text[15]; | ||
283 | int rc; | 287 | int rc; |
284 | 288 | ||
285 | rc = __get_ssqd_info(irq_ptr); | 289 | rc = qdio_setup_get_ssqd(irq_ptr, &irq_ptr->schid, NULL); |
286 | if (rc) { | 290 | if (rc) { |
287 | QDIO_DBF_TEXT2(0, setup, "ssqdasig"); | 291 | DBF_ERROR("%4x ssqd ERR", irq_ptr->schid.sch_no); |
288 | sprintf(dbf_text, "schn%4x", irq_ptr->schid.sch_no); | 292 | DBF_ERROR("rc:%x", rc); |
289 | QDIO_DBF_TEXT2(0, setup, dbf_text); | ||
290 | sprintf(dbf_text, "rc:%d", rc); | ||
291 | QDIO_DBF_TEXT2(0, setup, dbf_text); | ||
292 | /* all flags set, worst case */ | 293 | /* all flags set, worst case */ |
293 | qdioac = AC1_SIGA_INPUT_NEEDED | AC1_SIGA_OUTPUT_NEEDED | | 294 | qdioac = AC1_SIGA_INPUT_NEEDED | AC1_SIGA_OUTPUT_NEEDED | |
294 | AC1_SIGA_SYNC_NEEDED; | 295 | AC1_SIGA_SYNC_NEEDED; |
@@ -297,9 +298,7 @@ void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr) | |||
297 | 298 | ||
298 | check_and_setup_qebsm(irq_ptr, qdioac, irq_ptr->ssqd_desc.sch_token); | 299 | check_and_setup_qebsm(irq_ptr, qdioac, irq_ptr->ssqd_desc.sch_token); |
299 | process_ac_flags(irq_ptr, qdioac); | 300 | process_ac_flags(irq_ptr, qdioac); |
300 | 301 | DBF_EVENT("qdioac:%4x", qdioac); | |
301 | sprintf(dbf_text, "qdioac%2x", qdioac); | ||
302 | QDIO_DBF_TEXT2(0, setup, dbf_text); | ||
303 | } | 302 | } |
304 | 303 | ||
305 | void qdio_release_memory(struct qdio_irq *irq_ptr) | 304 | void qdio_release_memory(struct qdio_irq *irq_ptr) |
@@ -419,7 +418,7 @@ int qdio_setup_irq(struct qdio_initialize *init_data) | |||
419 | /* get qdio commands */ | 418 | /* get qdio commands */ |
420 | ciw = ccw_device_get_ciw(init_data->cdev, CIW_TYPE_EQUEUE); | 419 | ciw = ccw_device_get_ciw(init_data->cdev, CIW_TYPE_EQUEUE); |
421 | if (!ciw) { | 420 | if (!ciw) { |
422 | QDIO_DBF_TEXT2(1, setup, "no eq"); | 421 | DBF_ERROR("%4x NO EQ", irq_ptr->schid.sch_no); |
423 | rc = -EINVAL; | 422 | rc = -EINVAL; |
424 | goto out_err; | 423 | goto out_err; |
425 | } | 424 | } |
@@ -427,7 +426,7 @@ int qdio_setup_irq(struct qdio_initialize *init_data) | |||
427 | 426 | ||
428 | ciw = ccw_device_get_ciw(init_data->cdev, CIW_TYPE_AQUEUE); | 427 | ciw = ccw_device_get_ciw(init_data->cdev, CIW_TYPE_AQUEUE); |
429 | if (!ciw) { | 428 | if (!ciw) { |
430 | QDIO_DBF_TEXT2(1, setup, "no aq"); | 429 | DBF_ERROR("%4x NO AQ", irq_ptr->schid.sch_no); |
431 | rc = -EINVAL; | 430 | rc = -EINVAL; |
432 | goto out_err; | 431 | goto out_err; |
433 | } | 432 | } |
@@ -447,56 +446,38 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr, | |||
447 | { | 446 | { |
448 | char s[80]; | 447 | char s[80]; |
449 | 448 | ||
450 | sprintf(s, "qdio: %s ", dev_name(&cdev->dev)); | 449 | snprintf(s, 80, "qdio: %s %s on SC %x using " |
451 | switch (irq_ptr->qib.qfmt) { | 450 | "AI:%d QEBSM:%d PCI:%d TDD:%d SIGA:%s%s%s%s%s%s\n", |
452 | case QDIO_QETH_QFMT: | 451 | dev_name(&cdev->dev), |
453 | sprintf(s + strlen(s), "OSA "); | 452 | (irq_ptr->qib.qfmt == QDIO_QETH_QFMT) ? "OSA" : |
454 | break; | 453 | ((irq_ptr->qib.qfmt == QDIO_ZFCP_QFMT) ? "ZFCP" : "HS"), |
455 | case QDIO_ZFCP_QFMT: | 454 | irq_ptr->schid.sch_no, |
456 | sprintf(s + strlen(s), "ZFCP "); | 455 | is_thinint_irq(irq_ptr), |
457 | break; | 456 | (irq_ptr->sch_token) ? 1 : 0, |
458 | case QDIO_IQDIO_QFMT: | 457 | (irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) ? 1 : 0, |
459 | sprintf(s + strlen(s), "HS "); | 458 | css_general_characteristics.aif_tdd, |
460 | break; | 459 | (irq_ptr->siga_flag.input) ? "R" : " ", |
461 | } | 460 | (irq_ptr->siga_flag.output) ? "W" : " ", |
462 | sprintf(s + strlen(s), "on SC %x using ", irq_ptr->schid.sch_no); | 461 | (irq_ptr->siga_flag.sync) ? "S" : " ", |
463 | sprintf(s + strlen(s), "AI:%d ", is_thinint_irq(irq_ptr)); | 462 | (!irq_ptr->siga_flag.no_sync_ti) ? "A" : " ", |
464 | sprintf(s + strlen(s), "QEBSM:%d ", (irq_ptr->sch_token) ? 1 : 0); | 463 | (!irq_ptr->siga_flag.no_sync_out_ti) ? "O" : " ", |
465 | sprintf(s + strlen(s), "PCI:%d ", | 464 | (!irq_ptr->siga_flag.no_sync_out_pci) ? "P" : " "); |
466 | (irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) ? 1 : 0); | ||
467 | sprintf(s + strlen(s), "TDD:%d ", css_general_characteristics.aif_tdd); | ||
468 | sprintf(s + strlen(s), "SIGA:"); | ||
469 | sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.input) ? "R" : " "); | ||
470 | sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.output) ? "W" : " "); | ||
471 | sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.sync) ? "S" : " "); | ||
472 | sprintf(s + strlen(s), "%s", | ||
473 | (!irq_ptr->siga_flag.no_sync_ti) ? "A" : " "); | ||
474 | sprintf(s + strlen(s), "%s", | ||
475 | (!irq_ptr->siga_flag.no_sync_out_ti) ? "O" : " "); | ||
476 | sprintf(s + strlen(s), "%s", | ||
477 | (!irq_ptr->siga_flag.no_sync_out_pci) ? "P" : " "); | ||
478 | sprintf(s + strlen(s), "\n"); | ||
479 | printk(KERN_INFO "%s", s); | 465 | printk(KERN_INFO "%s", s); |
480 | } | 466 | } |
481 | 467 | ||
482 | int __init qdio_setup_init(void) | 468 | int __init qdio_setup_init(void) |
483 | { | 469 | { |
484 | char dbf_text[15]; | ||
485 | |||
486 | qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q), | 470 | qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q), |
487 | 256, 0, NULL); | 471 | 256, 0, NULL); |
488 | if (!qdio_q_cache) | 472 | if (!qdio_q_cache) |
489 | return -ENOMEM; | 473 | return -ENOMEM; |
490 | 474 | ||
491 | /* Check for OSA/FCP thin interrupts (bit 67). */ | 475 | /* Check for OSA/FCP thin interrupts (bit 67). */ |
492 | sprintf(dbf_text, "thini%1x", | 476 | DBF_EVENT("thinint:%1d", |
493 | (css_general_characteristics.aif_osa) ? 1 : 0); | 477 | (css_general_characteristics.aif_osa) ? 1 : 0); |
494 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
495 | 478 | ||
496 | /* Check for QEBSM support in general (bit 58). */ | 479 | /* Check for QEBSM support in general (bit 58). */ |
497 | sprintf(dbf_text, "cssQBS:%1x", | 480 | DBF_EVENT("cssQEBSM:%1d", (qebsm_possible()) ? 1 : 0); |
498 | (qebsm_possible()) ? 1 : 0); | ||
499 | QDIO_DBF_TEXT0(0, setup, dbf_text); | ||
500 | return 0; | 481 | return 0; |
501 | } | 482 | } |
502 | 483 | ||