master
 1/* 	$NetBSD: sticio.h,v 1.6 2020/09/12 16:44:41 kamil 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#include <sys/ioccom.h>
36
37/*
38 * Buffer sizes.  Image buffers (span buffers, really) must be able to hold
39 * 1280 32-bit pixels, even for the 8-bit boards.
40 */
41#define	STIC_XCOMM_SIZE		4096
42#define	STIC_PACKET_SIZE	4096
43#define	STIC_IMGBUF_SIZE	1280*4
44
45/*
46 * stic_xinfo: info about the board that can't be gleaned using the generic
47 * wscons interfaces.
48 */
49struct stic_xinfo {
50	int	sxi_stampw;		/* stamp width */
51	int	sxi_stamph;		/* stamp height */
52	int	sxi_unit;		/* control device unit (-1 == none) */
53	u_int	sxi_buf_size;		/* total buffer size in bytes */
54	u_int	sxi_buf_phys;		/* buffer PA (STIC address space) */
55	u_int	sxi_buf_pktoff;		/* offset to packet buffers */
56	u_int	sxi_buf_pktcnt;		/* packet buffer count */
57	u_int	sxi_buf_imgoff;		/* offset to image buffers */
58};
59
60/*
61 * stic_xcomm: Xserver communication area.  Used to communicate with the
62 * kernel or i860 firmware when performing packet queueing or other such
63 * funkiness.
64 */
65struct stic_xcomm {
66	u_int	sxc_head;		/* Xserver submit pointer */
67	u_int	sxc_tail;		/* STIC execute pointer */
68	u_int	sxc_nreject;		/* number of rejected STIC polls */
69	u_int	sxc_nstall;		/* number of queue stalls */
70	u_int	sxc_busy;		/* true if STIC is busy */
71	u_int	sxc_reserved[8];	/* reserved for future use */
72	u_int	sxc_done[16];		/* packet completion semaphores */
73};
74
75#ifdef _KERNEL
76/*
77 * stic_xmap: a description of the area returned by mapping the board.
78 * sxm_xcomm and sxm_buf are physically contigious and of variable size as a
79 * whole; the combined size is learnt from stic_xinfo::sxi_buf_size.
80 */
81struct stic_xmap {
82	u_int8_t	sxm_stic[NBPG];			/* STIC registers */
83	u_int8_t	sxm_poll[0xc0000];		/* poll registers */
84	u_int8_t	sxm_xcomm[256 * 1024];		/* X comms area */
85};
86#endif
87
88/*
89 * ioctl interface.
90 */
91#define	STICIO_GXINFO	_IOR('S', 0, struct stic_xinfo)
92#define	STICIO_RESET	_IO('S', 1)
93#define	STICIO_START860	_IO('S', 2)	/* PXG only, may disappear */
94#define	STICIO_RESET860	_IO('S', 3)	/* PXG only, may disappear */
95#define	STICIO_STARTQ	_IO('S', 4)	/* currently PX only */
96#define	STICIO_STOPQ	_IO('S', 5)	/* currently PX only */
97
98#endif	/* !_TC_STICIO_H_ */