Home | History | Annotate | Line # | Download | only in dev
grfvar.h revision 1.23
      1  1.23  scottr /*	$NetBSD: grfvar.h,v 1.23 1998/12/22 08:47:05 scottr Exp $	*/
      2   1.3     cgd 
      3   1.1  briggs /*
      4   1.1  briggs  * Copyright (c) 1988 University of Utah.
      5   1.1  briggs  * Copyright (c) 1990 The Regents of the University of California.
      6   1.1  briggs  * All rights reserved.
      7   1.1  briggs  *
      8   1.1  briggs  * This code is derived from software contributed to Berkeley by
      9   1.1  briggs  * the Systems Programming Group of the University of Utah Computer
     10   1.1  briggs  * Science Department.
     11   1.1  briggs  *
     12   1.1  briggs  * Redistribution and use in source and binary forms, with or without
     13   1.1  briggs  * modification, are permitted provided that the following conditions
     14   1.1  briggs  * are met:
     15   1.1  briggs  * 1. Redistributions of source code must retain the above copyright
     16   1.1  briggs  *    notice, this list of conditions and the following disclaimer.
     17   1.1  briggs  * 2. Redistributions in binary form must reproduce the above copyright
     18   1.1  briggs  *    notice, this list of conditions and the following disclaimer in the
     19   1.1  briggs  *    documentation and/or other materials provided with the distribution.
     20   1.1  briggs  * 3. All advertising materials mentioning features or use of this software
     21   1.1  briggs  *    must display the following acknowledgement:
     22   1.1  briggs  *	This product includes software developed by the University of
     23   1.1  briggs  *	California, Berkeley and its contributors.
     24   1.1  briggs  * 4. Neither the name of the University nor the names of its contributors
     25   1.1  briggs  *    may be used to endorse or promote products derived from this software
     26   1.1  briggs  *    without specific prior written permission.
     27   1.1  briggs  *
     28   1.1  briggs  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     29   1.1  briggs  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     30   1.1  briggs  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     31   1.1  briggs  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     32   1.1  briggs  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     33   1.1  briggs  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     34   1.1  briggs  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     35   1.1  briggs  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     36   1.1  briggs  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     37   1.1  briggs  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     38   1.1  briggs  * SUCH DAMAGE.
     39   1.1  briggs  *
     40   1.1  briggs  * from: Utah $Hdr: grfvar.h 1.9 91/01/21$
     41   1.1  briggs  *
     42   1.3     cgd  *	@(#)grfvar.h	7.3 (Berkeley) 5/7/91
     43   1.1  briggs  */
     44   1.1  briggs 
     45   1.7  briggs #define CARD_NAME_LEN	64
     46  1.10  scottr 
     47  1.10  scottr /*
     48  1.10  scottr  * State info, per hardware instance.
     49  1.10  scottr  */
     50  1.10  scottr struct grfbus_softc {
     51   1.7  briggs 	struct	device	sc_dev;
     52   1.7  briggs 	nubus_slot	sc_slot;
     53   1.6  briggs 
     54  1.22  scottr 	bus_addr_t		sc_basepa;	/* base of video space */
     55  1.22  scottr 	bus_addr_t		sc_fbofs;	/* offset to framebuffer */
     56  1.21  scottr 
     57  1.14  briggs 	bus_space_tag_t		sc_tag;
     58  1.16  scottr 	bus_space_handle_t	sc_handle;
     59  1.14  briggs 	bus_space_handle_t	sc_regh;
     60  1.14  briggs 
     61   1.7  briggs 	struct	grfmode curr_mode;	/* hardware desc(for ioctl)	*/
     62  1.14  briggs 	u_int32_t	card_id;	/* DrHW value for nubus cards	*/
     63  1.17  scottr 	bus_size_t	cli_offset;	/* Offset to clear interrupt	*/
     64  1.17  scottr 					/* for cards where that's suff.	*/
     65  1.17  scottr 	u_int32_t	cli_value;	/* Value to write at cli_offset */
     66   1.7  briggs 	nubus_dir	board_dir;	/* Nubus dir for curr board	*/
     67  1.10  scottr };
     68  1.10  scottr 
     69  1.10  scottr /*
     70  1.10  scottr  * State info, per grf instance.
     71  1.10  scottr  */
     72  1.10  scottr struct grf_softc {
     73  1.10  scottr 	struct	device sc_dev;		/* device glue */
     74  1.10  scottr 
     75  1.16  scottr 	bus_space_tag_t		sc_tag;
     76  1.16  scottr 	bus_space_handle_t	sc_handle;
     77  1.16  scottr 
     78  1.16  scottr 	int	sc_flags;		/* driver flags */
     79  1.22  scottr 	u_long	sc_phys;		/* PA of framebuffer */
     80  1.16  scottr 
     81  1.10  scottr 	struct	grfmode *sc_grfmode;	/* forwarded ... */
     82  1.10  scottr 	nubus_slot	*sc_slot;
     83   1.9  briggs 					/* mode-change on/off/mode function */
     84  1.10  scottr 	int	(*sc_mode) __P((struct grf_softc *, int, void *));
     85  1.18  scottr 					/* find framebuffer physical addr */
     86  1.10  scottr };
     87  1.10  scottr 
     88  1.10  scottr /*
     89  1.10  scottr  * Attach grf and ite semantics to Mac video hardware.
     90  1.10  scottr  */
     91  1.10  scottr struct grfbus_attach_args {
     92  1.21  scottr 	char		*ga_name;	/* name of semantics to attach */
     93  1.21  scottr 	bus_space_tag_t	ga_tag;		/* forwarded ... */
     94  1.16  scottr 	bus_space_handle_t ga_handle;
     95  1.16  scottr 	struct grfmode	*ga_grfmode;
     96  1.10  scottr 	nubus_slot	*ga_slot;
     97  1.22  scottr 	bus_addr_t	ga_phys;
     98  1.21  scottr 	int		(*ga_mode) __P((struct grf_softc *, int, void *));
     99   1.1  briggs };
    100   1.1  briggs 
    101  1.23  scottr typedef	caddr_t (*grf_phys_t) __P((struct grf_softc *gp, vaddr_t addr));
    102   1.9  briggs 
    103   1.1  briggs /* flags */
    104   1.1  briggs #define	GF_ALIVE	0x01
    105   1.1  briggs #define GF_OPEN		0x02
    106   1.1  briggs #define GF_EXCLUDE	0x04
    107   1.1  briggs #define GF_WANTED	0x08
    108   1.1  briggs #define GF_BSDOPEN	0x10
    109   1.1  briggs #define GF_HPUXOPEN	0x20
    110   1.1  briggs 
    111   1.1  briggs /* requests to mode routine */
    112   1.1  briggs #define GM_GRFON	1
    113   1.1  briggs #define GM_GRFOFF	2
    114   1.7  briggs #define GM_CURRMODE	3
    115   1.7  briggs #define GM_LISTMODES	4
    116   1.7  briggs #define GM_NEWMODE	5
    117   1.1  briggs 
    118   1.1  briggs /* minor device interpretation */
    119   1.1  briggs #define GRFUNIT(d)	((d) & 0x7)
    120   1.1  briggs 
    121   1.7  briggs /*
    122   1.7  briggs  * Nubus image data structure.  This is the equivalent of a PixMap in
    123   1.7  briggs  * MacOS programming parlance.  One of these structures exists for each
    124   1.7  briggs  * video mode that a quickdraw compatible card can fit in.
    125   1.7  briggs  */
    126   1.7  briggs struct image_data {
    127   1.7  briggs 	u_int32_t	size;
    128   1.7  briggs 	u_int32_t	offset;
    129   1.7  briggs 	u_int16_t	rowbytes;
    130   1.7  briggs 	u_int16_t	top;
    131   1.7  briggs 	u_int16_t	left;
    132   1.7  briggs 	u_int16_t	bottom;
    133   1.7  briggs 	u_int16_t	right;
    134   1.7  briggs 	u_int16_t	version;
    135   1.7  briggs 	u_int16_t	packType;
    136   1.7  briggs 	u_int32_t	packSize;
    137   1.7  briggs 	u_int32_t	hRes;
    138   1.7  briggs 	u_int32_t	vRes;
    139   1.7  briggs 	u_int16_t	pixelType;
    140   1.7  briggs 	u_int16_t	pixelSize;
    141   1.7  briggs 	u_int16_t	cmpCount;
    142   1.7  briggs 	u_int16_t	cmpSize;
    143   1.7  briggs 	u_int32_t	planeBytes;
    144   1.7  briggs };
    145   1.7  briggs 
    146   1.7  briggs #define VID_PARAMS		1
    147   1.7  briggs #define VID_TABLE_OFFSET	2
    148   1.7  briggs #define VID_PAGE_CNT		3
    149   1.7  briggs #define VID_DEV_TYPE		4
    150   1.9  briggs 
    151   1.9  briggs int	grfopen __P((dev_t dev, int flag, int mode, struct proc *p));
    152   1.9  briggs int	grfclose __P((dev_t dev, int flag, int mode, struct proc *p));
    153   1.9  briggs int	grfioctl __P((dev_t, int, caddr_t, int, struct proc *p));
    154  1.13  scottr int	grfpoll __P((dev_t dev, int events, struct proc *p));
    155   1.9  briggs int	grfmmap __P((dev_t dev, int off, int prot));
    156   1.9  briggs int	grfon __P((dev_t dev));
    157   1.9  briggs int	grfoff __P((dev_t dev));
    158   1.9  briggs int	grfaddr __P((struct grf_softc *gp, register int off));
    159   1.9  briggs int	grfmap __P((dev_t dev, caddr_t *addrp, struct proc *p));
    160   1.9  briggs int	grfunmap __P((dev_t dev, caddr_t addr, struct proc *p));
    161  1.10  scottr 
    162  1.11  scottr void	grf_establish __P((struct grfbus_softc *, nubus_slot *,
    163  1.21  scottr 	    int (*)(struct grf_softc *, int, void *)));
    164  1.12  scottr int	grfbusprint __P((void *, const char *));
    165