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