1*11109Ssam /* hp.c 4.11 83/02/16 */ 210334Shelge 310334Shelge /* 410334Shelge * RP??/RM?? disk driver 510334Shelge * with ECC handling and bad block forwarding. 610334Shelge * Also supports header io operations and 710334Shelge * commands to write check header and data. 810334Shelge */ 910334Shelge 1010334Shelge #include "../h/param.h" 1110334Shelge #include "../h/inode.h" 1210334Shelge #include "../h/fs.h" 1310334Shelge #include "../h/dkbad.h" 1410334Shelge 1510334Shelge #include "../vax/pte.h" 1610334Shelge #include "../vaxmba/hpreg.h" 1710334Shelge #include "../vaxmba/mbareg.h" 1810334Shelge 1910334Shelge #include "saio.h" 2010334Shelge #include "savax.h" 2110334Shelge 2210334Shelge #define MASKREG(reg) ((reg)&0xffff) 2310334Shelge 2410334Shelge #define MAXBADDESC 126 2510334Shelge #define SECTSIZ 512 /* sector size in bytes */ 2610334Shelge #define HDRSIZ 4 /* number of bytes in sector header */ 2710334Shelge #define MAXECC 5 /* the maximum number of bad bits accepted in 2810334Shelge * an ecc error when F_ECCLM is set */ 2910334Shelge 3010334Shelge char hp_type[MAXNMBA*8] = { 0 }; 3110334Shelge 3210334Shelge /* THIS SHOULD BE READ IN OFF THE PACK, PER DRIVE */ 3310334Shelge short hp6_off[8] = { 0, 38, 0, -1, -1, -1, 118, -1 }; 3410334Shelge short rm3_off[8] = { 0, 100, 0, -1, -1, -1, 310, -1 }; 3510334Shelge short rm5_off[8] = { 0, 27, 0, 562, 589, 681, 562, 82 }; 3610334Shelge short rm80_off[8] = { 0, 37, 0, -1, -1, -1, 115, 305 }; 3710334Shelge short hp7_off[8] = { 0, 10, 0, 330, 340, 500, 330, 50 }; 3810334Shelge short ml_off[8] = { 0, -1, -1, -1, -1, -1, -1, -1 }; 3910334Shelge short si9775_off[8] = { 0, 13, 0, -1, -1, -1, 40, 441 }; 4010334Shelge short si9730_off[8] = { 0, 50, 0, -1, -1, -1, -1, 155 }; 4110334Shelge short hpam_off[8] = { 0, 32, 0, 668, 723, 778, 668, 98 }; 4210626Shelge short hpfj_off[8] = { 0, 19, 0, -1, -1, -1, 398, 59 }; 4310334Shelge /* END SHOULD BE READ IN */ 4410334Shelge 4510334Shelge short hptypes[] = 4610334Shelge { MBDT_RM03, MBDT_RM05, MBDT_RP06, MBDT_RM80, MBDT_RP05, MBDT_RP07, 4710626Shelge MBDT_ML11A, MBDT_ML11B, -1/*9755*/, -1/*9730*/, -1/*Capr*/, 4811084Ssam -1/* eagle */, -1/* 48 sect eagle */, MBDT_RM02, 0}; 4910334Shelge 5010626Shelge #define RP06 (hptypes[hp_type[unit]] <= MBDT_RP06) 5110626Shelge #define ML11 (hptypes[hp_type[unit]] == MBDT_ML11A) 5210626Shelge #define RM80 (hptypes[hp_type[unit]] == MBDT_RM80) 5310334Shelge 5410334Shelge u_char hp_offset[16] = { 5510334Shelge HPOF_P400, HPOF_M400, HPOF_P400, HPOF_M400, 5610334Shelge HPOF_P800, HPOF_M800, HPOF_P800, HPOF_M800, 5710334Shelge HPOF_P1200, HPOF_M1200, HPOF_P1200, HPOF_M1200, 5810334Shelge 0, 0, 0, 0, 5910334Shelge }; 6010334Shelge 6110353Shelge struct st hpst[] = { 6210647Shelge 32, 5, 32*5, 823, rm3_off, /* RM03 */ 6310647Shelge 32, 19, 32*19, 823, rm5_off, /* RM05 */ 6410647Shelge 22, 19, 22*19, 815, hp6_off, /* RP06 */ 6510647Shelge 31, 14, 31*14, 559, rm80_off, /* RM80 */ 6610647Shelge 22, 19, 22*19, 411, hp6_off, /* RP06 */ 6710647Shelge 50, 32, 50*32, 630, hp7_off, /* RP07 */ 6810647Shelge 1, 1, 1, 1, ml_off, /* ML11A */ 6910647Shelge 1, 1, 1, 1, ml_off, /* ML11B */ 7010647Shelge 32, 40, 32*40, 843, si9775_off, /* 9775 */ 7110647Shelge 32, 10, 32*10, 823, si9730_off, /* 9730 */ 7210647Shelge 32, 16, 32*16, 1024, hpam_off, /* capricorn */ 7310647Shelge 43, 20, 43*20, 842, hpfj_off, /* Eagle */ 7410693Shelge 48, 20, 48*20, 842, hpfj_off, /* modif. eagle */ 7510647Shelge 1, 1, 1, 1, 0, /* rm02 - not used */ 7610334Shelge }; 7711084Ssam 7810334Shelge struct dkbad hpbad[MAXNMBA*8]; 7910334Shelge int sectsiz; 8010334Shelge 8110864Ssam /* 8210864Ssam * When awaiting command completion, don't 8310864Ssam * hang on to the status register since 8410864Ssam * this ties up the controller. 8510864Ssam */ 8610864Ssam #define HPWAIT(addr) while ((((addr)->hpds)&HPDS_DRY)==0) DELAY(500); 8710864Ssam 8810334Shelge hpopen(io) 8910334Shelge register struct iob *io; 9010334Shelge { 9110334Shelge register unit = io->i_unit; 9210334Shelge struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit); 9310353Shelge register struct st *st; 9410334Shelge 9510334Shelge mbainit(UNITTOMBA(unit)); 9610334Shelge if (hp_type[unit] == 0) { 9710334Shelge register type = hpaddr->hpdt & MBDT_TYPE; 9810334Shelge register int i; 9910334Shelge struct iob tio; 10010334Shelge 10110334Shelge for (i = 0; hptypes[i]; i++) 10210334Shelge if (hptypes[i] == type) 10310334Shelge goto found; 10410334Shelge _stop("unknown drive type"); 10510334Shelge found: 10611084Ssam hp_type[unit] = hpmaptype(hpaddr, i, unit); 10710647Shelge hpaddr->hpcs1 = HP_DCLR|HP_GO; /* init drive */ 10810647Shelge hpaddr->hpcs1 = HP_PRESET|HP_GO; 10910647Shelge if (!ML11) 11010647Shelge hpaddr->hpof = HPOF_FMT22; 11110334Shelge /* 11210334Shelge * Read in the bad sector table: 11310334Shelge * copy the contents of the io structure 11410334Shelge * to tio for use during the bb pointer 11510334Shelge * read operation. 11610334Shelge */ 11710626Shelge st = &hpst[i]; 11810334Shelge tio = *io; 11910334Shelge tio.i_bn = st->nspc * st->ncyl - st->nsect; 12010626Shelge tio.i_ma = (char *)&hpbad[unit]; 12110628Shelge tio.i_cc = sizeof (struct dkbad); 12210334Shelge tio.i_flgs |= F_RDDATA; 12310334Shelge for (i = 0; i < 5; i++) { 12410628Shelge if (hpstrategy(&tio, READ) == sizeof (struct dkbad)) 12510334Shelge break; 12610334Shelge tio.i_bn += 2; 12710334Shelge } 12810334Shelge if (i == 5) { 12910334Shelge printf("Unable to read bad sector table\n"); 13010334Shelge for (i = 0; i < MAXBADDESC; i++) { 13110334Shelge hpbad[unit].bt_bad[i].bt_cyl = -1; 13210334Shelge hpbad[unit].bt_bad[i].bt_trksec = -1; 13310334Shelge } 13410334Shelge } 13510334Shelge } 13610334Shelge if (io->i_boff < 0 || io->i_boff > 7 || 13710334Shelge st->off[io->i_boff]== -1) 13810334Shelge _stop("hp bad minor"); 13910334Shelge io->i_boff = st->off[io->i_boff] * st->nspc; 14010334Shelge } 14110334Shelge 14211084Ssam hpmaptype(hpaddr, type, unit) 14311084Ssam register struct hpdevice *hpaddr; 14411084Ssam unsigned type; 14511084Ssam int unit; 14611084Ssam { 14711084Ssam int ntracks, hpsn; 14811084Ssam 14911084Ssam /* 15011084Ssam * Handle SI model byte stuff when 15111084Ssam * we think it's an RM03 or RM05. 15211084Ssam */ 15311084Ssam if (type == 0 || type == 1) { 15411084Ssam hpsn = hpaddr->hpsn; 15511084Ssam if ((hpsn & SIMB_LU) != unit) 15611084Ssam return (type); 15711084Ssam switch ((hpsn & SIMB_MB) &~ (SIMB_S6|SIRM03|SIRM05)) { 15811084Ssam case SI9775D: 15911084Ssam return (8); 16011084Ssam case SI9730D: 16111084Ssam return (9); 16211084Ssam case SI9766: 16311084Ssam hpaddr->hpcs1 = HP_RECAL|HP_GO; 16411084Ssam DELAY(100000); 16511084Ssam return (1); 16611084Ssam 16711084Ssam case SI9762: 16811084Ssam return (0); 16911084Ssam } 17011084Ssam return (type); 17111084Ssam } 17211084Ssam /* 17311084Ssam * RM03: EMULEX controller. Map to correct 17411084Ssam * drive type by checking the holding 17511084Ssam * register for the disk geometry. 17611084Ssam */ 17711084Ssam if (type == 13) { 17811084Ssam hpaddr->hpcs1 = HP_NOP; 17911084Ssam hpaddr->hphr = HPHR_MAXTRAK; 18011084Ssam ntracks = MASKREG(hpaddr->hphr) + 1; 18111084Ssam if (ntracks == 16) 18211084Ssam return (10); /* AMPEX capricorn */ 18311084Ssam hpaddr->hphr = HPHR_MAXSECT; 18411084Ssam if (ntracks == 48) 18511084Ssam return (12); /* 48 sector Eagle */ 18611084Ssam if (ntracks == 43) 18711084Ssam return (11); /* 43 sector Eagle */ 18811084Ssam printf("RM02 with %d tracks?\n", ntracks); 18911084Ssam return (type); 19011084Ssam } 19111084Ssam /* 19211084Ssam * ML11's all map to the same type. 19311084Ssam */ 19411084Ssam if (type == 6 || type == 7) 19511084Ssam return (6); 19611084Ssam return (type); 19711084Ssam } 19811084Ssam 19910647Shelge int ssect; /* set to 1 if we are on a track with skip sectors */ 20010647Shelge 20110334Shelge hpstrategy(io, func) 20210334Shelge register struct iob *io; 20310334Shelge { 20410334Shelge register unit = io->i_unit; 20510334Shelge struct mba_regs *mba = mbamba(unit); 20610334Shelge daddr_t bn; 20710334Shelge struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit); 20810353Shelge struct st *st = &hpst[hp_type[unit]]; 20910334Shelge int cn, tn, sn, bytecnt, bytesleft; 21010334Shelge daddr_t startblock; 21110334Shelge char *membase; 21210334Shelge int er1, er2, hprecal; 21310334Shelge 21410334Shelge sectsiz = SECTSIZ; 21510334Shelge if ((io->i_flgs & (F_HDR|F_HCHECK)) != 0) 21610334Shelge sectsiz += HDRSIZ; 21710334Shelge if ((hpaddr->hpds & HPDS_VV) == 0) { 21810334Shelge hpaddr->hpcs1 = HP_DCLR|HP_GO; 21910334Shelge hpaddr->hpcs1 = HP_PRESET|HP_GO; 22011084Ssam if (!ML11) 22110334Shelge hpaddr->hpof = HPOF_FMT22; 22210334Shelge } 22310334Shelge io->i_errcnt = 0; 22410647Shelge ssect = 0; 22510334Shelge bytecnt = io->i_cc; 22610334Shelge membase = io->i_ma; 22710334Shelge startblock = io->i_bn; 22810608Ssam hprecal = 0; 22910626Shelge restart: 23010334Shelge bn = io->i_bn; 23110334Shelge cn = bn/st->nspc; 23210334Shelge sn = bn%st->nspc; 23310334Shelge tn = sn/st->nsect; 23410647Shelge sn = sn%st->nsect + ssect; 23510334Shelge 23610864Ssam HPWAIT(hpaddr); 23710626Shelge mba->mba_sr = -1; 23810647Shelge if (ML11) 23910334Shelge hpaddr->hpda = bn; 24010334Shelge else { 24110334Shelge hpaddr->hpdc = cn; 24210334Shelge hpaddr->hpda = (tn << 8) + sn; 24310334Shelge } 24410334Shelge if (mbastart(io, func) != 0) /* start transfer */ 24510334Shelge return (-1); 24610864Ssam HPWAIT(hpaddr); 24711084Ssam if ((hpaddr->hpds&HPDS_ERR) == 0 && (mba->mba_sr&MBSR_EBITS) == 0) 24811084Ssam return (bytecnt); 24910334Shelge 25010334Shelge /* ------- error handling ------- */ 25110334Shelge 25210334Shelge if (bytesleft = MASKREG(mba->mba_bcr>>16)) 25310334Shelge bytesleft |= 0xffff0000; /* sign ext */ 25410334Shelge bn = io->i_bn + (io->i_cc + bytesleft)/sectsiz; 25510334Shelge cn = bn/st->nspc; 25610334Shelge sn = bn%st->nspc; 25710334Shelge tn = sn/st->nsect; 25810334Shelge sn = sn%st->nsect; 25910334Shelge er1 = MASKREG(hpaddr->hper1); 26010334Shelge er2 = MASKREG(hpaddr->hper2); 26110334Shelge #ifdef HPDEBUG 26210334Shelge printf("hp error: (cyl,trk,sec)=(%d,%d,%d) ds=%b \n", 26310334Shelge cn, tn, sn, MASKREG(hpaddr->hpds), HPDS_BITS); 26410626Shelge printf("er1=%b er2=%b", er1, HPER1_BITS, er2, HPER2_BITS); 26510626Shelge printf("\nbytes left: %d, of 0x%x, da 0x%x",-bytesleft, 26610626Shelge hpaddr->hpof, hpaddr->hpda); 26710334Shelge printf("\n"); 26810334Shelge #endif 26910334Shelge if (er1 & HPER1_HCRC) { 27010334Shelge er1 &= ~(HPER1_HCE|HPER1_FER); 27110334Shelge er2 &= ~HPER2_BSE; 27210334Shelge } 27310334Shelge if (er1&HPER1_WLE) { 27410334Shelge printf("hp%d: write locked\n", unit); 27511084Ssam return (-1); 27611084Ssam } 27711084Ssam if (MASKREG(er1) == HPER1_FER && RP06) 27810334Shelge goto badsect; 27911084Ssam if (++io->i_errcnt > 27 || (er1 & HPER1_HARD) || 28011084Ssam (!ML11 && (er2 & HPER2_HARD))) { 28110608Ssam hard0: 28210334Shelge io->i_error = EHER; 28311084Ssam if (mba->mba_sr & (MBSR_WCKUP|MBSR_WCKLWR)) 28410334Shelge io->i_error = EWCK; 28510334Shelge hard: 28610647Shelge io->i_errblk = bn + ssect; 28710334Shelge printf("hp error: (cyl,trk,sec)=(%d,%d,%d) ds=%b \n", 28810334Shelge cn, tn, sn, MASKREG(hpaddr->hpds), HPDS_BITS); 28911084Ssam printf("er1=%b er2=%b", er1, HPER1_BITS, er2, HPER2_BITS); 29010334Shelge if (hpaddr->hpmr) 29110626Shelge printf(" mr1=%o", MASKREG(hpaddr->hpmr)); 29210334Shelge if (hpaddr->hpmr2) 29310626Shelge printf(" mr2=%o", MASKREG(hpaddr->hpmr2)); 29410626Shelge #ifdef HPDEBUG 29510626Shelge printf("dc: %d, da: 0x%x",MASKREG(hpaddr->hpdc), 29611084Ssam MASKREG(hpaddr->hpda)); 29710626Shelge #endif 29810626Shelge hpaddr->hpcs1 = HP_DCLR|HP_GO; 29910334Shelge printf("\n"); 30011084Ssam return (-1); 30110334Shelge 30211084Ssam } 30311084Ssam if ((er2 & HPER2_BSE) && !ML11) { 30410334Shelge badsect: 30510647Shelge if (!ssect && (er2&HPER2_SSE)) 30610647Shelge goto skipsect; 30711084Ssam if (io->i_flgs & F_NBSF) { 30810334Shelge io->i_error = EBSE; 30910334Shelge goto hard; 31010334Shelge } 31110334Shelge if (hpecc(io, BSE) == 0) 31210334Shelge goto success; 31311084Ssam io->i_error = EBSE; 31411084Ssam goto hard; 31511084Ssam } 31611084Ssam if (RM80 && er2&HPER2_SSE) { 31710647Shelge skipsect: 31810334Shelge (void) hpecc(io, SSE); 31911084Ssam ssect = 1; 32010334Shelge goto success; 32111084Ssam } 32211084Ssam if ((er1 & (HPER1_DCK|HPER1_ECH)) == HPER1_DCK) { 32310864Ssam if (hpecc(io, ECC) == 0) 32410334Shelge goto success; 32511084Ssam io->i_error = EECC; 32611084Ssam return (-1); 32710608Ssam } 32810608Ssam if (ML11 && (io->i_errcnt >= 16)) 32911084Ssam goto hard0; 33010608Ssam /* fall thru to retry */ 33110334Shelge hpaddr->hpcs1 = HP_DCLR|HP_GO; 33210864Ssam HPWAIT(hpaddr); 33310608Ssam if (((io->i_errcnt&07) == 4) ) { 33410334Shelge hpaddr->hpcs1 = HP_RECAL|HP_GO; 33510608Ssam hprecal = 1; 33611084Ssam goto again; 33710334Shelge } 33810334Shelge switch (hprecal) { 33910334Shelge 34010334Shelge case 1: 34110334Shelge hpaddr->hpdc = cn; 34210334Shelge hpaddr->hpcs1 = HP_SEEK|HP_GO; 34311084Ssam hprecal = 2; 34411084Ssam goto again; 34510864Ssam 34610334Shelge case 2: 34710608Ssam if (io->i_errcnt < 16 || (io->i_flgs & F_READ) == 0) 34810334Shelge goto donerecal; 34910334Shelge hpaddr->hpof = hp_offset[io->i_errcnt & 017]|HPOF_FMT22; 35010334Shelge hpaddr->hpcs1 = HP_OFFSET|HP_GO; 35111084Ssam hprecal = 3; 35211084Ssam goto again; 35310864Ssam 35411084Ssam case 3: 35510334Shelge donerecal: 35610334Shelge hprecal = 0; 35711084Ssam goto again; 35810334Shelge } 35910608Ssam if (io->i_errcnt >= 16) { 36010608Ssam hpaddr->hpcs1 = HP_RTC|HP_GO; 36110608Ssam while (hpaddr->hpds & HPDS_PIP) 36210608Ssam ; 36310334Shelge } 36411084Ssam goto again; 36511084Ssam 36611084Ssam success: /* continue with the next block */ 36710334Shelge bn++; 36810334Shelge if ((bn-startblock) * sectsiz < bytecnt) { 36911084Ssam again: /* re-read same block */ 37010334Shelge io->i_bn = bn; 37110334Shelge io->i_ma = membase + (io->i_bn - startblock)*sectsiz; 37210334Shelge io->i_cc = bytecnt - (io->i_bn - startblock)*sectsiz; 37310334Shelge #ifdef HPDEBUG 37410608Ssam printf("restart: bl %d, byte %d, mem 0x%x hprecal %d\n", 37510608Ssam io->i_bn, io->i_cc, io->i_ma, hprecal); 37610334Shelge #endif 37710626Shelge goto restart; 37810334Shelge } 37910334Shelge return (bytecnt); 38010334Shelge } 38110864Ssam 38210334Shelge hpecc(io, flag) 38310334Shelge register struct iob *io; 38410334Shelge int flag; 38510334Shelge { 38610334Shelge register unit = io->i_unit; 38710334Shelge register struct mba_regs *mbp = mbamba(unit); 38810334Shelge register struct hpdevice *rp = (struct hpdevice *)mbadrv(unit); 38910353Shelge register struct st *st = &hpst[hp_type[unit]]; 39011084Ssam int npf, bn, cn, tn, sn, bcr; 39110334Shelge 39210334Shelge if (bcr = MASKREG(mbp->mba_bcr>>16)) 39310334Shelge bcr |= 0xffff0000; /* sxt */ 39411084Ssam npf = (bcr + io->i_cc) / sectsiz; /* # sectors read */ 39511084Ssam bn = io->i_bn + npf + ssect; /* physical block #*/ 39610334Shelge switch (flag) { 39711084Ssam 39810864Ssam case ECC: { 39910334Shelge register int i; 40010334Shelge caddr_t addr; 40110334Shelge int bit, byte, mask, ecccnt = 0; 40210334Shelge 40310413Shelge printf("hp%d: soft ecc sn%d\n", unit, bn); 40410334Shelge mask = MASKREG(rp->hpec2); 40511084Ssam i = MASKREG(rp->hpec1) - 1; /* -1 makes 0 origin */ 40610334Shelge bit = i&07; 40710334Shelge i = (i&~07)>>3; 40810334Shelge byte = i; 40910334Shelge rp->hpcs1 = HP_DCLR | HP_GO; 41010334Shelge while (i <sectsiz && npf*sectsiz + i < io->i_cc && bit > -11) { 41110334Shelge addr = io->i_ma + (npf*sectsiz) + byte; 41210334Shelge #ifdef HPECCDEBUG 41310334Shelge printf("addr %x old:%x ",addr, (*addr&0xff)); 41410334Shelge #endif 41510334Shelge if ((io->i_flgs & (F_CHECK|F_HCHECK)) == 0) 41610334Shelge *addr ^= (mask << bit); /* don't 'correct' mem- 41710334Shelge * ory during Wcheck */ 41810334Shelge #ifdef HPECCDEBUG 41910334Shelge printf("new:%x\n",(*addr&0xff)); 42010334Shelge #endif 42110334Shelge byte++; 42210334Shelge i++; 42310334Shelge bit -= 8; 424*11109Ssam if ((io->i_flgs & F_ECCLM) && ecccnt++ >= MAXECC) 42511084Ssam return (1); 42610334Shelge } 42710334Shelge return(0); 42811084Ssam } 42910334Shelge 43011084Ssam /* 43111084Ssam * Skip sector error. 43211084Ssam * Set skip-sector-inhibit and 43311084Ssam * read next sector 43411084Ssam */ 43511084Ssam case SSE: 43610334Shelge rp->hpcs1 = HP_DCLR | HP_GO; 43710864Ssam HPWAIT(rp); 43810334Shelge rp->hpof |= HPOF_SSEI; 43911084Ssam return (0); 44010334Shelge 44110864Ssam case BSE: { 44210626Shelge int bbn; 44311084Ssam 44410626Shelge rp->hpcs1 = HP_DCLR | HP_GO; 44510334Shelge #ifdef HPDEBUG 44610334Shelge printf("hpecc: BSE @ bn %d\n", bn); 44710334Shelge #endif 44810334Shelge cn = bn/st->nspc; 44910334Shelge sn = bn%st->nspc; 45010334Shelge tn = sn/st->nsect; 45110626Shelge sn = sn%st->nsect; 45210626Shelge bcr += sectsiz; 45310626Shelge if ((bbn = isbad(&hpbad[unit], cn, tn, sn)) < 0) 45411084Ssam return (1); 45510626Shelge bbn = st->ncyl*st->nspc - st->nsect - 1 - bbn; 45610626Shelge cn = bbn/st->nspc; 45710626Shelge sn = bbn%st->nspc; 45810626Shelge tn = sn/st->nsect; 45910626Shelge sn = sn%st->nsect; 46010626Shelge io->i_cc = sectsiz; 46110626Shelge io->i_ma += npf*sectsiz; 46210626Shelge #ifdef HPDEBUG 46310626Shelge printf("revector to cn %d tn %d sn %d mem: 0x%x\n", 46410626Shelge cn, tn, sn, io->i_ma); 46510626Shelge #endif 46610647Shelge rp->hpof &= ~HPOF_SSEI; /* clear skip sector inhibit if set */ 46710626Shelge mbp->mba_sr = -1; 46810334Shelge rp->hpdc = cn; 46910334Shelge rp->hpda = (tn<<8) + sn; 47010334Shelge mbastart(io,io->i_flgs); 47110334Shelge io->i_errcnt = 0; /* error has been corrected */ 47210864Ssam HPWAIT(rp); 47310864Ssam return (rp->hpds&HPDS_ERR); 47410334Shelge } 47511084Ssam } 47611084Ssam printf("hpecc: flag=%d\n", flag); 47711084Ssam return (1); 47810334Shelge } 47910334Shelge /*ARGSUSED*/ 48010334Shelge hpioctl(io, cmd, arg) 48110334Shelge struct iob *io; 48210334Shelge int cmd; 48310334Shelge caddr_t arg; 48410334Shelge { 48510647Shelge register unit = io->i_unit; 48610647Shelge struct st *st = &hpst[hp_type[unit]], *tmp; 48710647Shelge struct mba_drv *drv = mbadrv(unit); 48810334Shelge 48910334Shelge switch(cmd) { 49010334Shelge 49110334Shelge case SAIODEVDATA: 49210334Shelge if ((drv->mbd_dt&MBDT_TAP) == 0) { 49310353Shelge tmp = (struct st *)arg; 49410353Shelge *tmp = *st; 49511084Ssam return (0); 49610334Shelge } 49711084Ssam return (ECMD); 49810334Shelge 49911084Ssam case SAIOSSI: /* skip-sector-inhibit */ 50011084Ssam if (drv->mbd_dt&MBDT_TAP) 50111084Ssam return (ECMD); 50211084Ssam if ((io->i_flgs&F_SSI) == 0) { 50311084Ssam /* make sure this is done once only */ 50411084Ssam io->i_flgs |= F_SSI; 50511084Ssam st->nsect++; 50611084Ssam st->nspc += st->ntrak; 50710864Ssam } 50811084Ssam return (0); 50910626Shelge 51011084Ssam case SAIONOSSI: /* remove skip-sector-inhibit */ 51110626Shelge if (io->i_flgs & F_SSI) { 51210626Shelge io->i_flgs &= ~F_SSI; 51310626Shelge drv->mbd_of &= ~HPOF_SSEI; 51410626Shelge st->nsect--; 51510626Shelge st->nspc -= st->ntrak; 51610626Shelge } 51710626Shelge return(0); 51810626Shelge 51910864Ssam case SAIOSSDEV: /* drive have skip sector? */ 52011084Ssam return (RM80 ? 0 : ECMD); 52110334Shelge } 52211084Ssam return (ECMD); 52310334Shelge } 524