Annotation of 41BSD/4.0.upgrade/sys/h/mbavar.h, revision 1.1.1.1

1.1       root        1: /*     mbavar.h        4.15    81/04/08        */
                      2: 
                      3: /*
                      4:  * This file contains definitions related to the kernel structures
                      5:  * for dealing with the massbus adapters.
                      6:  *
                      7:  * Each mba has a mba_hd structure.
                      8:  * Each massbus device has a mba_device structure.
                      9:  * Each massbus slave has a mba_slave structure.
                     10:  *
                     11:  * At boot time we prowl the structures and fill in the pointers
                     12:  * for devices which we find.
                     13:  */
                     14: 
                     15: /*
                     16:  * Per-mba structure.
                     17:  *
                     18:  * The initialization routine uses the information in the mbdinit table
                     19:  * to initialize the what is attached to each massbus slot information.
                     20:  * It counts the number of devices on each mba (to see if bothering to
                     21:  * search/seek is appropriate).
                     22:  *
                     23:  * During normal operation, the devices attached to the mba which wish
                     24:  * to transfer are queued on the mh_act? links.
                     25:  */
                     26: struct mba_hd {
                     27:        short   mh_active;              /* set if mba is active */
                     28:        short   mh_ndrive;              /* number of devices, to avoid seeks */
                     29:        struct  mba_regs *mh_mba;       /* virt addr of mba */
                     30:        struct  mba_regs *mh_physmba;   /* phys addr of mba */
                     31:        struct  mba_device *mh_mbip[8]; /* what is attached to each dev */
                     32:        struct  mba_device *mh_actf;    /* head of queue to transfer */
                     33:        struct  mba_device *mh_actl;    /* tail of queue to transfer */
                     34: };
                     35: 
                     36: /*
                     37:  * Per-device structure
                     38:  * (one for each RM/RP disk, and one for each tape formatter).
                     39:  *
                     40:  * This structure is used by the device driver as its argument
                     41:  * to the massbus driver, and by the massbus driver to locate
                     42:  * the device driver for a particular massbus slot.
                     43:  *
                     44:  * The device drivers hang ready buffers on this structure,
                     45:  * and the massbus driver will start i/o on the first such buffer
                     46:  * when appropriate.
                     47:  */
                     48: struct mba_device {
                     49:        struct  mba_driver *mi_driver;
                     50:        short   mi_unit;        /* unit number to the system */
                     51:        short   mi_mbanum;      /* the mba it is on */
                     52:        short   mi_drive;       /* controller on mba */
                     53:        short   mi_dk;          /* driver number for iostat */
                     54:        short   mi_alive;       /* device exists */
                     55:        short   mi_type;        /* driver specific unit type */
                     56:        struct  buf mi_tab;     /* head of queue for this device */
                     57:        struct  mba_device *mi_forw;
                     58: /* we could compute these every time, but hereby save time */
                     59:        struct  mba_regs *mi_mba;
                     60:        struct  mba_drv *mi_drv;
                     61:        struct  mba_hd *mi_hd;
                     62: };
                     63: 
                     64: /*
                     65:  * Tape formatter slaves are specified by
                     66:  * the following information which is used
                     67:  * at boot time to initialize the tape driver
                     68:  * internal tables.
                     69:  */
                     70: struct mba_slave {
                     71:        struct  mba_driver *ms_driver;
                     72:        short   ms_ctlr;                /* which of several formatters */
                     73:        short   ms_unit;                /* which unit to system */
                     74:        short   ms_slave;               /* which slave to formatter */
                     75:        short   ms_alive;
                     76: };
                     77: 
                     78: /*
                     79:  * Per device-type structure.
                     80:  *
                     81:  * Each massbus driver defines entries for a set of routines used
                     82:  * by the massbus driver, as well as an array of types which are
                     83:  * acceptable to it.
                     84:  */
                     85: struct mba_driver {
                     86:        int     (*md_attach)();         /* attach a device */
                     87:        int     (*md_slave)();          /* attach a slave */
                     88:        int     (*md_ustart)();         /* unit start routine */
                     89:        int     (*md_start)();          /* setup a data transfer */
                     90:        int     (*md_dtint)();          /* data transfer complete */
                     91:        int     (*md_ndint)();          /* non-data transfer interrupt */
                     92:        short   *md_type;               /* array of drive type codes */
                     93:        char    *md_dname, *md_sname;   /* device, slave names */
                     94:        struct  mba_device **md_info;   /* backpointers to mbinit structs */
                     95: };
                     96: 
                     97: /*
                     98:  * Possible return values from unit start routines.
                     99:  */
                    100: #define        MBU_NEXT        0               /* skip to next operation */
                    101: #define        MBU_BUSY        1               /* dual port busy; wait for intr */
                    102: #define        MBU_STARTED     2               /* non-data transfer started */
                    103: #define        MBU_DODATA      3               /* data transfer ready; start mba */
                    104: 
                    105: /*
                    106:  * Possible return values from data transfer interrupt handling routines
                    107:  */
                    108: #define        MBD_DONE        0               /* data transfer complete */
                    109: #define        MBD_RETRY       1               /* error occurred, please retry */
                    110: #define        MBD_RESTARTED   2               /* driver restarted i/o itself */
                    111: 
                    112: /*
                    113:  * Possible return values from non-data-transfer interrupt handling routines
                    114:  */
                    115: #define        MBN_DONE        0               /* non-data transfer complete */
                    116: #define        MBN_RETRY       1               /* failed; retry the operation */
                    117: #define        MBN_SKIP        2               /* don't do anything */
                    118: 
                    119: /*
                    120:  * Clear attention status for specified device.
                    121:  */
                    122: #define        mbclrattn(mi)   ((mi)->mi_mba->mba_drv[0].mbd_as = 1 << (mi)->mi_drive)
                    123: 
                    124: /*
                    125:  * Kernel definitions related to mba.
                    126:  */
                    127: #ifdef KERNEL
                    128: int    nummba;
                    129: #if NMBA > 0
                    130: struct mba_hd mba_hd[NMBA];
                    131: extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();
                    132: 
                    133: extern struct  mba_device mbdinit[];
                    134: extern struct  mba_slave mbsinit[];
                    135: #endif
                    136: #endif

unix.superglobalmegacorp.com

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