|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1988 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: * @(#)vbavar.h 7.5 (Berkeley) 6/28/90 ! 21: */ ! 22: ! 23: /* ! 24: * This file contains definitions related to the kernel structures ! 25: * for dealing with the VERSAbus adapters. ! 26: * ! 27: * Each VERSAbus has a vba_hd structure. ! 28: * Each VERSAbus controller which is not a device has a vba_ctlr structure. ! 29: * Each VERSAbus device has a vba_device structure. ! 30: */ ! 31: ! 32: #ifndef LOCORE ! 33: /* ! 34: * Per-vba structure. ! 35: */ ! 36: struct vba_hd { ! 37: int vh_lastiv; /* last interrupt vector assigned */ ! 38: }; ! 39: ! 40: /* ! 41: * Per-controller structure. ! 42: * (E.g. one for each disk and tape controller, and other things ! 43: * which use and release buffered data paths.) ! 44: * ! 45: * If a controller has devices attached, then there are ! 46: * cross-referenced vba_drive structures. ! 47: * This structure is the one which is queued in VERSAbus resource wait, ! 48: * and saves the information about VERSAbus resources which are used. ! 49: * The queue of devices waiting to transfer is also attached here. ! 50: */ ! 51: struct vba_ctlr { ! 52: struct vba_driver *um_driver; ! 53: short um_ctlr; /* controller index in driver */ ! 54: short um_vbanum; /* the vba it is on */ ! 55: short um_alive; /* controller exists */ ! 56: int (**um_intr)(); /* interrupt handler(s) */ ! 57: caddr_t um_addr; /* address of device in i/o space */ ! 58: struct vba_hd *um_hd; ! 59: /* the driver saves the prototype command here for use in its go routine */ ! 60: int um_cmd; /* communication to dgo() */ ! 61: int um_vbinfo; /* save VERSAbus registers, etc */ ! 62: struct buf um_tab; /* queue of devices for this controller */ ! 63: }; ! 64: ! 65: /* ! 66: * Per ``device'' structure. ! 67: * (A controller has devices or uses and releases buffered data paths). ! 68: * (Everything else is a ``device''.) ! 69: * ! 70: * If a controller has many drives attached, then there will ! 71: * be several vba_device structures associated with a single vba_ctlr ! 72: * structure. ! 73: * ! 74: * This structure contains all the information necessary to run ! 75: * a VERSAbus device. It also contains information ! 76: * for slaves of VERSAbus controllers as to which device on the slave ! 77: * this is. A flags field here can also be given in the system specification ! 78: * and is used to tell which tty lines are hard wired or other device ! 79: * specific parameters. ! 80: */ ! 81: struct vba_device { ! 82: struct vba_driver *ui_driver; ! 83: short ui_unit; /* unit number on the system */ ! 84: short ui_ctlr; /* mass ctlr number; -1 if none */ ! 85: short ui_vbanum; /* the vba it is on */ ! 86: short ui_slave; /* slave on controller */ ! 87: int (**ui_intr)(); /* interrupt handler(s) */ ! 88: caddr_t ui_addr; /* address of device in i/o space */ ! 89: short ui_dk; /* if init 1 set to number for iostat */ ! 90: long ui_flags; /* parameter from system specification */ ! 91: short ui_alive; /* device exists */ ! 92: short ui_type; /* driver specific type information */ ! 93: caddr_t ui_physaddr; /* phys addr, for standalone (dump) code */ ! 94: /* this is the forward link in a list of devices on a controller */ ! 95: struct vba_device *ui_forw; ! 96: /* if the device is connected to a controller, this is the controller */ ! 97: struct vba_ctlr *ui_mi; ! 98: struct vba_hd *ui_hd; ! 99: }; ! 100: #endif ! 101: ! 102: /* ! 103: * Per-driver structure. ! 104: * ! 105: * Each VERSAbus driver defines entries for a set of routines ! 106: * as well as an array of types which are acceptable to it. ! 107: * These are used at boot time by the configuration program. ! 108: */ ! 109: struct vba_driver { ! 110: int (*ud_probe)(); /* see if a driver is really there */ ! 111: int (*ud_slave)(); /* see if a slave is there */ ! 112: int (*ud_attach)(); /* setup driver for a slave */ ! 113: int (*ud_dgo)(); /* fill csr/ba to start transfer */ ! 114: long *ud_addr; /* device csr addresses */ ! 115: char *ud_dname; /* name of a device */ ! 116: struct vba_device **ud_dinfo; /* backpointers to vbdinit structs */ ! 117: char *ud_mname; /* name of a controller */ ! 118: struct vba_ctlr **ud_minfo; /* backpointers to vbminit structs */ ! 119: }; ! 120: ! 121: /* ! 122: * Common state for Versabus driver I/O resources, ! 123: * including memory for intermediate buffer and page map, ! 124: * allocated by vbainit. ! 125: */ ! 126: struct vb_buf { ! 127: /* these fields set up once by vbainit */ ! 128: int vb_flags; /* device parameters */ ! 129: struct pte *vb_map; /* private page entries */ ! 130: caddr_t vb_utl; /* virtual addresses mapped by vb_map */ ! 131: caddr_t vb_rawbuf; /* intermediate buffer */ ! 132: u_long vb_physbuf; /* phys addr of intermediate buffer */ ! 133: u_long vb_bufsize; /* intermediate buffer size */ ! 134: u_long vb_maxphys; /* physical address limit */ ! 135: /* remaining fields apply to current transfer: */ ! 136: int vb_copy; /* copy to/from intermediate buffer */ ! 137: int vb_iskernel; /* is to/from kernel address space */ ! 138: }; ! 139: ! 140: /* ! 141: * flags to vbainit ! 142: */ ! 143: #define VB_32BIT 0x00 /* device uses 32-bit addressing */ ! 144: #define VB_24BIT 0x01 /* device uses 24-bit addressing */ ! 145: #define VB_20BIT 0x02 /* device uses 20-bit addressing */ ! 146: #define VB_SCATTER 0x04 /* device does scatter-gather */ ! 147: ! 148: /* ! 149: * hardware memory-addressing limits: highest physical address ! 150: * that each address length can use for main memory access. ! 151: */ ! 152: #define VB_MAXADDR20 0x000fffff /* highest addr for 20-bit */ ! 153: #define VB_MAXADDR24 0x00efffff /* highest addr for 23/24-bit */ ! 154: #define VB_MAXADDR32 0x3effffff /* highest addr for 32-bit */ ! 155: ! 156: /* ! 157: * Statistics on vba operations. ! 158: */ ! 159: struct vbastat { ! 160: u_long k_raw; /* to/from contiguous kernel DMA buffer */ ! 161: u_long u_raw; /* to/from contiguous user DMA buffer */ ! 162: u_long k_copy; /* copied to/from kernel */ ! 163: u_long u_copy; /* copied to/from user */ ! 164: u_long k_sg; /* scatter-gather to/from kernel */ ! 165: u_long u_sg; /* scatter-gather to/from user */ ! 166: }; ! 167: ! 168: #ifndef LOCORE ! 169: #ifdef KERNEL ! 170: /* ! 171: * VBA related kernel variables ! 172: */ ! 173: int numvba; /* number of uba's */ ! 174: struct vba_hd vba_hd[]; ! 175: struct vbastat vbastat; ! 176: ! 177: /* ! 178: * Vbminit and vbdinit initialize the mass storage controller and ! 179: * device tables specifying possible devices. ! 180: */ ! 181: extern struct vba_ctlr vbminit[]; ! 182: extern struct vba_device vbdinit[]; ! 183: ! 184: /* ! 185: * VERSAbus device address space is mapped by VMEMmap ! 186: * into virtual address vmem[]. ! 187: */ ! 188: extern struct pte VMEMmap[]; /* vba device addr pte's */ ! 189: extern char vmem[]; /* vba device addr space */ ! 190: u_long vbasetup(); ! 191: #endif KERNEL ! 192: #endif !LOCORE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.