nextdisplay.c revision 1.6.8.5 1 1.6.8.5 nathanw /* $NetBSD: nextdisplay.c,v 1.6.8.5 2002/10/18 02:39:14 nathanw Exp $ */
2 1.6.8.2 nathanw
3 1.6.8.2 nathanw /*
4 1.6.8.2 nathanw * Copyright (c) 1998 Matt DeBergalis
5 1.6.8.2 nathanw * All rights reserved.
6 1.6.8.2 nathanw *
7 1.6.8.2 nathanw * Redistribution and use in source and binary forms, with or without
8 1.6.8.2 nathanw * modification, are permitted provided that the following conditions
9 1.6.8.2 nathanw * are met:
10 1.6.8.2 nathanw * 1. Redistributions of source code must retain the above copyright
11 1.6.8.2 nathanw * notice, this list of conditions and the following disclaimer.
12 1.6.8.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
13 1.6.8.2 nathanw * notice, this list of conditions and the following disclaimer in the
14 1.6.8.2 nathanw * documentation and/or other materials provided with the distribution.
15 1.6.8.2 nathanw * 3. All advertising materials mentioning features or use of this software
16 1.6.8.2 nathanw * must display the following acknowledgement:
17 1.6.8.2 nathanw * This product includes software developed by Matt DeBergalis
18 1.6.8.2 nathanw * 4. The name of the author may not be used to endorse or promote products
19 1.6.8.2 nathanw * derived from this software without specific prior written permission
20 1.6.8.2 nathanw *
21 1.6.8.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.6.8.2 nathanw * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.6.8.2 nathanw * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.6.8.2 nathanw * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.6.8.2 nathanw * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.6.8.2 nathanw * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.6.8.2 nathanw * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.6.8.2 nathanw * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.6.8.2 nathanw * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.6.8.2 nathanw * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.6.8.2 nathanw */
32 1.6.8.2 nathanw
33 1.6.8.2 nathanw #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
34 1.6.8.2 nathanw
35 1.6.8.2 nathanw #include <sys/param.h>
36 1.6.8.2 nathanw #include <sys/systm.h>
37 1.6.8.2 nathanw #include <sys/kernel.h>
38 1.6.8.2 nathanw #include <sys/device.h>
39 1.6.8.2 nathanw #include <sys/malloc.h>
40 1.6.8.2 nathanw
41 1.6.8.2 nathanw #include <machine/bus.h>
42 1.6.8.4 nathanw #include <machine/cpu.h>
43 1.6.8.2 nathanw
44 1.6.8.2 nathanw #include <next68k/next68k/nextrom.h>
45 1.6.8.2 nathanw
46 1.6.8.4 nathanw #include <next68k/dev/intiovar.h>
47 1.6.8.2 nathanw #include <next68k/dev/nextdisplayvar.h>
48 1.6.8.2 nathanw #include <dev/wscons/wsconsio.h>
49 1.6.8.2 nathanw
50 1.6.8.2 nathanw #include <dev/rcons/raster.h>
51 1.6.8.2 nathanw #include <dev/wscons/wscons_raster.h>
52 1.6.8.2 nathanw #include <dev/wscons/wsdisplayvar.h>
53 1.6.8.2 nathanw
54 1.6.8.4 nathanw extern int turbo;
55 1.6.8.4 nathanw
56 1.6.8.2 nathanw int nextdisplay_match __P((struct device *, struct cfdata *, void *));
57 1.6.8.2 nathanw void nextdisplay_attach __P((struct device *, struct device *, void *));
58 1.6.8.2 nathanw
59 1.6.8.5 nathanw CFATTACH_DECL(nextdisplay, sizeof(struct nextdisplay_softc),
60 1.6.8.5 nathanw nextdisplay_match, nextdisplay_attach, NULL, NULL);
61 1.6.8.2 nathanw
62 1.6.8.2 nathanw const struct wsdisplay_emulops nextdisplay_mono_emulops = {
63 1.6.8.2 nathanw rcons_cursor,
64 1.6.8.2 nathanw rcons_mapchar,
65 1.6.8.2 nathanw rcons_putchar,
66 1.6.8.2 nathanw rcons_copycols,
67 1.6.8.2 nathanw rcons_erasecols,
68 1.6.8.2 nathanw rcons_copyrows,
69 1.6.8.2 nathanw rcons_eraserows,
70 1.6.8.3 nathanw rcons_allocattr
71 1.6.8.2 nathanw };
72 1.6.8.2 nathanw
73 1.6.8.2 nathanw struct wsscreen_descr nextdisplay_mono = {
74 1.6.8.2 nathanw "mono",
75 1.6.8.2 nathanw 0, 0, /* will be filled in -- XXX shouldn't, it's global */
76 1.6.8.2 nathanw &nextdisplay_mono_emulops,
77 1.6.8.2 nathanw 0, 0
78 1.6.8.2 nathanw };
79 1.6.8.2 nathanw
80 1.6.8.2 nathanw struct wsscreen_descr nextdisplay_color = {
81 1.6.8.2 nathanw "color",
82 1.6.8.2 nathanw 0, 0, /* again, filled in */
83 1.6.8.2 nathanw &nextdisplay_mono_emulops,
84 1.6.8.2 nathanw 0, 0
85 1.6.8.2 nathanw };
86 1.6.8.2 nathanw
87 1.6.8.2 nathanw const struct wsscreen_descr *_nextdisplay_scrlist_mono[] = {
88 1.6.8.2 nathanw &nextdisplay_mono,
89 1.6.8.2 nathanw };
90 1.6.8.2 nathanw
91 1.6.8.2 nathanw const struct wsscreen_descr *_nextdisplay_scrlist_color[] = {
92 1.6.8.2 nathanw &nextdisplay_color,
93 1.6.8.2 nathanw };
94 1.6.8.2 nathanw
95 1.6.8.2 nathanw const struct wsscreen_list nextdisplay_screenlist_mono = {
96 1.6.8.2 nathanw sizeof(_nextdisplay_scrlist_mono) / sizeof(struct wsscreen_descr *),
97 1.6.8.2 nathanw _nextdisplay_scrlist_mono
98 1.6.8.2 nathanw };
99 1.6.8.2 nathanw
100 1.6.8.2 nathanw const struct wsscreen_list nextdisplay_screenlist_color = {
101 1.6.8.2 nathanw sizeof(_nextdisplay_scrlist_color) / sizeof(struct wsscreen_descr *),
102 1.6.8.2 nathanw _nextdisplay_scrlist_color
103 1.6.8.2 nathanw };
104 1.6.8.2 nathanw
105 1.6.8.2 nathanw static int nextdisplay_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
106 1.6.8.2 nathanw static paddr_t nextdisplay_mmap __P((void *, off_t, int));
107 1.6.8.2 nathanw static int nextdisplay_alloc_screen __P((void *, const struct wsscreen_descr *,
108 1.6.8.2 nathanw void **, int *, int *, long *));
109 1.6.8.2 nathanw static void nextdisplay_free_screen __P((void *, void *));
110 1.6.8.2 nathanw static int nextdisplay_show_screen __P((void *, void *, int,
111 1.6.8.2 nathanw void (*) (void *, int, int), void *));
112 1.6.8.2 nathanw static int nextdisplay_load_font __P((void *, void *, struct wsdisplay_font *));
113 1.6.8.2 nathanw
114 1.6.8.2 nathanw const struct wsdisplay_accessops nextdisplay_accessops = {
115 1.6.8.2 nathanw nextdisplay_ioctl,
116 1.6.8.2 nathanw nextdisplay_mmap,
117 1.6.8.2 nathanw nextdisplay_alloc_screen,
118 1.6.8.2 nathanw nextdisplay_free_screen,
119 1.6.8.2 nathanw nextdisplay_show_screen,
120 1.6.8.2 nathanw nextdisplay_load_font
121 1.6.8.2 nathanw };
122 1.6.8.2 nathanw
123 1.6.8.2 nathanw void nextdisplay_init(struct nextdisplay_config *, int);
124 1.6.8.2 nathanw
125 1.6.8.2 nathanw paddr_t nextdisplay_consaddr;
126 1.6.8.2 nathanw static int nextdisplay_is_console __P((paddr_t addr));
127 1.6.8.2 nathanw
128 1.6.8.2 nathanw static struct nextdisplay_config nextdisplay_console_dc;
129 1.6.8.2 nathanw
130 1.6.8.2 nathanw static int
131 1.6.8.2 nathanw nextdisplay_is_console(paddr_t addr)
132 1.6.8.2 nathanw {
133 1.6.8.2 nathanw return (nextdisplay_console_dc.isconsole
134 1.6.8.2 nathanw && (addr == nextdisplay_consaddr));
135 1.6.8.2 nathanw }
136 1.6.8.2 nathanw
137 1.6.8.2 nathanw int
138 1.6.8.2 nathanw nextdisplay_match(parent, match, aux)
139 1.6.8.2 nathanw struct device *parent;
140 1.6.8.2 nathanw struct cfdata *match;
141 1.6.8.2 nathanw void *aux;
142 1.6.8.2 nathanw {
143 1.6.8.2 nathanw if ((rom_machine_type == NeXT_WARP9)
144 1.6.8.2 nathanw || (rom_machine_type == NeXT_X15)
145 1.6.8.2 nathanw || (rom_machine_type == NeXT_WARP9C)
146 1.6.8.4 nathanw || (rom_machine_type == NeXT_TURBO_MONO)
147 1.6.8.2 nathanw || (rom_machine_type == NeXT_TURBO_COLOR))
148 1.6.8.2 nathanw return (1);
149 1.6.8.2 nathanw else
150 1.6.8.2 nathanw return (0);
151 1.6.8.2 nathanw }
152 1.6.8.2 nathanw
153 1.6.8.2 nathanw void
154 1.6.8.2 nathanw nextdisplay_init(dc, color)
155 1.6.8.2 nathanw struct nextdisplay_config *dc;
156 1.6.8.2 nathanw int color;
157 1.6.8.2 nathanw {
158 1.6.8.2 nathanw struct raster *rap;
159 1.6.8.2 nathanw struct rcons *rcp;
160 1.6.8.2 nathanw paddr_t addr;
161 1.6.8.2 nathanw int i;
162 1.6.8.2 nathanw
163 1.6.8.2 nathanw /* printf("in nextdisplay_init\n"); */
164 1.6.8.2 nathanw
165 1.6.8.2 nathanw if (color)
166 1.6.8.2 nathanw addr = (paddr_t)colorbase;
167 1.6.8.2 nathanw else
168 1.6.8.2 nathanw addr = (paddr_t)monobase;
169 1.6.8.2 nathanw
170 1.6.8.2 nathanw dc->dc_vaddr = addr;
171 1.6.8.2 nathanw dc->dc_paddr = color ? COLORP(addr) : MONOP(addr);
172 1.6.8.2 nathanw dc->dc_size = color ? NEXT_P_C16_VIDEOSIZE : NEXT_P_VIDEOSIZE;
173 1.6.8.2 nathanw
174 1.6.8.4 nathanw dc->dc_wid = 1120;
175 1.6.8.4 nathanw dc->dc_ht = 832;
176 1.6.8.2 nathanw dc->dc_depth = color ? 16 : 2;
177 1.6.8.4 nathanw dc->dc_rowbytes = (turbo ? 1120 : 1152) * dc->dc_depth / 8;
178 1.6.8.2 nathanw
179 1.6.8.2 nathanw dc->dc_videobase = dc->dc_vaddr;
180 1.6.8.2 nathanw
181 1.6.8.2 nathanw #if 0
182 1.6.8.2 nathanw printf("intiobase at: %08x\n", intiobase);
183 1.6.8.2 nathanw printf("intiolimit at: %08x\n", intiolimit);
184 1.6.8.2 nathanw printf("videobase at: %08x\n", color ? colorbase : monobase);
185 1.6.8.2 nathanw printf("videolimit at: %08x\n", color ? colorlimit : monolimit);
186 1.6.8.2 nathanw
187 1.6.8.2 nathanw printf("virtual fb at: %08x\n", dc->dc_vaddr);
188 1.6.8.2 nathanw printf("physical fb at: %08x\n", dc->dc_paddr);
189 1.6.8.2 nathanw printf("fb size: %08x\n", dc->dc_size);
190 1.6.8.2 nathanw
191 1.6.8.2 nathanw printf("dc_wid: %08x\n", dc->dc_wid);
192 1.6.8.2 nathanw printf("dc_ht: %08x\n", dc->dc_ht);
193 1.6.8.2 nathanw printf("dc_depth: %08x\n", dc->dc_depth);
194 1.6.8.2 nathanw printf("dc_rowbytes: %08x\n", dc->dc_rowbytes);
195 1.6.8.2 nathanw printf("dc_videobase: %08x\n", dc->dc_videobase);
196 1.6.8.2 nathanw #endif
197 1.6.8.2 nathanw
198 1.6.8.2 nathanw /* clear the screen */
199 1.6.8.2 nathanw for (i = 0; i < dc->dc_ht * dc->dc_rowbytes; i += sizeof(u_int32_t))
200 1.6.8.2 nathanw *(u_int32_t *)(dc->dc_videobase + i) =
201 1.6.8.2 nathanw (color ? 0x0 : 0xffffffff);
202 1.6.8.2 nathanw
203 1.6.8.2 nathanw printf("done clearing\n");
204 1.6.8.2 nathanw
205 1.6.8.2 nathanw rap = &dc->dc_raster;
206 1.6.8.2 nathanw rap->width = dc->dc_wid;
207 1.6.8.2 nathanw rap->height = dc->dc_ht;
208 1.6.8.2 nathanw rap->depth = color ? 16 : 2;
209 1.6.8.2 nathanw rap->linelongs = dc->dc_rowbytes / sizeof(u_int32_t);
210 1.6.8.2 nathanw rap->pixels = (u_int32_t *)dc->dc_videobase;
211 1.6.8.2 nathanw
212 1.6.8.2 nathanw /* initialize the raster console blitter */
213 1.6.8.2 nathanw rcp = &dc->dc_rcons;
214 1.6.8.2 nathanw rcp->rc_sp = rap;
215 1.6.8.2 nathanw rcp->rc_crow = rcp->rc_ccol = -1;
216 1.6.8.2 nathanw rcp->rc_crowp = &rcp->rc_crow;
217 1.6.8.2 nathanw rcp->rc_ccolp = &rcp->rc_ccol;
218 1.6.8.2 nathanw rcons_init(rcp, 34, 80);
219 1.6.8.2 nathanw
220 1.6.8.2 nathanw if (color) {
221 1.6.8.2 nathanw nextdisplay_color.nrows = dc->dc_rcons.rc_maxrow;
222 1.6.8.2 nathanw nextdisplay_color.ncols = dc->dc_rcons.rc_maxcol;
223 1.6.8.2 nathanw } else {
224 1.6.8.2 nathanw nextdisplay_mono.nrows = dc->dc_rcons.rc_maxrow;
225 1.6.8.2 nathanw nextdisplay_mono.ncols = dc->dc_rcons.rc_maxcol;
226 1.6.8.2 nathanw }
227 1.6.8.2 nathanw }
228 1.6.8.2 nathanw
229 1.6.8.2 nathanw void
230 1.6.8.2 nathanw nextdisplay_attach(parent, self, aux)
231 1.6.8.2 nathanw struct device *parent;
232 1.6.8.2 nathanw struct device *self;
233 1.6.8.2 nathanw void *aux;
234 1.6.8.2 nathanw {
235 1.6.8.2 nathanw struct nextdisplay_softc *sc;
236 1.6.8.2 nathanw struct wsemuldisplaydev_attach_args waa;
237 1.6.8.2 nathanw int isconsole;
238 1.6.8.2 nathanw int iscolor;
239 1.6.8.2 nathanw paddr_t addr;
240 1.6.8.2 nathanw
241 1.6.8.2 nathanw sc = (struct nextdisplay_softc *)self;
242 1.6.8.2 nathanw
243 1.6.8.2 nathanw if ((rom_machine_type == NeXT_WARP9C)
244 1.6.8.2 nathanw || (rom_machine_type == NeXT_TURBO_COLOR)) {
245 1.6.8.2 nathanw iscolor = 1;
246 1.6.8.2 nathanw addr = (paddr_t)colorbase;
247 1.6.8.2 nathanw } else {
248 1.6.8.2 nathanw iscolor = 0;
249 1.6.8.2 nathanw addr = (paddr_t)monobase;
250 1.6.8.2 nathanw }
251 1.6.8.2 nathanw
252 1.6.8.2 nathanw isconsole = nextdisplay_is_console(addr);
253 1.6.8.2 nathanw
254 1.6.8.2 nathanw if (isconsole) {
255 1.6.8.2 nathanw sc->sc_dc = &nextdisplay_console_dc;
256 1.6.8.2 nathanw sc->nscreens = 1;
257 1.6.8.2 nathanw } else {
258 1.6.8.2 nathanw sc->sc_dc = (struct nextdisplay_config *)
259 1.6.8.2 nathanw malloc(sizeof(struct nextdisplay_config), M_DEVBUF, M_WAITOK);
260 1.6.8.2 nathanw nextdisplay_init(sc->sc_dc, iscolor);
261 1.6.8.2 nathanw }
262 1.6.8.2 nathanw
263 1.6.8.2 nathanw printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
264 1.6.8.2 nathanw sc->sc_dc->dc_depth);
265 1.6.8.2 nathanw
266 1.6.8.2 nathanw /* initialize the raster */
267 1.6.8.2 nathanw waa.console = isconsole;
268 1.6.8.2 nathanw waa.scrdata = iscolor ? &nextdisplay_screenlist_color : &nextdisplay_screenlist_mono;
269 1.6.8.2 nathanw waa.accessops = &nextdisplay_accessops;
270 1.6.8.2 nathanw waa.accesscookie = sc;
271 1.6.8.2 nathanw #if 0
272 1.6.8.2 nathanw printf("nextdisplay: access cookie is %p\n", sc);
273 1.6.8.2 nathanw #endif
274 1.6.8.2 nathanw config_found(self, &waa, wsemuldisplaydevprint);
275 1.6.8.2 nathanw }
276 1.6.8.2 nathanw
277 1.6.8.2 nathanw
278 1.6.8.2 nathanw int
279 1.6.8.2 nathanw nextdisplay_ioctl(v, cmd, data, flag, p)
280 1.6.8.2 nathanw void *v;
281 1.6.8.2 nathanw u_long cmd;
282 1.6.8.2 nathanw caddr_t data;
283 1.6.8.2 nathanw int flag;
284 1.6.8.2 nathanw struct proc *p;
285 1.6.8.2 nathanw {
286 1.6.8.2 nathanw struct nextdisplay_softc *sc = v;
287 1.6.8.2 nathanw struct nextdisplay_config *dc = sc->sc_dc;
288 1.6.8.2 nathanw
289 1.6.8.2 nathanw switch (cmd) {
290 1.6.8.2 nathanw case WSDISPLAYIO_GTYPE:
291 1.6.8.2 nathanw *(int *)data = dc->dc_type;
292 1.6.8.2 nathanw return 0;
293 1.6.8.2 nathanw
294 1.6.8.2 nathanw case WSDISPLAYIO_SCURSOR:
295 1.6.8.2 nathanw printf("nextdisplay_ioctl: wsdisplayio_scursor\n");
296 1.6.8.2 nathanw return EPASSTHROUGH;
297 1.6.8.2 nathanw
298 1.6.8.2 nathanw case WSDISPLAYIO_SCURPOS:
299 1.6.8.2 nathanw printf("nextdisplay_ioctl: wsdisplayio_scurpos\n");
300 1.6.8.2 nathanw return EPASSTHROUGH;
301 1.6.8.2 nathanw
302 1.6.8.2 nathanw case WSDISPLAYIO_GINFO:
303 1.6.8.2 nathanw case WSDISPLAYIO_GETCMAP:
304 1.6.8.2 nathanw case WSDISPLAYIO_PUTCMAP:
305 1.6.8.2 nathanw case WSDISPLAYIO_GVIDEO:
306 1.6.8.2 nathanw case WSDISPLAYIO_SVIDEO:
307 1.6.8.2 nathanw case WSDISPLAYIO_GCURPOS:
308 1.6.8.2 nathanw case WSDISPLAYIO_GCURMAX:
309 1.6.8.2 nathanw case WSDISPLAYIO_GCURSOR:
310 1.6.8.2 nathanw printf("nextdisplay_ioctl: listed but unsupported ioctl\n");
311 1.6.8.2 nathanw return EPASSTHROUGH;
312 1.6.8.2 nathanw }
313 1.6.8.2 nathanw
314 1.6.8.2 nathanw return EPASSTHROUGH;
315 1.6.8.2 nathanw }
316 1.6.8.2 nathanw
317 1.6.8.2 nathanw static paddr_t
318 1.6.8.2 nathanw nextdisplay_mmap(v, offset, prot)
319 1.6.8.2 nathanw void *v;
320 1.6.8.2 nathanw off_t offset;
321 1.6.8.2 nathanw int prot;
322 1.6.8.2 nathanw {
323 1.6.8.2 nathanw
324 1.6.8.2 nathanw /* XXX */
325 1.6.8.2 nathanw printf("nextdisplay_mmap: failed\n");
326 1.6.8.2 nathanw return -1;
327 1.6.8.2 nathanw }
328 1.6.8.2 nathanw
329 1.6.8.2 nathanw int
330 1.6.8.2 nathanw nextdisplay_alloc_screen(v, type, cookiep, curxp, curyp, defattrp)
331 1.6.8.2 nathanw void *v;
332 1.6.8.2 nathanw const struct wsscreen_descr *type;
333 1.6.8.2 nathanw void **cookiep;
334 1.6.8.2 nathanw int *curxp, *curyp;
335 1.6.8.2 nathanw long *defattrp;
336 1.6.8.2 nathanw {
337 1.6.8.2 nathanw struct nextdisplay_softc *sc = v;
338 1.6.8.2 nathanw long defattr;
339 1.6.8.2 nathanw
340 1.6.8.2 nathanw /* only allow one screen */
341 1.6.8.2 nathanw if (sc->nscreens > 0)
342 1.6.8.2 nathanw return (ENOMEM);
343 1.6.8.2 nathanw
344 1.6.8.2 nathanw *cookiep = &sc->sc_dc->dc_rcons; /* one and only for now */
345 1.6.8.2 nathanw *curxp = 0;
346 1.6.8.2 nathanw *curyp = 0;
347 1.6.8.3 nathanw rcons_allocattr(&sc->sc_dc->dc_rcons, 0, 0,
348 1.6.8.3 nathanw (strcmp(type->name, "color") == 0)
349 1.6.8.3 nathanw ? 0
350 1.6.8.3 nathanw : WSATTR_REVERSE, &defattr);
351 1.6.8.2 nathanw *defattrp = defattr;
352 1.6.8.2 nathanw sc->nscreens++;
353 1.6.8.2 nathanw #if 0
354 1.6.8.2 nathanw printf("nextdisplay: allocating screen\n");
355 1.6.8.2 nathanw #endif
356 1.6.8.2 nathanw return (0);
357 1.6.8.2 nathanw }
358 1.6.8.2 nathanw
359 1.6.8.2 nathanw void
360 1.6.8.2 nathanw nextdisplay_free_screen(v, cookie)
361 1.6.8.2 nathanw void *v;
362 1.6.8.2 nathanw void *cookie;
363 1.6.8.2 nathanw {
364 1.6.8.2 nathanw struct nextdisplay_softc *sc = v;
365 1.6.8.2 nathanw
366 1.6.8.2 nathanw if (sc->sc_dc == &nextdisplay_console_dc)
367 1.6.8.2 nathanw panic("nextdisplay_free_screen: console");
368 1.6.8.2 nathanw
369 1.6.8.2 nathanw sc->nscreens--;
370 1.6.8.2 nathanw }
371 1.6.8.2 nathanw
372 1.6.8.2 nathanw int
373 1.6.8.2 nathanw nextdisplay_show_screen(v, cookie, waitok, cb, cbarg)
374 1.6.8.2 nathanw void *v;
375 1.6.8.2 nathanw void *cookie;
376 1.6.8.2 nathanw int waitok;
377 1.6.8.2 nathanw void (*cb) __P((void *, int, int));
378 1.6.8.2 nathanw void *cbarg;
379 1.6.8.2 nathanw {
380 1.6.8.2 nathanw
381 1.6.8.2 nathanw return (0);
382 1.6.8.2 nathanw }
383 1.6.8.2 nathanw
384 1.6.8.2 nathanw static int
385 1.6.8.2 nathanw nextdisplay_load_font(v, cookie, font)
386 1.6.8.2 nathanw void *v;
387 1.6.8.2 nathanw void *cookie;
388 1.6.8.2 nathanw struct wsdisplay_font *font;
389 1.6.8.2 nathanw {
390 1.6.8.2 nathanw return (EPASSTHROUGH);
391 1.6.8.2 nathanw }
392 1.6.8.2 nathanw
393 1.6.8.2 nathanw int
394 1.6.8.2 nathanw nextdisplay_cnattach(void)
395 1.6.8.2 nathanw {
396 1.6.8.2 nathanw struct nextdisplay_config *dc = &nextdisplay_console_dc;
397 1.6.8.2 nathanw long defattr;
398 1.6.8.2 nathanw int iscolor;
399 1.6.8.2 nathanw
400 1.6.8.2 nathanw if ((rom_machine_type == NeXT_WARP9C)
401 1.6.8.2 nathanw || (rom_machine_type == NeXT_TURBO_COLOR)) {
402 1.6.8.2 nathanw iscolor = 1;
403 1.6.8.2 nathanw nextdisplay_consaddr = (paddr_t)colorbase;
404 1.6.8.2 nathanw } else {
405 1.6.8.2 nathanw iscolor = 0;
406 1.6.8.2 nathanw nextdisplay_consaddr = (paddr_t)monobase;
407 1.6.8.2 nathanw }
408 1.6.8.2 nathanw
409 1.6.8.2 nathanw /* set up the display */
410 1.6.8.2 nathanw nextdisplay_init(&nextdisplay_console_dc, iscolor);
411 1.6.8.2 nathanw
412 1.6.8.3 nathanw rcons_allocattr(&dc->dc_rcons, 0, 0,
413 1.6.8.3 nathanw iscolor ? 0 : WSATTR_REVERSE, &defattr);
414 1.6.8.2 nathanw
415 1.6.8.2 nathanw wsdisplay_cnattach(iscolor ? &nextdisplay_color : &nextdisplay_mono,
416 1.6.8.2 nathanw &dc->dc_rcons, 0, 0, defattr);
417 1.6.8.2 nathanw
418 1.6.8.2 nathanw dc->isconsole = 1;
419 1.6.8.2 nathanw return (0);
420 1.6.8.2 nathanw }
421