diff options
author | Michael Holzheu <holzheu@de.ibm.com> | 2007-10-12 10:11:47 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2007-10-12 10:13:10 -0400 |
commit | 1b9fd76e30368489b561db5794b3831bcc28c8bc (patch) | |
tree | 5c686dd52482727d80bc713bd7290b1756dca504 /drivers/s390/char | |
parent | a004fb0c33539ae90f25573505be6a116a76e639 (diff) |
[S390] tape: Fix medium state handling
Currently there are situations, where the tape medium state (loaded, unloaded,
unknown) is not set correctly. The reason is that the medium association
field is used to determine the medium state. This not always leads to
correct results. To fix that we use another field of the medium sense
data instead.
Signed-off-by: Michael Holzheu <holzheu@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r-- | drivers/s390/char/tape_3590.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c index 9f244c591eeb..da25f8e24152 100644 --- a/drivers/s390/char/tape_3590.c +++ b/drivers/s390/char/tape_3590.c | |||
@@ -708,16 +708,22 @@ static void tape_3590_med_state_set(struct tape_device *device, | |||
708 | 708 | ||
709 | c_info = &TAPE_3590_CRYPT_INFO(device); | 709 | c_info = &TAPE_3590_CRYPT_INFO(device); |
710 | 710 | ||
711 | if (sense->masst == MSENSE_UNASSOCIATED) { | 711 | DBF_EVENT(6, "medium state: %x:%x\n", sense->macst, sense->masst); |
712 | switch (sense->macst) { | ||
713 | case 0x04: | ||
714 | case 0x05: | ||
715 | case 0x06: | ||
712 | tape_med_state_set(device, MS_UNLOADED); | 716 | tape_med_state_set(device, MS_UNLOADED); |
713 | TAPE_3590_CRYPT_INFO(device).medium_status = 0; | 717 | TAPE_3590_CRYPT_INFO(device).medium_status = 0; |
714 | return; | 718 | return; |
715 | } | 719 | case 0x08: |
716 | if (sense->masst != MSENSE_ASSOCIATED_MOUNT) { | 720 | case 0x09: |
717 | PRINT_ERR("Unknown medium state: %x\n", sense->masst); | 721 | tape_med_state_set(device, MS_LOADED); |
722 | break; | ||
723 | default: | ||
724 | tape_med_state_set(device, MS_UNKNOWN); | ||
718 | return; | 725 | return; |
719 | } | 726 | } |
720 | tape_med_state_set(device, MS_LOADED); | ||
721 | c_info->medium_status |= TAPE390_MEDIUM_LOADED_MASK; | 727 | c_info->medium_status |= TAPE390_MEDIUM_LOADED_MASK; |
722 | if (sense->flags & MSENSE_CRYPT_MASK) { | 728 | if (sense->flags & MSENSE_CRYPT_MASK) { |
723 | PRINT_INFO("Medium is encrypted (%04x)\n", sense->flags); | 729 | PRINT_INFO("Medium is encrypted (%04x)\n", sense->flags); |
@@ -835,15 +841,17 @@ tape_3590_unsolicited_irq(struct tape_device *device, struct irb *irb) | |||
835 | /* Probably result of halt ssch */ | 841 | /* Probably result of halt ssch */ |
836 | return TAPE_IO_PENDING; | 842 | return TAPE_IO_PENDING; |
837 | else if (irb->scsw.dstat == 0x85) | 843 | else if (irb->scsw.dstat == 0x85) |
838 | /* Device Ready -> check medium state */ | 844 | /* Device Ready */ |
839 | tape_3590_schedule_work(device, TO_MSEN); | 845 | DBF_EVENT(3, "unsol.irq! tape ready: %08x\n", device->cdev_id); |
840 | else if (irb->scsw.dstat & DEV_STAT_ATTENTION) | 846 | else if (irb->scsw.dstat & DEV_STAT_ATTENTION) { |
841 | tape_3590_schedule_work(device, TO_READ_ATTMSG); | 847 | tape_3590_schedule_work(device, TO_READ_ATTMSG); |
842 | else { | 848 | } else { |
843 | DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id); | 849 | DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id); |
844 | PRINT_WARN("Unsolicited IRQ (Device End) caught.\n"); | 850 | PRINT_WARN("Unsolicited IRQ (Device End) caught.\n"); |
845 | tape_dump_sense(device, NULL, irb); | 851 | tape_dump_sense(device, NULL, irb); |
846 | } | 852 | } |
853 | /* check medium state */ | ||
854 | tape_3590_schedule_work(device, TO_MSEN); | ||
847 | return TAPE_IO_SUCCESS; | 855 | return TAPE_IO_SUCCESS; |
848 | } | 856 | } |
849 | 857 | ||