Annotation of 43BSDReno/sys/vaxuba/ubavar.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1982, 1986 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * Redistribution is only permitted until one year after the first shipment
        !             6:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
        !             7:  * binary forms are permitted provided that: (1) source distributions retain
        !             8:  * this entire copyright notice and comment, and (2) distributions including
        !             9:  * binaries display the following acknowledgement:  This product includes
        !            10:  * software developed by the University of California, Berkeley and its
        !            11:  * contributors'' in the documentation or other materials provided with the
        !            12:  * distribution and in all advertising materials mentioning features or use
        !            13:  * of this software.  Neither the name of the University nor the names of
        !            14:  * its contributors may be used to endorse or promote products derived from
        !            15:  * this software without specific prior written permission.
        !            16:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            17:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            18:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            19:  *
        !            20:  *     @(#)ubavar.h    7.7 (Berkeley) 6/28/90
        !            21:  */
        !            22: 
        !            23: /*
        !            24:  * This file contains definitions related to the kernel structures
        !            25:  * for dealing with the unibus adapters.
        !            26:  *
        !            27:  * Each uba has a uba_hd structure.
        !            28:  * Each unibus controller which is not a device has a uba_ctlr structure.
        !            29:  * Each unibus device has a uba_device structure.
        !            30:  */
        !            31: 
        !            32: #ifndef LOCORE
        !            33: /*
        !            34:  * Per-uba structure.
        !            35:  *
        !            36:  * This structure holds the interrupt vector for the uba,
        !            37:  * and its address in physical and virtual space.  At boot time
        !            38:  * we determine the devices attached to the uba's and their
        !            39:  * interrupt vectors, filling in uh_vec.  We free the map
        !            40:  * register and bdp resources of the uba into the structures
        !            41:  * defined here.
        !            42:  *
        !            43:  * During normal operation, resources are allocated and returned
        !            44:  * to the structures here.  We watch the number of passive releases
        !            45:  * on each uba, and if the number is excessive may reset the uba.
        !            46:  * 
        !            47:  * When uba resources are needed and not available, or if a device
        !            48:  * which can tolerate no other uba activity (rk07) gets on the bus,
        !            49:  * then device drivers may have to wait to get to the bus and are
        !            50:  * queued here.  It is also possible for processes to block in
        !            51:  * the unibus driver in resource wait (mrwant, bdpwant); these
        !            52:  * wait states are also recorded here.
        !            53:  */
        !            54: struct uba_hd {
        !            55:        int     uh_type;                /* type of adaptor */
        !            56:        struct  uba_regs *uh_uba;       /* virt addr of uba adaptor regs */
        !            57:        struct  uba_regs *uh_physuba;   /* phys addr of uba adaptor regs */
        !            58:        struct  pte *uh_mr;             /* start of page map */
        !            59:        int     uh_memsize;             /* size of uba memory, pages */
        !            60:        caddr_t uh_mem;                 /* start of uba memory address space */
        !            61:        caddr_t uh_iopage;              /* start of uba io page */
        !            62:        int     (**uh_vec)();           /* interrupt vector */
        !            63:        struct  uba_device *uh_actf;    /* head of queue to transfer */
        !            64:        struct  uba_device *uh_actl;    /* tail of queue to transfer */
        !            65:        short   uh_mrwant;              /* someone is waiting for map reg */
        !            66:        short   uh_bdpwant;             /* someone awaits bdp's */
        !            67:        int     uh_bdpfree;             /* free bdp's */
        !            68:        int     uh_hangcnt;             /* number of ticks hung */
        !            69:        int     uh_zvcnt;               /* number of recent 0 vectors */
        !            70:        long    uh_zvtime;              /* time over which zvcnt accumulated */
        !            71:        int     uh_zvtotal;             /* total number of 0 vectors */
        !            72:        int     uh_errcnt;              /* number of errors */
        !            73:        int     uh_lastiv;              /* last free interrupt vector */
        !            74:        short   uh_users;               /* transient bdp use count */
        !            75:        short   uh_xclu;                /* an rk07 is using this uba! */
        !            76:        int     uh_lastmem;             /* limit of any unibus memory */
        !            77: #define        UAMSIZ  100
        !            78:        struct  map *uh_map;            /* register free map */
        !            79: };
        !            80: 
        !            81: /* given a pointer to uba_regs, find DWBUA registers */
        !            82: /* this should be replaced with a union in uba_hd */
        !            83: #define        BUA(uba)        ((struct dwbua_regs *)(uba))
        !            84: 
        !            85: /*
        !            86:  * Per-controller structure.
        !            87:  * (E.g. one for each disk and tape controller, and other things
        !            88:  * which use and release buffered data paths.)
        !            89:  *
        !            90:  * If a controller has devices attached, then there are
        !            91:  * cross-referenced uba_drive structures.
        !            92:  * This structure is the one which is queued in unibus resource wait,
        !            93:  * and saves the information about unibus resources which are used.
        !            94:  * The queue of devices waiting to transfer is also attached here.
        !            95:  */
        !            96: struct uba_ctlr {
        !            97:        struct  uba_driver *um_driver;
        !            98:        short   um_ctlr;        /* controller index in driver */
        !            99:        short   um_ubanum;      /* the uba it is on */
        !           100:        short   um_alive;       /* controller exists */
        !           101:        int     (**um_intr)();  /* interrupt handler(s) */
        !           102:        caddr_t um_addr;        /* address of device in i/o space */
        !           103:        struct  uba_hd *um_hd;
        !           104: /* the driver saves the prototype command here for use in its go routine */
        !           105:        int     um_cmd;         /* communication to dgo() */
        !           106:        int     um_ubinfo;      /* save unibus registers, etc */
        !           107:        int     um_bdp;         /* for controllers that hang on to bdp's */
        !           108:        struct  buf um_tab;     /* queue of devices for this controller */
        !           109: };
        !           110: 
        !           111: /*
        !           112:  * Per ``device'' structure.
        !           113:  * (A controller has devices or uses and releases buffered data paths).
        !           114:  * (Everything else is a ``device''.)
        !           115:  *
        !           116:  * If a controller has many drives attached, then there will
        !           117:  * be several uba_device structures associated with a single uba_ctlr
        !           118:  * structure.
        !           119:  *
        !           120:  * This structure contains all the information necessary to run
        !           121:  * a unibus device such as a dz or a dh.  It also contains information
        !           122:  * for slaves of unibus controllers as to which device on the slave
        !           123:  * this is.  A flags field here can also be given in the system specification
        !           124:  * and is used to tell which dz lines are hard wired or other device
        !           125:  * specific parameters.
        !           126:  */
        !           127: struct uba_device {
        !           128:        struct  uba_driver *ui_driver;
        !           129:        short   ui_unit;        /* unit number on the system */
        !           130:        short   ui_ctlr;        /* mass ctlr number; -1 if none */
        !           131:        short   ui_ubanum;      /* the uba it is on */
        !           132:        short   ui_slave;       /* slave on controller */
        !           133:        int     (**ui_intr)();  /* interrupt handler(s) */
        !           134:        caddr_t ui_addr;        /* address of device in i/o space */
        !           135:        short   ui_dk;          /* if init 1 set to number for iostat */
        !           136:        int     ui_flags;       /* parameter from system specification */
        !           137:        short   ui_alive;       /* device exists */
        !           138:        short   ui_type;        /* driver specific type information */
        !           139:        caddr_t ui_physaddr;    /* phys addr, for standalone (dump) code */
        !           140: /* this is the forward link in a list of devices on a controller */
        !           141:        struct  uba_device *ui_forw;
        !           142: /* if the device is connected to a controller, this is the controller */
        !           143:        struct  uba_ctlr *ui_mi;
        !           144:        struct  uba_hd *ui_hd;
        !           145: };
        !           146: 
        !           147: /*
        !           148:  * Per-driver structure.
        !           149:  *
        !           150:  * Each unibus driver defines entries for a set of routines
        !           151:  * as well as an array of types which are acceptable to it.
        !           152:  * These are used at boot time by the configuration program.
        !           153:  */
        !           154: struct uba_driver {
        !           155:        int     (*ud_probe)();          /* see if a driver is really there */
        !           156:        int     (*ud_slave)();          /* see if a slave is there */
        !           157:        int     (*ud_attach)();         /* setup driver for a slave */
        !           158:        int     (*ud_dgo)();            /* fill csr/ba to start transfer */
        !           159:        u_short *ud_addr;               /* device csr addresses */
        !           160:        char    *ud_dname;              /* name of a device */
        !           161:        struct  uba_device **ud_dinfo;  /* backpointers to ubdinit structs */
        !           162:        char    *ud_mname;              /* name of a controller */
        !           163:        struct  uba_ctlr **ud_minfo;    /* backpointers to ubminit structs */
        !           164:        short   ud_xclu;                /* want exclusive use of bdp's */
        !           165:        short   ud_keepbdp;             /* hang on to bdp's once allocated */
        !           166:        int     (*ud_ubamem)();         /* see if dedicated memory is present */
        !           167: };
        !           168: #endif
        !           169: 
        !           170: /*
        !           171:  * Flags to UBA map/bdp allocation routines
        !           172:  */
        !           173: #define        UBA_NEEDBDP     0x01            /* transfer needs a bdp */
        !           174: #define        UBA_CANTWAIT    0x02            /* don't block me */
        !           175: #define        UBA_NEED16      0x04            /* need 16 bit addresses only */
        !           176: #define        UBA_HAVEBDP     0x08            /* use bdp specified in high bits */
        !           177: 
        !           178: /*
        !           179:  * Macros to bust return word from map allocation routines.
        !           180:  * SHOULD USE STRUCTURE TO STORE UBA RESOURCE ALLOCATION:
        !           181:  */
        !           182: #ifdef notyet
        !           183: struct ubinfo {
        !           184:        long    ub_addr;        /* unibus address: mr + boff */
        !           185:        int     ub_nmr;         /* number of registers, 0 if empty */
        !           186:        int     ub_bdp;         /* bdp number, 0 if none */
        !           187: };
        !           188: #define        UBAI_MR(i)      (((i) >> 9) & 0x7ff)    /* starting map register */
        !           189: #define        UBAI_BOFF(i)    ((i)&0x1ff)             /* page offset */
        !           190: #else
        !           191: #define        UBAI_BDP(i)     ((int)(((unsigned)(i)) >> 28))
        !           192: #define        BDPMASK         0xf0000000
        !           193: #define        UBAI_NMR(i)     ((int)((i) >> 20) & 0xff)       /* max 255 (=127.5K) */
        !           194: #define        UBA_MAXNMR      255
        !           195: #define        UBAI_MR(i)      ((int)((i) >> 9) & 0x7ff)       /* max 2047 */
        !           196: #define        UBA_MAXMR       2047
        !           197: #define        UBAI_BOFF(i)    ((int)((i) & 0x1ff))
        !           198: #define        UBAI_ADDR(i)    ((int)((i) & 0xfffff))  /* uba addr (boff+mr) */
        !           199: #define        UBAI_INFO(off, mr, nmr, bdp) \
        !           200:        (((bdp) << 28) | ((nmr) << 20) | ((mr) << 9) | (off))
        !           201: #endif
        !           202: 
        !           203: #ifndef LOCORE
        !           204: #ifdef KERNEL
        !           205: #define        ubago(ui)       ubaqueue(ui, 0)
        !           206: 
        !           207: /*
        !           208:  * UBA related kernel variables
        !           209:  */
        !           210: int    numuba;                                 /* number of uba's */
        !           211: struct uba_hd uba_hd[];
        !           212: 
        !           213: /*
        !           214:  * Ubminit and ubdinit initialize the mass storage controller and
        !           215:  * device tables specifying possible devices.
        !           216:  */
        !           217: extern struct  uba_ctlr ubminit[];
        !           218: extern struct  uba_device ubdinit[];
        !           219: 
        !           220: /*
        !           221:  * UNIBUS device address space is mapped by UMEMmap
        !           222:  * into virtual address umem[][].
        !           223:  * The IO page is mapped to the last 8K of each.
        !           224:  * This should be enlarged for the Q22 bus.
        !           225:  */
        !           226: extern struct pte UMEMmap[][512];      /* uba device addr pte's */
        !           227: extern char umem[][512*NBPG];          /* uba device addr space */
        !           228: 
        !           229: /*
        !           230:  * Since some VAXen vector their unibus interrupts
        !           231:  * just adjacent to the system control block, we must
        !           232:  * allocate space there when running on ``any'' cpu.  This space is
        !           233:  * used for the vectors for all ubas.
        !           234:  */
        !           235: extern int (*UNIvec[][128])();                 /* unibus vec for ubas */
        !           236: extern int (*eUNIvec)();                       /* end of unibus vec */
        !           237: 
        !           238: #if defined(VAX780) || defined(VAX8600)
        !           239: /*
        !           240:  * On DW780's, we must set the scb vectors for the nexus of the
        !           241:  * UNIbus adaptors to vector to locore unibus adaptor interrupt dispatchers
        !           242:  * which make 780's look like the other VAXen.
        !           243:  */
        !           244: extern Xua0int(), Xua1int(), Xua2int(), Xua3int();
        !           245: #endif VAX780
        !           246: #endif KERNEL
        !           247: #endif !LOCORE

unix.superglobalmegacorp.com

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