--- cci/sys/vba/vddc.c 2019/07/28 12:24:19 1.1 +++ cci/sys/vba/vddc.c 2019/07/28 12:30:10 1.1.1.2 @@ -33,13 +33,13 @@ /* ** Layout of minor number assignments for the VDDC devices. ** -** 1 -** 5 3 2 0 -** +---------------------------+-----+ -** | Unit number | FLS | -** +---------------------------+-----+ -** | |_____ File system # ( 0-7 ) -** |__________ Unit # in the system +** +** 7 3 2 0 +** +--------------+-----+ +** | Unit number | FLS | +** +--------------+-----+ +** | |_____ File system # ( 0-7 ) +** |__________ Unit # in the system */ #define VDUNIT(x) (minor(x) >> 3) @@ -140,6 +140,21 @@ extern char vd1utl[]; extern char vd2utl[]; #if NVD > 3 extern char vd3utl[]; +#if NVD > 4 +extern char vd4utl[]; +#if NVD > 5 +extern char vd5utl[]; +#if NVD > 6 +extern char vd6utl[]; +#if NVD > 7 +extern char vd7utl[]; +#if NVD > 8 + error Can only support up to 8 controllers +#endif +#endif +#endif +#endif +#endif #endif #endif #endif @@ -173,6 +188,34 @@ ctlr_tab vdctlr_info[NVD] = { UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN}} +#if NVD > 4 + ,{UNKNOWN, (char *)VD4map, vd4utl, 0, FALSE, FALSE, TRUE, 0, + {UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN}} +#if NVD > 5 + ,{UNKNOWN, (char *)VD5map, vd5utl, 0, FALSE, FALSE, TRUE, 0, + {UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN}} +#if NVD > 6 + ,{UNKNOWN, (char *)VD6map, vd6utl, 0, FALSE, FALSE, TRUE, 0, + {UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN}} +#if NVD > 7 + ,{UNKNOWN, (char *)VD7map, vd7utl, 0, FALSE, FALSE, TRUE, 0, + {UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN, + UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN}} +#endif +#endif +#endif +#endif #endif #endif #endif @@ -253,12 +296,12 @@ register cdr *ctlr_addr; } if(vdaccess_with_no_trailer(ctlr_addr,ctlr,slave,INIT,10) & HRDERR) { - printf("\nVDDC: Controller #%d init error.\n", ctlr); + printf("\n VDDC: Controller %d init error.\n", ctlr); return FALSE; } if(vdaccess_with_no_trailer(ctlr_addr,ctlr,slave,DIAG,10) & HRDERR) { - printf("\nVDDC: Controller #%d diagnostic error.\n",ctlr); + printf("\n VDDC: Controller %d diagnostic error.\n",ctlr); return FALSE; } } @@ -302,7 +345,7 @@ register cdr *ctlr_addr; * If reached here, a drive which is not defined in the * 'vdst' tables is connected. Cannot set it's type. */ - printf("VDDC: Counld not identify controller #%d, drive #%d!\n", + printf("VDDC: Could not identify controller %d, drive %d!\n", ctlr, slave); return FALSE; } @@ -352,7 +395,7 @@ register int ctlr, slave, type, pass; } if(c_info->ctlr_dcb.operrsta & HRDERR) { if(!(c_info->ctlr_dcb.operrsta & (NOTCYLERR | DRVNRDY))) - printf("\nVDDC: Configuration error.\n"); + printf("\n VDDC: Configuration error.\n"); else if(pass == 0) { vdstart_drive(ctlr_addr, ctlr, slave); return vdconfigure_drive(ctlr_addr,ctlr,slave,type,1); @@ -373,7 +416,8 @@ vdstart_drive(ctlr_addr, ctlr, slave) cdr *ctlr_addr; register int ctlr, slave; { - printf("\nVDDC: Attempting to start drive #%d. Please wait...", slave); + printf("\n VDDC: Attempting to start drive %d.", slave); + printf(" Please wait..."); if(vdctlr_info[ctlr].ctlr_started) { DELAY(5500000); printf("\n"); @@ -474,7 +518,18 @@ struct vba_ctlr *um; /* -** +** Variables used: +** request -> points to current transaction queue element. +** unit -> contains the system's logical unit number. +** ctlr -> contains the physical controller number. +** slave -> contains the physical unit number on ctlr. +** vba_dev_info -> unix's controller information tables. +** par -> contains the file system number (0-7) +** u_info -> points to internal unit_information table +** c_info -> points to internal controller information table. +** blks -> temporary variable holds number of blocks to xfer. +** blks -> temporary variable holds starting block number. +** priority -> temporary variable holds old cpu priority. */ vdstrategy(request) @@ -515,10 +570,16 @@ register struct buf *request; if(!vddinfo[unit]->ui_mi->um_tab.b_active++) { splx(priority); vdstart(vddinfo[unit]->ui_mi); + return; } - else splx(priority); + splx(priority); return; } + harderr(request, u_info->info.type_name); + printf("- Strategy was passed bad information: " ); + printf("b_bcount=%d, dev_info=%x, alive=%x, and partition length=%d.\n", + request->b_bcount, vba_dev_info, vba_dev_info->ui_alive, + fs->partition[par].par_len); error: request->b_flags |= B_ERROR; request->b_error = ENXIO; @@ -664,7 +725,7 @@ register int ctlr; register fmt_dcb *dcb = &c_info->ctlr_dcb; uncache(&dcb->operrsta); - printf("\nVDDC: Controller #%d didn't interupt!", ctlr); + printf("\nVDDC: Controller %d didn't interupt!", ctlr); printf(" Status = %x", dcb->operrsta); if(c_info->ctlr_type == SMD_ECTLR) { uncache(&dcb->err_code); @@ -711,41 +772,49 @@ register int ctlr; if(c_info->ctlr_type == SMD_ECTLR) uncache(&dcb->err_code); switch(vddecode_error(request, dcb)) { - case CTLR_ERROR : - if(vdminfo[ctlr]->um_tab.b_errcnt >= 2) - vdhard_error(c_info, request, dcb); - vdreset_ctlr(vdminfo[ctlr]->um_addr,ctlr); - if(vdminfo[ctlr]->um_tab.b_errcnt++ < 2) { - vdminfo[ctlr]->um_tab.b_forw = - u_queue->b_back; - vdstart(vdminfo[ctlr]); - return; - } - request->b_resid = request->b_bcount; - break; - case DRIVE_ERROR : - if(vdminfo[ctlr]->um_tab.b_errcnt >= 2) - vdhard_error(c_info, request, dcb); - reset_drive(vdminfo[ctlr]->um_addr, - ctlr, slave, 2); - if(vdminfo[ctlr]->um_tab.b_errcnt++ < 2) { - vdminfo[ctlr]->um_tab.b_forw = - u_queue->b_back; - vdstart(vdminfo[ctlr]); - return; - } - request->b_resid = request->b_bcount; - break; - case HARD_DATA_ERROR : - vdhard_error(c_info, request, dcb); - request->b_resid = 0; - break; - case SOFT_DATA_ERROR : - vdsoft_error(c_info, request, dcb); - default : - request->b_error = 0; - request->b_resid = 0; - break; + case CTLR_ERROR : + vdhard_error(c_info, request, dcb, + (vdminfo[ctlr]->um_tab.b_errcnt < 2), + "Disk controller"); + vdreset_ctlr(vdminfo[ctlr]->um_addr,ctlr); + if(vdminfo[ctlr]->um_tab.b_errcnt++ < 2) { + vdminfo[ctlr]->um_tab.b_forw = u_queue->b_back; + vdstart(vdminfo[ctlr]); + return; + } + request->b_resid = request->b_bcount; + break; + case DRIVE_ERROR : + vdhard_error(c_info, request, dcb, + (vdminfo[ctlr]->um_tab.b_errcnt < 2), "Disk drive"); + reset_drive(vdminfo[ctlr]->um_addr, ctlr, slave, 2); + if(vdminfo[ctlr]->um_tab.b_errcnt++ < 2) { + vdminfo[ctlr]->um_tab.b_forw = u_queue->b_back; + vdstart(vdminfo[ctlr]); + return; + } + request->b_resid = request->b_bcount; + break; + case HARD_DATA_ERROR : + vdhard_error(c_info, request, dcb, + (vdminfo[ctlr]->um_tab.b_errcnt < 3), + "Uncorrected data"); + reset_drive(vdminfo[ctlr]->um_addr, ctlr, slave, 2); + if(vdminfo[ctlr]->um_tab.b_errcnt++ < 3) { + vdminfo[ctlr]->um_tab.b_forw = u_queue->b_back; + vdstart(vdminfo[ctlr]); + return; + } + request->b_resid = 0; + break; + case SOFT_DATA_ERROR : + vdsoft_error(c_info, request, dcb); + default : + if(vdminfo[ctlr]->um_tab.b_errcnt) + printf(" VDDC: Retried successfully.\n"); + request->b_error = 0; + request->b_resid = 0; + break; } end_transfer(request, c_info->rawbuf, c_info->map, c_info->utl); priority = spl7(); @@ -774,7 +843,7 @@ register int ctlr; vdstart(vdminfo[ctlr]); return; } - printf("\nVDDC: Unexpected interupt from controller #%d!\n", ctlr); + printf("\nVDDC: Unexpected interupt from controller %d!\n", ctlr); } @@ -789,8 +858,8 @@ register fmt_dcb *dcb; register int unit = VDUNIT(request->b_dev); if(dcb->operrsta & HRDERR) { - if (dcb->operrsta & (HCRCERR | HCMPERR | UCDATERR | WPTERR | - DSEEKERR | NOTCYLERR |DRVNRDY | INVDADR)) + if (dcb->operrsta & (HCMPERR | WPTERR | DSEEKERR | + NOTCYLERR | DRVNRDY | INVDADR)) return DRIVE_ERROR; else if(dcb->operrsta & (CTLRERR | OPABRT | INVCMD | DNEMEM)) return CTLR_ERROR; @@ -806,25 +875,20 @@ register fmt_dcb *dcb; ** */ -vdhard_error(c_info, request, dcb) -ctlr_tab *c_info; -register struct buf *request; -register fmt_dcb *dcb; -{ - register int delta; - register int unit = VDUNIT(request->b_dev); - register unit_tab *u_info = &vdunit_info[unit]; - register int blk = request->b_blkno * u_info->sec_per_blk; - - request->b_flags |= B_ERROR; - delta = (request->b_bcount+u_info->info.secsize-1)/u_info->info.secsize; - harderr(request, u_info->info.type_name); - printf("- Hard error between sectors %d and %d.", - blk, blk + delta); - printf(" Status = 0x%x", dcb->operrsta); - if(c_info->ctlr_type == SMD_ECTLR) - printf(", Error code = 0x%x", dcb->err_code); - printf("\n"); +vdhard_error(c_info, request, dcb, retry, type) +ctlr_tab *c_info; +struct buf *request; +fmt_dcb *dcb; +int retry; +char *type; +{ + vdreport(c_info, request, dcb, type); + if(retry) + printf(" VDDC: Retrying failed operation...\n"); + else { + request->b_flags |= B_ERROR; + printf(" VDDC: Retries failed to correct error!\n"); + } } @@ -833,23 +897,43 @@ register fmt_dcb *dcb; */ vdsoft_error(c_info, request, dcb) +ctlr_tab *c_info; +struct buf *request; +fmt_dcb *dcb; +{ + vdreport(c_info, request, dcb, "Corrected data"); +} + + +/* +*/ + +vdreport(c_info, request, dcb, type) ctlr_tab *c_info; register struct buf *request; register fmt_dcb *dcb; +char *type; { register int delta; register int unit = VDUNIT(request->b_dev); register unit_tab *u_info = &vdunit_info[unit]; register int blk = request->b_blkno * u_info->sec_per_blk; + register int par = FILSYS(request->b_dev); - delta = (request->b_bcount+u_info->info.secsize-1)/u_info->info.secsize; harderr(request, u_info->info.type_name); - printf("- Corrected soft error between sectors %d and %d.", - blk, blk + delta); - printf(" Status = 0x%x", dcb->operrsta); + printf("- %s error. Status = 0x%x", type, dcb->operrsta); if(c_info->ctlr_type == SMD_ECTLR) printf(", Error code = 0x%x", dcb->err_code); printf("\n"); + delta = (request->b_bcount - 1) / u_info->info.secsize; + blk = request->b_blkno + u_info->info.partition[par].par_start; + blk *= u_info->sec_per_blk; + if(delta == 0) + printf(" VDDC: Error occured on absolute sector %d.\n", blk); + else { + printf(" VDDC: Error occured between"); + printf(" absolute sectors %d and %d.\n", blk, (blk + delta)); + } } @@ -916,6 +1000,8 @@ struct uio *uio; ** */ +extern int physmem; + vddump(dev) dev_t dev; { @@ -931,7 +1017,7 @@ dev_t dev; int memaddr = 0x0; vdreset_ctlr(ctlr_addr, ctlr); - blkcount = maxfree - 2; /* In 1k byte pages */ + blkcount = physmem; /* In 1k byte pages */ if ((dumplo + blkcount) > fs->partition[filsys].par_len) { blkcount = fs->partition[filsys].par_len - dumplo; printf("\nVDDC: Only dumping first %dmb of memory!\n", @@ -1026,7 +1112,7 @@ register int ctlr; register ctlr_tab *c_info = &vdctlr_info[ctlr]; register int type, priority; - printf("\nVDDC: Resetting controller #%d. Please wait...\n", ctlr); + printf("\n VDDC: Resetting controller %d. Please wait...\n", ctlr); VDDC_RESET(ctlr_addr, type); c_info->ctlr_started = FALSE; if(c_info->ctlr_type == SMD_ECTLR) { @@ -1039,11 +1125,11 @@ register int ctlr; CCF_ENP | CCF_EPE | CCF_EDE | CCF_ECE | CCF_ERR; } if(vdaccess_with_no_trailer(ctlr_addr,ctlr,0,INIT,10) & HRDERR) { - printf("\nVDDC: Controller #%d failed to initialize!\n", ctlr); + printf("\n VDDC: Controller %d failed to initialize!\n",ctlr); return FALSE; } if(vdaccess_with_no_trailer(ctlr_addr,ctlr,0,DIAG,10) & HRDERR) { - printf("\nVDDC: Controller #%d diagnostic error!\n",ctlr); + printf("\n VDDC: Controller %d diagnostic error!\n",ctlr); return FALSE; } /* reset all units attached to controller */ @@ -1052,7 +1138,7 @@ register int ctlr; reset_drive(ctlr_addr, ctlr, u_queue->b_dev, 0); u_queue = u_queue->b_forw; } while(u_queue != c_queue->b_forw); - printf("VDDC: Controller #%d was reset successfully.\n", ctlr); + printf(" VDDC: Controller %d was reset successfully.\n", ctlr); return TRUE; } @@ -1068,9 +1154,10 @@ register int ctlr, slave, start; register int type = vdctlr_info[ctlr].unit_type[slave]; if(type != UNKNOWN) - if(!vdconfigure_drive(ctlr_addr, ctlr, slave, type, start)) - printf("\nVDDC: Couldn't reset unit #%d, controller #%d!\n", - slave, ctlr); + if(!vdconfigure_drive(ctlr_addr, ctlr, slave, type, start)) { + printf("\n VDDC: Could not reset"); + printf(" unit %d, controller %d!\n", slave, ctlr); + } } /*