Home | History | Annotate | Line # | Download | only in dev
grf.c revision 1.27
      1  1.27       is /*	$NetBSD: grf.c,v 1.27 1996/05/19 20:06:20 is Exp $	*/
      2  1.15      cgd 
      3   1.1       mw /*
      4   1.1       mw  * 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.1       mw  * 3. All advertising materials mentioning features or use of this software
     21   1.1       mw  *    must display the following acknowledgement:
     22   1.1       mw  *	This product includes software developed by the University of
     23   1.1       mw  *	California, Berkeley and its contributors.
     24   1.1       mw  * 4. Neither the name of the University nor the names of its contributors
     25   1.1       mw  *    may be used to endorse or promote products derived from this software
     26   1.1       mw  *    without specific prior written permission.
     27   1.1       mw  *
     28   1.1       mw  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     29   1.1       mw  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     30   1.1       mw  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     31   1.1       mw  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     32   1.1       mw  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     33   1.1       mw  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     34   1.1       mw  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     35   1.1       mw  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     36   1.1       mw  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     37   1.1       mw  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     38   1.1       mw  * SUCH DAMAGE.
     39   1.1       mw  *
     40   1.4       mw  * from: Utah $Hdr: grf.c 1.31 91/01/21$
     41   1.4       mw  *
     42   1.4       mw  *	@(#)grf.c	7.8 (Berkeley) 5/7/91
     43   1.1       mw  */
     44   1.1       mw 
     45   1.1       mw /*
     46  1.11   chopps  * Graphics display driver for the Amiga
     47   1.1       mw  * This is the hardware-independent portion of the driver.
     48  1.11   chopps  * Hardware access is through the grf_softc->g_mode routine.
     49   1.1       mw  */
     50   1.1       mw 
     51   1.8   chopps #include <sys/param.h>
     52   1.8   chopps #include <sys/proc.h>
     53   1.8   chopps #include <sys/ioctl.h>
     54  1.11   chopps #include <sys/device.h>
     55   1.8   chopps #include <sys/file.h>
     56   1.8   chopps #include <sys/malloc.h>
     57   1.9   chopps #include <sys/systm.h>
     58  1.11   chopps #include <sys/vnode.h>
     59  1.11   chopps #include <sys/mman.h>
     60   1.8   chopps #include <vm/vm.h>
     61   1.8   chopps #include <vm/vm_kern.h>
     62   1.8   chopps #include <vm/vm_page.h>
     63   1.8   chopps #include <vm/vm_pager.h>
     64  1.11   chopps #include <machine/cpu.h>
     65  1.27       is #include <machine/fbio.h>
     66  1.11   chopps #include <amiga/amiga/color.h>	/* DEBUG */
     67  1.11   chopps #include <amiga/amiga/device.h>
     68  1.11   chopps #include <amiga/dev/grfioctl.h>
     69  1.11   chopps #include <amiga/dev/grfvar.h>
     70  1.11   chopps #include <amiga/dev/itevar.h>
     71  1.26    veego #include <amiga/dev/viewioctl.h>
     72  1.26    veego 
     73  1.26    veego #include <sys/conf.h>
     74  1.26    veego #include <machine/conf.h>
     75   1.8   chopps 
     76  1.21   chopps #include "view.h"
     77  1.26    veego #include "grf.h"
     78  1.21   chopps 
     79  1.11   chopps #if NGRF > 0
     80   1.1       mw #include "ite.h"
     81   1.1       mw #if NITE == 0
     82   1.9   chopps #define	ite_on(u,f)
     83   1.9   chopps #define	ite_off(u,f)
     84   1.9   chopps #define ite_reinit(d)
     85   1.1       mw #endif
     86   1.1       mw 
     87  1.11   chopps int grfon __P((dev_t));
     88  1.11   chopps int grfoff __P((dev_t));
     89  1.11   chopps int grfsinfo __P((dev_t, struct grfdyninfo *));
     90  1.11   chopps #ifdef BANKEDDEVPAGER
     91  1.11   chopps int grfbanked_get __P((dev_t, off_t, int));
     92  1.11   chopps int grfbanked_cur __P((dev_t));
     93  1.11   chopps int grfbanked_set __P((dev_t, int));
     94   1.1       mw #endif
     95   1.1       mw 
     96  1.11   chopps void grfattach __P((struct device *, struct device *, void *));
     97  1.25  thorpej int grfmatch __P((struct device *, void *, void *));
     98  1.11   chopps int grfprint __P((void *, char *));
     99   1.1       mw /*
    100  1.11   chopps  * pointers to grf drivers device structs
    101   1.1       mw  */
    102  1.11   chopps struct grf_softc *grfsp[NGRF];
    103  1.11   chopps 
    104  1.25  thorpej struct cfattach grf_ca = {
    105  1.25  thorpej 	sizeof(struct device), grfmatch, grfattach
    106  1.25  thorpej };
    107  1.25  thorpej 
    108  1.25  thorpej struct cfdriver grf_cd = {
    109  1.25  thorpej 	NULL, "grf", DV_DULL, NULL, 0
    110  1.25  thorpej };
    111  1.11   chopps 
    112  1.11   chopps /*
    113  1.11   chopps  * only used in console init.
    114  1.11   chopps  */
    115  1.11   chopps static struct cfdata *cfdata;
    116  1.11   chopps 
    117  1.11   chopps /*
    118  1.11   chopps  * match if the unit of grf matches its perspective
    119  1.11   chopps  * low level board driver.
    120  1.11   chopps  */
    121  1.11   chopps int
    122  1.25  thorpej grfmatch(pdp, match, auxp)
    123  1.11   chopps 	struct device *pdp;
    124  1.25  thorpej 	void *match, *auxp;
    125   1.1       mw {
    126  1.25  thorpej 	struct cfdata *cfp = match;
    127  1.25  thorpej 
    128  1.11   chopps 	if (cfp->cf_unit != ((struct grf_softc *)pdp)->g_unit)
    129  1.11   chopps 		return(0);
    130  1.11   chopps 	cfdata = cfp;
    131  1.11   chopps 	return(1);
    132   1.1       mw }
    133   1.1       mw 
    134   1.1       mw /*
    135  1.11   chopps  * attach.. plug pointer in and print some info.
    136  1.11   chopps  * then try and attach an ite to us. note: dp is NULL
    137  1.11   chopps  * durring console init.
    138   1.1       mw  */
    139  1.11   chopps void
    140  1.11   chopps grfattach(pdp, dp, auxp)
    141  1.11   chopps 	struct device *pdp, *dp;
    142  1.11   chopps 	void *auxp;
    143   1.1       mw {
    144  1.11   chopps 	struct grf_softc *gp;
    145  1.11   chopps 	int maj;
    146  1.11   chopps 
    147  1.11   chopps 	gp = (struct grf_softc *)pdp;
    148  1.11   chopps 	grfsp[gp->g_unit] = (struct grf_softc *)pdp;
    149   1.1       mw 
    150  1.11   chopps 	/*
    151  1.11   chopps 	 * find our major device number
    152  1.11   chopps 	 */
    153  1.11   chopps 	for(maj = 0; maj < nchrdev; maj++)
    154  1.17   chopps 		if (cdevsw[maj].d_open == grfopen)
    155  1.11   chopps 			break;
    156  1.11   chopps 
    157  1.11   chopps 	gp->g_grfdev = makedev(maj, gp->g_unit);
    158  1.11   chopps 	if (dp != NULL) {
    159  1.14   chopps 		printf(": width %d height %d", gp->g_display.gd_dwidth,
    160  1.11   chopps 		    gp->g_display.gd_dheight);
    161  1.11   chopps 		if (gp->g_display.gd_colors == 2)
    162  1.12   chopps 			printf(" monochrome\n");
    163  1.11   chopps 		else
    164  1.12   chopps 			printf(" colors %d\n", gp->g_display.gd_colors);
    165  1.11   chopps 	}
    166  1.11   chopps 
    167  1.11   chopps 	/*
    168  1.11   chopps 	 * try and attach an ite
    169  1.11   chopps 	 */
    170  1.11   chopps 	amiga_config_found(cfdata, dp, gp, grfprint);
    171   1.1       mw }
    172   1.1       mw 
    173  1.11   chopps int
    174  1.11   chopps grfprint(auxp, pnp)
    175  1.11   chopps 	void *auxp;
    176  1.11   chopps 	char *pnp;
    177  1.11   chopps {
    178  1.11   chopps 	if (pnp)
    179  1.13   chopps 		printf("ite at %s", pnp);
    180  1.11   chopps 	return(UNCONF);
    181   1.1       mw }
    182   1.1       mw 
    183   1.1       mw /*ARGSUSED*/
    184  1.11   chopps int
    185  1.11   chopps grfopen(dev, flags, devtype, p)
    186   1.1       mw 	dev_t dev;
    187  1.11   chopps 	int flags, devtype;
    188  1.11   chopps 	struct proc *p;
    189   1.1       mw {
    190  1.11   chopps 	struct grf_softc *gp;
    191  1.11   chopps 
    192  1.24      jtc 	if (GRFUNIT(dev) >= NGRF || (gp = grfsp[GRFUNIT(dev)]) == NULL)
    193  1.11   chopps 		return(ENXIO);
    194  1.11   chopps 
    195  1.11   chopps 	if ((gp->g_flags & GF_ALIVE) == 0)
    196   1.1       mw 		return(ENXIO);
    197  1.11   chopps 
    198   1.1       mw 	if ((gp->g_flags & (GF_OPEN|GF_EXCLUDE)) == (GF_OPEN|GF_EXCLUDE))
    199   1.1       mw 		return(EBUSY);
    200  1.11   chopps 
    201  1.11   chopps 	return(0);
    202   1.1       mw }
    203   1.1       mw 
    204   1.1       mw /*ARGSUSED*/
    205  1.11   chopps int
    206  1.26    veego grfclose(dev, flags, mode, p)
    207   1.1       mw 	dev_t dev;
    208  1.11   chopps 	int flags;
    209  1.26    veego 	int mode;
    210  1.26    veego 	struct proc *p;
    211   1.1       mw {
    212  1.11   chopps 	struct grf_softc *gp;
    213   1.1       mw 
    214  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    215  1.11   chopps 	(void)grfoff(dev);
    216   1.1       mw 	gp->g_flags &= GF_ALIVE;
    217   1.1       mw 	return(0);
    218   1.1       mw }
    219   1.1       mw 
    220   1.1       mw /*ARGSUSED*/
    221  1.11   chopps int
    222   1.1       mw grfioctl(dev, cmd, data, flag, p)
    223   1.1       mw 	dev_t dev;
    224  1.16   chopps 	u_long cmd;
    225   1.1       mw 	caddr_t data;
    226  1.16   chopps 	int flag;
    227   1.1       mw 	struct proc *p;
    228   1.1       mw {
    229  1.11   chopps 	struct grf_softc *gp;
    230   1.1       mw 	int error;
    231   1.1       mw 
    232  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    233   1.1       mw 	error = 0;
    234  1.11   chopps 
    235   1.1       mw 	switch (cmd) {
    236   1.5       mw 	case OGRFIOCGINFO:
    237   1.5       mw 	        /* argl.. no bank-member.. */
    238   1.5       mw 	  	bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo)-4);
    239   1.5       mw 		break;
    240   1.1       mw 	case GRFIOCGINFO:
    241   1.1       mw 		bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo));
    242   1.1       mw 		break;
    243   1.1       mw 	case GRFIOCON:
    244   1.1       mw 		error = grfon(dev);
    245   1.1       mw 		break;
    246   1.1       mw 	case GRFIOCOFF:
    247   1.1       mw 		error = grfoff(dev);
    248   1.1       mw 		break;
    249   1.1       mw 	case GRFIOCSINFO:
    250  1.11   chopps 		error = grfsinfo(dev, (struct grfdyninfo *) data);
    251   1.1       mw 		break;
    252   1.3       mw 	case GRFGETVMODE:
    253  1.26    veego 		return(gp->g_mode(gp, GM_GRFGETVMODE, data, 0, 0));
    254   1.3       mw 	case GRFSETVMODE:
    255  1.26    veego 		error = gp->g_mode(gp, GM_GRFSETVMODE, data, 0, 0);
    256  1.18   chopps 		if (error == 0 && gp->g_itedev && !(gp->g_flags & GF_GRFON))
    257  1.11   chopps 			ite_reinit(gp->g_itedev);
    258   1.3       mw 		break;
    259   1.3       mw 	case GRFGETNUMVM:
    260  1.26    veego 		return(gp->g_mode(gp, GM_GRFGETNUMVM, data, 0, 0));
    261  1.11   chopps 	/*
    262  1.11   chopps 	 * these are all hardware dependant, and have to be resolved
    263  1.11   chopps 	 * in the respective driver.
    264  1.11   chopps 	 */
    265   1.5       mw 	case GRFIOCPUTCMAP:
    266   1.5       mw 	case GRFIOCGETCMAP:
    267   1.5       mw 	case GRFIOCSSPRITEPOS:
    268   1.5       mw 	case GRFIOCGSPRITEPOS:
    269   1.5       mw 	case GRFIOCSSPRITEINF:
    270   1.5       mw 	case GRFIOCGSPRITEINF:
    271   1.5       mw 	case GRFIOCGSPRITEMAX:
    272  1.18   chopps 	case GRFIOCBITBLT:
    273  1.20   chopps     	case GRFIOCSETMON:
    274  1.23   chopps 	case GRFIOCBLANK:	/* blank ioctl, IOCON/OFF will turn ite on */
    275  1.17   chopps 	case GRFTOGGLE: /* Toggles between Cirrus boards and native ECS on
    276  1.17   chopps                      Amiga. 15/11/94 ill */
    277  1.22   chopps 		/*
    278  1.22   chopps 		 * We need the minor dev number to get the overlay/image
    279  1.22   chopps 		 * information for grf_ul.
    280  1.22   chopps 		 */
    281  1.26    veego 		return(gp->g_mode(gp, GM_GRFIOCTL, data, cmd, dev));
    282  1.27       is 
    283  1.27       is 	case FBIOSVIDEO:
    284  1.27       is 		return(gp->g_mode(gp, GM_GRFIOCTL, data, GRFIOCBLANK, dev));
    285  1.27       is 
    286   1.1       mw 	default:
    287  1.21   chopps #if NVIEW > 0
    288  1.11   chopps 		/*
    289  1.11   chopps 		 * check to see whether it's a command recognized by the
    290  1.11   chopps 		 * view code if the unit is 0
    291  1.11   chopps 		 * XXX
    292  1.11   chopps 		 */
    293   1.5       mw 		if (GRFUNIT(dev) == 0)
    294  1.11   chopps 			return(viewioctl(dev, cmd, data, flag, p));
    295  1.21   chopps #endif
    296   1.1       mw 		error = EINVAL;
    297   1.1       mw 		break;
    298   1.1       mw 
    299   1.1       mw 	}
    300   1.1       mw 	return(error);
    301   1.1       mw }
    302   1.1       mw 
    303   1.1       mw /*ARGSUSED*/
    304  1.11   chopps int
    305  1.26    veego grfselect(dev, rw, p)
    306   1.1       mw 	dev_t dev;
    307  1.11   chopps 	int rw;
    308  1.26    veego 	struct proc *p;
    309   1.1       mw {
    310   1.1       mw 	if (rw == FREAD)
    311   1.1       mw 		return(0);
    312   1.1       mw 	return(1);
    313   1.1       mw }
    314   1.1       mw 
    315  1.11   chopps /*
    316  1.11   chopps  * map the contents of a graphics display card into process'
    317  1.11   chopps  * memory space.
    318  1.11   chopps  */
    319  1.11   chopps int
    320  1.19  mycroft grfmmap(dev, off, prot)
    321  1.11   chopps 	dev_t dev;
    322  1.11   chopps 	int off, prot;
    323   1.1       mw {
    324  1.11   chopps 	struct grf_softc *gp;
    325  1.11   chopps 	struct grfinfo *gi;
    326  1.11   chopps 
    327  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    328  1.11   chopps 	gi = &gp->g_display;
    329   1.1       mw 
    330  1.11   chopps 	/*
    331  1.11   chopps 	 * control registers
    332  1.11   chopps 	 */
    333  1.11   chopps 	if (off >= 0 && off < gi->gd_regsize)
    334  1.11   chopps 		return(((u_int)gi->gd_regaddr + off) >> PGSHIFT);
    335   1.1       mw 
    336  1.11   chopps 	/*
    337  1.11   chopps 	 * frame buffer
    338  1.11   chopps 	 */
    339  1.11   chopps 	if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
    340  1.11   chopps 		off -= gi->gd_regsize;
    341  1.11   chopps #ifdef BANKEDDEVPAGER
    342  1.11   chopps 		if (gi->gd_bank_size)
    343  1.11   chopps 			off %= gi->gd_bank_size;
    344   1.1       mw #endif
    345  1.11   chopps 		return(((u_int)gi->gd_fbaddr + off) >> PGSHIFT);
    346   1.1       mw 	}
    347  1.11   chopps 	/* bogus */
    348  1.11   chopps 	return(-1);
    349   1.1       mw }
    350   1.1       mw 
    351  1.11   chopps int
    352  1.11   chopps grfon(dev)
    353   1.1       mw 	dev_t dev;
    354   1.1       mw {
    355  1.11   chopps 	struct grf_softc *gp;
    356   1.1       mw 
    357  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    358   1.1       mw 
    359   1.3       mw 	if (gp->g_flags & GF_GRFON)
    360  1.11   chopps 		return(0);
    361  1.11   chopps 
    362   1.3       mw 	gp->g_flags |= GF_GRFON;
    363  1.11   chopps 	if (gp->g_itedev != NODEV)
    364  1.11   chopps 		ite_off(gp->g_itedev, 3);
    365   1.3       mw 
    366  1.26    veego 	return(gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVON : GM_GRFON,
    367  1.26    veego 							NULL, 0, 0));
    368   1.1       mw }
    369   1.1       mw 
    370  1.11   chopps int
    371   1.1       mw grfoff(dev)
    372   1.1       mw 	dev_t dev;
    373   1.1       mw {
    374  1.11   chopps 	struct grf_softc *gp;
    375   1.1       mw 	int error;
    376   1.3       mw 
    377  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    378  1.11   chopps 
    379  1.11   chopps 	if ((gp->g_flags & GF_GRFON) == 0)
    380  1.11   chopps 		return(0);
    381  1.11   chopps 
    382   1.3       mw 	gp->g_flags &= ~GF_GRFON;
    383  1.26    veego 	error = gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF,
    384  1.26    veego 							NULL, 0, 0);
    385  1.11   chopps 
    386  1.11   chopps 	/*
    387  1.11   chopps 	 * Closely tied together no X's
    388  1.11   chopps 	 */
    389  1.11   chopps 	if (gp->g_itedev != NODEV)
    390  1.11   chopps 		ite_on(gp->g_itedev, 2);
    391   1.1       mw 
    392   1.1       mw 	return(error);
    393   1.1       mw }
    394   1.1       mw 
    395  1.11   chopps int
    396   1.1       mw grfsinfo(dev, dyninfo)
    397   1.1       mw 	dev_t dev;
    398   1.1       mw 	struct grfdyninfo *dyninfo;
    399   1.1       mw {
    400  1.11   chopps 	struct grf_softc *gp;
    401   1.1       mw 	int error;
    402   1.1       mw 
    403  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    404  1.26    veego 	error = gp->g_mode(gp, GM_GRFCONFIG, dyninfo, 0, 0);
    405   1.1       mw 
    406  1.11   chopps 	/*
    407  1.11   chopps 	 * Closely tied together no X's
    408  1.11   chopps 	 */
    409  1.11   chopps 	if (gp->g_itedev != NODEV)
    410  1.11   chopps 		ite_reinit(gp->g_itedev);
    411   1.1       mw 	return(error);
    412   1.1       mw }
    413   1.1       mw 
    414   1.5       mw #ifdef BANKEDDEVPAGER
    415   1.5       mw 
    416   1.5       mw int
    417   1.5       mw grfbanked_get (dev, off, prot)
    418   1.5       mw      dev_t dev;
    419   1.5       mw      off_t off;
    420   1.5       mw      int   prot;
    421   1.5       mw {
    422  1.11   chopps 	struct grf_softc *gp;
    423  1.11   chopps 	struct grfinfo *gi;
    424  1.11   chopps 	int error, bank;
    425  1.11   chopps 
    426  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    427  1.11   chopps 	gi = &gp->g_display;
    428  1.11   chopps 
    429  1.11   chopps 	off -= gi->gd_regsize;
    430  1.11   chopps 	if (off < 0 || off >= gi->gd_fbsize)
    431  1.11   chopps 		return -1;
    432   1.5       mw 
    433  1.11   chopps 	error = gp->g_mode(gp, GM_GRFGETBANK, &bank, off, prot);
    434  1.11   chopps 	return error ? -1 : bank;
    435   1.5       mw }
    436   1.5       mw 
    437   1.5       mw int
    438   1.5       mw grfbanked_cur (dev)
    439  1.11   chopps 	dev_t dev;
    440   1.5       mw {
    441  1.11   chopps 	struct grf_softc *gp;
    442  1.11   chopps 	int error, bank;
    443   1.5       mw 
    444  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    445  1.11   chopps 
    446  1.26    veego 	error = gp->g_mode(gp, GM_GRFGETCURBANK, &bank, 0, 0);
    447  1.11   chopps 	return(error ? -1 : bank);
    448   1.5       mw }
    449   1.5       mw 
    450   1.5       mw int
    451   1.5       mw grfbanked_set (dev, bank)
    452  1.11   chopps 	dev_t dev;
    453  1.11   chopps 	int bank;
    454   1.5       mw {
    455  1.11   chopps 	struct grf_softc *gp;
    456   1.5       mw 
    457  1.11   chopps 	gp = grfsp[GRFUNIT(dev)];
    458  1.26    veego 	return(gp->g_mode(gp, GM_GRFSETBANK, &bank, 0, 0) ? -1 : 0);
    459   1.5       mw }
    460   1.5       mw 
    461   1.5       mw #endif /* BANKEDDEVPAGER */
    462   1.1       mw #endif	/* NGRF > 0 */
    463