patch-2.4.8 linux/drivers/s390/char/tape34xx.c
Next file: linux/drivers/s390/char/tape34xx.h
Previous file: linux/drivers/s390/char/tape3490.h
Back to the patch index
Back to the overall index
- Lines: 2464
- Date:
Wed Jul 25 14:12:02 2001
- Orig file:
v2.4.7/linux/drivers/s390/char/tape34xx.c
- Orig date:
Wed Apr 11 19:02:28 2001
diff -u --recursive --new-file v2.4.7/linux/drivers/s390/char/tape34xx.c linux/drivers/s390/char/tape34xx.c
@@ -82,13 +82,13 @@
}
ccw_req_t *
-tape34xx_write_block (const char *data, size_t count, tape_info_t * tape)
+tape34xx_write_block (const char *data, size_t count, tape_info_t * ti)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
void *mem;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xwbl nomem");
@@ -115,7 +115,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = WRITE_CMD;
@@ -127,11 +127,11 @@
tape_free_request (cqr);
return NULL;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = mem;
- tape->userbuf = (void *) data;
- tapestate_set (tape, TS_WRI_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = mem;
+ ti->userbuf = (void *) data;
+ tapestate_set (ti, TS_WRI_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xwbl ccwg");
#endif /* TAPE_DEBUG */
@@ -139,31 +139,31 @@
}
void
-tape34xx_free_write_block (ccw_req_t * cqr, tape_info_t * tape)
+tape34xx_free_write_block (ccw_req_t * cqr, tape_info_t * ti)
{
unsigned long lockflags;
ccw1_t *ccw;
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
ccw = cqr->cpaddr;
ccw++;
clear_normalized_cda (ccw);
- kfree (tape->kernbuf);
+ kfree (ti->kernbuf);
tape_free_request (cqr);
- tape->kernbuf = tape->userbuf = NULL;
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ ti->kernbuf = ti->userbuf = NULL;
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xfwb free");
#endif /* TAPE_DEBUG */
}
ccw_req_t *
-tape34xx_read_block (const char *data, size_t count, tape_info_t * tape)
+tape34xx_read_block (const char *data, size_t count, tape_info_t * ti)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
void *mem;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xrbl nomem");
@@ -182,7 +182,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = READ_FORWARD;
@@ -194,24 +194,25 @@
tape_free_request (cqr);
return NULL;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = mem;
- tape->userbuf = (void *) data;
- tapestate_set (tape, TS_RFO_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = mem;
+ ti->userbuf = (void *) data;
+ tapestate_set (ti, TS_RFO_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xrbl ccwg");
#endif /* TAPE_DEBUG */
return cqr;
}
+
ccw_req_t *
-tape34xx_read_opposite (tape_info_t * tape,int novalue)
+tape34xx_read_opposite (tape_info_t * ti,int novalue)
{
ccw_req_t *cqr;
ccw1_t *ccw;
size_t count;
// first, retrieve the count from the old cqr.
- cqr = tape->cqr;
+ cqr = ti->cqr;
ccw = cqr->cpaddr;
ccw++;
count=ccw->count;
@@ -219,7 +220,7 @@
clear_normalized_cda (ccw);
tape_free_request (cqr);
// build new cqr
- cqr = tape_alloc_ccw_req (tape, 3, 0);
+ cqr = tape_alloc_ccw_req (ti, 3, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xrop nomem");
@@ -230,13 +231,13 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = READ_BACKWARD;
ccw->flags = CCW_FLAG_CC;
ccw->count = count;
- set_normalized_cda (ccw, (unsigned long) tape->kernbuf);
+ set_normalized_cda (ccw, (unsigned long) ti->kernbuf);
if ((ccw->cda) == 0) {
tape_free_request (cqr);
return NULL;
@@ -251,7 +252,7 @@
ccw->flags = 0;
ccw->count = 1;
ccw->cda = (unsigned long)ccw;
- tapestate_set (tape, TS_RBA_INIT);
+ tapestate_set (ti, TS_RBA_INIT);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xrop ccwg");
#endif /* TAPE_DEBUG */
@@ -259,27 +260,27 @@
}
void
-tape34xx_free_read_block (ccw_req_t * cqr, tape_info_t * tape)
+tape34xx_free_read_block (ccw_req_t * cqr, tape_info_t * ti)
{
unsigned long lockflags;
size_t cpysize;
ccw1_t *ccw;
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
ccw = cqr->cpaddr;
ccw++;
- cpysize = ccw->count - tape->devstat.rescnt;
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
- if (copy_to_user (tape->userbuf, tape->kernbuf, cpysize)) {
+ cpysize = ccw->count - ti->devstat.rescnt;
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
+ if (copy_to_user (ti->userbuf, ti->kernbuf, cpysize)) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xfrb segf.");
#endif /* TAPE_DEBUG */
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
clear_normalized_cda (ccw);
- kfree (tape->kernbuf);
+ kfree (ti->kernbuf);
tape_free_request (cqr);
- tape->kernbuf = tape->userbuf = NULL;
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ ti->kernbuf = ti->userbuf = NULL;
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xfrb free");
#endif /* TAPE_DEBUG */
@@ -294,7 +295,7 @@
* at the EOT (End of Tape) side of the file mark.
*/
ccw_req_t *
-tape34xx_mtfsf (tape_info_t * tape, int count)
+tape34xx_mtfsf (tape_info_t * ti, int count)
{
long lockflags;
int i;
@@ -306,7 +307,7 @@
#endif /* TAPE_DEBUG */
return NULL;
}
- cqr = tape_alloc_ccw_req (tape, 2 + count, 0);
+ cqr = tape_alloc_ccw_req (ti, 2 + count, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xfsf nomem");
@@ -317,7 +318,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
for (i = 0; i < count; i++) {
ccw->cmd_code = FORSPACEFILE;
@@ -330,11 +331,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_FSF_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_FSF_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xfsf ccwg");
#endif /* TAPE_DEBUG */
@@ -346,7 +347,7 @@
* the EOT (End of Tape) side of the last skipped file mark.
*/
ccw_req_t *
-tape34xx_mtbsf (tape_info_t * tape, int count)
+tape34xx_mtbsf (tape_info_t * ti, int count)
{
long lockflags;
int i;
@@ -358,7 +359,7 @@
#endif /* TAPE_DEBUG */
return NULL;
}
- cqr = tape_alloc_ccw_req (tape, 2 + count, 0);
+ cqr = tape_alloc_ccw_req (ti, 2 + count, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xbsf nomem");
@@ -369,7 +370,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
for (i = 0; i < count; i++) {
ccw->cmd_code = BACKSPACEFILE;
@@ -382,11 +383,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_BSF_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_BSF_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xbsf ccwg");
#endif /* TAPE_DEBUG */
@@ -398,7 +399,7 @@
* via MTSETBLK.
*/
ccw_req_t *
-tape34xx_mtfsr (tape_info_t * tape, int count)
+tape34xx_mtfsr (tape_info_t * ti, int count)
{
long lockflags;
int i;
@@ -410,7 +411,7 @@
#endif /* TAPE_DEBUG */
return NULL;
}
- cqr = tape_alloc_ccw_req (tape, 2 + count, 0);
+ cqr = tape_alloc_ccw_req (ti, 2 + count, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xfsr nomem");
@@ -421,7 +422,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
for (i = 0; i < count; i++) {
ccw->cmd_code = FORSPACEBLOCK;
@@ -434,11 +435,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_FSB_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_FSB_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xfsr ccwgen");
#endif /* TAPE_DEBUG */
@@ -450,7 +451,7 @@
* (blocksize is set via MTSETBLK.
*/
ccw_req_t *
-tape34xx_mtbsr (tape_info_t * tape, int count)
+tape34xx_mtbsr (tape_info_t * ti, int count)
{
long lockflags;
int i;
@@ -462,7 +463,7 @@
#endif /* TAPE_DEBUG */
return NULL;
}
- cqr = tape_alloc_ccw_req (tape, 2 + count, 0);
+ cqr = tape_alloc_ccw_req (ti, 2 + count, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xbsr nomem");
@@ -473,7 +474,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
for (i = 0; i < count; i++) {
ccw->cmd_code = BACKSPACEBLOCK;
@@ -486,11 +487,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_BSB_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_BSB_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xbsr ccwg");
#endif /* TAPE_DEBUG */
@@ -501,7 +502,7 @@
* MTWEOF: Write 'count' file marks at the current position.
*/
ccw_req_t *
-tape34xx_mtweof (tape_info_t * tape, int count)
+tape34xx_mtweof (tape_info_t * ti, int count)
{
long lockflags;
int i;
@@ -513,7 +514,7 @@
#endif /* TAPE_DEBUG */
return NULL;
}
- cqr = tape_alloc_ccw_req (tape, 2 + count, 0);
+ cqr = tape_alloc_ccw_req (ti, 2 + count, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xweo nomem");
@@ -524,7 +525,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
for (i = 0; i < count; i++) {
ccw->cmd_code = WRITETAPEMARK;
@@ -538,11 +539,11 @@
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
ccw++;
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_WTM_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_WTM_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xweo ccwg");
#endif /* TAPE_DEBUG */
@@ -553,12 +554,12 @@
* MTREW: Rewind the tape.
*/
ccw_req_t *
-tape34xx_mtrew (tape_info_t * tape, int count)
+tape34xx_mtrew (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 3, 0);
+ cqr = tape_alloc_ccw_req (ti, 3, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xrew nomem");
@@ -569,7 +570,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = REWIND;
ccw->flags = CCW_FLAG_CC;
@@ -580,11 +581,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_REW_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_REW_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xrew ccwg");
#endif /* TAPE_DEBUG */
@@ -596,12 +597,12 @@
* Implement 'rewind unload'
*/
ccw_req_t *
-tape34xx_mtoffl (tape_info_t * tape, int count)
+tape34xx_mtoffl (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 3, 32);
+ cqr = tape_alloc_ccw_req (ti, 3, 32);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xoff nomem");
@@ -612,7 +613,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = REWIND_UNLOAD;
ccw->flags = CCW_FLAG_CC;
@@ -623,11 +624,11 @@
ccw->flags = 0;
ccw->count = 32;
ccw->cda = (unsigned long) cqr->cpaddr;
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_RUN_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_RUN_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xoff ccwg");
#endif /* TAPE_DEBUG */
@@ -638,12 +639,12 @@
* MTNOP: 'No operation'.
*/
ccw_req_t *
-tape34xx_mtnop (tape_info_t * tape, int count)
+tape34xx_mtnop (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 1, 0);
+ cqr = tape_alloc_ccw_req (ti, 1, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xnop nomem");
@@ -655,11 +656,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) ccw->cmd_code;
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xnop ccwg");
#endif /* TAPE_DEBUG */
@@ -672,7 +673,7 @@
* last skipped file mark.
*/
ccw_req_t *
-tape34xx_mtbsfm (tape_info_t * tape, int count)
+tape34xx_mtbsfm (tape_info_t * ti, int count)
{
long lockflags;
int i;
@@ -684,7 +685,7 @@
#endif /* TAPE_DEBUG */
return NULL;
}
- cqr = tape_alloc_ccw_req (tape, 2 + count, 0);
+ cqr = tape_alloc_ccw_req (ti, 2 + count, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xbsm nomem");
@@ -695,7 +696,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
for (i = 0; i < count; i++) {
ccw->cmd_code = BACKSPACEFILE;
@@ -708,11 +709,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_BSF_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_BSF_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xbsm ccwg");
#endif /* TAPE_DEBUG */
@@ -725,7 +726,7 @@
* of the last skipped file mark.
*/
ccw_req_t *
-tape34xx_mtfsfm (tape_info_t * tape, int count)
+tape34xx_mtfsfm (tape_info_t * ti, int count)
{
long lockflags;
int i;
@@ -737,7 +738,7 @@
#endif /* TAPE_DEBUG */
return NULL;
}
- cqr = tape_alloc_ccw_req (tape, 2 + count, 0);
+ cqr = tape_alloc_ccw_req (ti, 2 + count, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xfsm nomem");
@@ -748,7 +749,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
for (i = 0; i < count; i++) {
ccw->cmd_code = FORSPACEFILE;
@@ -761,11 +762,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_FSF_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_FSF_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xfsm ccwg");
#endif /* TAPE_DEBUG */
@@ -779,12 +780,12 @@
* MTRETEN: Retension the tape, i.e. forward space to end of tape and rewind.
*/
ccw_req_t *
-tape34xx_mteom (tape_info_t * tape, int count)
+tape34xx_mteom (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 4, 0);
+ cqr = tape_alloc_ccw_req (ti, 4, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xeom nomem");
@@ -795,7 +796,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = FORSPACEFILE;
ccw->flags = CCW_FLAG_CC;
@@ -811,11 +812,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (cqr->cpaddr);
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_FSF_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_FSF_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xeom ccwg");
#endif /* TAPE_DEBUG */
@@ -826,12 +827,12 @@
* MTERASE: erases the tape.
*/
ccw_req_t *
-tape34xx_mterase (tape_info_t * tape, int count)
+tape34xx_mterase (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 5, 0);
+ cqr = tape_alloc_ccw_req (ti, 5, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xera nomem");
@@ -842,7 +843,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = REWIND;
ccw->flags = CCW_FLAG_CC;
@@ -863,11 +864,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_DSE_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_DSE_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xera ccwg");
#endif /* TAPE_DEBUG */
@@ -878,12 +879,12 @@
* MTSETDENSITY: set tape density.
*/
ccw_req_t *
-tape34xx_mtsetdensity (tape_info_t * tape, int count)
+tape34xx_mtsetdensity (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xden nomem");
@@ -894,17 +895,17 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = NOP;
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xden ccwg");
#endif /* TAPE_DEBUG */
@@ -915,7 +916,7 @@
* MTSEEK: seek to the specified block.
*/
ccw_req_t *
-tape34xx_mtseek (tape_info_t * tape, int count)
+tape34xx_mtseek (tape_info_t * ti, int count)
{
long lockflags;
__u8 *data;
@@ -936,7 +937,7 @@
kfree(data);
return NULL;
}
- if (((tape34xx_disc_data_t *) tape->discdata)->modeset_byte & 0x08) // IDRC on
+ if (((tape34xx_disc_data_t *) ti->discdata)->modeset_byte & 0x08) // IDRC on
data[1] = data[1] | 0x80;
data[3] += count % 256;
@@ -946,7 +947,7 @@
debug_text_event (tape_debug_area,6,"xsee id:");
debug_int_event (tape_debug_area,6,count);
#endif /* TAPE_DEBUG */
- cqr = tape_alloc_ccw_req (tape, 3, 0);
+ cqr = tape_alloc_ccw_req (ti, 3, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xsee nomem");
@@ -958,7 +959,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = LOCATE;
ccw->flags = CCW_FLAG_CC;
@@ -969,11 +970,11 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = data;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_LBL_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = data;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_LBL_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xsee ccwg");
#endif /* TAPE_DEBUG */
@@ -984,13 +985,13 @@
* MTTELL: Tell block. Return the number of block relative to current file.
*/
ccw_req_t *
-tape34xx_mttell (tape_info_t * tape, int count)
+tape34xx_mttell (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
void *mem;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xtel nomem");
@@ -1009,18 +1010,18 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = READ_BLOCK_ID;
ccw->flags = 0;
ccw->count = 8;
set_normalized_cda (ccw, (unsigned long) mem);
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = mem;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_RBI_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = mem;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_RBI_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xtel ccwg");
#endif /* TAPE_DEBUG */
@@ -1032,12 +1033,12 @@
* Implement NOP.
*/
ccw_req_t *
-tape34xx_mtsetdrvbuffer (tape_info_t * tape, int count)
+tape34xx_mtsetdrvbuffer (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xbuf nomem");
@@ -1048,17 +1049,17 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = NOP;
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xbuf ccwg");
#endif /* TAPE_DEBUG */
@@ -1070,12 +1071,12 @@
* Implement NOP CCW command.
*/
ccw_req_t *
-tape34xx_mtlock (tape_info_t * tape, int count)
+tape34xx_mtlock (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xloc nomem");
@@ -1086,17 +1087,17 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = NOP;
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xloc ccwg");
#endif /* TAPE_DEBUG */
@@ -1108,12 +1109,12 @@
* Implement the NOP CCW command.
*/
ccw_req_t *
-tape34xx_mtunlock (tape_info_t * tape, int count)
+tape34xx_mtunlock (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xulk nomem");
@@ -1124,17 +1125,17 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = NOP;
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xulk ccwg");
#endif /* TAPE_DEBUG */
@@ -1143,52 +1144,25 @@
/*
* MTLOAD: Loads the tape.
- * Implement the NOP CCW command.
+ * This function is not implemented and returns NULL, which causes the Frontend to wait for a medium being loaded.
+ * The 3480/3490 type Tapes do not support a load command
*/
ccw_req_t *
-tape34xx_mtload (tape_info_t * tape, int count)
+tape34xx_mtload (tape_info_t * ti, int count)
{
- long lockflags;
- ccw_req_t *cqr;
- ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
- if (!cqr) {
-#ifdef TAPE_DEBUG
- debug_text_exception (tape_debug_area,6,"xloa nomem");
-#endif /* TAPE_DEBUG */
- return NULL;
- }
- ccw = cqr->cpaddr;
- ccw->cmd_code = MODE_SET_DB;
- ccw->flags = CCW_FLAG_CC;
- ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
- ccw++;
- ccw->cmd_code = NOP;
- ccw->flags = 0;
- ccw->count = 0;
- ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
-#ifdef TAPE_DEBUG
- debug_text_event (tape_debug_area,6,"xloa ccwg");
-#endif /* TAPE_DEBUG */
- return cqr;
+ return NULL;
}
/*
* MTUNLOAD: Rewind the tape and unload it.
*/
ccw_req_t *
-tape34xx_mtunload (tape_info_t * tape, int count)
+tape34xx_mtunload (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 3, 32);
+ cqr = tape_alloc_ccw_req (ti, 3, 32);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xunl nomem");
@@ -1199,7 +1173,7 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = REWIND_UNLOAD;
ccw->flags = CCW_FLAG_CC;
@@ -1210,11 +1184,11 @@
ccw->flags = 0;
ccw->count = 32;
ccw->cda = (unsigned long) cqr->cpaddr;
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_RUN_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_RUN_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xunl ccwg");
#endif /* TAPE_DEBUG */
@@ -1226,7 +1200,7 @@
* Sets the IDRC on/off.
*/
ccw_req_t *
-tape34xx_mtcompression (tape_info_t * tape, int count)
+tape34xx_mtcompression (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
@@ -1238,12 +1212,12 @@
return NULL;
}
if (count == 0)
- ((tape34xx_disc_data_t *) tape->discdata)->modeset_byte = 0x00; // IDRC off
+ ((tape34xx_disc_data_t *) ti->discdata)->modeset_byte = 0x00; // IDRC off
else
- ((tape34xx_disc_data_t *) tape->discdata)->modeset_byte = 0x08; // IDRC on
+ ((tape34xx_disc_data_t *) ti->discdata)->modeset_byte = 0x08; // IDRC on
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xcom nomem");
@@ -1254,17 +1228,17 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = NOP;
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xcom ccwg");
#endif /* TAPE_DEBUG */
@@ -1276,12 +1250,12 @@
* Implement the NOP CCW command.
*/
ccw_req_t *
-tape34xx_mtsetpart (tape_info_t * tape, int count)
+tape34xx_mtsetpart (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xspa nomem");
@@ -1292,17 +1266,17 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = NOP;
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xspa ccwg");
#endif /* TAPE_DEBUG */
@@ -1314,12 +1288,12 @@
* Implement the NOP CCW command.
*/
ccw_req_t *
-tape34xx_mtmkpart (tape_info_t * tape, int count)
+tape34xx_mtmkpart (tape_info_t * ti, int count)
{
long lockflags;
ccw_req_t *cqr;
ccw1_t *ccw;
- cqr = tape_alloc_ccw_req (tape, 2, 0);
+ cqr = tape_alloc_ccw_req (ti, 2, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xnpa nomem");
@@ -1330,17 +1304,17 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
ccw++;
ccw->cmd_code = NOP;
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->kernbuf = NULL;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_NOP_INIT);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->kernbuf = NULL;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_NOP_INIT);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xnpa ccwg");
#endif /* TAPE_DEBUG */
@@ -1351,7 +1325,7 @@
* MTIOCGET: query the tape drive status.
*/
ccw_req_t *
-tape34xx_mtiocget (tape_info_t * tape, int count)
+tape34xx_mtiocget (tape_info_t * ti, int count)
{
return NULL;
}
@@ -1360,22 +1334,22 @@
* MTIOCPOS: query the tape position.
*/
ccw_req_t *
-tape34xx_mtiocpos (tape_info_t * tape, int count)
+tape34xx_mtiocpos (tape_info_t * ti, int count)
{
return NULL;
}
-ccw_req_t * tape34xx_bread (struct request *req,tape_info_t* tape,int tapeblock_major) {
+ccw_req_t * tape34xx_bread (struct request *req,tape_info_t* ti,int tapeblock_major) {
ccw_req_t *cqr;
ccw1_t *ccw;
__u8 *data;
- int s2b = blksize_size[tapeblock_major][tape->blk_minor]/hardsect_size[tapeblock_major][tape->blk_minor];
+ int s2b = blksize_size[tapeblock_major][ti->blk_minor]/hardsect_size[tapeblock_major][ti->blk_minor];
int realcount;
int size,bhct = 0;
struct buffer_head* bh;
for (bh = req->bh; bh; bh = bh->b_reqnext) {
- if (bh->b_size > blksize_size[tapeblock_major][tape->blk_minor])
- for (size = 0; size < bh->b_size; size += blksize_size[tapeblock_major][tape->blk_minor])
+ if (bh->b_size > blksize_size[tapeblock_major][ti->blk_minor])
+ for (size = 0; size < bh->b_size; size += blksize_size[tapeblock_major][ti->blk_minor])
bhct++;
else
bhct++;
@@ -1389,7 +1363,7 @@
data[0] = 0x01;
data[1] = data[2] = data[3] = 0x00;
realcount=req->sector/s2b;
- if (((tape34xx_disc_data_t *) tape->discdata)->modeset_byte & 0x08) // IDRC on
+ if (((tape34xx_disc_data_t *) ti->discdata)->modeset_byte & 0x08) // IDRC on
data[1] = data[1] | 0x80;
data[3] += realcount % 256;
@@ -1399,7 +1373,7 @@
debug_text_event (tape_debug_area,6,"xBREDid:");
debug_int_event (tape_debug_area,6,realcount);
#endif /* TAPE_DEBUG */
- cqr = tape_alloc_ccw_req (tape, 2+bhct+1, 0);
+ cqr = tape_alloc_ccw_req (ti, 2+bhct+1, 0);
if (!cqr) {
#ifdef TAPE_DEBUG
debug_text_exception (tape_debug_area,6,"xBREDnomem");
@@ -1411,28 +1385,28 @@
ccw->cmd_code = MODE_SET_DB;
ccw->flags = CCW_FLAG_CC;
ccw->count = 1;
- set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)));
- if (realcount!=tape->position) {
+ set_normalized_cda (ccw, (unsigned long) (&(((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)));
+ if (realcount!=ti->position) {
ccw++;
ccw->cmd_code = LOCATE;
ccw->flags = CCW_FLAG_CC;
ccw->count = 4;
set_normalized_cda (ccw, (unsigned long) data);
}
- tape->position=realcount+req->nr_sectors/s2b;
+ ti->position=realcount+req->nr_sectors/s2b;
for (bh=req->bh;bh!=NULL;) {
ccw->flags = CCW_FLAG_CC;
- if (bh->b_size >= blksize_size[tapeblock_major][tape->blk_minor]) {
- for (size = 0; size < bh->b_size; size += blksize_size[tapeblock_major][tape->blk_minor]) {
+ if (bh->b_size >= blksize_size[tapeblock_major][ti->blk_minor]) {
+ for (size = 0; size < bh->b_size; size += blksize_size[tapeblock_major][ti->blk_minor]) {
ccw++;
ccw->flags = CCW_FLAG_CC;
ccw->cmd_code = READ_FORWARD;
- ccw->count = blksize_size[tapeblock_major][tape->blk_minor];
+ ccw->count = blksize_size[tapeblock_major][ti->blk_minor];
set_normalized_cda (ccw, __pa (bh->b_data + size));
}
bh = bh->b_reqnext;
} else { /* group N bhs to fit into byt_per_blk */
- for (size = 0; bh != NULL && size < blksize_size[tapeblock_major][tape->blk_minor];) {
+ for (size = 0; bh != NULL && size < blksize_size[tapeblock_major][ti->blk_minor];) {
ccw++;
ccw->flags = CCW_FLAG_DC;
ccw->cmd_code = READ_FORWARD;
@@ -1441,10 +1415,10 @@
size += bh->b_size;
bh = bh->b_reqnext;
}
- if (size != blksize_size[tapeblock_major][tape->blk_minor]) {
+ if (size != blksize_size[tapeblock_major][ti->blk_minor]) {
PRINT_WARN ("Cannot fulfill small request %d vs. %d (%ld sects)\n",
size,
- blksize_size[tapeblock_major][tape->blk_minor],
+ blksize_size[tapeblock_major][ti->blk_minor],
req->nr_sectors);
kfree(data);
tape_free_request (cqr);
@@ -1459,15 +1433,15 @@
ccw->flags = 0;
ccw->count = 0;
ccw->cda = (unsigned long) (&(ccw->cmd_code));
- tape->kernbuf = data;
- tape->userbuf = NULL;
- tapestate_set (tape, TS_BLOCK_INIT);
+ ti->kernbuf = data;
+ ti->userbuf = NULL;
+ tapestate_set (ti, TS_BLOCK_INIT);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xBREDccwg");
#endif /* TAPE_DEBUG */
return cqr;
}
-void tape34xx_free_bread (ccw_req_t* cqr,struct _tape_info_t* tape) {
+void tape34xx_free_bread (ccw_req_t* cqr,struct _tape_info_t* ti) {
ccw1_t* ccw;
for (ccw=(ccw1_t*)cqr->cpaddr;(ccw->flags & CCW_FLAG_CC)||(ccw->flags & CCW_FLAG_DC);ccw++)
if ((ccw->cmd_code == MODE_SET_DB) ||
@@ -1475,49 +1449,60 @@
(ccw->cmd_code == READ_FORWARD))
clear_normalized_cda(ccw);
tape_free_request(cqr);
- kfree(tape->kernbuf);
- tape->kernbuf=NULL;
+ kfree(ti->kernbuf);
+ ti->kernbuf=NULL;
}
/* event handlers */
void
-tape34xx_default_handler (tape_info_t * tape)
+tape34xx_default_handler (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"xdefhandle");
#endif /* TAPE_DEBUG */
- tapestate_set (tape, TS_FAILED);
PRINT_ERR ("TAPE34XX: An unexpected Unit Check occurred.\n");
PRINT_ERR ("TAPE34XX: Please read Documentation/s390/TAPE and report it!\n");
PRINT_ERR ("TAPE34XX: Current state is: %s",
- (((tapestate_get (tape) < TS_SIZE) && (tapestate_get (tape) >= 0)) ?
- state_verbose[tapestate_get (tape)] : "->UNKNOWN STATE<-"));
- tape_dump_sense (&tape->devstat);
- tape->rc = -EIO;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ (((tapestate_get (ti) < TS_SIZE) && (tapestate_get (ti) >= 0)) ?
+ state_verbose[tapestate_get (ti)] : "->UNKNOWN STATE<-"));
+ tape_dump_sense (&ti->devstat);
+ ti->rc = -EIO;
+ ti->wanna_wakeup=1;
+ switch (tapestate_get(ti)) {
+ case TS_REW_RELEASE_INIT:
+ tapestate_set(ti,TS_FAILED);
+ wake_up (&ti->wq);
+ break;
+ case TS_BLOCK_INIT:
+ tapestate_set(ti,TS_FAILED);
+ schedule_tapeblock_exec_IO(ti);
+ break;
+ default:
+ tapestate_set(ti,TS_FAILED);
+ wake_up_interruptible (&ti->wq);
+ }
}
void
-tape34xx_unexpect_uchk_handler (tape_info_t * tape)
+tape34xx_unexpect_uchk_handler (tape_info_t * ti)
{
- if ((tape->devstat.ii.sense.data[0] == 0x40) &&
- (tape->devstat.ii.sense.data[1] == 0x40) &&
- (tape->devstat.ii.sense.data[3] == 0x43)) {
+ if ((ti->devstat.ii.sense.data[0] == 0x40) &&
+ (ti->devstat.ii.sense.data[1] == 0x40) &&
+ (ti->devstat.ii.sense.data[3] == 0x43)) {
// no tape in the drive
- PRINT_INFO ("Drive %d not ready. No volume loaded.\n", tape->rew_minor / 2);
+ PRINT_INFO ("Drive %d not ready. No volume loaded.\n", ti->rew_minor / 2);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"xuuh nomed");
#endif /* TAPE_DEBUG */
- tapestate_set (tape, TS_FAILED);
- tape->rc = -ENOMEDIUM;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
- } else if ((tape->devstat.ii.sense.data[0] == 0x42) &&
- (tape->devstat.ii.sense.data[1] == 0x44) &&
- (tape->devstat.ii.sense.data[3] == 0x3b)) {
+ tapestate_set (ti, TS_FAILED);
+ ti->rc = -ENOMEDIUM;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
+ } else if ((ti->devstat.ii.sense.data[0] == 0x42) &&
+ (ti->devstat.ii.sense.data[1] == 0x44) &&
+ (ti->devstat.ii.sense.data[3] == 0x3b)) {
PRINT_INFO ("Media in drive %d was changed!\n",
- tape->rew_minor / 2);
+ ti->rew_minor / 2);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"xuuh medchg");
#endif
@@ -1526,261 +1511,273 @@
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"xuuh unexp");
debug_text_event (tape_debug_area,3,"state:");
- debug_text_event (tape_debug_area,3,((tapestate_get (tape) < TS_SIZE) &&
- (tapestate_get (tape) >= 0)) ?
- state_verbose[tapestate_get (tape)] :
+ debug_text_event (tape_debug_area,3,((tapestate_get (ti) < TS_SIZE) &&
+ (tapestate_get (ti) >= 0)) ?
+ state_verbose[tapestate_get (ti)] :
"TS UNKNOWN");
#endif /* TAPE_DEBUG */
- tape34xx_default_handler (tape);
+ tape34xx_default_handler (ti);
}
}
void
-tape34xx_unused_done (tape_info_t * tape)
+tape34xx_unused_done (tape_info_t * ti)
{
- if ((tape->devstat.ii.sense.data[0] == 0x40) &&
- (tape->devstat.ii.sense.data[1] == 0x40) &&
- (tape->devstat.ii.sense.data[3] == 0x43)) {
- // A medium was inserted in the drive!
+ if (ti->medium_is_unloaded) {
+ // A medium was inserted in the drive!
#ifdef TAPE_DEBUG
- debug_text_event (tape_debug_area,6,"xuud med");
+ debug_text_event (tape_debug_area,6,"xuui med");
#endif /* TAPE_DEBUG */
- } else {
+ PRINT_WARN ("A medium was inserted into the tape.\n");
+ ti->medium_is_unloaded=0;
+ } else {
#ifdef TAPE_DEBUG
- debug_text_event (tape_debug_area,3,"unsol.irq!");
- debug_text_event (tape_debug_area,3,"dev end");
- debug_int_exception (tape_debug_area,3,tape->devinfo.irq);
+ debug_text_event (tape_debug_area,3,"unsol.irq!");
+ debug_text_event (tape_debug_area,3,"dev end");
+ debug_int_exception (tape_debug_area,3,ti->devinfo.irq);
#endif /* TAPE_DEBUG */
- PRINT_WARN ("Unsolicited IRQ (Device End) caught in unused state.\n");
- tape_dump_sense (&tape->devstat);
- }
+ PRINT_WARN ("Unsolicited IRQ (Device End) caught in unused state.\n");
+ tape_dump_sense (&ti->devstat);
+ }
}
void
-tape34xx_idle_done (tape_info_t * tape)
+tape34xx_idle_done (tape_info_t * ti)
{
+ if (ti->medium_is_unloaded) {
+ // A medium was inserted in the drive!
+#ifdef TAPE_DEBUG
+ debug_text_event (tape_debug_area,6,"xuud med");
+#endif /* TAPE_DEBUG */
+ PRINT_WARN ("A medium was inserted into the tape.\n");
+ ti->medium_is_unloaded=0;
+ wake_up_interruptible (&ti->wq);
+ } else {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"unsol.irq!");
debug_text_event (tape_debug_area,3,"dev end");
- debug_int_exception (tape_debug_area,3,tape->devinfo.irq);
+ debug_int_exception (tape_debug_area,3,ti->devinfo.irq);
#endif /* TAPE_DEBUG */
PRINT_WARN ("Unsolicited IRQ (Device End) caught in idle state.\n");
- tape_dump_sense (&tape->devstat);
+ tape_dump_sense (&ti->devstat);
+ }
}
void
-tape34xx_block_done (tape_info_t * tape)
+tape34xx_block_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"x:bREQdone");
#endif /* TAPE_DEBUG */
- tapestate_set(tape,TS_DONE);
- schedule_tapeblock_exec_IO(tape);
+ tapestate_set(ti,TS_DONE);
+ schedule_tapeblock_exec_IO(ti);
}
void
-tape34xx_bsf_init_done (tape_info_t * tape)
+tape34xx_bsf_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"bsf done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_dse_init_done (tape_info_t * tape)
+tape34xx_dse_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"dse done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_fsf_init_done (tape_info_t * tape)
+tape34xx_fsf_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"fsf done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_fsb_init_done (tape_info_t * tape)
+tape34xx_fsb_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"fsb done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_bsb_init_done (tape_info_t * tape)
+tape34xx_bsb_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"bsb done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_lbl_init_done (tape_info_t * tape)
+tape34xx_lbl_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"lbl done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
//s390irq_spin_unlock(tape->devinfo.irq);
- tape->wanna_wakeup=1;
- wake_up (&tape->wq);
+ ti->wanna_wakeup=1;
+ wake_up (&ti->wq);
}
void
-tape34xx_nop_init_done (tape_info_t * tape)
+tape34xx_nop_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"nop done..");
debug_text_exception (tape_debug_area,6,"or rew/rel");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
//s390irq_spin_unlock(tape->devinfo.irq);
- tape->wanna_wakeup=1;
- wake_up (&tape->wq);
+ ti->wanna_wakeup=1;
+ wake_up (&ti->wq);
}
void
-tape34xx_rfo_init_done (tape_info_t * tape)
+tape34xx_rfo_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"rfo done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_rbi_init_done (tape_info_t * tape)
+tape34xx_rbi_init_done (tape_info_t * ti)
{
__u8 *data;
+#ifdef TAPE_DEBUG
int i;
- tapestate_set (tape, TS_FAILED);
- data = tape->kernbuf;
- tape->rc = data[3];
- tape->rc += 256 * data[2];
- tape->rc += 65536 * (data[1] & 0x3F);
+#endif
+ tapestate_set (ti, TS_FAILED);
+ data = ti->kernbuf;
+ ti->rc = data[3];
+ ti->rc += 256 * data[2];
+ ti->rc += 65536 * (data[1] & 0x3F);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"rbi done");
debug_text_event (tape_debug_area,6,"data:");
for (i=0;i<8;i++)
debug_int_event (tape_debug_area,6,data[i]);
#endif
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_rew_init_done (tape_info_t * tape)
+tape34xx_rew_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"rew done");
#endif
//BH: use irqsave
//s390irq_spin_lock(tape->devinfo.irq);
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
//s390irq_spin_unlock(tape->devinfo.irq);
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_rew_release_init_done (tape_info_t * tape)
+tape34xx_rew_release_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"rewR done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
//s390irq_spin_unlock(tape->devinfo.irq);
- tape->wanna_wakeup=1;
- wake_up (&tape->wq);
+ ti->wanna_wakeup=1;
+ wake_up (&ti->wq);
}
void
-tape34xx_run_init_done (tape_info_t * tape)
+tape34xx_run_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"rew done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_wri_init_done (tape_info_t * tape)
+tape34xx_wri_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"wri done");
#endif
//BH: use irqsave
- //s390irq_spin_lock(tape->devinfo.irq);
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- //s390irq_spin_unlock(tape->devinfo.irq);
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ //s390irq_spin_lock(ti->devinfo.irq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ //s390irq_spin_unlock(ti->devinfo.irq);
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
void
-tape34xx_wtm_init_done (tape_info_t * tape)
+tape34xx_wtm_init_done (tape_info_t * ti)
{
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"wtm done");
#endif
- tapestate_set (tape, TS_DONE);
- tape->rc = 0;
- tape->wanna_wakeup=1;
- wake_up_interruptible (&tape->wq);
+ tapestate_set (ti, TS_DONE);
+ ti->rc = 0;
+ ti->wanna_wakeup=1;
+ wake_up_interruptible (&ti->wq);
}
/* This function analyses the tape's sense-data in case of a unit-check. If possible,
it tries to recover from the error. Else the user is informed about the problem. */
void
-tape34xx_error_recovery (tape_info_t* tape)
+tape34xx_error_recovery (tape_info_t* ti)
{
- __u8* sense=tape->devstat.ii.sense.data;
+ __u8* sense=ti->devstat.ii.sense.data;
int inhibit_cu_recovery=0;
- int cu_type=tape->discipline->cu_type;
- if ((((tape34xx_disc_data_t *) tape->discdata)->modeset_byte)&0x80) inhibit_cu_recovery=1;
- if (tapestate_get(tape)==TS_BLOCK_INIT) {
+ int cu_type=ti->discipline->cu_type;
+ if ((((tape34xx_disc_data_t *) ti->discdata)->modeset_byte)&0x80) inhibit_cu_recovery=1;
+ if (tapestate_get(ti)==TS_BLOCK_INIT) {
// no recovery for block device, bottom half will retry...
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
}
if (sense[0]&SENSE_COMMAND_REJECT)
- switch (tapestate_get(tape)) {
+ switch (tapestate_get(ti)) {
case TS_BLOCK_INIT:
case TS_DSE_INIT:
case TS_EGA_INIT:
@@ -1788,33 +1785,33 @@
case TS_WTM_INIT:
if (sense[1]&SENSE_WRITE_PROTECT) {
// trying to write, but medium is write protected
- tape34xx_error_recovery_has_failed(tape,EACCES);
+ tape34xx_error_recovery_has_failed(ti,EACCES);
return;
}
default:
- tape34xx_error_recovery_HWBUG(tape,1);
+ tape34xx_error_recovery_HWBUG(ti,1);
return;
}
// special cases for various tape-states when reaching end of recorded area
if (((sense[0]==0x08) || (sense[0]==0x10) || (sense[0]==0x12)) &&
((sense[1]==0x40) || (sense[1]==0x0c)))
- switch (tapestate_get(tape)) {
+ switch (tapestate_get(ti)) {
case TS_FSF_INIT:
// Trying to seek beyond end of recorded area
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case TS_LBL_INIT:
// Block could not be located.
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case TS_RFO_INIT:
// Try to read beyond end of recorded area -> 0 bytes read
- tape34xx_error_recovery_has_failed(tape,0);
+ tape34xx_error_recovery_has_failed(ti,0);
return;
}
// Sensing special bits
if (sense[0]&SENSE_BUS_OUT_CHECK) {
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
}
if (sense[0]&SENSE_DATA_CHECK) {
@@ -1826,12 +1823,12 @@
(inhibit_cu_recovery)) {
// data check is not permanent, may be recovered.
// We always use async-mode with cu-recovery, so this should *never* happen.
- tape34xx_error_recovery_HWBUG(tape,2);
+ tape34xx_error_recovery_HWBUG(ti,2);
return;
} else {
// data check is permanent, CU recovery has failed
PRINT_WARN("Permanent read error, recovery failed!\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
}
case 0x25:
@@ -1840,38 +1837,38 @@
(inhibit_cu_recovery)) {
// data check is not permanent, may be recovered.
// We always use async-mode with cu-recovery, so this should *never* happen.
- tape34xx_error_recovery_HWBUG(tape,3);
+ tape34xx_error_recovery_HWBUG(ti,3);
return;
} else {
// data check is permanent, cu-recovery has failed
PRINT_WARN("Permanent write error, recovery failed!\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
}
case 0x26:
// Data Check (read opposite) occurred. We'll recover this.
- tape34xx_error_recovery_read_opposite(tape);
+ tape34xx_error_recovery_read_opposite(ti);
return;
case 0x28:
// The ID-Mark at the beginning of the tape could not be written. This is fatal, we'll report and exit.
PRINT_WARN("ID-Mark could not be written. Check your hardware!\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x31:
// Tape void. Tried to read beyond end of device. We'll report and exit.
PRINT_WARN("Try to read beyond end of recorded area!\n");
- tape34xx_error_recovery_has_failed(tape,ENOSPC);
+ tape34xx_error_recovery_has_failed(ti,ENOSPC);
return;
case 0x41:
// Record sequence error. cu detected incorrect block-id sequence on tape. We'll report and exit.
PRINT_WARN("Illegal block-id sequence found!\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
default:
// well, all data checks for 3480 should result in one of the above erpa-codes. if not -> bug
// On 3490, other data-check conditions do exist.
if (cu_type==0x3480) {
- tape34xx_error_recovery_HWBUG(tape,4);
+ tape34xx_error_recovery_HWBUG(ti,4);
return;
}
}
@@ -1881,11 +1878,11 @@
switch (sense[3]) {
case 0x40: // overrun error
PRINT_WARN ("Data overrun error between control-unit and drive. Use a faster channel connection, if possible! \n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
default:
// Overrun bit is set, but erpa does not show overrun error. This is a bug.
- tape34xx_error_recovery_HWBUG(tape,5);
+ tape34xx_error_recovery_HWBUG(ti,5);
return;
}
}
@@ -1894,11 +1891,11 @@
case 0x41:
// Record sequence error. cu detected incorrect block-id sequence on tape. We'll report and exit.
PRINT_WARN("Illegal block-id sequence found!\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
default:
// Record sequence error bit is set, but erpa does not show record sequence error. This is a bug.
- tape34xx_error_recovery_HWBUG(tape,6);
+ tape34xx_error_recovery_HWBUG(ti,6);
return;
}
}
@@ -1911,119 +1908,119 @@
case 0x21:
// Data streaming not operational. Cu switches to interlock mode, we reissue the command.
PRINT_WARN ("Data streaming not operational. Switching to interlock-mode! \n");
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x22:
// Path equipment check. Might be drive adapter error, buffer error on the lower interface, internal path not useable, or error during cartridge load.
// All of the above are not recoverable
PRINT_WARN ("A path equipment check occurred. One of the following conditions occurred:\n");
PRINT_WARN ("drive adapter error,buffer error on the lower interface, internal path not useable, error during cartridge load.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x23:
// Read data check. Should have been be covered earlier -> Bug!
- tape34xx_error_recovery_HWBUG(tape,7);
+ tape34xx_error_recovery_HWBUG(ti,7);
return;
case 0x24:
// Load display check. Load display was command was issued, but the drive is displaying a drive check message. Can be threated as "device end".
- tape34xx_error_recovery_succeded(tape);
+ tape34xx_error_recovery_succeded(ti);
return;
case 0x25:
// Write data check. Should have been covered earlier -> Bug!
- tape34xx_error_recovery_HWBUG(tape,8);
+ tape34xx_error_recovery_HWBUG(ti,8);
return;
case 0x26:
// Data check (read opposite). Should have been covered earlier -> Bug!
- tape34xx_error_recovery_HWBUG(tape,9);
+ tape34xx_error_recovery_HWBUG(ti,9);
return;
case 0x27:
// Command reject. May indicate illegal channel program or buffer over/underrun.
// Since all channel programms are issued by this driver and ought be correct,
// we assume a over/underrun situaltion and retry the channel program.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x28:
// Write id mark check. Should have beed covered earlier -> bug!
- tape34xx_error_recovery_HWBUG(tape,10);
+ tape34xx_error_recovery_HWBUG(ti,10);
return;
case 0x29:
// Function incompatible. Either idrc is on but hardware not capable doing idrc
// or a perform subsystem func is issued and the cu is not online. Anyway, this
// cannot be recovered and is an I/O error.
PRINT_WARN ("Function incompatible. Try to switch off idrc! \n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x2a:
// Unsolicited environmental data. An internal counter overflows, we can ignore
// this and reissue the cmd.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x2b:
// Environmental data present. Indicates either unload completed ok or read buffered
// log command completed ok.
- if (tapestate_get(tape)==TS_RUN_INIT) {
+ if (tapestate_get(ti)==TS_RUN_INIT) {
// Rewind unload completed ok.
- tape34xx_error_recovery_succeded(tape);
+ tape34xx_error_recovery_succeded(ti);
return;
}
// Since we do not issue read buffered log commands, this should never occur -> bug.
- tape34xx_error_recovery_HWBUG(tape,11);
+ tape34xx_error_recovery_HWBUG(ti,11);
return;
case 0x2c:
// Permanent equipment check. cu has tried recovery, but did not succeed. This is an
// I/O error.
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x2d:
// Data security erase failure.
- if (tapestate_get(tape)==TS_DSE_INIT) {
+ if (tapestate_get(ti)==TS_DSE_INIT) {
// report an I/O error
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
}
// Data security erase failure, but no such command issued. This is a bug.
- tape34xx_error_recovery_HWBUG(tape,12);
+ tape34xx_error_recovery_HWBUG(ti,12);
return;
case 0x2e:
// Not capable. This indicates either that the drive fails reading the format id mark
// or that that format specified is not supported by the drive. We write a message and
// return an I/O error.
PRINT_WARN("Drive not capable processing the tape format!");
- tape34xx_error_recovery_has_failed(tape,EMEDIUMTYPE);
+ tape34xx_error_recovery_has_failed(ti,EMEDIUMTYPE);
return;
case 0x2f:
// This erpa is reserved. This is a bug.
- tape34xx_error_recovery_HWBUG(tape,13);
+ tape34xx_error_recovery_HWBUG(ti,13);
return;
case 0x30:
// The medium is write protected, while trying to write on it. We'll report this.
PRINT_WARN("Medium is write protected!\n");
- tape34xx_error_recovery_has_failed(tape,EACCES);
+ tape34xx_error_recovery_has_failed(ti,EACCES);
return;
case 0x31:
// Tape void. Should have beed covered ealier -> bug
- tape34xx_error_recovery_HWBUG(tape,14);
+ tape34xx_error_recovery_HWBUG(ti,14);
return;
case 0x32:
// Tension loss. We cannot recover this, it's an I/O error.
PRINT_WARN("The drive lost tape tension.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x33:
// Load Failure. The catridge was not inserted correctly or the tape is not threaded
// correctly. We cannot recover this, the user has to reload the catridge.
PRINT_WARN("Cartridge load failure. Reload the cartridge and try again.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x34:
// Unload failure. The drive cannot maintain tape tension and control tape movement
// during an unload operation.
PRINT_WARN("Failure during cartridge unload. Please try manually.\n");
- if (tapestate_get(tape)!=TS_RUN_INIT) {
- tape34xx_error_recovery_HWBUG(tape,15);
+ if (tapestate_get(ti)!=TS_RUN_INIT) {
+ tape34xx_error_recovery_HWBUG(ti,15);
return;
}
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x35:
// Drive equipment check. One of the following:
@@ -2032,335 +2029,335 @@
// - the cartridge loader does not respond correctly
// - a failure occurs during an index, load, or unload cycle
PRINT_WARN("Equipment check! Please check the drive and the cartridge loader.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x36:
switch (cu_type) {
case 0x3480:
// This erpa is reserved for 3480 -> BUG
- tape34xx_error_recovery_HWBUG(tape,16);
+ tape34xx_error_recovery_HWBUG(ti,16);
return;
case 0x3490:
// End of data. This is a permanent I/O error, which cannot be recovered.
// A read-type command has reached the end-of-data mark.
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
}
case 0x37:
// Tape length error. The tape is shorter than reported in the beginning-of-tape data.
PRINT_WARN("Tape length error.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x38:
// Physical end of tape. A read/write operation reached the physical end of tape.
- if (tapestate_get(tape)==TS_WRI_INIT) {
- tape34xx_error_recovery_has_failed(tape,ENOSPC);
+ if (tapestate_get(ti)==TS_WRI_INIT) {
+ tape34xx_error_recovery_has_failed(ti,ENOSPC);
}
return;
case 0x39:
// Backward at BOT. The drive is at BOT and is requestet to move backward.
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x3a:
// Drive switched not ready, but the command needs the drive to be ready.
PRINT_WARN("Drive not ready. Turn the ready/not ready switch to ready position and try again.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x3b:
// Manual rewind or unload. This causes an I/O error.
- PRINT_WARN("Medium is rewinded or unloaded manually.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ PRINT_WARN("Medium was rewound or unloaded manually. Expect errors! Please do only use the mtoffl and mtrew ioctl to unload tapes or rewind tapes.\n");
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x3c:
case 0x3d:
case 0x3e:
case 0x3f:
// These erpas are reserved -> BUG
- tape34xx_error_recovery_HWBUG(tape,17);
+ tape34xx_error_recovery_HWBUG(ti,17);
return;
case 0x40:
// Overrun error. This should have been covered earlier -> bug.
- tape34xx_error_recovery_HWBUG(tape,18);
+ tape34xx_error_recovery_HWBUG(ti,18);
return;
case 0x41:
// Record sequence error. This should have been covered earlier -> bug.
- tape34xx_error_recovery_HWBUG(tape,19);
+ tape34xx_error_recovery_HWBUG(ti,19);
return;
case 0x42:
// Degraded mode. A condition that can cause degraded performace is detected.
PRINT_WARN("Subsystem is running in degraded mode. This may compromise your performace.\n");
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x43:
// Drive not ready. Probably swith the ready/not ready switch to ready?
PRINT_WARN("The drive is not ready. Maybe no medium in?\n");
- tape34xx_error_recovery_has_failed(tape,ENOMEDIUM);
+ tape34xx_error_recovery_has_failed(ti,ENOMEDIUM);
return;
case 0x44:
// Locate Block unsuccessfull. We'll report this.
- if ((tapestate_get(tape)!=TS_BLOCK_INIT) &&
- (tapestate_get(tape)!=TS_LBL_INIT)) {
- tape34xx_error_recovery_HWBUG(tape,20); // No locate block was issued...
+ if ((tapestate_get(ti)!=TS_BLOCK_INIT) &&
+ (tapestate_get(ti)!=TS_LBL_INIT)) {
+ tape34xx_error_recovery_HWBUG(ti,20); // No locate block was issued...
return;
}
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x45:
// The drive is assigned elsewhere [to a different channel path/computer].
PRINT_WARN("The drive is assigned elsewhere.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x46:
// Drive not online. Drive may be switched offline, the power supply may be switched off
// or the drive address may not be set correctly.
PRINT_WARN("The drive is not online.");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x47:
// Volume fenced. cu reports volume integrity is lost!
PRINT_WARN("Volume fenced. The volume integrity is lost! \n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x48:
// Log sense data and retry request. We'll do so...
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x49:
// Bus out check. A parity check error on the bus was found. PRINT_WARN("Bus out check. A data transfer over the bus was corrupted.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x4a:
// Control unit erp failed. We'll report this.
PRINT_WARN("The control unit failed recovering an I/O error.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x4b:
// Cu and drive incompatible. The drive requests micro-program patches, which are not available on the cu.
PRINT_WARN("The drive needs microprogram patches from the control unit, which are not available.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x4c:
// Recovered Check-One failure. Cu develops a hardware error, but is able to recover. We'll reissue the command.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x4d:
switch (cu_type) {
case 0x3480:
// This erpa is reserved for 3480 -> bug
- tape34xx_error_recovery_HWBUG(tape,21);
+ tape34xx_error_recovery_HWBUG(ti,21);
return;
case 0x3490:
// Resetting event recieved. Since the driver does not support resetting event recovery
// (which has to be handled by the I/O Layer), we'll report and retry our command.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
}
case 0x4e:
switch (cu_type) {
case 0x3480:
// This erpa is reserved for 3480 -> bug.
- tape34xx_error_recovery_HWBUG(tape,22);
+ tape34xx_error_recovery_HWBUG(ti,22);
return;
case 0x3490:
// Maximum block size exeeded. This indicates, that the block to be written is larger
// than allowed for buffered mode. We'll report this...
PRINT_WARN("Maximum block size for buffered mode exceeded.\n");
- tape34xx_error_recovery_has_failed(tape,ENOBUFS);
+ tape34xx_error_recovery_has_failed(ti,ENOBUFS);
return;
}
case 0x4f:
// These erpas are reserved -> bug
- tape34xx_error_recovery_HWBUG(tape,23);
+ tape34xx_error_recovery_HWBUG(ti,23);
return;
case 0x50:
// Read buffered log (Overflow). Cu is running in extended beffered log mode, and a counter overflows.
// This should never happen, since we're never running in extended buffered log mode -> bug.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x51:
// Read buffered log (EOV). EOF processing occurs while the cu is in extended buffered log mode.
// This should never happen, since we're never running in extended buffered log mode -> bug.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x52:
// End of Volume complete. Rewind unload completed ok. We'll report to the user...
- if (tapestate_get(tape)!=TS_RUN_INIT) {
- tape34xx_error_recovery_HWBUG(tape,24);
+ if (tapestate_get(ti)!=TS_RUN_INIT) {
+ tape34xx_error_recovery_HWBUG(ti,24);
return;
}
- tape34xx_error_recovery_succeded(tape);
+ tape34xx_error_recovery_succeded(ti);
return;
case 0x53:
// Global command intercept. We'll have to reissue our command.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x54:
// Channel interface recovery (temporary). This can be recovered by reissuing the command.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x55:
// Channel interface recovery (permanent). This cannot be recovered, we'll inform the user.
PRINT_WARN("A permanent channel interface error occurred.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x56:
// Channel protocol error. This cannot be recovered.
PRINT_WARN("A channel protocol error occurred.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x57:
switch (cu_type) {
case 0x3480:
// Attention intercept. We have to reissue the command.
PRINT_WARN("An attention intercept occurred, which will be recovered.\n");
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
case 0x3490:
// Global status intercept. We have to reissue the command.
PRINT_WARN("An global status intercept was recieved, which will be recovered.\n");
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
}
case 0x58:
case 0x59:
// These erpas are reserved -> bug.
- tape34xx_error_recovery_HWBUG(tape,25);
+ tape34xx_error_recovery_HWBUG(ti,25);
return;
case 0x5a:
// Tape length incompatible. The tape inserted is too long,
// which could cause damage to the tape or the drive.
PRINT_WARN("Tape length incompatible [should be IBM Cartridge System Tape]. May cause damage to drive or tape.n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x5b:
// Format 3480 XF incompatible
if (sense[1]&SENSE_BEGINNING_OF_TAPE) {
// Everything is fine. The tape will be overwritten in a different format.
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
return;
}
PRINT_WARN("Tape format is incompatible to the drive, which writes 3480-2 XF.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x5c:
// Format 3480-2 XF incompatible
PRINT_WARN("Tape format is incompatible to the drive. The drive cannot access 3480-2 XF volumes.\n");
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
return;
case 0x5d:
// Tape length violation.
PRINT_WARN("Tape length violation [should be IBM Enhanced Capacity Cartridge System Tape]. May cause damage to drive or tape.\n");
- tape34xx_error_recovery_has_failed(tape,EMEDIUMTYPE);
+ tape34xx_error_recovery_has_failed(ti,EMEDIUMTYPE);
return;
case 0x5e:
// Compaction algorithm incompatible.
PRINT_WARN("The volume is recorded using an incompatible compaction algorith, which is not supported by the control unit.\n");
- tape34xx_error_recovery_has_failed(tape,EMEDIUMTYPE);
+ tape34xx_error_recovery_has_failed(ti,EMEDIUMTYPE);
return;
default:
// Reserved erpas -> bug
- tape34xx_error_recovery_HWBUG(tape,26);
+ tape34xx_error_recovery_HWBUG(ti,26);
return;
}
}
-void tape34xx_error_recovery_has_failed (tape_info_t* tape,int error_id) {
+void tape34xx_error_recovery_has_failed (tape_info_t* ti,int error_id) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"xerp fail");
- debug_text_event (tape_debug_area,3,(((tapestate_get (tape) < TS_SIZE) &&
- (tapestate_get (tape) >= 0)) ?
- state_verbose[tapestate_get (tape)] : "UNKNOWN"));
+ debug_text_event (tape_debug_area,3,(((tapestate_get (ti) < TS_SIZE) &&
+ (tapestate_get (ti) >= 0)) ?
+ state_verbose[tapestate_get (ti)] : "UNKNOWN"));
#endif
- if ((tapestate_get(tape)!=TS_UNUSED) && (tapestate_get(tape)!=TS_IDLE)) {
- tape_dump_sense(&tape->devstat);
- tape->rc = -error_id;
- tape->wanna_wakeup=1;
- switch (tapestate_get(tape)) {
+ if ((tapestate_get(ti)!=TS_UNUSED) && (tapestate_get(ti)!=TS_IDLE)) {
+ tape_dump_sense(&ti->devstat);
+ ti->rc = -error_id;
+ ti->wanna_wakeup=1;
+ switch (tapestate_get(ti)) {
case TS_REW_RELEASE_INIT:
- tapestate_set(tape,TS_FAILED);
- wake_up (&tape->wq);
+ tapestate_set(ti,TS_FAILED);
+ wake_up (&ti->wq);
break;
case TS_BLOCK_INIT:
- tapestate_set(tape,TS_FAILED);
- schedule_tapeblock_exec_IO(tape);
+ tapestate_set(ti,TS_FAILED);
+ schedule_tapeblock_exec_IO(ti);
break;
default:
- tapestate_set(tape,TS_FAILED);
- wake_up_interruptible (&tape->wq);
+ tapestate_set(ti,TS_FAILED);
+ wake_up_interruptible (&ti->wq);
}
} else {
PRINT_WARN("Recieved an unsolicited IRQ.\n");
- tape_dump_sense(&tape->devstat);
+ tape_dump_sense(&ti->devstat);
}
}
-void tape34xx_error_recovery_succeded(tape_info_t* tape) {
+void tape34xx_error_recovery_succeded(tape_info_t* ti) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"xerp done");
- debug_text_event (tape_debug_area,3,(((tapestate_get (tape) < TS_SIZE) &&
- (tapestate_get (tape) >= 0)) ?
- state_verbose[tapestate_get (tape)] : "UNKNOWN"));
+ debug_text_event (tape_debug_area,3,(((tapestate_get (ti) < TS_SIZE) &&
+ (tapestate_get (ti) >= 0)) ?
+ state_verbose[tapestate_get (ti)] : "UNKNOWN"));
#endif
- if ((tapestate_get(tape)!=TS_UNUSED) && (tapestate_get(tape)!=TS_DONE)) {
- tapestate_event (tape, TE_DONE);
+ if ((tapestate_get(ti)!=TS_UNUSED) && (tapestate_get(ti)!=TS_DONE)) {
+ tapestate_event (ti, TE_DONE);
} else {
PRINT_WARN("Recieved an unsolicited IRQ.\n");
- tape_dump_sense(&tape->devstat);
+ tape_dump_sense(&ti->devstat);
}
}
-void tape34xx_error_recovery_do_retry(tape_info_t* tape) {
+void tape34xx_error_recovery_do_retry(tape_info_t* ti) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"xerp retr");
- debug_text_event (tape_debug_area,3,(((tapestate_get (tape) < TS_SIZE) &&
- (tapestate_get (tape) >= 0)) ?
- state_verbose[tapestate_get (tape)] : "UNKNOWN"));
+ debug_text_event (tape_debug_area,3,(((tapestate_get (ti) < TS_SIZE) &&
+ (tapestate_get (ti) >= 0)) ?
+ state_verbose[tapestate_get (ti)] : "UNKNOWN"));
#endif
- if ((tapestate_get(tape)!=TS_UNUSED) && (tapestate_get(tape)!=TS_IDLE)) {
- tape_dump_sense(&tape->devstat);
- while (do_IO (tape->devinfo.irq, tape->cqr->cpaddr, (unsigned long) tape->cqr, 0x00, tape->cqr->options));
+ if ((tapestate_get(ti)!=TS_UNUSED) && (tapestate_get(ti)!=TS_IDLE)) {
+ tape_dump_sense(&ti->devstat);
+ while (do_IO (ti->devinfo.irq, ti->cqr->cpaddr, (unsigned long) ti->cqr, 0x00, ti->cqr->options));
} else {
PRINT_WARN("Recieved an unsolicited IRQ.\n");
- tape_dump_sense(&tape->devstat);
+ tape_dump_sense(&ti->devstat);
}
}
void
-tape34xx_error_recovery_read_opposite (tape_info_t* tape) {
- switch (tapestate_get(tape)) {
+tape34xx_error_recovery_read_opposite (tape_info_t* ti) {
+ switch (tapestate_get(ti)) {
case TS_RFO_INIT:
// We did read forward, but the data could not be read *correctly*.
// We will read backward and then skip forward again.
- tape->cqr=tape34xx_read_opposite(tape,0);
- if (tape->cqr==NULL)
- tape34xx_error_recovery_has_failed(tape,EIO);
+ ti->cqr=tape34xx_read_opposite(ti,0);
+ if (ti->cqr==NULL)
+ tape34xx_error_recovery_has_failed(ti,EIO);
else
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
break;
case TS_RBA_INIT:
// We tried to read forward and backward, but hat no success -> failed.
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
break;
case TS_BLOCK_INIT:
- tape34xx_error_recovery_do_retry(tape);
+ tape34xx_error_recovery_do_retry(ti);
break;
default:
PRINT_WARN("read_opposite_recovery_called_with_state:%s\n",
- (((tapestate_get (tape) < TS_SIZE) &&
- (tapestate_get (tape) >= 0)) ?
- state_verbose[tapestate_get (tape)] : "UNKNOWN"));
+ (((tapestate_get (ti) < TS_SIZE) &&
+ (tapestate_get (ti) >= 0)) ?
+ state_verbose[tapestate_get (ti)] : "UNKNOWN"));
}
}
void
-tape34xx_error_recovery_HWBUG (tape_info_t* tape,int condno) {
- devstat_t* stat=&tape->devstat;
+tape34xx_error_recovery_HWBUG (tape_info_t* ti,int condno) {
+ devstat_t* stat=&ti->devstat;
PRINT_WARN("An unexpected condition #%d was caught in tape error recovery.\n",condno);
PRINT_WARN("Please report this incident.\n");
PRINT_WARN("State of the tape:%s\n",
- (((tapestate_get (tape) < TS_SIZE) &&
- (tapestate_get (tape) >= 0)) ?
- state_verbose[tapestate_get (tape)] : "UNKNOWN"));
+ (((tapestate_get (ti) < TS_SIZE) &&
+ (tapestate_get (ti) >= 0)) ?
+ state_verbose[tapestate_get (ti)] : "UNKNOWN"));
PRINT_INFO ("Sense data: %02X%02X%02X%02X %02X%02X%02X%02X "
" %02X%02X%02X%02X %02X%02X%02X%02X \n",
stat->ii.sense.data[0], stat->ii.sense.data[1],
@@ -2381,5 +2378,5 @@
stat->ii.sense.data[26], stat->ii.sense.data[27],
stat->ii.sense.data[28], stat->ii.sense.data[29],
stat->ii.sense.data[30], stat->ii.sense.data[31]);
- tape34xx_error_recovery_has_failed(tape,EIO);
+ tape34xx_error_recovery_has_failed(ti,EIO);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)