--- cci/d/pits/vddc.c 2019/07/28 12:24:19 1.1.1.1 +++ cci/d/pits/vddc.c 2019/07/28 12:30:32 1.1.1.2 @@ -4,43 +4,52 @@ * X is switch selectable. */ -#define SBR 0 -#define PGSHIFT 10 +#define NOUNIT 20 +#define PGSHIFT 10 + #include "pte.h" #include "vddc.h" -/* ************************** - parameters for FSD,SMD,XFD - ************************** +/* ****************************** + parameters for FSD,SMD,XFD,XSD + ****************************** */ -#define NOUNIT 15 struct DEVPAR devpar[NOUNIT] = { - 823,10,10,32,512,0,"FSD", /* FSD */ - 823,10,10,32,512,0,"FSD", /* FSD */ - 823,10,10,32,512,0,"FSD", /* FSD */ - 823,10,10,32,512,0,"FSD", /* FSD */ + 823,10,10,32,512,0,"fsd", /* FSD */ + 823,10,10,32,512,0,"fsd", /* FSD */ + 823,10,10,32,512,0,"fsd", /* FSD */ + 823,10,10,32,512,0,"fsd", /* FSD */ + 0,0,0,0,0,0," ", + 823,19,19,32,512,0,"smd", /* SMD */ + 823,19,19,32,512,0,"smd", /* SMD */ + 823,19,19,32,512,0,"smd", /* SMD */ + 823,19,19,32,512,0,"smd", /* SMD */ 0,0,0,0,0,0," ", - 823,19,19,32,512,0,"SMD", /* SMD */ - 823,19,19,32,512,0,"SMD", /* SMD */ - 823,19,19,32,512,0,"SMD", /* SMD */ - 823,19,19,32,512,0,"SMD", /* SMD */ + 711,24,24,32,512,0,"xfd", /* XFD */ + 711,24,24,32,512,0,"xfd", /* XFD */ + 711,24,24,32,512,0,"xfd", /* XFD */ + 711,24,24,32,512,0,"xfd", /* XFD */ 0,0,0,0,0,0," ", - 711,24,24,32,512,0,"XFD", /* XFD */ - 711,24,24,32,512,0,"XFD", /* XFD */ - 711,24,24,32,512,0,"XFD", /* XFD */ - 711,24,24,32,512,0,"XFD", /* XFD */ + 711,24,24,48,512,0,"xsd", /* XSD */ + 711,24,24,48,512,0,"xsd", /* XSD */ + 711,24,24,48,512,0,"xsd", /* XSD */ + 711,24,24,48,512,0,"xsd", /* XSD */ 0,0,0,0,0,0," " }; /* ***************************************** - Controller parameters for controllers 0-3 + Controller parameters for controllers 0-7 ***************************************** */ -struct DA VDDCBASE[4] = { +struct DA VDDCBASE[8] = { 0xff2000,0xe0,0, /* device address, int vect, online flg */ 0xff2100,0xe1,0, /* device address, int vect, online flg */ 0xff2200,0xe2,0, /* device address, int vect, online flg */ - 0xff2300,0xe3,0 /* device address, int vect, online flg */ + 0xff2300,0xe3,0, /* device address, int vect, online flg */ + 0xff2400,0xe4,0, /* device address, int vect, online flg */ + 0xff2500,0xe5,0, /* device address, int vect, online flg */ + 0xff2600,0xe6,0, /* device address, int vect, online flg */ + 0xff2700,0xe7,0 /* device address, int vect, online flg */ }; /* VDDC Master DCB packet */ @@ -83,11 +92,7 @@ vddc() set_handler(VDDCBASE[cont].intvect,&oldvec,r12); /* Reset UDC controller */ - /*if (vddc_reset() == 0) { - writes("\n...Cannot reset VDDC controller no. "); - writed(cont); writes("\n"); - return(0); } - */ + vddc_reset(); whonline(); return(1); } @@ -96,7 +101,7 @@ chk_vdadr() short len; len = 4; writes("\nProbing for VDDC controllers..."); - for(nvddc=vddcno=0; vddcno<4; vddcno++) { + for(nvddc=vddcno=0; vddcno<8; vddcno++) { curaddr = VDDCBASE[vddcno].devaddr + IOBASE; if(badaddr(curaddr,len) == 0) { writes("\nVDDC controller no. "); writed(vddcno); @@ -131,16 +136,25 @@ m_vddc() whonline() { register struct DEVPAR *dp; register long unit; + *((long *)(VDDCbase + 0xc)) = 0xffffffff; + if (*((long *)(VDDCbase + 0xc)) != 0xffffffff){ + writes("\n\nController ");writed(cont);writes(" is a VSMD"); + vddc_ctlr(INITIALIZE,unit); + } + else { + writes("\n\nController ");writed(cont);writes(" is a VSMD-E"); + *((long *)(VDDCbase + 0x40)) = 0x33061; + vddc_ctlr(INITIALIZE,unit); + } for(unit=0;devpar[unit+type*5].nocyl != 0;unit++) { Probe = 1; devpar[unit+type*5].alive = 1; - if (!vddc_op(RD_DATA,unit,0,1,&iob0)){ - devpar[unit+type*5].alive = 0; } - else { /* Unit is on line */ - vddc_ctlr(CONFIG,unit); - vddc_ctlr(INITIALIZE,unit); - Probe = 0; - } + vddc_ctlr(CONFIG,unit); + if (!vddc_op(R_DATA,unit,0,1,&iob0)){ + devpar[unit+type*5].alive = 0; } + else { + Probe = 0; + } } Probe = 0; } @@ -148,7 +162,7 @@ whonline() /* ****************************************************** Routine to sent one of the following control - command to VDDC : Format, start drives, stop drives, + command to VDDC : start drives, stop drives, initialize controller, diagnose, Configure drive, status. op : one of the above opcode @@ -167,20 +181,6 @@ char dev; dp = &devpar[dev+type*5]; notrailer = 0; switch (op) { - case FORMAT : - for (noword=0;noword<512;noword++) - format_data[noword] = (char)0; - trailer[0] = (long)format_data; - trailer[1] = dp->nocyl*dp->nohead*dp->secs_trak; - trailer[2] = (short)0; /* Start from log. sector 0 */ - trailer[3] = (char)0; - notrailer = (char)4; - Format = 1; - setup_dcb(&dcb,op,dev,notrailer,trailer); - noword=sento_vddc(&dcb); /* Return 1 if O.K */ - Format = 0; - return(noword); - break; case START_DR : break; case STOP_DR : @@ -188,7 +188,9 @@ char dev; case CONFIG: trailer[0] = dp->nocyl; trailer[1] = dp->nohead; - notrailer = 2; + trailer[2] = dp->secs_trak; + trailer[3] = 0; + notrailer = 4; break; case STATUS: setup_dcb(&dcb,op,dev,notrailer,trailer); @@ -221,7 +223,10 @@ char *buf_adr; long no_blks, blkno; { long trailer[3], nosec_cyl, secno; long cyl_no, trak_no, sector_no; + char uf0,uf3; register struct DEVPAR *dp; + uf0 = 0x0; + uf3 = 0xc0; if (!devpar[dev+type*5].alive) { writes("\n...Unit "); writed(dev); writes(" is not online\n"); @@ -241,16 +246,48 @@ long no_blks, blkno; trailer[0] = (long)buf_adr; trailer[1] = no_blks * (BLKSIZ/2); /* Unit is in word size */ - trailer[2] = (cyl_no&0xfff)|(sector_no<<16)|(trak_no<<24); - if (!IOinit) { - /* if (op==(unsigned short)RD_DATA) writec('R'); - else writec('W'); - writeh(blkno); writec('/'); writeh(no_blks); writec('/'); - writeh(trailer[2]); */ - } + if (cyl_no > dp->nocyl-2) { + trailer[2]=(cyl_no&0xfff)|(sector_no<<16)|(trak_no<<24)|(uf3<<12); + } + else { + trailer[2]=(cyl_no&0xfff)|(sector_no<<16)|(trak_no<<24)|(uf0<<12); + } setup_dcb(&dcb,op,dev,3,trailer); return(sento_vddc(&dcb)); /* Return 1 if O.K */ } +/* + write or read to/from specific cylinder, track, sector +*/ +vddc_op2(op,dev,cyl,trk,sec,no_blks,buf_adr) +unsigned short op; +char *buf_adr; +long no_blks, cyl, trk, sec; +{ + long trailer[3]; + char uf0; + + uf0 = 0x0; + trailer[0] = (long)buf_adr; + trailer[1] = no_blks * (BLKSIZ/2); + trailer[2] = (cyl & 0xfff)|(sec << 16)|(trk << 24)|(uf0 << 12); + setup_dcb(&dcb,op,dev,3,trailer); + return(sento_vddc(&dcb)); +} +/* + seek to a specific cylinder, track, sector +*/ +vddc_op3(op,dev,cyl,trk,sec) +unsigned short op; +long cyl, trk, sec; +{ + long trailer[1]; + char uf0; + + uf0 = 0x0; + trailer[0] = (cyl & 0xfff)|(sec << 16)|(trk << 24)|(uf0 << 12); + setup_dcb(&dcb,op,dev,1,trailer); + return(sento_vddc(&dcb)); +} /* ********************* Reset VDDC controller ********************* @@ -273,7 +310,7 @@ char devno, notrailer; long *trailer; { register long ix, *r12; dcb->nxt_dcb = NO_CHAIN; - dcb->int_flags = (unsigned short)INT_SUCCESS; + dcb->int_flags = (unsigned short)INT_DONE; dcb->opcode = opcode; dcb->dcb_stat = 0; /* Clear DCB status */ dcb->dev_sel = (char)devno & 0x3; /* Device selected */ @@ -326,13 +363,10 @@ struct DCB *vdcb; */ vddc_wait() { register long cnt; - if (Format) { cnt = 0xfffffff0; - writes("\nVDDC formatting..."); } - else cnt = 0xfff00; + cnt = 0xfff00; while (!Vdone) { /* Wait for completion interrupt */ - if (Format) writec('f'); if (--cnt <= 0) { - if (!Probe) + if (!Probe) writes("\n...time out, lost completion interrupt..\n"); return(0); } } @@ -357,7 +391,7 @@ struct DCB *vdcb; if (((vdcb->dcb_stat&0xf0000000) != DCB_DONE) || (vdcb->dcb_stat&ANY_ERROR)) { prt_vddcstat(vdcb->dcb_stat); - return(0); + if (vdcb->dcb_stat&HARD_ERROR) return(0); } return(1); }