xref: /netbsd-src/sys/dev/i2o/iopio.h (revision e2710f6fc49b7ec163aad7615cffe77a9607ce4c)
1*e2710f6fSandvar /*	$NetBSD: iopio.h,v 1.9 2022/04/17 21:24:53 andvar Exp $	*/
2ef80e73aSad 
3ef80e73aSad /*-
4ef80e73aSad  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
5ef80e73aSad  * All rights reserved.
6ef80e73aSad  *
7ef80e73aSad  * This code is derived from software contributed to The NetBSD Foundation
8ef80e73aSad  * by Andrew Doran.
9ef80e73aSad  *
10ef80e73aSad  * Redistribution and use in source and binary forms, with or without
11ef80e73aSad  * modification, are permitted provided that the following conditions
12ef80e73aSad  * are met:
13ef80e73aSad  * 1. Redistributions of source code must retain the above copyright
14ef80e73aSad  *    notice, this list of conditions and the following disclaimer.
15ef80e73aSad  * 2. Redistributions in binary form must reproduce the above copyright
16ef80e73aSad  *    notice, this list of conditions and the following disclaimer in the
17ef80e73aSad  *    documentation and/or other materials provided with the distribution.
18ef80e73aSad  *
19ef80e73aSad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20ef80e73aSad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21ef80e73aSad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22ef80e73aSad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23ef80e73aSad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24ef80e73aSad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25ef80e73aSad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26ef80e73aSad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27ef80e73aSad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28ef80e73aSad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29ef80e73aSad  * POSSIBILITY OF SUCH DAMAGE.
30ef80e73aSad  */
31ef80e73aSad 
32ef80e73aSad #ifndef _I2O_IOPIO_H_
33ef80e73aSad #define	_I2O_IOPIO_H_
34ef80e73aSad 
3579203164Sriastradh #include <sys/types.h>
361fbab01aSdholland #include <sys/ioccom.h>
371fbab01aSdholland 
38ef80e73aSad #define	IOP_MAX_MSG_XFERS	3	/* Maximum transfer count per msg */
39ef80e73aSad #define	IOP_MAX_OUTBOUND	256	/* Maximum outbound queue depth */
40ef80e73aSad #define	IOP_MAX_INBOUND		256	/* Maximum inbound queue depth */
41ef80e73aSad #define	IOP_MF_RESERVE		4	/* Frames to reserve for ctl ops */
42ef80e73aSad #define	IOP_MAX_XFER		64*1024	/* Maximum transfer size */
4340470684Sad #define	IOP_MAX_MSG_SIZE	160	/* Maximum message frame size */
44*e2710f6fSandvar #define	IOP_MIN_MSG_SIZE	128	/* Minimum size supported by IOP */
45ef80e73aSad 
46ef80e73aSad struct iop_tidmap {
47ef80e73aSad 	u_short	it_tid;
48ef80e73aSad 	u_short	it_flags;
496127f4edSdyoung 	char	it_dvname[16];
50ef80e73aSad };
51ef80e73aSad #define	IT_CONFIGURED	0x02	/* target configured */
52ef80e73aSad 
53ef80e73aSad struct ioppt_buf {
54ef80e73aSad 	void	*ptb_data;	/* pointer to buffer */
55ef80e73aSad 	size_t	ptb_datalen;	/* buffer size in bytes */
56ef80e73aSad 	int	ptb_out;	/* non-zero if transfer is to IOP */
57ef80e73aSad };
58ef80e73aSad 
59ef80e73aSad struct ioppt {
60ef80e73aSad 	void	*pt_msg;	/* pointer to message buffer */
61ef80e73aSad 	size_t	pt_msglen;	/* message buffer size in bytes */
62ef80e73aSad 	void	*pt_reply;	/* pointer to reply buffer */
63ef80e73aSad 	size_t	pt_replylen;	/* reply buffer size in bytes */
64ef80e73aSad 	int	pt_timo;	/* completion timeout in ms */
65ef80e73aSad 	int	pt_nbufs;	/* number of transfers */
66ef80e73aSad 	struct	ioppt_buf pt_bufs[IOP_MAX_MSG_XFERS]; /* transfers */
67ef80e73aSad };
68ef80e73aSad 
69ef80e73aSad #define	IOPIOCPT	_IOWR('u', 0, struct ioppt)
70ef80e73aSad #define	IOPIOCGLCT	_IOWR('u', 1, struct iovec)
71ef80e73aSad #define	IOPIOCGSTATUS	_IOWR('u', 2, struct iovec)
72ef80e73aSad #define	IOPIOCRECONFIG	_IO('u', 3)
73ef80e73aSad #define	IOPIOCGTIDMAP	_IOWR('u', 4, struct iovec)
74ef80e73aSad 
75ef80e73aSad #endif	/* !_I2O_IOPIO_H_ */
76