1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
/* $NetBSD: xcfb.c,v 1.9 1995/10/09 01:45:26 jonathan Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Ralph Campbell and Rick Macklem.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)xcfb.c 8.1 (Berkeley) 6/10/93
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/*
* devGraphics.c --
*
* This file contains machine-dependent routines for the graphics device.
*
* Copyright (C) 1989 Digital Equipment Corporation.
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appears in all copies.
* Digital Equipment Corporation makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* from: Header: /sprite/src/kernel/dev/ds3100.md/RCS/devGraphics.c,
* v 9.2 90/02/13 22:16:24 shirriff Exp SPRITE (DECWRL)";
*/
#include <fb.h>
#include <xcfb.h>
#include <dtop.h>
#if NXCFB > 0
#if NDTOP == 0
xcfb needs dtop device
#else
#include <sys/param.h>
#include <sys/time.h>
#include <sys/kernel.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <sys/errno.h>
#include <sys/proc.h>
#include <sys/mman.h>
#include <vm/vm.h>
#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/machConst.h>
#include <machine/pmioctl.h>
#include <machine/fbio.h>
#include <machine/fbvar.h>
#include <pmax/pmax/cons.h>
#include <pmax/dev/xcfbreg.h>
#include <pmax/dev/ims332.h>
#include <pmax/pmax/maxine.h>
#include <pmax/pmax/pmaxtype.h>
#include <pmax/dev/dtopreg.h>
#include <pmax/dev/fbreg.h>
/*
* These need to be mapped into user space.
*/
struct fbuaccess xcfbu;
/*
* rcons methods and globals.
*/
struct pmax_fbtty xcfbfb;
struct fbinfo xcfbfi; /*XXX*/
extern struct cfdriver cfb;
#define CMAP_BITS (3 * 256) /* 256 entries, 3 bytes per. */
static u_char cmap_bits [NXCFB * CMAP_BITS]; /* One colormap per cfb... */
#define XCFB_FB_SIZE 0x100000 /* size of raster (mapped into userspace) */
struct fbdriver xcfb_driver = {
ims332_video_on,
ims332_video_off,
ims332InitColorMap,
ims332GetColorMap,
ims332LoadColorMap,
ims332PosCursor,
ims332LoadCursor,
ims332CursorColor
};
/*
* Forward references.
*/
extern void fbScreenInit __P((struct fbinfo *fi));
void genKbdEvent(), genMouseEvent(), genMouseButtons();
extern void dtopKBDPutc();
extern void (*dtopDivertXInput)();
extern void (*dtopMouseEvent)();
extern void (*dtopMouseButtons)();
extern int pmax_boardtype;
extern u_short defCursor[32];
/*
* Autoconfiguration data for config.new.
* Use static-sized softc until config.old and old autoconfig
* code is completely gone.
*/
int xcfbmatch __P((struct device *, void *, void *));
void xcfbattach __P((struct device *, struct device *, void *));
struct cfdriver xcfbcd = {
NULL, "xcfb", xcfbmatch, xcfbattach, DV_DULL, sizeof(struct device), 0
};
int
xcfbmatch(parent, match, aux)
struct device *parent;
void *match;
void *aux;
{
struct cfdata *cf = match;
struct confargs *ca = aux;
static int nxcfbs = 1;
/* make sure that we're looking for this type of device. */
if (!BUS_MATCHNAME(ca, "PMAG-DV ") && !BUS_MATCHNAME(ca, "xcfb"))
return (0);
#ifdef notyet
/* if it can't have the one mentioned, reject it */
if (cf->cf_unit >= nxcfbs)
return (0);
#endif
return (1);
}
void
xcfbattach(parent, self, aux)
struct device *parent;
struct device *self;
void *aux;
{
struct confargs *ca = aux;
if (!xcfbinit(NULL, BUS_CVTADDR(ca), self->dv_unit, 0));
return;
/* no interrupts for XCFB */
/*BUS_INTR_ESTABLISH(ca, xcfbintr, self->dv_unit);*/
printf("\n");
}
/*
* Initialization
*/
int
xcfbinit(fi, base, unit, silent)
struct fbinfo *fi;
caddr_t base;
int unit;
int silent;
{
register u_int *reset = (u_int *)IMS332_RESET_ADDRESS;
if (fi == 0) fi = &xcfbfi;
unit = 0; /*XXX*/ /* FIXME */
/*XXX*/
/*
* Or Cached? A comment in the Mach driver suggests that the X server
* runs faster in cached address space, but the X server is going
* to blow away the data cache whenever it updates the screen, so..
*/
base = (char *) MACH_PHYS_TO_UNCACHED(XINE_PHYS_CFB_START);
/* Fill in main frame buffer info struct. */
fi->fi_unit = unit;
fi->fi_pixels = (caddr_t)(base + VRAM_OFFSET);
fi->fi_pixelsize = 1024 * 768;
fi->fi_base = (caddr_t)IMS332_RESET_ADDRESS;
fi->fi_vdac = (caddr_t)IMS332_ADDRESS;
fi->fi_size = 0x100000;
fi->fi_linebytes = 1024;
fi->fi_driver = &xcfb_driver;
fi->fi_blanked = 0;
fi->fi_cmap_bits = (caddr_t)&cmap_bits [CMAP_BITS * unit];
/* Fill in Frame Buffer Type struct. */
fi->fi_type.fb_boardtype = PMAX_FBTYPE_XCFB;
fi->fi_type.fb_width = 1024;
fi->fi_type.fb_height = 768;
fi->fi_type.fb_depth = 8;
fi->fi_type.fb_cmsize = 256;
fi->fi_type.fb_size = XCFB_FB_SIZE;
/*
* qvss/pm-style mmap()ed event queue compatibility glue
*/
/*
* Must be in Uncached space since the fbuaccess structure is
* mapped into the user's address space uncached.
*/
fi->fi_fbu = (struct fbuaccess *)
MACH_PHYS_TO_UNCACHED(MACH_CACHED_TO_PHYS(&xcfbu));
/* This is glass-tty state but it's in the shared structure. Ick. */
fi->fi_fbu->scrInfo.max_row = 50;
fi->fi_fbu->scrInfo.max_col = 80;
init_pmaxfbu(fi);
/*
* Initialize old-style pmax glass-tty screen info.
*/
fi->fi_glasstty = &xcfbfb;
/*XXX*/
/* dimensions translated -15 pixels, for sprite origin? */
fi->fi_fbu->scrInfo.max_cur_x = 1008;
fi->fi_fbu->scrInfo.max_cur_y = 752;
fi->fi_fbu->scrInfo.min_cur_x = -15;
fi->fi_fbu->scrInfo.min_cur_y = -15;
/* Initialize the RAMDAC. */
ims332init (fi);
/* Connect serial device(s) */
if (tb_kbdmouseconfig(fi)) {
printf(" (mouse/keyboard config failed)");
return (0);
}
/*
* Connect to the raster-console pseudo-driver
*/
fbconnect("PMAG-DV", fi, silent);
#ifdef fpinitialized
fp->initialized = 1;
#endif
return (1);
}
#endif /* NDTOP */
#endif /* NXCFB */
|