1 /* vbavar.h 1.3 86/01/20 */ 2 3 /* 4 * This file contains definitions related to the kernel structures 5 * for dealing with the VERSAbus adapters. 6 * 7 * Each VERSAbus has a vba_hd structure. 8 * Each VERSAbus controller which is not a device has a vba_ctlr structure. 9 * Each VERSAbus device has a vba_device structure. 10 */ 11 12 #ifndef LOCORE 13 /* 14 * Per-vba structure. 15 */ 16 struct vba_hd { 17 int vh_lastiv; /* last interrupt vector assigned */ 18 }; 19 20 /* 21 * Per-controller structure. 22 * (E.g. one for each disk and tape controller, and other things 23 * which use and release buffered data paths.) 24 * 25 * If a controller has devices attached, then there are 26 * cross-referenced vba_drive structures. 27 * This structure is the one which is queued in VERSAbus resource wait, 28 * and saves the information about VERSAbus resources which are used. 29 * The queue of devices waiting to transfer is also attached here. 30 */ 31 struct vba_ctlr { 32 struct vba_driver *um_driver; 33 short um_ctlr; /* controller index in driver */ 34 short um_vbanum; /* the vba it is on */ 35 short um_alive; /* controller exists */ 36 int (**um_intr)(); /* interrupt handler(s) */ 37 caddr_t um_addr; /* address of device in i/o space */ 38 struct vba_hd *um_hd; 39 /* the driver saves the prototype command here for use in its go routine */ 40 int um_cmd; /* communication to dgo() */ 41 int um_vbinfo; /* save VERSAbus registers, etc */ 42 struct buf um_tab; /* queue of devices for this controller */ 43 }; 44 45 /* 46 * Per ``device'' structure. 47 * (A controller has devices or uses and releases buffered data paths). 48 * (Everything else is a ``device''.) 49 * 50 * If a controller has many drives attached, then there will 51 * be several vba_device structures associated with a single vba_ctlr 52 * structure. 53 * 54 * This structure contains all the information necessary to run 55 * a VERSAbus device. It also contains information 56 * for slaves of VERSAbus controllers as to which device on the slave 57 * this is. A flags field here can also be given in the system specification 58 * and is used to tell which tty lines are hard wired or other device 59 * specific parameters. 60 */ 61 struct vba_device { 62 struct vba_driver *ui_driver; 63 short ui_unit; /* unit number on the system */ 64 short ui_ctlr; /* mass ctlr number; -1 if none */ 65 short ui_vbanum; /* the vba it is on */ 66 short ui_slave; /* slave on controller */ 67 int (**ui_intr)(); /* interrupt handler(s) */ 68 caddr_t ui_addr; /* address of device in i/o space */ 69 short ui_dk; /* if init 1 set to number for iostat */ 70 long ui_flags; /* parameter from system specification */ 71 short ui_alive; /* device exists */ 72 short ui_type; /* driver specific type information */ 73 caddr_t ui_physaddr; /* phys addr, for standalone (dump) code */ 74 /* this is the forward link in a list of devices on a controller */ 75 struct vba_device *ui_forw; 76 /* if the device is connected to a controller, this is the controller */ 77 struct vba_ctlr *ui_mi; 78 struct vba_hd *ui_hd; 79 }; 80 #endif 81 82 /* 83 * Per-driver structure. 84 * 85 * Each VERSAbus driver defines entries for a set of routines 86 * as well as an array of types which are acceptable to it. 87 * These are used at boot time by the configuration program. 88 */ 89 struct vba_driver { 90 int (*ud_probe)(); /* see if a driver is really there */ 91 int (*ud_slave)(); /* see if a slave is there */ 92 int (*ud_attach)(); /* setup driver for a slave */ 93 int (*ud_dgo)(); /* fill csr/ba to start transfer */ 94 long *ud_addr; /* device csr addresses */ 95 char *ud_dname; /* name of a device */ 96 struct vba_device **ud_dinfo; /* backpointers to vbdinit structs */ 97 char *ud_mname; /* name of a controller */ 98 struct vba_ctlr **ud_minfo; /* backpointers to vbminit structs */ 99 }; 100 101 #ifndef LOCORE 102 #ifdef KERNEL 103 /* 104 * VBA related kernel variables 105 */ 106 int numvba; /* number of uba's */ 107 struct vba_hd vba_hd[]; 108 109 /* 110 * Vbminit and vbdinit initialize the mass storage controller and 111 * device tables specifying possible devices. 112 */ 113 extern struct vba_ctlr vbminit[]; 114 extern struct vba_device vbdinit[]; 115 116 /* 117 * VERSAbus device address space is mapped by VMEMmap 118 * into virtual address vmem[][]. 119 */ 120 extern struct pte VMEMmap[]; /* vba device addr pte's */ 121 extern char vmem[]; /* vba device addr space */ 122 123 #endif KERNEL 124 #endif !LOCORE 125