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