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