Home | History | Annotate | Line # | Download | only in dev
      1  1.5  tsutsui /*	$NetBSD: diofbvar.h,v 1.5 2024/05/01 19:28:33 tsutsui Exp $	*/
      2  1.1  tsutsui /*	$OpenBSD: diofbvar.h,v 1.10 2006/08/11 18:33:13 miod Exp $	*/
      3  1.1  tsutsui 
      4  1.1  tsutsui /*
      5  1.1  tsutsui  * Copyright (c) 2005, Miodrag Vallat
      6  1.1  tsutsui  *
      7  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
      8  1.1  tsutsui  * modification, are permitted provided that the following conditions
      9  1.1  tsutsui  * are met:
     10  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     11  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     12  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     15  1.1  tsutsui  *
     16  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  tsutsui  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     18  1.1  tsutsui  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     19  1.1  tsutsui  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
     20  1.1  tsutsui  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     21  1.1  tsutsui  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     22  1.1  tsutsui  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1  tsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     24  1.1  tsutsui  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
     25  1.1  tsutsui  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  1.1  tsutsui  * POSSIBILITY OF SUCH DAMAGE.
     27  1.1  tsutsui  */
     28  1.1  tsutsui /*
     29  1.1  tsutsui  * Copyright (c) 1988 University of Utah.
     30  1.1  tsutsui  * Copyright (c) 1990, 1993
     31  1.1  tsutsui  *	The Regents of the University of California.  All rights reserved.
     32  1.1  tsutsui  *
     33  1.1  tsutsui  * This code is derived from software contributed to Berkeley by
     34  1.1  tsutsui  * the Systems Programming Group of the University of Utah Computer
     35  1.1  tsutsui  * Science Department.
     36  1.1  tsutsui  *
     37  1.1  tsutsui  * Redistribution and use in source and binary forms, with or without
     38  1.1  tsutsui  * modification, are permitted provided that the following conditions
     39  1.1  tsutsui  * are met:
     40  1.1  tsutsui  * 1. Redistributions of source code must retain the above copyright
     41  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer.
     42  1.1  tsutsui  * 2. Redistributions in binary form must reproduce the above copyright
     43  1.1  tsutsui  *    notice, this list of conditions and the following disclaimer in the
     44  1.1  tsutsui  *    documentation and/or other materials provided with the distribution.
     45  1.1  tsutsui  * 3. Neither the name of the University nor the names of its contributors
     46  1.1  tsutsui  *    may be used to endorse or promote products derived from this software
     47  1.1  tsutsui  *    without specific prior written permission.
     48  1.1  tsutsui  *
     49  1.1  tsutsui  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     50  1.1  tsutsui  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     51  1.1  tsutsui  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     52  1.1  tsutsui  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     53  1.1  tsutsui  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     54  1.1  tsutsui  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     55  1.1  tsutsui  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     56  1.1  tsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     57  1.1  tsutsui  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     58  1.1  tsutsui  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     59  1.1  tsutsui  * SUCH DAMAGE.
     60  1.1  tsutsui  *
     61  1.1  tsutsui  * from: Utah $Hdr: grfvar.h 1.11 93/08/13$
     62  1.1  tsutsui  *
     63  1.1  tsutsui  *	@(#)grfvar.h	8.2 (Berkeley) 9/9/93
     64  1.1  tsutsui  */
     65  1.1  tsutsui 
     66  1.1  tsutsui #ifdef	_KERNEL
     67  1.1  tsutsui 
     68  1.1  tsutsui struct diocmap {
     69  1.3  tsutsui 	uint8_t r[256], g[256], b[256];
     70  1.1  tsutsui };
     71  1.1  tsutsui 
     72  1.1  tsutsui /*
     73  1.1  tsutsui  * Minimal frame buffer state structure.
     74  1.1  tsutsui  */
     75  1.1  tsutsui struct diofb {
     76  1.1  tsutsui 	uint8_t *regkva;		/* KVA of registers */
     77  1.1  tsutsui 	uint8_t *fbkva;			/* KVA of framebuffer */
     78  1.1  tsutsui 
     79  1.1  tsutsui 	uint8_t	*regaddr;		/* control registers physaddr */
     80  1.1  tsutsui 	uint8_t	*fbaddr;		/* frame buffer physaddr */
     81  1.1  tsutsui 
     82  1.1  tsutsui 	u_int	fbsize;			/* frame buffer size */
     83  1.1  tsutsui 	u_int	fbwidth;		/* frame buffer width */
     84  1.1  tsutsui 	u_int	fbheight;		/* frame buffer height */
     85  1.1  tsutsui 	u_int	dwidth;			/* displayed part width */
     86  1.1  tsutsui 	u_int	dheight;		/* displayed part height */
     87  1.1  tsutsui 
     88  1.1  tsutsui 	u_int	planes;			/* number of planes */
     89  1.1  tsutsui 	u_int	planemask;		/* and related mask */
     90  1.1  tsutsui 
     91  1.1  tsutsui 	/* rasops information */
     92  1.1  tsutsui 	struct rasops_info ri;
     93  1.1  tsutsui 
     94  1.1  tsutsui 	/* color information */
     95  1.1  tsutsui 	struct diocmap cmap;
     96  1.1  tsutsui 
     97  1.1  tsutsui 	/* wsdisplay information */
     98  1.1  tsutsui 	char wsdname[32];
     99  1.1  tsutsui 	struct wsscreen_descr wsd;
    100  1.1  tsutsui 	struct wsscreen_list wsl;
    101  1.1  tsutsui 	struct wsscreen_descr *scrlist[1];
    102  1.1  tsutsui 	int	nscreens;
    103  1.1  tsutsui 	u_int	mapmode;
    104  1.1  tsutsui 
    105  1.1  tsutsui 	/* blockmove routine */
    106  1.3  tsutsui 	int	(*bmv)(struct diofb *, uint16_t, uint16_t, uint16_t,
    107  1.3  tsutsui 		    uint16_t, uint16_t, uint16_t, int16_t, int16_t);
    108  1.5  tsutsui 
    109  1.5  tsutsui 	/* putchar routine to handle rasops; MD busywait might be required */
    110  1.5  tsutsui 	void	(*wsputchar)(void *, int, int, u_int, long);
    111  1.1  tsutsui };
    112  1.1  tsutsui 
    113  1.1  tsutsui /* Replacement Rules (rops) */
    114  1.1  tsutsui #define	RR_CLEAR		0x0
    115  1.1  tsutsui #define	RR_COPY			0x3
    116  1.1  tsutsui #define	RR_XOR			0x6
    117  1.1  tsutsui #define	RR_INVERT		0xa
    118  1.4  tsutsui #define	RR_COPYINVERTED		0xc
    119  1.1  tsutsui 
    120  1.1  tsutsui void	diofb_cnattach(struct diofb *);
    121  1.1  tsutsui void	diofb_end_attach(device_t, struct wsdisplay_accessops *, struct diofb *,
    122  1.1  tsutsui 	    int, const char *);
    123  1.1  tsutsui int	diofb_fbinquire(struct diofb *, int, struct diofbreg *);
    124  1.1  tsutsui void	diofb_fbsetup(struct diofb *);
    125  1.1  tsutsui int	diofb_getcmap(struct diofb *, struct wsdisplay_cmap *);
    126  1.1  tsutsui void	diofb_resetcmap(struct diofb *);
    127  1.1  tsutsui 
    128  1.1  tsutsui int	diofb_alloc_attr(void *, int, int, int, long *);
    129  1.1  tsutsui int	diofb_alloc_screen(void *, const struct wsscreen_descr *, void **,
    130  1.1  tsutsui 	    int *, int *, long *);
    131  1.1  tsutsui void	diofb_free_screen(void *, void *);
    132  1.1  tsutsui paddr_t	diofb_mmap(void *, void *, off_t, int);
    133  1.1  tsutsui int	diofb_show_screen(void *, void *, int, void (*)(void *, int, int),
    134  1.1  tsutsui 	    void *);
    135  1.1  tsutsui 
    136  1.3  tsutsui int	diofb_mono_windowmove(struct diofb *, uint16_t, uint16_t, uint16_t,
    137  1.3  tsutsui 	    uint16_t, uint16_t, uint16_t, int16_t, int16_t);
    138  1.1  tsutsui 
    139  1.1  tsutsui /* Console support */
    140  1.1  tsutsui int	dvboxcnattach(bus_space_tag_t, bus_addr_t, int);
    141  1.1  tsutsui int	gboxcnattach(bus_space_tag_t, bus_addr_t, int);
    142  1.1  tsutsui int	hypercnattach(bus_space_tag_t, bus_addr_t, int);
    143  1.1  tsutsui int	rboxcnattach(bus_space_tag_t, bus_addr_t, int);
    144  1.1  tsutsui int	topcatcnattach(bus_space_tag_t, bus_addr_t, int);
    145  1.1  tsutsui int	tvrxcnattach(bus_space_tag_t, bus_addr_t, int);
    146  1.2  tsutsui int	gendiofbcnattach(bus_space_tag_t, bus_addr_t, int);
    147  1.1  tsutsui extern	struct diofb diofb_cn;		/* struct diofb for console device */
    148  1.1  tsutsui 
    149  1.1  tsutsui #endif
    150  1.1  tsutsui 
    151  1.1  tsutsui /*
    152  1.1  tsutsui  * In mapped mode, mmap() will provide the following layout:
    153  1.1  tsutsui  * 0 - (DIOFB_REGSPACE - 1)	frame buffer registers
    154  1.1  tsutsui  * DIOFB_REGSPACE onwards	frame buffer memory
    155  1.1  tsutsui  */
    156  1.1  tsutsui #define	DIOFB_REGSPACE	0x020000
    157