1 /* $Id: light.c,v 1.10 2021/08/07 16:19:04 thorpej Exp $ */
2
3 /*
4 * Copyright (c) 2006 Stephen M. Rumble
5 * Copyright (c) 2003 Ilpo Ruotsalainen
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * <<Id: LICENSE_GC,v 1.1 2001/10/01 23:24:05 cgd Exp>>
31 */
32
33 /*
34 * SGI "Light" graphics, a.k.a. "Entry", "Starter", "LG1", and "LG2".
35 *
36 * 1024x768 8bpp at 60Hz.
37 *
38 * This driver supports the boards found in Indigo R3k and R4k machines.
39 * There is a Crimson variant, but the register offsets differ significantly.
40 *
41 * Light's REX chip is the precursor of the REX3 found in "newport", hence
42 * much similarity exists.
43 */
44
45 #include <sys/cdefs.h>
46 __KERNEL_RCSID(0, "$NetBSD: light.c,v 1.10 2021/08/07 16:19:04 thorpej Exp $");
47
48 #include <sys/param.h>
49 #include <sys/systm.h>
50 #include <sys/device.h>
51 #include <sys/kmem.h>
52
53 #include <machine/sysconf.h>
54
55 #include <dev/wscons/wsconsio.h>
56 #include <dev/wscons/wsdisplayvar.h>
57 #include <dev/wsfont/wsfont.h>
58
59 #include <sgimips/gio/giovar.h>
60 #include <sgimips/gio/lightvar.h>
61 #include <sgimips/gio/lightreg.h>
62
63 struct light_softc {
64 struct light_devconfig *sc_dc;
65 };
66
67 struct light_devconfig {
68 uint32_t dc_addr;
69
70 bus_space_tag_t dc_st;
71 bus_space_handle_t dc_sh;
72
73 int dc_boardrev;
74 int dc_font;
75 struct wsdisplay_font *dc_fontdata;
76 };
77
78 /* always 1024x768x8 */
79 #define LIGHT_XRES 1024
80 #define LIGHT_YRES 768
81 #define LIGHT_DEPTH 8
82
83 static int light_match(device_t, cfdata_t, void *);
84 static void light_attach(device_t, device_t, void *);
85
86 CFATTACH_DECL_NEW(light, sizeof(struct light_softc), light_match, light_attach,
87 NULL, NULL);
88
89 /* wsdisplay_emulops */
90 static void light_cursor(void *, int, int, int);
91 static int light_mapchar(void *, int, unsigned int *);
92 static void light_putchar(void *, int, int, u_int, long);
93 static void light_copycols(void *, int, int, int, int);
94 static void light_erasecols(void *, int, int, int, long);
95 static void light_copyrows(void *, int, int, int);
96 static void light_eraserows(void *, int, int, long);
97 static int light_allocattr(void *, int, int, int, long *);
98
99 /* wsdisplay_accessops */
100 static int light_ioctl(void *, void *, u_long, void *, int, struct lwp *);
101 static paddr_t light_mmap(void *, void *, off_t, int);
102 static int light_alloc_screen(void *, const struct wsscreen_descr *,
103 void **, int *, int *, long *);
104 static void light_free_screen(void *, void *);
105 static int light_show_screen(void *, void *, int,
106 void (*)(void *, int, int), void *);
107
108 static const struct wsdisplay_accessops light_accessops = {
109 .ioctl = light_ioctl,
110 .mmap = light_mmap,
111 .alloc_screen = light_alloc_screen,
112 .free_screen = light_free_screen,
113 .show_screen = light_show_screen,
114 .load_font = NULL,
115 .pollc = NULL,
116 .scroll = NULL
117 };
118
119 static const struct wsdisplay_emulops light_emulops = {
120 .cursor = light_cursor,
121 .mapchar = light_mapchar,
122 .putchar = light_putchar,
123 .copycols = light_copycols,
124 .erasecols = light_erasecols,
125 .copyrows = light_copyrows,
126 .eraserows = light_eraserows,
127 .allocattr = light_allocattr,
128 .replaceattr = NULL
129 };
130
131 static const struct wsscreen_descr light_screen = {
132 .name = "1024x768",
133 .ncols = 128,
134 .nrows = 48,
135 .textops = &light_emulops,
136 .fontwidth = 8,
137 .fontheight = 16,
138 .capabilities = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_REVERSE
139 };
140
141 const struct wsscreen_descr *_light_screenlist[] = {
142 &light_screen
143 };
144
145 static const struct wsscreen_list light_screenlist = {
146 sizeof(_light_screenlist) / sizeof(_light_screenlist[0]),
147 _light_screenlist
148 };
149
150 static struct light_devconfig light_console_dc;
151 static int light_is_console = 0;
152
153 #define LIGHT_ATTR_ENCODE(fg, bg) (((fg << 8) & 0xff00) | (bg * 0x00ff))
154 #define LIGHT_ATTR_FG(attr) ((attr >> 8) & 0x00ff)
155 #define LIGHT_ATTR_BG(attr) (attr & 0x00ff)
156
157 #define LIGHT_IS_LG1(_rev) ((_rev) < 2) /* else LG2 */
158
159 /*******************************************************************************
160 * REX routines and helper functions
161 ******************************************************************************/
162
163 static uint32_t
rex_read(struct light_devconfig * dc,uint32_t rset,uint32_t r)164 rex_read(struct light_devconfig *dc, uint32_t rset, uint32_t r)
165 {
166
167 return (bus_space_read_4(dc->dc_st, dc->dc_sh, rset + r));
168 }
169
170 static void
rex_write(struct light_devconfig * dc,uint32_t rset,uint32_t r,uint32_t v)171 rex_write(struct light_devconfig *dc, uint32_t rset, uint32_t r, uint32_t v)
172 {
173
174 bus_space_write_4(dc->dc_st, dc->dc_sh, rset + r, v);
175 }
176
177 static uint8_t
rex_vc1_read(struct light_devconfig * dc)178 rex_vc1_read(struct light_devconfig *dc)
179 {
180
181 rex_write(dc, REX_PAGE1_GO, REX_P1REG_CFGSEL, REX_CFGSEL_VC1_SYSCTL);
182 rex_read(dc, REX_PAGE1_GO, REX_P1REG_VC1_ADDRDATA);
183 return (rex_read(dc, REX_PAGE1_SET, REX_P1REG_VC1_ADDRDATA));
184 }
185
186 static void
rex_vc1_write(struct light_devconfig * dc,uint8_t val)187 rex_vc1_write(struct light_devconfig *dc, uint8_t val)
188 {
189
190 rex_write(dc, REX_PAGE1_GO, REX_P1REG_CFGSEL, REX_CFGSEL_VC1_SYSCTL);
191 rex_write(dc, REX_PAGE1_SET, REX_P1REG_VC1_ADDRDATA, val);
192 rex_write(dc, REX_PAGE1_GO, REX_P1REG_VC1_ADDRDATA, val);
193 }
194
195 static void
rex_wait(struct light_devconfig * dc)196 rex_wait(struct light_devconfig *dc)
197 {
198
199 while (rex_read(dc, REX_PAGE1_SET,REX_P1REG_CFGMODE) & REX_CFGMODE_BUSY)
200 ;
201 }
202
203 static int
rex_revision(struct light_devconfig * dc)204 rex_revision(struct light_devconfig *dc)
205 {
206
207 rex_write(dc, REX_PAGE1_SET, REX_P1REG_CFGSEL, REX_CFGSEL_VC1_LADDR);
208 rex_read(dc, REX_PAGE1_GO, REX_P1REG_WCLOCKREV);
209 return (rex_read(dc, REX_PAGE1_SET, REX_P1REG_WCLOCKREV) & 0x7);
210 }
211
212 static void
rex_copy_rect(struct light_devconfig * dc,int from_x,int from_y,int to_x,int to_y,int width,int height)213 rex_copy_rect(struct light_devconfig *dc, int from_x, int from_y, int to_x,
214 int to_y, int width, int height)
215 {
216 int dx, dy, ystarti, yendi;
217
218 dx = from_x - to_x;
219 dy = from_y - to_y;
220
221 /* adjust for y. NB: STOPONX, STOPONY are inclusive */
222 if (to_y > from_y) {
223 ystarti = to_y + height - 1;
224 yendi = to_y;
225 } else {
226 ystarti = to_y;
227 yendi = to_y + height - 1;
228 }
229
230 rex_wait(dc);
231
232 rex_write(dc, REX_PAGE0_SET, REX_P0REG_XSTARTI, to_x);
233 rex_write(dc, REX_PAGE0_SET, REX_P0REG_XENDI, to_x + width);
234 rex_write(dc, REX_PAGE0_SET, REX_P0REG_YSTARTI, ystarti);
235 rex_write(dc, REX_PAGE0_SET, REX_P0REG_YENDI, yendi);
236 rex_write(dc, REX_PAGE0_SET, REX_P0REG_COMMAND, REX_OP_DRAW |
237 REX_LOGICOP_SRC | REX_OP_FLG_LOGICSRC | REX_OP_FLG_QUADMODE |
238 REX_OP_FLG_BLOCK | REX_OP_FLG_STOPONX | REX_OP_FLG_STOPONY);
239 rex_write(dc, REX_PAGE0_GO, REX_P0REG_XYMOVE,
240 ((dx << 16) & 0xffff0000) | (dy & 0x0000ffff));
241 }
242
243 static void
rex_fill_rect(struct light_devconfig * dc,int from_x,int from_y,int to_x,int to_y,long attr)244 rex_fill_rect(struct light_devconfig *dc, int from_x, int from_y, int to_x,
245 int to_y, long attr)
246 {
247
248 rex_wait(dc);
249
250 rex_write(dc, REX_PAGE0_SET, REX_P0REG_YSTARTI, from_y);
251 rex_write(dc, REX_PAGE0_SET, REX_P0REG_YENDI, to_y);
252 rex_write(dc, REX_PAGE0_SET, REX_P0REG_XSTARTI, from_x);
253 rex_write(dc, REX_PAGE0_SET, REX_P0REG_XENDI, to_x);
254 rex_write(dc, REX_PAGE0_SET, REX_P0REG_COLORREDI, LIGHT_ATTR_BG(attr));
255 rex_write(dc, REX_PAGE0_SET, REX_P0REG_COMMAND, REX_OP_DRAW |
256 REX_LOGICOP_SRC | REX_OP_FLG_QUADMODE | REX_OP_FLG_BLOCK |
257 REX_OP_FLG_STOPONX | REX_OP_FLG_STOPONY);
258 rex_read(dc, REX_PAGE0_GO, REX_P0REG_COMMAND);
259 }
260
261 /*******************************************************************************
262 * match/attach functions
263 ******************************************************************************/
264
265 static int
light_match(device_t parent,cfdata_t cf,void * aux)266 light_match(device_t parent, cfdata_t cf, void *aux)
267 {
268 struct gio_attach_args *ga = aux;
269
270 if (ga->ga_addr != LIGHT_ADDR_0 && ga->ga_addr != LIGHT_ADDR_1)
271 return (0);
272
273 if (platform.badaddr(
274 (void *)(ga->ga_ioh + REX_PAGE1_SET + REX_P1REG_XYOFFSET),
275 sizeof(uint32_t)))
276 return (0);
277
278 if (bus_space_read_4(ga->ga_iot, ga->ga_ioh,
279 REX_PAGE1_SET + REX_P1REG_XYOFFSET) != 0x08000800)
280 return (0);
281
282 return (1);
283 }
284
285 static void
light_attach_common(struct light_devconfig * dc,struct gio_attach_args * ga)286 light_attach_common(struct light_devconfig *dc, struct gio_attach_args *ga)
287 {
288
289 dc->dc_addr = ga->ga_addr;
290 dc->dc_st = ga->ga_iot;
291 dc->dc_sh = ga->ga_ioh;
292
293 dc->dc_boardrev = rex_revision(dc);
294
295 wsfont_init();
296
297 dc->dc_font = wsfont_find(NULL, 8, 16, 0, WSDISPLAY_FONTORDER_L2R,
298 WSDISPLAY_FONTORDER_L2R, WSFONT_FIND_BITMAP);
299
300 if (dc->dc_font < 0)
301 panic("light_attach_common: no suitable fonts");
302
303 if (wsfont_lock(dc->dc_font, &dc->dc_fontdata))
304 panic("light_attach_common: unable to lock font data");
305
306 rex_vc1_write(dc, rex_vc1_read(dc) & ~(VC1_SYSCTL_CURSOR |
307 VC1_SYSCTL_CURSOR_ON));
308 rex_fill_rect(dc, 0, 0, LIGHT_XRES - 1, LIGHT_YRES - 1, 0);
309 }
310
311 static void
light_attach(device_t parent,device_t self,void * aux)312 light_attach(device_t parent, device_t self, void *aux)
313 {
314 struct gio_attach_args *ga = aux;
315 struct light_softc *sc = device_private(self);
316 struct wsemuldisplaydev_attach_args wa;
317
318 if (light_is_console && ga->ga_addr == light_console_dc.dc_addr) {
319 wa.console = 1;
320 sc->sc_dc = &light_console_dc;
321 } else {
322 wa.console = 0;
323 sc->sc_dc = kmem_zalloc(sizeof(struct light_devconfig),
324 KM_SLEEP);
325
326 light_attach_common(sc->sc_dc, ga);
327 }
328
329 aprint_naive(": Display adapter\n");
330
331 aprint_normal(": SGI LG%d (board revision %d)\n",
332 LIGHT_IS_LG1(sc->sc_dc->dc_boardrev) ? 1 : 2,
333 sc->sc_dc->dc_boardrev);
334
335 wa.scrdata = &light_screenlist;
336 wa.accessops = &light_accessops;
337 wa.accesscookie = sc->sc_dc;
338
339 config_found(self, &wa, wsemuldisplaydevprint, CFARGS_NONE);
340 }
341
342 int
light_cnattach(struct gio_attach_args * ga)343 light_cnattach(struct gio_attach_args *ga)
344 {
345
346 if (!light_match(NULL, NULL, ga))
347 return (ENXIO);
348
349 light_attach_common(&light_console_dc, ga);
350
351 wsdisplay_cnattach(&light_screen, &light_console_dc, 0, 0,
352 LIGHT_ATTR_ENCODE(WSCOL_WHITE, WSCOL_BLACK));
353
354 light_is_console = 1;
355
356 return (0);
357 }
358
359 /*******************************************************************************
360 * wsdisplay_emulops
361 ******************************************************************************/
362
363 static void
light_cursor(void * c,int on,int row,int col)364 light_cursor(void *c, int on, int row, int col)
365 {
366 /* XXX */
367 }
368
369 static int
light_mapchar(void * c,int ch,unsigned int * cp)370 light_mapchar(void *c, int ch, unsigned int *cp)
371 {
372 struct light_devconfig *dc = (void *)c;
373
374 if (dc->dc_fontdata->encoding != WSDISPLAY_FONTENC_ISO) {
375 ch = wsfont_map_unichar(dc->dc_fontdata, ch);
376
377 if (ch < 0)
378 goto fail;
379 }
380
381 if (ch < dc->dc_fontdata->firstchar ||
382 ch >= dc->dc_fontdata->firstchar + dc->dc_fontdata->numchars)
383 goto fail;
384
385 *cp = ch;
386 return 5;
387
388 fail:
389 *cp = ' ';
390 return 0;
391 }
392
393 static void
light_putchar(void * c,int row,int col,u_int ch,long attr)394 light_putchar(void *c, int row, int col, u_int ch, long attr)
395 {
396 struct light_devconfig *dc = c;
397 struct wsdisplay_font *font = dc->dc_fontdata;
398 uint8_t *bitmap;
399 uint32_t pattern;
400 int i, x, y;
401
402 bitmap = (u_int8_t *)font->data +
403 ((ch - font->firstchar) * font->fontheight * font->stride);
404 x = col * font->fontwidth;
405 y = row * font->fontheight;
406
407 rex_wait(dc);
408
409 rex_write(dc, REX_PAGE0_SET, REX_P0REG_YSTARTI, y);
410 rex_write(dc, REX_PAGE0_SET, REX_P0REG_YENDI, y + font->fontheight - 1);
411 rex_write(dc, REX_PAGE0_SET, REX_P0REG_XSTARTI, x);
412 rex_write(dc, REX_PAGE0_SET, REX_P0REG_XENDI, x + font->fontwidth - 1);
413 rex_write(dc, REX_PAGE0_SET, REX_P0REG_COLORREDI, LIGHT_ATTR_FG(attr));
414 rex_write(dc, REX_PAGE0_SET, REX_P0REG_COLORBACK, LIGHT_ATTR_BG(attr));
415 rex_write(dc, REX_PAGE0_GO, REX_P0REG_COMMAND, REX_OP_NOP);
416
417 rex_wait(dc);
418
419 rex_write(dc, REX_PAGE0_SET, REX_P0REG_COMMAND, REX_OP_DRAW |
420 REX_LOGICOP_SRC | REX_OP_FLG_ENZPATTERN | REX_OP_FLG_QUADMODE |
421 REX_OP_FLG_XYCONTINUE | REX_OP_FLG_STOPONX | REX_OP_FLG_BLOCK |
422 REX_OP_FLG_LENGTH32 | REX_OP_FLG_ZOPAQUE);
423
424 for (i = 0; i < font->fontheight; i++) {
425 /* XXX assumes font->fontwidth == 8 */
426 pattern = *bitmap << 24;
427 rex_write(dc, REX_PAGE0_GO, REX_P0REG_ZPATTERN, pattern);
428 bitmap += font->stride;
429 }
430 }
431
432 /* copy set of columns within the same line */
433 static void
light_copycols(void * c,int row,int srccol,int dstcol,int ncols)434 light_copycols(void *c, int row, int srccol, int dstcol, int ncols)
435 {
436 struct light_devconfig *dc = c;
437 struct wsdisplay_font *font = dc->dc_fontdata;
438 int from_x, from_y, to_x, to_y, width, height;
439
440 from_x = srccol * font->fontwidth;
441 from_y = row * font->fontheight;
442 to_x = dstcol * font->fontwidth;
443 to_y = from_y;
444 width = ncols * font->fontwidth;
445 height = font->fontheight;
446
447 rex_copy_rect(c, from_x, from_y, to_x, to_y, width, height);
448 }
449
450 /* erase a set of columns in the same line */
451 static void
light_erasecols(void * c,int row,int startcol,int ncols,long attr)452 light_erasecols(void *c, int row, int startcol, int ncols, long attr)
453 {
454 struct light_devconfig *dc = c;
455 struct wsdisplay_font *font = dc->dc_fontdata;
456 int from_x, from_y, to_x, to_y;
457
458 from_x = startcol * font->fontwidth;
459 from_y = row * font->fontheight;
460 to_x = from_x + (ncols * font->fontwidth) - 1;
461 to_y = from_y + font->fontheight - 1;
462
463 rex_fill_rect(c, from_x, from_y, to_x, to_y, attr);
464 }
465
466 /* copy a set of complete rows */
467 static void
light_copyrows(void * c,int srcrow,int dstrow,int nrows)468 light_copyrows(void *c, int srcrow, int dstrow, int nrows)
469 {
470 struct light_devconfig *dc = c;
471 struct wsdisplay_font *font = dc->dc_fontdata;
472 int from_x, from_y, to_x, to_y, width, height;
473
474 from_x = 0;
475 from_y = srcrow * font->fontheight;
476 to_x = 0;
477 to_y = dstrow * font->fontheight;
478 width = LIGHT_XRES;
479 height = nrows * font->fontheight;
480
481 rex_copy_rect(c, from_x, from_y, to_x, to_y, width, height);
482 }
483
484 /* erase a set of complete rows */
485 static void
light_eraserows(void * c,int row,int nrows,long attr)486 light_eraserows(void *c, int row, int nrows, long attr)
487 {
488 struct light_devconfig *dc = c;
489 struct wsdisplay_font *font = dc->dc_fontdata;
490 int from_x, from_y, to_x, to_y;
491
492 from_x = 0;
493 from_y = row * font->fontheight;
494 to_x = LIGHT_XRES - 1;
495 to_y = from_y + (nrows * font->fontheight) - 1;
496
497 rex_fill_rect(c, from_x, from_y, to_x, to_y, attr);
498 }
499
500 static int
light_allocattr(void * c,int fg,int bg,int flags,long * attr)501 light_allocattr(void *c, int fg, int bg, int flags, long *attr)
502 {
503
504 if (flags & ~(WSATTR_WSCOLORS | WSATTR_HILIT | WSATTR_REVERSE))
505 return (EINVAL);
506
507 if ((flags & WSATTR_WSCOLORS) == 0) {
508 fg = WSCOL_WHITE;
509 bg = WSCOL_BLACK;
510 }
511
512 if (flags & WSATTR_HILIT)
513 fg += 8;
514
515 if (flags & WSATTR_REVERSE) {
516 int tmp = fg;
517 fg = bg;
518 bg = tmp;
519 }
520
521 *attr = LIGHT_ATTR_ENCODE(fg, bg);
522 return (0);
523 }
524
525 /*******************************************************************************
526 * wsdisplay_accessops
527 ******************************************************************************/
528
529 static int
light_ioctl(void * c,void * vs,u_long cmd,void * data,int flag,struct lwp * l)530 light_ioctl(void *c, void *vs, u_long cmd, void *data, int flag,
531 struct lwp *l)
532 {
533 struct wsdisplay_fbinfo *fbinfo = (struct wsdisplay_fbinfo *)data;
534
535 switch (cmd) {
536 case WSDISPLAYIO_GINFO:
537 fbinfo->width = LIGHT_XRES;
538 fbinfo->height = LIGHT_YRES;
539 fbinfo->depth = LIGHT_DEPTH;
540 fbinfo->cmsize = 1 << LIGHT_DEPTH;
541 return (0);
542
543 case WSDISPLAYIO_GMODE:
544 *(u_int *)data = WSDISPLAYIO_MODE_EMUL;
545 break;
546
547 case WSDISPLAYIO_GTYPE:
548 *(u_int *)data = WSDISPLAY_TYPE_LIGHT;
549 return (0);
550
551 case WSDISPLAYIO_SVIDEO:
552 /*
553 * Turning off VC1 will stop refreshing the video ram (or so I
554 * suspect). We'll blank the screen after bringing it back up,
555 * since that's nicer than displaying garbage.
556 */
557 if (*(u_int *)data == WSDISPLAYIO_VIDEO_OFF)
558 rex_vc1_write(c,rex_vc1_read(c) & ~VC1_SYSCTL_VIDEO_ON);
559 else {
560 rex_vc1_write(c, rex_vc1_read(c) | VC1_SYSCTL_VIDEO_ON);
561 rex_fill_rect(c, 0, 0, LIGHT_XRES-1, LIGHT_YRES-1, 0);
562 }
563 return (0);
564 }
565
566 return (EPASSTHROUGH);
567 }
568
569 static paddr_t
light_mmap(void * c,void * vs,off_t off,int prot)570 light_mmap(void *c, void *vs, off_t off, int prot)
571 {
572 struct light_devconfig *dc = c;
573
574 if (off >= 0x7fff)
575 return (-1);
576
577 return (mips_btop(dc->dc_addr + off));
578 }
579
580 static int
light_alloc_screen(void * c,const struct wsscreen_descr * type,void ** cookiep,int * curxp,int * curyp,long * attr)581 light_alloc_screen(void *c, const struct wsscreen_descr *type, void **cookiep,
582 int *curxp, int *curyp, long *attr)
583 {
584
585 return (ENOMEM);
586 }
587
588 static void
light_free_screen(void * c,void * cookie)589 light_free_screen(void *c, void *cookie)
590 {
591
592 panic("light_free_screen");
593 }
594
595 static int
light_show_screen(void * c,void * cookie,int waitok,void (* cb)(void *,int,int),void * cbarg)596 light_show_screen(void *c, void *cookie, int waitok,
597 void (*cb)(void *, int, int), void *cbarg)
598 {
599
600 return (0);
601 }
602