xref: /netbsd-src/sys/dev/i2o/iopspvar.h (revision cbab9cadce21ae72fac13910001079fff214cc29)
1*cbab9cadSchs /*	$NetBSD: iopspvar.h,v 1.9 2012/10/27 17:18:17 chs Exp $	*/
2d49fd135Sad 
3d49fd135Sad /*-
4e5bca80aSad  * Copyright (c) 2000, 2001, 2007 The NetBSD Foundation, Inc.
5d49fd135Sad  * All rights reserved.
6d49fd135Sad  *
7d49fd135Sad  * This code is derived from software contributed to The NetBSD Foundation
8d49fd135Sad  * by Andrew Doran.
9d49fd135Sad  *
10d49fd135Sad  * Redistribution and use in source and binary forms, with or without
11d49fd135Sad  * modification, are permitted provided that the following conditions
12d49fd135Sad  * are met:
13d49fd135Sad  * 1. Redistributions of source code must retain the above copyright
14d49fd135Sad  *    notice, this list of conditions and the following disclaimer.
15d49fd135Sad  * 2. Redistributions in binary form must reproduce the above copyright
16d49fd135Sad  *    notice, this list of conditions and the following disclaimer in the
17d49fd135Sad  *    documentation and/or other materials provided with the distribution.
18d49fd135Sad  *
19d49fd135Sad  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20d49fd135Sad  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21d49fd135Sad  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22d49fd135Sad  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23d49fd135Sad  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24d49fd135Sad  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25d49fd135Sad  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26d49fd135Sad  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27d49fd135Sad  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28d49fd135Sad  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29d49fd135Sad  * POSSIBILITY OF SUCH DAMAGE.
30d49fd135Sad  */
31d49fd135Sad 
32d49fd135Sad #ifndef _I2O_IOPSPVAR_H_
33d49fd135Sad #define	_I2O_IOPSPVAR_H_
34d49fd135Sad 
35937a7a3eSbouyer #define	IOPSP_MAX_LUN		8
36d49fd135Sad #define	IOPSP_MAX_SCSI_TARGET	15
3703e46dc8Sad #define	IOPSP_MAX_FC_TARGET	127
38d49fd135Sad 
39937a7a3eSbouyer #define	IOPSP_TIDMAP(map, t, l)	(map[(t) * IOPSP_MAX_LUN + (l)])
40d49fd135Sad #define	IOPSP_TID_ABSENT	0x0000	/* Device is absent */
41d49fd135Sad #define	IOPSP_TID_INUSE		0xffff	/* Device in use by another module */
42d49fd135Sad 
43d49fd135Sad struct iopsp_target {
44d49fd135Sad 	u_int8_t	it_width;
45d49fd135Sad 	u_int8_t	it_syncrate;
46d49fd135Sad 	u_int8_t	it_offset;
47d49fd135Sad 	u_int8_t	it_flags;
48d49fd135Sad };
49d49fd135Sad #define	IT_PRESENT		0x01	/* Target is present */
50d49fd135Sad 
51d49fd135Sad struct iopsp_softc {
52*cbab9cadSchs 	device_t sc_dev;			/* Generic device data */
53d49fd135Sad 	struct	scsipi_adapter sc_adapter;	/* scsipi adapter */
54937a7a3eSbouyer 	struct	scsipi_channel sc_channel;	/* Prototype link */
55d49fd135Sad 	struct	iop_initiator sc_ii;		/* I2O initiator state */
560129c52cSad 	u_short	*sc_tidmap;			/* Target/LUN -> TID map */
57ebf51109Sad 	u_int	sc_chgind;			/* Last LCT change # */
58434a4243Sthorpej 	int	sc_openings;			/* # command openings */
59d49fd135Sad 	struct	iopsp_target *sc_targetmap;	/* Target information */
60d49fd135Sad };
61d49fd135Sad 
62d49fd135Sad #endif	/* !_I2O_IOPSPVAR_H_ */
63