1996-08-28 01:53:46 +04:00
|
|
|
/* $NetBSD: grf.c,v 1.28 1996/08/27 21:54:43 cgd Exp $ */
|
1994-10-26 05:01:24 +03:00
|
|
|
|
1993-07-05 23:19:43 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1988 University of Utah.
|
|
|
|
* Copyright (c) 1990 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* the Systems Programming Group of the University of Utah Computer
|
|
|
|
* Science Department.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
1993-10-31 02:40:53 +03:00
|
|
|
* from: Utah $Hdr: grf.c 1.31 91/01/21$
|
|
|
|
*
|
|
|
|
* @(#)grf.c 7.8 (Berkeley) 5/7/91
|
1993-07-05 23:19:43 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1994-05-08 09:52:54 +04:00
|
|
|
* Graphics display driver for the Amiga
|
1993-07-05 23:19:43 +04:00
|
|
|
* This is the hardware-independent portion of the driver.
|
1994-05-08 09:52:54 +04:00
|
|
|
* Hardware access is through the grf_softc->g_mode routine.
|
1993-07-05 23:19:43 +04:00
|
|
|
*/
|
|
|
|
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/ioctl.h>
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <sys/device.h>
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/malloc.h>
|
1994-02-17 12:10:32 +03:00
|
|
|
#include <sys/systm.h>
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <sys/vnode.h>
|
|
|
|
#include <sys/mman.h>
|
1994-02-14 00:10:20 +03:00
|
|
|
#include <vm/vm.h>
|
|
|
|
#include <vm/vm_kern.h>
|
|
|
|
#include <vm/vm_page.h>
|
|
|
|
#include <vm/vm_pager.h>
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <machine/cpu.h>
|
1996-05-20 00:06:02 +04:00
|
|
|
#include <machine/fbio.h>
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <amiga/amiga/color.h> /* DEBUG */
|
|
|
|
#include <amiga/amiga/device.h>
|
|
|
|
#include <amiga/dev/grfioctl.h>
|
|
|
|
#include <amiga/dev/grfvar.h>
|
|
|
|
#include <amiga/dev/itevar.h>
|
1996-04-22 01:10:48 +04:00
|
|
|
#include <amiga/dev/viewioctl.h>
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1996-04-22 01:10:48 +04:00
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <machine/conf.h>
|
1995-05-07 19:37:02 +04:00
|
|
|
|
1996-04-22 01:10:48 +04:00
|
|
|
#include "view.h"
|
1994-05-08 09:52:54 +04:00
|
|
|
#include "grf.h"
|
1994-02-17 12:10:32 +03:00
|
|
|
|
1996-04-22 01:10:48 +04:00
|
|
|
#if NGRF > 0
|
1993-07-05 23:19:43 +04:00
|
|
|
#include "ite.h"
|
|
|
|
#if NITE == 0
|
1994-02-17 12:10:32 +03:00
|
|
|
#define ite_on(u,f)
|
|
|
|
#define ite_off(u,f)
|
|
|
|
#define ite_reinit(d)
|
1993-07-05 23:19:43 +04:00
|
|
|
#endif
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
int grfon __P((dev_t));
|
|
|
|
int grfoff __P((dev_t));
|
|
|
|
int grfsinfo __P((dev_t, struct grfdyninfo *));
|
|
|
|
#ifdef BANKEDDEVPAGER
|
|
|
|
int grfbanked_get __P((dev_t, off_t, int));
|
|
|
|
int grfbanked_cur __P((dev_t));
|
|
|
|
int grfbanked_set __P((dev_t, int));
|
1993-07-05 23:19:43 +04:00
|
|
|
#endif
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
void grfattach __P((struct device *, struct device *, void *));
|
1996-03-17 04:16:48 +03:00
|
|
|
int grfmatch __P((struct device *, void *, void *));
|
1996-08-28 01:53:46 +04:00
|
|
|
int grfprint __P((void *, const char *));
|
1993-07-05 23:19:43 +04:00
|
|
|
/*
|
1994-05-08 09:52:54 +04:00
|
|
|
* pointers to grf drivers device structs
|
1993-07-05 23:19:43 +04:00
|
|
|
*/
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *grfsp[NGRF];
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1996-03-17 04:16:48 +03:00
|
|
|
struct cfattach grf_ca = {
|
|
|
|
sizeof(struct device), grfmatch, grfattach
|
|
|
|
};
|
1994-05-08 09:52:54 +04:00
|
|
|
|
1996-03-17 04:16:48 +03:00
|
|
|
struct cfdriver grf_cd = {
|
|
|
|
NULL, "grf", DV_DULL, NULL, 0
|
|
|
|
};
|
1993-07-05 23:19:43 +04:00
|
|
|
|
|
|
|
/*
|
1994-05-08 09:52:54 +04:00
|
|
|
* only used in console init.
|
1993-07-05 23:19:43 +04:00
|
|
|
*/
|
1994-05-08 09:52:54 +04:00
|
|
|
static struct cfdata *cfdata;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* match if the unit of grf matches its perspective
|
|
|
|
* low level board driver.
|
|
|
|
*/
|
|
|
|
int
|
1996-03-17 04:16:48 +03:00
|
|
|
grfmatch(pdp, match, auxp)
|
1994-05-08 09:52:54 +04:00
|
|
|
struct device *pdp;
|
1996-03-17 04:16:48 +03:00
|
|
|
void *match, *auxp;
|
1994-05-08 09:52:54 +04:00
|
|
|
{
|
1996-03-17 04:16:48 +03:00
|
|
|
struct cfdata *cfp = match;
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
if (cfp->cf_unit != ((struct grf_softc *)pdp)->g_unit)
|
1993-07-05 23:19:43 +04:00
|
|
|
return(0);
|
1994-05-08 09:52:54 +04:00
|
|
|
cfdata = cfp;
|
1993-07-05 23:19:43 +04:00
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* attach.. plug pointer in and print some info.
|
|
|
|
* then try and attach an ite to us. note: dp is NULL
|
|
|
|
* durring console init.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
grfattach(pdp, dp, auxp)
|
|
|
|
struct device *pdp, *dp;
|
|
|
|
void *auxp;
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
|
|
|
int maj;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = (struct grf_softc *)pdp;
|
|
|
|
grfsp[gp->g_unit] = (struct grf_softc *)pdp;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* find our major device number
|
|
|
|
*/
|
|
|
|
for(maj = 0; maj < nchrdev; maj++)
|
1994-12-28 12:24:55 +03:00
|
|
|
if (cdevsw[maj].d_open == grfopen)
|
1994-05-08 09:52:54 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
gp->g_grfdev = makedev(maj, gp->g_unit);
|
|
|
|
if (dp != NULL) {
|
1994-06-16 18:28:42 +04:00
|
|
|
printf(": width %d height %d", gp->g_display.gd_dwidth,
|
1994-05-08 09:52:54 +04:00
|
|
|
gp->g_display.gd_dheight);
|
|
|
|
if (gp->g_display.gd_colors == 2)
|
1994-05-11 23:06:40 +04:00
|
|
|
printf(" monochrome\n");
|
1994-05-08 09:52:54 +04:00
|
|
|
else
|
1994-05-11 23:06:40 +04:00
|
|
|
printf(" colors %d\n", gp->g_display.gd_colors);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1994-05-08 09:52:54 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* try and attach an ite
|
|
|
|
*/
|
|
|
|
amiga_config_found(cfdata, dp, gp, grfprint);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
grfprint(auxp, pnp)
|
|
|
|
void *auxp;
|
1996-08-28 01:53:46 +04:00
|
|
|
const char *pnp;
|
1994-05-08 09:52:54 +04:00
|
|
|
{
|
|
|
|
if (pnp)
|
1994-06-05 11:45:08 +04:00
|
|
|
printf("ite at %s", pnp);
|
1994-05-08 09:52:54 +04:00
|
|
|
return(UNCONF);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
|
|
|
grfopen(dev, flags, devtype, p)
|
1993-07-05 23:19:43 +04:00
|
|
|
dev_t dev;
|
1994-05-08 09:52:54 +04:00
|
|
|
int flags, devtype;
|
|
|
|
struct proc *p;
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1995-11-30 03:56:23 +03:00
|
|
|
if (GRFUNIT(dev) >= NGRF || (gp = grfsp[GRFUNIT(dev)]) == NULL)
|
1993-07-05 23:19:43 +04:00
|
|
|
return(ENXIO);
|
1994-05-08 09:52:54 +04:00
|
|
|
|
|
|
|
if ((gp->g_flags & GF_ALIVE) == 0)
|
|
|
|
return(ENXIO);
|
|
|
|
|
1993-07-05 23:19:43 +04:00
|
|
|
if ((gp->g_flags & (GF_OPEN|GF_EXCLUDE)) == (GF_OPEN|GF_EXCLUDE))
|
|
|
|
return(EBUSY);
|
1994-05-08 09:52:54 +04:00
|
|
|
|
|
|
|
return(0);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
1996-04-22 01:10:48 +04:00
|
|
|
grfclose(dev, flags, mode, p)
|
1993-07-05 23:19:43 +04:00
|
|
|
dev_t dev;
|
1994-05-08 09:52:54 +04:00
|
|
|
int flags;
|
1996-04-22 01:10:48 +04:00
|
|
|
int mode;
|
|
|
|
struct proc *p;
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
|
|
|
(void)grfoff(dev);
|
1993-07-05 23:19:43 +04:00
|
|
|
gp->g_flags &= GF_ALIVE;
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
1993-07-05 23:19:43 +04:00
|
|
|
grfioctl(dev, cmd, data, flag, p)
|
|
|
|
dev_t dev;
|
1994-12-01 20:24:23 +03:00
|
|
|
u_long cmd;
|
1993-07-05 23:19:43 +04:00
|
|
|
caddr_t data;
|
1994-12-01 20:24:23 +03:00
|
|
|
int flag;
|
1993-07-05 23:19:43 +04:00
|
|
|
struct proc *p;
|
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
1993-07-05 23:19:43 +04:00
|
|
|
int error;
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
1993-07-05 23:19:43 +04:00
|
|
|
error = 0;
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
switch (cmd) {
|
1994-01-27 00:05:34 +03:00
|
|
|
case OGRFIOCGINFO:
|
|
|
|
/* argl.. no bank-member.. */
|
|
|
|
bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo)-4);
|
|
|
|
break;
|
1993-07-05 23:19:43 +04:00
|
|
|
case GRFIOCGINFO:
|
|
|
|
bcopy((caddr_t)&gp->g_display, data, sizeof(struct grfinfo));
|
|
|
|
break;
|
|
|
|
case GRFIOCON:
|
|
|
|
error = grfon(dev);
|
|
|
|
break;
|
|
|
|
case GRFIOCOFF:
|
|
|
|
error = grfoff(dev);
|
|
|
|
break;
|
|
|
|
case GRFIOCSINFO:
|
1994-05-08 09:52:54 +04:00
|
|
|
error = grfsinfo(dev, (struct grfdyninfo *) data);
|
1993-07-05 23:19:43 +04:00
|
|
|
break;
|
1993-09-02 22:05:24 +04:00
|
|
|
case GRFGETVMODE:
|
1996-04-22 01:10:48 +04:00
|
|
|
return(gp->g_mode(gp, GM_GRFGETVMODE, data, 0, 0));
|
1993-09-02 22:05:24 +04:00
|
|
|
case GRFSETVMODE:
|
1996-04-22 01:10:48 +04:00
|
|
|
error = gp->g_mode(gp, GM_GRFSETVMODE, data, 0, 0);
|
1995-02-12 22:18:33 +03:00
|
|
|
if (error == 0 && gp->g_itedev && !(gp->g_flags & GF_GRFON))
|
1994-05-08 09:52:54 +04:00
|
|
|
ite_reinit(gp->g_itedev);
|
1993-09-02 22:05:24 +04:00
|
|
|
break;
|
|
|
|
case GRFGETNUMVM:
|
1996-04-22 01:10:48 +04:00
|
|
|
return(gp->g_mode(gp, GM_GRFGETNUMVM, data, 0, 0));
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* these are all hardware dependant, and have to be resolved
|
|
|
|
* in the respective driver.
|
|
|
|
*/
|
1994-01-27 00:05:34 +03:00
|
|
|
case GRFIOCPUTCMAP:
|
|
|
|
case GRFIOCGETCMAP:
|
|
|
|
case GRFIOCSSPRITEPOS:
|
|
|
|
case GRFIOCGSPRITEPOS:
|
|
|
|
case GRFIOCSSPRITEINF:
|
|
|
|
case GRFIOCGSPRITEINF:
|
|
|
|
case GRFIOCGSPRITEMAX:
|
1995-02-12 22:18:33 +03:00
|
|
|
case GRFIOCBITBLT:
|
1995-04-23 20:20:43 +04:00
|
|
|
case GRFIOCSETMON:
|
1995-10-09 05:08:35 +03:00
|
|
|
case GRFIOCBLANK: /* blank ioctl, IOCON/OFF will turn ite on */
|
1994-12-28 12:24:55 +03:00
|
|
|
case GRFTOGGLE: /* Toggles between Cirrus boards and native ECS on
|
|
|
|
Amiga. 15/11/94 ill */
|
1995-08-18 20:21:33 +04:00
|
|
|
/*
|
|
|
|
* We need the minor dev number to get the overlay/image
|
|
|
|
* information for grf_ul.
|
|
|
|
*/
|
1996-04-22 01:10:48 +04:00
|
|
|
return(gp->g_mode(gp, GM_GRFIOCTL, data, cmd, dev));
|
1996-05-20 00:06:02 +04:00
|
|
|
|
|
|
|
case FBIOSVIDEO:
|
|
|
|
return(gp->g_mode(gp, GM_GRFIOCTL, data, GRFIOCBLANK, dev));
|
|
|
|
|
1993-07-05 23:19:43 +04:00
|
|
|
default:
|
1995-05-07 19:37:02 +04:00
|
|
|
#if NVIEW > 0
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* check to see whether it's a command recognized by the
|
|
|
|
* view code if the unit is 0
|
|
|
|
* XXX
|
|
|
|
*/
|
1994-01-27 00:05:34 +03:00
|
|
|
if (GRFUNIT(dev) == 0)
|
1994-05-08 09:52:54 +04:00
|
|
|
return(viewioctl(dev, cmd, data, flag, p));
|
1995-05-07 19:37:02 +04:00
|
|
|
#endif
|
1993-07-05 23:19:43 +04:00
|
|
|
error = EINVAL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*ARGSUSED*/
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
1996-04-22 01:10:48 +04:00
|
|
|
grfselect(dev, rw, p)
|
1993-07-05 23:19:43 +04:00
|
|
|
dev_t dev;
|
1994-05-08 09:52:54 +04:00
|
|
|
int rw;
|
1996-04-22 01:10:48 +04:00
|
|
|
struct proc *p;
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
|
|
|
if (rw == FREAD)
|
|
|
|
return(0);
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* map the contents of a graphics display card into process'
|
|
|
|
* memory space.
|
|
|
|
*/
|
|
|
|
int
|
1995-04-10 13:12:10 +04:00
|
|
|
grfmmap(dev, off, prot)
|
1994-05-08 09:52:54 +04:00
|
|
|
dev_t dev;
|
|
|
|
int off, prot;
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
|
|
|
struct grfinfo *gi;
|
|
|
|
|
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
|
|
|
gi = &gp->g_display;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* control registers
|
|
|
|
*/
|
|
|
|
if (off >= 0 && off < gi->gd_regsize)
|
|
|
|
return(((u_int)gi->gd_regaddr + off) >> PGSHIFT);
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* frame buffer
|
|
|
|
*/
|
|
|
|
if (off >= gi->gd_regsize && off < gi->gd_regsize+gi->gd_fbsize) {
|
|
|
|
off -= gi->gd_regsize;
|
|
|
|
#ifdef BANKEDDEVPAGER
|
|
|
|
if (gi->gd_bank_size)
|
|
|
|
off %= gi->gd_bank_size;
|
1993-07-05 23:19:43 +04:00
|
|
|
#endif
|
1994-05-08 09:52:54 +04:00
|
|
|
return(((u_int)gi->gd_fbaddr + off) >> PGSHIFT);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
1994-05-08 09:52:54 +04:00
|
|
|
/* bogus */
|
|
|
|
return(-1);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
1993-07-05 23:19:43 +04:00
|
|
|
grfon(dev)
|
|
|
|
dev_t dev;
|
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
|
|
|
|
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
if (gp->g_flags & GF_GRFON)
|
1994-05-08 09:52:54 +04:00
|
|
|
return(0);
|
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
gp->g_flags |= GF_GRFON;
|
1994-05-08 09:52:54 +04:00
|
|
|
if (gp->g_itedev != NODEV)
|
|
|
|
ite_off(gp->g_itedev, 3);
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1996-04-22 01:10:48 +04:00
|
|
|
return(gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVON : GM_GRFON,
|
|
|
|
NULL, 0, 0));
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
1993-07-05 23:19:43 +04:00
|
|
|
grfoff(dev)
|
|
|
|
dev_t dev;
|
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
1993-07-05 23:19:43 +04:00
|
|
|
int error;
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
|
|
|
|
|
|
|
if ((gp->g_flags & GF_GRFON) == 0)
|
|
|
|
return(0);
|
|
|
|
|
1993-09-02 22:05:24 +04:00
|
|
|
gp->g_flags &= ~GF_GRFON;
|
1996-04-22 01:10:48 +04:00
|
|
|
error = gp->g_mode(gp, (dev & GRFOVDEV) ? GM_GRFOVOFF : GM_GRFOFF,
|
|
|
|
NULL, 0, 0);
|
1994-05-08 09:52:54 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Closely tied together no X's
|
|
|
|
*/
|
|
|
|
if (gp->g_itedev != NODEV)
|
|
|
|
ite_on(gp->g_itedev, 2);
|
1993-09-02 22:05:24 +04:00
|
|
|
|
1993-07-05 23:19:43 +04:00
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
int
|
1993-07-05 23:19:43 +04:00
|
|
|
grfsinfo(dev, dyninfo)
|
|
|
|
dev_t dev;
|
|
|
|
struct grfdyninfo *dyninfo;
|
|
|
|
{
|
|
|
|
struct grf_softc *gp;
|
1994-05-08 09:52:54 +04:00
|
|
|
int error;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
1996-04-22 01:10:48 +04:00
|
|
|
error = gp->g_mode(gp, GM_GRFCONFIG, dyninfo, 0, 0);
|
1993-07-05 23:19:43 +04:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* Closely tied together no X's
|
|
|
|
*/
|
|
|
|
if (gp->g_itedev != NODEV)
|
|
|
|
ite_reinit(gp->g_itedev);
|
1993-07-05 23:19:43 +04:00
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
1994-01-27 00:05:34 +03:00
|
|
|
#ifdef BANKEDDEVPAGER
|
|
|
|
|
|
|
|
int
|
|
|
|
grfbanked_get (dev, off, prot)
|
|
|
|
dev_t dev;
|
|
|
|
off_t off;
|
|
|
|
int prot;
|
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
|
|
|
struct grfinfo *gi;
|
|
|
|
int error, bank;
|
|
|
|
|
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
|
|
|
gi = &gp->g_display;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
off -= gi->gd_regsize;
|
|
|
|
if (off < 0 || off >= gi->gd_fbsize)
|
|
|
|
return -1;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
error = gp->g_mode(gp, GM_GRFGETBANK, &bank, off, prot);
|
|
|
|
return error ? -1 : bank;
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
grfbanked_cur (dev)
|
1994-05-08 09:52:54 +04:00
|
|
|
dev_t dev;
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
|
|
|
int error, bank;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
|
|
|
|
1996-04-22 01:10:48 +04:00
|
|
|
error = gp->g_mode(gp, GM_GRFGETCURBANK, &bank, 0, 0);
|
1994-05-08 09:52:54 +04:00
|
|
|
return(error ? -1 : bank);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
grfbanked_set (dev, bank)
|
1994-05-08 09:52:54 +04:00
|
|
|
dev_t dev;
|
|
|
|
int bank;
|
1994-01-27 00:05:34 +03:00
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
1994-01-27 00:05:34 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
1996-04-22 01:10:48 +04:00
|
|
|
return(gp->g_mode(gp, GM_GRFSETBANK, &bank, 0, 0) ? -1 : 0);
|
1994-01-27 00:05:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* BANKEDDEVPAGER */
|
1993-07-05 23:19:43 +04:00
|
|
|
#endif /* NGRF > 0 */
|