xref: /illumos-gate/usr/src/uts/common/sys/emul64cmd.h (revision 2d6eb4a5)
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 #include <sys/scsi/scsi_types.h>
31*b1dd958fScth 
32*b1dd958fScth #ifdef	__cplusplus
33*b1dd958fScth extern "C" {
34*b1dd958fScth #endif
35*b1dd958fScth 
36*b1dd958fScth #define	PKT2CMD(pkt)		((struct emul64_cmd *)(pkt)->pkt_ha_private)
37*b1dd958fScth #define	CMD2PKT(sp)		((sp)->cmd_pkt)
38*b1dd958fScth 
39*b1dd958fScth /*
40*b1dd958fScth  * Per-command EMUL64 private data
41*b1dd958fScth  *
42*b1dd958fScth  *	- Allocated at same time as scsi_pkt by scsi_hba_pkt_alloc(9E)
43*b1dd958fScth  *	- Pointed to by pkt_ha_private field in scsi_pkt
44*b1dd958fScth  */
45*b1dd958fScth struct emul64_cmd {
46*b1dd958fScth 
47*b1dd958fScth 	struct scsi_pkt		*cmd_pkt;	/* scsi_pkt reference */
48*b1dd958fScth 	struct emul64_cmd		*cmd_forw;	/* queue link */
49*b1dd958fScth 	unsigned char		*cmd_addr;	/* b_un.b_addr */
50*b1dd958fScth 	clock_t			cmd_deadline;	/* cmd completion time */
51*b1dd958fScth 	uint32_t		cmd_flags;	/* private flags */
52*b1dd958fScth 	uint32_t		cmd_count;	/* b_bcount */
53*b1dd958fScth 	uint_t			cmd_cdblen;	/* length of cdb */
54*b1dd958fScth 	uint_t			cmd_scblen;	/* length of scb */
55*b1dd958fScth 	struct emul64		*cmd_emul64;
56*b1dd958fScth };
57*b1dd958fScth 
58*b1dd958fScth 
59*b1dd958fScth 
60*b1dd958fScth /*
61*b1dd958fScth  * These are the defined flags for this structure.
62*b1dd958fScth  */
63*b1dd958fScth #define	CFLAG_FINISHED		0x0001	/* command completed */
64*b1dd958fScth #define	CFLAG_COMPLETED		0x0002	/* completion routine called */
65*b1dd958fScth #define	CFLAG_IN_TRANSPORT	0x0004	/* in use by emul64 driver */
66*b1dd958fScth #define	CFLAG_TRANFLAG		0x000f	/* transport part of flags */
67*b1dd958fScth #define	CFLAG_DMAVALID		0x0010	/* dma mapping valid */
68*b1dd958fScth #define	CFLAG_DMASEND		0x0020	/* data is going 'out' */
69*b1dd958fScth #define	CFLAG_CMDIOPB		0x0040	/* this is an 'iopb' packet */
70*b1dd958fScth #define	CFLAG_FREE		0x0080	/* packet is on free list */
71*b1dd958fScth #define	CFLAG_DMA_PARTIAL	0x0100	/* partial xfer OK */
72*b1dd958fScth 
73*b1dd958fScth #ifdef	__cplusplus
74*b1dd958fScth }
75*b1dd958fScth #endif
76*b1dd958fScth 
77*b1dd958fScth #endif	/* _SYS_SCSI_ADAPTERS_EMUL64CMD_H */
78