Home | History | Annotate | Line # | Download | only in isa
pcdisplay.c revision 1.15
      1  1.15   thorpej /* $NetBSD: pcdisplay.c,v 1.15 2001/12/16 22:33:35 thorpej Exp $ */
      2   1.1  drochner 
      3   1.1  drochner /*
      4   1.1  drochner  * Copyright (c) 1998
      5   1.1  drochner  *	Matthias Drochner.  All rights reserved.
      6   1.1  drochner  *
      7   1.1  drochner  * Redistribution and use in source and binary forms, with or without
      8   1.1  drochner  * modification, are permitted provided that the following conditions
      9   1.1  drochner  * are met:
     10   1.1  drochner  * 1. Redistributions of source code must retain the above copyright
     11   1.1  drochner  *    notice, this list of conditions and the following disclaimer.
     12   1.1  drochner  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1  drochner  *    notice, this list of conditions and the following disclaimer in the
     14   1.1  drochner  *    documentation and/or other materials provided with the distribution.
     15   1.1  drochner  * 3. All advertising materials mentioning features or use of this software
     16   1.1  drochner  *    must display the following acknowledgement:
     17   1.1  drochner  *	This product includes software developed for the NetBSD Project
     18   1.1  drochner  *	by Matthias Drochner.
     19   1.1  drochner  * 4. The name of the author may not be used to endorse or promote products
     20   1.1  drochner  *    derived from this software without specific prior written permission.
     21   1.1  drochner  *
     22   1.1  drochner  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23   1.1  drochner  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24   1.1  drochner  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25   1.1  drochner  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26   1.1  drochner  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27   1.1  drochner  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28   1.1  drochner  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29   1.1  drochner  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30   1.1  drochner  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31   1.1  drochner  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32   1.1  drochner  *
     33   1.1  drochner  */
     34  1.12     lukem 
     35  1.12     lukem #include <sys/cdefs.h>
     36  1.15   thorpej __KERNEL_RCSID(0, "$NetBSD: pcdisplay.c,v 1.15 2001/12/16 22:33:35 thorpej Exp $");
     37   1.1  drochner 
     38   1.1  drochner #include <sys/param.h>
     39   1.1  drochner #include <sys/systm.h>
     40   1.1  drochner #include <sys/kernel.h>
     41   1.1  drochner #include <sys/device.h>
     42   1.1  drochner #include <sys/malloc.h>
     43   1.1  drochner #include <machine/bus.h>
     44   1.1  drochner 
     45   1.1  drochner #include <dev/isa/isavar.h>
     46   1.1  drochner 
     47   1.1  drochner #include <dev/ic/mc6845reg.h>
     48   1.1  drochner #include <dev/ic/pcdisplayvar.h>
     49   1.1  drochner #include <dev/isa/pcdisplayvar.h>
     50   1.1  drochner 
     51   1.1  drochner #include <dev/ic/pcdisplay.h>
     52   1.1  drochner 
     53   1.1  drochner #include <dev/wscons/wsconsio.h>
     54   1.1  drochner #include <dev/wscons/wsdisplayvar.h>
     55   1.1  drochner 
     56  1.11   thorpej #include "pcweasel.h"
     57  1.11   thorpej #if NPCWEASEL > 0
     58  1.11   thorpej #include <dev/isa/weaselreg.h>
     59  1.11   thorpej #include <dev/isa/weaselvar.h>
     60  1.11   thorpej #endif
     61  1.11   thorpej 
     62   1.1  drochner struct pcdisplay_config {
     63   1.1  drochner 	struct pcdisplayscreen pcs;
     64   1.1  drochner 	struct pcdisplay_handle dc_ph;
     65   1.1  drochner 	int mono;
     66   1.1  drochner };
     67   1.1  drochner 
     68   1.1  drochner struct pcdisplay_softc {
     69   1.1  drochner 	struct device sc_dev;
     70   1.1  drochner 	struct pcdisplay_config *sc_dc;
     71   1.1  drochner 	int nscreens;
     72  1.11   thorpej #if NPCWEASEL > 0
     73  1.11   thorpej 	struct weasel_handle sc_weasel;
     74  1.11   thorpej #endif
     75   1.1  drochner };
     76   1.1  drochner 
     77   1.1  drochner static int pcdisplayconsole, pcdisplay_console_attached;
     78   1.1  drochner static struct pcdisplay_config pcdisplay_console_dc;
     79   1.1  drochner 
     80   1.1  drochner int	pcdisplay_match __P((struct device *, struct cfdata *, void *));
     81   1.1  drochner void	pcdisplay_attach __P((struct device *, struct device *, void *));
     82   1.1  drochner 
     83   1.1  drochner static int pcdisplay_is_console __P((bus_space_tag_t));
     84   1.1  drochner static int pcdisplay_probe_col __P((bus_space_tag_t, bus_space_tag_t));
     85   1.1  drochner static int pcdisplay_probe_mono __P((bus_space_tag_t, bus_space_tag_t));
     86   1.1  drochner static void pcdisplay_init __P((struct pcdisplay_config *,
     87   1.1  drochner 			     bus_space_tag_t, bus_space_tag_t,
     88   1.1  drochner 			     int));
     89   1.1  drochner static int pcdisplay_alloc_attr __P((void *, int, int, int, long *));
     90   1.1  drochner 
     91   1.1  drochner struct cfattach pcdisplay_ca = {
     92   1.1  drochner 	sizeof(struct pcdisplay_softc), pcdisplay_match, pcdisplay_attach,
     93   1.1  drochner };
     94   1.1  drochner 
     95   1.1  drochner const struct wsdisplay_emulops pcdisplay_emulops = {
     96   1.1  drochner 	pcdisplay_cursor,
     97   1.3  drochner 	pcdisplay_mapchar,
     98   1.2  drochner 	pcdisplay_putchar,
     99   1.1  drochner 	pcdisplay_copycols,
    100   1.1  drochner 	pcdisplay_erasecols,
    101   1.1  drochner 	pcdisplay_copyrows,
    102   1.1  drochner 	pcdisplay_eraserows,
    103   1.1  drochner 	pcdisplay_alloc_attr
    104   1.1  drochner };
    105   1.1  drochner 
    106   1.1  drochner const struct wsscreen_descr pcdisplay_scr = {
    107   1.1  drochner 	"80x25", 80, 25,
    108   1.1  drochner 	&pcdisplay_emulops,
    109   1.1  drochner 	0, 0, /* no font support */
    110   1.1  drochner 	WSSCREEN_REVERSE /* that's minimal... */
    111   1.1  drochner };
    112   1.1  drochner 
    113   1.1  drochner const struct wsscreen_descr *_pcdisplay_scrlist[] = {
    114   1.1  drochner 	&pcdisplay_scr,
    115   1.1  drochner };
    116   1.1  drochner 
    117   1.1  drochner const struct wsscreen_list pcdisplay_screenlist = {
    118   1.1  drochner 	sizeof(_pcdisplay_scrlist) / sizeof(struct wsscreen_descr *),
    119   1.1  drochner 	_pcdisplay_scrlist
    120   1.1  drochner };
    121   1.1  drochner 
    122   1.1  drochner static int pcdisplay_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
    123  1.10    simonb static paddr_t pcdisplay_mmap __P((void *, off_t, int));
    124   1.1  drochner static int pcdisplay_alloc_screen __P((void *, const struct wsscreen_descr *,
    125   1.1  drochner 				       void **, int *, int *, long *));
    126   1.1  drochner static void pcdisplay_free_screen __P((void *, void *));
    127   1.7  drochner static int pcdisplay_show_screen __P((void *, void *, int,
    128   1.7  drochner 				      void (*) (void *, int, int), void *));
    129   1.1  drochner 
    130   1.1  drochner const struct wsdisplay_accessops pcdisplay_accessops = {
    131   1.1  drochner 	pcdisplay_ioctl,
    132   1.1  drochner 	pcdisplay_mmap,
    133   1.1  drochner 	pcdisplay_alloc_screen,
    134   1.1  drochner 	pcdisplay_free_screen,
    135   1.1  drochner 	pcdisplay_show_screen,
    136   1.6  drochner 	0 /* load_font */
    137   1.1  drochner };
    138   1.1  drochner 
    139   1.1  drochner static int
    140   1.1  drochner pcdisplay_probe_col(iot, memt)
    141   1.1  drochner 	bus_space_tag_t iot, memt;
    142   1.1  drochner {
    143   1.1  drochner 	bus_space_handle_t memh, ioh_6845;
    144   1.1  drochner 	u_int16_t oldval, val;
    145   1.1  drochner 
    146   1.1  drochner 	if (bus_space_map(memt, 0xb8000, 0x8000, 0, &memh))
    147   1.1  drochner 		return (0);
    148   1.1  drochner 	oldval = bus_space_read_2(memt, memh, 0);
    149   1.1  drochner 	bus_space_write_2(memt, memh, 0, 0xa55a);
    150   1.1  drochner 	val = bus_space_read_2(memt, memh, 0);
    151   1.1  drochner 	bus_space_write_2(memt, memh, 0, oldval);
    152   1.1  drochner 	bus_space_unmap(memt, memh, 0x8000);
    153   1.1  drochner 	if (val != 0xa55a)
    154   1.1  drochner 		return (0);
    155   1.1  drochner 
    156   1.1  drochner 	if (bus_space_map(iot, 0x3d0, 0x10, 0, &ioh_6845))
    157   1.1  drochner 		return (0);
    158   1.1  drochner 	bus_space_unmap(iot, ioh_6845, 0x10);
    159   1.1  drochner 
    160   1.1  drochner 	return (1);
    161   1.1  drochner }
    162   1.1  drochner 
    163   1.1  drochner static int
    164   1.1  drochner pcdisplay_probe_mono(iot, memt)
    165   1.1  drochner 	bus_space_tag_t iot, memt;
    166   1.1  drochner {
    167   1.1  drochner 	bus_space_handle_t memh, ioh_6845;
    168   1.1  drochner 	u_int16_t oldval, val;
    169   1.1  drochner 
    170   1.1  drochner 	if (bus_space_map(memt, 0xb0000, 0x8000, 0, &memh))
    171   1.1  drochner 		return (0);
    172   1.1  drochner 	oldval = bus_space_read_2(memt, memh, 0);
    173   1.1  drochner 	bus_space_write_2(memt, memh, 0, 0xa55a);
    174   1.1  drochner 	val = bus_space_read_2(memt, memh, 0);
    175   1.1  drochner 	bus_space_write_2(memt, memh, 0, oldval);
    176   1.1  drochner 	bus_space_unmap(memt, memh, 0x8000);
    177   1.1  drochner 	if (val != 0xa55a)
    178   1.1  drochner 		return (0);
    179   1.1  drochner 
    180   1.1  drochner 	if (bus_space_map(iot, 0x3b0, 0x10, 0, &ioh_6845))
    181   1.1  drochner 		return (0);
    182   1.1  drochner 	bus_space_unmap(iot, ioh_6845, 0x10);
    183   1.1  drochner 
    184   1.1  drochner 	return (1);
    185   1.1  drochner }
    186   1.1  drochner 
    187   1.1  drochner static void
    188   1.1  drochner pcdisplay_init(dc, iot, memt, mono)
    189   1.1  drochner 	struct pcdisplay_config *dc;
    190   1.1  drochner 	bus_space_tag_t iot, memt;
    191   1.1  drochner 	int mono;
    192   1.1  drochner {
    193   1.1  drochner 	struct pcdisplay_handle *ph = &dc->dc_ph;
    194   1.1  drochner 	int cpos;
    195   1.1  drochner 
    196   1.1  drochner         ph->ph_iot = iot;
    197   1.1  drochner         ph->ph_memt = memt;
    198   1.1  drochner 	dc->mono = mono;
    199   1.1  drochner 
    200   1.1  drochner 	if (bus_space_map(memt, mono ? 0xb0000 : 0xb8000, 0x8000,
    201   1.1  drochner 			  0, &ph->ph_memh))
    202   1.1  drochner 		panic("pcdisplay_init: cannot map memory");
    203   1.1  drochner 	if (bus_space_map(iot, mono ? 0x3b0 : 0x3d0, 0x10,
    204   1.1  drochner 			  0, &ph->ph_ioh_6845))
    205   1.1  drochner 		panic("pcdisplay_init: cannot map io");
    206   1.1  drochner 
    207   1.1  drochner 	/*
    208   1.1  drochner 	 * initialize the only screen
    209   1.1  drochner 	 */
    210   1.1  drochner 	dc->pcs.hdl = ph;
    211   1.1  drochner 	dc->pcs.type = &pcdisplay_scr;
    212   1.1  drochner 	dc->pcs.active = 1;
    213   1.1  drochner 	dc->pcs.mem = NULL;
    214   1.1  drochner 
    215   1.1  drochner 	cpos = pcdisplay_6845_read(ph, cursorh) << 8;
    216   1.1  drochner 	cpos |= pcdisplay_6845_read(ph, cursorl);
    217   1.1  drochner 
    218   1.1  drochner 	/* make sure we have a valid cursor position */
    219   1.1  drochner 	if (cpos < 0 || cpos >= pcdisplay_scr.nrows * pcdisplay_scr.ncols)
    220   1.1  drochner 		cpos = 0;
    221   1.4  drochner 
    222   1.4  drochner 	dc->pcs.dispoffset = 0;
    223   1.1  drochner 
    224   1.1  drochner 	dc->pcs.vc_crow = cpos / pcdisplay_scr.ncols;
    225   1.1  drochner 	dc->pcs.vc_ccol = cpos % pcdisplay_scr.ncols;
    226   1.9        ad 	pcdisplay_cursor_init(&dc->pcs, 1);
    227   1.1  drochner }
    228   1.1  drochner 
    229   1.1  drochner int
    230   1.1  drochner pcdisplay_match(parent, match, aux)
    231   1.1  drochner 	struct device *parent;
    232   1.1  drochner 	struct cfdata *match;
    233   1.1  drochner 	void *aux;
    234   1.1  drochner {
    235   1.1  drochner 	struct isa_attach_args *ia = aux;
    236   1.1  drochner 	int mono;
    237   1.1  drochner 
    238   1.1  drochner 	/* If values are hardwired to something that they can't be, punt. */
    239  1.14   thorpej 	if ((ia->ia_iobase != IOBASEUNK &&
    240  1.14   thorpej 	     ia->ia_iobase != 0x3d0 &&
    241  1.14   thorpej 	     ia->ia_iobase != 0x3b0) ||
    242  1.14   thorpej 	    /* ia->ia_iosize != 0 || XXX isa.c */
    243  1.14   thorpej 	    (ia->ia_maddr != MADDRUNK &&
    244  1.14   thorpej 	     ia->ia_maddr != 0xb8000 &&
    245  1.14   thorpej 	     ia->ia_maddr != 0xb0000) ||
    246  1.14   thorpej 	    (ia->ia_msize != 0 && ia->ia_msize != 0x8000) ||
    247  1.14   thorpej 	    ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
    248   1.1  drochner 		return (0);
    249   1.1  drochner 
    250   1.1  drochner 	if (pcdisplay_is_console(ia->ia_iot))
    251   1.1  drochner 		mono = pcdisplay_console_dc.mono;
    252  1.14   thorpej 	else if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 &&
    253   1.1  drochner 		 pcdisplay_probe_col(ia->ia_iot, ia->ia_memt))
    254   1.1  drochner 		mono = 0;
    255  1.14   thorpej 	else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 &&
    256   1.1  drochner 		 pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt))
    257   1.1  drochner 		mono = 1;
    258   1.1  drochner 	else
    259   1.1  drochner 		return (0);
    260   1.1  drochner 
    261  1.14   thorpej 	ia->ia_iobase = mono ? 0x3b0 : 0x3d0;
    262  1.14   thorpej 	ia->ia_iosize = 0x10;
    263  1.14   thorpej 	ia->ia_maddr = mono ? 0xb0000 : 0xb8000;
    264  1.14   thorpej 	ia->ia_msize = 0x8000;
    265   1.1  drochner 	return (1);
    266   1.1  drochner }
    267   1.1  drochner 
    268   1.1  drochner void
    269   1.1  drochner pcdisplay_attach(parent, self, aux)
    270   1.1  drochner 	struct device *parent, *self;
    271   1.1  drochner 	void *aux;
    272   1.1  drochner {
    273   1.1  drochner 	struct isa_attach_args *ia = aux;
    274   1.1  drochner 	struct pcdisplay_softc *sc = (struct pcdisplay_softc *)self;
    275   1.1  drochner 	int console;
    276   1.1  drochner 	struct pcdisplay_config *dc;
    277   1.1  drochner 	struct wsemuldisplaydev_attach_args aa;
    278   1.1  drochner 
    279   1.1  drochner 	printf("\n");
    280   1.1  drochner 
    281   1.1  drochner 	console = pcdisplay_is_console(ia->ia_iot);
    282   1.1  drochner 
    283   1.1  drochner 	if (console) {
    284   1.1  drochner 		dc = &pcdisplay_console_dc;
    285   1.1  drochner 		sc->nscreens = 1;
    286   1.1  drochner 		pcdisplay_console_attached = 1;
    287   1.1  drochner 	} else {
    288   1.1  drochner 		dc = malloc(sizeof(struct pcdisplay_config),
    289   1.1  drochner 			    M_DEVBUF, M_WAITOK);
    290  1.14   thorpej 		if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 &&
    291   1.1  drochner 		    pcdisplay_probe_col(ia->ia_iot, ia->ia_memt))
    292   1.1  drochner 			pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 0);
    293  1.14   thorpej 		else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 &&
    294   1.1  drochner 			 pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt))
    295   1.1  drochner 			pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 1);
    296   1.1  drochner 		else
    297   1.1  drochner 			panic("pcdisplay_attach: display disappeared");
    298   1.1  drochner 	}
    299   1.1  drochner 	sc->sc_dc = dc;
    300  1.11   thorpej 
    301  1.11   thorpej #if NPCWEASEL > 0
    302  1.11   thorpej 	/*
    303  1.11   thorpej 	 * If the display is monochrome, check to see if we have
    304  1.11   thorpej 	 * a PC-Weasel, and initialize its special features.
    305  1.11   thorpej 	 */
    306  1.11   thorpej 	if (dc->mono) {
    307  1.11   thorpej 		sc->sc_weasel.wh_st = dc->dc_ph.ph_memt;
    308  1.11   thorpej 		sc->sc_weasel.wh_sh = dc->dc_ph.ph_memh;
    309  1.11   thorpej 		sc->sc_weasel.wh_parent = &sc->sc_dev;
    310  1.15   thorpej 		weasel_isa_init(&sc->sc_weasel);
    311  1.11   thorpej 	}
    312  1.11   thorpej #endif /* NPCWEASEL > 0 */
    313   1.1  drochner 
    314   1.1  drochner 	aa.console = console;
    315   1.1  drochner 	aa.scrdata = &pcdisplay_screenlist;
    316   1.1  drochner 	aa.accessops = &pcdisplay_accessops;
    317   1.1  drochner 	aa.accesscookie = sc;
    318   1.1  drochner 
    319   1.1  drochner         config_found(self, &aa, wsemuldisplaydevprint);
    320   1.1  drochner }
    321   1.1  drochner 
    322   1.1  drochner 
    323   1.1  drochner int
    324   1.1  drochner pcdisplay_cnattach(iot, memt)
    325   1.1  drochner 	bus_space_tag_t iot, memt;
    326   1.1  drochner {
    327   1.1  drochner 	int mono;
    328   1.1  drochner 
    329   1.1  drochner 	if (pcdisplay_probe_col(iot, memt))
    330   1.1  drochner 		mono = 0;
    331   1.1  drochner 	else if (pcdisplay_probe_mono(iot, memt))
    332   1.1  drochner 		mono = 1;
    333   1.1  drochner 	else
    334   1.1  drochner 		return (ENXIO);
    335   1.1  drochner 
    336   1.1  drochner 	pcdisplay_init(&pcdisplay_console_dc, iot, memt, mono);
    337   1.1  drochner 
    338   1.1  drochner 	wsdisplay_cnattach(&pcdisplay_scr, &pcdisplay_console_dc,
    339   1.1  drochner 			   pcdisplay_console_dc.pcs.vc_ccol,
    340   1.1  drochner 			   pcdisplay_console_dc.pcs.vc_crow,
    341   1.1  drochner 			   FG_LIGHTGREY | BG_BLACK);
    342   1.1  drochner 
    343   1.1  drochner 	pcdisplayconsole = 1;
    344   1.1  drochner 	return (0);
    345   1.1  drochner }
    346   1.1  drochner 
    347   1.1  drochner static int
    348   1.1  drochner pcdisplay_is_console(iot)
    349   1.1  drochner 	bus_space_tag_t iot;
    350   1.1  drochner {
    351   1.1  drochner 	if (pcdisplayconsole &&
    352   1.1  drochner 	    !pcdisplay_console_attached &&
    353   1.1  drochner 	    iot == pcdisplay_console_dc.dc_ph.ph_iot)
    354   1.1  drochner 		return (1);
    355   1.1  drochner 	return (0);
    356   1.1  drochner }
    357   1.1  drochner 
    358   1.1  drochner static int
    359   1.1  drochner pcdisplay_ioctl(v, cmd, data, flag, p)
    360   1.1  drochner 	void *v;
    361   1.1  drochner 	u_long cmd;
    362   1.1  drochner 	caddr_t data;
    363   1.1  drochner 	int flag;
    364   1.1  drochner 	struct proc *p;
    365   1.1  drochner {
    366   1.1  drochner 	/*
    367   1.1  drochner 	 * XXX "do something!"
    368   1.1  drochner 	 */
    369   1.1  drochner 	return (-1);
    370   1.1  drochner }
    371   1.1  drochner 
    372  1.10    simonb static paddr_t
    373   1.1  drochner pcdisplay_mmap(v, offset, prot)
    374   1.1  drochner 	void *v;
    375   1.1  drochner 	off_t offset;
    376   1.1  drochner 	int prot;
    377   1.1  drochner {
    378   1.1  drochner 	return (-1);
    379   1.1  drochner }
    380   1.1  drochner 
    381   1.1  drochner static int
    382   1.1  drochner pcdisplay_alloc_screen(v, type, cookiep, curxp, curyp, defattrp)
    383   1.1  drochner 	void *v;
    384   1.1  drochner 	const struct wsscreen_descr *type;
    385   1.1  drochner 	void **cookiep;
    386   1.1  drochner 	int *curxp, *curyp;
    387   1.1  drochner 	long *defattrp;
    388   1.1  drochner {
    389   1.1  drochner 	struct pcdisplay_softc *sc = v;
    390   1.1  drochner 
    391   1.1  drochner 	if (sc->nscreens > 0)
    392   1.1  drochner 		return (ENOMEM);
    393   1.1  drochner 
    394   1.1  drochner 	*cookiep = sc->sc_dc;
    395   1.1  drochner 	*curxp = 0;
    396   1.1  drochner 	*curyp = 0;
    397   1.1  drochner 	*defattrp = FG_LIGHTGREY | BG_BLACK;
    398   1.1  drochner 	sc->nscreens++;
    399   1.1  drochner 	return (0);
    400   1.1  drochner }
    401   1.1  drochner 
    402   1.1  drochner static void
    403   1.1  drochner pcdisplay_free_screen(v, cookie)
    404   1.1  drochner 	void *v;
    405   1.1  drochner 	void *cookie;
    406   1.1  drochner {
    407   1.1  drochner 	struct pcdisplay_softc *sc = v;
    408   1.1  drochner 
    409   1.1  drochner 	if (sc->sc_dc == &pcdisplay_console_dc)
    410   1.1  drochner 		panic("pcdisplay_free_screen: console");
    411   1.1  drochner 
    412   1.1  drochner 	sc->nscreens--;
    413   1.1  drochner }
    414   1.1  drochner 
    415   1.7  drochner static int
    416   1.7  drochner pcdisplay_show_screen(v, cookie, waitok, cb, cbarg)
    417   1.1  drochner 	void *v;
    418   1.1  drochner 	void *cookie;
    419   1.7  drochner 	int waitok;
    420   1.7  drochner 	void (*cb) __P((void *, int, int));
    421   1.7  drochner 	void *cbarg;
    422   1.1  drochner {
    423   1.1  drochner #ifdef DIAGNOSTIC
    424   1.1  drochner 	struct pcdisplay_softc *sc = v;
    425   1.1  drochner 
    426   1.1  drochner 	if (cookie != sc->sc_dc)
    427   1.1  drochner 		panic("pcdisplay_show_screen: bad screen");
    428   1.1  drochner #endif
    429   1.7  drochner 	return (0);
    430   1.1  drochner }
    431   1.1  drochner 
    432   1.1  drochner static int
    433   1.1  drochner pcdisplay_alloc_attr(id, fg, bg, flags, attrp)
    434   1.1  drochner 	void *id;
    435   1.1  drochner 	int fg, bg;
    436   1.1  drochner 	int flags;
    437   1.1  drochner 	long *attrp;
    438   1.1  drochner {
    439   1.1  drochner 	if (flags & WSATTR_REVERSE)
    440   1.1  drochner 		*attrp = FG_BLACK | BG_LIGHTGREY;
    441   1.1  drochner 	else
    442   1.1  drochner 		*attrp = FG_LIGHTGREY | BG_BLACK;
    443   1.1  drochner 	return (0);
    444   1.1  drochner }
    445