Annotation of Net2/arch/tahoe/vba/vbavar.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms, with or without
                      6:  * modification, are permitted provided that the following conditions
                      7:  * are met:
                      8:  * 1. Redistributions of source code must retain the above copyright
                      9:  *    notice, this list of conditions and the following disclaimer.
                     10:  * 2. Redistributions in binary form must reproduce the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer in the
                     12:  *    documentation and/or other materials provided with the distribution.
                     13:  * 3. All advertising materials mentioning features or use of this software
                     14:  *    must display the following acknowledgement:
                     15:  *     This product includes software developed by the University of
                     16:  *     California, Berkeley and its contributors.
                     17:  * 4. Neither the name of the University nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  *
                     33:  *     @(#)vbavar.h    7.5 (Berkeley) 6/28/90
                     34:  */
                     35: 
                     36: /*
                     37:  * This file contains definitions related to the kernel structures
                     38:  * for dealing with the VERSAbus adapters.
                     39:  *
                     40:  * Each VERSAbus has a vba_hd structure.
                     41:  * Each VERSAbus controller which is not a device has a vba_ctlr structure.
                     42:  * Each VERSAbus device has a vba_device structure.
                     43:  */
                     44: 
                     45: #ifndef LOCORE
                     46: /*
                     47:  * Per-vba structure.
                     48:  */
                     49: struct vba_hd {
                     50:        int     vh_lastiv;              /* last interrupt vector assigned */
                     51: };
                     52: 
                     53: /*
                     54:  * Per-controller structure.
                     55:  * (E.g. one for each disk and tape controller, and other things
                     56:  * which use and release buffered data paths.)
                     57:  *
                     58:  * If a controller has devices attached, then there are
                     59:  * cross-referenced vba_drive structures.
                     60:  * This structure is the one which is queued in VERSAbus resource wait,
                     61:  * and saves the information about VERSAbus resources which are used.
                     62:  * The queue of devices waiting to transfer is also attached here.
                     63:  */
                     64: struct vba_ctlr {
                     65:        struct  vba_driver *um_driver;
                     66:        short   um_ctlr;        /* controller index in driver */
                     67:        short   um_vbanum;      /* the vba it is on */
                     68:        short   um_alive;       /* controller exists */
                     69:        int     (**um_intr)();  /* interrupt handler(s) */
                     70:        caddr_t um_addr;        /* address of device in i/o space */
                     71:        struct  vba_hd *um_hd;
                     72: /* the driver saves the prototype command here for use in its go routine */
                     73:        int     um_cmd;         /* communication to dgo() */
                     74:        int     um_vbinfo;      /* save VERSAbus registers, etc */
                     75:        struct  buf um_tab;     /* queue of devices for this controller */
                     76: };
                     77: 
                     78: /*
                     79:  * Per ``device'' structure.
                     80:  * (A controller has devices or uses and releases buffered data paths).
                     81:  * (Everything else is a ``device''.)
                     82:  *
                     83:  * If a controller has many drives attached, then there will
                     84:  * be several vba_device structures associated with a single vba_ctlr
                     85:  * structure.
                     86:  *
                     87:  * This structure contains all the information necessary to run
                     88:  * a VERSAbus device.  It also contains information
                     89:  * for slaves of VERSAbus controllers as to which device on the slave
                     90:  * this is.  A flags field here can also be given in the system specification
                     91:  * and is used to tell which tty lines are hard wired or other device
                     92:  * specific parameters.
                     93:  */
                     94: struct vba_device {
                     95:        struct  vba_driver *ui_driver;
                     96:        short   ui_unit;        /* unit number on the system */
                     97:        short   ui_ctlr;        /* mass ctlr number; -1 if none */
                     98:        short   ui_vbanum;      /* the vba it is on */
                     99:        short   ui_slave;       /* slave on controller */
                    100:        int     (**ui_intr)();  /* interrupt handler(s) */
                    101:        caddr_t ui_addr;        /* address of device in i/o space */
                    102:        short   ui_dk;          /* if init 1 set to number for iostat */
                    103:        long    ui_flags;       /* parameter from system specification */
                    104:        short   ui_alive;       /* device exists */
                    105:        short   ui_type;        /* driver specific type information */
                    106:        caddr_t ui_physaddr;    /* phys addr, for standalone (dump) code */
                    107: /* this is the forward link in a list of devices on a controller */
                    108:        struct  vba_device *ui_forw;
                    109: /* if the device is connected to a controller, this is the controller */
                    110:        struct  vba_ctlr *ui_mi;
                    111:        struct  vba_hd *ui_hd;
                    112: };
                    113: #endif
                    114: 
                    115: /*
                    116:  * Per-driver structure.
                    117:  *
                    118:  * Each VERSAbus driver defines entries for a set of routines
                    119:  * as well as an array of types which are acceptable to it.
                    120:  * These are used at boot time by the configuration program.
                    121:  */
                    122: struct vba_driver {
                    123:        int     (*ud_probe)();          /* see if a driver is really there */
                    124:        int     (*ud_slave)();          /* see if a slave is there */
                    125:        int     (*ud_attach)();         /* setup driver for a slave */
                    126:        int     (*ud_dgo)();            /* fill csr/ba to start transfer */
                    127:        long    *ud_addr;               /* device csr addresses */
                    128:        char    *ud_dname;              /* name of a device */
                    129:        struct  vba_device **ud_dinfo;  /* backpointers to vbdinit structs */
                    130:        char    *ud_mname;              /* name of a controller */
                    131:        struct  vba_ctlr **ud_minfo;    /* backpointers to vbminit structs */
                    132: };
                    133: 
                    134: /*
                    135:  * Common state for Versabus driver I/O resources,
                    136:  * including memory for intermediate buffer and page map,
                    137:  * allocated by vbainit.
                    138:  */
                    139: struct vb_buf {
                    140:        /* these fields set up once by vbainit */
                    141:        int     vb_flags;               /* device parameters */
                    142:        struct  pte *vb_map;            /* private page entries */
                    143:        caddr_t vb_utl;                 /* virtual addresses mapped by vb_map */
                    144:        caddr_t vb_rawbuf;              /* intermediate buffer */
                    145:        u_long  vb_physbuf;             /* phys addr of intermediate buffer */
                    146:        u_long  vb_bufsize;             /* intermediate buffer size */
                    147:        u_long  vb_maxphys;             /* physical address limit */
                    148:        /* remaining fields apply to current transfer: */
                    149:        int     vb_copy;                /* copy to/from intermediate buffer */
                    150:        int     vb_iskernel;            /* is to/from kernel address space */
                    151: };
                    152: 
                    153: /*
                    154:  * flags to vbainit
                    155:  */
                    156: #define        VB_32BIT        0x00            /* device uses 32-bit addressing */
                    157: #define        VB_24BIT        0x01            /* device uses 24-bit addressing */
                    158: #define        VB_20BIT        0x02            /* device uses 20-bit addressing */
                    159: #define        VB_SCATTER      0x04            /* device does scatter-gather */
                    160: 
                    161: /*
                    162:  * hardware memory-addressing limits: highest physical address
                    163:  * that each address length can use for main memory access.
                    164:  */
                    165: #define        VB_MAXADDR20    0x000fffff      /* highest addr for 20-bit */
                    166: #define        VB_MAXADDR24    0x00efffff      /* highest addr for 23/24-bit */
                    167: #define        VB_MAXADDR32    0x3effffff      /* highest addr for 32-bit */
                    168: 
                    169: /*
                    170:  * Statistics on vba operations.
                    171:  */
                    172: struct vbastat {
                    173:        u_long  k_raw;          /* to/from contiguous kernel DMA buffer */
                    174:        u_long  u_raw;          /* to/from contiguous user DMA buffer */
                    175:        u_long  k_copy;         /* copied to/from kernel */
                    176:        u_long  u_copy;         /* copied to/from user */
                    177:        u_long  k_sg;           /* scatter-gather to/from kernel */
                    178:        u_long  u_sg;           /* scatter-gather to/from user */
                    179: };
                    180: 
                    181: #ifndef LOCORE
                    182: #ifdef KERNEL
                    183: /*
                    184:  * VBA related kernel variables
                    185:  */
                    186: int    numvba;                                 /* number of uba's */
                    187: struct vba_hd vba_hd[];
                    188: struct vbastat vbastat;
                    189: 
                    190: /*
                    191:  * Vbminit and vbdinit initialize the mass storage controller and
                    192:  * device tables specifying possible devices.
                    193:  */
                    194: extern struct  vba_ctlr vbminit[];
                    195: extern struct  vba_device vbdinit[];
                    196: 
                    197: /*
                    198:  * VERSAbus device address space is mapped by VMEMmap
                    199:  * into virtual address vmem[].
                    200:  */
                    201: extern struct pte VMEMmap[];   /* vba device addr pte's */
                    202: extern char vmem[];            /* vba device addr space */
                    203: u_long vbasetup();
                    204: #endif KERNEL
                    205: #endif !LOCORE

unix.superglobalmegacorp.com

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