xref: /onnv-gate/usr/src/uts/common/sys/emul64cmd.h (revision 85:1bca8d4eab66)
1*85Scth /*
2*85Scth  * CDDL HEADER START
3*85Scth  *
4*85Scth  * The contents of this file are subject to the terms of the
5*85Scth  * Common Development and Distribution License, Version 1.0 only
6*85Scth  * (the "License").  You may not use this file except in compliance
7*85Scth  * with the License.
8*85Scth  *
9*85Scth  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*85Scth  * or http://www.opensolaris.org/os/licensing.
11*85Scth  * See the License for the specific language governing permissions
12*85Scth  * and limitations under the License.
13*85Scth  *
14*85Scth  * When distributing Covered Code, include this CDDL HEADER in each
15*85Scth  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*85Scth  * If applicable, add the following below this CDDL HEADER, with the
17*85Scth  * fields enclosed by brackets "[]" replaced with your own identifying
18*85Scth  * information: Portions Copyright [yyyy] [name of copyright owner]
19*85Scth  *
20*85Scth  * CDDL HEADER END
21*85Scth  */
22*85Scth /*
23*85Scth  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*85Scth  * Use is subject to license terms.
25*85Scth  */
26*85Scth 
27*85Scth #ifndef _SYS_SCSI_ADAPTERS_EMUL64CMD_H
28*85Scth #define	_SYS_SCSI_ADAPTERS_EMUL64CMD_H
29*85Scth 
30*85Scth #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*85Scth 
32*85Scth #include <sys/scsi/scsi_types.h>
33*85Scth 
34*85Scth #ifdef	__cplusplus
35*85Scth extern "C" {
36*85Scth #endif
37*85Scth 
38*85Scth #define	PKT2CMD(pkt)		((struct emul64_cmd *)(pkt)->pkt_ha_private)
39*85Scth #define	CMD2PKT(sp)		((sp)->cmd_pkt)
40*85Scth 
41*85Scth /*
42*85Scth  * Per-command EMUL64 private data
43*85Scth  *
44*85Scth  *	- Allocated at same time as scsi_pkt by scsi_hba_pkt_alloc(9E)
45*85Scth  *	- Pointed to by pkt_ha_private field in scsi_pkt
46*85Scth  */
47*85Scth struct emul64_cmd {
48*85Scth 
49*85Scth 	struct scsi_pkt		*cmd_pkt;	/* scsi_pkt reference */
50*85Scth 	struct emul64_cmd		*cmd_forw;	/* queue link */
51*85Scth 	unsigned char		*cmd_addr;	/* b_un.b_addr */
52*85Scth 	clock_t			cmd_deadline;	/* cmd completion time */
53*85Scth 	uint32_t		cmd_flags;	/* private flags */
54*85Scth 	uint32_t		cmd_count;	/* b_bcount */
55*85Scth 	uint_t			cmd_cdblen;	/* length of cdb */
56*85Scth 	uint_t			cmd_scblen;	/* length of scb */
57*85Scth 	struct emul64		*cmd_emul64;
58*85Scth };
59*85Scth 
60*85Scth 
61*85Scth 
62*85Scth /*
63*85Scth  * These are the defined flags for this structure.
64*85Scth  */
65*85Scth #define	CFLAG_FINISHED		0x0001	/* command completed */
66*85Scth #define	CFLAG_COMPLETED		0x0002	/* completion routine called */
67*85Scth #define	CFLAG_IN_TRANSPORT	0x0004	/* in use by emul64 driver */
68*85Scth #define	CFLAG_TRANFLAG		0x000f	/* transport part of flags */
69*85Scth #define	CFLAG_DMAVALID		0x0010	/* dma mapping valid */
70*85Scth #define	CFLAG_DMASEND		0x0020	/* data is going 'out' */
71*85Scth #define	CFLAG_CMDIOPB		0x0040	/* this is an 'iopb' packet */
72*85Scth #define	CFLAG_FREE		0x0080	/* packet is on free list */
73*85Scth #define	CFLAG_DMA_PARTIAL	0x0100	/* partial xfer OK */
74*85Scth 
75*85Scth #ifdef	__cplusplus
76*85Scth }
77*85Scth #endif
78*85Scth 
79*85Scth #endif	/* _SYS_SCSI_ADAPTERS_EMUL64CMD_H */
80