aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2012-05-09 10:27:37 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-05-16 08:42:39 -0400
commit161beff8f40d83bb144b52f34cf966357162cdf1 (patch)
tree5d1cc43c53dbe32c82ef6acf322f9fd5a6ee65ce /drivers/s390/char
parentb2a68c235663c65365c4b4424c6e6c5ee90ae3a1 (diff)
s390/tape: remove tape block leftovers
Signed-off-by: Heiko Carstens <heiko.carstens@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.h43
-rw-r--r--drivers/s390/char/tape_34xx.c136
-rw-r--r--drivers/s390/char/tape_3590.c105
-rw-r--r--drivers/s390/char/tape_char.c13
-rw-r--r--drivers/s390/char/tape_core.c16
5 files changed, 2 insertions, 311 deletions
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index 267b54e8ff5a..bc6c7cfd36b6 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -154,12 +154,6 @@ struct tape_discipline {
154 struct tape_request *(*read_block)(struct tape_device *, size_t); 154 struct tape_request *(*read_block)(struct tape_device *, size_t);
155 struct tape_request *(*write_block)(struct tape_device *, size_t); 155 struct tape_request *(*write_block)(struct tape_device *, size_t);
156 void (*process_eov)(struct tape_device*); 156 void (*process_eov)(struct tape_device*);
157#ifdef CONFIG_S390_TAPE_BLOCK
158 /* Block device stuff. */
159 struct tape_request *(*bread)(struct tape_device *, struct request *);
160 void (*check_locate)(struct tape_device *, struct tape_request *);
161 void (*free_bread)(struct tape_request *);
162#endif
163 /* ioctl function for additional ioctls. */ 157 /* ioctl function for additional ioctls. */
164 int (*ioctl_fn)(struct tape_device *, unsigned int, unsigned long); 158 int (*ioctl_fn)(struct tape_device *, unsigned int, unsigned long);
165 /* Array of tape commands with TAPE_NR_MTOPS entries */ 159 /* Array of tape commands with TAPE_NR_MTOPS entries */
@@ -182,26 +176,6 @@ struct tape_char_data {
182 int block_size; /* of size block_size. */ 176 int block_size; /* of size block_size. */
183}; 177};
184 178
185#ifdef CONFIG_S390_TAPE_BLOCK
186/* Block Frontend Data */
187struct tape_blk_data
188{
189 struct tape_device * device;
190 /* Block device request queue. */
191 struct request_queue * request_queue;
192 spinlock_t request_queue_lock;
193
194 /* Task to move entries from block request to CCS request queue. */
195 struct work_struct requeue_task;
196 atomic_t requeue_scheduled;
197
198 /* Current position on the tape. */
199 long block_position;
200 int medium_changed;
201 struct gendisk * disk;
202};
203#endif
204
205/* Tape Info */ 179/* Tape Info */
206struct tape_device { 180struct tape_device {
207 /* entry in tape_device_list */ 181 /* entry in tape_device_list */
@@ -248,10 +222,6 @@ struct tape_device {
248 222
249 /* Character device frontend data */ 223 /* Character device frontend data */
250 struct tape_char_data char_data; 224 struct tape_char_data char_data;
251#ifdef CONFIG_S390_TAPE_BLOCK
252 /* Block dev frontend data */
253 struct tape_blk_data blk_data;
254#endif
255 225
256 /* Function to start or stop the next request later. */ 226 /* Function to start or stop the next request later. */
257 struct delayed_work tape_dnr; 227 struct delayed_work tape_dnr;
@@ -313,19 +283,6 @@ extern void tapechar_exit(void);
313extern int tapechar_setup_device(struct tape_device *); 283extern int tapechar_setup_device(struct tape_device *);
314extern void tapechar_cleanup_device(struct tape_device *); 284extern void tapechar_cleanup_device(struct tape_device *);
315 285
316/* Externals from tape_block.c */
317#ifdef CONFIG_S390_TAPE_BLOCK
318extern int tapeblock_init (void);
319extern void tapeblock_exit(void);
320extern int tapeblock_setup_device(struct tape_device *);
321extern void tapeblock_cleanup_device(struct tape_device *);
322#else
323static inline int tapeblock_init (void) {return 0;}
324static inline void tapeblock_exit (void) {;}
325static inline int tapeblock_setup_device(struct tape_device *t) {return 0;}
326static inline void tapeblock_cleanup_device (struct tape_device *t) {;}
327#endif
328
329/* tape initialisation functions */ 286/* tape initialisation functions */
330#ifdef CONFIG_PROC_FS 287#ifdef CONFIG_PROC_FS
331extern void tape_proc_init (void); 288extern void tape_proc_init (void);
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c
index 934ef33eb9a4..b28de80b7ca4 100644
--- a/drivers/s390/char/tape_34xx.c
+++ b/drivers/s390/char/tape_34xx.c
@@ -323,20 +323,6 @@ tape_34xx_unit_check(struct tape_device *device, struct tape_request *request,
323 inhibit_cu_recovery = (*device->modeset_byte & 0x80) ? 1 : 0; 323 inhibit_cu_recovery = (*device->modeset_byte & 0x80) ? 1 : 0;
324 sense = irb->ecw; 324 sense = irb->ecw;
325 325
326#ifdef CONFIG_S390_TAPE_BLOCK
327 if (request->op == TO_BLOCK) {
328 /*
329 * Recovery for block device requests. Set the block_position
330 * to something invalid and retry.
331 */
332 device->blk_data.block_position = -1;
333 if (request->retries-- <= 0)
334 return tape_34xx_erp_failed(request, -EIO);
335 else
336 return tape_34xx_erp_retry(request);
337 }
338#endif
339
340 if ( 326 if (
341 sense[0] & SENSE_COMMAND_REJECT && 327 sense[0] & SENSE_COMMAND_REJECT &&
342 sense[1] & SENSE_WRITE_PROTECT 328 sense[1] & SENSE_WRITE_PROTECT
@@ -1129,123 +1115,6 @@ tape_34xx_mtseek(struct tape_device *device, int mt_count)
1129 return tape_do_io_free(device, request); 1115 return tape_do_io_free(device, request);
1130} 1116}
1131 1117
1132#ifdef CONFIG_S390_TAPE_BLOCK
1133/*
1134 * Tape block read for 34xx.
1135 */
1136static struct tape_request *
1137tape_34xx_bread(struct tape_device *device, struct request *req)
1138{
1139 struct tape_request *request;
1140 struct ccw1 *ccw;
1141 int count = 0;
1142 unsigned off;
1143 char *dst;
1144 struct bio_vec *bv;
1145 struct req_iterator iter;
1146 struct tape_34xx_block_id * start_block;
1147
1148 DBF_EVENT(6, "xBREDid:");
1149
1150 /* Count the number of blocks for the request. */
1151 rq_for_each_segment(bv, req, iter)
1152 count += bv->bv_len >> (TAPEBLOCK_HSEC_S2B + 9);
1153
1154 /* Allocate the ccw request. */
1155 request = tape_alloc_request(3+count+1, 8);
1156 if (IS_ERR(request))
1157 return request;
1158
1159 /* Setup ccws. */
1160 request->op = TO_BLOCK;
1161 start_block = (struct tape_34xx_block_id *) request->cpdata;
1162 start_block->block = blk_rq_pos(req) >> TAPEBLOCK_HSEC_S2B;
1163 DBF_EVENT(6, "start_block = %i\n", start_block->block);
1164
1165 ccw = request->cpaddr;
1166 ccw = tape_ccw_cc(ccw, MODE_SET_DB, 1, device->modeset_byte);
1167
1168 /*
1169 * We always setup a nop after the mode set ccw. This slot is
1170 * used in tape_std_check_locate to insert a locate ccw if the
1171 * current tape position doesn't match the start block to be read.
1172 * The second nop will be filled with a read block id which is in
1173 * turn used by tape_34xx_free_bread to populate the segment bid
1174 * table.
1175 */
1176 ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
1177 ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
1178
1179 rq_for_each_segment(bv, req, iter) {
1180 dst = kmap(bv->bv_page) + bv->bv_offset;
1181 for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
1182 ccw->flags = CCW_FLAG_CC;
1183 ccw->cmd_code = READ_FORWARD;
1184 ccw->count = TAPEBLOCK_HSEC_SIZE;
1185 set_normalized_cda(ccw, (void*) __pa(dst));
1186 ccw++;
1187 dst += TAPEBLOCK_HSEC_SIZE;
1188 }
1189 }
1190
1191 ccw = tape_ccw_end(ccw, NOP, 0, NULL);
1192 DBF_EVENT(6, "xBREDccwg\n");
1193 return request;
1194}
1195
1196static void
1197tape_34xx_free_bread (struct tape_request *request)
1198{
1199 struct ccw1* ccw;
1200
1201 ccw = request->cpaddr;
1202 if ((ccw + 2)->cmd_code == READ_BLOCK_ID) {
1203 struct {
1204 struct tape_34xx_block_id cbid;
1205 struct tape_34xx_block_id dbid;
1206 } __attribute__ ((packed)) *rbi_data;
1207
1208 rbi_data = request->cpdata;
1209
1210 if (request->device)
1211 tape_34xx_add_sbid(request->device, rbi_data->cbid);
1212 }
1213
1214 /* Last ccw is a nop and doesn't need clear_normalized_cda */
1215 for (; ccw->flags & CCW_FLAG_CC; ccw++)
1216 if (ccw->cmd_code == READ_FORWARD)
1217 clear_normalized_cda(ccw);
1218 tape_free_request(request);
1219}
1220
1221/*
1222 * check_locate is called just before the tape request is passed to
1223 * the common io layer for execution. It has to check the current
1224 * tape position and insert a locate ccw if it doesn't match the
1225 * start block for the request.
1226 */
1227static void
1228tape_34xx_check_locate(struct tape_device *device, struct tape_request *request)
1229{
1230 struct tape_34xx_block_id * start_block;
1231
1232 start_block = (struct tape_34xx_block_id *) request->cpdata;
1233 if (start_block->block == device->blk_data.block_position)
1234 return;
1235
1236 DBF_LH(4, "Block seek(%06d+%06d)\n", start_block->block, device->bof);
1237 start_block->wrap = 0;
1238 start_block->segment = 1;
1239 start_block->format = (*device->modeset_byte & 0x08) ?
1240 TAPE34XX_FMT_3480_XF :
1241 TAPE34XX_FMT_3480;
1242 start_block->block = start_block->block + device->bof;
1243 tape_34xx_merge_sbid(device, start_block);
1244 tape_ccw_cc(request->cpaddr + 1, LOCATE, 4, request->cpdata);
1245 tape_ccw_cc(request->cpaddr + 2, READ_BLOCK_ID, 8, request->cpdata);
1246}
1247#endif
1248
1249/* 1118/*
1250 * List of 3480/3490 magnetic tape commands. 1119 * List of 3480/3490 magnetic tape commands.
1251 */ 1120 */
@@ -1295,11 +1164,6 @@ static struct tape_discipline tape_discipline_34xx = {
1295 .irq = tape_34xx_irq, 1164 .irq = tape_34xx_irq,
1296 .read_block = tape_std_read_block, 1165 .read_block = tape_std_read_block,
1297 .write_block = tape_std_write_block, 1166 .write_block = tape_std_write_block,
1298#ifdef CONFIG_S390_TAPE_BLOCK
1299 .bread = tape_34xx_bread,
1300 .free_bread = tape_34xx_free_bread,
1301 .check_locate = tape_34xx_check_locate,
1302#endif
1303 .ioctl_fn = tape_34xx_ioctl, 1167 .ioctl_fn = tape_34xx_ioctl,
1304 .mtop_array = tape_34xx_mtop 1168 .mtop_array = tape_34xx_mtop
1305}; 1169};
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 49c6aab7ad78..a5c6614b0db2 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -670,92 +670,6 @@ tape_3590_schedule_work(struct tape_device *device, enum tape_op op)
670 return 0; 670 return 0;
671} 671}
672 672
673#ifdef CONFIG_S390_TAPE_BLOCK
674/*
675 * Tape Block READ
676 */
677static struct tape_request *
678tape_3590_bread(struct tape_device *device, struct request *req)
679{
680 struct tape_request *request;
681 struct ccw1 *ccw;
682 int count = 0, start_block;
683 unsigned off;
684 char *dst;
685 struct bio_vec *bv;
686 struct req_iterator iter;
687
688 DBF_EVENT(6, "xBREDid:");
689 start_block = blk_rq_pos(req) >> TAPEBLOCK_HSEC_S2B;
690 DBF_EVENT(6, "start_block = %i\n", start_block);
691
692 rq_for_each_segment(bv, req, iter)
693 count += bv->bv_len >> (TAPEBLOCK_HSEC_S2B + 9);
694
695 request = tape_alloc_request(2 + count + 1, 4);
696 if (IS_ERR(request))
697 return request;
698 request->op = TO_BLOCK;
699 *(__u32 *) request->cpdata = start_block;
700 ccw = request->cpaddr;
701 ccw = tape_ccw_cc(ccw, MODE_SET_DB, 1, device->modeset_byte);
702
703 /*
704 * We always setup a nop after the mode set ccw. This slot is
705 * used in tape_std_check_locate to insert a locate ccw if the
706 * current tape position doesn't match the start block to be read.
707 */
708 ccw = tape_ccw_cc(ccw, NOP, 0, NULL);
709
710 rq_for_each_segment(bv, req, iter) {
711 dst = page_address(bv->bv_page) + bv->bv_offset;
712 for (off = 0; off < bv->bv_len; off += TAPEBLOCK_HSEC_SIZE) {
713 ccw->flags = CCW_FLAG_CC;
714 ccw->cmd_code = READ_FORWARD;
715 ccw->count = TAPEBLOCK_HSEC_SIZE;
716 set_normalized_cda(ccw, (void *) __pa(dst));
717 ccw++;
718 dst += TAPEBLOCK_HSEC_SIZE;
719 }
720 BUG_ON(off > bv->bv_len);
721 }
722 ccw = tape_ccw_end(ccw, NOP, 0, NULL);
723 DBF_EVENT(6, "xBREDccwg\n");
724 return request;
725}
726
727static void
728tape_3590_free_bread(struct tape_request *request)
729{
730 struct ccw1 *ccw;
731
732 /* Last ccw is a nop and doesn't need clear_normalized_cda */
733 for (ccw = request->cpaddr; ccw->flags & CCW_FLAG_CC; ccw++)
734 if (ccw->cmd_code == READ_FORWARD)
735 clear_normalized_cda(ccw);
736 tape_free_request(request);
737}
738
739/*
740 * check_locate is called just before the tape request is passed to
741 * the common io layer for execution. It has to check the current
742 * tape position and insert a locate ccw if it doesn't match the
743 * start block for the request.
744 */
745static void
746tape_3590_check_locate(struct tape_device *device, struct tape_request *request)
747{
748 __u32 *start_block;
749
750 start_block = (__u32 *) request->cpdata;
751 if (*start_block != device->blk_data.block_position) {
752 /* Add the start offset of the file to get the real block. */
753 *start_block += device->bof;
754 tape_ccw_cc(request->cpaddr + 1, LOCATE, 4, request->cpdata);
755 }
756}
757#endif
758
759static void tape_3590_med_state_set(struct tape_device *device, 673static void tape_3590_med_state_set(struct tape_device *device,
760 struct tape_3590_med_sense *sense) 674 struct tape_3590_med_sense *sense)
761{ 675{
@@ -1423,20 +1337,6 @@ tape_3590_unit_check(struct tape_device *device, struct tape_request *request,
1423{ 1337{
1424 struct tape_3590_sense *sense; 1338 struct tape_3590_sense *sense;
1425 1339
1426#ifdef CONFIG_S390_TAPE_BLOCK
1427 if (request->op == TO_BLOCK) {
1428 /*
1429 * Recovery for block device requests. Set the block_position
1430 * to something invalid and retry.
1431 */
1432 device->blk_data.block_position = -1;
1433 if (request->retries-- <= 0)
1434 return tape_3590_erp_failed(device, request, irb, -EIO);
1435 else
1436 return tape_3590_erp_retry(device, request, irb);
1437 }
1438#endif
1439
1440 sense = (struct tape_3590_sense *) irb->ecw; 1340 sense = (struct tape_3590_sense *) irb->ecw;
1441 1341
1442 DBF_EVENT(6, "Unit Check: RQC = %x\n", sense->rc_rqc); 1342 DBF_EVENT(6, "Unit Check: RQC = %x\n", sense->rc_rqc);
@@ -1729,11 +1629,6 @@ static struct tape_discipline tape_discipline_3590 = {
1729 .irq = tape_3590_irq, 1629 .irq = tape_3590_irq,
1730 .read_block = tape_std_read_block, 1630 .read_block = tape_std_read_block,
1731 .write_block = tape_std_write_block, 1631 .write_block = tape_std_write_block,
1732#ifdef CONFIG_S390_TAPE_BLOCK
1733 .bread = tape_3590_bread,
1734 .free_bread = tape_3590_free_bread,
1735 .check_locate = tape_3590_check_locate,
1736#endif
1737 .ioctl_fn = tape_3590_ioctl, 1632 .ioctl_fn = tape_3590_ioctl,
1738 .mtop_array = tape_3590_mtop 1633 .mtop_array = tape_3590_mtop
1739}; 1634};
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c
index 87cd0ab242de..46886a7578c6 100644
--- a/drivers/s390/char/tape_char.c
+++ b/drivers/s390/char/tape_char.c
@@ -161,11 +161,6 @@ tapechar_read(struct file *filp, char __user *data, size_t count, loff_t *ppos)
161 if (rc) 161 if (rc)
162 return rc; 162 return rc;
163 163
164#ifdef CONFIG_S390_TAPE_BLOCK
165 /* Changes position. */
166 device->blk_data.medium_changed = 1;
167#endif
168
169 DBF_EVENT(6, "TCHAR:nbytes: %lx\n", block_size); 164 DBF_EVENT(6, "TCHAR:nbytes: %lx\n", block_size);
170 /* Let the discipline build the ccw chain. */ 165 /* Let the discipline build the ccw chain. */
171 request = device->discipline->read_block(device, block_size); 166 request = device->discipline->read_block(device, block_size);
@@ -218,11 +213,6 @@ tapechar_write(struct file *filp, const char __user *data, size_t count, loff_t
218 if (rc) 213 if (rc)
219 return rc; 214 return rc;
220 215
221#ifdef CONFIG_S390_TAPE_BLOCK
222 /* Changes position. */
223 device->blk_data.medium_changed = 1;
224#endif
225
226 DBF_EVENT(6,"TCHAR:nbytes: %lx\n", block_size); 216 DBF_EVENT(6,"TCHAR:nbytes: %lx\n", block_size);
227 DBF_EVENT(6, "TCHAR:nblocks: %x\n", nblocks); 217 DBF_EVENT(6, "TCHAR:nblocks: %x\n", nblocks);
228 /* Let the discipline build the ccw chain. */ 218 /* Let the discipline build the ccw chain. */
@@ -379,9 +369,6 @@ __tapechar_ioctl(struct tape_device *device,
379 case MTBSFM: 369 case MTBSFM:
380 case MTFSFM: 370 case MTFSFM:
381 case MTSEEK: 371 case MTSEEK:
382#ifdef CONFIG_S390_TAPE_BLOCK
383 device->blk_data.medium_changed = 1;
384#endif
385 if (device->required_tapemarks) 372 if (device->required_tapemarks)
386 tape_std_terminate_write(device); 373 tape_std_terminate_write(device);
387 default: 374 default:
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index b3a3e8e8656e..585618663ba4 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -401,9 +401,6 @@ tape_generic_online(struct tape_device *device,
401 rc = tapechar_setup_device(device); 401 rc = tapechar_setup_device(device);
402 if (rc) 402 if (rc)
403 goto out_minor; 403 goto out_minor;
404 rc = tapeblock_setup_device(device);
405 if (rc)
406 goto out_char;
407 404
408 tape_state_set(device, TS_UNUSED); 405 tape_state_set(device, TS_UNUSED);
409 406
@@ -411,8 +408,6 @@ tape_generic_online(struct tape_device *device,
411 408
412 return 0; 409 return 0;
413 410
414out_char:
415 tapechar_cleanup_device(device);
416out_minor: 411out_minor:
417 tape_remove_minor(device); 412 tape_remove_minor(device);
418out_discipline: 413out_discipline:
@@ -426,7 +421,6 @@ out:
426static void 421static void
427tape_cleanup_device(struct tape_device *device) 422tape_cleanup_device(struct tape_device *device)
428{ 423{
429 tapeblock_cleanup_device(device);
430 tapechar_cleanup_device(device); 424 tapechar_cleanup_device(device);
431 device->discipline->cleanup_device(device); 425 device->discipline->cleanup_device(device);
432 module_put(device->discipline->owner); 426 module_put(device->discipline->owner);
@@ -785,10 +779,6 @@ __tape_start_io(struct tape_device *device, struct tape_request *request)
785{ 779{
786 int rc; 780 int rc;
787 781
788#ifdef CONFIG_S390_TAPE_BLOCK
789 if (request->op == TO_BLOCK)
790 device->discipline->check_locate(device, request);
791#endif
792 rc = ccw_device_start( 782 rc = ccw_device_start(
793 device->cdev, 783 device->cdev,
794 request->cpaddr, 784 request->cpaddr,
@@ -1253,7 +1243,7 @@ __tape_do_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
1253} 1243}
1254 1244
1255/* 1245/*
1256 * Tape device open function used by tape_char & tape_block frontends. 1246 * Tape device open function used by tape_char frontend.
1257 */ 1247 */
1258int 1248int
1259tape_open(struct tape_device *device) 1249tape_open(struct tape_device *device)
@@ -1283,7 +1273,7 @@ tape_open(struct tape_device *device)
1283} 1273}
1284 1274
1285/* 1275/*
1286 * Tape device release function used by tape_char & tape_block frontends. 1276 * Tape device release function used by tape_char frontend.
1287 */ 1277 */
1288int 1278int
1289tape_release(struct tape_device *device) 1279tape_release(struct tape_device *device)
@@ -1344,7 +1334,6 @@ tape_init (void)
1344 DBF_EVENT(3, "tape init\n"); 1334 DBF_EVENT(3, "tape init\n");
1345 tape_proc_init(); 1335 tape_proc_init();
1346 tapechar_init (); 1336 tapechar_init ();
1347 tapeblock_init ();
1348 return 0; 1337 return 0;
1349} 1338}
1350 1339
@@ -1358,7 +1347,6 @@ tape_exit(void)
1358 1347
1359 /* Get rid of the frontends */ 1348 /* Get rid of the frontends */
1360 tapechar_exit(); 1349 tapechar_exit();
1361 tapeblock_exit();
1362 tape_proc_cleanup(); 1350 tape_proc_cleanup();
1363 debug_unregister (TAPE_DBF_AREA); 1351 debug_unregister (TAPE_DBF_AREA);
1364} 1352}