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