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

1.1     ! root        1: /*
        !             2: **     Header file for the VDDC (Versabus Direct Disk Controller) Driver
        !             3: */
        !             4: 
        !             5: /*
        !             6: **     DCB Command Codes
        !             7: */
        !             8: 
        !             9: #define        RD              0x80            /* Read Data */
        !            10: #define        FTR             0xc0            /* Full Track Read */
        !            11: #define        RAS             0x90            /* Read and Scatter */
        !            12: #define        C               0xa0            /* Compare */
        !            13: #define        FTC             0xe0            /* Full Track Compare */
        !            14: #define        RHDE            0x180           /* Read Header, Data & ECC (not used) */
        !            15: #define        WD              0x00            /* Write Data */
        !            16: #define        FTW             0x40            /* Full Track Write */
        !            17: #define        WTC             0x20            /* Write Then Compare */
        !            18: #define        FTWTC           0x60            /* Full Track Write Then Compare */
        !            19: #define        GAW             0x10            /* Gather and Write */
        !            20: #define        WDE             0x100           /* Write Data & ECC (not used) */
        !            21: #define        FSECT           0x900           /* Format Sector */
        !            22: #define        GWC             0x30            /* Gather Write & Compare */
        !            23: #define        VDSTART         0x800           /* Start drives */
        !            24: #define        VDRELEASE       0xa00           /* Stop drives */
        !            25: #define        SEEK            0xb00           /* Seek */
        !            26: #define        INIT            0xc00           /* Initialize VDDC */
        !            27: #define        DIAG            0xd00           /* Diagnose (self-test) VDDC */
        !            28: #define        RSTCFG          0xe00           /* Reset/Configure VDDC/DDI/Drive(s) */
        !            29: #define        VDSTATUS        0xf00           /* VDDC Status */
        !            30: 
        !            31: #define        ABORT           0x80000000      /* ABORT active i/o */
        !            32: 
        !            33: /*
        !            34: **     Error / Status Symbolic Constants
        !            35: */
        !            36: 
        !            37: #define        HCRCERR         0x1             /* Header CRC Error */
        !            38: #define        HCMPERR         0x2             /* Header Compare Error */
        !            39: #define        WPTERR          0x4             /* Write Protect Error/Status */
        !            40: #define        SZTIMEOUT       0x8             /* Seize timeout Error */
        !            41: #define        DSEEKERR        0x10            /* Disk Seek Error */
        !            42: #define        UCDATERR        0x20            /* Uncorrectable Data Error */
        !            43: #define        NOTCYLERR       0x40            /* Not on Cylinder Error */
        !            44: #define        DRVNRDY         0x80            /* Drive Not Ready Error/Status */
        !            45: #define        ALTACC          0x100           /* Alternate (track) accessed Status */
        !            46: #define        SEEKSTRT        0x200           /* Seek Started Status */
        !            47: #define        INVDADR         0x400           /* Invalid Disk Address Error */
        !            48: #define        DNEMEM          0x800           /* Non-Existant Memory Error */
        !            49: #define        PARERR          0x1000          /* Memory Parity Error */
        !            50: #define        DCOMPERR        0x2000          /* Data Compare Error */
        !            51: #define        DDIRDY          0x4000          /* DDI Ready Error/Status */
        !            52: #define        OPABRT          0x8000          /* Operator Abort (Host) Error/Status */
        !            53: #define        DSERLY          0x10000         /* Data Strobe Early */
        !            54: #define        DSLATE          0x20000         /* Data Strobe Late */
        !            55: #define        TOPLUS          0x40000         /* Track Offset Plus */
        !            56: #define        TOMNUS          0x80000         /* Track Offset Minus */
        !            57: #define        CPDCRT          0x100000        /* Cntlr Performed Data Correction */
        !            58: #define        HRDERR          0x200000        /* Hard Error */
        !            59: #define        SFTERR          0x400000        /* Soft Error (retry succesful) */
        !            60: #define        ANYERR          0x800000        /* Any Error */
        !            61: #define INVCMD         0x1000000       /* Programmer error */
        !            62: 
        !            63: 
        !            64: /*
        !            65: **     DCB Status Symbolic Constants
        !            66: */
        !            67: 
        !            68: #define        DCBABT          0x10000000      /* DCB Aborted */
        !            69: #define        DCBUSC          0x20000000      /* DCB Unsuccesfully Completed */
        !            70: #define        DCBCMP          0x40000000      /* DCB Complete */
        !            71: #define        DCBSTR          0x80000000      /* DCB Started */
        !            72: 
        !            73: /*
        !            74: **     MDCB Status Symbolic Constants
        !            75: */
        !            76: 
        !            77: #define        CTLRBSY         0x10000000      /* Cntlr Busy */
        !            78: #define        INTCCDE         0x60000000      /* Interrupt Cause Code */
        !            79: #define        DCBINT          0x80000000      /* DCB Interrupt Flag */
        !            80: 
        !            81: 
        !            82: /*
        !            83: **     Hard Error Types
        !            84: */
        !            85: 
        !            86: #define        HTYPES  (HCRCERR|HCMPERR|WPTERR|SZTIMEOUT|DSEEKERR|UCDATERR|NOTCYLERR| \
        !            87:                 DRVNRDY|INVDADR|DNEMEM|PARERR|DCOMPERR)
        !            88: 
        !            89: 
        !            90: /*
        !            91: **     Errors
        !            92: */
        !            93: 
        !            94: #define        ERRS    0x3FFF
        !            95: #define        CANRETRY        (SZTIMEOUT|DSEEKERR|NOTCYLERR|DCOMPERR|UCDATERR| \
        !            96:                         PARERR|DNEMEM|HCRCERR|HCMPERR)
        !            97: /*
        !            98: **     VDDC Interrupt Modes
        !            99: */
        !           100: 
        !           101: #define        NOINT   0x0             /* No Interrupt */
        !           102: #define        INTERR  0x2             /* Interrupt on Error */
        !           103: #define        INTSUC  0x1             /* Interrupt on Success */
        !           104: #define        INTDUN  0x3             /* Interrupt on Error or Success */
        !           105: 
        !           106: #define        CMD_MASK 0xFF0          /* Command code mask */
        !           107:                                /* When a tabular approach can be used */
        !           108:                                /* again change this back to 0x1F0 */
        !           109: 
        !           110: struct size
        !           111: {
        !           112:        daddr_t nblocks;
        !           113:        int     block0;
        !           114: };
        !           115: 
        !           116: 
        !           117: 
        !           118: #define        VDMF    0x8000          /* Manufacturer Fault 1=good sector */
        !           119: #define        VDUF    0x4000          /* User Fault 1=good sector */
        !           120: #define        VDALT   0x2000          /* Alternate Sector 1=alternate */
        !           121: #define        VDWPT   0x1000          /* Write Protect 1=Read Only Sector */
        !           122: 
        !           123: /*
        !           124: **     Addr of Memory-Mapped I/O port for VDDC Control Register
        !           125: */
        !           126: 
        !           127: /*
        !           128: **     Address of Memory-Mapped I/O Port for VDDC H/W Reset
        !           129: */
        !           130: 
        !           131: #define        VDDC_RESET(addr)        *(addr + 4) = 0;        /* reset controller */
        !           132: 
        !           133: /*
        !           134: **     Start i/o to/from controller.
        !           135: */
        !           136: 
        !           137: #define VDDC_ATTENTION(ctrl,mdcbadr)  \
        !           138:                        { movow(((int)mdcbadr & 0xffff0000)>>16,ctrl) ;\
        !           139:                          movow( (int)mdcbadr & 0xffff, ctrl+2);\
        !           140:                        }
        !           141: 
        !           142: /*
        !           143: **     Abort controller operation.
        !           144: */
        !           145: 
        !           146: #define VDDC_ABORT(ctrl)  \
        !           147:                        { \
        !           148:                          movow((ABORT & 0xffff0000)>>16,ctrl) ;\
        !           149:                          movow(ABORT & 0xffff, ctrl+2);\
        !           150:                        }
        !           151: 
        !           152: #define        POLLTILLDONE(c, a, x)   { vdtimeout = 1000*(x); \
        !           153:                         uncache((char *)&a); \
        !           154:                         while (!(a & (DCBCMP | DCBABT))) { \
        !           155:                                DELAY(1000); \
        !           156:                                vdtimeout--; \
        !           157:                                uncache((char *)&a); \
        !           158:                                if (vdtimeout <= 0) { \
        !           159:                                        printf("VDDC: Controller timeout"); \
        !           160:                                        VDDC_ABORT(c); \
        !           161:                                        DELAY(20000); \
        !           162:                                        uncache((char *)&a); \
        !           163:                                        break; \
        !           164:                                } \
        !           165:                         } \
        !           166:                        }
        !           167: 
        !           168: 
        !           169: /* Disk Address */
        !           170: 
        !           171: typedef struct {
        !           172:        char    track;                  /* all 8 bits */
        !           173:        char    sector;                 /* low order 5 bits */
        !           174:        short   cylinder;               /* low order 12 bits */
        !           175: } dskadr;
        !           176: 
        !           177: /* DCB Trailer Formats */
        !           178: 
        !           179: /* Read / Write Trailer */
        !           180: 
        !           181: typedef struct {
        !           182:        char            *memadr;        /* memory address */
        !           183:        unsigned long   wcount;         /* 16 bit word count */
        !           184:        dskadr          disk;           /* disk address */
        !           185: } trrw;
        !           186: 
        !           187: /* Seek trailer format */
        !           188: 
        !           189: typedef struct {
        !           190:        dskadr  seekaddr;
        !           191: } trseek;
        !           192: 
        !           193: /* Format Trailer */
        !           194: 
        !           195: typedef struct {
        !           196:        char    *addr;                  /* data buffer to be filled on sector*/
        !           197:        long    nsectors;               /* # of sectors to be formatted */
        !           198:        dskadr  disk;                   /* Disk physical address info */
        !           199:        dskadr  hdr;                    /* Header address info */
        !           200: } trfmt;
        !           201: 
        !           202: 
        !           203: /* Reset / Configure Trailer */
        !           204: 
        !           205: typedef struct {
        !           206:        long    ncyl;                   /* # cylinders */
        !           207:        long    nsurfaces;              /* # surfaces */
        !           208:        long    nsectors;               /* # sectors */
        !           209: } treset;                              /* # of sectors is defined by VDDC */
        !           210:                                        /* as 32/track of 512 data bytes each */
        !           211: 
        !           212: 
        !           213: /* DCB Format */
        !           214: 
        !           215: typedef struct fmtdcb{
        !           216:        struct fmtdcb   *nxtdcb;        /* next dcb in chain or End of Chain */
        !           217:        short   intflg;                 /* interrupt settings and flags */
        !           218:        short   opcode;                 /* DCB Command code etc... */
        !           219:        long    operrsta;               /* Error & Status info */
        !           220:        short   fill;                   /* not used */
        !           221:        char    devselect;              /* Drive selection */
        !           222:        char    trailcnt;               /* Trailer Word Count */
        !           223:        long    err_memadr;             /* Error memory address */
        !           224:        short   fill2;                  /* not used */
        !           225:        short   err_wcount;             /* Error word count */
        !           226:        char    err_trk;                /* Error track/sector */
        !           227:        char    err_sec;                /* Error track/sector */
        !           228:        short   err_cyl;                /* Error cylinder adr */
        !           229:        union   {
        !           230:                trseek  seektrail;      /* seek command trailer */
        !           231:                trrw    rwtrail;        /* read/write trailer */
        !           232:                trfmt   fmtrail;        /* format trailer */
        !           233:                treset  resetrail;      /* reset/configure trailer */
        !           234:        } trail;
        !           235: } fmt_dcb;
        !           236: 
        !           237: 
        !           238: /* MDCB Format */
        !           239: 
        !           240: typedef struct {
        !           241:        fmt_dcb *firstdcb;              /* first dcb in chain */
        !           242:        fmt_dcb *procdcb;               /* dcb being processed */
        !           243:        fmt_dcb *intdcb;                /* dcb causing interrupt */
        !           244:        long    vddcstat;               /* VDDC status */
        !           245: } fmt_mdcb;
        !           246: 
        !           247: 
        !           248: /* the total # of drive types possible */
        !           249: #define NVDDRV 4
        !           250: 
        !           251: #define        XSD     0
        !           252: #define        XFD     1
        !           253: #define        SMD     2
        !           254: #define        FSD     3
        !           255: 
        !           256: 
        !           257: typedef struct {
        !           258:        long    par_start;
        !           259:        long    par_len;
        !           260: } par_tab;
        !           261: 
        !           262: typedef struct {
        !           263:        short   secsiz;                 /* Number of bytes in a sector  */
        !           264:        short   nsec;                   /* Number of sectors per track */
        !           265:        short   ntrak;                  /* Number of tracks per cylinder */
        !           266:        short   ncyl;                   /* Number of cylinders */
        !           267:        char    *type_name;             /* Name of drive */
        !           268:        par_tab fs_a;                   /* partition a (root file system) */
        !           269:        par_tab fs_b;                   /* partition b (swap) */
        !           270:        par_tab fs_c;                   /* partition c (user data) */
        !           271:        par_tab fs_d;                   /* partition d (maintenance cyls) */
        !           272:        par_tab fs_e;                   /* partition e (all user data area) */
        !           273:        par_tab fs_f;                   /* partition f (whole disk) */
        !           274:        par_tab fs_g;                   /* partition g (non existant) */
        !           275:        par_tab fs_h;                   /* partition h (non existant) */
        !           276: } fs_tab;
        !           277: 
        !           278: /* Physical information for known disk drives.  */
        !           279: #ifdef VDGENDATA
        !           280: long   vddcaddr[] = { 0xf2000, 0xf2100, 0xf2200, 0xf2300 };
        !           281: long   vdtimeout = 0;
        !           282: 
        !           283: fs_tab vdst[] = {
        !           284:        {512, 48,       24,     711,    "xsd",  /* 515 Mb FSD */
        !           285:                {0, 30528},             /* xsd0a cyl 0 - 52 */
        !           286:                {30528,  30528},        /* xsd3b cyl 53 - 105 */
        !           287:                {61056,  345600},       /*xfsd3c cyl 106 - 705 */
        !           288:                {406656, 2880},         /* xfsd3d cyl 706 - 710 */
        !           289:                {0,      406656},       /* xfsd3e cyl 0 - 705 */
        !           290:                {0,      409536},       /* xfsd3f cyl 0 - 710 */
        !           291:                {0, 0}, {0, 0}          /* non existant partitions */
        !           292:        },
        !           293:        {512, 32,       24,     711,    "xfd",  /* 340 Mb FSD */
        !           294:                {0,      20352},        /* xfsd3a cyl 0 - 52 */
        !           295:                {20352,  20352},        /* xfsd3b cyl 53 - 105 */
        !           296:                {40704,  230400},       /* xfsd3c cyl 106 - 705 */
        !           297:                {271104, 1920},         /* xfsd3d cyl 706 - 710 */
        !           298:                {0,      271104},       /* xfsd3e cyl 0 - 705 */
        !           299:                {0,      273024},       /* xfsd3f cyl 0 - 710 */
        !           300:                {0, 0}, {0, 0}          /* non existant partitions */
        !           301:        },
        !           302:        {512, 32,       19,     823,    "smd",  /* 300 Mb SMD */
        !           303:                {0,      20064},        /* smd3a cyl 0 - 65 */
        !           304:                {20064,  13680},        /* smd3b cyl 66 - 110 */
        !           305:                {33744,  214928},       /* smd3c cyl 111 - 817 */
        !           306:                {248672, 1520},         /* smd3d cyl 818 - 822 */
        !           307:                {0,      248672},       /* smd3e cyl 0 - 817 */
        !           308:                {0,      250192},       /* smd3f cyl 0 - 822 */
        !           309:                {0, 0}, {0, 0}          /* non existant partitions */
        !           310:        },
        !           311:        {512, 32,       10,     823,    "fsd",  /* 160 Mb FSD */
        !           312:                {0,      9600},         /* fsd3a cyl   0 -  59 */
        !           313:                {0,      12000},        /* fsd3b cyl  60 - 134 */
        !           314:                {0,      108480},       /* fsd3c cyl 135 - 812 */
        !           315:                {0,      800},          /* fsd3d cyl 813 - 822 */
        !           316:                {0,      130080},       /* fsd3e cyl   0 - 812 */
        !           317:                {0,      131680},       /* fsd3f cyl   0 - 822 */
        !           318:                {0, 0}, {0, 0}       /* non existant partitions */
        !           319:        }
        !           320: };
        !           321: #else
        !           322: extern long    vddcaddr[];
        !           323: extern long    vdtimeout = 0;
        !           324: 
        !           325: extern fs_tab  vdst[];
        !           326: #endif
        !           327: 

unix.superglobalmegacorp.com

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