Annotation of 43BSD/sys/vaxuba/ubavar.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1982, 1986 Regents of the University of California.
                      3:  * All rights reserved.  The Berkeley software License Agreement
                      4:  * specifies the terms and conditions for redistribution.
                      5:  *
                      6:  *     @(#)ubavar.h    7.1 (Berkeley) 6/5/86
                      7:  */
                      8: 
                      9: /*
                     10:  * This file contains definitions related to the kernel structures
                     11:  * for dealing with the unibus adapters.
                     12:  *
                     13:  * Each uba has a uba_hd structure.
                     14:  * Each unibus controller which is not a device has a uba_ctlr structure.
                     15:  * Each unibus device has a uba_device structure.
                     16:  */
                     17: 
                     18: #ifndef LOCORE
                     19: /*
                     20:  * Per-uba structure.
                     21:  *
                     22:  * This structure holds the interrupt vector for the uba,
                     23:  * and its address in physical and virtual space.  At boot time
                     24:  * we determine the devices attached to the uba's and their
                     25:  * interrupt vectors, filling in uh_vec.  We free the map
                     26:  * register and bdp resources of the uba into the structures
                     27:  * defined here.
                     28:  *
                     29:  * During normal operation, resources are allocated and returned
                     30:  * to the structures here.  We watch the number of passive releases
                     31:  * on each uba, and if the number is excessive may reset the uba.
                     32:  * 
                     33:  * When uba resources are needed and not available, or if a device
                     34:  * which can tolerate no other uba activity (rk07) gets on the bus,
                     35:  * then device drivers may have to wait to get to the bus and are
                     36:  * queued here.  It is also possible for processes to block in
                     37:  * the unibus driver in resource wait (mrwant, bdpwant); these
                     38:  * wait states are also recorded here.
                     39:  */
                     40: struct uba_hd {
                     41:        struct  uba_regs *uh_uba;       /* virt addr of uba */
                     42:        struct  uba_regs *uh_physuba;   /* phys addr of uba */
                     43:        int     (**uh_vec)();           /* interrupt vector */
                     44:        struct  uba_device *uh_actf;    /* head of queue to transfer */
                     45:        struct  uba_device *uh_actl;    /* tail of queue to transfer */
                     46:        short   uh_mrwant;              /* someone is waiting for map reg */
                     47:        short   uh_bdpwant;             /* someone awaits bdp's */
                     48:        int     uh_bdpfree;             /* free bdp's */
                     49:        int     uh_hangcnt;             /* number of ticks hung */
                     50:        int     uh_zvcnt;               /* number of recent 0 vectors */
                     51:        long    uh_zvtime;              /* time over which zvcnt accumulated */
                     52:        int     uh_zvtotal;             /* total number of 0 vectors */
                     53:        int     uh_errcnt;              /* number of errors */
                     54:        int     uh_lastiv;              /* last free interrupt vector */
                     55:        short   uh_users;               /* transient bdp use count */
                     56:        short   uh_xclu;                /* an rk07 is using this uba! */
                     57:        int     uh_lastmem;             /* limit of any unibus memory */
                     58: #define        UAMSIZ  100
                     59:        struct  map *uh_map;            /* buffered data path regs free */
                     60: };
                     61: 
                     62: #ifndef LOCORE
                     63: /*
                     64:  * Per-controller structure.
                     65:  * (E.g. one for each disk and tape controller, and other things
                     66:  * which use and release buffered data paths.)
                     67:  *
                     68:  * If a controller has devices attached, then there are
                     69:  * cross-referenced uba_drive structures.
                     70:  * This structure is the one which is queued in unibus resource wait,
                     71:  * and saves the information about unibus resources which are used.
                     72:  * The queue of devices waiting to transfer is also attached here.
                     73:  */
                     74: struct uba_ctlr {
                     75:        struct  uba_driver *um_driver;
                     76:        short   um_ctlr;        /* controller index in driver */
                     77:        short   um_ubanum;      /* the uba it is on */
                     78:        short   um_alive;       /* controller exists */
                     79:        int     (**um_intr)();  /* interrupt handler(s) */
                     80:        caddr_t um_addr;        /* address of device in i/o space */
                     81:        struct  uba_hd *um_hd;
                     82: /* the driver saves the prototype command here for use in its go routine */
                     83:        int     um_cmd;         /* communication to dgo() */
                     84:        int     um_ubinfo;      /* save unibus registers, etc */
                     85:        struct  buf um_tab;     /* queue of devices for this controller */
                     86: };
                     87: 
                     88: /*
                     89:  * Per ``device'' structure.
                     90:  * (A controller has devices or uses and releases buffered data paths).
                     91:  * (Everything else is a ``device''.)
                     92:  *
                     93:  * If a controller has many drives attached, then there will
                     94:  * be several uba_device structures associated with a single uba_ctlr
                     95:  * structure.
                     96:  *
                     97:  * This structure contains all the information necessary to run
                     98:  * a unibus device such as a dz or a dh.  It also contains information
                     99:  * for slaves of unibus controllers as to which device on the slave
                    100:  * this is.  A flags field here can also be given in the system specification
                    101:  * and is used to tell which dz lines are hard wired or other device
                    102:  * specific parameters.
                    103:  */
                    104: struct uba_device {
                    105:        struct  uba_driver *ui_driver;
                    106:        short   ui_unit;        /* unit number on the system */
                    107:        short   ui_ctlr;        /* mass ctlr number; -1 if none */
                    108:        short   ui_ubanum;      /* the uba it is on */
                    109:        short   ui_slave;       /* slave on controller */
                    110:        int     (**ui_intr)();  /* interrupt handler(s) */
                    111:        caddr_t ui_addr;        /* address of device in i/o space */
                    112:        short   ui_dk;          /* if init 1 set to number for iostat */
                    113:        int     ui_flags;       /* parameter from system specification */
                    114:        short   ui_alive;       /* device exists */
                    115:        short   ui_type;        /* driver specific type information */
                    116:        caddr_t ui_physaddr;    /* phys addr, for standalone (dump) code */
                    117: /* this is the forward link in a list of devices on a controller */
                    118:        struct  uba_device *ui_forw;
                    119: /* if the device is connected to a controller, this is the controller */
                    120:        struct  uba_ctlr *ui_mi;
                    121:        struct  uba_hd *ui_hd;
                    122: };
                    123: #endif
                    124: 
                    125: /*
                    126:  * Per-driver structure.
                    127:  *
                    128:  * Each unibus driver defines entries for a set of routines
                    129:  * as well as an array of types which are acceptable to it.
                    130:  * These are used at boot time by the configuration program.
                    131:  */
                    132: struct uba_driver {
                    133:        int     (*ud_probe)();          /* see if a driver is really there */
                    134:        int     (*ud_slave)();          /* see if a slave is there */
                    135:        int     (*ud_attach)();         /* setup driver for a slave */
                    136:        int     (*ud_dgo)();            /* fill csr/ba to start transfer */
                    137:        u_short *ud_addr;               /* device csr addresses */
                    138:        char    *ud_dname;              /* name of a device */
                    139:        struct  uba_device **ud_dinfo;  /* backpointers to ubdinit structs */
                    140:        char    *ud_mname;              /* name of a controller */
                    141:        struct  uba_ctlr **ud_minfo;    /* backpointers to ubminit structs */
                    142:        short   ud_xclu;                /* want exclusive use of bdp's */
                    143:        int     (*ud_ubamem)();         /* see if dedicated memory is present */
                    144: };
                    145: #endif
                    146: 
                    147: /*
                    148:  * Flags to UBA map/bdp allocation routines
                    149:  */
                    150: #define        UBA_NEEDBDP     0x01            /* transfer needs a bdp */
                    151: #define        UBA_CANTWAIT    0x02            /* don't block me */
                    152: #define        UBA_NEED16      0x04            /* need 16 bit addresses only */
                    153: #define        UBA_HAVEBDP     0x08            /* use bdp specified in high bits */
                    154: 
                    155: /*
                    156:  * Macros to bust return word from map allocation routines.
                    157:  */
                    158: #define        UBAI_BDP(i)     ((int)(((unsigned)(i))>>28))
                    159: #define        UBAI_NMR(i)     ((int)((i)>>18)&0x3ff)
                    160: #define        UBAI_MR(i)      ((int)((i)>>9)&0x1ff)
                    161: #define        UBAI_BOFF(i)    ((int)((i)&0x1ff))
                    162: #define        UBAI_ADDR(i)    ((int)((i)&0x3ffff))    /* uba addr (boff+mr) */
                    163: 
                    164: #ifndef LOCORE
                    165: #ifdef KERNEL
                    166: /*
                    167:  * UBA related kernel variables
                    168:  */
                    169: int    numuba;                                 /* number of uba's */
                    170: struct uba_hd uba_hd[];
                    171: 
                    172: /*
                    173:  * Ubminit and ubdinit initialize the mass storage controller and
                    174:  * device tables specifying possible devices.
                    175:  */
                    176: extern struct  uba_ctlr ubminit[];
                    177: extern struct  uba_device ubdinit[];
                    178: 
                    179: /*
                    180:  * UNIbus device address space is mapped by UMEMmap
                    181:  * into virtual address umem[][].
                    182:  */
                    183: extern struct pte UMEMmap[][512];      /* uba device addr pte's */
                    184: extern char umem[][512*NBPG];          /* uba device addr space */
                    185: 
                    186: /*
                    187:  * Since some VAXen vector their unibus interrupts
                    188:  * just adjacent to the system control block, we must
                    189:  * allocate space there when running on ``any'' cpu.  This space is
                    190:  * used for the vectors for uba0 and uba1 on all cpu's.
                    191:  */
                    192: extern int (*UNIvec[])();                      /* unibus vec for uba0 */
                    193: #if NUBA > 1
                    194: extern int (*UNI1vec[])();                     /* unibus vec for uba1 */
                    195: #endif
                    196: 
                    197: #if defined(VAX780) || defined(VAX8600)
                    198: /*
                    199:  * On 780's, we must set the scb vectors for the nexus of the
                    200:  * UNIbus adaptors to vector to locore unibus adaptor interrupt dispatchers
                    201:  * which make 780's look like the other VAXen.
                    202:  */
                    203: extern Xua0int(), Xua1int(), Xua2int(), Xua3int();
                    204: #endif VAX780
                    205: #endif KERNEL
                    206: #endif !LOCORE

unix.superglobalmegacorp.com

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