Annotation of cci/sys/stand/vdformat.h, revision 1.1

1.1     ! root        1: /*
        !             2: **     Header file for the VDDC (Versabus Direct Disk Controller) Driver
        !             3: */
        !             4: 
        !             5: #define        NSECPTRK 32             /* #sectors/track - fixed by VDDC */
        !             6: #define SECTSIZ 512            /* sector size fixed by VDDC */
        !             7: #define L2SIZ  9               /* log2 of sector size */
        !             8: #define L2BSIZ 10              /* log2 of block size */
        !             9: #define NVDDRV 3               /* number of drive types supported */
        !            10: 
        !            11: /*
        !            12: **     DCB Command Codes
        !            13: */
        !            14: 
        !            15: #define        RD      0x80            /* Read Data */
        !            16: #define        FTR     0xc0            /* Full Track Read */
        !            17: #define        RAS     0x90            /* Read and Scatter */
        !            18: #define        C       0xa0            /* Compare */
        !            19: #define        FTC     0xe0            /* Full Track Compare */
        !            20: #define        RHDE    0x180           /* Read Header, Data & ECC (not used) */
        !            21: #define        WD      0x00            /* Write Data */
        !            22: #define        FTW     0x40            /* Full Track Write */
        !            23: #define        WTC     0x20            /* Write Then Compare */
        !            24: #define        FTWTC   0x60            /* Full Track Write Then Compare */
        !            25: #define        GAW     0x10            /* Gather and Write */
        !            26: #define        WDE     0x100           /* Write Data & ECC (not used) */
        !            27: #define        FSECT   0x900           /* Format Sector */
        !            28: #define        GWC     0x30            /* Gather Write & Compare */
        !            29: #define        VDSTART 0x800           /* Start drives */
        !            30: #define        VDRELEASE 0xa00         /* Stop drives */
        !            31: #define        SEEK    0xb00           /* Seek */
        !            32: #define        INIT    0xc00           /* Initialize VDDC */
        !            33: #define        DIAG    0xd00           /* Diagnose (self-test) VDDC */
        !            34: #define        RSTCFG  0xe00           /* Reset/Configure VDDC/DDI/Drive(s) */
        !            35: #define        VDSTATUS   0xf00                /* VDDC Status */
        !            36: #define        ABORT   0x80000000      /* To be written to VDDC Cntrl Register */
        !            37: 
        !            38: /*
        !            39: **     Error / Status Symbolic Constants
        !            40: */
        !            41: 
        !            42: #define        HCRCERR         0x1             /* Header CRC Error */
        !            43: #define        HCMPERR         0x2             /* Header Compare Error */
        !            44: #define        WPTERR          0x4             /* Write Protect Error/Status */
        !            45: #define        SZTIMEOUT       0x8             /* Seize timeout Error */
        !            46: #define        DSEEKERR        0x10            /* Disk Seek Error */
        !            47: #define        UCDATERR        0x20            /* Uncorrectable Data Error */
        !            48: #define        NOTCYLERR       0x40            /* Not on Cylinder Error */
        !            49: #define        DRVNRDY         0x80            /* Drive Not Ready Error/Status */
        !            50: #define        ALTACC          0x100           /* Alternate (track) accessed Status */
        !            51: #define        SEEKSTRT        0x200           /* Seek Started Status */
        !            52: #define        INVDADR         0x400           /* Invalid Disk Address Error */
        !            53: #define        DNEMEM          0x800           /* Non-Existant Memory Error */
        !            54: #define        PARERR          0x1000          /* Memory Parity Error */
        !            55: #define        DCOMPERR        0x2000          /* Data Compare Error */
        !            56: #define        DDIRDY          0x4000          /* DDI Ready Error/Status */
        !            57: #define        OPABRT          0x8000          /* Operator Abort (Host) Error/Status */
        !            58: #define        DSERLY          0x10000         /* Data Strobe Early */
        !            59: #define        DSLATE          0x20000         /* Data Strobe Late */
        !            60: #define        TOPLUS          0x40000         /* Track Offset Plus */
        !            61: #define        TOMNUS          0x80000         /* Track Offset Minus */
        !            62: #define        CPDCRT          0x100000        /* Cntlr Performed Data Correction */
        !            63: #define        HRDERR          0x200000        /* Hard Error */
        !            64: #define        SFTERR          0x400000        /* Soft Error (retry succesful) */
        !            65: #define        ANYERR          0x800000        /* Any Error */
        !            66: 
        !            67: /*
        !            68: **     DCB Status Symbolic Constants
        !            69: */
        !            70: 
        !            71: #define        DCBABT          0x10000000      /* DCB Aborted */
        !            72: #define        DCBUSC          0x20000000      /* DCB Unsuccesfully Completed */
        !            73: #define        DCBCMP          0x40000000      /* DCB Complete */
        !            74: #define        DCBSTR          0x80000000      /* DCB Started */
        !            75: 
        !            76: /*
        !            77: **     MDCB Status Symbolic Constants
        !            78: */
        !            79: 
        !            80: #define        CTLRBSY         0x10000000      /* Cntlr Busy */
        !            81: #define        INTCCDE         0x60000000      /* Interrupt Cause Code */
        !            82: #define        DCBINT          0x80000000      /* DCB Interrupt Flag */
        !            83: 
        !            84: 
        !            85: /*
        !            86: **     Hard Error Types
        !            87: */
        !            88: 
        !            89: #define        HTYPES  (HCRCERR|HCMPERR|WPTERR|SZTIMEOUT|DSEEKERR|UCDATERR|NOTCYLERR| \
        !            90:                 DRVNRDY|INVDADR|DNEMEM|PARERR|DCOMPERR)
        !            91: 
        !            92: 
        !            93: /*
        !            94: **     Errors
        !            95: */
        !            96: 
        !            97: #define        ERRS    0x3FFF
        !            98: #define        CANRETRY        (SZTIMEOUT|DSEEKERR|NOTCYLERR|DCOMPERR|UCDATERR| \
        !            99:                         PARERR|DNEMEM|HCRCERR|HCMPERR)
        !           100: /*
        !           101: **     VDDC Interrupt Modes
        !           102: */
        !           103: 
        !           104: #define        NOINT   0x0             /* No Interrupt */
        !           105: #define        INTERR  0x2             /* Interrupt on Error */
        !           106: #define        INTSUC  0x1             /* Interrupt on Success */
        !           107: #define        INTDUN  0x3             /* Interrupt on Error or Success */
        !           108: 
        !           109: #define        CMD_MASK 0xFF0          /* Command code mask */
        !           110:                                /* When a tabular approach can be used */
        !           111:                                /* again change this back to 0x1F0 */
        !           112: 
        !           113: struct size
        !           114: {
        !           115:        daddr_t nblocks;
        !           116:        int     block0;
        !           117: };
        !           118: 
        !           119: 
        !           120: 
        !           121: #define        VDMF    0x8000          /* Manufacturer Fault 1=good sector */
        !           122: #define        VDUF    0x4000          /* User Fault 1=good sector */
        !           123: #define        VDALT   0x2000          /* Alternate Sector 1=alternate */
        !           124: #define        VDWPT   0x1000          /* Write Protect 1=Read Only Sector */
        !           125: 
        !           126: /*
        !           127: **     Addr of Memory-Mapped I/O port for VDDC Control Register
        !           128: */
        !           129: 
        !           130: /*
        !           131: **     Address of Memory-Mapped I/O Port for VDDC H/W Reset
        !           132: */
        !           133: 
        !           134: #define        VDDC_RESET(addr)        *(addr + 4) = 0;        /* reset controller */
        !           135: 
        !           136: /*
        !           137: **     Start i/o to/from controller.
        !           138: */
        !           139: 
        !           140: #define VDDC_ATTENTION(ctrl,mdcbadr)  \
        !           141:                        { movow(((int)mdcbadr & 0xffff0000)>>16,ctrl) ;\
        !           142:                          movow( (int)mdcbadr & 0xffff, ctrl+2);\
        !           143:                        }
        !           144: 
        !           145: /*
        !           146: **     Abort controller operation.
        !           147: */
        !           148: 
        !           149: #define VDDC_ABORT(ctrl)  \
        !           150:                        { \
        !           151:                          movow((ABORT & 0xffff0000)>>16,ctrl) ;\
        !           152:                          movow(ABORT & 0xffff, ctrl+2);\
        !           153:                        }
        !           154: 
        !           155: #define        POLLTILLDONE(c, a, x)   { vdtimeout = 1000*(x); \
        !           156:                         uncache((char *)&a); \
        !           157:                         while (!(a & (DCBCMP | DCBABT))) { \
        !           158:                                DELAY(1000); \
        !           159:                                vdtimeout--; \
        !           160:                                uncache((char *)&a); \
        !           161:                                if (vdtimeout <= 0) { \
        !           162:                                        printf("VDDC controller timeout"); \
        !           163:                                        VDDC_ABORT(c); \
        !           164:                                        break; \
        !           165:                                } \
        !           166:                         } \
        !           167:                        }
        !           168: 
        !           169: static long    vddcaddr[4] = { 0xf2000, 0xf2100, 0xf2200, 0xf2300 };
        !           170: 
        !           171: /* Disk Address */
        !           172: 
        !           173: typedef struct {
        !           174:        char    track;          /* all 8 bits */
        !           175:        char    sector;         /* low order 5 bits */
        !           176:        short   cylinder;       /* low order 12 bits */
        !           177: } dskadr;
        !           178: 
        !           179: /* DCB Trailer Formats */
        !           180: 
        !           181: /* Read / Write Trailer */
        !           182: 
        !           183: typedef struct {
        !           184:        char    *memadr;                        /* memory address */
        !           185:        long    wcount;                         /* 16 bit word count */
        !           186:        dskadr  disk;                           /* disk address */
        !           187: } trrw;
        !           188: 
        !           189: /* Seek trailer format */
        !           190: 
        !           191: typedef struct {
        !           192:        dskadr  seekaddr;
        !           193: } trseek;
        !           194: 
        !           195: /* Format Trailer */
        !           196: 
        !           197: typedef struct {
        !           198:        char    *addr;                  /* data buffer to be filled on sector*/
        !           199:        long    nsectors;               /* # of sectors to be formatted */
        !           200:        dskadr  disk;                   /* Disk physical address info */
        !           201:        dskadr  hdr;                    /* Header address info */
        !           202: } trfmt;
        !           203: 
        !           204: 
        !           205: /* Reset / Configure Trailer */
        !           206: 
        !           207: typedef struct {
        !           208:        long    ncyl;                   /* # cylinders */
        !           209:        long    nsurfaces;              /* # surfaces */
        !           210: } treset;                              /* # of sectors is defined by VDDC */
        !           211:                                        /* to be 32/track of 512 data bytes each */
        !           212: 
        !           213: 
        !           214: /* DCB Format */
        !           215: 
        !           216: typedef struct fmtdcb{
        !           217:        struct fmtdcb   *nxtdcb;        /* next dcb in chain or End of Chain */
        !           218:        short   intflg;                 /* interrupt settings and flags */
        !           219:        short   opcode;                 /* DCB Command code etc... */
        !           220:        long    operrsta;               /* Error & Status info */
        !           221:        short   fill;                   /* not used */
        !           222:        char    devselect;              /* Drive selection */
        !           223:        char    trailcnt;               /* Trailer Word Count */
        !           224:        long    err_memadr;             /* Error memory address */
        !           225:        short   fill2;                  /* not used */
        !           226:        short   err_wcount;             /* Error word count */
        !           227:        char    err_trk;                /* Error track/sector */
        !           228:        char    err_sec;                /* Error track/sector */
        !           229:        short   err_cyl;                /* Error cylinder adr */
        !           230:        union   {
        !           231:                trseek  seektrail;      /* seek command trailer */
        !           232:                trrw    rwtrail;        /* read/write trailer */
        !           233:                trfmt   fmtrail;        /* format trailer */
        !           234:                treset  resetrail;      /* reset/configure trailer */
        !           235:        } trail;
        !           236: } fmt_dcb;
        !           237: 
        !           238: 
        !           239: /* MDCB Format */
        !           240: 
        !           241: typedef struct {
        !           242:        fmt_dcb *firstdcb;              /* first dcb in chain */
        !           243:        fmt_dcb *procdcb;               /* dcb being processed */
        !           244:        fmt_dcb *intdcb;                /* dcb causing interrupt */
        !           245:        long    vddcstat;               /* VDDC status */
        !           246: } fmt_mdcb;
        !           247: 
        !           248: static long    vdtimeout = 0;
        !           249: 

unix.superglobalmegacorp.com

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