aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/tape_3590.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/tape_3590.c')
-rw-r--r--drivers/s390/char/tape_3590.c367
1 files changed, 180 insertions, 187 deletions
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 71605a179d65..fc1d91294143 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -8,12 +8,15 @@
8 * Martin Schwidefsky <schwidefsky@de.ibm.com> 8 * Martin Schwidefsky <schwidefsky@de.ibm.com>
9 */ 9 */
10 10
11#define KMSG_COMPONENT "tape"
12
11#include <linux/module.h> 13#include <linux/module.h>
12#include <linux/init.h> 14#include <linux/init.h>
13#include <linux/bio.h> 15#include <linux/bio.h>
14#include <asm/ebcdic.h> 16#include <asm/ebcdic.h>
15 17
16#define TAPE_DBF_AREA tape_3590_dbf 18#define TAPE_DBF_AREA tape_3590_dbf
19#define BUFSIZE 512 /* size of buffers for dynamic generated messages */
17 20
18#include "tape.h" 21#include "tape.h"
19#include "tape_std.h" 22#include "tape_std.h"
@@ -36,7 +39,7 @@ EXPORT_SYMBOL(TAPE_DBF_AREA);
36 * - Read Alternate: implemented 39 * - Read Alternate: implemented
37 *******************************************************************/ 40 *******************************************************************/
38 41
39#define PRINTK_HEADER "TAPE_3590: " 42#define KMSG_COMPONENT "tape"
40 43
41static const char *tape_3590_msg[TAPE_3590_MAX_MSG] = { 44static const char *tape_3590_msg[TAPE_3590_MAX_MSG] = {
42 [0x00] = "", 45 [0x00] = "",
@@ -661,8 +664,7 @@ tape_3590_bread(struct tape_device *device, struct request *req)
661 ccw++; 664 ccw++;
662 dst += TAPEBLOCK_HSEC_SIZE; 665 dst += TAPEBLOCK_HSEC_SIZE;
663 } 666 }
664 if (off > bv->bv_len) 667 BUG_ON(off > bv->bv_len);
665 BUG();
666 } 668 }
667 ccw = tape_ccw_end(ccw, NOP, 0, NULL); 669 ccw = tape_ccw_end(ccw, NOP, 0, NULL);
668 DBF_EVENT(6, "xBREDccwg\n"); 670 DBF_EVENT(6, "xBREDccwg\n");
@@ -726,7 +728,7 @@ static void tape_3590_med_state_set(struct tape_device *device,
726 } 728 }
727 c_info->medium_status |= TAPE390_MEDIUM_LOADED_MASK; 729 c_info->medium_status |= TAPE390_MEDIUM_LOADED_MASK;
728 if (sense->flags & MSENSE_CRYPT_MASK) { 730 if (sense->flags & MSENSE_CRYPT_MASK) {
729 PRINT_INFO("Medium is encrypted (%04x)\n", sense->flags); 731 DBF_EVENT(6, "Medium is encrypted (%04x)\n", sense->flags);
730 c_info->medium_status |= TAPE390_MEDIUM_ENCRYPTED_MASK; 732 c_info->medium_status |= TAPE390_MEDIUM_ENCRYPTED_MASK;
731 } else { 733 } else {
732 DBF_EVENT(6, "Medium is not encrypted %04x\n", sense->flags); 734 DBF_EVENT(6, "Medium is not encrypted %04x\n", sense->flags);
@@ -847,8 +849,7 @@ tape_3590_unsolicited_irq(struct tape_device *device, struct irb *irb)
847 tape_3590_schedule_work(device, TO_READ_ATTMSG); 849 tape_3590_schedule_work(device, TO_READ_ATTMSG);
848 } else { 850 } else {
849 DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id); 851 DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id);
850 PRINT_WARN("Unsolicited IRQ (Device End) caught.\n"); 852 tape_dump_sense_dbf(device, NULL, irb);
851 tape_dump_sense(device, NULL, irb);
852 } 853 }
853 /* check medium state */ 854 /* check medium state */
854 tape_3590_schedule_work(device, TO_MSEN); 855 tape_3590_schedule_work(device, TO_MSEN);
@@ -876,8 +877,6 @@ tape_3590_erp_basic(struct tape_device *device, struct tape_request *request,
876 case SENSE_BRA_DRE: 877 case SENSE_BRA_DRE:
877 return tape_3590_erp_failed(device, request, irb, rc); 878 return tape_3590_erp_failed(device, request, irb, rc);
878 default: 879 default:
879 PRINT_ERR("Unknown BRA %x - This should not happen!\n",
880 sense->bra);
881 BUG(); 880 BUG();
882 return TAPE_IO_STOP; 881 return TAPE_IO_STOP;
883 } 882 }
@@ -910,7 +909,8 @@ tape_3590_erp_swap(struct tape_device *device, struct tape_request *request,
910 * should proceed with the new tape... this 909 * should proceed with the new tape... this
911 * should probably be done in user space! 910 * should probably be done in user space!
912 */ 911 */
913 PRINT_WARN("(%s): Swap Tape Device!\n", dev_name(&device->cdev->dev)); 912 dev_warn (&device->cdev->dev, "The tape medium must be loaded into a "
913 "different tape unit\n");
914 return tape_3590_erp_basic(device, request, irb, -EIO); 914 return tape_3590_erp_basic(device, request, irb, -EIO);
915} 915}
916 916
@@ -985,8 +985,6 @@ tape_3590_erp_read_opposite(struct tape_device *device,
985 return tape_3590_erp_failed(device, request, irb, -EIO); 985 return tape_3590_erp_failed(device, request, irb, -EIO);
986 break; 986 break;
987 default: 987 default:
988 PRINT_WARN("read_opposite_recovery_called_with_op: %s\n",
989 tape_op_verbose[request->op]);
990 return tape_3590_erp_failed(device, request, irb, -EIO); 988 return tape_3590_erp_failed(device, request, irb, -EIO);
991 } 989 }
992} 990}
@@ -998,50 +996,61 @@ static void
998tape_3590_print_mim_msg_f0(struct tape_device *device, struct irb *irb) 996tape_3590_print_mim_msg_f0(struct tape_device *device, struct irb *irb)
999{ 997{
1000 struct tape_3590_sense *sense; 998 struct tape_3590_sense *sense;
999 char *exception, *service;
1000
1001 exception = kmalloc(BUFSIZE, GFP_ATOMIC);
1002 service = kmalloc(BUFSIZE, GFP_ATOMIC);
1003
1004 if (!exception || !service)
1005 goto out_nomem;
1001 1006
1002 sense = (struct tape_3590_sense *) irb->ecw; 1007 sense = (struct tape_3590_sense *) irb->ecw;
1003 /* Exception Message */ 1008 /* Exception Message */
1004 switch (sense->fmt.f70.emc) { 1009 switch (sense->fmt.f70.emc) {
1005 case 0x02: 1010 case 0x02:
1006 PRINT_WARN("(%s): Data degraded\n", 1011 snprintf(exception, BUFSIZE, "Data degraded");
1007 dev_name(&device->cdev->dev));
1008 break; 1012 break;
1009 case 0x03: 1013 case 0x03:
1010 PRINT_WARN("(%s): Data degraded in partion %i\n", 1014 snprintf(exception, BUFSIZE, "Data degraded in partion %i",
1011 dev_name(&device->cdev->dev), sense->fmt.f70.mp); 1015 sense->fmt.f70.mp);
1012 break; 1016 break;
1013 case 0x04: 1017 case 0x04:
1014 PRINT_WARN("(%s): Medium degraded\n", 1018 snprintf(exception, BUFSIZE, "Medium degraded");
1015 dev_name(&device->cdev->dev));
1016 break; 1019 break;
1017 case 0x05: 1020 case 0x05:
1018 PRINT_WARN("(%s): Medium degraded in partition %i\n", 1021 snprintf(exception, BUFSIZE, "Medium degraded in partition %i",
1019 dev_name(&device->cdev->dev), sense->fmt.f70.mp); 1022 sense->fmt.f70.mp);
1020 break; 1023 break;
1021 case 0x06: 1024 case 0x06:
1022 PRINT_WARN("(%s): Block 0 Error\n", 1025 snprintf(exception, BUFSIZE, "Block 0 Error");
1023 dev_name(&device->cdev->dev));
1024 break; 1026 break;
1025 case 0x07: 1027 case 0x07:
1026 PRINT_WARN("(%s): Medium Exception 0x%02x\n", 1028 snprintf(exception, BUFSIZE, "Medium Exception 0x%02x",
1027 dev_name(&device->cdev->dev), sense->fmt.f70.md); 1029 sense->fmt.f70.md);
1028 break; 1030 break;
1029 default: 1031 default:
1030 PRINT_WARN("(%s): MIM ExMsg: 0x%02x\n", 1032 snprintf(exception, BUFSIZE, "0x%02x",
1031 dev_name(&device->cdev->dev), sense->fmt.f70.emc); 1033 sense->fmt.f70.emc);
1032 break; 1034 break;
1033 } 1035 }
1034 /* Service Message */ 1036 /* Service Message */
1035 switch (sense->fmt.f70.smc) { 1037 switch (sense->fmt.f70.smc) {
1036 case 0x02: 1038 case 0x02:
1037 PRINT_WARN("(%s): Reference Media maintenance procedure %i\n", 1039 snprintf(service, BUFSIZE, "Reference Media maintenance "
1038 dev_name(&device->cdev->dev), sense->fmt.f70.md); 1040 "procedure %i", sense->fmt.f70.md);
1039 break; 1041 break;
1040 default: 1042 default:
1041 PRINT_WARN("(%s): MIM ServiceMsg: 0x%02x\n", 1043 snprintf(service, BUFSIZE, "0x%02x",
1042 dev_name(&device->cdev->dev), sense->fmt.f70.smc); 1044 sense->fmt.f70.smc);
1043 break; 1045 break;
1044 } 1046 }
1047
1048 dev_warn (&device->cdev->dev, "Tape media information: exception %s, "
1049 "service %s\n", exception, service);
1050
1051out_nomem:
1052 kfree(exception);
1053 kfree(service);
1045} 1054}
1046 1055
1047/* 1056/*
@@ -1051,108 +1060,108 @@ static void
1051tape_3590_print_io_sim_msg_f1(struct tape_device *device, struct irb *irb) 1060tape_3590_print_io_sim_msg_f1(struct tape_device *device, struct irb *irb)
1052{ 1061{
1053 struct tape_3590_sense *sense; 1062 struct tape_3590_sense *sense;
1063 char *exception, *service;
1064
1065 exception = kmalloc(BUFSIZE, GFP_ATOMIC);
1066 service = kmalloc(BUFSIZE, GFP_ATOMIC);
1067
1068 if (!exception || !service)
1069 goto out_nomem;
1054 1070
1055 sense = (struct tape_3590_sense *) irb->ecw; 1071 sense = (struct tape_3590_sense *) irb->ecw;
1056 /* Exception Message */ 1072 /* Exception Message */
1057 switch (sense->fmt.f71.emc) { 1073 switch (sense->fmt.f71.emc) {
1058 case 0x01: 1074 case 0x01:
1059 PRINT_WARN("(%s): Effect of failure is unknown\n", 1075 snprintf(exception, BUFSIZE, "Effect of failure is unknown");
1060 dev_name(&device->cdev->dev));
1061 break; 1076 break;
1062 case 0x02: 1077 case 0x02:
1063 PRINT_WARN("(%s): CU Exception - no performance impact\n", 1078 snprintf(exception, BUFSIZE, "CU Exception - no performance "
1064 dev_name(&device->cdev->dev)); 1079 "impact");
1065 break; 1080 break;
1066 case 0x03: 1081 case 0x03:
1067 PRINT_WARN("(%s): CU Exception on channel interface 0x%02x\n", 1082 snprintf(exception, BUFSIZE, "CU Exception on channel "
1068 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1083 "interface 0x%02x", sense->fmt.f71.md[0]);
1069 break; 1084 break;
1070 case 0x04: 1085 case 0x04:
1071 PRINT_WARN("(%s): CU Exception on device path 0x%02x\n", 1086 snprintf(exception, BUFSIZE, "CU Exception on device path "
1072 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1087 "0x%02x", sense->fmt.f71.md[0]);
1073 break; 1088 break;
1074 case 0x05: 1089 case 0x05:
1075 PRINT_WARN("(%s): CU Exception on library path 0x%02x\n", 1090 snprintf(exception, BUFSIZE, "CU Exception on library path "
1076 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1091 "0x%02x", sense->fmt.f71.md[0]);
1077 break; 1092 break;
1078 case 0x06: 1093 case 0x06:
1079 PRINT_WARN("(%s): CU Exception on node 0x%02x\n", 1094 snprintf(exception, BUFSIZE, "CU Exception on node 0x%02x",
1080 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1095 sense->fmt.f71.md[0]);
1081 break; 1096 break;
1082 case 0x07: 1097 case 0x07:
1083 PRINT_WARN("(%s): CU Exception on partition 0x%02x\n", 1098 snprintf(exception, BUFSIZE, "CU Exception on partition "
1084 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1099 "0x%02x", sense->fmt.f71.md[0]);
1085 break; 1100 break;
1086 default: 1101 default:
1087 PRINT_WARN("(%s): SIM ExMsg: 0x%02x\n", 1102 snprintf(exception, BUFSIZE, "0x%02x",
1088 dev_name(&device->cdev->dev), sense->fmt.f71.emc); 1103 sense->fmt.f71.emc);
1089 } 1104 }
1090 /* Service Message */ 1105 /* Service Message */
1091 switch (sense->fmt.f71.smc) { 1106 switch (sense->fmt.f71.smc) {
1092 case 0x01: 1107 case 0x01:
1093 PRINT_WARN("(%s): Repair impact is unknown\n", 1108 snprintf(service, BUFSIZE, "Repair impact is unknown");
1094 dev_name(&device->cdev->dev));
1095 break; 1109 break;
1096 case 0x02: 1110 case 0x02:
1097 PRINT_WARN("(%s): Repair will not impact cu performance\n", 1111 snprintf(service, BUFSIZE, "Repair will not impact cu "
1098 dev_name(&device->cdev->dev)); 1112 "performance");
1099 break; 1113 break;
1100 case 0x03: 1114 case 0x03:
1101 if (sense->fmt.f71.mdf == 0) 1115 if (sense->fmt.f71.mdf == 0)
1102 PRINT_WARN("(%s): Repair will disable node " 1116 snprintf(service, BUFSIZE, "Repair will disable node "
1103 "0x%x on CU\n", 1117 "0x%x on CU", sense->fmt.f71.md[1]);
1104 dev_name(&device->cdev->dev),
1105 sense->fmt.f71.md[1]);
1106 else 1118 else
1107 PRINT_WARN("(%s): Repair will disable nodes " 1119 snprintf(service, BUFSIZE, "Repair will disable "
1108 "(0x%x-0x%x) on CU\n", 1120 "nodes (0x%x-0x%x) on CU", sense->fmt.f71.md[1],
1109 dev_name(&device->cdev->dev), 1121 sense->fmt.f71.md[2]);
1110 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1111 break; 1122 break;
1112 case 0x04: 1123 case 0x04:
1113 if (sense->fmt.f71.mdf == 0) 1124 if (sense->fmt.f71.mdf == 0)
1114 PRINT_WARN("(%s): Repair will disable cannel path " 1125 snprintf(service, BUFSIZE, "Repair will disable "
1115 "0x%x on CU\n", 1126 "channel path 0x%x on CU",
1116 dev_name(&device->cdev->dev), 1127 sense->fmt.f71.md[1]);
1117 sense->fmt.f71.md[1]);
1118 else 1128 else
1119 PRINT_WARN("(%s): Repair will disable cannel paths " 1129 snprintf(service, BUFSIZE, "Repair will disable cannel"
1120 "(0x%x-0x%x) on CU\n", 1130 " paths (0x%x-0x%x) on CU",
1121 dev_name(&device->cdev->dev), 1131 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1122 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1123 break; 1132 break;
1124 case 0x05: 1133 case 0x05:
1125 if (sense->fmt.f71.mdf == 0) 1134 if (sense->fmt.f71.mdf == 0)
1126 PRINT_WARN("(%s): Repair will disable device path " 1135 snprintf(service, BUFSIZE, "Repair will disable device"
1127 "0x%x on CU\n", 1136 " path 0x%x on CU", sense->fmt.f71.md[1]);
1128 dev_name(&device->cdev->dev),
1129 sense->fmt.f71.md[1]);
1130 else 1137 else
1131 PRINT_WARN("(%s): Repair will disable device paths " 1138 snprintf(service, BUFSIZE, "Repair will disable device"
1132 "(0x%x-0x%x) on CU\n", 1139 " paths (0x%x-0x%x) on CU",
1133 dev_name(&device->cdev->dev), 1140 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1134 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1135 break; 1141 break;
1136 case 0x06: 1142 case 0x06:
1137 if (sense->fmt.f71.mdf == 0) 1143 if (sense->fmt.f71.mdf == 0)
1138 PRINT_WARN("(%s): Repair will disable library path " 1144 snprintf(service, BUFSIZE, "Repair will disable "
1139 "0x%x on CU\n", 1145 "library path 0x%x on CU",
1140 dev_name(&device->cdev->dev), 1146 sense->fmt.f71.md[1]);
1141 sense->fmt.f71.md[1]);
1142 else 1147 else
1143 PRINT_WARN("(%s): Repair will disable library paths " 1148 snprintf(service, BUFSIZE, "Repair will disable "
1144 "(0x%x-0x%x) on CU\n", 1149 "library paths (0x%x-0x%x) on CU",
1145 dev_name(&device->cdev->dev), 1150 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1146 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1147 break; 1151 break;
1148 case 0x07: 1152 case 0x07:
1149 PRINT_WARN("(%s): Repair will disable access to CU\n", 1153 snprintf(service, BUFSIZE, "Repair will disable access to CU");
1150 dev_name(&device->cdev->dev));
1151 break; 1154 break;
1152 default: 1155 default:
1153 PRINT_WARN("(%s): SIM ServiceMsg: 0x%02x\n", 1156 snprintf(service, BUFSIZE, "0x%02x",
1154 dev_name(&device->cdev->dev), sense->fmt.f71.smc); 1157 sense->fmt.f71.smc);
1155 } 1158 }
1159
1160 dev_warn (&device->cdev->dev, "I/O subsystem information: exception"
1161 " %s, service %s\n", exception, service);
1162out_nomem:
1163 kfree(exception);
1164 kfree(service);
1156} 1165}
1157 1166
1158/* 1167/*
@@ -1162,111 +1171,109 @@ static void
1162tape_3590_print_dev_sim_msg_f2(struct tape_device *device, struct irb *irb) 1171tape_3590_print_dev_sim_msg_f2(struct tape_device *device, struct irb *irb)
1163{ 1172{
1164 struct tape_3590_sense *sense; 1173 struct tape_3590_sense *sense;
1174 char *exception, *service;
1175
1176 exception = kmalloc(BUFSIZE, GFP_ATOMIC);
1177 service = kmalloc(BUFSIZE, GFP_ATOMIC);
1178
1179 if (!exception || !service)
1180 goto out_nomem;
1165 1181
1166 sense = (struct tape_3590_sense *) irb->ecw; 1182 sense = (struct tape_3590_sense *) irb->ecw;
1167 /* Exception Message */ 1183 /* Exception Message */
1168 switch (sense->fmt.f71.emc) { 1184 switch (sense->fmt.f71.emc) {
1169 case 0x01: 1185 case 0x01:
1170 PRINT_WARN("(%s): Effect of failure is unknown\n", 1186 snprintf(exception, BUFSIZE, "Effect of failure is unknown");
1171 dev_name(&device->cdev->dev));
1172 break; 1187 break;
1173 case 0x02: 1188 case 0x02:
1174 PRINT_WARN("(%s): DV Exception - no performance impact\n", 1189 snprintf(exception, BUFSIZE, "DV Exception - no performance"
1175 dev_name(&device->cdev->dev)); 1190 " impact");
1176 break; 1191 break;
1177 case 0x03: 1192 case 0x03:
1178 PRINT_WARN("(%s): DV Exception on channel interface 0x%02x\n", 1193 snprintf(exception, BUFSIZE, "DV Exception on channel "
1179 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1194 "interface 0x%02x", sense->fmt.f71.md[0]);
1180 break; 1195 break;
1181 case 0x04: 1196 case 0x04:
1182 PRINT_WARN("(%s): DV Exception on loader 0x%02x\n", 1197 snprintf(exception, BUFSIZE, "DV Exception on loader 0x%02x",
1183 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1198 sense->fmt.f71.md[0]);
1184 break; 1199 break;
1185 case 0x05: 1200 case 0x05:
1186 PRINT_WARN("(%s): DV Exception on message display 0x%02x\n", 1201 snprintf(exception, BUFSIZE, "DV Exception on message display"
1187 dev_name(&device->cdev->dev), sense->fmt.f71.md[0]); 1202 " 0x%02x", sense->fmt.f71.md[0]);
1188 break; 1203 break;
1189 case 0x06: 1204 case 0x06:
1190 PRINT_WARN("(%s): DV Exception in tape path\n", 1205 snprintf(exception, BUFSIZE, "DV Exception in tape path");
1191 dev_name(&device->cdev->dev));
1192 break; 1206 break;
1193 case 0x07: 1207 case 0x07:
1194 PRINT_WARN("(%s): DV Exception in drive\n", 1208 snprintf(exception, BUFSIZE, "DV Exception in drive");
1195 dev_name(&device->cdev->dev));
1196 break; 1209 break;
1197 default: 1210 default:
1198 PRINT_WARN("(%s): DSIM ExMsg: 0x%02x\n", 1211 snprintf(exception, BUFSIZE, "0x%02x",
1199 dev_name(&device->cdev->dev), sense->fmt.f71.emc); 1212 sense->fmt.f71.emc);
1200 } 1213 }
1201 /* Service Message */ 1214 /* Service Message */
1202 switch (sense->fmt.f71.smc) { 1215 switch (sense->fmt.f71.smc) {
1203 case 0x01: 1216 case 0x01:
1204 PRINT_WARN("(%s): Repair impact is unknown\n", 1217 snprintf(service, BUFSIZE, "Repair impact is unknown");
1205 dev_name(&device->cdev->dev));
1206 break; 1218 break;
1207 case 0x02: 1219 case 0x02:
1208 PRINT_WARN("(%s): Repair will not impact device performance\n", 1220 snprintf(service, BUFSIZE, "Repair will not impact device "
1209 dev_name(&device->cdev->dev)); 1221 "performance");
1210 break; 1222 break;
1211 case 0x03: 1223 case 0x03:
1212 if (sense->fmt.f71.mdf == 0) 1224 if (sense->fmt.f71.mdf == 0)
1213 PRINT_WARN("(%s): Repair will disable channel path " 1225 snprintf(service, BUFSIZE, "Repair will disable "
1214 "0x%x on DV\n", 1226 "channel path 0x%x on DV",
1215 dev_name(&device->cdev->dev), 1227 sense->fmt.f71.md[1]);
1216 sense->fmt.f71.md[1]);
1217 else 1228 else
1218 PRINT_WARN("(%s): Repair will disable channel path " 1229 snprintf(service, BUFSIZE, "Repair will disable "
1219 "(0x%x-0x%x) on DV\n", 1230 "channel path (0x%x-0x%x) on DV",
1220 dev_name(&device->cdev->dev), 1231 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1221 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1222 break; 1232 break;
1223 case 0x04: 1233 case 0x04:
1224 if (sense->fmt.f71.mdf == 0) 1234 if (sense->fmt.f71.mdf == 0)
1225 PRINT_WARN("(%s): Repair will disable interface 0x%x " 1235 snprintf(service, BUFSIZE, "Repair will disable "
1226 "on DV\n", 1236 "interface 0x%x on DV", sense->fmt.f71.md[1]);
1227 dev_name(&device->cdev->dev),
1228 sense->fmt.f71.md[1]);
1229 else 1237 else
1230 PRINT_WARN("(%s): Repair will disable interfaces " 1238 snprintf(service, BUFSIZE, "Repair will disable "
1231 "(0x%x-0x%x) on DV\n", 1239 "interfaces (0x%x-0x%x) on DV",
1232 dev_name(&device->cdev->dev), 1240 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1233 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1234 break; 1241 break;
1235 case 0x05: 1242 case 0x05:
1236 if (sense->fmt.f71.mdf == 0) 1243 if (sense->fmt.f71.mdf == 0)
1237 PRINT_WARN("(%s): Repair will disable loader 0x%x " 1244 snprintf(service, BUFSIZE, "Repair will disable loader"
1238 "on DV\n", 1245 " 0x%x on DV", sense->fmt.f71.md[1]);
1239 dev_name(&device->cdev->dev),
1240 sense->fmt.f71.md[1]);
1241 else 1246 else
1242 PRINT_WARN("(%s): Repair will disable loader " 1247 snprintf(service, BUFSIZE, "Repair will disable loader"
1243 "(0x%x-0x%x) on DV\n", 1248 " (0x%x-0x%x) on DV",
1244 dev_name(&device->cdev->dev), 1249 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1245 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1246 break; 1250 break;
1247 case 0x07: 1251 case 0x07:
1248 PRINT_WARN("(%s): Repair will disable access to DV\n", 1252 snprintf(service, BUFSIZE, "Repair will disable access to DV");
1249 dev_name(&device->cdev->dev));
1250 break; 1253 break;
1251 case 0x08: 1254 case 0x08:
1252 if (sense->fmt.f71.mdf == 0) 1255 if (sense->fmt.f71.mdf == 0)
1253 PRINT_WARN("(%s): Repair will disable message " 1256 snprintf(service, BUFSIZE, "Repair will disable "
1254 "display 0x%x on DV\n", 1257 "message display 0x%x on DV",
1255 dev_name(&device->cdev->dev), 1258 sense->fmt.f71.md[1]);
1256 sense->fmt.f71.md[1]);
1257 else 1259 else
1258 PRINT_WARN("(%s): Repair will disable message " 1260 snprintf(service, BUFSIZE, "Repair will disable "
1259 "displays (0x%x-0x%x) on DV\n", 1261 "message displays (0x%x-0x%x) on DV",
1260 dev_name(&device->cdev->dev), 1262 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1261 sense->fmt.f71.md[1], sense->fmt.f71.md[2]);
1262 break; 1263 break;
1263 case 0x09: 1264 case 0x09:
1264 PRINT_WARN("(%s): Clean DV\n", dev_name(&device->cdev->dev)); 1265 snprintf(service, BUFSIZE, "Clean DV");
1265 break; 1266 break;
1266 default: 1267 default:
1267 PRINT_WARN("(%s): DSIM ServiceMsg: 0x%02x\n", 1268 snprintf(service, BUFSIZE, "0x%02x",
1268 dev_name(&device->cdev->dev), sense->fmt.f71.smc); 1269 sense->fmt.f71.smc);
1269 } 1270 }
1271
1272 dev_warn (&device->cdev->dev, "Device subsystem information: exception"
1273 " %s, service %s\n", exception, service);
1274out_nomem:
1275 kfree(exception);
1276 kfree(service);
1270} 1277}
1271 1278
1272/* 1279/*
@@ -1282,46 +1289,44 @@ tape_3590_print_era_msg(struct tape_device *device, struct irb *irb)
1282 return; 1289 return;
1283 if ((sense->mc > 0) && (sense->mc < TAPE_3590_MAX_MSG)) { 1290 if ((sense->mc > 0) && (sense->mc < TAPE_3590_MAX_MSG)) {
1284 if (tape_3590_msg[sense->mc] != NULL) 1291 if (tape_3590_msg[sense->mc] != NULL)
1285 PRINT_WARN("(%s): %s\n", dev_name(&device->cdev->dev), 1292 dev_warn (&device->cdev->dev, "The tape unit has "
1286 tape_3590_msg[sense->mc]); 1293 "issued sense message %s\n",
1287 else { 1294 tape_3590_msg[sense->mc]);
1288 PRINT_WARN("(%s): Message Code 0x%x\n", 1295 else
1289 dev_name(&device->cdev->dev), sense->mc); 1296 dev_warn (&device->cdev->dev, "The tape unit has "
1290 } 1297 "issued an unknown sense message code 0x%x\n",
1298 sense->mc);
1291 return; 1299 return;
1292 } 1300 }
1293 if (sense->mc == 0xf0) { 1301 if (sense->mc == 0xf0) {
1294 /* Standard Media Information Message */ 1302 /* Standard Media Information Message */
1295 PRINT_WARN("(%s): MIM SEV=%i, MC=%02x, ES=%x/%x, " 1303 dev_warn (&device->cdev->dev, "MIM SEV=%i, MC=%02x, ES=%x/%x, "
1296 "RC=%02x-%04x-%02x\n", dev_name(&device->cdev->dev), 1304 "RC=%02x-%04x-%02x\n", sense->fmt.f70.sev, sense->mc,
1297 sense->fmt.f70.sev, sense->mc, 1305 sense->fmt.f70.emc, sense->fmt.f70.smc,
1298 sense->fmt.f70.emc, sense->fmt.f70.smc, 1306 sense->fmt.f70.refcode, sense->fmt.f70.mid,
1299 sense->fmt.f70.refcode, sense->fmt.f70.mid, 1307 sense->fmt.f70.fid);
1300 sense->fmt.f70.fid);
1301 tape_3590_print_mim_msg_f0(device, irb); 1308 tape_3590_print_mim_msg_f0(device, irb);
1302 return; 1309 return;
1303 } 1310 }
1304 if (sense->mc == 0xf1) { 1311 if (sense->mc == 0xf1) {
1305 /* Standard I/O Subsystem Service Information Message */ 1312 /* Standard I/O Subsystem Service Information Message */
1306 PRINT_WARN("(%s): IOSIM SEV=%i, DEVTYPE=3590/%02x, " 1313 dev_warn (&device->cdev->dev, "IOSIM SEV=%i, DEVTYPE=3590/%02x,"
1307 "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n", 1314 " MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",
1308 dev_name(&device->cdev->dev), sense->fmt.f71.sev, 1315 sense->fmt.f71.sev, device->cdev->id.dev_model,
1309 device->cdev->id.dev_model, 1316 sense->mc, sense->fmt.f71.emc, sense->fmt.f71.smc,
1310 sense->mc, sense->fmt.f71.emc, 1317 sense->fmt.f71.refcode1, sense->fmt.f71.refcode2,
1311 sense->fmt.f71.smc, sense->fmt.f71.refcode1, 1318 sense->fmt.f71.refcode3);
1312 sense->fmt.f71.refcode2, sense->fmt.f71.refcode3);
1313 tape_3590_print_io_sim_msg_f1(device, irb); 1319 tape_3590_print_io_sim_msg_f1(device, irb);
1314 return; 1320 return;
1315 } 1321 }
1316 if (sense->mc == 0xf2) { 1322 if (sense->mc == 0xf2) {
1317 /* Standard Device Service Information Message */ 1323 /* Standard Device Service Information Message */
1318 PRINT_WARN("(%s): DEVSIM SEV=%i, DEVTYPE=3590/%02x, " 1324 dev_warn (&device->cdev->dev, "DEVSIM SEV=%i, DEVTYPE=3590/%02x"
1319 "MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n", 1325 ", MC=%02x, ES=%x/%x, REF=0x%04x-0x%04x-0x%04x\n",
1320 dev_name(&device->cdev->dev), sense->fmt.f71.sev, 1326 sense->fmt.f71.sev, device->cdev->id.dev_model,
1321 device->cdev->id.dev_model, 1327 sense->mc, sense->fmt.f71.emc, sense->fmt.f71.smc,
1322 sense->mc, sense->fmt.f71.emc, 1328 sense->fmt.f71.refcode1, sense->fmt.f71.refcode2,
1323 sense->fmt.f71.smc, sense->fmt.f71.refcode1, 1329 sense->fmt.f71.refcode3);
1324 sense->fmt.f71.refcode2, sense->fmt.f71.refcode3);
1325 tape_3590_print_dev_sim_msg_f2(device, irb); 1330 tape_3590_print_dev_sim_msg_f2(device, irb);
1326 return; 1331 return;
1327 } 1332 }
@@ -1329,8 +1334,8 @@ tape_3590_print_era_msg(struct tape_device *device, struct irb *irb)
1329 /* Standard Library Service Information Message */ 1334 /* Standard Library Service Information Message */
1330 return; 1335 return;
1331 } 1336 }
1332 PRINT_WARN("(%s): Device Message(%x)\n", 1337 dev_warn (&device->cdev->dev, "The tape unit has issued an unknown "
1333 dev_name(&device->cdev->dev), sense->mc); 1338 "sense message code %x\n", sense->mc);
1334} 1339}
1335 1340
1336static int tape_3590_crypt_error(struct tape_device *device, 1341static int tape_3590_crypt_error(struct tape_device *device,
@@ -1355,9 +1360,8 @@ static int tape_3590_crypt_error(struct tape_device *device,
1355 /* No connection to EKM */ 1360 /* No connection to EKM */
1356 return tape_3590_erp_basic(device, request, irb, -ENOTCONN); 1361 return tape_3590_erp_basic(device, request, irb, -ENOTCONN);
1357 1362
1358 PRINT_ERR("(%s): Unable to get encryption key from EKM\n", bus_id); 1363 dev_err (&device->cdev->dev, "The tape unit failed to obtain the "
1359 PRINT_ERR("(%s): CU=%02X DRIVE=%06X EKM=%02X:%04X\n", bus_id, cu_rc, 1364 "encryption key from EKM\n");
1360 drv_rc, ekm_rc1, ekm_rc2);
1361 1365
1362 return tape_3590_erp_basic(device, request, irb, -ENOKEY); 1366 return tape_3590_erp_basic(device, request, irb, -ENOKEY);
1363} 1367}
@@ -1443,8 +1447,6 @@ tape_3590_unit_check(struct tape_device *device, struct tape_request *request,
1443 * print additional msg since default msg 1447 * print additional msg since default msg
1444 * "device intervention" is not very meaningfull 1448 * "device intervention" is not very meaningfull
1445 */ 1449 */
1446 PRINT_WARN("(%s): Tape operation when medium not loaded\n",
1447 dev_name(&device->cdev->dev));
1448 tape_med_state_set(device, MS_UNLOADED); 1450 tape_med_state_set(device, MS_UNLOADED);
1449 tape_3590_schedule_work(device, TO_CRYPT_OFF); 1451 tape_3590_schedule_work(device, TO_CRYPT_OFF);
1450 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM); 1452 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM);
@@ -1490,19 +1492,13 @@ tape_3590_unit_check(struct tape_device *device, struct tape_request *request,
1490 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM); 1492 return tape_3590_erp_basic(device, request, irb, -ENOMEDIUM);
1491 1493
1492 case 0x6020: 1494 case 0x6020:
1493 PRINT_WARN("(%s): Cartridge of wrong type ?\n",
1494 dev_name(&device->cdev->dev));
1495 return tape_3590_erp_basic(device, request, irb, -EMEDIUMTYPE); 1495 return tape_3590_erp_basic(device, request, irb, -EMEDIUMTYPE);
1496 1496
1497 case 0x8011: 1497 case 0x8011:
1498 PRINT_WARN("(%s): Another host has reserved the tape device\n",
1499 dev_name(&device->cdev->dev));
1500 return tape_3590_erp_basic(device, request, irb, -EPERM); 1498 return tape_3590_erp_basic(device, request, irb, -EPERM);
1501 case 0x8013: 1499 case 0x8013:
1502 PRINT_WARN("(%s): Another host has privileged access to the " 1500 dev_warn (&device->cdev->dev, "A different host has privileged"
1503 "tape device\n", dev_name(&device->cdev->dev)); 1501 " access to the tape unit\n");
1504 PRINT_WARN("(%s): To solve the problem unload the current "
1505 "cartridge!\n", dev_name(&device->cdev->dev));
1506 return tape_3590_erp_basic(device, request, irb, -EPERM); 1502 return tape_3590_erp_basic(device, request, irb, -EPERM);
1507 default: 1503 default:
1508 return tape_3590_erp_basic(device, request, irb, -EIO); 1504 return tape_3590_erp_basic(device, request, irb, -EIO);
@@ -1552,9 +1548,7 @@ tape_3590_irq(struct tape_device *device, struct tape_request *request,
1552 } 1548 }
1553 1549
1554 DBF_EVENT(6, "xunknownirq\n"); 1550 DBF_EVENT(6, "xunknownirq\n");
1555 PRINT_ERR("Unexpected interrupt.\n"); 1551 tape_dump_sense_dbf(device, request, irb);
1556 PRINT_ERR("Current op is: %s", tape_op_verbose[request->op]);
1557 tape_dump_sense(device, request, irb);
1558 return TAPE_IO_STOP; 1552 return TAPE_IO_STOP;
1559} 1553}
1560 1554
@@ -1609,7 +1603,6 @@ tape_3590_setup_device(struct tape_device *device)
1609 if (rc) 1603 if (rc)
1610 goto fail_rdc_data; 1604 goto fail_rdc_data;
1611 if (rdc_data->data[31] == 0x13) { 1605 if (rdc_data->data[31] == 0x13) {
1612 PRINT_INFO("Device has crypto support\n");
1613 data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK; 1606 data->crypt_info.capability |= TAPE390_CRYPT_SUPPORTED_MASK;
1614 tape_3592_disable_crypt(device); 1607 tape_3592_disable_crypt(device);
1615 } else { 1608 } else {