2003-01-01 03:25:01 +03:00
|
|
|
/* $NetBSD: grf.c,v 1.47 2003/01/01 00:28:57 thorpej 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
|
|
|
*/
|
|
|
|
|
2002-01-28 12:56:43 +03:00
|
|
|
#include <sys/cdefs.h>
|
2003-01-01 03:25:01 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: grf.c,v 1.47 2003/01/01 00:28:57 thorpej Exp $");
|
2002-01-28 12:56:43 +03:00
|
|
|
|
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>
|
2000-06-26 18:20:25 +04:00
|
|
|
#include <uvm/uvm_extern.h>
|
1994-05-08 09:52:54 +04:00
|
|
|
#include <machine/cpu.h>
|
2001-09-19 22:10:32 +04:00
|
|
|
#include <dev/sun/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>
|
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
|
|
|
|
|
2002-01-26 16:40:52 +03:00
|
|
|
int grfon(dev_t);
|
|
|
|
int grfoff(dev_t);
|
|
|
|
int grfsinfo(dev_t, struct grfdyninfo *);
|
1993-07-05 23:19:43 +04:00
|
|
|
|
2002-01-26 16:40:52 +03:00
|
|
|
void grfattach(struct device *, struct device *, void *);
|
|
|
|
int grfmatch(struct device *, struct cfdata *, void *);
|
|
|
|
int grfprint(void *, const char *);
|
1993-07-05 23:19:43 +04:00
|
|
|
/*
|
2002-01-26 16:40:52 +03: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
|
|
|
|
2002-10-02 08:55:47 +04:00
|
|
|
CFATTACH_DECL(grf, sizeof(struct device),
|
|
|
|
grfmatch, grfattach, NULL, NULL);
|
1994-05-08 09:52:54 +04:00
|
|
|
|
2002-09-06 17:18:43 +04:00
|
|
|
dev_type_open(grfopen);
|
|
|
|
dev_type_close(grfclose);
|
|
|
|
dev_type_ioctl(grfioctl);
|
|
|
|
dev_type_mmap(grfmmap);
|
|
|
|
|
|
|
|
const struct cdevsw grf_cdevsw = {
|
|
|
|
grfopen, grfclose, nullread, nullwrite, grfioctl,
|
2002-10-23 13:10:23 +04:00
|
|
|
nostop, notty, nopoll, grfmmap, nokqfilter,
|
2002-09-06 17:18:43 +04:00
|
|
|
};
|
|
|
|
|
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
|
|
|
/*
|
2002-01-26 16:40:52 +03:00
|
|
|
* match if the unit of grf matches its perspective
|
1994-05-08 09:52:54 +04:00
|
|
|
* low level board driver.
|
|
|
|
*/
|
|
|
|
int
|
2002-01-26 16:40:52 +03:00
|
|
|
grfmatch(struct device *pdp, struct cfdata *cfp, void *auxp)
|
1994-05-08 09:52:54 +04:00
|
|
|
{
|
1996-03-17 04:16:48 +03:00
|
|
|
|
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
|
2002-01-26 16:40:52 +03:00
|
|
|
grfattach(struct device *pdp, struct device *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
|
|
|
/*
|
2002-01-26 16:40:52 +03:00
|
|
|
* find our major device number
|
1994-05-08 09:52:54 +04:00
|
|
|
*/
|
2002-09-06 17:18:43 +04:00
|
|
|
maj = cdevsw_lookup_major(&grf_cdevsw);
|
1994-05-08 09:52:54 +04:00
|
|
|
|
|
|
|
gp->g_grfdev = makedev(maj, gp->g_unit);
|
|
|
|
if (dp != NULL) {
|
1996-10-13 07:05:43 +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)
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" monochrome\n");
|
1994-05-08 09:52:54 +04:00
|
|
|
else
|
1996-10-13 07:05:43 +04:00
|
|
|
printf(" colors %d\n", gp->g_display.gd_colors);
|
1993-07-05 23:19:43 +04:00
|
|
|
}
|
2002-01-26 16:40:52 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
|
|
|
* try and attach an ite
|
|
|
|
*/
|
|
|
|
amiga_config_found(cfdata, dp, gp, grfprint);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-01-26 16:40:52 +03:00
|
|
|
grfprint(void *auxp, const char *pnp)
|
1994-05-08 09:52:54 +04:00
|
|
|
{
|
|
|
|
if (pnp)
|
2003-01-01 03:25:01 +03:00
|
|
|
aprint_normal("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
|
2002-01-26 16:40:52 +03:00
|
|
|
grfopen(dev_t dev, int flags, int 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
|
2002-01-26 16:40:52 +03:00
|
|
|
grfclose(dev_t dev, int flags, 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
|
2002-01-26 16:40:52 +03:00
|
|
|
grfioctl(dev_t dev, u_long cmd, caddr_t data, int flag, 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
|
|
|
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:
|
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
|
|
|
|
1999-08-16 23:55:27 +04:00
|
|
|
case GRFIOCBLANK: /* blank ioctl, IOCON/OFF will turn ite on */
|
1996-05-20 00:06:02 +04:00
|
|
|
case FBIOSVIDEO:
|
1999-08-16 23:55:27 +04:00
|
|
|
error = gp->g_mode(gp, GM_GRFIOCTL, data, GRFIOCBLANK, dev);
|
|
|
|
if (!error)
|
|
|
|
gp->g_blank = *(int *)data;
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
case FBIOGVIDEO:
|
|
|
|
*(int *)data = gp->g_blank;
|
|
|
|
return (0);
|
1996-05-20 00:06:02 +04:00
|
|
|
|
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
|
2002-01-26 16:40:52 +03:00
|
|
|
* XXX
|
1994-05-08 09:52:54 +04:00
|
|
|
*/
|
2002-09-06 17:18:43 +04:00
|
|
|
if (GRFUNIT(dev) == 0) {
|
|
|
|
extern const struct cdevsw view_cdevsw;
|
|
|
|
|
|
|
|
return((*view_cdevsw.d_ioctl)(dev, cmd, data, flag, p));
|
|
|
|
}
|
1995-05-07 19:37:02 +04:00
|
|
|
#endif
|
2002-03-17 22:40:26 +03:00
|
|
|
error = EPASSTHROUGH;
|
1993-07-05 23:19:43 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
return(error);
|
|
|
|
}
|
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
/*
|
2002-01-26 16:40:52 +03:00
|
|
|
* map the contents of a graphics display card into process'
|
1994-05-08 09:52:54 +04:00
|
|
|
* memory space.
|
|
|
|
*/
|
2000-06-26 08:55:19 +04:00
|
|
|
paddr_t
|
2002-01-26 16:40:52 +03:00
|
|
|
grfmmap(dev_t dev, off_t off, int prot)
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
1994-05-08 09:52:54 +04:00
|
|
|
struct grf_softc *gp;
|
|
|
|
struct grfinfo *gi;
|
2002-01-26 16:40:52 +03:00
|
|
|
|
1994-05-08 09:52:54 +04:00
|
|
|
gp = grfsp[GRFUNIT(dev)];
|
|
|
|
gi = &gp->g_display;
|
1993-07-05 23:19:43 +04:00
|
|
|
|
2002-01-26 16:40:52 +03:00
|
|
|
/*
|
1994-05-08 09:52:54 +04:00
|
|
|
* control registers
|
|
|
|
*/
|
|
|
|
if (off >= 0 && off < gi->gd_regsize)
|
2000-06-26 08:55:19 +04:00
|
|
|
return(((paddr_t)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;
|
2000-06-26 08:55:19 +04:00
|
|
|
return(((paddr_t)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
|
2002-01-26 16:40:52 +03:00
|
|
|
grfon(dev_t dev)
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
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
|
2002-01-26 16:40:52 +03:00
|
|
|
grfoff(dev_t dev)
|
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
|
|
|
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
|
2002-01-26 16:40:52 +03:00
|
|
|
grfsinfo(dev_t dev, struct grfdyninfo *dyninfo)
|
1993-07-05 23:19:43 +04:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* NGRF > 0 */
|