xref: /netbsd/sys/dev/tc/sticio.h (revision bf9ec67e)
1 /* 	$NetBSD: sticio.h,v 1.1 2001/09/18 19:51:23 ad Exp $	*/
2 
3 /*-
4  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Andrew Doran.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the NetBSD
21  *	Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _TC_STICIO_H_
40 #define	_TC_STICIO_H_
41 
42 /*
43  * Buffer sizes.  Image buffers (span buffers, really) must be able to hold
44  * 1280 32-bit pixels, even for the 8-bit boards.
45  */
46 #define	STIC_XCOMM_SIZE		4096
47 #define	STIC_PACKET_SIZE	4096
48 #define	STIC_IMGBUF_SIZE	1280*4
49 
50 /*
51  * stic_xinfo: info about the board that can't be gleaned using the generic
52  * wscons interfaces.
53  */
54 struct stic_xinfo {
55 	int	sxi_stampw;		/* stamp width */
56 	int	sxi_stamph;		/* stamp height */
57 	int	sxi_unit;		/* control device unit (-1 == none) */
58 	u_int	sxi_buf_size;		/* total buffer size in bytes */
59 	u_int	sxi_buf_phys;		/* buffer PA (STIC address space) */
60 	u_int	sxi_buf_pktoff;		/* offset to packet buffers */
61 	u_int	sxi_buf_pktcnt;		/* packet buffer count */
62 	u_int	sxi_buf_imgoff;		/* offset to image buffers */
63 };
64 
65 /*
66  * stic_xcomm: Xserver communication area.  Used to communicate with the
67  * kernel or i860 firmware when performing packet queueing or other such
68  * funkiness.
69  */
70 struct stic_xcomm {
71 	u_int	sxc_head;		/* Xserver submit pointer */
72 	u_int	sxc_tail;		/* STIC execute pointer */
73 	u_int	sxc_nreject;		/* number of rejected STIC polls */
74 	u_int	sxc_nstall;		/* number of queue stalls */
75 	u_int	sxc_busy;		/* true if STIC is busy */
76 	u_int	sxc_reserved[8];	/* reserved for future use */
77 	u_int	sxc_done[16];		/* packet completion semaphores */
78 };
79 
80 /*
81  * stic_xmap: a description of the area returned by mapping the board.
82  * sxm_xcomm and sxm_buf are physically contigious and of variable size as a
83  * whole; the combined size is learnt from stic_xinfo::sxi_buf_size.
84  */
85 struct stic_xmap {
86 	u_int8_t	sxm_stic[NBPG];			/* STIC registers */
87 	u_int8_t	sxm_poll[0xc0000];		/* poll registers */
88 	u_int8_t	sxm_xcomm[256 * 1024];		/* X comms area */
89 };
90 
91 /*
92  * ioctl interface.
93  */
94 #define	STICIO_GXINFO	_IOR('S', 0, struct stic_xinfo)
95 #define	STICIO_RESET	_IO('S', 1)
96 #define	STICIO_START860	_IO('S', 2)	/* PXG only, may disappear */
97 #define	STICIO_RESET860	_IO('S', 3)	/* PXG only, may disappear */
98 #define	STICIO_STARTQ	_IO('S', 4)	/* currently PX only */
99 #define	STICIO_STOPQ	_IO('S', 5)	/* currently PX only */
100 
101 #endif	/* !_TC_STICIO_H_ */
102