Annotation of cci/d/ioex/multi.c, revision 1.1

1.1     ! root        1: 
        !             2: #include "vddc.h"
        !             3: #define GATE_CLOSED    (0xff)  
        !             4: #define NBPG   1024
        !             5: asm(".set NBPG,1024");
        !             6: asm(".set IPL,0x8");
        !             7: 
        !             8: struct ccb     /* CHANNEL CONTROL BLOCK */
        !             9: {
        !            10:   char ccw ;           /* 0x11 normal; 0x09 clear non_vect interrupt */
        !            11:   char gate;           /* This is "the" GATE */
        !            12:   char pt_tpb[4] ;     /* pointer to ->TAPE OPERATION BLOCK or MOVE BLOCK */
        !            13: };
        !            14: extern long Probe, iob0, iob1, iob2, iob3, iob4;
        !            15: extern long Multi, cmd_done, Vdone;
        !            16: extern long tape_ON, vddc_ON, vioc_ON;
        !            17: 
        !            18: extern struct DEVPAR devpar[];
        !            19: extern struct tpb tpb;
        !            20: extern struct ccb ccblk;
        !            21: extern struct DCB vdcb;
        !            22: extern struct tpblk *tblk;
        !            23: 
        !            24: long disk_buf[2*NBPG/4];
        !            25: long mul_err = 0;
        !            26: 
        !            27: 
        !            28: multi()
        !            29: {
        !            30:        register long tm_bsiz, drno;
        !            31: 
        !            32:        writes("\n\t** Multiple interrupts test **\n");
        !            33:        drno = get_unit();
        !            34:        if (tape_ON) {
        !            35:                tm_bsiz = tape_op(CONFIG,0,0);
        !            36:                tm_rew();               /* rewind tape */
        !            37:                tblk = (struct tpblk *)&tpb;
        !            38:                }
        !            39:        mul_err = 0;
        !            40:        multi_ex(&iob0, &iob2, &iob4, disk_buf, drno);
        !            41:        if (!mul_err) writes("\nPassed..\n");
        !            42:                else writes("\nFailed..\n");
        !            43: }
        !            44: 
        !            45: 
        !            46: /*     This test tries by create memory contention between Tahoe
        !            47:        and the tape master by the following actions :
        !            48:                (1) Sent a command to Tape master to move 2 blocks
        !            49:                    of data in Tahoe memory to buffer X, X+1
        !            50:                (2) use movblk instruction to move the same 2 blocks
        !            51:                    to buffer Y, Y+1 and keep doing this until cmd_done
        !            52:                    (indicate tape master done with command)
        !            53:                (3) compare buffer X, X+1 with Y, Y+1.
        !            54: */
        !            55: multi_ex(srcbuf, tdest, sdest, dbuff,drno)
        !            56: char *srcbuf, *tdest, *sdest, *dbuff;
        !            57: long drno;
        !            58: {      register long ix, *lptr;
        !            59:        register short *sptr;
        !            60: 
        !            61:        sptr = (short *)srcbuf;         /* Write pattern to source buffers */
        !            62:        for (ix=0; ix<NBPG; ix++) *sptr++ = ix; 
        !            63:        for (ix=0; ix<(NBPG*2); ix++)  {
        !            64:                sdest[ix] = tdest[ix] = dbuff[ix] = 0;  /* Clear destination */
        !            65:                }
        !            66: 
        !            67:        /* Set up Tpb to move 2 blocks */
        !            68:        if (tape_ON) tblk_mv(srcbuf,tdest,NBPG*2);      
        !            69:        mul_int(srcbuf,sdest,drno,dbuff);
        !            70: 
        !            71:        for (ix=0; ix<(NBPG*2); ix++) {
        !            72:                if (tape_ON) {
        !            73:                        if (srcbuf[ix] != tdest[ix]) {
        !            74:                                writes("\nBlockmv tape error, expected ");
        !            75:                                writeh(srcbuf[ix]&0xff);
        !            76:                                writes(" , actual "); writeh(tdest[ix]&0xff);
        !            77:                                writes(" , address "); writeh(&tdest[ix]);
        !            78:                                mul_err = 1;
        !            79:                                }
        !            80:                        }
        !            81:                if (vddc_ON) {
        !            82:                        if (srcbuf[ix] != dbuff[ix]) {
        !            83:                                writes("\nBlockmv disk error, expected ");
        !            84:                                writeh(srcbuf[ix]&0xff);
        !            85:                                writes(" , actual "); writeh(dbuff[ix]&0xff);
        !            86:                                writes(" , address "); writeh(&dbuff[ix]);
        !            87:                                mul_err = 1;
        !            88:                                }
        !            89:                        }
        !            90:                if (srcbuf[ix] != sdest[ix]) {
        !            91:                        writes("\nBlockmv Tahoe error, expected ");
        !            92:                        writeh(srcbuf[ix]&0xff);
        !            93:                        writes(" , actual "); writeh(sdest[ix]&0xff);
        !            94:                        writes(" , address "); writeh(&sdest[ix]);
        !            95:                        mul_err = 1;
        !            96:                        }
        !            97:                }
        !            98: }
        !            99: 
        !           100: 
        !           101: get_unit()
        !           102: {      register long unit;
        !           103:        for (unit=0;devpar[unit].nocyl;unit++) 
        !           104:                { if (devpar[unit].alive) return(unit); }
        !           105:        return(-1);
        !           106: }
        !           107: 
        !           108: 
        !           109: /*     Routine to create memory contention
        !           110:        return -1 if error
        !           111: */
        !           112: mul_int(src,sdest,dno,dbuff)
        !           113: char *src, *sdest, *dbuff;
        !           114: long dno;
        !           115: {      register long *r12, cntr, rtn_cnt, ix, save;
        !           116: 
        !           117:        Multi = 1;
        !           118:        if (tape_ON) get_taperdy();     /* Get Tape ready */
        !           119:        cmd_done = 0;
        !           120: 
        !           121:        asm("mtpr $0x1f,$IPL");         /* NO interrupt yet ! */
        !           122:        if (vddc_ON) vddc_op(WR_COMP,dno,0x2025a,2,src);
        !           123:        if (tape_ON) cy_attn();         /* Execute command */
        !           124: 
        !           125:        for (ix=0;ix<6;ix++) {  /* Burns some time,TAHOE do some block move */
        !           126:                asm("movl 4(fp),r0");           /* Source */
        !           127:                asm("movl 8(fp),r1");           /* Destination */
        !           128:                asm("movl $NBPG*2,r2");         /* Count */
        !           129:                asm("movblk");                  /* Move it */
        !           130:                }
        !           131:        ix =1;
        !           132:        asm("mtpr $0x1,$IPL");          /* NOW interrupt me.. */
        !           133:        if (tape_ON)  {
        !           134:                if (!isvddc_done()) return(-1);
        !           135:                if (cmd_done == 2) return(-1);  /* operation has error */       
        !           136:                }
        !           137:        if (vddc_ON) {
        !           138:                while (!Vdone);
        !           139:                Multi = 0;
        !           140:                vddc_op(RD_DATA,dno,0x2025a,2,dbuff);
        !           141:                }
        !           142:        Multi = 0;
        !           143:        return(0);
        !           144: }
        !           145: 
        !           146: isvddc_done()
        !           147: {      register long count;
        !           148:        count = 400;
        !           149:        while (!cmd_done)       {
        !           150:                DELAY(0x1fffff);
        !           151:                if (--count==0) return(0);
        !           152:                }
        !           153:        return(1);
        !           154: }
        !           155: 
        !           156: get_taperdy()
        !           157: {
        !           158:        while (g_open()==0)                     /* Is gate open ? */
        !           159:                { tm_init();
        !           160:                error("tape not ready yet..\n");
        !           161:                return(-1);
        !           162:                }
        !           163:        ccblk.gate = (char)GATE_CLOSED;         /* Close gate */
        !           164: }
        !           165: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.