macfb.c revision 1.1.4.1 1 1.1.4.1 bouyer /* $NetBSD: macfb.c,v 1.1.4.1 2000/11/20 20:12:17 bouyer Exp $ */
2 1.1.4.1 bouyer /*
3 1.1.4.1 bouyer * Copyright (c) 1998 Matt DeBergalis
4 1.1.4.1 bouyer * All rights reserved.
5 1.1.4.1 bouyer *
6 1.1.4.1 bouyer * Redistribution and use in source and binary forms, with or without
7 1.1.4.1 bouyer * modification, are permitted provided that the following conditions
8 1.1.4.1 bouyer * are met:
9 1.1.4.1 bouyer * 1. Redistributions of source code must retain the above copyright
10 1.1.4.1 bouyer * notice, this list of conditions and the following disclaimer.
11 1.1.4.1 bouyer * 2. Redistributions in binary form must reproduce the above copyright
12 1.1.4.1 bouyer * notice, this list of conditions and the following disclaimer in the
13 1.1.4.1 bouyer * documentation and/or other materials provided with the distribution.
14 1.1.4.1 bouyer * 3. All advertising materials mentioning features or use of this software
15 1.1.4.1 bouyer * must display the following acknowledgement:
16 1.1.4.1 bouyer * This product includes software developed by Matt DeBergalis
17 1.1.4.1 bouyer * 4. The name of the author may not be used to endorse or promote products
18 1.1.4.1 bouyer * derived from this software without specific prior written permission
19 1.1.4.1 bouyer *
20 1.1.4.1 bouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1.4.1 bouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1.4.1 bouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1.4.1 bouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1.4.1 bouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1.4.1 bouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1.4.1 bouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1.4.1 bouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1.4.1 bouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1.4.1 bouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1.4.1 bouyer */
31 1.1.4.1 bouyer
32 1.1.4.1 bouyer #include "opt_wsdisplay_compat.h"
33 1.1.4.1 bouyer #include "grf.h"
34 1.1.4.1 bouyer
35 1.1.4.1 bouyer #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
36 1.1.4.1 bouyer
37 1.1.4.1 bouyer #include <sys/param.h>
38 1.1.4.1 bouyer #include <sys/systm.h>
39 1.1.4.1 bouyer #include <sys/kernel.h>
40 1.1.4.1 bouyer #include <sys/device.h>
41 1.1.4.1 bouyer #include <sys/malloc.h>
42 1.1.4.1 bouyer
43 1.1.4.1 bouyer #include <machine/cpu.h>
44 1.1.4.1 bouyer #include <machine/bus.h>
45 1.1.4.1 bouyer
46 1.1.4.1 bouyer #include <machine/grfioctl.h>
47 1.1.4.1 bouyer #include <mac68k/nubus/nubus.h>
48 1.1.4.1 bouyer #include <mac68k/dev/grfvar.h>
49 1.1.4.1 bouyer #include <mac68k/dev/macfbvar.h>
50 1.1.4.1 bouyer #include <dev/wscons/wsconsio.h>
51 1.1.4.1 bouyer
52 1.1.4.1 bouyer #include <dev/rcons/raster.h>
53 1.1.4.1 bouyer #include <dev/wscons/wscons_raster.h>
54 1.1.4.1 bouyer #include <dev/wscons/wsdisplayvar.h>
55 1.1.4.1 bouyer
56 1.1.4.1 bouyer int macfb_match __P((struct device *, struct cfdata *, void *));
57 1.1.4.1 bouyer void macfb_attach __P((struct device *, struct device *, void *));
58 1.1.4.1 bouyer
59 1.1.4.1 bouyer struct cfattach macfb_ca = {
60 1.1.4.1 bouyer sizeof(struct macfb_softc),
61 1.1.4.1 bouyer macfb_match,
62 1.1.4.1 bouyer macfb_attach,
63 1.1.4.1 bouyer };
64 1.1.4.1 bouyer
65 1.1.4.1 bouyer const struct wsdisplay_emulops macfb_emulops = {
66 1.1.4.1 bouyer rcons_cursor,
67 1.1.4.1 bouyer rcons_mapchar,
68 1.1.4.1 bouyer rcons_putchar,
69 1.1.4.1 bouyer rcons_copycols,
70 1.1.4.1 bouyer rcons_erasecols,
71 1.1.4.1 bouyer rcons_copyrows,
72 1.1.4.1 bouyer rcons_eraserows,
73 1.1.4.1 bouyer rcons_alloc_attr
74 1.1.4.1 bouyer };
75 1.1.4.1 bouyer
76 1.1.4.1 bouyer struct wsscreen_descr macfb_stdscreen = {
77 1.1.4.1 bouyer "std",
78 1.1.4.1 bouyer 0, 0, /* will be filled in -- XXX shouldn't, it's global */
79 1.1.4.1 bouyer &macfb_emulops,
80 1.1.4.1 bouyer 0, 0,
81 1.1.4.1 bouyer WSSCREEN_REVERSE
82 1.1.4.1 bouyer };
83 1.1.4.1 bouyer
84 1.1.4.1 bouyer const struct wsscreen_descr *_macfb_scrlist[] = {
85 1.1.4.1 bouyer &macfb_stdscreen,
86 1.1.4.1 bouyer };
87 1.1.4.1 bouyer
88 1.1.4.1 bouyer const struct wsscreen_list macfb_screenlist = {
89 1.1.4.1 bouyer sizeof(_macfb_scrlist) / sizeof(struct wsscreen_descr *),
90 1.1.4.1 bouyer _macfb_scrlist
91 1.1.4.1 bouyer };
92 1.1.4.1 bouyer
93 1.1.4.1 bouyer static int macfb_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
94 1.1.4.1 bouyer static paddr_t macfb_mmap __P((void *, off_t, int));
95 1.1.4.1 bouyer static int macfb_alloc_screen __P((void *, const struct wsscreen_descr *,
96 1.1.4.1 bouyer void **, int *, int *, long *));
97 1.1.4.1 bouyer static void macfb_free_screen __P((void *, void *));
98 1.1.4.1 bouyer static int macfb_show_screen __P((void *, void *, int,
99 1.1.4.1 bouyer void (*)(void *, int, int), void *));
100 1.1.4.1 bouyer
101 1.1.4.1 bouyer const struct wsdisplay_accessops macfb_accessops = {
102 1.1.4.1 bouyer macfb_ioctl,
103 1.1.4.1 bouyer macfb_mmap,
104 1.1.4.1 bouyer macfb_alloc_screen,
105 1.1.4.1 bouyer macfb_free_screen,
106 1.1.4.1 bouyer macfb_show_screen,
107 1.1.4.1 bouyer 0 /* load_font */
108 1.1.4.1 bouyer };
109 1.1.4.1 bouyer
110 1.1.4.1 bouyer void macfb_init __P((struct macfb_devconfig *));
111 1.1.4.1 bouyer
112 1.1.4.1 bouyer paddr_t macfb_consaddr;
113 1.1.4.1 bouyer static int macfb_is_console __P((paddr_t addr));
114 1.1.4.1 bouyer #ifdef WSDISPLAY_COMPAT_ITEFONT
115 1.1.4.1 bouyer static void init_itefont __P((void));
116 1.1.4.1 bouyer #endif /* WSDISPLAY_COMPAT_ITEFONT */
117 1.1.4.1 bouyer
118 1.1.4.1 bouyer static struct macfb_devconfig macfb_console_dc;
119 1.1.4.1 bouyer
120 1.1.4.1 bouyer /* From Booter via locore */
121 1.1.4.1 bouyer extern long videoaddr;
122 1.1.4.1 bouyer extern long videorowbytes;
123 1.1.4.1 bouyer extern long videobitdepth;
124 1.1.4.1 bouyer extern u_long videosize;
125 1.1.4.1 bouyer extern u_int32_t mac68k_vidlog;
126 1.1.4.1 bouyer extern u_int32_t mac68k_vidphys;
127 1.1.4.1 bouyer extern u_int32_t mac68k_vidlen;
128 1.1.4.1 bouyer
129 1.1.4.1 bouyer static int
130 1.1.4.1 bouyer macfb_is_console(paddr_t addr)
131 1.1.4.1 bouyer {
132 1.1.4.1 bouyer if (addr != macfb_consaddr &&
133 1.1.4.1 bouyer (addr >= 0xf9000000 && addr <= 0xfeffffff)) {
134 1.1.4.1 bouyer /*
135 1.1.4.1 bouyer * This is in the NuBus standard slot space range, so we
136 1.1.4.1 bouyer * may well have to look at 0xFssxxxxx, too. Mask off the
137 1.1.4.1 bouyer * slot number and duplicate it in bits 20-23, per IM:V
138 1.1.4.1 bouyer * pp 459, 463, and IM:VI ch 30 p 17.
139 1.1.4.1 bouyer * Note: this is an ugly hack and I wish I knew what
140 1.1.4.1 bouyer * to do about it. -- sr
141 1.1.4.1 bouyer */
142 1.1.4.1 bouyer addr = (paddr_t)(((u_long)addr & 0xff0fffff) |
143 1.1.4.1 bouyer (((u_long)addr & 0x0f000000) >> 4));
144 1.1.4.1 bouyer }
145 1.1.4.1 bouyer return ((mac68k_machine.serial_console & 0x03) == 0
146 1.1.4.1 bouyer && (addr == macfb_consaddr));
147 1.1.4.1 bouyer }
148 1.1.4.1 bouyer
149 1.1.4.1 bouyer void
150 1.1.4.1 bouyer macfb_clear(dc)
151 1.1.4.1 bouyer struct macfb_devconfig *dc;
152 1.1.4.1 bouyer {
153 1.1.4.1 bouyer int i, rows;
154 1.1.4.1 bouyer
155 1.1.4.1 bouyer /* clear the display */
156 1.1.4.1 bouyer rows = dc->dc_ht;
157 1.1.4.1 bouyer for (i = 0; rows-- > 0; i += dc->dc_rowbytes)
158 1.1.4.1 bouyer memset((u_char *)dc->dc_vaddr + dc->dc_offset + i,
159 1.1.4.1 bouyer 0, dc->dc_rowbytes);
160 1.1.4.1 bouyer }
161 1.1.4.1 bouyer
162 1.1.4.1 bouyer void
163 1.1.4.1 bouyer macfb_init(dc)
164 1.1.4.1 bouyer struct macfb_devconfig *dc;
165 1.1.4.1 bouyer {
166 1.1.4.1 bouyer struct raster *rap;
167 1.1.4.1 bouyer struct rcons *rcp;
168 1.1.4.1 bouyer
169 1.1.4.1 bouyer macfb_clear(dc);
170 1.1.4.1 bouyer
171 1.1.4.1 bouyer #ifdef WSDISPLAY_COMPAT_ITEFONT
172 1.1.4.1 bouyer init_itefont();
173 1.1.4.1 bouyer #endif /* WSDISPLAY_COMPAT_ITEFONT */
174 1.1.4.1 bouyer
175 1.1.4.1 bouyer rap = &dc->dc_raster;
176 1.1.4.1 bouyer rap->width = dc->dc_wid;
177 1.1.4.1 bouyer rap->height = dc->dc_ht;
178 1.1.4.1 bouyer rap->depth = dc->dc_depth;
179 1.1.4.1 bouyer rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
180 1.1.4.1 bouyer rap->pixels = (u_int32_t *)(dc->dc_vaddr + dc->dc_offset);
181 1.1.4.1 bouyer
182 1.1.4.1 bouyer /* initialize the raster console blitter */
183 1.1.4.1 bouyer rcp = &dc->dc_rcons;
184 1.1.4.1 bouyer rcp->rc_sp = rap;
185 1.1.4.1 bouyer rcp->rc_crow = rcp->rc_ccol = -1;
186 1.1.4.1 bouyer rcp->rc_crowp = &rcp->rc_crow;
187 1.1.4.1 bouyer rcp->rc_ccolp = &rcp->rc_ccol;
188 1.1.4.1 bouyer rcons_init(rcp, 128, 192);
189 1.1.4.1 bouyer
190 1.1.4.1 bouyer macfb_stdscreen.nrows = dc->dc_rcons.rc_maxrow;
191 1.1.4.1 bouyer macfb_stdscreen.ncols = dc->dc_rcons.rc_maxcol;
192 1.1.4.1 bouyer }
193 1.1.4.1 bouyer
194 1.1.4.1 bouyer int
195 1.1.4.1 bouyer macfb_match(parent, match, aux)
196 1.1.4.1 bouyer struct device *parent;
197 1.1.4.1 bouyer struct cfdata *match;
198 1.1.4.1 bouyer void *aux;
199 1.1.4.1 bouyer {
200 1.1.4.1 bouyer return (1);
201 1.1.4.1 bouyer }
202 1.1.4.1 bouyer
203 1.1.4.1 bouyer void
204 1.1.4.1 bouyer macfb_attach(parent, self, aux)
205 1.1.4.1 bouyer struct device *parent;
206 1.1.4.1 bouyer struct device *self;
207 1.1.4.1 bouyer void *aux;
208 1.1.4.1 bouyer {
209 1.1.4.1 bouyer struct grfbus_attach_args *ga = aux;
210 1.1.4.1 bouyer struct grfmode *gm = ga->ga_grfmode;
211 1.1.4.1 bouyer struct macfb_softc *sc;
212 1.1.4.1 bouyer struct wsemuldisplaydev_attach_args waa;
213 1.1.4.1 bouyer int isconsole;
214 1.1.4.1 bouyer
215 1.1.4.1 bouyer sc = (struct macfb_softc *)self;
216 1.1.4.1 bouyer
217 1.1.4.1 bouyer printf("\n");
218 1.1.4.1 bouyer
219 1.1.4.1 bouyer isconsole = macfb_is_console(ga->ga_phys + ga->ga_grfmode->fboff);
220 1.1.4.1 bouyer
221 1.1.4.1 bouyer if (isconsole) {
222 1.1.4.1 bouyer sc->sc_dc = &macfb_console_dc;
223 1.1.4.1 bouyer sc->nscreens = 1;
224 1.1.4.1 bouyer } else {
225 1.1.4.1 bouyer sc->sc_dc = malloc(sizeof(struct macfb_devconfig), M_DEVBUF, M_WAITOK);
226 1.1.4.1 bouyer sc->sc_dc->dc_vaddr = (vaddr_t)gm->fbbase;
227 1.1.4.1 bouyer sc->sc_dc->dc_paddr = ga->ga_phys;
228 1.1.4.1 bouyer sc->sc_dc->dc_size = gm->fbsize;
229 1.1.4.1 bouyer
230 1.1.4.1 bouyer sc->sc_dc->dc_wid = gm->width;
231 1.1.4.1 bouyer sc->sc_dc->dc_ht = gm->height;
232 1.1.4.1 bouyer sc->sc_dc->dc_depth = gm->psize;
233 1.1.4.1 bouyer sc->sc_dc->dc_rowbytes = gm->rowbytes;
234 1.1.4.1 bouyer
235 1.1.4.1 bouyer sc->sc_dc->dc_offset = gm->fboff;
236 1.1.4.1 bouyer
237 1.1.4.1 bouyer macfb_clear(sc->sc_dc);
238 1.1.4.1 bouyer
239 1.1.4.1 bouyer sc->nscreens = 1;
240 1.1.4.1 bouyer }
241 1.1.4.1 bouyer
242 1.1.4.1 bouyer /* initialize the raster */
243 1.1.4.1 bouyer waa.console = isconsole;
244 1.1.4.1 bouyer waa.scrdata = &macfb_screenlist;
245 1.1.4.1 bouyer waa.accessops = &macfb_accessops;
246 1.1.4.1 bouyer waa.accesscookie = sc;
247 1.1.4.1 bouyer
248 1.1.4.1 bouyer config_found(self, &waa, wsemuldisplaydevprint);
249 1.1.4.1 bouyer
250 1.1.4.1 bouyer #if NGRF > 0
251 1.1.4.1 bouyer grf_attach(sc, self->dv_unit);
252 1.1.4.1 bouyer #endif
253 1.1.4.1 bouyer }
254 1.1.4.1 bouyer
255 1.1.4.1 bouyer
256 1.1.4.1 bouyer int
257 1.1.4.1 bouyer macfb_ioctl(v, cmd, data, flag, p)
258 1.1.4.1 bouyer void *v;
259 1.1.4.1 bouyer u_long cmd;
260 1.1.4.1 bouyer caddr_t data;
261 1.1.4.1 bouyer int flag;
262 1.1.4.1 bouyer struct proc *p;
263 1.1.4.1 bouyer {
264 1.1.4.1 bouyer struct macfb_softc *sc = v;
265 1.1.4.1 bouyer struct macfb_devconfig *dc = sc->sc_dc;
266 1.1.4.1 bouyer struct wsdisplay_fbinfo *wdf;
267 1.1.4.1 bouyer
268 1.1.4.1 bouyer switch (cmd) {
269 1.1.4.1 bouyer case WSDISPLAYIO_GTYPE:
270 1.1.4.1 bouyer *(int *)data = dc->dc_type;
271 1.1.4.1 bouyer return 0;
272 1.1.4.1 bouyer
273 1.1.4.1 bouyer case WSDISPLAYIO_GINFO:
274 1.1.4.1 bouyer wdf = (struct wsdisplay_fbinfo *)data;
275 1.1.4.1 bouyer wdf->height = dc->dc_raster.height;
276 1.1.4.1 bouyer wdf->width = dc->dc_raster.width;
277 1.1.4.1 bouyer wdf->depth = dc->dc_raster.depth;
278 1.1.4.1 bouyer wdf->cmsize = 256;
279 1.1.4.1 bouyer return 0;
280 1.1.4.1 bouyer
281 1.1.4.1 bouyer case WSDISPLAYIO_GCURMAX:
282 1.1.4.1 bouyer case WSDISPLAYIO_GCURPOS:
283 1.1.4.1 bouyer case WSDISPLAYIO_GCURSOR:
284 1.1.4.1 bouyer case WSDISPLAYIO_GETCMAP:
285 1.1.4.1 bouyer case WSDISPLAYIO_GVIDEO:
286 1.1.4.1 bouyer case WSDISPLAYIO_PUTCMAP:
287 1.1.4.1 bouyer case WSDISPLAYIO_SCURPOS:
288 1.1.4.1 bouyer case WSDISPLAYIO_SCURSOR:
289 1.1.4.1 bouyer case WSDISPLAYIO_SVIDEO:
290 1.1.4.1 bouyer /* NONE of these operations are supported. */
291 1.1.4.1 bouyer return ENOTTY;
292 1.1.4.1 bouyer }
293 1.1.4.1 bouyer
294 1.1.4.1 bouyer return -1;
295 1.1.4.1 bouyer }
296 1.1.4.1 bouyer
297 1.1.4.1 bouyer static paddr_t
298 1.1.4.1 bouyer macfb_mmap(v, offset, prot)
299 1.1.4.1 bouyer void *v;
300 1.1.4.1 bouyer off_t offset;
301 1.1.4.1 bouyer int prot;
302 1.1.4.1 bouyer {
303 1.1.4.1 bouyer struct macfb_softc *sc = v;
304 1.1.4.1 bouyer struct macfb_devconfig *dc = sc->sc_dc;
305 1.1.4.1 bouyer paddr_t addr;
306 1.1.4.1 bouyer
307 1.1.4.1 bouyer if (offset >= 0 &&
308 1.1.4.1 bouyer offset < m68k_round_page(dc->dc_rowbytes * dc->dc_ht))
309 1.1.4.1 bouyer addr = m68k_btop(dc->dc_paddr + dc->dc_offset + offset);
310 1.1.4.1 bouyer else
311 1.1.4.1 bouyer addr = (-1); /* XXX bogus */
312 1.1.4.1 bouyer
313 1.1.4.1 bouyer return addr;
314 1.1.4.1 bouyer }
315 1.1.4.1 bouyer
316 1.1.4.1 bouyer int
317 1.1.4.1 bouyer macfb_alloc_screen(v, type, cookiep, curxp, curyp, defattrp)
318 1.1.4.1 bouyer void *v;
319 1.1.4.1 bouyer const struct wsscreen_descr *type;
320 1.1.4.1 bouyer void **cookiep;
321 1.1.4.1 bouyer int *curxp, *curyp;
322 1.1.4.1 bouyer long *defattrp;
323 1.1.4.1 bouyer {
324 1.1.4.1 bouyer struct macfb_softc *sc = v;
325 1.1.4.1 bouyer long defattr;
326 1.1.4.1 bouyer
327 1.1.4.1 bouyer if (sc->nscreens > 0)
328 1.1.4.1 bouyer return (ENOMEM);
329 1.1.4.1 bouyer
330 1.1.4.1 bouyer *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
331 1.1.4.1 bouyer *curxp = 0;
332 1.1.4.1 bouyer *curyp = 0;
333 1.1.4.1 bouyer rcons_alloc_attr(&sc->sc_dc->dc_rcons, 0, 0, 0, &defattr);
334 1.1.4.1 bouyer *defattrp = defattr;
335 1.1.4.1 bouyer sc->nscreens++;
336 1.1.4.1 bouyer return (0);
337 1.1.4.1 bouyer }
338 1.1.4.1 bouyer
339 1.1.4.1 bouyer void
340 1.1.4.1 bouyer macfb_free_screen(v, cookie)
341 1.1.4.1 bouyer void *v;
342 1.1.4.1 bouyer void *cookie;
343 1.1.4.1 bouyer {
344 1.1.4.1 bouyer struct macfb_softc *sc = v;
345 1.1.4.1 bouyer
346 1.1.4.1 bouyer if (sc->sc_dc == &macfb_console_dc)
347 1.1.4.1 bouyer panic("cfb_free_screen: console");
348 1.1.4.1 bouyer
349 1.1.4.1 bouyer sc->nscreens--;
350 1.1.4.1 bouyer }
351 1.1.4.1 bouyer
352 1.1.4.1 bouyer int
353 1.1.4.1 bouyer macfb_show_screen(v, cookie, waitok, cb, cbarg)
354 1.1.4.1 bouyer void *v;
355 1.1.4.1 bouyer void *cookie;
356 1.1.4.1 bouyer int waitok;
357 1.1.4.1 bouyer void (*cb) __P((void *, int, int));
358 1.1.4.1 bouyer void *cbarg;
359 1.1.4.1 bouyer {
360 1.1.4.1 bouyer return 0;
361 1.1.4.1 bouyer }
362 1.1.4.1 bouyer
363 1.1.4.1 bouyer int
364 1.1.4.1 bouyer macfb_cnattach(addr)
365 1.1.4.1 bouyer paddr_t addr;
366 1.1.4.1 bouyer {
367 1.1.4.1 bouyer struct macfb_devconfig *dc = &macfb_console_dc;
368 1.1.4.1 bouyer long defattr;
369 1.1.4.1 bouyer
370 1.1.4.1 bouyer dc->dc_vaddr = m68k_trunc_page(videoaddr);
371 1.1.4.1 bouyer dc->dc_paddr = m68k_trunc_page(mac68k_vidphys);
372 1.1.4.1 bouyer
373 1.1.4.1 bouyer dc->dc_wid = videosize & 0xffff;
374 1.1.4.1 bouyer dc->dc_ht = (videosize >> 16) & 0xffff;
375 1.1.4.1 bouyer dc->dc_depth = videobitdepth;
376 1.1.4.1 bouyer dc->dc_rowbytes = videorowbytes;
377 1.1.4.1 bouyer
378 1.1.4.1 bouyer dc->dc_size = (mac68k_vidlen > 0) ?
379 1.1.4.1 bouyer mac68k_vidlen : dc->dc_ht * dc->dc_rowbytes;
380 1.1.4.1 bouyer dc->dc_offset = m68k_page_offset(mac68k_vidphys);
381 1.1.4.1 bouyer
382 1.1.4.1 bouyer /* set up the display */
383 1.1.4.1 bouyer macfb_init(&macfb_console_dc);
384 1.1.4.1 bouyer
385 1.1.4.1 bouyer rcons_alloc_attr(&dc->dc_rcons, 0, 0, 0, &defattr);
386 1.1.4.1 bouyer
387 1.1.4.1 bouyer wsdisplay_cnattach(&macfb_stdscreen, &dc->dc_rcons,
388 1.1.4.1 bouyer 0, 0, defattr);
389 1.1.4.1 bouyer
390 1.1.4.1 bouyer macfb_consaddr = addr;
391 1.1.4.1 bouyer dc->isconsole = 1;
392 1.1.4.1 bouyer return (0);
393 1.1.4.1 bouyer }
394 1.1.4.1 bouyer
395 1.1.4.1 bouyer #ifdef WSDISPLAY_COMPAT_ITEFONT
396 1.1.4.1 bouyer #include <mac68k/dev/6x10.h>
397 1.1.4.1 bouyer
398 1.1.4.1 bouyer void
399 1.1.4.1 bouyer init_itefont()
400 1.1.4.1 bouyer {
401 1.1.4.1 bouyer static int itefont_initted = 0;
402 1.1.4.1 bouyer int i, j;
403 1.1.4.1 bouyer
404 1.1.4.1 bouyer extern struct raster_font gallant19; /* XXX */
405 1.1.4.1 bouyer
406 1.1.4.1 bouyer if (itefont_initted)
407 1.1.4.1 bouyer return;
408 1.1.4.1 bouyer itefont_initted = 1;
409 1.1.4.1 bouyer
410 1.1.4.1 bouyer /* XXX but we cannot use malloc here... */
411 1.1.4.1 bouyer gallant19.width = 6;
412 1.1.4.1 bouyer gallant19.height = 10;
413 1.1.4.1 bouyer gallant19.ascent = 0;
414 1.1.4.1 bouyer
415 1.1.4.1 bouyer for (i = 32; i < 128; i++) {
416 1.1.4.1 bouyer u_int *p;
417 1.1.4.1 bouyer
418 1.1.4.1 bouyer if (gallant19.chars[i].r == NULL)
419 1.1.4.1 bouyer continue;
420 1.1.4.1 bouyer
421 1.1.4.1 bouyer gallant19.chars[i].r->width = 6;
422 1.1.4.1 bouyer gallant19.chars[i].r->height = 10;
423 1.1.4.1 bouyer p = gallant19.chars[i].r->pixels;
424 1.1.4.1 bouyer
425 1.1.4.1 bouyer for (j = 0; j < 10; j++)
426 1.1.4.1 bouyer *p++ = Font6x10[i * 10 + j] << 26;
427 1.1.4.1 bouyer }
428 1.1.4.1 bouyer }
429 1.1.4.1 bouyer #endif /* WSDISPLAY_COMPAT_ITEFONT */
430