xref: /netbsd-src/sys/dev/tc/sticio.h (revision 274254cdae52594c1aa480a736aef78313d15c9c)
1 /* 	$NetBSD: sticio.h,v 1.4 2008/04/28 20:23:58 martin 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  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _TC_STICIO_H_
33 #define	_TC_STICIO_H_
34 
35 /*
36  * Buffer sizes.  Image buffers (span buffers, really) must be able to hold
37  * 1280 32-bit pixels, even for the 8-bit boards.
38  */
39 #define	STIC_XCOMM_SIZE		4096
40 #define	STIC_PACKET_SIZE	4096
41 #define	STIC_IMGBUF_SIZE	1280*4
42 
43 /*
44  * stic_xinfo: info about the board that can't be gleaned using the generic
45  * wscons interfaces.
46  */
47 struct stic_xinfo {
48 	int	sxi_stampw;		/* stamp width */
49 	int	sxi_stamph;		/* stamp height */
50 	int	sxi_unit;		/* control device unit (-1 == none) */
51 	u_int	sxi_buf_size;		/* total buffer size in bytes */
52 	u_int	sxi_buf_phys;		/* buffer PA (STIC address space) */
53 	u_int	sxi_buf_pktoff;		/* offset to packet buffers */
54 	u_int	sxi_buf_pktcnt;		/* packet buffer count */
55 	u_int	sxi_buf_imgoff;		/* offset to image buffers */
56 };
57 
58 /*
59  * stic_xcomm: Xserver communication area.  Used to communicate with the
60  * kernel or i860 firmware when performing packet queueing or other such
61  * funkiness.
62  */
63 struct stic_xcomm {
64 	u_int	sxc_head;		/* Xserver submit pointer */
65 	u_int	sxc_tail;		/* STIC execute pointer */
66 	u_int	sxc_nreject;		/* number of rejected STIC polls */
67 	u_int	sxc_nstall;		/* number of queue stalls */
68 	u_int	sxc_busy;		/* true if STIC is busy */
69 	u_int	sxc_reserved[8];	/* reserved for future use */
70 	u_int	sxc_done[16];		/* packet completion semaphores */
71 };
72 
73 /*
74  * stic_xmap: a description of the area returned by mapping the board.
75  * sxm_xcomm and sxm_buf are physically contigious and of variable size as a
76  * whole; the combined size is learnt from stic_xinfo::sxi_buf_size.
77  */
78 struct stic_xmap {
79 	u_int8_t	sxm_stic[NBPG];			/* STIC registers */
80 	u_int8_t	sxm_poll[0xc0000];		/* poll registers */
81 	u_int8_t	sxm_xcomm[256 * 1024];		/* X comms area */
82 };
83 
84 /*
85  * ioctl interface.
86  */
87 #define	STICIO_GXINFO	_IOR('S', 0, struct stic_xinfo)
88 #define	STICIO_RESET	_IO('S', 1)
89 #define	STICIO_START860	_IO('S', 2)	/* PXG only, may disappear */
90 #define	STICIO_RESET860	_IO('S', 3)	/* PXG only, may disappear */
91 #define	STICIO_STARTQ	_IO('S', 4)	/* currently PX only */
92 #define	STICIO_STOPQ	_IO('S', 5)	/* currently PX only */
93 
94 #endif	/* !_TC_STICIO_H_ */
95