[BACK]Return to ubavar.h CVS log [TXT][DIR] Up to [local] / sys / arch / vax / qbus

Annotation of sys/arch/vax/qbus/ubavar.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: ubavar.h,v 1.7 2006/07/19 20:22:37 miod Exp $ */
                      2: /*     $NetBSD: ubavar.h,v 1.31 2001/04/26 19:16:07 ragge Exp $        */
                      3:
                      4: /*
                      5:  * Copyright (c) 1982, 1986 Regents of the University of California.
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. Neither the name of the University nor the names of its contributors
                     17:  *    may be used to endorse or promote products derived from this software
                     18:  *    without specific prior written permission.
                     19:  *
                     20:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     21:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     22:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     23:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     30:  * SUCH DAMAGE.
                     31:  *
                     32:  *     @(#)ubavar.h    7.7 (Berkeley) 6/28/90
                     33:  */
                     34: #ifndef _QBUS_UBAVAR_H
                     35: #define        _QBUS_UBAVAR_H
                     36:
                     37: /*
                     38:  * This file contains definitions related to the kernel structures
                     39:  * for dealing with the unibus adapters.
                     40:  *
                     41:  * Each uba has a uba_softc structure.
                     42:  * Each unibus controller which is not a device has a uba_ctlr structure.
                     43:  * Each unibus device has a uba_device structure.
                     44:  */
                     45:
                     46: /*
                     47:  * Per-uba structure.
                     48:  *
                     49:  * This structure holds the interrupt vector for the uba,
                     50:  * and its address in physical and virtual space.  At boot time
                     51:  * we determine the devices attached to the uba's and their
                     52:  * interrupt vectors, filling in uh_vec.  We free the map
                     53:  * register and bdp resources of the uba into the structures
                     54:  * defined here.
                     55:  *
                     56:  * During normal operation, resources are allocated and returned
                     57:  * to the structures here.  We watch the number of passive releases
                     58:  * on each uba, and if the number is excessive may reset the uba.
                     59:  *
                     60:  * When uba resources are needed and not available, or if a device
                     61:  * which can tolerate no other uba activity (rk07) gets on the bus,
                     62:  * then device drivers may have to wait to get to the bus and are
                     63:  * queued here.  It is also possible for processes to block in
                     64:  * the unibus driver in resource wait (mrwant, bdpwant); these
                     65:  * wait states are also recorded here.
                     66:  */
                     67: struct uba_softc {
                     68:        struct  device uh_dev;          /* Device struct, autoconfig */
                     69:        struct  evcount uh_intrcnt;             /* interrupt counting */
                     70:        SIMPLEQ_HEAD(, uba_unit) uh_resq;       /* resource wait chain */
                     71:        SIMPLEQ_HEAD(, uba_reset) uh_resetq;    /* ubareset queue */
                     72:        int     uh_lastiv;              /* last free interrupt vector */
                     73:        int     (*uh_errchk)(struct uba_softc *);
                     74:        void    (*uh_beforescan)(struct uba_softc *);
                     75:        void    (*uh_afterscan)(struct uba_softc *);
                     76:        void    (*uh_ubainit)(struct uba_softc *);
                     77:        void    (*uh_ubapurge)(struct uba_softc *, int);
                     78:        short   uh_nr;                  /* Unibus sequential number */
                     79:        bus_space_tag_t uh_iot;         /* Tag for this Unibus */
                     80:        bus_space_handle_t uh_ioh;      /* Handle for I/O space */
                     81:        bus_dma_tag_t   uh_dmat;
                     82: };
                     83:
                     84: /*
                     85:  * Per-controller structure.
                     86:  * The unit struct is common to both the adapter and the controller
                     87:  * to which it belongs. It is only used on controllers that handles
                     88:  * BDP's, and calls the adapter queueing subroutines.
                     89:  */
                     90: struct uba_unit {
                     91:        SIMPLEQ_ENTRY(uba_unit) uu_resq;/* Queue while waiting for resources */
                     92:        void    *uu_softc;      /* Pointer to units softc */
                     93:        int     uu_bdp;         /* for controllers that hang on to bdp's */
                     94:        int    (*uu_ready)(struct uba_unit *);
                     95:        void    *uu_ref;        /* Buffer this is related to */
                     96:        short   uu_xclu;        /* want exclusive use of bdp's */
                     97:        short   uu_keepbdp;     /* hang on to bdp's once allocated */
                     98: };
                     99:
                    100: /*
                    101:  * Reset structure. All devices that needs to be reinitialized
                    102:  * after an ubareset registers with this struct.
                    103:  */
                    104: struct uba_reset {
                    105:        SIMPLEQ_ENTRY(uba_reset) ur_resetq;
                    106:        void (*ur_reset)(struct device *);
                    107:        struct device *ur_dev;
                    108: };
                    109:
                    110: /*
                    111:  * uba_attach_args is used during autoconfiguration. It is sent
                    112:  * from ubascan() to each (possible) device.
                    113:  */
                    114: struct uba_attach_args {
                    115:        bus_space_tag_t ua_iot;         /* Tag for this bus I/O-space */
                    116:        bus_addr_t      ua_ioh;         /* I/O regs addr */
                    117:        bus_dma_tag_t   ua_dmat;
                    118:        void            *ua_icookie;    /* Cookie for interrupt establish */
                    119:        int             ua_iaddr;       /* Full CSR address of device */
                    120:        int             ua_br;          /* IPL this dev interrupted on */
                    121:        int             ua_cvec;        /* Vector for this device */
                    122: };
                    123:
                    124: /*
                    125:  * Flags to UBA map/bdp allocation routines
                    126:  */
                    127: #define        UBA_NEEDBDP     0x01            /* transfer needs a bdp */
                    128: #define        UBA_CANTWAIT    0x02            /* don't block me */
                    129: #define        UBA_NEED16      0x04            /* need 16 bit addresses only */
                    130: #define        UBA_HAVEBDP     0x08            /* use bdp specified in high bits */
                    131: #define        UBA_DONTQUE     0x10            /* Do not enqueue xfer */
                    132:
                    133: /*
                    134:  * Struct for unibus allocation.
                    135:  */
                    136: struct ubinfo {
                    137:        bus_dmamap_t ui_dmam;
                    138:        bus_dma_segment_t ui_seg;
                    139:        int ui_rseg;
                    140:        caddr_t ui_vaddr;
                    141:        bus_addr_t ui_baddr;
                    142:        bus_size_t ui_size;
                    143: };
                    144:
                    145: /*
                    146:  * Some common defines for all subtypes of U/Q-buses/adapters.
                    147:  */
                    148: #define        UBAIOSIZE       (8*1024)        /* 8K I/O space */
                    149: #define ubdevreg(addr) ((addr) & 017777)
                    150:
                    151: #ifdef _KERNEL
                    152: void uba_intr_establish(void *, int, void (*)(void *), void *, struct evcount *);
                    153: void uba_reset_establish(void (*)(struct device *), struct device *);
                    154: void uba_attach(struct uba_softc *, unsigned long);
                    155: void uba_enqueue(struct uba_unit *);
                    156: void uba_done(struct uba_softc *);
                    157: void ubareset(struct uba_softc *);
                    158: int uballoc(struct uba_softc *, struct ubinfo *, int);
                    159: int ubmemalloc(struct uba_softc *, struct ubinfo *, int);
                    160: void ubfree(struct uba_softc *, struct ubinfo *);
                    161: void ubmemfree(struct uba_softc *, struct ubinfo *);
                    162: #endif /* _KERNEL */
                    163:
                    164: #endif /* _QBUS_UBAVAR_H */

CVSweb