diff options
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/block/dasd.c | 16 | ||||
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 36 | ||||
-rw-r--r-- | drivers/s390/char/con3215.c | 50 | ||||
-rw-r--r-- | drivers/s390/char/sclp_quiesce.c | 37 | ||||
-rw-r--r-- | drivers/s390/cio/chsc.c | 82 | ||||
-rw-r--r-- | drivers/s390/cio/cio.c | 128 | ||||
-rw-r--r-- | drivers/s390/cio/css.h | 3 | ||||
-rw-r--r-- | drivers/s390/cio/device.c | 17 | ||||
-rw-r--r-- | drivers/s390/cio/device_fsm.c | 27 | ||||
-rw-r--r-- | drivers/s390/cio/device_id.c | 10 | ||||
-rw-r--r-- | drivers/s390/cio/device_pgid.c | 30 | ||||
-rw-r--r-- | drivers/s390/cio/device_status.c | 3 | ||||
-rw-r--r-- | drivers/s390/cio/qdio.c | 8 | ||||
-rw-r--r-- | drivers/s390/cio/qdio.h | 4 | ||||
-rw-r--r-- | drivers/s390/crypto/ap_bus.c | 10 | ||||
-rw-r--r-- | drivers/s390/net/lcs.c | 78 | ||||
-rw-r--r-- | drivers/s390/net/lcs.h | 25 | ||||
-rw-r--r-- | drivers/s390/net/qeth.h | 2 | ||||
-rw-r--r-- | drivers/s390/net/qeth_main.c | 6 |
19 files changed, 350 insertions, 222 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 79ffef6bfaf8..a2cef57d7bcb 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -1264,15 +1264,21 @@ __dasd_check_expire(struct dasd_device * device) | |||
1264 | if (list_empty(&device->ccw_queue)) | 1264 | if (list_empty(&device->ccw_queue)) |
1265 | return; | 1265 | return; |
1266 | cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); | 1266 | cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); |
1267 | if (cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) { | 1267 | if ((cqr->status == DASD_CQR_IN_IO && cqr->expires != 0) && |
1268 | if (time_after_eq(jiffies, cqr->expires + cqr->starttime)) { | 1268 | (time_after_eq(jiffies, cqr->expires + cqr->starttime))) { |
1269 | if (device->discipline->term_IO(cqr) != 0) { | ||
1270 | /* Hmpf, try again in 5 sec */ | ||
1271 | dasd_set_timer(device, 5*HZ); | ||
1272 | DEV_MESSAGE(KERN_ERR, device, | ||
1273 | "internal error - timeout (%is) expired " | ||
1274 | "for cqr %p, termination failed, " | ||
1275 | "retrying in 5s", | ||
1276 | (cqr->expires/HZ), cqr); | ||
1277 | } else { | ||
1269 | DEV_MESSAGE(KERN_ERR, device, | 1278 | DEV_MESSAGE(KERN_ERR, device, |
1270 | "internal error - timeout (%is) expired " | 1279 | "internal error - timeout (%is) expired " |
1271 | "for cqr %p (%i retries left)", | 1280 | "for cqr %p (%i retries left)", |
1272 | (cqr->expires/HZ), cqr, cqr->retries); | 1281 | (cqr->expires/HZ), cqr, cqr->retries); |
1273 | if (device->discipline->term_IO(cqr) != 0) | ||
1274 | /* Hmpf, try again in 1/10 sec */ | ||
1275 | dasd_set_timer(device, 10); | ||
1276 | } | 1282 | } |
1277 | } | 1283 | } |
1278 | } | 1284 | } |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 91cf971f0652..17fdd8c9f740 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -684,21 +684,26 @@ dasd_ro_store(struct device *dev, struct device_attribute *attr, | |||
684 | const char *buf, size_t count) | 684 | const char *buf, size_t count) |
685 | { | 685 | { |
686 | struct dasd_devmap *devmap; | 686 | struct dasd_devmap *devmap; |
687 | int ro_flag; | 687 | int val; |
688 | char *endp; | ||
688 | 689 | ||
689 | devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); | 690 | devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); |
690 | if (IS_ERR(devmap)) | 691 | if (IS_ERR(devmap)) |
691 | return PTR_ERR(devmap); | 692 | return PTR_ERR(devmap); |
692 | ro_flag = buf[0] == '1'; | 693 | |
694 | val = simple_strtoul(buf, &endp, 0); | ||
695 | if (((endp + 1) < (buf + count)) || (val > 1)) | ||
696 | return -EINVAL; | ||
697 | |||
693 | spin_lock(&dasd_devmap_lock); | 698 | spin_lock(&dasd_devmap_lock); |
694 | if (ro_flag) | 699 | if (val) |
695 | devmap->features |= DASD_FEATURE_READONLY; | 700 | devmap->features |= DASD_FEATURE_READONLY; |
696 | else | 701 | else |
697 | devmap->features &= ~DASD_FEATURE_READONLY; | 702 | devmap->features &= ~DASD_FEATURE_READONLY; |
698 | if (devmap->device) | 703 | if (devmap->device) |
699 | devmap->device->features = devmap->features; | 704 | devmap->device->features = devmap->features; |
700 | if (devmap->device && devmap->device->gdp) | 705 | if (devmap->device && devmap->device->gdp) |
701 | set_disk_ro(devmap->device->gdp, ro_flag); | 706 | set_disk_ro(devmap->device->gdp, val); |
702 | spin_unlock(&dasd_devmap_lock); | 707 | spin_unlock(&dasd_devmap_lock); |
703 | return count; | 708 | return count; |
704 | } | 709 | } |
@@ -729,17 +734,22 @@ dasd_use_diag_store(struct device *dev, struct device_attribute *attr, | |||
729 | { | 734 | { |
730 | struct dasd_devmap *devmap; | 735 | struct dasd_devmap *devmap; |
731 | ssize_t rc; | 736 | ssize_t rc; |
732 | int use_diag; | 737 | int val; |
738 | char *endp; | ||
733 | 739 | ||
734 | devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); | 740 | devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); |
735 | if (IS_ERR(devmap)) | 741 | if (IS_ERR(devmap)) |
736 | return PTR_ERR(devmap); | 742 | return PTR_ERR(devmap); |
737 | use_diag = buf[0] == '1'; | 743 | |
744 | val = simple_strtoul(buf, &endp, 0); | ||
745 | if (((endp + 1) < (buf + count)) || (val > 1)) | ||
746 | return -EINVAL; | ||
747 | |||
738 | spin_lock(&dasd_devmap_lock); | 748 | spin_lock(&dasd_devmap_lock); |
739 | /* Changing diag discipline flag is only allowed in offline state. */ | 749 | /* Changing diag discipline flag is only allowed in offline state. */ |
740 | rc = count; | 750 | rc = count; |
741 | if (!devmap->device) { | 751 | if (!devmap->device) { |
742 | if (use_diag) | 752 | if (val) |
743 | devmap->features |= DASD_FEATURE_USEDIAG; | 753 | devmap->features |= DASD_FEATURE_USEDIAG; |
744 | else | 754 | else |
745 | devmap->features &= ~DASD_FEATURE_USEDIAG; | 755 | devmap->features &= ~DASD_FEATURE_USEDIAG; |
@@ -854,14 +864,20 @@ dasd_eer_store(struct device *dev, struct device_attribute *attr, | |||
854 | const char *buf, size_t count) | 864 | const char *buf, size_t count) |
855 | { | 865 | { |
856 | struct dasd_devmap *devmap; | 866 | struct dasd_devmap *devmap; |
857 | int rc; | 867 | int val, rc; |
868 | char *endp; | ||
858 | 869 | ||
859 | devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); | 870 | devmap = dasd_devmap_from_cdev(to_ccwdev(dev)); |
860 | if (IS_ERR(devmap)) | 871 | if (IS_ERR(devmap)) |
861 | return PTR_ERR(devmap); | 872 | return PTR_ERR(devmap); |
862 | if (!devmap->device) | 873 | if (!devmap->device) |
863 | return count; | 874 | return -ENODEV; |
864 | if (buf[0] == '1') { | 875 | |
876 | val = simple_strtoul(buf, &endp, 0); | ||
877 | if (((endp + 1) < (buf + count)) || (val > 1)) | ||
878 | return -EINVAL; | ||
879 | |||
880 | if (val) { | ||
865 | rc = dasd_eer_enable(devmap->device); | 881 | rc = dasd_eer_enable(devmap->device); |
866 | if (rc) | 882 | if (rc) |
867 | return rc; | 883 | return rc; |
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index d7de175d53f0..c9321b920e90 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
@@ -299,14 +299,14 @@ raw3215_timeout(unsigned long __data) | |||
299 | struct raw3215_info *raw = (struct raw3215_info *) __data; | 299 | struct raw3215_info *raw = (struct raw3215_info *) __data; |
300 | unsigned long flags; | 300 | unsigned long flags; |
301 | 301 | ||
302 | spin_lock_irqsave(raw->lock, flags); | 302 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
303 | if (raw->flags & RAW3215_TIMER_RUNS) { | 303 | if (raw->flags & RAW3215_TIMER_RUNS) { |
304 | del_timer(&raw->timer); | 304 | del_timer(&raw->timer); |
305 | raw->flags &= ~RAW3215_TIMER_RUNS; | 305 | raw->flags &= ~RAW3215_TIMER_RUNS; |
306 | raw3215_mk_write_req(raw); | 306 | raw3215_mk_write_req(raw); |
307 | raw3215_start_io(raw); | 307 | raw3215_start_io(raw); |
308 | } | 308 | } |
309 | spin_unlock_irqrestore(raw->lock, flags); | 309 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
310 | } | 310 | } |
311 | 311 | ||
312 | /* | 312 | /* |
@@ -355,10 +355,10 @@ raw3215_tasklet(void *data) | |||
355 | unsigned long flags; | 355 | unsigned long flags; |
356 | 356 | ||
357 | raw = (struct raw3215_info *) data; | 357 | raw = (struct raw3215_info *) data; |
358 | spin_lock_irqsave(raw->lock, flags); | 358 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
359 | raw3215_mk_write_req(raw); | 359 | raw3215_mk_write_req(raw); |
360 | raw3215_try_io(raw); | 360 | raw3215_try_io(raw); |
361 | spin_unlock_irqrestore(raw->lock, flags); | 361 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
362 | /* Check for pending message from raw3215_irq */ | 362 | /* Check for pending message from raw3215_irq */ |
363 | if (raw->message != NULL) { | 363 | if (raw->message != NULL) { |
364 | printk(raw->message, raw->msg_dstat, raw->msg_cstat); | 364 | printk(raw->message, raw->msg_dstat, raw->msg_cstat); |
@@ -512,9 +512,9 @@ raw3215_make_room(struct raw3215_info *raw, unsigned int length) | |||
512 | if (RAW3215_BUFFER_SIZE - raw->count >= length) | 512 | if (RAW3215_BUFFER_SIZE - raw->count >= length) |
513 | break; | 513 | break; |
514 | /* there might be another cpu waiting for the lock */ | 514 | /* there might be another cpu waiting for the lock */ |
515 | spin_unlock(raw->lock); | 515 | spin_unlock(get_ccwdev_lock(raw->cdev)); |
516 | udelay(100); | 516 | udelay(100); |
517 | spin_lock(raw->lock); | 517 | spin_lock(get_ccwdev_lock(raw->cdev)); |
518 | } | 518 | } |
519 | } | 519 | } |
520 | 520 | ||
@@ -528,7 +528,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length) | |||
528 | int c, count; | 528 | int c, count; |
529 | 529 | ||
530 | while (length > 0) { | 530 | while (length > 0) { |
531 | spin_lock_irqsave(raw->lock, flags); | 531 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
532 | count = (length > RAW3215_BUFFER_SIZE) ? | 532 | count = (length > RAW3215_BUFFER_SIZE) ? |
533 | RAW3215_BUFFER_SIZE : length; | 533 | RAW3215_BUFFER_SIZE : length; |
534 | length -= count; | 534 | length -= count; |
@@ -555,7 +555,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length) | |||
555 | /* start or queue request */ | 555 | /* start or queue request */ |
556 | raw3215_try_io(raw); | 556 | raw3215_try_io(raw); |
557 | } | 557 | } |
558 | spin_unlock_irqrestore(raw->lock, flags); | 558 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
559 | } | 559 | } |
560 | } | 560 | } |
561 | 561 | ||
@@ -568,7 +568,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch) | |||
568 | unsigned long flags; | 568 | unsigned long flags; |
569 | unsigned int length, i; | 569 | unsigned int length, i; |
570 | 570 | ||
571 | spin_lock_irqsave(raw->lock, flags); | 571 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
572 | if (ch == '\t') { | 572 | if (ch == '\t') { |
573 | length = TAB_STOP_SIZE - (raw->line_pos%TAB_STOP_SIZE); | 573 | length = TAB_STOP_SIZE - (raw->line_pos%TAB_STOP_SIZE); |
574 | raw->line_pos += length; | 574 | raw->line_pos += length; |
@@ -592,7 +592,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch) | |||
592 | /* start or queue request */ | 592 | /* start or queue request */ |
593 | raw3215_try_io(raw); | 593 | raw3215_try_io(raw); |
594 | } | 594 | } |
595 | spin_unlock_irqrestore(raw->lock, flags); | 595 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
596 | } | 596 | } |
597 | 597 | ||
598 | /* | 598 | /* |
@@ -604,13 +604,13 @@ raw3215_flush_buffer(struct raw3215_info *raw) | |||
604 | { | 604 | { |
605 | unsigned long flags; | 605 | unsigned long flags; |
606 | 606 | ||
607 | spin_lock_irqsave(raw->lock, flags); | 607 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
608 | if (raw->count > 0) { | 608 | if (raw->count > 0) { |
609 | raw->flags |= RAW3215_FLUSHING; | 609 | raw->flags |= RAW3215_FLUSHING; |
610 | raw3215_try_io(raw); | 610 | raw3215_try_io(raw); |
611 | raw->flags &= ~RAW3215_FLUSHING; | 611 | raw->flags &= ~RAW3215_FLUSHING; |
612 | } | 612 | } |
613 | spin_unlock_irqrestore(raw->lock, flags); | 613 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
614 | } | 614 | } |
615 | 615 | ||
616 | /* | 616 | /* |
@@ -625,9 +625,9 @@ raw3215_startup(struct raw3215_info *raw) | |||
625 | return 0; | 625 | return 0; |
626 | raw->line_pos = 0; | 626 | raw->line_pos = 0; |
627 | raw->flags |= RAW3215_ACTIVE; | 627 | raw->flags |= RAW3215_ACTIVE; |
628 | spin_lock_irqsave(raw->lock, flags); | 628 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
629 | raw3215_try_io(raw); | 629 | raw3215_try_io(raw); |
630 | spin_unlock_irqrestore(raw->lock, flags); | 630 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
631 | 631 | ||
632 | return 0; | 632 | return 0; |
633 | } | 633 | } |
@@ -644,21 +644,21 @@ raw3215_shutdown(struct raw3215_info *raw) | |||
644 | if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED)) | 644 | if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED)) |
645 | return; | 645 | return; |
646 | /* Wait for outstanding requests, then free irq */ | 646 | /* Wait for outstanding requests, then free irq */ |
647 | spin_lock_irqsave(raw->lock, flags); | 647 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
648 | if ((raw->flags & RAW3215_WORKING) || | 648 | if ((raw->flags & RAW3215_WORKING) || |
649 | raw->queued_write != NULL || | 649 | raw->queued_write != NULL || |
650 | raw->queued_read != NULL) { | 650 | raw->queued_read != NULL) { |
651 | raw->flags |= RAW3215_CLOSING; | 651 | raw->flags |= RAW3215_CLOSING; |
652 | add_wait_queue(&raw->empty_wait, &wait); | 652 | add_wait_queue(&raw->empty_wait, &wait); |
653 | set_current_state(TASK_INTERRUPTIBLE); | 653 | set_current_state(TASK_INTERRUPTIBLE); |
654 | spin_unlock_irqrestore(raw->lock, flags); | 654 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
655 | schedule(); | 655 | schedule(); |
656 | spin_lock_irqsave(raw->lock, flags); | 656 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
657 | remove_wait_queue(&raw->empty_wait, &wait); | 657 | remove_wait_queue(&raw->empty_wait, &wait); |
658 | set_current_state(TASK_RUNNING); | 658 | set_current_state(TASK_RUNNING); |
659 | raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING); | 659 | raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING); |
660 | } | 660 | } |
661 | spin_unlock_irqrestore(raw->lock, flags); | 661 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
662 | } | 662 | } |
663 | 663 | ||
664 | static int | 664 | static int |
@@ -686,7 +686,6 @@ raw3215_probe (struct ccw_device *cdev) | |||
686 | } | 686 | } |
687 | 687 | ||
688 | raw->cdev = cdev; | 688 | raw->cdev = cdev; |
689 | raw->lock = get_ccwdev_lock(cdev); | ||
690 | raw->inbuf = (char *) raw + sizeof(struct raw3215_info); | 689 | raw->inbuf = (char *) raw + sizeof(struct raw3215_info); |
691 | memset(raw, 0, sizeof(struct raw3215_info)); | 690 | memset(raw, 0, sizeof(struct raw3215_info)); |
692 | raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE, | 691 | raw->buffer = (char *) kmalloc(RAW3215_BUFFER_SIZE, |
@@ -809,9 +808,9 @@ con3215_unblank(void) | |||
809 | unsigned long flags; | 808 | unsigned long flags; |
810 | 809 | ||
811 | raw = raw3215[0]; /* console 3215 is the first one */ | 810 | raw = raw3215[0]; /* console 3215 is the first one */ |
812 | spin_lock_irqsave(raw->lock, flags); | 811 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
813 | raw3215_make_room(raw, RAW3215_BUFFER_SIZE); | 812 | raw3215_make_room(raw, RAW3215_BUFFER_SIZE); |
814 | spin_unlock_irqrestore(raw->lock, flags); | 813 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
815 | } | 814 | } |
816 | 815 | ||
817 | static int __init | 816 | static int __init |
@@ -873,7 +872,6 @@ con3215_init(void) | |||
873 | raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE); | 872 | raw->buffer = (char *) alloc_bootmem_low(RAW3215_BUFFER_SIZE); |
874 | raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE); | 873 | raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE); |
875 | raw->cdev = cdev; | 874 | raw->cdev = cdev; |
876 | raw->lock = get_ccwdev_lock(cdev); | ||
877 | cdev->dev.driver_data = raw; | 875 | cdev->dev.driver_data = raw; |
878 | cdev->handler = raw3215_irq; | 876 | cdev->handler = raw3215_irq; |
879 | 877 | ||
@@ -1066,10 +1064,10 @@ tty3215_unthrottle(struct tty_struct * tty) | |||
1066 | 1064 | ||
1067 | raw = (struct raw3215_info *) tty->driver_data; | 1065 | raw = (struct raw3215_info *) tty->driver_data; |
1068 | if (raw->flags & RAW3215_THROTTLED) { | 1066 | if (raw->flags & RAW3215_THROTTLED) { |
1069 | spin_lock_irqsave(raw->lock, flags); | 1067 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
1070 | raw->flags &= ~RAW3215_THROTTLED; | 1068 | raw->flags &= ~RAW3215_THROTTLED; |
1071 | raw3215_try_io(raw); | 1069 | raw3215_try_io(raw); |
1072 | spin_unlock_irqrestore(raw->lock, flags); | 1070 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
1073 | } | 1071 | } |
1074 | } | 1072 | } |
1075 | 1073 | ||
@@ -1096,10 +1094,10 @@ tty3215_start(struct tty_struct *tty) | |||
1096 | 1094 | ||
1097 | raw = (struct raw3215_info *) tty->driver_data; | 1095 | raw = (struct raw3215_info *) tty->driver_data; |
1098 | if (raw->flags & RAW3215_STOPPED) { | 1096 | if (raw->flags & RAW3215_STOPPED) { |
1099 | spin_lock_irqsave(raw->lock, flags); | 1097 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
1100 | raw->flags &= ~RAW3215_STOPPED; | 1098 | raw->flags &= ~RAW3215_STOPPED; |
1101 | raw3215_try_io(raw); | 1099 | raw3215_try_io(raw); |
1102 | spin_unlock_irqrestore(raw->lock, flags); | 1100 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
1103 | } | 1101 | } |
1104 | } | 1102 | } |
1105 | 1103 | ||
diff --git a/drivers/s390/char/sclp_quiesce.c b/drivers/s390/char/sclp_quiesce.c index 32004aae95c1..ffa9282ce97a 100644 --- a/drivers/s390/char/sclp_quiesce.c +++ b/drivers/s390/char/sclp_quiesce.c | |||
@@ -19,52 +19,17 @@ | |||
19 | 19 | ||
20 | #include "sclp.h" | 20 | #include "sclp.h" |
21 | 21 | ||
22 | |||
23 | #ifdef CONFIG_SMP | ||
24 | /* Signal completion of shutdown process. All CPUs except the first to enter | ||
25 | * this function: go to stopped state. First CPU: wait until all other | ||
26 | * CPUs are in stopped or check stop state. Afterwards, load special PSW | ||
27 | * to indicate completion. */ | ||
28 | static void | ||
29 | do_load_quiesce_psw(void * __unused) | ||
30 | { | ||
31 | static atomic_t cpuid = ATOMIC_INIT(-1); | ||
32 | psw_t quiesce_psw; | ||
33 | int cpu; | ||
34 | |||
35 | if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1) | ||
36 | signal_processor(smp_processor_id(), sigp_stop); | ||
37 | /* Wait for all other cpus to enter stopped state */ | ||
38 | for_each_online_cpu(cpu) { | ||
39 | if (cpu == smp_processor_id()) | ||
40 | continue; | ||
41 | while(!smp_cpu_not_running(cpu)) | ||
42 | cpu_relax(); | ||
43 | } | ||
44 | /* Quiesce the last cpu with the special psw */ | ||
45 | quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT; | ||
46 | quiesce_psw.addr = 0xfff; | ||
47 | __load_psw(quiesce_psw); | ||
48 | } | ||
49 | |||
50 | /* Shutdown handler. Perform shutdown function on all CPUs. */ | ||
51 | static void | ||
52 | do_machine_quiesce(void) | ||
53 | { | ||
54 | on_each_cpu(do_load_quiesce_psw, NULL, 0, 0); | ||
55 | } | ||
56 | #else | ||
57 | /* Shutdown handler. Signal completion of shutdown by loading special PSW. */ | 22 | /* Shutdown handler. Signal completion of shutdown by loading special PSW. */ |
58 | static void | 23 | static void |
59 | do_machine_quiesce(void) | 24 | do_machine_quiesce(void) |
60 | { | 25 | { |
61 | psw_t quiesce_psw; | 26 | psw_t quiesce_psw; |
62 | 27 | ||
28 | smp_send_stop(); | ||
63 | quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT; | 29 | quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT; |
64 | quiesce_psw.addr = 0xfff; | 30 | quiesce_psw.addr = 0xfff; |
65 | __load_psw(quiesce_psw); | 31 | __load_psw(quiesce_psw); |
66 | } | 32 | } |
67 | #endif | ||
68 | 33 | ||
69 | /* Handler for quiesce event. Start shutdown procedure. */ | 34 | /* Handler for quiesce event. Start shutdown procedure. */ |
70 | static void | 35 | static void |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 2d78f0f4a40f..dbfb77b03928 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -251,6 +251,8 @@ s390_subchannel_remove_chpid(struct device *dev, void *data) | |||
251 | cc = cio_clear(sch); | 251 | cc = cio_clear(sch); |
252 | if (cc == -ENODEV) | 252 | if (cc == -ENODEV) |
253 | goto out_unreg; | 253 | goto out_unreg; |
254 | /* Request retry of internal operation. */ | ||
255 | device_set_intretry(sch); | ||
254 | /* Call handler. */ | 256 | /* Call handler. */ |
255 | if (sch->driver && sch->driver->termination) | 257 | if (sch->driver && sch->driver->termination) |
256 | sch->driver->termination(&sch->dev); | 258 | sch->driver->termination(&sch->dev); |
@@ -711,9 +713,6 @@ static inline int check_for_io_on_path(struct subchannel *sch, int index) | |||
711 | { | 713 | { |
712 | int cc; | 714 | int cc; |
713 | 715 | ||
714 | if (!device_is_online(sch)) | ||
715 | /* cio could be doing I/O. */ | ||
716 | return 0; | ||
717 | cc = stsch(sch->schid, &sch->schib); | 716 | cc = stsch(sch->schid, &sch->schib); |
718 | if (cc) | 717 | if (cc) |
719 | return 0; | 718 | return 0; |
@@ -722,6 +721,26 @@ static inline int check_for_io_on_path(struct subchannel *sch, int index) | |||
722 | return 0; | 721 | return 0; |
723 | } | 722 | } |
724 | 723 | ||
724 | static void terminate_internal_io(struct subchannel *sch) | ||
725 | { | ||
726 | if (cio_clear(sch)) { | ||
727 | /* Recheck device in case clear failed. */ | ||
728 | sch->lpm = 0; | ||
729 | if (device_trigger_verify(sch) != 0) { | ||
730 | if(css_enqueue_subchannel_slow(sch->schid)) { | ||
731 | css_clear_subchannel_slow_list(); | ||
732 | need_rescan = 1; | ||
733 | } | ||
734 | } | ||
735 | return; | ||
736 | } | ||
737 | /* Request retry of internal operation. */ | ||
738 | device_set_intretry(sch); | ||
739 | /* Call handler. */ | ||
740 | if (sch->driver && sch->driver->termination) | ||
741 | sch->driver->termination(&sch->dev); | ||
742 | } | ||
743 | |||
725 | static inline void | 744 | static inline void |
726 | __s390_subchannel_vary_chpid(struct subchannel *sch, __u8 chpid, int on) | 745 | __s390_subchannel_vary_chpid(struct subchannel *sch, __u8 chpid, int on) |
727 | { | 746 | { |
@@ -744,20 +763,26 @@ __s390_subchannel_vary_chpid(struct subchannel *sch, __u8 chpid, int on) | |||
744 | device_trigger_reprobe(sch); | 763 | device_trigger_reprobe(sch); |
745 | else if (sch->driver && sch->driver->verify) | 764 | else if (sch->driver && sch->driver->verify) |
746 | sch->driver->verify(&sch->dev); | 765 | sch->driver->verify(&sch->dev); |
747 | } else { | 766 | break; |
748 | sch->opm &= ~(0x80 >> chp); | 767 | } |
749 | sch->lpm &= ~(0x80 >> chp); | 768 | sch->opm &= ~(0x80 >> chp); |
750 | if (check_for_io_on_path(sch, chp)) | 769 | sch->lpm &= ~(0x80 >> chp); |
770 | if (check_for_io_on_path(sch, chp)) { | ||
771 | if (device_is_online(sch)) | ||
751 | /* Path verification is done after killing. */ | 772 | /* Path verification is done after killing. */ |
752 | device_kill_io(sch); | 773 | device_kill_io(sch); |
753 | else if (!sch->lpm) { | 774 | else |
775 | /* Kill and retry internal I/O. */ | ||
776 | terminate_internal_io(sch); | ||
777 | } else if (!sch->lpm) { | ||
778 | if (device_trigger_verify(sch) != 0) { | ||
754 | if (css_enqueue_subchannel_slow(sch->schid)) { | 779 | if (css_enqueue_subchannel_slow(sch->schid)) { |
755 | css_clear_subchannel_slow_list(); | 780 | css_clear_subchannel_slow_list(); |
756 | need_rescan = 1; | 781 | need_rescan = 1; |
757 | } | 782 | } |
758 | } else if (sch->driver && sch->driver->verify) | 783 | } |
759 | sch->driver->verify(&sch->dev); | 784 | } else if (sch->driver && sch->driver->verify) |
760 | } | 785 | sch->driver->verify(&sch->dev); |
761 | break; | 786 | break; |
762 | } | 787 | } |
763 | spin_unlock_irqrestore(&sch->lock, flags); | 788 | spin_unlock_irqrestore(&sch->lock, flags); |
@@ -1465,41 +1490,6 @@ chsc_get_chp_desc(struct subchannel *sch, int chp_no) | |||
1465 | return desc; | 1490 | return desc; |
1466 | } | 1491 | } |
1467 | 1492 | ||
1468 | static int reset_channel_path(struct channel_path *chp) | ||
1469 | { | ||
1470 | int cc; | ||
1471 | |||
1472 | cc = rchp(chp->id); | ||
1473 | switch (cc) { | ||
1474 | case 0: | ||
1475 | return 0; | ||
1476 | case 2: | ||
1477 | return -EBUSY; | ||
1478 | default: | ||
1479 | return -ENODEV; | ||
1480 | } | ||
1481 | } | ||
1482 | |||
1483 | static void reset_channel_paths_css(struct channel_subsystem *css) | ||
1484 | { | ||
1485 | int i; | ||
1486 | |||
1487 | for (i = 0; i <= __MAX_CHPID; i++) { | ||
1488 | if (css->chps[i]) | ||
1489 | reset_channel_path(css->chps[i]); | ||
1490 | } | ||
1491 | } | ||
1492 | |||
1493 | void cio_reset_channel_paths(void) | ||
1494 | { | ||
1495 | int i; | ||
1496 | |||
1497 | for (i = 0; i <= __MAX_CSSID; i++) { | ||
1498 | if (css[i] && css[i]->valid) | ||
1499 | reset_channel_paths_css(css[i]); | ||
1500 | } | ||
1501 | } | ||
1502 | |||
1503 | static int __init | 1493 | static int __init |
1504 | chsc_alloc_sei_area(void) | 1494 | chsc_alloc_sei_area(void) |
1505 | { | 1495 | { |
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 8936e460a807..20aee2783847 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | #include <asm/irq_regs.h> | 22 | #include <asm/irq_regs.h> |
23 | #include <asm/setup.h> | 23 | #include <asm/setup.h> |
24 | #include <asm/reset.h> | ||
24 | #include "airq.h" | 25 | #include "airq.h" |
25 | #include "cio.h" | 26 | #include "cio.h" |
26 | #include "css.h" | 27 | #include "css.h" |
@@ -28,6 +29,7 @@ | |||
28 | #include "ioasm.h" | 29 | #include "ioasm.h" |
29 | #include "blacklist.h" | 30 | #include "blacklist.h" |
30 | #include "cio_debug.h" | 31 | #include "cio_debug.h" |
32 | #include "../s390mach.h" | ||
31 | 33 | ||
32 | debug_info_t *cio_debug_msg_id; | 34 | debug_info_t *cio_debug_msg_id; |
33 | debug_info_t *cio_debug_trace_id; | 35 | debug_info_t *cio_debug_trace_id; |
@@ -841,26 +843,12 @@ __clear_subchannel_easy(struct subchannel_id schid) | |||
841 | return -EBUSY; | 843 | return -EBUSY; |
842 | } | 844 | } |
843 | 845 | ||
844 | struct sch_match_id { | 846 | static int __shutdown_subchannel_easy(struct subchannel_id schid, void *data) |
845 | struct subchannel_id schid; | ||
846 | struct ccw_dev_id devid; | ||
847 | int rc; | ||
848 | }; | ||
849 | |||
850 | static int __shutdown_subchannel_easy_and_match(struct subchannel_id schid, | ||
851 | void *data) | ||
852 | { | 847 | { |
853 | struct schib schib; | 848 | struct schib schib; |
854 | struct sch_match_id *match_id = data; | ||
855 | 849 | ||
856 | if (stsch_err(schid, &schib)) | 850 | if (stsch_err(schid, &schib)) |
857 | return -ENXIO; | 851 | return -ENXIO; |
858 | if (match_id && schib.pmcw.dnv && | ||
859 | (schib.pmcw.dev == match_id->devid.devno) && | ||
860 | (schid.ssid == match_id->devid.ssid)) { | ||
861 | match_id->schid = schid; | ||
862 | match_id->rc = 0; | ||
863 | } | ||
864 | if (!schib.pmcw.ena) | 852 | if (!schib.pmcw.ena) |
865 | return 0; | 853 | return 0; |
866 | switch(__disable_subchannel_easy(schid, &schib)) { | 854 | switch(__disable_subchannel_easy(schid, &schib)) { |
@@ -876,27 +864,111 @@ static int __shutdown_subchannel_easy_and_match(struct subchannel_id schid, | |||
876 | return 0; | 864 | return 0; |
877 | } | 865 | } |
878 | 866 | ||
879 | static int clear_all_subchannels_and_match(struct ccw_dev_id *devid, | 867 | static atomic_t chpid_reset_count; |
880 | struct subchannel_id *schid) | 868 | |
869 | static void s390_reset_chpids_mcck_handler(void) | ||
870 | { | ||
871 | struct crw crw; | ||
872 | struct mci *mci; | ||
873 | |||
874 | /* Check for pending channel report word. */ | ||
875 | mci = (struct mci *)&S390_lowcore.mcck_interruption_code; | ||
876 | if (!mci->cp) | ||
877 | return; | ||
878 | /* Process channel report words. */ | ||
879 | while (stcrw(&crw) == 0) { | ||
880 | /* Check for responses to RCHP. */ | ||
881 | if (crw.slct && crw.rsc == CRW_RSC_CPATH) | ||
882 | atomic_dec(&chpid_reset_count); | ||
883 | } | ||
884 | } | ||
885 | |||
886 | #define RCHP_TIMEOUT (30 * USEC_PER_SEC) | ||
887 | static void css_reset(void) | ||
888 | { | ||
889 | int i, ret; | ||
890 | unsigned long long timeout; | ||
891 | |||
892 | /* Reset subchannels. */ | ||
893 | for_each_subchannel(__shutdown_subchannel_easy, NULL); | ||
894 | /* Reset channel paths. */ | ||
895 | s390_reset_mcck_handler = s390_reset_chpids_mcck_handler; | ||
896 | /* Enable channel report machine checks. */ | ||
897 | __ctl_set_bit(14, 28); | ||
898 | /* Temporarily reenable machine checks. */ | ||
899 | local_mcck_enable(); | ||
900 | for (i = 0; i <= __MAX_CHPID; i++) { | ||
901 | ret = rchp(i); | ||
902 | if ((ret == 0) || (ret == 2)) | ||
903 | /* | ||
904 | * rchp either succeeded, or another rchp is already | ||
905 | * in progress. In either case, we'll get a crw. | ||
906 | */ | ||
907 | atomic_inc(&chpid_reset_count); | ||
908 | } | ||
909 | /* Wait for machine check for all channel paths. */ | ||
910 | timeout = get_clock() + (RCHP_TIMEOUT << 12); | ||
911 | while (atomic_read(&chpid_reset_count) != 0) { | ||
912 | if (get_clock() > timeout) | ||
913 | break; | ||
914 | cpu_relax(); | ||
915 | } | ||
916 | /* Disable machine checks again. */ | ||
917 | local_mcck_disable(); | ||
918 | /* Disable channel report machine checks. */ | ||
919 | __ctl_clear_bit(14, 28); | ||
920 | s390_reset_mcck_handler = NULL; | ||
921 | } | ||
922 | |||
923 | static struct reset_call css_reset_call = { | ||
924 | .fn = css_reset, | ||
925 | }; | ||
926 | |||
927 | static int __init init_css_reset_call(void) | ||
928 | { | ||
929 | atomic_set(&chpid_reset_count, 0); | ||
930 | register_reset_call(&css_reset_call); | ||
931 | return 0; | ||
932 | } | ||
933 | |||
934 | arch_initcall(init_css_reset_call); | ||
935 | |||
936 | struct sch_match_id { | ||
937 | struct subchannel_id schid; | ||
938 | struct ccw_dev_id devid; | ||
939 | int rc; | ||
940 | }; | ||
941 | |||
942 | static int __reipl_subchannel_match(struct subchannel_id schid, void *data) | ||
943 | { | ||
944 | struct schib schib; | ||
945 | struct sch_match_id *match_id = data; | ||
946 | |||
947 | if (stsch_err(schid, &schib)) | ||
948 | return -ENXIO; | ||
949 | if (schib.pmcw.dnv && | ||
950 | (schib.pmcw.dev == match_id->devid.devno) && | ||
951 | (schid.ssid == match_id->devid.ssid)) { | ||
952 | match_id->schid = schid; | ||
953 | match_id->rc = 0; | ||
954 | return 1; | ||
955 | } | ||
956 | return 0; | ||
957 | } | ||
958 | |||
959 | static int reipl_find_schid(struct ccw_dev_id *devid, | ||
960 | struct subchannel_id *schid) | ||
881 | { | 961 | { |
882 | struct sch_match_id match_id; | 962 | struct sch_match_id match_id; |
883 | 963 | ||
884 | match_id.devid = *devid; | 964 | match_id.devid = *devid; |
885 | match_id.rc = -ENODEV; | 965 | match_id.rc = -ENODEV; |
886 | local_irq_disable(); | 966 | for_each_subchannel(__reipl_subchannel_match, &match_id); |
887 | for_each_subchannel(__shutdown_subchannel_easy_and_match, &match_id); | ||
888 | if (match_id.rc == 0) | 967 | if (match_id.rc == 0) |
889 | *schid = match_id.schid; | 968 | *schid = match_id.schid; |
890 | return match_id.rc; | 969 | return match_id.rc; |
891 | } | 970 | } |
892 | 971 | ||
893 | |||
894 | void clear_all_subchannels(void) | ||
895 | { | ||
896 | local_irq_disable(); | ||
897 | for_each_subchannel(__shutdown_subchannel_easy_and_match, NULL); | ||
898 | } | ||
899 | |||
900 | extern void do_reipl_asm(__u32 schid); | 972 | extern void do_reipl_asm(__u32 schid); |
901 | 973 | ||
902 | /* Make sure all subchannels are quiet before we re-ipl an lpar. */ | 974 | /* Make sure all subchannels are quiet before we re-ipl an lpar. */ |
@@ -904,9 +976,9 @@ void reipl_ccw_dev(struct ccw_dev_id *devid) | |||
904 | { | 976 | { |
905 | struct subchannel_id schid; | 977 | struct subchannel_id schid; |
906 | 978 | ||
907 | if (clear_all_subchannels_and_match(devid, &schid)) | 979 | s390_reset_system(); |
980 | if (reipl_find_schid(devid, &schid) != 0) | ||
908 | panic("IPL Device not found\n"); | 981 | panic("IPL Device not found\n"); |
909 | cio_reset_channel_paths(); | ||
910 | do_reipl_asm(*((__u32*)&schid)); | 982 | do_reipl_asm(*((__u32*)&schid)); |
911 | } | 983 | } |
912 | 984 | ||
diff --git a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h index 4c2ff8336288..9ff064e71767 100644 --- a/drivers/s390/cio/css.h +++ b/drivers/s390/cio/css.h | |||
@@ -94,6 +94,7 @@ struct ccw_device_private { | |||
94 | unsigned int donotify:1; /* call notify function */ | 94 | unsigned int donotify:1; /* call notify function */ |
95 | unsigned int recog_done:1; /* dev. recog. complete */ | 95 | unsigned int recog_done:1; /* dev. recog. complete */ |
96 | unsigned int fake_irb:1; /* deliver faked irb */ | 96 | unsigned int fake_irb:1; /* deliver faked irb */ |
97 | unsigned int intretry:1; /* retry internal operation */ | ||
97 | } __attribute__((packed)) flags; | 98 | } __attribute__((packed)) flags; |
98 | unsigned long intparm; /* user interruption parameter */ | 99 | unsigned long intparm; /* user interruption parameter */ |
99 | struct qdio_irq *qdio_data; | 100 | struct qdio_irq *qdio_data; |
@@ -171,6 +172,8 @@ void device_trigger_reprobe(struct subchannel *); | |||
171 | /* Helper functions for vary on/off. */ | 172 | /* Helper functions for vary on/off. */ |
172 | int device_is_online(struct subchannel *); | 173 | int device_is_online(struct subchannel *); |
173 | void device_kill_io(struct subchannel *); | 174 | void device_kill_io(struct subchannel *); |
175 | void device_set_intretry(struct subchannel *sch); | ||
176 | int device_trigger_verify(struct subchannel *sch); | ||
174 | 177 | ||
175 | /* Machine check helper function. */ | 178 | /* Machine check helper function. */ |
176 | void device_kill_pending_timer(struct subchannel *); | 179 | void device_kill_pending_timer(struct subchannel *); |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 39c98f940507..d3d3716ff84b 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -687,8 +687,20 @@ io_subchannel_register(void *data) | |||
687 | cdev = data; | 687 | cdev = data; |
688 | sch = to_subchannel(cdev->dev.parent); | 688 | sch = to_subchannel(cdev->dev.parent); |
689 | 689 | ||
690 | /* | ||
691 | * io_subchannel_register() will also be called after device | ||
692 | * recognition has been done for a boxed device (which will already | ||
693 | * be registered). We need to reprobe since we may now have sense id | ||
694 | * information. | ||
695 | */ | ||
690 | if (klist_node_attached(&cdev->dev.knode_parent)) { | 696 | if (klist_node_attached(&cdev->dev.knode_parent)) { |
691 | bus_rescan_devices(&ccw_bus_type); | 697 | if (!cdev->drv) { |
698 | ret = device_reprobe(&cdev->dev); | ||
699 | if (ret) | ||
700 | /* We can't do much here. */ | ||
701 | dev_info(&cdev->dev, "device_reprobe() returned" | ||
702 | " %d\n", ret); | ||
703 | } | ||
692 | goto out; | 704 | goto out; |
693 | } | 705 | } |
694 | /* make it known to the system */ | 706 | /* make it known to the system */ |
@@ -948,6 +960,9 @@ io_subchannel_ioterm(struct device *dev) | |||
948 | cdev = dev->driver_data; | 960 | cdev = dev->driver_data; |
949 | if (!cdev) | 961 | if (!cdev) |
950 | return; | 962 | return; |
963 | /* Internal I/O will be retried by the interrupt handler. */ | ||
964 | if (cdev->private->flags.intretry) | ||
965 | return; | ||
951 | cdev->private->state = DEV_STATE_CLEAR_VERIFY; | 966 | cdev->private->state = DEV_STATE_CLEAR_VERIFY; |
952 | if (cdev->handler) | 967 | if (cdev->handler) |
953 | cdev->handler(cdev, cdev->private->intparm, | 968 | cdev->handler(cdev, cdev->private->intparm, |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index de3d0857db9f..09c7672eb3f3 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -59,6 +59,27 @@ device_set_disconnected(struct subchannel *sch) | |||
59 | cdev->private->state = DEV_STATE_DISCONNECTED; | 59 | cdev->private->state = DEV_STATE_DISCONNECTED; |
60 | } | 60 | } |
61 | 61 | ||
62 | void device_set_intretry(struct subchannel *sch) | ||
63 | { | ||
64 | struct ccw_device *cdev; | ||
65 | |||
66 | cdev = sch->dev.driver_data; | ||
67 | if (!cdev) | ||
68 | return; | ||
69 | cdev->private->flags.intretry = 1; | ||
70 | } | ||
71 | |||
72 | int device_trigger_verify(struct subchannel *sch) | ||
73 | { | ||
74 | struct ccw_device *cdev; | ||
75 | |||
76 | cdev = sch->dev.driver_data; | ||
77 | if (!cdev || !cdev->online) | ||
78 | return -EINVAL; | ||
79 | dev_fsm_event(cdev, DEV_EVENT_VERIFY); | ||
80 | return 0; | ||
81 | } | ||
82 | |||
62 | /* | 83 | /* |
63 | * Timeout function. It just triggers a DEV_EVENT_TIMEOUT. | 84 | * Timeout function. It just triggers a DEV_EVENT_TIMEOUT. |
64 | */ | 85 | */ |
@@ -893,6 +914,12 @@ ccw_device_w4sense(struct ccw_device *cdev, enum dev_event dev_event) | |||
893 | * had killed the original request. | 914 | * had killed the original request. |
894 | */ | 915 | */ |
895 | if (irb->scsw.fctl & (SCSW_FCTL_CLEAR_FUNC | SCSW_FCTL_HALT_FUNC)) { | 916 | if (irb->scsw.fctl & (SCSW_FCTL_CLEAR_FUNC | SCSW_FCTL_HALT_FUNC)) { |
917 | /* Retry Basic Sense if requested. */ | ||
918 | if (cdev->private->flags.intretry) { | ||
919 | cdev->private->flags.intretry = 0; | ||
920 | ccw_device_do_sense(cdev, irb); | ||
921 | return; | ||
922 | } | ||
896 | cdev->private->flags.dosense = 0; | 923 | cdev->private->flags.dosense = 0; |
897 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 924 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
898 | ccw_device_accumulate_irb(cdev, irb); | 925 | ccw_device_accumulate_irb(cdev, irb); |
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c index a74785b9e4eb..f17275917fe5 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c | |||
@@ -191,6 +191,8 @@ __ccw_device_sense_id_start(struct ccw_device *cdev) | |||
191 | if ((sch->opm & cdev->private->imask) != 0 && | 191 | if ((sch->opm & cdev->private->imask) != 0 && |
192 | cdev->private->iretry > 0) { | 192 | cdev->private->iretry > 0) { |
193 | cdev->private->iretry--; | 193 | cdev->private->iretry--; |
194 | /* Reset internal retry indication. */ | ||
195 | cdev->private->flags.intretry = 0; | ||
194 | ret = cio_start (sch, cdev->private->iccws, | 196 | ret = cio_start (sch, cdev->private->iccws, |
195 | cdev->private->imask); | 197 | cdev->private->imask); |
196 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ | 198 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ |
@@ -237,8 +239,14 @@ ccw_device_check_sense_id(struct ccw_device *cdev) | |||
237 | return 0; /* Success */ | 239 | return 0; /* Success */ |
238 | } | 240 | } |
239 | /* Check the error cases. */ | 241 | /* Check the error cases. */ |
240 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) | 242 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) { |
243 | /* Retry Sense ID if requested. */ | ||
244 | if (cdev->private->flags.intretry) { | ||
245 | cdev->private->flags.intretry = 0; | ||
246 | return -EAGAIN; | ||
247 | } | ||
241 | return -ETIME; | 248 | return -ETIME; |
249 | } | ||
242 | if (irb->esw.esw0.erw.cons && (irb->ecw[0] & SNS0_CMD_REJECT)) { | 250 | if (irb->esw.esw0.erw.cons && (irb->ecw[0] & SNS0_CMD_REJECT)) { |
243 | /* | 251 | /* |
244 | * if the device doesn't support the SenseID | 252 | * if the device doesn't support the SenseID |
diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c index 2975ce888c19..cb1879a96818 100644 --- a/drivers/s390/cio/device_pgid.c +++ b/drivers/s390/cio/device_pgid.c | |||
@@ -71,6 +71,8 @@ __ccw_device_sense_pgid_start(struct ccw_device *cdev) | |||
71 | ccw->cda = (__u32) __pa (&cdev->private->pgid[i]); | 71 | ccw->cda = (__u32) __pa (&cdev->private->pgid[i]); |
72 | if (cdev->private->iretry > 0) { | 72 | if (cdev->private->iretry > 0) { |
73 | cdev->private->iretry--; | 73 | cdev->private->iretry--; |
74 | /* Reset internal retry indication. */ | ||
75 | cdev->private->flags.intretry = 0; | ||
74 | ret = cio_start (sch, cdev->private->iccws, | 76 | ret = cio_start (sch, cdev->private->iccws, |
75 | cdev->private->imask); | 77 | cdev->private->imask); |
76 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ | 78 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ |
@@ -122,8 +124,14 @@ __ccw_device_check_sense_pgid(struct ccw_device *cdev) | |||
122 | 124 | ||
123 | sch = to_subchannel(cdev->dev.parent); | 125 | sch = to_subchannel(cdev->dev.parent); |
124 | irb = &cdev->private->irb; | 126 | irb = &cdev->private->irb; |
125 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) | 127 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) { |
128 | /* Retry Sense PGID if requested. */ | ||
129 | if (cdev->private->flags.intretry) { | ||
130 | cdev->private->flags.intretry = 0; | ||
131 | return -EAGAIN; | ||
132 | } | ||
126 | return -ETIME; | 133 | return -ETIME; |
134 | } | ||
127 | if (irb->esw.esw0.erw.cons && | 135 | if (irb->esw.esw0.erw.cons && |
128 | (irb->ecw[0]&(SNS0_CMD_REJECT|SNS0_INTERVENTION_REQ))) { | 136 | (irb->ecw[0]&(SNS0_CMD_REJECT|SNS0_INTERVENTION_REQ))) { |
129 | /* | 137 | /* |
@@ -253,6 +261,8 @@ __ccw_device_do_pgid(struct ccw_device *cdev, __u8 func) | |||
253 | ret = -EACCES; | 261 | ret = -EACCES; |
254 | if (cdev->private->iretry > 0) { | 262 | if (cdev->private->iretry > 0) { |
255 | cdev->private->iretry--; | 263 | cdev->private->iretry--; |
264 | /* Reset internal retry indication. */ | ||
265 | cdev->private->flags.intretry = 0; | ||
256 | ret = cio_start (sch, cdev->private->iccws, | 266 | ret = cio_start (sch, cdev->private->iccws, |
257 | cdev->private->imask); | 267 | cdev->private->imask); |
258 | /* We expect an interrupt in case of success or busy | 268 | /* We expect an interrupt in case of success or busy |
@@ -293,6 +303,8 @@ static int __ccw_device_do_nop(struct ccw_device *cdev) | |||
293 | ret = -EACCES; | 303 | ret = -EACCES; |
294 | if (cdev->private->iretry > 0) { | 304 | if (cdev->private->iretry > 0) { |
295 | cdev->private->iretry--; | 305 | cdev->private->iretry--; |
306 | /* Reset internal retry indication. */ | ||
307 | cdev->private->flags.intretry = 0; | ||
296 | ret = cio_start (sch, cdev->private->iccws, | 308 | ret = cio_start (sch, cdev->private->iccws, |
297 | cdev->private->imask); | 309 | cdev->private->imask); |
298 | /* We expect an interrupt in case of success or busy | 310 | /* We expect an interrupt in case of success or busy |
@@ -321,8 +333,14 @@ __ccw_device_check_pgid(struct ccw_device *cdev) | |||
321 | 333 | ||
322 | sch = to_subchannel(cdev->dev.parent); | 334 | sch = to_subchannel(cdev->dev.parent); |
323 | irb = &cdev->private->irb; | 335 | irb = &cdev->private->irb; |
324 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) | 336 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) { |
337 | /* Retry Set PGID if requested. */ | ||
338 | if (cdev->private->flags.intretry) { | ||
339 | cdev->private->flags.intretry = 0; | ||
340 | return -EAGAIN; | ||
341 | } | ||
325 | return -ETIME; | 342 | return -ETIME; |
343 | } | ||
326 | if (irb->esw.esw0.erw.cons) { | 344 | if (irb->esw.esw0.erw.cons) { |
327 | if (irb->ecw[0] & SNS0_CMD_REJECT) | 345 | if (irb->ecw[0] & SNS0_CMD_REJECT) |
328 | return -EOPNOTSUPP; | 346 | return -EOPNOTSUPP; |
@@ -360,8 +378,14 @@ static int __ccw_device_check_nop(struct ccw_device *cdev) | |||
360 | 378 | ||
361 | sch = to_subchannel(cdev->dev.parent); | 379 | sch = to_subchannel(cdev->dev.parent); |
362 | irb = &cdev->private->irb; | 380 | irb = &cdev->private->irb; |
363 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) | 381 | if (irb->scsw.fctl & (SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) { |
382 | /* Retry NOP if requested. */ | ||
383 | if (cdev->private->flags.intretry) { | ||
384 | cdev->private->flags.intretry = 0; | ||
385 | return -EAGAIN; | ||
386 | } | ||
364 | return -ETIME; | 387 | return -ETIME; |
388 | } | ||
365 | if (irb->scsw.cc == 3) { | 389 | if (irb->scsw.cc == 3) { |
366 | CIO_MSG_EVENT(2, "NOP - Device %04x on Subchannel 0.%x.%04x," | 390 | CIO_MSG_EVENT(2, "NOP - Device %04x on Subchannel 0.%x.%04x," |
367 | " lpm %02X, became 'not operational'\n", | 391 | " lpm %02X, became 'not operational'\n", |
diff --git a/drivers/s390/cio/device_status.c b/drivers/s390/cio/device_status.c index 3f7cbce4cd87..bdcf930f7beb 100644 --- a/drivers/s390/cio/device_status.c +++ b/drivers/s390/cio/device_status.c | |||
@@ -319,6 +319,9 @@ ccw_device_do_sense(struct ccw_device *cdev, struct irb *irb) | |||
319 | sch->sense_ccw.count = SENSE_MAX_COUNT; | 319 | sch->sense_ccw.count = SENSE_MAX_COUNT; |
320 | sch->sense_ccw.flags = CCW_FLAG_SLI; | 320 | sch->sense_ccw.flags = CCW_FLAG_SLI; |
321 | 321 | ||
322 | /* Reset internal retry indication. */ | ||
323 | cdev->private->flags.intretry = 0; | ||
324 | |||
322 | return cio_start (sch, &sch->sense_ccw, 0xff); | 325 | return cio_start (sch, &sch->sense_ccw, 0xff); |
323 | } | 326 | } |
324 | 327 | ||
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 476aa1da5cbc..8d5fa1b4d11f 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -481,7 +481,7 @@ qdio_stop_polling(struct qdio_q *q) | |||
481 | unsigned char state = 0; | 481 | unsigned char state = 0; |
482 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; | 482 | struct qdio_irq *irq = (struct qdio_irq *) q->irq_ptr; |
483 | 483 | ||
484 | if (!atomic_swap(&q->polling,0)) | 484 | if (!atomic_xchg(&q->polling,0)) |
485 | return 1; | 485 | return 1; |
486 | 486 | ||
487 | QDIO_DBF_TEXT4(0,trace,"stoppoll"); | 487 | QDIO_DBF_TEXT4(0,trace,"stoppoll"); |
@@ -1964,8 +1964,8 @@ qdio_irq_check_sense(struct subchannel_id schid, struct irb *irb) | |||
1964 | QDIO_DBF_HEX0(0,sense,irb,QDIO_DBF_SENSE_LEN); | 1964 | QDIO_DBF_HEX0(0,sense,irb,QDIO_DBF_SENSE_LEN); |
1965 | 1965 | ||
1966 | QDIO_PRINT_WARN("sense data available on qdio channel.\n"); | 1966 | QDIO_PRINT_WARN("sense data available on qdio channel.\n"); |
1967 | HEXDUMP16(WARN,"irb: ",irb); | 1967 | QDIO_HEXDUMP16(WARN,"irb: ",irb); |
1968 | HEXDUMP16(WARN,"sense data: ",irb->ecw); | 1968 | QDIO_HEXDUMP16(WARN,"sense data: ",irb->ecw); |
1969 | } | 1969 | } |
1970 | 1970 | ||
1971 | } | 1971 | } |
@@ -3425,7 +3425,7 @@ do_qdio_handle_inbound(struct qdio_q *q, unsigned int callflags, | |||
3425 | 3425 | ||
3426 | if ((used_elements+count==QDIO_MAX_BUFFERS_PER_Q)&& | 3426 | if ((used_elements+count==QDIO_MAX_BUFFERS_PER_Q)&& |
3427 | (callflags&QDIO_FLAG_UNDER_INTERRUPT)) | 3427 | (callflags&QDIO_FLAG_UNDER_INTERRUPT)) |
3428 | atomic_swap(&q->polling,0); | 3428 | atomic_xchg(&q->polling,0); |
3429 | 3429 | ||
3430 | if (used_elements) | 3430 | if (used_elements) |
3431 | return; | 3431 | return; |
diff --git a/drivers/s390/cio/qdio.h b/drivers/s390/cio/qdio.h index 49bb9e371c32..42927c1b7451 100644 --- a/drivers/s390/cio/qdio.h +++ b/drivers/s390/cio/qdio.h | |||
@@ -236,7 +236,7 @@ enum qdio_irq_states { | |||
236 | #define QDIO_PRINT_EMERG(x...) do { } while (0) | 236 | #define QDIO_PRINT_EMERG(x...) do { } while (0) |
237 | #endif | 237 | #endif |
238 | 238 | ||
239 | #define HEXDUMP16(importance,header,ptr) \ | 239 | #define QDIO_HEXDUMP16(importance,header,ptr) \ |
240 | QDIO_PRINT_##importance(header "%02x %02x %02x %02x " \ | 240 | QDIO_PRINT_##importance(header "%02x %02x %02x %02x " \ |
241 | "%02x %02x %02x %02x %02x %02x %02x %02x " \ | 241 | "%02x %02x %02x %02x %02x %02x %02x %02x " \ |
242 | "%02x %02x %02x %02x\n",*(((char*)ptr)), \ | 242 | "%02x %02x %02x %02x\n",*(((char*)ptr)), \ |
@@ -429,8 +429,6 @@ struct qdio_perf_stats { | |||
429 | }; | 429 | }; |
430 | #endif /* QDIO_PERFORMANCE_STATS */ | 430 | #endif /* QDIO_PERFORMANCE_STATS */ |
431 | 431 | ||
432 | #define atomic_swap(a,b) xchg((int*)a.counter,b) | ||
433 | |||
434 | /* unlikely as the later the better */ | 432 | /* unlikely as the later the better */ |
435 | #define SYNC_MEMORY if (unlikely(q->siga_sync)) qdio_siga_sync_q(q) | 433 | #define SYNC_MEMORY if (unlikely(q->siga_sync)) qdio_siga_sync_q(q) |
436 | #define SYNC_MEMORY_ALL if (unlikely(q->siga_sync)) \ | 434 | #define SYNC_MEMORY_ALL if (unlikely(q->siga_sync)) \ |
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index 79d89c368919..6a54334ffe09 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -431,7 +431,15 @@ static int ap_uevent (struct device *dev, char **envp, int num_envp, | |||
431 | ap_dev->device_type); | 431 | ap_dev->device_type); |
432 | if (buffer_size - length <= 0) | 432 | if (buffer_size - length <= 0) |
433 | return -ENOMEM; | 433 | return -ENOMEM; |
434 | envp[1] = 0; | 434 | buffer += length; |
435 | buffer_size -= length; | ||
436 | /* Add MODALIAS= */ | ||
437 | envp[1] = buffer; | ||
438 | length = scnprintf(buffer, buffer_size, "MODALIAS=ap:t%02X", | ||
439 | ap_dev->device_type); | ||
440 | if (buffer_size - length <= 0) | ||
441 | return -ENOMEM; | ||
442 | envp[2] = NULL; | ||
435 | return 0; | 443 | return 0; |
436 | } | 444 | } |
437 | 445 | ||
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 66a8aec6efa6..08d4e47070bd 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c | |||
@@ -54,6 +54,8 @@ | |||
54 | #error Cannot compile lcs.c without some net devices switched on. | 54 | #error Cannot compile lcs.c without some net devices switched on. |
55 | #endif | 55 | #endif |
56 | 56 | ||
57 | #define PRINTK_HEADER " lcs: " | ||
58 | |||
57 | /** | 59 | /** |
58 | * initialization string for output | 60 | * initialization string for output |
59 | */ | 61 | */ |
@@ -120,7 +122,7 @@ lcs_alloc_channel(struct lcs_channel *channel) | |||
120 | kzalloc(LCS_IOBUFFERSIZE, GFP_DMA | GFP_KERNEL); | 122 | kzalloc(LCS_IOBUFFERSIZE, GFP_DMA | GFP_KERNEL); |
121 | if (channel->iob[cnt].data == NULL) | 123 | if (channel->iob[cnt].data == NULL) |
122 | break; | 124 | break; |
123 | channel->iob[cnt].state = BUF_STATE_EMPTY; | 125 | channel->iob[cnt].state = LCS_BUF_STATE_EMPTY; |
124 | } | 126 | } |
125 | if (cnt < LCS_NUM_BUFFS) { | 127 | if (cnt < LCS_NUM_BUFFS) { |
126 | /* Not all io buffers could be allocated. */ | 128 | /* Not all io buffers could be allocated. */ |
@@ -236,7 +238,7 @@ lcs_setup_read_ccws(struct lcs_card *card) | |||
236 | ((struct lcs_header *) | 238 | ((struct lcs_header *) |
237 | card->read.iob[cnt].data)->offset = LCS_ILLEGAL_OFFSET; | 239 | card->read.iob[cnt].data)->offset = LCS_ILLEGAL_OFFSET; |
238 | card->read.iob[cnt].callback = lcs_get_frames_cb; | 240 | card->read.iob[cnt].callback = lcs_get_frames_cb; |
239 | card->read.iob[cnt].state = BUF_STATE_READY; | 241 | card->read.iob[cnt].state = LCS_BUF_STATE_READY; |
240 | card->read.iob[cnt].count = LCS_IOBUFFERSIZE; | 242 | card->read.iob[cnt].count = LCS_IOBUFFERSIZE; |
241 | } | 243 | } |
242 | card->read.ccws[0].flags &= ~CCW_FLAG_PCI; | 244 | card->read.ccws[0].flags &= ~CCW_FLAG_PCI; |
@@ -247,7 +249,7 @@ lcs_setup_read_ccws(struct lcs_card *card) | |||
247 | card->read.ccws[LCS_NUM_BUFFS].cda = | 249 | card->read.ccws[LCS_NUM_BUFFS].cda = |
248 | (__u32) __pa(card->read.ccws); | 250 | (__u32) __pa(card->read.ccws); |
249 | /* Setg initial state of the read channel. */ | 251 | /* Setg initial state of the read channel. */ |
250 | card->read.state = CH_STATE_INIT; | 252 | card->read.state = LCS_CH_STATE_INIT; |
251 | 253 | ||
252 | card->read.io_idx = 0; | 254 | card->read.io_idx = 0; |
253 | card->read.buf_idx = 0; | 255 | card->read.buf_idx = 0; |
@@ -294,7 +296,7 @@ lcs_setup_write_ccws(struct lcs_card *card) | |||
294 | card->write.ccws[LCS_NUM_BUFFS].cda = | 296 | card->write.ccws[LCS_NUM_BUFFS].cda = |
295 | (__u32) __pa(card->write.ccws); | 297 | (__u32) __pa(card->write.ccws); |
296 | /* Set initial state of the write channel. */ | 298 | /* Set initial state of the write channel. */ |
297 | card->read.state = CH_STATE_INIT; | 299 | card->read.state = LCS_CH_STATE_INIT; |
298 | 300 | ||
299 | card->write.io_idx = 0; | 301 | card->write.io_idx = 0; |
300 | card->write.buf_idx = 0; | 302 | card->write.buf_idx = 0; |
@@ -496,7 +498,7 @@ lcs_start_channel(struct lcs_channel *channel) | |||
496 | channel->ccws + channel->io_idx, 0, 0, | 498 | channel->ccws + channel->io_idx, 0, 0, |
497 | DOIO_DENY_PREFETCH | DOIO_ALLOW_SUSPEND); | 499 | DOIO_DENY_PREFETCH | DOIO_ALLOW_SUSPEND); |
498 | if (rc == 0) | 500 | if (rc == 0) |
499 | channel->state = CH_STATE_RUNNING; | 501 | channel->state = LCS_CH_STATE_RUNNING; |
500 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); | 502 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); |
501 | if (rc) { | 503 | if (rc) { |
502 | LCS_DBF_TEXT_(4,trace,"essh%s", channel->ccwdev->dev.bus_id); | 504 | LCS_DBF_TEXT_(4,trace,"essh%s", channel->ccwdev->dev.bus_id); |
@@ -520,8 +522,8 @@ lcs_clear_channel(struct lcs_channel *channel) | |||
520 | LCS_DBF_TEXT_(4,trace,"ecsc%s", channel->ccwdev->dev.bus_id); | 522 | LCS_DBF_TEXT_(4,trace,"ecsc%s", channel->ccwdev->dev.bus_id); |
521 | return rc; | 523 | return rc; |
522 | } | 524 | } |
523 | wait_event(channel->wait_q, (channel->state == CH_STATE_CLEARED)); | 525 | wait_event(channel->wait_q, (channel->state == LCS_CH_STATE_CLEARED)); |
524 | channel->state = CH_STATE_STOPPED; | 526 | channel->state = LCS_CH_STATE_STOPPED; |
525 | return rc; | 527 | return rc; |
526 | } | 528 | } |
527 | 529 | ||
@@ -535,11 +537,11 @@ lcs_stop_channel(struct lcs_channel *channel) | |||
535 | unsigned long flags; | 537 | unsigned long flags; |
536 | int rc; | 538 | int rc; |
537 | 539 | ||
538 | if (channel->state == CH_STATE_STOPPED) | 540 | if (channel->state == LCS_CH_STATE_STOPPED) |
539 | return 0; | 541 | return 0; |
540 | LCS_DBF_TEXT(4,trace,"haltsch"); | 542 | LCS_DBF_TEXT(4,trace,"haltsch"); |
541 | LCS_DBF_TEXT_(4,trace,"%s", channel->ccwdev->dev.bus_id); | 543 | LCS_DBF_TEXT_(4,trace,"%s", channel->ccwdev->dev.bus_id); |
542 | channel->state = CH_STATE_INIT; | 544 | channel->state = LCS_CH_STATE_INIT; |
543 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 545 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
544 | rc = ccw_device_halt(channel->ccwdev, (addr_t) channel); | 546 | rc = ccw_device_halt(channel->ccwdev, (addr_t) channel); |
545 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); | 547 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); |
@@ -548,7 +550,7 @@ lcs_stop_channel(struct lcs_channel *channel) | |||
548 | return rc; | 550 | return rc; |
549 | } | 551 | } |
550 | /* Asynchronous halt initialted. Wait for its completion. */ | 552 | /* Asynchronous halt initialted. Wait for its completion. */ |
551 | wait_event(channel->wait_q, (channel->state == CH_STATE_HALTED)); | 553 | wait_event(channel->wait_q, (channel->state == LCS_CH_STATE_HALTED)); |
552 | lcs_clear_channel(channel); | 554 | lcs_clear_channel(channel); |
553 | return 0; | 555 | return 0; |
554 | } | 556 | } |
@@ -596,8 +598,8 @@ __lcs_get_buffer(struct lcs_channel *channel) | |||
596 | LCS_DBF_TEXT(5, trace, "_getbuff"); | 598 | LCS_DBF_TEXT(5, trace, "_getbuff"); |
597 | index = channel->io_idx; | 599 | index = channel->io_idx; |
598 | do { | 600 | do { |
599 | if (channel->iob[index].state == BUF_STATE_EMPTY) { | 601 | if (channel->iob[index].state == LCS_BUF_STATE_EMPTY) { |
600 | channel->iob[index].state = BUF_STATE_LOCKED; | 602 | channel->iob[index].state = LCS_BUF_STATE_LOCKED; |
601 | return channel->iob + index; | 603 | return channel->iob + index; |
602 | } | 604 | } |
603 | index = (index + 1) & (LCS_NUM_BUFFS - 1); | 605 | index = (index + 1) & (LCS_NUM_BUFFS - 1); |
@@ -626,7 +628,7 @@ __lcs_resume_channel(struct lcs_channel *channel) | |||
626 | { | 628 | { |
627 | int rc; | 629 | int rc; |
628 | 630 | ||
629 | if (channel->state != CH_STATE_SUSPENDED) | 631 | if (channel->state != LCS_CH_STATE_SUSPENDED) |
630 | return 0; | 632 | return 0; |
631 | if (channel->ccws[channel->io_idx].flags & CCW_FLAG_SUSPEND) | 633 | if (channel->ccws[channel->io_idx].flags & CCW_FLAG_SUSPEND) |
632 | return 0; | 634 | return 0; |
@@ -636,7 +638,7 @@ __lcs_resume_channel(struct lcs_channel *channel) | |||
636 | LCS_DBF_TEXT_(4, trace, "ersc%s", channel->ccwdev->dev.bus_id); | 638 | LCS_DBF_TEXT_(4, trace, "ersc%s", channel->ccwdev->dev.bus_id); |
637 | PRINT_ERR("Error in lcs_resume_channel: rc=%d\n",rc); | 639 | PRINT_ERR("Error in lcs_resume_channel: rc=%d\n",rc); |
638 | } else | 640 | } else |
639 | channel->state = CH_STATE_RUNNING; | 641 | channel->state = LCS_CH_STATE_RUNNING; |
640 | return rc; | 642 | return rc; |
641 | 643 | ||
642 | } | 644 | } |
@@ -670,10 +672,10 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
670 | int index, rc; | 672 | int index, rc; |
671 | 673 | ||
672 | LCS_DBF_TEXT(5, trace, "rdybuff"); | 674 | LCS_DBF_TEXT(5, trace, "rdybuff"); |
673 | BUG_ON(buffer->state != BUF_STATE_LOCKED && | 675 | BUG_ON(buffer->state != LCS_BUF_STATE_LOCKED && |
674 | buffer->state != BUF_STATE_PROCESSED); | 676 | buffer->state != LCS_BUF_STATE_PROCESSED); |
675 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 677 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
676 | buffer->state = BUF_STATE_READY; | 678 | buffer->state = LCS_BUF_STATE_READY; |
677 | index = buffer - channel->iob; | 679 | index = buffer - channel->iob; |
678 | /* Set length. */ | 680 | /* Set length. */ |
679 | channel->ccws[index].count = buffer->count; | 681 | channel->ccws[index].count = buffer->count; |
@@ -695,8 +697,8 @@ __lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
695 | int index, prev, next; | 697 | int index, prev, next; |
696 | 698 | ||
697 | LCS_DBF_TEXT(5, trace, "prcsbuff"); | 699 | LCS_DBF_TEXT(5, trace, "prcsbuff"); |
698 | BUG_ON(buffer->state != BUF_STATE_READY); | 700 | BUG_ON(buffer->state != LCS_BUF_STATE_READY); |
699 | buffer->state = BUF_STATE_PROCESSED; | 701 | buffer->state = LCS_BUF_STATE_PROCESSED; |
700 | index = buffer - channel->iob; | 702 | index = buffer - channel->iob; |
701 | prev = (index - 1) & (LCS_NUM_BUFFS - 1); | 703 | prev = (index - 1) & (LCS_NUM_BUFFS - 1); |
702 | next = (index + 1) & (LCS_NUM_BUFFS - 1); | 704 | next = (index + 1) & (LCS_NUM_BUFFS - 1); |
@@ -704,7 +706,7 @@ __lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
704 | channel->ccws[index].flags |= CCW_FLAG_SUSPEND; | 706 | channel->ccws[index].flags |= CCW_FLAG_SUSPEND; |
705 | channel->ccws[index].flags &= ~CCW_FLAG_PCI; | 707 | channel->ccws[index].flags &= ~CCW_FLAG_PCI; |
706 | /* Check the suspend bit of the previous buffer. */ | 708 | /* Check the suspend bit of the previous buffer. */ |
707 | if (channel->iob[prev].state == BUF_STATE_READY) { | 709 | if (channel->iob[prev].state == LCS_BUF_STATE_READY) { |
708 | /* | 710 | /* |
709 | * Previous buffer is in state ready. It might have | 711 | * Previous buffer is in state ready. It might have |
710 | * happened in lcs_ready_buffer that the suspend bit | 712 | * happened in lcs_ready_buffer that the suspend bit |
@@ -727,10 +729,10 @@ lcs_release_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) | |||
727 | unsigned long flags; | 729 | unsigned long flags; |
728 | 730 | ||
729 | LCS_DBF_TEXT(5, trace, "relbuff"); | 731 | LCS_DBF_TEXT(5, trace, "relbuff"); |
730 | BUG_ON(buffer->state != BUF_STATE_LOCKED && | 732 | BUG_ON(buffer->state != LCS_BUF_STATE_LOCKED && |
731 | buffer->state != BUF_STATE_PROCESSED); | 733 | buffer->state != LCS_BUF_STATE_PROCESSED); |
732 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 734 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
733 | buffer->state = BUF_STATE_EMPTY; | 735 | buffer->state = LCS_BUF_STATE_EMPTY; |
734 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); | 736 | spin_unlock_irqrestore(get_ccwdev_lock(channel->ccwdev), flags); |
735 | } | 737 | } |
736 | 738 | ||
@@ -1264,7 +1266,7 @@ lcs_register_mc_addresses(void *data) | |||
1264 | netif_carrier_off(card->dev); | 1266 | netif_carrier_off(card->dev); |
1265 | netif_tx_disable(card->dev); | 1267 | netif_tx_disable(card->dev); |
1266 | wait_event(card->write.wait_q, | 1268 | wait_event(card->write.wait_q, |
1267 | (card->write.state != CH_STATE_RUNNING)); | 1269 | (card->write.state != LCS_CH_STATE_RUNNING)); |
1268 | lcs_fix_multicast_list(card); | 1270 | lcs_fix_multicast_list(card); |
1269 | if (card->state == DEV_STATE_UP) { | 1271 | if (card->state == DEV_STATE_UP) { |
1270 | netif_carrier_on(card->dev); | 1272 | netif_carrier_on(card->dev); |
@@ -1404,7 +1406,7 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1404 | } | 1406 | } |
1405 | } | 1407 | } |
1406 | /* How far in the ccw chain have we processed? */ | 1408 | /* How far in the ccw chain have we processed? */ |
1407 | if ((channel->state != CH_STATE_INIT) && | 1409 | if ((channel->state != LCS_CH_STATE_INIT) && |
1408 | (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) { | 1410 | (irb->scsw.fctl & SCSW_FCTL_START_FUNC)) { |
1409 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) | 1411 | index = (struct ccw1 *) __va((addr_t) irb->scsw.cpa) |
1410 | - channel->ccws; | 1412 | - channel->ccws; |
@@ -1424,20 +1426,20 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
1424 | (irb->scsw.dstat & DEV_STAT_CHN_END) || | 1426 | (irb->scsw.dstat & DEV_STAT_CHN_END) || |
1425 | (irb->scsw.dstat & DEV_STAT_UNIT_CHECK)) | 1427 | (irb->scsw.dstat & DEV_STAT_UNIT_CHECK)) |
1426 | /* Mark channel as stopped. */ | 1428 | /* Mark channel as stopped. */ |
1427 | channel->state = CH_STATE_STOPPED; | 1429 | channel->state = LCS_CH_STATE_STOPPED; |
1428 | else if (irb->scsw.actl & SCSW_ACTL_SUSPENDED) | 1430 | else if (irb->scsw.actl & SCSW_ACTL_SUSPENDED) |
1429 | /* CCW execution stopped on a suspend bit. */ | 1431 | /* CCW execution stopped on a suspend bit. */ |
1430 | channel->state = CH_STATE_SUSPENDED; | 1432 | channel->state = LCS_CH_STATE_SUSPENDED; |
1431 | if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) { | 1433 | if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) { |
1432 | if (irb->scsw.cc != 0) { | 1434 | if (irb->scsw.cc != 0) { |
1433 | ccw_device_halt(channel->ccwdev, (addr_t) channel); | 1435 | ccw_device_halt(channel->ccwdev, (addr_t) channel); |
1434 | return; | 1436 | return; |
1435 | } | 1437 | } |
1436 | /* The channel has been stopped by halt_IO. */ | 1438 | /* The channel has been stopped by halt_IO. */ |
1437 | channel->state = CH_STATE_HALTED; | 1439 | channel->state = LCS_CH_STATE_HALTED; |
1438 | } | 1440 | } |
1439 | if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { | 1441 | if (irb->scsw.fctl & SCSW_FCTL_CLEAR_FUNC) { |
1440 | channel->state = CH_STATE_CLEARED; | 1442 | channel->state = LCS_CH_STATE_CLEARED; |
1441 | } | 1443 | } |
1442 | /* Do the rest in the tasklet. */ | 1444 | /* Do the rest in the tasklet. */ |
1443 | tasklet_schedule(&channel->irq_tasklet); | 1445 | tasklet_schedule(&channel->irq_tasklet); |
@@ -1461,7 +1463,7 @@ lcs_tasklet(unsigned long data) | |||
1461 | /* Check for processed buffers. */ | 1463 | /* Check for processed buffers. */ |
1462 | iob = channel->iob; | 1464 | iob = channel->iob; |
1463 | buf_idx = channel->buf_idx; | 1465 | buf_idx = channel->buf_idx; |
1464 | while (iob[buf_idx].state == BUF_STATE_PROCESSED) { | 1466 | while (iob[buf_idx].state == LCS_BUF_STATE_PROCESSED) { |
1465 | /* Do the callback thing. */ | 1467 | /* Do the callback thing. */ |
1466 | if (iob[buf_idx].callback != NULL) | 1468 | if (iob[buf_idx].callback != NULL) |
1467 | iob[buf_idx].callback(channel, iob + buf_idx); | 1469 | iob[buf_idx].callback(channel, iob + buf_idx); |
@@ -1469,12 +1471,12 @@ lcs_tasklet(unsigned long data) | |||
1469 | } | 1471 | } |
1470 | channel->buf_idx = buf_idx; | 1472 | channel->buf_idx = buf_idx; |
1471 | 1473 | ||
1472 | if (channel->state == CH_STATE_STOPPED) | 1474 | if (channel->state == LCS_CH_STATE_STOPPED) |
1473 | // FIXME: what if rc != 0 ?? | 1475 | // FIXME: what if rc != 0 ?? |
1474 | rc = lcs_start_channel(channel); | 1476 | rc = lcs_start_channel(channel); |
1475 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 1477 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
1476 | if (channel->state == CH_STATE_SUSPENDED && | 1478 | if (channel->state == LCS_CH_STATE_SUSPENDED && |
1477 | channel->iob[channel->io_idx].state == BUF_STATE_READY) { | 1479 | channel->iob[channel->io_idx].state == LCS_BUF_STATE_READY) { |
1478 | // FIXME: what if rc != 0 ?? | 1480 | // FIXME: what if rc != 0 ?? |
1479 | rc = __lcs_resume_channel(channel); | 1481 | rc = __lcs_resume_channel(channel); |
1480 | } | 1482 | } |
@@ -1689,8 +1691,8 @@ lcs_detect(struct lcs_card *card) | |||
1689 | card->state = DEV_STATE_UP; | 1691 | card->state = DEV_STATE_UP; |
1690 | } else { | 1692 | } else { |
1691 | card->state = DEV_STATE_DOWN; | 1693 | card->state = DEV_STATE_DOWN; |
1692 | card->write.state = CH_STATE_INIT; | 1694 | card->write.state = LCS_CH_STATE_INIT; |
1693 | card->read.state = CH_STATE_INIT; | 1695 | card->read.state = LCS_CH_STATE_INIT; |
1694 | } | 1696 | } |
1695 | return rc; | 1697 | return rc; |
1696 | } | 1698 | } |
@@ -1705,8 +1707,8 @@ lcs_stopcard(struct lcs_card *card) | |||
1705 | 1707 | ||
1706 | LCS_DBF_TEXT(3, setup, "stopcard"); | 1708 | LCS_DBF_TEXT(3, setup, "stopcard"); |
1707 | 1709 | ||
1708 | if (card->read.state != CH_STATE_STOPPED && | 1710 | if (card->read.state != LCS_CH_STATE_STOPPED && |
1709 | card->write.state != CH_STATE_STOPPED && | 1711 | card->write.state != LCS_CH_STATE_STOPPED && |
1710 | card->state == DEV_STATE_UP) { | 1712 | card->state == DEV_STATE_UP) { |
1711 | lcs_clear_multicast_list(card); | 1713 | lcs_clear_multicast_list(card); |
1712 | rc = lcs_send_stoplan(card,LCS_INITIATOR_TCPIP); | 1714 | rc = lcs_send_stoplan(card,LCS_INITIATOR_TCPIP); |
@@ -1871,7 +1873,7 @@ lcs_stop_device(struct net_device *dev) | |||
1871 | netif_tx_disable(dev); | 1873 | netif_tx_disable(dev); |
1872 | dev->flags &= ~IFF_UP; | 1874 | dev->flags &= ~IFF_UP; |
1873 | wait_event(card->write.wait_q, | 1875 | wait_event(card->write.wait_q, |
1874 | (card->write.state != CH_STATE_RUNNING)); | 1876 | (card->write.state != LCS_CH_STATE_RUNNING)); |
1875 | rc = lcs_stopcard(card); | 1877 | rc = lcs_stopcard(card); |
1876 | if (rc) | 1878 | if (rc) |
1877 | PRINT_ERR("Try it again!\n "); | 1879 | PRINT_ERR("Try it again!\n "); |
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h index b5247dc08b57..0e1e4a0a88f0 100644 --- a/drivers/s390/net/lcs.h +++ b/drivers/s390/net/lcs.h | |||
@@ -23,11 +23,6 @@ do { \ | |||
23 | } while (0) | 23 | } while (0) |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * some more definitions for debug or output stuff | ||
27 | */ | ||
28 | #define PRINTK_HEADER " lcs: " | ||
29 | |||
30 | /** | ||
31 | * sysfs related stuff | 26 | * sysfs related stuff |
32 | */ | 27 | */ |
33 | #define CARD_FROM_DEV(cdev) \ | 28 | #define CARD_FROM_DEV(cdev) \ |
@@ -127,22 +122,22 @@ do { \ | |||
127 | * LCS Buffer states | 122 | * LCS Buffer states |
128 | */ | 123 | */ |
129 | enum lcs_buffer_states { | 124 | enum lcs_buffer_states { |
130 | BUF_STATE_EMPTY, /* buffer is empty */ | 125 | LCS_BUF_STATE_EMPTY, /* buffer is empty */ |
131 | BUF_STATE_LOCKED, /* buffer is locked, don't touch */ | 126 | LCS_BUF_STATE_LOCKED, /* buffer is locked, don't touch */ |
132 | BUF_STATE_READY, /* buffer is ready for read/write */ | 127 | LCS_BUF_STATE_READY, /* buffer is ready for read/write */ |
133 | BUF_STATE_PROCESSED, | 128 | LCS_BUF_STATE_PROCESSED, |
134 | }; | 129 | }; |
135 | 130 | ||
136 | /** | 131 | /** |
137 | * LCS Channel State Machine declarations | 132 | * LCS Channel State Machine declarations |
138 | */ | 133 | */ |
139 | enum lcs_channel_states { | 134 | enum lcs_channel_states { |
140 | CH_STATE_INIT, | 135 | LCS_CH_STATE_INIT, |
141 | CH_STATE_HALTED, | 136 | LCS_CH_STATE_HALTED, |
142 | CH_STATE_STOPPED, | 137 | LCS_CH_STATE_STOPPED, |
143 | CH_STATE_RUNNING, | 138 | LCS_CH_STATE_RUNNING, |
144 | CH_STATE_SUSPENDED, | 139 | LCS_CH_STATE_SUSPENDED, |
145 | CH_STATE_CLEARED, | 140 | LCS_CH_STATE_CLEARED, |
146 | }; | 141 | }; |
147 | 142 | ||
148 | /** | 143 | /** |
diff --git a/drivers/s390/net/qeth.h b/drivers/s390/net/qeth.h index 821383d8cbe7..53c358c7d368 100644 --- a/drivers/s390/net/qeth.h +++ b/drivers/s390/net/qeth.h | |||
@@ -151,8 +151,6 @@ qeth_hex_dump(unsigned char *buf, size_t len) | |||
151 | #define SENSE_RESETTING_EVENT_BYTE 1 | 151 | #define SENSE_RESETTING_EVENT_BYTE 1 |
152 | #define SENSE_RESETTING_EVENT_FLAG 0x80 | 152 | #define SENSE_RESETTING_EVENT_FLAG 0x80 |
153 | 153 | ||
154 | #define atomic_swap(a,b) xchg((int *)a.counter, b) | ||
155 | |||
156 | /* | 154 | /* |
157 | * Common IO related definitions | 155 | * Common IO related definitions |
158 | */ | 156 | */ |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index 8364d5475ac7..7fdc5272c446 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -2982,7 +2982,7 @@ qeth_check_outbound_queue(struct qeth_qdio_out_q *queue) | |||
2982 | */ | 2982 | */ |
2983 | if ((atomic_read(&queue->used_buffers) <= QETH_LOW_WATERMARK_PACK) || | 2983 | if ((atomic_read(&queue->used_buffers) <= QETH_LOW_WATERMARK_PACK) || |
2984 | !atomic_read(&queue->set_pci_flags_count)){ | 2984 | !atomic_read(&queue->set_pci_flags_count)){ |
2985 | if (atomic_swap(&queue->state, QETH_OUT_Q_LOCKED_FLUSH) == | 2985 | if (atomic_xchg(&queue->state, QETH_OUT_Q_LOCKED_FLUSH) == |
2986 | QETH_OUT_Q_UNLOCKED) { | 2986 | QETH_OUT_Q_UNLOCKED) { |
2987 | /* | 2987 | /* |
2988 | * If we get in here, there was no action in | 2988 | * If we get in here, there was no action in |
@@ -3245,7 +3245,7 @@ qeth_free_qdio_buffers(struct qeth_card *card) | |||
3245 | int i, j; | 3245 | int i, j; |
3246 | 3246 | ||
3247 | QETH_DBF_TEXT(trace, 2, "freeqdbf"); | 3247 | QETH_DBF_TEXT(trace, 2, "freeqdbf"); |
3248 | if (atomic_swap(&card->qdio.state, QETH_QDIO_UNINITIALIZED) == | 3248 | if (atomic_xchg(&card->qdio.state, QETH_QDIO_UNINITIALIZED) == |
3249 | QETH_QDIO_UNINITIALIZED) | 3249 | QETH_QDIO_UNINITIALIZED) |
3250 | return; | 3250 | return; |
3251 | kfree(card->qdio.in_q); | 3251 | kfree(card->qdio.in_q); |
@@ -4366,7 +4366,7 @@ out: | |||
4366 | if (flush_count) | 4366 | if (flush_count) |
4367 | qeth_flush_buffers(queue, 0, start_index, flush_count); | 4367 | qeth_flush_buffers(queue, 0, start_index, flush_count); |
4368 | else if (!atomic_read(&queue->set_pci_flags_count)) | 4368 | else if (!atomic_read(&queue->set_pci_flags_count)) |
4369 | atomic_swap(&queue->state, QETH_OUT_Q_LOCKED_FLUSH); | 4369 | atomic_xchg(&queue->state, QETH_OUT_Q_LOCKED_FLUSH); |
4370 | /* | 4370 | /* |
4371 | * queue->state will go from LOCKED -> UNLOCKED or from | 4371 | * queue->state will go from LOCKED -> UNLOCKED or from |
4372 | * LOCKED_FLUSH -> LOCKED if output_handler wanted to 'notify' us | 4372 | * LOCKED_FLUSH -> LOCKED if output_handler wanted to 'notify' us |