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