Annotation of 43BSDTahoe/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.4 (Berkeley) 5/14/88
                      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:        int     uh_type;                /* type of adaptor */
                     42:        struct  uba_regs *uh_uba;       /* virt addr of uba adaptor regs */
                     43:        struct  uba_regs *uh_physuba;   /* phys addr of uba adaptor regs */
                     44:        struct  pte *uh_mr;             /* start of page map */
                     45:        int     uh_memsize;             /* size of uba memory, pages */
                     46:        caddr_t uh_mem;                 /* start of uba memory address space */
                     47:        caddr_t uh_iopage;              /* start of uba io page */
                     48:        int     (**uh_vec)();           /* interrupt vector */
                     49:        struct  uba_device *uh_actf;    /* head of queue to transfer */
                     50:        struct  uba_device *uh_actl;    /* tail of queue to transfer */
                     51:        short   uh_mrwant;              /* someone is waiting for map reg */
                     52:        short   uh_bdpwant;             /* someone awaits bdp's */
                     53:        int     uh_bdpfree;             /* free bdp's */
                     54:        int     uh_hangcnt;             /* number of ticks hung */
                     55:        int     uh_zvcnt;               /* number of recent 0 vectors */
                     56:        long    uh_zvtime;              /* time over which zvcnt accumulated */
                     57:        int     uh_zvtotal;             /* total number of 0 vectors */
                     58:        int     uh_errcnt;              /* number of errors */
                     59:        int     uh_lastiv;              /* last free interrupt vector */
                     60:        short   uh_users;               /* transient bdp use count */
                     61:        short   uh_xclu;                /* an rk07 is using this uba! */
                     62:        int     uh_lastmem;             /* limit of any unibus memory */
                     63: #define        UAMSIZ  100
                     64:        struct  map *uh_map;            /* buffered data path regs free */
                     65: };
                     66: 
                     67: /* given a pointer to uba_regs, find DWBUA registers */
                     68: /* this should be replaced with a union in uba_hd */
                     69: #define        BUA(uba)        ((struct dwbua_regs *)(uba))
                     70: 
                     71: /*
                     72:  * Per-controller structure.
                     73:  * (E.g. one for each disk and tape controller, and other things
                     74:  * which use and release buffered data paths.)
                     75:  *
                     76:  * If a controller has devices attached, then there are
                     77:  * cross-referenced uba_drive structures.
                     78:  * This structure is the one which is queued in unibus resource wait,
                     79:  * and saves the information about unibus resources which are used.
                     80:  * The queue of devices waiting to transfer is also attached here.
                     81:  */
                     82: struct uba_ctlr {
                     83:        struct  uba_driver *um_driver;
                     84:        short   um_ctlr;        /* controller index in driver */
                     85:        short   um_ubanum;      /* the uba it is on */
                     86:        short   um_alive;       /* controller exists */
                     87:        int     (**um_intr)();  /* interrupt handler(s) */
                     88:        caddr_t um_addr;        /* address of device in i/o space */
                     89:        struct  uba_hd *um_hd;
                     90: /* the driver saves the prototype command here for use in its go routine */
                     91:        int     um_cmd;         /* communication to dgo() */
                     92:        int     um_ubinfo;      /* save unibus registers, etc */
                     93:        int     um_bdp;         /* for controllers that hang on to bdp's */
                     94:        struct  buf um_tab;     /* queue of devices for this controller */
                     95: };
                     96: 
                     97: /*
                     98:  * Per ``device'' structure.
                     99:  * (A controller has devices or uses and releases buffered data paths).
                    100:  * (Everything else is a ``device''.)
                    101:  *
                    102:  * If a controller has many drives attached, then there will
                    103:  * be several uba_device structures associated with a single uba_ctlr
                    104:  * structure.
                    105:  *
                    106:  * This structure contains all the information necessary to run
                    107:  * a unibus device such as a dz or a dh.  It also contains information
                    108:  * for slaves of unibus controllers as to which device on the slave
                    109:  * this is.  A flags field here can also be given in the system specification
                    110:  * and is used to tell which dz lines are hard wired or other device
                    111:  * specific parameters.
                    112:  */
                    113: struct uba_device {
                    114:        struct  uba_driver *ui_driver;
                    115:        short   ui_unit;        /* unit number on the system */
                    116:        short   ui_ctlr;        /* mass ctlr number; -1 if none */
                    117:        short   ui_ubanum;      /* the uba it is on */
                    118:        short   ui_slave;       /* slave on controller */
                    119:        int     (**ui_intr)();  /* interrupt handler(s) */
                    120:        caddr_t ui_addr;        /* address of device in i/o space */
                    121:        short   ui_dk;          /* if init 1 set to number for iostat */
                    122:        int     ui_flags;       /* parameter from system specification */
                    123:        short   ui_alive;       /* device exists */
                    124:        short   ui_type;        /* driver specific type information */
                    125:        caddr_t ui_physaddr;    /* phys addr, for standalone (dump) code */
                    126: /* this is the forward link in a list of devices on a controller */
                    127:        struct  uba_device *ui_forw;
                    128: /* if the device is connected to a controller, this is the controller */
                    129:        struct  uba_ctlr *ui_mi;
                    130:        struct  uba_hd *ui_hd;
                    131: };
                    132: 
                    133: /*
                    134:  * Per-driver structure.
                    135:  *
                    136:  * Each unibus driver defines entries for a set of routines
                    137:  * as well as an array of types which are acceptable to it.
                    138:  * These are used at boot time by the configuration program.
                    139:  */
                    140: struct uba_driver {
                    141:        int     (*ud_probe)();          /* see if a driver is really there */
                    142:        int     (*ud_slave)();          /* see if a slave is there */
                    143:        int     (*ud_attach)();         /* setup driver for a slave */
                    144:        int     (*ud_dgo)();            /* fill csr/ba to start transfer */
                    145:        u_short *ud_addr;               /* device csr addresses */
                    146:        char    *ud_dname;              /* name of a device */
                    147:        struct  uba_device **ud_dinfo;  /* backpointers to ubdinit structs */
                    148:        char    *ud_mname;              /* name of a controller */
                    149:        struct  uba_ctlr **ud_minfo;    /* backpointers to ubminit structs */
                    150:        short   ud_xclu;                /* want exclusive use of bdp's */
                    151:        short   ud_keepbdp;             /* hang on to bdp's once allocated */
                    152:        int     (*ud_ubamem)();         /* see if dedicated memory is present */
                    153: };
                    154: #endif
                    155: 
                    156: /*
                    157:  * Flags to UBA map/bdp allocation routines
                    158:  */
                    159: #define        UBA_NEEDBDP     0x01            /* transfer needs a bdp */
                    160: #define        UBA_CANTWAIT    0x02            /* don't block me */
                    161: #define        UBA_NEED16      0x04            /* need 16 bit addresses only */
                    162: #define        UBA_HAVEBDP     0x08            /* use bdp specified in high bits */
                    163: 
                    164: /*
                    165:  * Macros to bust return word from map allocation routines.
                    166:  */
                    167: #define        UBAI_BDP(i)     ((int)(((unsigned)(i))>>28))
                    168: #define        UBAI_NMR(i)     ((int)((i)>>18)&0x3ff)
                    169: #define        UBAI_MR(i)      ((int)((i)>>9)&0x1ff)
                    170: #define        UBAI_BOFF(i)    ((int)((i)&0x1ff))
                    171: #define        UBAI_ADDR(i)    ((int)((i)&0x3ffff))    /* uba addr (boff+mr) */
                    172: 
                    173: #ifndef LOCORE
                    174: #ifdef KERNEL
                    175: #define        ubago(ui)       ubaqueue(ui, 0)
                    176: 
                    177: /*
                    178:  * UBA related kernel variables
                    179:  */
                    180: int    numuba;                                 /* number of uba's */
                    181: struct uba_hd uba_hd[];
                    182: 
                    183: /*
                    184:  * Ubminit and ubdinit initialize the mass storage controller and
                    185:  * device tables specifying possible devices.
                    186:  */
                    187: extern struct  uba_ctlr ubminit[];
                    188: extern struct  uba_device ubdinit[];
                    189: 
                    190: /*
                    191:  * UNIBUS device address space is mapped by UMEMmap
                    192:  * into virtual address umem[][].
                    193:  * The IO page is mapped to the last 8K of each.
                    194:  * This should be enlarged for the Q22 bus.
                    195:  */
                    196: extern struct pte UMEMmap[][512];      /* uba device addr pte's */
                    197: extern char umem[][512*NBPG];          /* uba device addr space */
                    198: 
                    199: /*
                    200:  * Since some VAXen vector their unibus interrupts
                    201:  * just adjacent to the system control block, we must
                    202:  * allocate space there when running on ``any'' cpu.  This space is
                    203:  * used for the vectors for all ubas.
                    204:  */
                    205: extern int (*UNIvec[][128])();                 /* unibus vec for ubas */
                    206: extern int (*eUNIvec)();                       /* end of unibus vec */
                    207: 
                    208: #if defined(VAX780) || defined(VAX8600)
                    209: /*
                    210:  * On DW780's, we must set the scb vectors for the nexus of the
                    211:  * UNIbus adaptors to vector to locore unibus adaptor interrupt dispatchers
                    212:  * which make 780's look like the other VAXen.
                    213:  */
                    214: extern Xua0int(), Xua1int(), Xua2int(), Xua3int();
                    215: #endif VAX780
                    216: #endif KERNEL
                    217: #endif !LOCORE

unix.superglobalmegacorp.com

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