- ci->tpb = ci->last;
- uncache(&ci->ccb.gate);
- while(ci->ccb.gate == GATE_CLOSED)
- uncache(&ci->ccb.gate);
- load_mbus_addr((caddr_t)&ci->tpb, ci->ccb.tpb_ptr);
- ci->ccb.ccw = NORMAL_INTERUPT;
- ci->ccb.gate = GATE_CLOSED;
- ci->interupt_path = cy_normal_path;
- CY_ATTENTION(cyminfo[ctlr]->um_addr);
-}
-
-
-/*
-** for each longword in the tpb we call uncache to purge it from
-** the cache. This is done so that we can correctly access tpb data
-** that was placed there by the controller.
-*/
-
-uncache_tpb(ci)
-ctlr_tab *ci;
-{
- register long *ptr = (long *)&ci->tpb;
- register int i;
-
- for(i=0; i<((sizeof(fmt_tpb)+sizeof(long)-1)/sizeof(long)); i++)
- uncache(ptr++);
-}
-
-
-/*
-** Cyprint_error is the common printing routine for all messages
-** that need to print the tape status along with it. This is so we
-** we can save space, have consistant messages, and we can send the messages
-** to the correct places.
-*/
-
-cyprint_err(message, unit, status)
-register char *message;
-register int unit, status;
-{
- status &= 0xffff;
- printf("cy%d: %s! Status = %x\n", unit, message, status);
-}
-
-/*
-** Decode the error to determine whether the previous command was
-** ok, retryable, or fatal and return the value. If it was a hardware
-** problem we print the message to the console, otherwise we print it
-** to the user's terminal later when execute returns.
-*/
-
-cydecode_error(unit, status)
-register int unit, status;
-{
- register unit_tab *ui = &unit_info[unit];
- register ctlr_tab *ci = &ctlr_info[cydinfo[unit]->ui_ctlr];
-
- if(!(status & CS_OL) && (ci->tpb.cmd != OFF_UNL)) {
- ui->message = "Drive is not on-line";
- cyprint_err(ui->message, unit, status);
- return FATAL;
- }
- ui->bot = ((status & CS_LP) != 0);
- ui->eof = ((status & CS_FM) != 0);
- switch(status & CS_ERm) {
- case ER_EOT:
- if(ci->tpb.control & CW_REV) {
- ui->bot = TRUE;
- ui->eot = FALSE;
- }
- else if(!ui->eot){
- ui->message = "End of tape";
- ui->bot = FALSE;
- ui->eot = TRUE;
- }
- case 0 :
- case ER_FM:
- case ER_NOSTRM:
- return 0;
- case ER_TIMOUT:
- case ER_TIMOUT1:
- case ER_TIMOUT2:
- case ER_TIMOUT3:
- case ER_TIMOUT4:
- ui->message = "Drive timed out during transfer";
- cyprint_err(ui->message, unit, status);
- return FATAL;
- case ER_NEX:
- ui->message =
- "Controller referenced non-existant system memory";
- cyprint_err(ui->message, unit, status);
- return FATAL;
- case ER_DIAG:
- case ER_JUMPER:
- ui->message = "Controller diagnostics failed";
- cyprint_err(ui->message, unit, status);
- return FATAL;
- case ER_STROBE:
- if (ci->tpb.cmd == READ_BU) {
- ci->last.cmd = READ_TA;
- return RETRY;
- }
- if(ci->tpb.cmd == READ_TA)
- return 0;
- ui->message = "Unsatisfactory media found";
- return FATAL;
- case ER_FIFO:
- case ER_NOTRDY:
- ui->error_count = 1;
- return RETRY;
- case ER_PROT:
- ui->message = "Tape is write protected";
- return FATAL;
- case ER_CHKSUM:
- ui->message = "Checksum error in controller proms";
- cyprint_err(ui->message, unit, status);
- return FATAL;
- case ER_HARD:
- ui->error_count++;
- if((ci->tpb.cmd == WRIT_TA) ||
- (ci->tpb.cmd == WRIT_BU) ||
- (ci->tpb.cmd == WRIT_FM)) {
- ui->bad_count++;
- return EXTEND;
- }
- ui->message = "Unrecoverable media error during read";
- return FATAL;
- case ER_PARITY:
- if(++ui->error_count < 8)
- return RETRY;
- ui->message = "Unrecoverable tape parity error";
- return FATAL;
- case ER_BLANK:
- ui->message="Blank tape found (data expected)";
- return FATAL;
- case ER_HDWERR:
- default:
- ui->message = "Unrecoverble hardware error";
- cyprint_err(ui->message, unit, status);
- return FATAL;
- }
-}
-
-cyread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- unit_tab *ui = &unit_info[CYUNIT(dev)];
-
- return (physio(cystrategy, &ui->rawbp, dev, B_READ, cyminsize, uio));
-}
-
-
-cywrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- unit_tab *ui = &unit_info[CYUNIT(dev)];
-
- return (physio(cystrategy,&ui->rawbp, dev, B_WRITE, cyminsize, uio));