Home | History | Annotate | Line # | Download | only in isa
pcdisplay.c revision 1.11
      1  1.11   thorpej /* $NetBSD: pcdisplay.c,v 1.11 2000/11/04 18:47:20 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.1  drochner 
     35   1.1  drochner #include <sys/param.h>
     36   1.1  drochner #include <sys/systm.h>
     37   1.1  drochner #include <sys/kernel.h>
     38   1.1  drochner #include <sys/device.h>
     39   1.1  drochner #include <sys/malloc.h>
     40   1.1  drochner #include <machine/bus.h>
     41   1.1  drochner 
     42   1.1  drochner #include <dev/isa/isavar.h>
     43   1.1  drochner 
     44   1.1  drochner #include <dev/ic/mc6845reg.h>
     45   1.1  drochner #include <dev/ic/pcdisplayvar.h>
     46   1.1  drochner #include <dev/isa/pcdisplayvar.h>
     47   1.1  drochner 
     48   1.1  drochner #include <dev/ic/pcdisplay.h>
     49   1.1  drochner 
     50   1.1  drochner #include <dev/wscons/wsconsio.h>
     51   1.1  drochner #include <dev/wscons/wsdisplayvar.h>
     52   1.1  drochner 
     53  1.11   thorpej #include "pcweasel.h"
     54  1.11   thorpej #if NPCWEASEL > 0
     55  1.11   thorpej #include <dev/isa/weaselreg.h>
     56  1.11   thorpej #include <dev/isa/weaselvar.h>
     57  1.11   thorpej #endif
     58  1.11   thorpej 
     59   1.1  drochner struct pcdisplay_config {
     60   1.1  drochner 	struct pcdisplayscreen pcs;
     61   1.1  drochner 	struct pcdisplay_handle dc_ph;
     62   1.1  drochner 	int mono;
     63   1.1  drochner };
     64   1.1  drochner 
     65   1.1  drochner struct pcdisplay_softc {
     66   1.1  drochner 	struct device sc_dev;
     67   1.1  drochner 	struct pcdisplay_config *sc_dc;
     68   1.1  drochner 	int nscreens;
     69  1.11   thorpej #if NPCWEASEL > 0
     70  1.11   thorpej 	struct weasel_handle sc_weasel;
     71  1.11   thorpej #endif
     72   1.1  drochner };
     73   1.1  drochner 
     74   1.1  drochner static int pcdisplayconsole, pcdisplay_console_attached;
     75   1.1  drochner static struct pcdisplay_config pcdisplay_console_dc;
     76   1.1  drochner 
     77   1.1  drochner int	pcdisplay_match __P((struct device *, struct cfdata *, void *));
     78   1.1  drochner void	pcdisplay_attach __P((struct device *, struct device *, void *));
     79   1.1  drochner 
     80   1.1  drochner static int pcdisplay_is_console __P((bus_space_tag_t));
     81   1.1  drochner static int pcdisplay_probe_col __P((bus_space_tag_t, bus_space_tag_t));
     82   1.1  drochner static int pcdisplay_probe_mono __P((bus_space_tag_t, bus_space_tag_t));
     83   1.1  drochner static void pcdisplay_init __P((struct pcdisplay_config *,
     84   1.1  drochner 			     bus_space_tag_t, bus_space_tag_t,
     85   1.1  drochner 			     int));
     86   1.1  drochner static int pcdisplay_alloc_attr __P((void *, int, int, int, long *));
     87   1.1  drochner 
     88   1.1  drochner struct cfattach pcdisplay_ca = {
     89   1.1  drochner 	sizeof(struct pcdisplay_softc), pcdisplay_match, pcdisplay_attach,
     90   1.1  drochner };
     91   1.1  drochner 
     92   1.1  drochner const struct wsdisplay_emulops pcdisplay_emulops = {
     93   1.1  drochner 	pcdisplay_cursor,
     94   1.3  drochner 	pcdisplay_mapchar,
     95   1.2  drochner 	pcdisplay_putchar,
     96   1.1  drochner 	pcdisplay_copycols,
     97   1.1  drochner 	pcdisplay_erasecols,
     98   1.1  drochner 	pcdisplay_copyrows,
     99   1.1  drochner 	pcdisplay_eraserows,
    100   1.1  drochner 	pcdisplay_alloc_attr
    101   1.1  drochner };
    102   1.1  drochner 
    103   1.1  drochner const struct wsscreen_descr pcdisplay_scr = {
    104   1.1  drochner 	"80x25", 80, 25,
    105   1.1  drochner 	&pcdisplay_emulops,
    106   1.1  drochner 	0, 0, /* no font support */
    107   1.1  drochner 	WSSCREEN_REVERSE /* that's minimal... */
    108   1.1  drochner };
    109   1.1  drochner 
    110   1.1  drochner const struct wsscreen_descr *_pcdisplay_scrlist[] = {
    111   1.1  drochner 	&pcdisplay_scr,
    112   1.1  drochner };
    113   1.1  drochner 
    114   1.1  drochner const struct wsscreen_list pcdisplay_screenlist = {
    115   1.1  drochner 	sizeof(_pcdisplay_scrlist) / sizeof(struct wsscreen_descr *),
    116   1.1  drochner 	_pcdisplay_scrlist
    117   1.1  drochner };
    118   1.1  drochner 
    119   1.1  drochner static int pcdisplay_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
    120  1.10    simonb static paddr_t pcdisplay_mmap __P((void *, off_t, int));
    121   1.1  drochner static int pcdisplay_alloc_screen __P((void *, const struct wsscreen_descr *,
    122   1.1  drochner 				       void **, int *, int *, long *));
    123   1.1  drochner static void pcdisplay_free_screen __P((void *, void *));
    124   1.7  drochner static int pcdisplay_show_screen __P((void *, void *, int,
    125   1.7  drochner 				      void (*) (void *, int, int), void *));
    126   1.1  drochner 
    127   1.1  drochner const struct wsdisplay_accessops pcdisplay_accessops = {
    128   1.1  drochner 	pcdisplay_ioctl,
    129   1.1  drochner 	pcdisplay_mmap,
    130   1.1  drochner 	pcdisplay_alloc_screen,
    131   1.1  drochner 	pcdisplay_free_screen,
    132   1.1  drochner 	pcdisplay_show_screen,
    133   1.6  drochner 	0 /* load_font */
    134   1.1  drochner };
    135   1.1  drochner 
    136   1.1  drochner static int
    137   1.1  drochner pcdisplay_probe_col(iot, memt)
    138   1.1  drochner 	bus_space_tag_t iot, memt;
    139   1.1  drochner {
    140   1.1  drochner 	bus_space_handle_t memh, ioh_6845;
    141   1.1  drochner 	u_int16_t oldval, val;
    142   1.1  drochner 
    143   1.1  drochner 	if (bus_space_map(memt, 0xb8000, 0x8000, 0, &memh))
    144   1.1  drochner 		return (0);
    145   1.1  drochner 	oldval = bus_space_read_2(memt, memh, 0);
    146   1.1  drochner 	bus_space_write_2(memt, memh, 0, 0xa55a);
    147   1.1  drochner 	val = bus_space_read_2(memt, memh, 0);
    148   1.1  drochner 	bus_space_write_2(memt, memh, 0, oldval);
    149   1.1  drochner 	bus_space_unmap(memt, memh, 0x8000);
    150   1.1  drochner 	if (val != 0xa55a)
    151   1.1  drochner 		return (0);
    152   1.1  drochner 
    153   1.1  drochner 	if (bus_space_map(iot, 0x3d0, 0x10, 0, &ioh_6845))
    154   1.1  drochner 		return (0);
    155   1.1  drochner 	bus_space_unmap(iot, ioh_6845, 0x10);
    156   1.1  drochner 
    157   1.1  drochner 	return (1);
    158   1.1  drochner }
    159   1.1  drochner 
    160   1.1  drochner static int
    161   1.1  drochner pcdisplay_probe_mono(iot, memt)
    162   1.1  drochner 	bus_space_tag_t iot, memt;
    163   1.1  drochner {
    164   1.1  drochner 	bus_space_handle_t memh, ioh_6845;
    165   1.1  drochner 	u_int16_t oldval, val;
    166   1.1  drochner 
    167   1.1  drochner 	if (bus_space_map(memt, 0xb0000, 0x8000, 0, &memh))
    168   1.1  drochner 		return (0);
    169   1.1  drochner 	oldval = bus_space_read_2(memt, memh, 0);
    170   1.1  drochner 	bus_space_write_2(memt, memh, 0, 0xa55a);
    171   1.1  drochner 	val = bus_space_read_2(memt, memh, 0);
    172   1.1  drochner 	bus_space_write_2(memt, memh, 0, oldval);
    173   1.1  drochner 	bus_space_unmap(memt, memh, 0x8000);
    174   1.1  drochner 	if (val != 0xa55a)
    175   1.1  drochner 		return (0);
    176   1.1  drochner 
    177   1.1  drochner 	if (bus_space_map(iot, 0x3b0, 0x10, 0, &ioh_6845))
    178   1.1  drochner 		return (0);
    179   1.1  drochner 	bus_space_unmap(iot, ioh_6845, 0x10);
    180   1.1  drochner 
    181   1.1  drochner 	return (1);
    182   1.1  drochner }
    183   1.1  drochner 
    184   1.1  drochner static void
    185   1.1  drochner pcdisplay_init(dc, iot, memt, mono)
    186   1.1  drochner 	struct pcdisplay_config *dc;
    187   1.1  drochner 	bus_space_tag_t iot, memt;
    188   1.1  drochner 	int mono;
    189   1.1  drochner {
    190   1.1  drochner 	struct pcdisplay_handle *ph = &dc->dc_ph;
    191   1.1  drochner 	int cpos;
    192   1.1  drochner 
    193   1.1  drochner         ph->ph_iot = iot;
    194   1.1  drochner         ph->ph_memt = memt;
    195   1.1  drochner 	dc->mono = mono;
    196   1.1  drochner 
    197   1.1  drochner 	if (bus_space_map(memt, mono ? 0xb0000 : 0xb8000, 0x8000,
    198   1.1  drochner 			  0, &ph->ph_memh))
    199   1.1  drochner 		panic("pcdisplay_init: cannot map memory");
    200   1.1  drochner 	if (bus_space_map(iot, mono ? 0x3b0 : 0x3d0, 0x10,
    201   1.1  drochner 			  0, &ph->ph_ioh_6845))
    202   1.1  drochner 		panic("pcdisplay_init: cannot map io");
    203   1.1  drochner 
    204   1.1  drochner 	/*
    205   1.1  drochner 	 * initialize the only screen
    206   1.1  drochner 	 */
    207   1.1  drochner 	dc->pcs.hdl = ph;
    208   1.1  drochner 	dc->pcs.type = &pcdisplay_scr;
    209   1.1  drochner 	dc->pcs.active = 1;
    210   1.1  drochner 	dc->pcs.mem = NULL;
    211   1.1  drochner 
    212   1.1  drochner 	cpos = pcdisplay_6845_read(ph, cursorh) << 8;
    213   1.1  drochner 	cpos |= pcdisplay_6845_read(ph, cursorl);
    214   1.1  drochner 
    215   1.1  drochner 	/* make sure we have a valid cursor position */
    216   1.1  drochner 	if (cpos < 0 || cpos >= pcdisplay_scr.nrows * pcdisplay_scr.ncols)
    217   1.1  drochner 		cpos = 0;
    218   1.4  drochner 
    219   1.4  drochner 	dc->pcs.dispoffset = 0;
    220   1.1  drochner 
    221   1.1  drochner 	dc->pcs.vc_crow = cpos / pcdisplay_scr.ncols;
    222   1.1  drochner 	dc->pcs.vc_ccol = cpos % pcdisplay_scr.ncols;
    223   1.9        ad 	pcdisplay_cursor_init(&dc->pcs, 1);
    224   1.1  drochner }
    225   1.1  drochner 
    226   1.1  drochner int
    227   1.1  drochner pcdisplay_match(parent, match, aux)
    228   1.1  drochner 	struct device *parent;
    229   1.1  drochner 	struct cfdata *match;
    230   1.1  drochner 	void *aux;
    231   1.1  drochner {
    232   1.1  drochner 	struct isa_attach_args *ia = aux;
    233   1.1  drochner 	int mono;
    234   1.1  drochner 
    235   1.1  drochner 	/* If values are hardwired to something that they can't be, punt. */
    236   1.1  drochner 	if ((ia->ia_iobase != IOBASEUNK &&
    237   1.1  drochner 	     ia->ia_iobase != 0x3d0 &&
    238   1.1  drochner 	     ia->ia_iobase != 0x3b0) ||
    239   1.1  drochner 	    /* ia->ia_iosize != 0 || XXX isa.c */
    240   1.1  drochner 	    (ia->ia_maddr != MADDRUNK &&
    241   1.1  drochner 	     ia->ia_maddr != 0xb8000 &&
    242   1.1  drochner 	     ia->ia_maddr != 0xb0000) ||
    243   1.1  drochner 	    (ia->ia_msize != 0 && ia->ia_msize != 0x8000) ||
    244   1.1  drochner 	    ia->ia_irq != IRQUNK || ia->ia_drq != DRQUNK)
    245   1.1  drochner 		return (0);
    246   1.1  drochner 
    247   1.1  drochner 	if (pcdisplay_is_console(ia->ia_iot))
    248   1.1  drochner 		mono = pcdisplay_console_dc.mono;
    249   1.1  drochner 	else if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 &&
    250   1.1  drochner 		 pcdisplay_probe_col(ia->ia_iot, ia->ia_memt))
    251   1.1  drochner 		mono = 0;
    252   1.1  drochner 	else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 &&
    253   1.1  drochner 		 pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt))
    254   1.1  drochner 		mono = 1;
    255   1.1  drochner 	else
    256   1.1  drochner 		return (0);
    257   1.1  drochner 
    258   1.1  drochner 	ia->ia_iobase = mono ? 0x3b0 : 0x3d0;
    259   1.1  drochner 	ia->ia_iosize = 0x10;
    260   1.1  drochner 	ia->ia_maddr = mono ? 0xb0000 : 0xb8000;
    261   1.1  drochner 	ia->ia_msize = 0x8000;
    262   1.1  drochner 	return (1);
    263   1.1  drochner }
    264   1.1  drochner 
    265   1.1  drochner void
    266   1.1  drochner pcdisplay_attach(parent, self, aux)
    267   1.1  drochner 	struct device *parent, *self;
    268   1.1  drochner 	void *aux;
    269   1.1  drochner {
    270   1.1  drochner 	struct isa_attach_args *ia = aux;
    271   1.1  drochner 	struct pcdisplay_softc *sc = (struct pcdisplay_softc *)self;
    272   1.1  drochner 	int console;
    273   1.1  drochner 	struct pcdisplay_config *dc;
    274   1.1  drochner 	struct wsemuldisplaydev_attach_args aa;
    275   1.1  drochner 
    276   1.1  drochner 	printf("\n");
    277   1.1  drochner 
    278   1.1  drochner 	console = pcdisplay_is_console(ia->ia_iot);
    279   1.1  drochner 
    280   1.1  drochner 	if (console) {
    281   1.1  drochner 		dc = &pcdisplay_console_dc;
    282   1.1  drochner 		sc->nscreens = 1;
    283   1.1  drochner 		pcdisplay_console_attached = 1;
    284   1.1  drochner 	} else {
    285   1.1  drochner 		dc = malloc(sizeof(struct pcdisplay_config),
    286   1.1  drochner 			    M_DEVBUF, M_WAITOK);
    287   1.1  drochner 		if (ia->ia_iobase != 0x3b0 && ia->ia_maddr != 0xb0000 &&
    288   1.1  drochner 		    pcdisplay_probe_col(ia->ia_iot, ia->ia_memt))
    289   1.1  drochner 			pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 0);
    290   1.1  drochner 		else if (ia->ia_iobase != 0x3d0 && ia->ia_maddr != 0xb8000 &&
    291   1.1  drochner 			 pcdisplay_probe_mono(ia->ia_iot, ia->ia_memt))
    292   1.1  drochner 			pcdisplay_init(dc, ia->ia_iot, ia->ia_memt, 1);
    293   1.1  drochner 		else
    294   1.1  drochner 			panic("pcdisplay_attach: display disappeared");
    295   1.1  drochner 	}
    296   1.1  drochner 	sc->sc_dc = dc;
    297  1.11   thorpej 
    298  1.11   thorpej #if NPCWEASEL > 0
    299  1.11   thorpej 	/*
    300  1.11   thorpej 	 * If the display is monochrome, check to see if we have
    301  1.11   thorpej 	 * a PC-Weasel, and initialize its special features.
    302  1.11   thorpej 	 */
    303  1.11   thorpej 	if (dc->mono) {
    304  1.11   thorpej 		sc->sc_weasel.wh_st = dc->dc_ph.ph_memt;
    305  1.11   thorpej 		sc->sc_weasel.wh_sh = dc->dc_ph.ph_memh;
    306  1.11   thorpej 		sc->sc_weasel.wh_parent = &sc->sc_dev;
    307  1.11   thorpej 		weasel_init(&sc->sc_weasel);
    308  1.11   thorpej 	}
    309  1.11   thorpej #endif /* NPCWEASEL > 0 */
    310   1.1  drochner 
    311   1.1  drochner 	aa.console = console;
    312   1.1  drochner 	aa.scrdata = &pcdisplay_screenlist;
    313   1.1  drochner 	aa.accessops = &pcdisplay_accessops;
    314   1.1  drochner 	aa.accesscookie = sc;
    315   1.1  drochner 
    316   1.1  drochner         config_found(self, &aa, wsemuldisplaydevprint);
    317   1.1  drochner }
    318   1.1  drochner 
    319   1.1  drochner 
    320   1.1  drochner int
    321   1.1  drochner pcdisplay_cnattach(iot, memt)
    322   1.1  drochner 	bus_space_tag_t iot, memt;
    323   1.1  drochner {
    324   1.1  drochner 	int mono;
    325   1.1  drochner 
    326   1.1  drochner 	if (pcdisplay_probe_col(iot, memt))
    327   1.1  drochner 		mono = 0;
    328   1.1  drochner 	else if (pcdisplay_probe_mono(iot, memt))
    329   1.1  drochner 		mono = 1;
    330   1.1  drochner 	else
    331   1.1  drochner 		return (ENXIO);
    332   1.1  drochner 
    333   1.1  drochner 	pcdisplay_init(&pcdisplay_console_dc, iot, memt, mono);
    334   1.1  drochner 
    335   1.1  drochner 	wsdisplay_cnattach(&pcdisplay_scr, &pcdisplay_console_dc,
    336   1.1  drochner 			   pcdisplay_console_dc.pcs.vc_ccol,
    337   1.1  drochner 			   pcdisplay_console_dc.pcs.vc_crow,
    338   1.1  drochner 			   FG_LIGHTGREY | BG_BLACK);
    339   1.1  drochner 
    340   1.1  drochner 	pcdisplayconsole = 1;
    341   1.1  drochner 	return (0);
    342   1.1  drochner }
    343   1.1  drochner 
    344   1.1  drochner static int
    345   1.1  drochner pcdisplay_is_console(iot)
    346   1.1  drochner 	bus_space_tag_t iot;
    347   1.1  drochner {
    348   1.1  drochner 	if (pcdisplayconsole &&
    349   1.1  drochner 	    !pcdisplay_console_attached &&
    350   1.1  drochner 	    iot == pcdisplay_console_dc.dc_ph.ph_iot)
    351   1.1  drochner 		return (1);
    352   1.1  drochner 	return (0);
    353   1.1  drochner }
    354   1.1  drochner 
    355   1.1  drochner static int
    356   1.1  drochner pcdisplay_ioctl(v, cmd, data, flag, p)
    357   1.1  drochner 	void *v;
    358   1.1  drochner 	u_long cmd;
    359   1.1  drochner 	caddr_t data;
    360   1.1  drochner 	int flag;
    361   1.1  drochner 	struct proc *p;
    362   1.1  drochner {
    363   1.1  drochner 	/*
    364   1.1  drochner 	 * XXX "do something!"
    365   1.1  drochner 	 */
    366   1.1  drochner 	return (-1);
    367   1.1  drochner }
    368   1.1  drochner 
    369  1.10    simonb static paddr_t
    370   1.1  drochner pcdisplay_mmap(v, offset, prot)
    371   1.1  drochner 	void *v;
    372   1.1  drochner 	off_t offset;
    373   1.1  drochner 	int prot;
    374   1.1  drochner {
    375   1.1  drochner 	return (-1);
    376   1.1  drochner }
    377   1.1  drochner 
    378   1.1  drochner static int
    379   1.1  drochner pcdisplay_alloc_screen(v, type, cookiep, curxp, curyp, defattrp)
    380   1.1  drochner 	void *v;
    381   1.1  drochner 	const struct wsscreen_descr *type;
    382   1.1  drochner 	void **cookiep;
    383   1.1  drochner 	int *curxp, *curyp;
    384   1.1  drochner 	long *defattrp;
    385   1.1  drochner {
    386   1.1  drochner 	struct pcdisplay_softc *sc = v;
    387   1.1  drochner 
    388   1.1  drochner 	if (sc->nscreens > 0)
    389   1.1  drochner 		return (ENOMEM);
    390   1.1  drochner 
    391   1.1  drochner 	*cookiep = sc->sc_dc;
    392   1.1  drochner 	*curxp = 0;
    393   1.1  drochner 	*curyp = 0;
    394   1.1  drochner 	*defattrp = FG_LIGHTGREY | BG_BLACK;
    395   1.1  drochner 	sc->nscreens++;
    396   1.1  drochner 	return (0);
    397   1.1  drochner }
    398   1.1  drochner 
    399   1.1  drochner static void
    400   1.1  drochner pcdisplay_free_screen(v, cookie)
    401   1.1  drochner 	void *v;
    402   1.1  drochner 	void *cookie;
    403   1.1  drochner {
    404   1.1  drochner 	struct pcdisplay_softc *sc = v;
    405   1.1  drochner 
    406   1.1  drochner 	if (sc->sc_dc == &pcdisplay_console_dc)
    407   1.1  drochner 		panic("pcdisplay_free_screen: console");
    408   1.1  drochner 
    409   1.1  drochner 	sc->nscreens--;
    410   1.1  drochner }
    411   1.1  drochner 
    412   1.7  drochner static int
    413   1.7  drochner pcdisplay_show_screen(v, cookie, waitok, cb, cbarg)
    414   1.1  drochner 	void *v;
    415   1.1  drochner 	void *cookie;
    416   1.7  drochner 	int waitok;
    417   1.7  drochner 	void (*cb) __P((void *, int, int));
    418   1.7  drochner 	void *cbarg;
    419   1.1  drochner {
    420   1.1  drochner #ifdef DIAGNOSTIC
    421   1.1  drochner 	struct pcdisplay_softc *sc = v;
    422   1.1  drochner 
    423   1.1  drochner 	if (cookie != sc->sc_dc)
    424   1.1  drochner 		panic("pcdisplay_show_screen: bad screen");
    425   1.1  drochner #endif
    426   1.7  drochner 	return (0);
    427   1.1  drochner }
    428   1.1  drochner 
    429   1.1  drochner static int
    430   1.1  drochner pcdisplay_alloc_attr(id, fg, bg, flags, attrp)
    431   1.1  drochner 	void *id;
    432   1.1  drochner 	int fg, bg;
    433   1.1  drochner 	int flags;
    434   1.1  drochner 	long *attrp;
    435   1.1  drochner {
    436   1.1  drochner 	if (flags & WSATTR_REVERSE)
    437   1.1  drochner 		*attrp = FG_BLACK | BG_LIGHTGREY;
    438   1.1  drochner 	else
    439   1.1  drochner 		*attrp = FG_LIGHTGREY | BG_BLACK;
    440   1.1  drochner 	return (0);
    441   1.1  drochner }
    442