1 /* 2 * @(#)qd_data.c 1.16 (ULTRIX) 7/2/86 3 */ 4 5 /************************************************************************ 6 * * 7 * Copyright (c) 1985, 1986 by * 8 * Digital Equipment Corporation, Maynard, MA * 9 * All rights reserved. * 10 * * 11 * This software is furnished under a license and may be used and * 12 * copied only in accordance with the terms of such license and * 13 * with the inclusion of the above copyright notice. This * 14 * software or any other copies thereof may not be provided or * 15 * otherwise made available to any other person. No title to and * 16 * ownership of the software is hereby transferred. * 17 * * 18 * The information in this software is subject to change without * 19 * notice and should not be construed as a commitment by Digital * 20 * Equipment Corporation. * 21 * * 22 * Digital assumes no responsibility for the use or reliability * 23 * of its software on equipment which is not supplied by Digital. * 24 * * 25 ************************************************************************/ 26 27 /* 28 * qd_data.c 29 * 30 * Modification history 31 * 32 * QDSS data file 33 * 34 * 3-Jul-85 - longo 35 * 36 * Created file. 37 * 38 * 15-Jul-85 - longo 39 * 40 * Added "qdfont.h" include and moved "mouse_report" struct 41 * and definitions in from "qduser.h". 42 * 43 * 18-Aug-85 - longo 44 * 45 * Added "duart_imask" entry to qdflags for shadowing. 46 * 47 * 4-Sep-85 - longo 48 * 49 * Added storage "QBAreg[]" for DMA support. 50 * 51 * 11-Sep-85 - longo 52 * 53 * Added constant for event buffer size (now 1k). 54 * 55 * 17-Sep-85 - longo 56 * 57 * Changes for DMA support. 58 * 59 * 18-Sep-85 - longo 60 * 61 * Changes for scroll interrupt support. 62 * 63 * 2-Oct-85 - longo 64 * 65 * Added color map write buffer shared RAM stuff and adder 66 * interrupt enable register shadowing to qdflags. 67 * 68 * 4-Oct-85 - longo 69 * 70 * Added kernel loop back state flag to qdflags. 71 * 72 * 16-Oct-85 - longo 73 * 74 * Added "pntr_id" entry to qdflags struct. 75 * 76 * 22-Oct-85 - longo 77 * 78 * Added buf structures for use by driver strategy routines. 79 * 80 * 23-Oct-85 - longo 81 * 82 * Added "user_dma" entry to qdflag structure. 83 * 84 * 8-Nov-85 - longo 85 * 86 * Added "selmask" entry to qdflags structure. 87 * 88 * 11-Nov-85 - longo 89 * 90 * Changed "_vs_eventqueue" struct references to "qdinput". 91 * 92 * 25-Nov-85 - longo 93 * 94 * Added "one_only" lock switch for single process access. 95 * 96 * 18-Mar-86 - jaw 97 * 98 * Add routines to cpu switch for nexus/unibus addreses. 99 * Also got rid of some globals like nexnum. 100 * ka8800 cleanup. 101 * 102 * 19-Mar-86 - ricky palmer 103 * 104 * Added "devio.h" to include list. V2.0 105 * 106 * 02-Jul-86 - Brian Stevens 107 * 108 * Added cursor structure for each display 109 * 110 */ 111 112 #include "qd.h" /* # of QDSS's the system is configured for */ 113 114 #include "../vax/pte.h" /* page table values */ 115 #include "../vax/mtpr.h" /* VAX register access stuff */ 116 117 #include "../h/param.h" /* general system params & macros */ 118 #include "../h/conf.h" /* "linesw" tty driver dispatch */ 119 #include "../h/dir.h" /* for directory handling */ 120 #include "../h/user.h" /* user structure (what else?) */ 121 #include "qdioctl.h" /* ioctl call values */ 122 #include "../h/tty.h" 123 #include "../h/map.h" /* resource allocation map struct */ 124 #include "../h/buf.h" /* buf structs */ 125 #include "../h/vm.h" /* includes 'vm' header files */ 126 #include "../h/clist.h" /* char list handling structs */ 127 #include "../h/file.h" /* file I/O definitions */ 128 #include "../h/uio.h" /* write/read call structs */ 129 #include "../h/kernel.h" /* clock handling structs */ 130 #include "../vax/cpu.h" /* per cpu (pcpu) struct */ 131 132 #include "../vaxuba/ubareg.h" /* uba & 'qba' register structs */ 133 #include "../vaxuba/ubavar.h" /* uba structs & uba map externs */ 134 135 #include "qduser.h" /* definitions shared with my client */ 136 #include "qdreg.h" /* QDSS device register structures */ 137 138 /*----------------------------------------------------------- 139 * QDSS driver status flags for tracking operational state */ 140 141 struct qdflags { 142 143 u_int inuse; /* which minor dev's are in use now */ 144 u_int config; /* I/O page register content */ 145 u_int mapped; /* user mapping status word */ 146 u_int kernel_loop; /* if kernel console is redirected */ 147 u_int user_dma; /* DMA from user space in progress */ 148 u_short pntr_id; /* type code of pointing device */ 149 u_short duart_imask; /* shadowing for duart intrpt mask reg */ 150 u_short adder_ie; /* shadowing for adder intrpt enbl reg */ 151 u_short curs_acc; /* cursor acceleration factor */ 152 u_short curs_thr; /* cursor acceleration threshold level */ 153 u_short tab_res; /* tablet resolution factor */ 154 u_short selmask; /* mask for active qd select entries */ 155 }; 156 157 /* bit definitions for "inuse" entry */ 158 159 #define CONS_DEV 0x01 160 #define ALTCONS_DEV 0x02 161 #define GRAPHIC_DEV 0x04 162 163 /* bit definitions for 'mapped' member of flag structure */ 164 165 #define MAPDEV 0x01 /* hardware is mapped */ 166 #define MAPDMA 0x02 /* DMA buffer mapped */ 167 #define MAPEQ 0x04 /* event queue buffer mapped */ 168 #define MAPSCR 0x08 /* scroll param area mapped */ 169 #define MAPCOLOR 0x10 /* color map writing buffer mapped */ 170 171 /* bit definitions for 'selmask' member of qdflag structure */ 172 173 #define SEL_READ 0x01 /* read select is active */ 174 #define SEL_WRITE 0x02 /* write select is active */ 175 176 /*---------------------------------------------- 177 * constants used in shared memory operations */ 178 179 #define EVENT_BUFSIZE 1024 /* # of bytes per device's event buffer */ 180 181 #define MAXEVENTS ( (EVENT_BUFSIZE - sizeof(struct qdinput)) \ 182 / sizeof(struct _vs_event) ) 183 184 #define DMA_BUFSIZ (1024 * 3) 185 186 #define COLOR_BUFSIZ ((sizeof(struct color_buf) + 512) & ~0x01FF) 187 188 /*******************************************************************/ 189 190 #ifdef BINARY 191 192 extern struct uba_device *qdinfo[]; /* array of pntrs to each QDSS */ 193 /* uba structure */ 194 extern struct tty qd_tty[]; 195 196 extern struct qd_softc qd_softc[]; 197 198 /*---------------------------------------------------------- 199 * static storage used by multiple functions in this code */ 200 201 extern int Qbus_unmap[]; /* Qbus mapper release key */ 202 extern struct qdflags qdflags[]; /* QDSS device status flags */ 203 extern struct qdmap qdmap[]; /* QDSS register map structure */ 204 extern caddr_t qdbase[]; /* base address of each QDSS unit */ 205 extern struct buf qdbuf[]; /* buf structs used by strategy */ 206 extern char one_only[]; /* lock for single process access */ 207 208 /*----------------------------- 209 * shared memory allocation */ 210 211 extern char event_shared[]; /* reserve event buf space */ 212 extern struct qdinput *eq_header[]; /* event buf header ptrs */ 213 214 extern char DMA_shared[]; /* reserve DMA buf space */ 215 extern struct DMAreq_header *DMAheader[]; /* DMA buf header ptrs */ 216 217 extern char scroll_shared[]; /* reserve space for scroll structs */ 218 extern struct scroll *scroll[]; /* pointers to scroll structures */ 219 220 extern char color_shared[]; /* reserve space: color bufs */ 221 extern struct color_buf *color_buf[]; /* pointers to color bufs */ 222 223 /*-------------------------------- 224 * mouse input event structures */ 225 226 extern struct mouse_report last_rep[]; 227 extern struct mouse_report current_rep[]; 228 229 /*---------------------------- 230 * input event "select" use */ 231 232 extern struct proc *rsel[]; /* process waiting for select */ 233 234 extern int DMAbuf_size; 235 236 /*---------------------------- 237 * console cursor structure */ 238 239 struct _vs_cursor cursor[]; 240 241 242 /*********************************************************************/ 243 244 #else 245 246 /*-------------------------------------------------------------------------- 247 * reference to an array of "uba_device" structures built by the auto 248 * configuration program. The uba_device structure decribes the device 249 * sufficiently for the driver to talk to it. The auto configuration code 250 * fills in the uba_device structures (located in ioconf.c) from user 251 * maintained info. */ 252 253 struct uba_device *qdinfo[NQD]; /* array of pntrs to each QDSS's */ 254 /* uba structures */ 255 struct tty qd_tty[NQD*4]; /* teletype structures for each.. */ 256 /* ..possible minor device */ 257 258 struct qd_softc qd_softc[NQD]; 259 260 /*---------------------------------------------------------- 261 * static storage used by multiple functions in this code */ 262 263 int Qbus_unmap[NQD]; /* Qbus mapper release code */ 264 struct qdflags qdflags[NQD]; /* QDSS device status flags */ 265 struct qdmap qdmap[NQD]; /* QDSS register map structure */ 266 caddr_t qdbase[NQD]; /* base address of each QDSS unit */ 267 struct buf qdbuf[NQD]; /* buf structs used by strategy */ 268 char one_only[NQD]; /* lock for single process access */ 269 270 /*------------------------------------------------------------------------ 271 * the array "event_shared[]" is made up of a number of event queue buffers 272 * equal to the number of QDSS's configured into the running kernel (NQD). 273 * Each event queue buffer begins with an event queue header (struct qdinput) 274 * followed by a group of event queue entries (struct _vs_event). The array 275 * "*eq_header[]" is an array of pointers to the start of each event queue 276 * buffer in "event_shared[]". */ 277 278 #define EQSIZE ((EVENT_BUFSIZE * NQD) + 512) 279 280 char event_shared[EQSIZE]; /* reserve space for event bufs */ 281 struct qdinput *eq_header[NQD]; /* event queue header pntrs */ 282 283 /*-------------------------------------------------------------------------- 284 * This allocation method reserves enough memory pages for NQD shared DMA I/O 285 * buffers. Each buffer must consume an integral number of memory pages to 286 * guarantee that a following buffer will begin on a page boundary. Also, 287 * enough space is allocated so that the FIRST I/O buffer can start at the 288 * 1st page boundary after "&DMA_shared". Page boundaries are used so that 289 * memory protections can be turned on/off for individual buffers. */ 290 291 #define IOBUFSIZE ((DMA_BUFSIZ * NQD) + 512) 292 293 char DMA_shared[IOBUFSIZE]; /* reserve I/O buffer space */ 294 struct DMAreq_header *DMAheader[NQD]; /* DMA buffer header pntrs */ 295 296 /*------------------------------------------------------------------------- 297 * The driver assists a client in scroll operations by loading dragon 298 * registers from an interrupt service routine. The loading is done using 299 * parameters found in memory shrade between the driver and it's client. 300 * The scroll parameter structures are ALL loacted in the same memory page 301 * for reasons of memory economy. */ 302 303 char scroll_shared[2 * 512]; /* reserve space for scroll structs */ 304 struct scroll *scroll[NQD]; /* pointers to scroll structures */ 305 306 /*----------------------------------------------------------------------- 307 * the driver is programmable to provide the user with color map write 308 * services at VSYNC interrupt time. At interrupt time the driver loads 309 * the color map with any user-requested load data found in shared memory */ 310 311 #define COLOR_SHARED ((COLOR_BUFSIZ * NQD) + 512) 312 313 char color_shared[COLOR_SHARED]; /* reserve space: color bufs */ 314 struct color_buf *color_buf[NQD]; /* pointers to color bufs */ 315 316 /*-------------------------------- 317 * mouse input event structures */ 318 319 struct mouse_report last_rep[NQD]; 320 struct mouse_report current_rep[NQD]; 321 322 /*---------------------------- 323 * input event "select" use */ 324 325 struct proc *rsel[NQD]; /* process waiting for select */ 326 327 /*---------------------------- 328 * console cursor structure */ 329 330 struct _vs_cursor cursor[NQD]; 331 332 333 /************************************************************************/ 334 335 int nNQD = NQD; 336 337 int DMAbuf_size = DMA_BUFSIZ; 338 339 #endif 340 341 342