Home | History | Annotate | Line # | Download | only in dev
grf.c revision 1.56.2.2
      1  1.56.2.2      yamt /*	$NetBSD: grf.c,v 1.56.2.2 2012/10/30 17:18:48 yamt Exp $ */
      2      1.15       cgd 
      3       1.1        mw /*
      4      1.54     rmind  * Copyright (c) 1988 University of Utah.
      5       1.1        mw  * Copyright (c) 1990 The Regents of the University of California.
      6       1.1        mw  * All rights reserved.
      7       1.1        mw  *
      8       1.1        mw  * This code is derived from software contributed to Berkeley by
      9       1.1        mw  * the Systems Programming Group of the University of Utah Computer
     10       1.1        mw  * Science Department.
     11       1.1        mw  *
     12       1.1        mw  * Redistribution and use in source and binary forms, with or without
     13       1.1        mw  * modification, are permitted provided that the following conditions
     14       1.1        mw  * are met:
     15       1.1        mw  * 1. Redistributions of source code must retain the above copyright
     16       1.1        mw  *    notice, this list of conditions and the following disclaimer.
     17       1.1        mw  * 2. Redistributions in binary form must reproduce the above copyright
     18       1.1        mw  *    notice, this list of conditions and the following disclaimer in the
     19       1.1        mw  *    documentation and/or other materials provided with the distribution.
     20      1.48       agc  * 3. Neither the name of the University nor the names of its contributors
     21      1.48       agc  *    may be used to endorse or promote products derived from this software
     22      1.48       agc  *    without specific prior written permission.
     23      1.48       agc  *
     24      1.48       agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25      1.48       agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26      1.48       agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27      1.48       agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28      1.48       agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29      1.48       agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30      1.48       agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31      1.48       agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32      1.48       agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33      1.48       agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34      1.48       agc  * SUCH DAMAGE.
     35      1.48       agc  *
     36      1.48       agc  * from: Utah $Hdr: grf.c 1.31 91/01/21$
     37      1.48       agc  *
     38      1.48       agc  *	@(#)grf.c	7.8 (Berkeley) 5/7/91
     39      1.48       agc  */
     40      1.40   aymeric 
     41      1.40   aymeric #include <sys/cdefs.h>
     42  1.56.2.2      yamt __KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.56.2.2 2012/10/30 17:18:48 yamt Exp $");
     43       1.1        mw 
     44       1.1        mw /*
     45      1.11    chopps  * Graphics display driver for the Amiga
     46       1.1        mw  * This is the hardware-independent portion of the driver.
     47      1.11    chopps  * Hardware access is through the grf_softc->g_mode routine.
     48       1.1        mw  */
     49       1.1        mw 
     50  1.56.2.1      yamt #include "view.h"
     51  1.56.2.1      yamt #include "grf.h"
     52  1.56.2.1      yamt #include "kbd.h"
     53  1.56.2.1      yamt #include "wsdisplay.h"
     54  1.56.2.1      yamt 
     55       1.8    chopps #include <sys/param.h>
     56       1.8    chopps #include <sys/proc.h>
     57       1.8    chopps #include <sys/ioctl.h>
     58      1.11    chopps #include <sys/device.h>
     59       1.8    chopps #include <sys/file.h>
     60       1.8    chopps #include <sys/malloc.h>
     61       1.9    chopps #include <sys/systm.h>
     62      1.11    chopps #include <sys/vnode.h>
     63      1.11    chopps #include <sys/mman.h>
     64  1.56.2.1      yamt #include <sys/bus.h>
     65  1.56.2.1      yamt #include <sys/kauth.h>
     66  1.56.2.1      yamt 
     67      1.11    chopps #include <machine/cpu.h>
     68  1.56.2.1      yamt 
     69  1.56.2.1      yamt #include <dev/cons.h>
     70      1.38   thorpej #include <dev/sun/fbio.h>
     71  1.56.2.1      yamt #include <dev/wscons/wsconsio.h>
     72  1.56.2.1      yamt #include <dev/wscons/wsdisplayvar.h>
     73  1.56.2.1      yamt #include <dev/rasops/rasops.h>
     74  1.56.2.1      yamt #include <dev/wscons/wsdisplay_vconsvar.h>
     75  1.56.2.1      yamt 
     76      1.11    chopps #include <amiga/amiga/color.h>	/* DEBUG */
     77      1.11    chopps #include <amiga/amiga/device.h>
     78      1.11    chopps #include <amiga/dev/grfioctl.h>
     79  1.56.2.1      yamt #include <amiga/dev/grfws.h>
     80      1.11    chopps #include <amiga/dev/grfvar.h>
     81      1.11    chopps #include <amiga/dev/itevar.h>
     82  1.56.2.1      yamt #include <amiga/dev/kbdvar.h>
     83      1.26     veego #include <amiga/dev/viewioctl.h>
     84      1.26     veego 
     85      1.26     veego #include <sys/conf.h>
     86       1.8    chopps 
     87      1.11    chopps #if NGRF > 0
     88       1.1        mw #include "ite.h"
     89       1.1        mw #if NITE == 0
     90       1.9    chopps #define	ite_on(u,f)
     91       1.9    chopps #define	ite_off(u,f)
     92       1.9    chopps #define ite_reinit(d)
     93       1.1        mw #endif
     94       1.1        mw 
     95      1.39   aymeric int grfon(dev_t);
     96      1.39   aymeric int grfoff(dev_t);
     97      1.39   aymeric int grfsinfo(dev_t, struct grfdyninfo *);
     98       1.1        mw 
     99      1.55      matt void grfattach(device_t, device_t, void *);
    100      1.55      matt int grfmatch(device_t, cfdata_t, void *);
    101      1.39   aymeric int grfprint(void *, const char *);
    102  1.56.2.1      yamt #ifdef DEBUG
    103  1.56.2.1      yamt void grfdebug(struct grf_softc *, const char *, ...);
    104  1.56.2.1      yamt #endif
    105       1.1        mw /*
    106      1.39   aymeric  * pointers to grf drivers device structs
    107       1.1        mw  */
    108      1.11    chopps struct grf_softc *grfsp[NGRF];
    109      1.11    chopps 
    110      1.55      matt CFATTACH_DECL_NEW(grf, 0,
    111      1.44   thorpej     grfmatch, grfattach, NULL, NULL);
    112      1.11    chopps 
    113      1.42   gehenna dev_type_open(grfopen);
    114      1.42   gehenna dev_type_close(grfclose);
    115      1.42   gehenna dev_type_ioctl(grfioctl);
    116      1.42   gehenna dev_type_mmap(grfmmap);
    117      1.42   gehenna 
    118      1.42   gehenna const struct cdevsw grf_cdevsw = {
    119      1.42   gehenna 	grfopen, grfclose, nullread, nullwrite, grfioctl,
    120      1.46  jdolecek 	nostop, notty, nopoll, grfmmap, nokqfilter,
    121      1.42   gehenna };
    122      1.42   gehenna 
    123      1.11    chopps /*
    124      1.11    chopps  * only used in console init.
    125      1.11    chopps  */
    126      1.55      matt static cfdata_t cfdata;
    127      1.11    chopps 
    128  1.56.2.1      yamt #if NWSDISPLAY > 0
    129  1.56.2.1      yamt static struct vcons_screen console_vcons;
    130  1.56.2.1      yamt 
    131  1.56.2.1      yamt static void grf_init_screen(void *, struct vcons_screen *, int, long *);
    132  1.56.2.1      yamt static struct rasops_info *grf_setup_rasops(struct grf_softc *,
    133  1.56.2.1      yamt     struct vcons_screen *);
    134  1.56.2.1      yamt static paddr_t grf_wsmmap_md(off_t off);
    135  1.56.2.1      yamt 
    136  1.56.2.1      yamt cons_decl(grf);
    137  1.56.2.1      yamt #endif
    138  1.56.2.1      yamt 
    139      1.11    chopps /*
    140      1.39   aymeric  * match if the unit of grf matches its perspective
    141      1.11    chopps  * low level board driver.
    142      1.11    chopps  */
    143      1.11    chopps int
    144  1.56.2.2      yamt grfmatch(device_t parent, cfdata_t cf, void *aux)
    145       1.1        mw {
    146  1.56.2.2      yamt 	struct grf_softc *psc;
    147      1.25   thorpej 
    148  1.56.2.2      yamt 	psc = device_private(parent);
    149  1.56.2.2      yamt 	if (cf->cf_unit != psc->g_unit)
    150      1.11    chopps 		return(0);
    151  1.56.2.2      yamt 	cfdata = cf;
    152      1.11    chopps 	return(1);
    153       1.1        mw }
    154       1.1        mw 
    155       1.1        mw /*
    156  1.56.2.1      yamt  * Attach.. plug pointer in and print some info.
    157  1.56.2.1      yamt  * Then try and attach a wsdisplay or ite to us.
    158  1.56.2.2      yamt  * Note: self is NULL durring console init.
    159       1.1        mw  */
    160      1.11    chopps void
    161  1.56.2.2      yamt grfattach(device_t parent, device_t self, void *aux)
    162       1.1        mw {
    163  1.56.2.1      yamt #if NWSDISPLAY > 0
    164  1.56.2.1      yamt 	struct wsemuldisplaydev_attach_args wa;
    165  1.56.2.1      yamt 	long defattr;
    166  1.56.2.1      yamt #endif
    167      1.11    chopps 	struct grf_softc *gp;
    168      1.11    chopps 	int maj;
    169      1.11    chopps 
    170  1.56.2.2      yamt 	gp = device_private(parent);
    171  1.56.2.2      yamt 	gp->g_device = self;
    172  1.56.2.2      yamt 	grfsp[gp->g_unit] = gp;
    173       1.1        mw 
    174      1.11    chopps 	/*
    175      1.39   aymeric 	 * find our major device number
    176      1.11    chopps 	 */
    177      1.42   gehenna 	maj = cdevsw_lookup_major(&grf_cdevsw);
    178      1.11    chopps 
    179      1.11    chopps 	gp->g_grfdev = makedev(maj, gp->g_unit);
    180  1.56.2.2      yamt 	if (self != NULL) {
    181      1.31  christos 		printf(": width %d height %d", gp->g_display.gd_dwidth,
    182      1.11    chopps 		    gp->g_display.gd_dheight);
    183      1.11    chopps 		if (gp->g_display.gd_colors == 2)
    184      1.31  christos 			printf(" monochrome\n");
    185      1.11    chopps 		else
    186      1.31  christos 			printf(" colors %d\n", gp->g_display.gd_colors);
    187  1.56.2.1      yamt #if NWSDISPLAY > 0
    188  1.56.2.1      yamt 		vcons_init(&gp->g_vd, gp, gp->g_screens[0], gp->g_accessops);
    189  1.56.2.1      yamt 		gp->g_vd.init_screen = grf_init_screen;
    190  1.56.2.1      yamt 		if (gp->g_flags & GF_CONSOLE) {
    191  1.56.2.1      yamt 			console_vcons.scr_flags |= VCONS_SCREEN_IS_STATIC;
    192  1.56.2.1      yamt 			vcons_init_screen(&gp->g_vd,
    193  1.56.2.1      yamt 			    &console_vcons, 1, &defattr);
    194  1.56.2.1      yamt 			gp->g_screens[0]->textops =
    195  1.56.2.1      yamt 			    &console_vcons.scr_ri.ri_ops;
    196  1.56.2.1      yamt 			wsdisplay_cnattach(gp->g_screens[0],
    197  1.56.2.1      yamt 			    &console_vcons.scr_ri, 0, 0, defattr);
    198  1.56.2.1      yamt 			vcons_replay_msgbuf(&console_vcons);
    199  1.56.2.1      yamt 		}
    200  1.56.2.1      yamt 
    201  1.56.2.1      yamt 		/* attach wsdisplay */
    202  1.56.2.1      yamt 		wa.console = (gp->g_flags & GF_CONSOLE) != 0;
    203  1.56.2.1      yamt 		wa.scrdata = &gp->g_screenlist;
    204  1.56.2.1      yamt 		wa.accessops = gp->g_accessops;
    205  1.56.2.1      yamt 		wa.accesscookie = &gp->g_vd;
    206  1.56.2.2      yamt 		config_found(self, &wa, wsemuldisplaydevprint);
    207  1.56.2.1      yamt #endif  /* NWSDISPLAY > 0 */
    208      1.11    chopps 	}
    209      1.39   aymeric 
    210  1.56.2.1      yamt #if NWSDISPLAY == 0
    211      1.11    chopps 	/*
    212      1.11    chopps 	 * try and attach an ite
    213      1.11    chopps 	 */
    214  1.56.2.2      yamt 	amiga_config_found(cfdata, self, gp, grfprint);
    215  1.56.2.1      yamt #endif
    216       1.1        mw }
    217       1.1        mw 
    218      1.11    chopps int
    219  1.56.2.2      yamt grfprint(void *aux, const char *pnp)
    220      1.11    chopps {
    221      1.11    chopps 	if (pnp)
    222      1.47   thorpej 		aprint_normal("ite at %s", pnp);
    223      1.11    chopps 	return(UNCONF);
    224       1.1        mw }
    225       1.1        mw 
    226       1.1        mw /*ARGSUSED*/
    227      1.11    chopps int
    228      1.49  christos grfopen(dev_t dev, int flags, int devtype, struct lwp *l)
    229       1.1        mw {
    230      1.11    chopps 	struct grf_softc *gp;
    231      1.11    chopps 
    232      1.24       jtc 	if (GRFUNIT(dev) >= NGRF || (gp = grfsp[GRFUNIT(dev)]) == NULL)
    233      1.11    chopps 		return(ENXIO);
    234      1.11    chopps 
    235      1.11    chopps 	if ((gp->g_flags & GF_ALIVE) == 0)
    236       1.1        mw 		return(ENXIO);
    237      1.11    chopps 
    238       1.1        mw 	if ((gp->g_flags & (GF_OPEN|GF_EXCLUDE)) == (GF_OPEN|GF_EXCLUDE))
    239       1.1        mw 		return(EBUSY);
    240      1.11    chopps 
    241      1.11    chopps 	return(0);
    242       1.1        mw }
    243       1.1        mw 
    244       1.1        mw /*ARGSUSED*/
    245      1.11    chopps int
    246      1.49  christos grfclose(dev_t dev, int flags, int mode, struct lwp *l)
    247       1.1        mw {
    248      1.11    chopps 	struct grf_softc *gp;
    249       1.1        mw 
    250      1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    251      1.11    chopps 	(void)grfoff(dev);
    252       1.1        mw 	gp->g_flags &= GF_ALIVE;
    253       1.1        mw 	return(0);
    254       1.1        mw }
    255       1.1        mw 
    256       1.1        mw /*ARGSUSED*/
    257      1.11    chopps int
    258      1.50  christos grfioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
    259       1.1        mw {
    260      1.11    chopps 	struct grf_softc *gp;
    261       1.1        mw 	int error;
    262       1.1        mw 
    263      1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    264       1.1        mw 	error = 0;
    265      1.11    chopps 
    266       1.1        mw 	switch (cmd) {
    267       1.5        mw 	case OGRFIOCGINFO:
    268       1.5        mw 	        /* argl.. no bank-member.. */
    269      1.52    cegger 	  	memcpy(data, (void *)&gp->g_display, sizeof(struct grfinfo)-4);
    270       1.5        mw 		break;
    271       1.1        mw 	case GRFIOCGINFO:
    272      1.52    cegger 		memcpy(data, (void *)&gp->g_display, sizeof(struct grfinfo));
    273       1.1        mw 		break;
    274       1.1        mw 	case GRFIOCON:
    275       1.1        mw 		error = grfon(dev);
    276       1.1        mw 		break;
    277       1.1        mw 	case GRFIOCOFF:
    278       1.1        mw 		error = grfoff(dev);
    279       1.1        mw 		break;
    280       1.1        mw 	case GRFIOCSINFO:
    281      1.11    chopps 		error = grfsinfo(dev, (struct grfdyninfo *) data);
    282       1.1        mw 		break;
    283       1.3        mw 	case GRFGETVMODE:
    284      1.26     veego 		return(gp->g_mode(gp, GM_GRFGETVMODE, data, 0, 0));
    285       1.3        mw 	case GRFSETVMODE:
    286      1.26     veego 		error = gp->g_mode(gp, GM_GRFSETVMODE, data, 0, 0);
    287      1.18    chopps 		if (error == 0 && gp->g_itedev && !(gp->g_flags & GF_GRFON))
    288      1.11    chopps 			ite_reinit(gp->g_itedev);
    289       1.3        mw 		break;
    290       1.3        mw 	case GRFGETNUMVM:
    291      1.26     veego 		return(gp->g_mode(gp, GM_GRFGETNUMVM, data, 0, 0));
    292      1.11    chopps 	/*
    293      1.56       wiz 	 * these are all hardware dependent, and have to be resolved
    294      1.11    chopps 	 * in the respective driver.
    295      1.11    chopps 	 */
    296       1.5        mw 	case GRFIOCPUTCMAP:
    297       1.5        mw 	case GRFIOCGETCMAP:
    298       1.5        mw 	case GRFIOCSSPRITEPOS:
    299       1.5        mw 	case GRFIOCGSPRITEPOS:
    300       1.5        mw 	case GRFIOCSSPRITEINF:
    301       1.5        mw 	case GRFIOCGSPRITEINF:
    302       1.5        mw 	case GRFIOCGSPRITEMAX:
    303      1.18    chopps 	case GRFIOCBITBLT:
    304      1.20    chopps     	case GRFIOCSETMON:
    305      1.17    chopps 	case GRFTOGGLE: /* Toggles between Cirrus boards and native ECS on
    306      1.17    chopps                      Amiga. 15/11/94 ill */
    307      1.22    chopps 		/*
    308      1.22    chopps 		 * We need the minor dev number to get the overlay/image
    309      1.22    chopps 		 * information for grf_ul.
    310      1.22    chopps 		 */
    311      1.26     veego 		return(gp->g_mode(gp, GM_GRFIOCTL, data, cmd, dev));
    312      1.27        is 
    313      1.34        is 	case GRFIOCBLANK:	/* blank ioctl, IOCON/OFF will turn ite on */
    314      1.27        is 	case FBIOSVIDEO:
    315      1.34        is 		error = gp->g_mode(gp, GM_GRFIOCTL, data, GRFIOCBLANK, dev);
    316      1.34        is 		if (!error)
    317      1.34        is 			gp->g_blank = *(int *)data;
    318      1.34        is 		return (error);
    319      1.34        is 
    320      1.34        is 	case FBIOGVIDEO:
    321      1.34        is 		*(int *)data = gp->g_blank;
    322      1.34        is 		return (0);
    323      1.27        is 
    324       1.1        mw 	default:
    325      1.21    chopps #if NVIEW > 0
    326      1.11    chopps 		/*
    327      1.11    chopps 		 * check to see whether it's a command recognized by the
    328      1.11    chopps 		 * view code if the unit is 0
    329      1.39   aymeric 		 * XXX
    330      1.11    chopps 		 */
    331      1.42   gehenna 		if (GRFUNIT(dev) == 0) {
    332      1.42   gehenna 			extern const struct cdevsw view_cdevsw;
    333      1.42   gehenna 
    334      1.49  christos 			return((*view_cdevsw.d_ioctl)(dev, cmd, data, flag, l));
    335      1.42   gehenna 		}
    336      1.21    chopps #endif
    337      1.41    atatat 		error = EPASSTHROUGH;
    338       1.1        mw 		break;
    339       1.1        mw 
    340       1.1        mw 	}
    341       1.1        mw 	return(error);
    342       1.1        mw }
    343       1.1        mw 
    344      1.11    chopps /*
    345      1.39   aymeric  * map the contents of a graphics display card into process'
    346      1.11    chopps  * memory space.
    347      1.11    chopps  */
    348      1.35    simonb paddr_t
    349      1.39   aymeric grfmmap(dev_t dev, off_t off, int prot)
    350       1.1        mw {
    351      1.11    chopps 	struct grf_softc *gp;
    352      1.11    chopps 	struct grfinfo *gi;
    353      1.39   aymeric 
    354      1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    355      1.11    chopps 	gi = &gp->g_display;
    356       1.1        mw 
    357      1.39   aymeric 	/*
    358      1.11    chopps 	 * control registers
    359      1.11    chopps 	 */
    360      1.11    chopps 	if (off >= 0 && off < gi->gd_regsize)
    361      1.35    simonb 		return(((paddr_t)gi->gd_regaddr + off) >> PGSHIFT);
    362       1.1        mw 
    363      1.11    chopps 	/*
    364      1.11    chopps 	 * frame buffer
    365      1.11    chopps 	 */
    366      1.11    chopps 	if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
    367      1.11    chopps 		off -= gi->gd_regsize;
    368      1.35    simonb 		return(((paddr_t)gi->gd_fbaddr + off) >> PGSHIFT);
    369       1.1        mw 	}
    370      1.11    chopps 	/* bogus */
    371      1.11    chopps 	return(-1);
    372       1.1        mw }
    373       1.1        mw 
    374      1.11    chopps int
    375      1.39   aymeric grfon(dev_t dev)
    376       1.1        mw {
    377      1.11    chopps 	struct grf_softc *gp;
    378       1.1        mw 
    379      1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    380       1.1        mw 
    381       1.3        mw 	if (gp->g_flags & GF_GRFON)
    382      1.11    chopps 		return(0);
    383      1.11    chopps 
    384       1.3        mw 	gp->g_flags |= GF_GRFON;
    385      1.11    chopps 	if (gp->g_itedev != NODEV)
    386      1.11    chopps 		ite_off(gp->g_itedev, 3);
    387       1.3        mw 
    388      1.26     veego 	return(gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVON : GM_GRFON,
    389      1.26     veego 							NULL, 0, 0));
    390       1.1        mw }
    391       1.1        mw 
    392      1.11    chopps int
    393      1.39   aymeric grfoff(dev_t dev)
    394       1.1        mw {
    395      1.11    chopps 	struct grf_softc *gp;
    396       1.1        mw 	int error;
    397       1.3        mw 
    398      1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    399      1.11    chopps 
    400      1.11    chopps 	if ((gp->g_flags & GF_GRFON) == 0)
    401      1.11    chopps 		return(0);
    402      1.11    chopps 
    403       1.3        mw 	gp->g_flags &= ~GF_GRFON;
    404      1.26     veego 	error = gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF,
    405      1.26     veego 							NULL, 0, 0);
    406      1.11    chopps 
    407      1.11    chopps 	/*
    408      1.11    chopps 	 * Closely tied together no X's
    409      1.11    chopps 	 */
    410      1.11    chopps 	if (gp->g_itedev != NODEV)
    411      1.11    chopps 		ite_on(gp->g_itedev, 2);
    412       1.1        mw 
    413       1.1        mw 	return(error);
    414       1.1        mw }
    415       1.1        mw 
    416      1.11    chopps int
    417      1.39   aymeric grfsinfo(dev_t dev, struct grfdyninfo *dyninfo)
    418       1.1        mw {
    419      1.11    chopps 	struct grf_softc *gp;
    420       1.1        mw 	int error;
    421       1.1        mw 
    422      1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    423      1.26     veego 	error = gp->g_mode(gp, GM_GRFCONFIG, dyninfo, 0, 0);
    424       1.1        mw 
    425      1.11    chopps 	/*
    426      1.11    chopps 	 * Closely tied together no X's
    427      1.11    chopps 	 */
    428      1.11    chopps 	if (gp->g_itedev != NODEV)
    429      1.11    chopps 		ite_reinit(gp->g_itedev);
    430       1.1        mw 	return(error);
    431       1.1        mw }
    432       1.1        mw 
    433  1.56.2.1      yamt #if NWSDISPLAY > 0
    434  1.56.2.1      yamt void
    435  1.56.2.1      yamt grfcnprobe(struct consdev *cd)
    436  1.56.2.1      yamt {
    437  1.56.2.1      yamt 	struct grf_softc *gp;
    438  1.56.2.1      yamt 	int unit;
    439  1.56.2.1      yamt 
    440  1.56.2.1      yamt 	/*
    441  1.56.2.1      yamt 	 * Find the first working grf device for being console.
    442  1.56.2.1      yamt 	 * Ignore unit 0 (grfcc), which should use amidisplaycc instead.
    443  1.56.2.1      yamt 	 */
    444  1.56.2.1      yamt 	for (unit = 1; unit < NGRF; unit++) {
    445  1.56.2.1      yamt 		gp = grfsp[unit];
    446  1.56.2.1      yamt 		if (gp != NULL && (gp->g_flags & GF_ALIVE)) {
    447  1.56.2.1      yamt 			cd->cn_pri = CN_INTERNAL;
    448  1.56.2.1      yamt 			cd->cn_dev = NODEV;  /* initialized later by wscons */
    449  1.56.2.1      yamt 			return;
    450  1.56.2.1      yamt 		}
    451  1.56.2.1      yamt 	}
    452  1.56.2.1      yamt 
    453  1.56.2.1      yamt 	/* no grf console alive */
    454  1.56.2.1      yamt 	cd->cn_pri = CN_DEAD;
    455  1.56.2.1      yamt }
    456  1.56.2.1      yamt 
    457  1.56.2.1      yamt void
    458  1.56.2.1      yamt grfcninit(struct consdev *cd)
    459  1.56.2.1      yamt {
    460  1.56.2.1      yamt 	struct grf_softc *gp;
    461  1.56.2.1      yamt 	struct rasops_info *ri;
    462  1.56.2.1      yamt 	long defattr;
    463  1.56.2.1      yamt 	int unit;
    464  1.56.2.1      yamt 
    465  1.56.2.1      yamt 	/* find console grf and set up wsdisplay for it */
    466  1.56.2.1      yamt 	for (unit = 1; unit < NGRF; unit++) {
    467  1.56.2.1      yamt 		gp = grfsp[unit];
    468  1.56.2.1      yamt 		if (gp != NULL && (gp->g_flags & GF_ALIVE)) {
    469  1.56.2.1      yamt 			gp->g_flags |= GF_CONSOLE;  /* we are console! */
    470  1.56.2.1      yamt 			gp->g_screens[0]->ncols = gp->g_display.gd_fbwidth /
    471  1.56.2.1      yamt 			    gp->g_screens[0]->fontwidth;
    472  1.56.2.1      yamt 			gp->g_screens[0]->nrows = gp->g_display.gd_fbheight /
    473  1.56.2.1      yamt 			    gp->g_screens[0]->fontheight;
    474  1.56.2.1      yamt 
    475  1.56.2.1      yamt 			ri = grf_setup_rasops(gp, &console_vcons);
    476  1.56.2.1      yamt 			console_vcons.scr_cookie = gp;
    477  1.56.2.1      yamt 			defattr = 0;  /* XXX */
    478  1.56.2.1      yamt 
    479  1.56.2.1      yamt 			wsdisplay_preattach(gp->g_screens[0], ri, 0, 0,
    480  1.56.2.1      yamt 			    defattr);
    481  1.56.2.1      yamt #if NKBD > 0
    482  1.56.2.1      yamt 			/* tell kbd device it is used as console keyboard */
    483  1.56.2.1      yamt 			kbd_cnattach();
    484  1.56.2.1      yamt #endif
    485  1.56.2.1      yamt 			return;
    486  1.56.2.1      yamt 		}
    487  1.56.2.1      yamt 	}
    488  1.56.2.1      yamt 	panic("grfcninit: lost console");
    489  1.56.2.1      yamt }
    490  1.56.2.1      yamt 
    491  1.56.2.1      yamt static void
    492  1.56.2.1      yamt grf_init_screen(void *cookie, struct vcons_screen *scr, int existing,
    493  1.56.2.1      yamt     long *defattr)
    494  1.56.2.1      yamt {
    495  1.56.2.1      yamt 	struct grf_softc *gp;
    496  1.56.2.1      yamt 	struct rasops_info *ri;
    497  1.56.2.1      yamt 
    498  1.56.2.1      yamt 	gp = cookie;
    499  1.56.2.1      yamt 	ri = grf_setup_rasops(gp, scr);
    500  1.56.2.1      yamt }
    501  1.56.2.1      yamt 
    502  1.56.2.1      yamt static struct rasops_info *
    503  1.56.2.1      yamt grf_setup_rasops(struct grf_softc *gp, struct vcons_screen *scr)
    504  1.56.2.1      yamt {
    505  1.56.2.1      yamt 	struct rasops_info *ri;
    506  1.56.2.1      yamt 	int i;
    507  1.56.2.1      yamt 
    508  1.56.2.1      yamt 	ri = &scr->scr_ri;
    509  1.56.2.1      yamt 	scr->scr_flags |= VCONS_DONT_READ;
    510  1.56.2.1      yamt 	memset(ri, 0, sizeof(struct rasops_info));
    511  1.56.2.1      yamt 
    512  1.56.2.1      yamt 	ri->ri_rows = gp->g_screens[0]->nrows;
    513  1.56.2.1      yamt 	ri->ri_cols = gp->g_screens[0]->ncols;
    514  1.56.2.1      yamt 	ri->ri_hw = scr;
    515  1.56.2.1      yamt 	ri->ri_ops.cursor    = gp->g_emulops->cursor;
    516  1.56.2.1      yamt 	ri->ri_ops.mapchar   = gp->g_emulops->mapchar;
    517  1.56.2.1      yamt 	ri->ri_ops.copyrows  = gp->g_emulops->copyrows;
    518  1.56.2.1      yamt 	ri->ri_ops.eraserows = gp->g_emulops->eraserows;
    519  1.56.2.1      yamt 	ri->ri_ops.copycols  = gp->g_emulops->copycols;
    520  1.56.2.1      yamt 	ri->ri_ops.erasecols = gp->g_emulops->erasecols;
    521  1.56.2.1      yamt 	ri->ri_ops.putchar   = gp->g_emulops->putchar;
    522  1.56.2.1      yamt 	ri->ri_ops.allocattr = gp->g_emulops->allocattr;
    523  1.56.2.1      yamt 
    524  1.56.2.1      yamt 	/* multiplication table for row-offsets */
    525  1.56.2.1      yamt 	for (i = 0; i < ri->ri_rows; i++)
    526  1.56.2.1      yamt 		gp->g_rowoffset[i] = i * ri->ri_cols;
    527  1.56.2.1      yamt 
    528  1.56.2.1      yamt 	return ri;
    529  1.56.2.1      yamt }
    530  1.56.2.1      yamt 
    531  1.56.2.1      yamt paddr_t
    532  1.56.2.1      yamt grf_wsmmap(void *v, void *vs, off_t off, int prot)
    533  1.56.2.1      yamt {
    534  1.56.2.1      yamt 	struct vcons_data *vd;
    535  1.56.2.1      yamt 	struct grf_softc *gp;
    536  1.56.2.1      yamt 	struct grfinfo *gi;
    537  1.56.2.1      yamt 
    538  1.56.2.1      yamt 	vd = v;
    539  1.56.2.1      yamt 	gp = vd->cookie;
    540  1.56.2.1      yamt 	gi = &gp->g_display;
    541  1.56.2.1      yamt 
    542  1.56.2.1      yamt 	/* Normal fb mapping */
    543  1.56.2.1      yamt 	if (off < gi->gd_fbsize)
    544  1.56.2.1      yamt 		return grf_wsmmap_md(((bus_addr_t)gp->g_fbkva) + off);
    545  1.56.2.1      yamt 
    546  1.56.2.1      yamt 	if (kauth_authorize_machdep(kauth_cred_get(), KAUTH_MACHDEP_UNMANAGEDMEM,
    547  1.56.2.1      yamt 	    NULL, NULL, NULL, NULL) != 0) {
    548  1.56.2.1      yamt 		aprint_normal("%s: permission to mmap denied.\n",
    549  1.56.2.2      yamt 		    device_xname(gp->g_device));
    550  1.56.2.1      yamt 		return -1;
    551  1.56.2.1      yamt 	}
    552  1.56.2.1      yamt 
    553  1.56.2.1      yamt 	if ((off >= (bus_addr_t)gp->g_fbkva ) &&
    554  1.56.2.1      yamt 	    (off < ( (bus_addr_t)gp->g_fbkva + (size_t)gi->gd_fbsize)))
    555  1.56.2.1      yamt 		return grf_wsmmap_md(off);
    556  1.56.2.1      yamt 
    557  1.56.2.1      yamt 	/* Handle register mapping */
    558  1.56.2.1      yamt 	if ((off >= (bus_addr_t)gi->gd_regaddr) &&
    559  1.56.2.1      yamt 	    (off < ((bus_addr_t)gi->gd_regaddr + (size_t)gi->gd_regsize)))
    560  1.56.2.1      yamt 		return grf_wsmmap_md(off);
    561  1.56.2.1      yamt 
    562  1.56.2.1      yamt 	return -1;
    563  1.56.2.1      yamt }
    564  1.56.2.1      yamt 
    565  1.56.2.1      yamt static paddr_t
    566  1.56.2.1      yamt grf_wsmmap_md(off_t off)
    567  1.56.2.1      yamt {
    568  1.56.2.1      yamt #if defined(__m68k__)
    569  1.56.2.1      yamt 	return (paddr_t) m68k_btop(off);
    570  1.56.2.1      yamt #else
    571  1.56.2.1      yamt 	return -1; /* FIXME */
    572  1.56.2.1      yamt #endif
    573  1.56.2.1      yamt }
    574  1.56.2.1      yamt 
    575  1.56.2.1      yamt int
    576  1.56.2.1      yamt grf_wsioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
    577  1.56.2.1      yamt {
    578  1.56.2.1      yamt 	struct vcons_data *vd;
    579  1.56.2.1      yamt 	struct grf_softc *gp;
    580  1.56.2.1      yamt 
    581  1.56.2.1      yamt 	vd = v;
    582  1.56.2.1      yamt 	gp = vd->cookie;
    583  1.56.2.1      yamt 
    584  1.56.2.1      yamt 	switch (cmd) {
    585  1.56.2.1      yamt 	/* XXX: check if ptr to implementation is not null */
    586  1.56.2.1      yamt 	case WSDISPLAYIO_GINFO:
    587  1.56.2.1      yamt 		return gp->g_wsioctl->ginfo(gp, data);
    588  1.56.2.1      yamt 	case WSDISPLAYIO_SMODE:
    589  1.56.2.1      yamt 		return gp->g_wsioctl->smode(gp, data);
    590  1.56.2.1      yamt 	case WSDISPLAYIO_GMODE:
    591  1.56.2.1      yamt 		return gp->g_wsioctl->gmode(gp, data);
    592  1.56.2.1      yamt 	case WSDISPLAYIO_GTYPE:
    593  1.56.2.1      yamt 		return gp->g_wsioctl->gtype(gp, data);
    594  1.56.2.1      yamt 	case WSDISPLAYIO_SVIDEO:
    595  1.56.2.1      yamt 		return gp->g_wsioctl->svideo(gp, data);
    596  1.56.2.1      yamt 	case WSDISPLAYIO_GVIDEO:
    597  1.56.2.1      yamt 		return gp->g_wsioctl->gvideo(gp, data);
    598  1.56.2.1      yamt 	case WSDISPLAYIO_GETCMAP:
    599  1.56.2.1      yamt 		return gp->g_wsioctl->getcmap(gp, data);
    600  1.56.2.1      yamt 	case WSDISPLAYIO_PUTCMAP:
    601  1.56.2.1      yamt 		return gp->g_wsioctl->putcmap(gp, data);
    602  1.56.2.1      yamt 	}
    603  1.56.2.1      yamt 
    604  1.56.2.1      yamt 	return EPASSTHROUGH;
    605  1.56.2.1      yamt }
    606  1.56.2.1      yamt 
    607  1.56.2.1      yamt /* wsdisplay_accessops ioctls */
    608  1.56.2.1      yamt 
    609  1.56.2.1      yamt int
    610  1.56.2.1      yamt grf_wsaogetcmap(void *c, void *data)
    611  1.56.2.1      yamt {
    612  1.56.2.1      yamt 	u_int index, count;
    613  1.56.2.1      yamt 	struct grf_softc *gp;
    614  1.56.2.1      yamt 	struct wsdisplay_cmap *cm;
    615  1.56.2.1      yamt 
    616  1.56.2.1      yamt 	cm = (struct wsdisplay_cmap*) data;
    617  1.56.2.1      yamt 	gp = c;
    618  1.56.2.1      yamt 	index = 0;
    619  1.56.2.1      yamt 	count = 0;
    620  1.56.2.1      yamt 
    621  1.56.2.1      yamt 	if (gp->g_wsmode == WSDISPLAYIO_MODE_EMUL)
    622  1.56.2.1      yamt 		return EINVAL;
    623  1.56.2.1      yamt 
    624  1.56.2.1      yamt 	if (index >= 255 || count > 256 || index + count > 256)
    625  1.56.2.1      yamt 		return EINVAL;
    626  1.56.2.1      yamt 
    627  1.56.2.1      yamt 	/*
    628  1.56.2.1      yamt 	 * TODO: copyout values for r, g, b. This function should be
    629  1.56.2.1      yamt 	 * driver-specific...
    630  1.56.2.1      yamt 	 */
    631  1.56.2.1      yamt 
    632  1.56.2.1      yamt 	return 0;
    633  1.56.2.1      yamt }
    634  1.56.2.1      yamt 
    635  1.56.2.1      yamt int
    636  1.56.2.1      yamt grf_wsaoputcmap(void *c, void *data)
    637  1.56.2.1      yamt {
    638  1.56.2.1      yamt 	/*
    639  1.56.2.1      yamt 	 * We probably couldn't care less about color map in MODE_EMUL,
    640  1.56.2.1      yamt 	 * I don't know about X11 yet. Also, these ioctls could be used by
    641  1.56.2.1      yamt 	 * fullscreen console programs (think wsdisplay picture viewer, or
    642  1.56.2.1      yamt 	 * the wsimgshow tool written by Yasushi Oshima).
    643  1.56.2.1      yamt 	 */
    644  1.56.2.1      yamt 	struct grf_softc *gp;
    645  1.56.2.1      yamt 
    646  1.56.2.1      yamt 	gp = c;
    647  1.56.2.1      yamt 
    648  1.56.2.1      yamt 	if (gp->g_wsmode == WSDISPLAYIO_MODE_EMUL)
    649  1.56.2.1      yamt 		return EINVAL;
    650  1.56.2.1      yamt 	/* ... */
    651  1.56.2.1      yamt 
    652  1.56.2.1      yamt 	return 0;
    653  1.56.2.1      yamt }
    654  1.56.2.1      yamt 
    655  1.56.2.1      yamt int
    656  1.56.2.1      yamt grf_wsaosvideo(void *c, void *data)
    657  1.56.2.1      yamt {
    658  1.56.2.1      yamt #if 0
    659  1.56.2.1      yamt 	struct grf_softc *gp;
    660  1.56.2.1      yamt 	dev_t dev;
    661  1.56.2.1      yamt 	int rv;
    662  1.56.2.1      yamt 
    663  1.56.2.1      yamt 	gp = c;
    664  1.56.2.1      yamt 	dev = (dev_t) &gp->g_grfdev;
    665  1.56.2.1      yamt 
    666  1.56.2.1      yamt 	if (*(u_int *)data == WSDISPLAYIO_VIDEO_OFF) {
    667  1.56.2.1      yamt 		if ((gp->g_flags & GF_GRFON) == 0)
    668  1.56.2.1      yamt 			rv = 0;
    669  1.56.2.1      yamt 		else {
    670  1.56.2.1      yamt 			gp->g_flags &= ~GF_GRFON;
    671  1.56.2.1      yamt 			rv = gp->g_mode(gp, (dev & GRFOVDEV) ?
    672  1.56.2.1      yamt 			    GM_GRFOVOFF : GM_GRFOFF, NULL, 0, 0);
    673  1.56.2.1      yamt 		}
    674  1.56.2.1      yamt 
    675  1.56.2.1      yamt 	} else {
    676  1.56.2.1      yamt 		if ((gp->g_flags & GF_GRFON))
    677  1.56.2.1      yamt         		rv = 0;
    678  1.56.2.1      yamt 		else
    679  1.56.2.1      yamt 			gp->g_flags |= GF_GRFON;
    680  1.56.2.1      yamt 			rv = gp->g_mode(gp, (dev & GRFOVDEV) ?
    681  1.56.2.1      yamt 			    GM_GRFOVON : GM_GRFON, NULL, 0, 0);
    682  1.56.2.1      yamt 	}
    683  1.56.2.1      yamt 
    684  1.56.2.1      yamt 	return rv;
    685  1.56.2.1      yamt #endif
    686  1.56.2.1      yamt 	return 0;
    687  1.56.2.1      yamt }
    688  1.56.2.1      yamt 
    689  1.56.2.1      yamt int
    690  1.56.2.1      yamt grf_wsaogvideo(void *c, void *data)
    691  1.56.2.1      yamt {
    692  1.56.2.1      yamt 	struct grf_softc *gp;
    693  1.56.2.1      yamt 
    694  1.56.2.1      yamt 	gp = c;
    695  1.56.2.1      yamt 
    696  1.56.2.1      yamt 	if(gp->g_flags & GF_GRFON)
    697  1.56.2.1      yamt 		*(u_int *)data = WSDISPLAYIO_VIDEO_ON;
    698  1.56.2.1      yamt 	else
    699  1.56.2.1      yamt 		*(u_int *)data = WSDISPLAYIO_VIDEO_OFF;
    700  1.56.2.1      yamt 
    701  1.56.2.1      yamt 	return 0;
    702  1.56.2.1      yamt }
    703  1.56.2.1      yamt 
    704  1.56.2.1      yamt int
    705  1.56.2.1      yamt grf_wsaogtype(void *c, void *data)
    706  1.56.2.1      yamt {
    707  1.56.2.1      yamt 	struct grf_softc *gp;
    708  1.56.2.1      yamt 
    709  1.56.2.1      yamt 	gp = c;
    710  1.56.2.1      yamt 
    711  1.56.2.1      yamt 	*(u_int *)data = WSDISPLAY_TYPE_GRF;
    712  1.56.2.1      yamt 	return 0;
    713  1.56.2.1      yamt }
    714  1.56.2.1      yamt 
    715  1.56.2.1      yamt int
    716  1.56.2.1      yamt grf_wsaogmode(void *c, void *data)
    717  1.56.2.1      yamt {
    718  1.56.2.1      yamt 	struct grf_softc *gp;
    719  1.56.2.1      yamt 
    720  1.56.2.1      yamt 	gp = c;
    721  1.56.2.1      yamt 
    722  1.56.2.1      yamt 	*(u_int *)data = gp->g_wsmode;
    723  1.56.2.1      yamt 	return 0;
    724  1.56.2.1      yamt }
    725  1.56.2.1      yamt 
    726  1.56.2.1      yamt int
    727  1.56.2.1      yamt grf_wsaosmode(void *c, void *data)
    728  1.56.2.1      yamt {
    729  1.56.2.1      yamt 	/* XXX: should provide hw-dependent impl of this in grf_xxx driver? */
    730  1.56.2.1      yamt 	struct grf_softc *gp;
    731  1.56.2.1      yamt 
    732  1.56.2.1      yamt 	gp = c;
    733  1.56.2.1      yamt 
    734  1.56.2.1      yamt 	if ((*(int*) data) != gp->g_wsmode) {
    735  1.56.2.1      yamt 		gp->g_wsmode = (*(int*) data);
    736  1.56.2.1      yamt 		if ((*(int*) data) == WSDISPLAYIO_MODE_EMUL) {
    737  1.56.2.1      yamt 			//vcons_redraw_screen( active vcons screen );
    738  1.56.2.1      yamt 		}
    739  1.56.2.1      yamt 	}
    740  1.56.2.1      yamt 	return 0;
    741  1.56.2.1      yamt }
    742  1.56.2.1      yamt 
    743  1.56.2.1      yamt int
    744  1.56.2.1      yamt grf_wsaoginfo(void *c, void *data)
    745  1.56.2.1      yamt {
    746  1.56.2.1      yamt 	struct wsdisplay_fbinfo *fbinfo;
    747  1.56.2.1      yamt 	struct grf_softc *gp;
    748  1.56.2.1      yamt 	struct grfinfo *gi;
    749  1.56.2.1      yamt 
    750  1.56.2.1      yamt 	gp = c;
    751  1.56.2.1      yamt 
    752  1.56.2.1      yamt 	fbinfo = (struct wsdisplay_fbinfo *)data;
    753  1.56.2.1      yamt 	gi = &gp->g_display;
    754  1.56.2.1      yamt 
    755  1.56.2.1      yamt 	/*
    756  1.56.2.1      yamt 	 * TODO: better sanity checking, it is possible that
    757  1.56.2.1      yamt 	 * wsdisplay is initialized, but no screen is opened
    758  1.56.2.1      yamt 	 * (for example, device is not used).
    759  1.56.2.1      yamt 	 */
    760  1.56.2.1      yamt 
    761  1.56.2.1      yamt 	/*
    762  1.56.2.1      yamt 	 * We shold return truth about current mode here because
    763  1.56.2.1      yamt 	 * X11 wsfb driver denepds on this!
    764  1.56.2.1      yamt 	 */
    765  1.56.2.1      yamt 	fbinfo->height = gi->gd_fbheight;
    766  1.56.2.1      yamt 	fbinfo->width = gi->gd_fbwidth;
    767  1.56.2.1      yamt 	fbinfo->depth = gi->gd_planes;
    768  1.56.2.1      yamt 	fbinfo->cmsize = gi->gd_colors;
    769  1.56.2.1      yamt 
    770  1.56.2.1      yamt 	return 0;
    771  1.56.2.1      yamt }
    772  1.56.2.1      yamt 
    773  1.56.2.1      yamt #endif  /* NWSDISPLAY > 0 */
    774  1.56.2.1      yamt 
    775  1.56.2.1      yamt #ifdef DEBUG
    776  1.56.2.1      yamt void
    777  1.56.2.1      yamt grfdebug(struct grf_softc *gp, const char *fmt, ...)
    778  1.56.2.1      yamt {
    779  1.56.2.1      yamt 	static int ccol = 0, crow = 1;
    780  1.56.2.1      yamt 	volatile char *cp;
    781  1.56.2.1      yamt 	char buf[256];
    782  1.56.2.1      yamt 	va_list ap;
    783  1.56.2.1      yamt 	int ncols;
    784  1.56.2.1      yamt 	char *bp;
    785  1.56.2.1      yamt 
    786  1.56.2.1      yamt 	va_start(ap, fmt);
    787  1.56.2.1      yamt 	vsnprintf(buf, 256, fmt, ap);
    788  1.56.2.1      yamt 	va_end(ap);
    789  1.56.2.1      yamt 
    790  1.56.2.1      yamt 	cp = gp->g_fbkva;
    791  1.56.2.1      yamt 	ncols = gp->g_display.gd_fbwidth / 8;
    792  1.56.2.1      yamt 	cp += (crow * ncols + ccol) << 2;
    793  1.56.2.1      yamt 	for (bp = buf; *bp != '\0'; bp++) {
    794  1.56.2.1      yamt 		if (*bp == '\n') {
    795  1.56.2.1      yamt 			ccol = 0;
    796  1.56.2.1      yamt 			crow++;
    797  1.56.2.1      yamt 			continue;
    798  1.56.2.1      yamt 		}
    799  1.56.2.1      yamt 		*cp++ = *bp;
    800  1.56.2.1      yamt 		*cp = 0x0a;
    801  1.56.2.1      yamt 		cp += 3;
    802  1.56.2.1      yamt 		ccol++;
    803  1.56.2.1      yamt 	}
    804  1.56.2.1      yamt }
    805  1.56.2.1      yamt #endif  /* DEBUG */
    806  1.56.2.1      yamt 
    807       1.1        mw #endif	/* NGRF > 0 */
    808