Home | History | Annotate | Line # | Download | only in dev
grf.c revision 1.36
      1  1.36       mrg /*	$NetBSD: grf.c,v 1.36 2000/06/26 14:20:30 mrg 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.30    mhitch #include <sys/poll.h>
     61   1.8    chopps #include <vm/vm.h>
     62  1.36       mrg #include <uvm/uvm_extern.h>
     63  1.11    chopps #include <machine/cpu.h>
     64  1.27        is #include <machine/fbio.h>
     65  1.11    chopps #include <amiga/amiga/color.h>	/* DEBUG */
     66  1.11    chopps #include <amiga/amiga/device.h>
     67  1.11    chopps #include <amiga/dev/grfioctl.h>
     68  1.11    chopps #include <amiga/dev/grfvar.h>
     69  1.11    chopps #include <amiga/dev/itevar.h>
     70  1.26     veego #include <amiga/dev/viewioctl.h>
     71  1.26     veego 
     72  1.26     veego #include <sys/conf.h>
     73  1.26     veego #include <machine/conf.h>
     74   1.8    chopps 
     75  1.21    chopps #include "view.h"
     76  1.26     veego #include "grf.h"
     77  1.21    chopps 
     78  1.11    chopps #if NGRF > 0
     79   1.1        mw #include "ite.h"
     80   1.1        mw #if NITE == 0
     81   1.9    chopps #define	ite_on(u,f)
     82   1.9    chopps #define	ite_off(u,f)
     83   1.9    chopps #define ite_reinit(d)
     84   1.1        mw #endif
     85   1.1        mw 
     86  1.11    chopps int grfon __P((dev_t));
     87  1.11    chopps int grfoff __P((dev_t));
     88  1.11    chopps int grfsinfo __P((dev_t, struct grfdyninfo *));
     89  1.11    chopps #ifdef BANKEDDEVPAGER
     90  1.11    chopps int grfbanked_get __P((dev_t, off_t, int));
     91  1.11    chopps int grfbanked_cur __P((dev_t));
     92  1.11    chopps int grfbanked_set __P((dev_t, int));
     93   1.1        mw #endif
     94   1.1        mw 
     95  1.11    chopps void grfattach __P((struct device *, struct device *, void *));
     96  1.32     veego int grfmatch __P((struct device *, struct cfdata *, void *));
     97  1.28       cgd int grfprint __P((void *, const char *));
     98   1.1        mw /*
     99  1.11    chopps  * pointers to grf drivers device structs
    100   1.1        mw  */
    101  1.11    chopps struct grf_softc *grfsp[NGRF];
    102  1.11    chopps 
    103  1.25   thorpej struct cfattach grf_ca = {
    104  1.25   thorpej 	sizeof(struct device), grfmatch, grfattach
    105  1.25   thorpej };
    106  1.11    chopps 
    107  1.11    chopps /*
    108  1.11    chopps  * only used in console init.
    109  1.11    chopps  */
    110  1.11    chopps static struct cfdata *cfdata;
    111  1.11    chopps 
    112  1.11    chopps /*
    113  1.11    chopps  * match if the unit of grf matches its perspective
    114  1.11    chopps  * low level board driver.
    115  1.11    chopps  */
    116  1.11    chopps int
    117  1.32     veego grfmatch(pdp, cfp, auxp)
    118  1.11    chopps 	struct device *pdp;
    119  1.32     veego 	struct cfdata *cfp;
    120  1.32     veego 	void *auxp;
    121   1.1        mw {
    122  1.25   thorpej 
    123  1.11    chopps 	if (cfp->cf_unit != ((struct grf_softc *)pdp)->g_unit)
    124  1.11    chopps 		return(0);
    125  1.11    chopps 	cfdata = cfp;
    126  1.11    chopps 	return(1);
    127   1.1        mw }
    128   1.1        mw 
    129   1.1        mw /*
    130  1.11    chopps  * attach.. plug pointer in and print some info.
    131  1.11    chopps  * then try and attach an ite to us. note: dp is NULL
    132  1.11    chopps  * durring console init.
    133   1.1        mw  */
    134  1.11    chopps void
    135  1.11    chopps grfattach(pdp, dp, auxp)
    136  1.11    chopps 	struct device *pdp, *dp;
    137  1.11    chopps 	void *auxp;
    138   1.1        mw {
    139  1.11    chopps 	struct grf_softc *gp;
    140  1.11    chopps 	int maj;
    141  1.11    chopps 
    142  1.11    chopps 	gp = (struct grf_softc *)pdp;
    143  1.11    chopps 	grfsp[gp->g_unit] = (struct grf_softc *)pdp;
    144   1.1        mw 
    145  1.11    chopps 	/*
    146  1.11    chopps 	 * find our major device number
    147  1.11    chopps 	 */
    148  1.11    chopps 	for(maj = 0; maj < nchrdev; maj++)
    149  1.17    chopps 		if (cdevsw[maj].d_open == grfopen)
    150  1.11    chopps 			break;
    151  1.11    chopps 
    152  1.11    chopps 	gp->g_grfdev = makedev(maj, gp->g_unit);
    153  1.11    chopps 	if (dp != NULL) {
    154  1.31  christos 		printf(": width %d height %d", gp->g_display.gd_dwidth,
    155  1.11    chopps 		    gp->g_display.gd_dheight);
    156  1.11    chopps 		if (gp->g_display.gd_colors == 2)
    157  1.31  christos 			printf(" monochrome\n");
    158  1.11    chopps 		else
    159  1.31  christos 			printf(" colors %d\n", gp->g_display.gd_colors);
    160  1.11    chopps 	}
    161  1.11    chopps 
    162  1.11    chopps 	/*
    163  1.11    chopps 	 * try and attach an ite
    164  1.11    chopps 	 */
    165  1.11    chopps 	amiga_config_found(cfdata, dp, gp, grfprint);
    166   1.1        mw }
    167   1.1        mw 
    168  1.11    chopps int
    169  1.11    chopps grfprint(auxp, pnp)
    170  1.11    chopps 	void *auxp;
    171  1.28       cgd 	const char *pnp;
    172  1.11    chopps {
    173  1.11    chopps 	if (pnp)
    174  1.31  christos 		printf("ite at %s", pnp);
    175  1.11    chopps 	return(UNCONF);
    176   1.1        mw }
    177   1.1        mw 
    178   1.1        mw /*ARGSUSED*/
    179  1.11    chopps int
    180  1.11    chopps grfopen(dev, flags, devtype, p)
    181   1.1        mw 	dev_t dev;
    182  1.11    chopps 	int flags, devtype;
    183  1.11    chopps 	struct proc *p;
    184   1.1        mw {
    185  1.11    chopps 	struct grf_softc *gp;
    186  1.11    chopps 
    187  1.24       jtc 	if (GRFUNIT(dev) >= NGRF || (gp = grfsp[GRFUNIT(dev)]) == NULL)
    188  1.11    chopps 		return(ENXIO);
    189  1.11    chopps 
    190  1.11    chopps 	if ((gp->g_flags & GF_ALIVE) == 0)
    191   1.1        mw 		return(ENXIO);
    192  1.11    chopps 
    193   1.1        mw 	if ((gp->g_flags & (GF_OPEN|GF_EXCLUDE)) == (GF_OPEN|GF_EXCLUDE))
    194   1.1        mw 		return(EBUSY);
    195  1.11    chopps 
    196  1.11    chopps 	return(0);
    197   1.1        mw }
    198   1.1        mw 
    199   1.1        mw /*ARGSUSED*/
    200  1.11    chopps int
    201  1.26     veego grfclose(dev, flags, mode, p)
    202   1.1        mw 	dev_t dev;
    203  1.11    chopps 	int flags;
    204  1.26     veego 	int mode;
    205  1.26     veego 	struct proc *p;
    206   1.1        mw {
    207  1.11    chopps 	struct grf_softc *gp;
    208   1.1        mw 
    209  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    210  1.11    chopps 	(void)grfoff(dev);
    211   1.1        mw 	gp->g_flags &= GF_ALIVE;
    212   1.1        mw 	return(0);
    213   1.1        mw }
    214   1.1        mw 
    215   1.1        mw /*ARGSUSED*/
    216  1.11    chopps int
    217   1.1        mw grfioctl(dev, cmd, data, flag, p)
    218   1.1        mw 	dev_t dev;
    219  1.16    chopps 	u_long cmd;
    220   1.1        mw 	caddr_t data;
    221  1.16    chopps 	int flag;
    222   1.1        mw 	struct proc *p;
    223   1.1        mw {
    224  1.11    chopps 	struct grf_softc *gp;
    225   1.1        mw 	int error;
    226   1.1        mw 
    227  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    228   1.1        mw 	error = 0;
    229  1.11    chopps 
    230   1.1        mw 	switch (cmd) {
    231   1.5        mw 	case OGRFIOCGINFO:
    232   1.5        mw 	        /* argl.. no bank-member.. */
    233   1.5        mw 	  	bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo)-4);
    234   1.5        mw 		break;
    235   1.1        mw 	case GRFIOCGINFO:
    236   1.1        mw 		bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo));
    237   1.1        mw 		break;
    238   1.1        mw 	case GRFIOCON:
    239   1.1        mw 		error = grfon(dev);
    240   1.1        mw 		break;
    241   1.1        mw 	case GRFIOCOFF:
    242   1.1        mw 		error = grfoff(dev);
    243   1.1        mw 		break;
    244   1.1        mw 	case GRFIOCSINFO:
    245  1.11    chopps 		error = grfsinfo(dev, (struct grfdyninfo *) data);
    246   1.1        mw 		break;
    247   1.3        mw 	case GRFGETVMODE:
    248  1.26     veego 		return(gp->g_mode(gp, GM_GRFGETVMODE, data, 0, 0));
    249   1.3        mw 	case GRFSETVMODE:
    250  1.26     veego 		error = gp->g_mode(gp, GM_GRFSETVMODE, data, 0, 0);
    251  1.18    chopps 		if (error == 0 && gp->g_itedev && !(gp->g_flags & GF_GRFON))
    252  1.11    chopps 			ite_reinit(gp->g_itedev);
    253   1.3        mw 		break;
    254   1.3        mw 	case GRFGETNUMVM:
    255  1.26     veego 		return(gp->g_mode(gp, GM_GRFGETNUMVM, data, 0, 0));
    256  1.11    chopps 	/*
    257  1.11    chopps 	 * these are all hardware dependant, and have to be resolved
    258  1.11    chopps 	 * in the respective driver.
    259  1.11    chopps 	 */
    260   1.5        mw 	case GRFIOCPUTCMAP:
    261   1.5        mw 	case GRFIOCGETCMAP:
    262   1.5        mw 	case GRFIOCSSPRITEPOS:
    263   1.5        mw 	case GRFIOCGSPRITEPOS:
    264   1.5        mw 	case GRFIOCSSPRITEINF:
    265   1.5        mw 	case GRFIOCGSPRITEINF:
    266   1.5        mw 	case GRFIOCGSPRITEMAX:
    267  1.18    chopps 	case GRFIOCBITBLT:
    268  1.20    chopps     	case GRFIOCSETMON:
    269  1.17    chopps 	case GRFTOGGLE: /* Toggles between Cirrus boards and native ECS on
    270  1.17    chopps                      Amiga. 15/11/94 ill */
    271  1.22    chopps 		/*
    272  1.22    chopps 		 * We need the minor dev number to get the overlay/image
    273  1.22    chopps 		 * information for grf_ul.
    274  1.22    chopps 		 */
    275  1.26     veego 		return(gp->g_mode(gp, GM_GRFIOCTL, data, cmd, dev));
    276  1.27        is 
    277  1.34        is 	case GRFIOCBLANK:	/* blank ioctl, IOCON/OFF will turn ite on */
    278  1.27        is 	case FBIOSVIDEO:
    279  1.34        is 		error = gp->g_mode(gp, GM_GRFIOCTL, data, GRFIOCBLANK, dev);
    280  1.34        is 		if (!error)
    281  1.34        is 			gp->g_blank = *(int *)data;
    282  1.34        is 		return (error);
    283  1.34        is 
    284  1.34        is 	case FBIOGVIDEO:
    285  1.34        is 		*(int *)data = gp->g_blank;
    286  1.34        is 		return (0);
    287  1.27        is 
    288   1.1        mw 	default:
    289  1.21    chopps #if NVIEW > 0
    290  1.11    chopps 		/*
    291  1.11    chopps 		 * check to see whether it's a command recognized by the
    292  1.11    chopps 		 * view code if the unit is 0
    293  1.11    chopps 		 * XXX
    294  1.11    chopps 		 */
    295   1.5        mw 		if (GRFUNIT(dev) == 0)
    296  1.11    chopps 			return(viewioctl(dev, cmd, data, flag, p));
    297  1.21    chopps #endif
    298   1.1        mw 		error = EINVAL;
    299   1.1        mw 		break;
    300   1.1        mw 
    301   1.1        mw 	}
    302   1.1        mw 	return(error);
    303   1.1        mw }
    304   1.1        mw 
    305   1.1        mw /*ARGSUSED*/
    306  1.11    chopps int
    307  1.30    mhitch grfpoll(dev, events, p)
    308   1.1        mw 	dev_t dev;
    309  1.30    mhitch 	int events;
    310  1.26     veego 	struct proc *p;
    311   1.1        mw {
    312  1.30    mhitch 	return(events & (POLLOUT | POLLWRNORM));
    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.35    simonb paddr_t
    320  1.19   mycroft grfmmap(dev, off, prot)
    321  1.11    chopps 	dev_t dev;
    322  1.35    simonb 	off_t off;
    323  1.35    simonb 	int prot;
    324   1.1        mw {
    325  1.11    chopps 	struct grf_softc *gp;
    326  1.11    chopps 	struct grfinfo *gi;
    327  1.11    chopps 
    328  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    329  1.11    chopps 	gi = &gp->g_display;
    330   1.1        mw 
    331  1.11    chopps 	/*
    332  1.11    chopps 	 * control registers
    333  1.11    chopps 	 */
    334  1.11    chopps 	if (off >= 0 && off < gi->gd_regsize)
    335  1.35    simonb 		return(((paddr_t)gi->gd_regaddr + off) >> PGSHIFT);
    336   1.1        mw 
    337  1.11    chopps 	/*
    338  1.11    chopps 	 * frame buffer
    339  1.11    chopps 	 */
    340  1.11    chopps 	if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
    341  1.11    chopps 		off -= gi->gd_regsize;
    342  1.11    chopps #ifdef BANKEDDEVPAGER
    343  1.11    chopps 		if (gi->gd_bank_size)
    344  1.11    chopps 			off %= gi->gd_bank_size;
    345   1.1        mw #endif
    346  1.35    simonb 		return(((paddr_t)gi->gd_fbaddr + off) >> PGSHIFT);
    347   1.1        mw 	}
    348  1.11    chopps 	/* bogus */
    349  1.11    chopps 	return(-1);
    350   1.1        mw }
    351   1.1        mw 
    352  1.11    chopps int
    353  1.11    chopps grfon(dev)
    354   1.1        mw 	dev_t dev;
    355   1.1        mw {
    356  1.11    chopps 	struct grf_softc *gp;
    357   1.1        mw 
    358  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    359   1.1        mw 
    360   1.3        mw 	if (gp->g_flags & GF_GRFON)
    361  1.11    chopps 		return(0);
    362  1.11    chopps 
    363   1.3        mw 	gp->g_flags |= GF_GRFON;
    364  1.11    chopps 	if (gp->g_itedev != NODEV)
    365  1.11    chopps 		ite_off(gp->g_itedev, 3);
    366   1.3        mw 
    367  1.26     veego 	return(gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVON : GM_GRFON,
    368  1.26     veego 							NULL, 0, 0));
    369   1.1        mw }
    370   1.1        mw 
    371  1.11    chopps int
    372   1.1        mw grfoff(dev)
    373   1.1        mw 	dev_t dev;
    374   1.1        mw {
    375  1.11    chopps 	struct grf_softc *gp;
    376   1.1        mw 	int error;
    377   1.3        mw 
    378  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    379  1.11    chopps 
    380  1.11    chopps 	if ((gp->g_flags & GF_GRFON) == 0)
    381  1.11    chopps 		return(0);
    382  1.11    chopps 
    383   1.3        mw 	gp->g_flags &= ~GF_GRFON;
    384  1.26     veego 	error = gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF,
    385  1.26     veego 							NULL, 0, 0);
    386  1.11    chopps 
    387  1.11    chopps 	/*
    388  1.11    chopps 	 * Closely tied together no X's
    389  1.11    chopps 	 */
    390  1.11    chopps 	if (gp->g_itedev != NODEV)
    391  1.11    chopps 		ite_on(gp->g_itedev, 2);
    392   1.1        mw 
    393   1.1        mw 	return(error);
    394   1.1        mw }
    395   1.1        mw 
    396  1.11    chopps int
    397   1.1        mw grfsinfo(dev, dyninfo)
    398   1.1        mw 	dev_t dev;
    399   1.1        mw 	struct grfdyninfo *dyninfo;
    400   1.1        mw {
    401  1.11    chopps 	struct grf_softc *gp;
    402   1.1        mw 	int error;
    403   1.1        mw 
    404  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    405  1.26     veego 	error = gp->g_mode(gp, GM_GRFCONFIG, dyninfo, 0, 0);
    406   1.1        mw 
    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_reinit(gp->g_itedev);
    412   1.1        mw 	return(error);
    413   1.1        mw }
    414   1.1        mw 
    415   1.5        mw #ifdef BANKEDDEVPAGER
    416   1.5        mw 
    417   1.5        mw int
    418   1.5        mw grfbanked_get (dev, off, prot)
    419   1.5        mw      dev_t dev;
    420   1.5        mw      off_t off;
    421   1.5        mw      int   prot;
    422   1.5        mw {
    423  1.11    chopps 	struct grf_softc *gp;
    424  1.11    chopps 	struct grfinfo *gi;
    425  1.11    chopps 	int error, bank;
    426  1.11    chopps 
    427  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    428  1.11    chopps 	gi = &gp->g_display;
    429  1.11    chopps 
    430  1.11    chopps 	off -= gi->gd_regsize;
    431  1.11    chopps 	if (off < 0 || off >= gi->gd_fbsize)
    432  1.11    chopps 		return -1;
    433   1.5        mw 
    434  1.11    chopps 	error = gp->g_mode(gp, GM_GRFGETBANK, &bank, off, prot);
    435  1.11    chopps 	return error ? -1 : bank;
    436   1.5        mw }
    437   1.5        mw 
    438   1.5        mw int
    439   1.5        mw grfbanked_cur (dev)
    440  1.11    chopps 	dev_t dev;
    441   1.5        mw {
    442  1.11    chopps 	struct grf_softc *gp;
    443  1.11    chopps 	int error, bank;
    444   1.5        mw 
    445  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    446  1.11    chopps 
    447  1.26     veego 	error = gp->g_mode(gp, GM_GRFGETCURBANK, &bank, 0, 0);
    448  1.11    chopps 	return(error ? -1 : bank);
    449   1.5        mw }
    450   1.5        mw 
    451   1.5        mw int
    452   1.5        mw grfbanked_set (dev, bank)
    453  1.11    chopps 	dev_t dev;
    454  1.11    chopps 	int bank;
    455   1.5        mw {
    456  1.11    chopps 	struct grf_softc *gp;
    457   1.5        mw 
    458  1.11    chopps 	gp = grfsp[GRFUNIT(dev)];
    459  1.26     veego 	return(gp->g_mode(gp, GM_GRFSETBANK, &bank, 0, 0) ? -1 : 0);
    460   1.5        mw }
    461   1.5        mw 
    462   1.5        mw #endif /* BANKEDDEVPAGER */
    463   1.1        mw #endif	/* NGRF > 0 */
    464