xref: /titanic_44/usr/src/uts/common/sys/1394/ixl1394.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_1394_IXL1394_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_1394_IXL1394_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  * ixl1394.h
34*7c478bd9Sstevel@tonic-gate  *    Contains all defines and structures necessary for Isochronous Transfer
35*7c478bd9Sstevel@tonic-gate  *    Language (IXL) programs. IXL programs are used to specify the transmission
36*7c478bd9Sstevel@tonic-gate  *    or receipt of isochronous packets for an isochronous channel.
37*7c478bd9Sstevel@tonic-gate  */
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
40*7c478bd9Sstevel@tonic-gate extern "C" {
41*7c478bd9Sstevel@tonic-gate #endif
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #include <sys/note.h>
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate /*
46*7c478bd9Sstevel@tonic-gate  * Error codes for IXL program compilation and dynamic update
47*7c478bd9Sstevel@tonic-gate  * Comments indicate which are source of error
48*7c478bd9Sstevel@tonic-gate  * NOTE: Make sure IXL1394_COMP_ERR_LAST is updated if a new error code is
49*7c478bd9Sstevel@tonic-gate  * added. t1394_errmsg.c uses *FIRST and *LAST as bounds checks.
50*7c478bd9Sstevel@tonic-gate  */
51*7c478bd9Sstevel@tonic-gate #define	IXL1394_EMEM_ALLOC_FAIL		(-301)	/* compile only */
52*7c478bd9Sstevel@tonic-gate #define	IXL1394_EBAD_IXL_OPCODE		(-302)	/* compile only */
53*7c478bd9Sstevel@tonic-gate #define	IXL1394_EFRAGMENT_OFLO		(-303)	/* compile only */
54*7c478bd9Sstevel@tonic-gate #define	IXL1394_ENO_DATA_PKTS		(-304)	/* compile only */
55*7c478bd9Sstevel@tonic-gate #define	IXL1394_EMISPLACED_RECV		(-305)	/* compile only */
56*7c478bd9Sstevel@tonic-gate #define	IXL1394_EMISPLACED_SEND		(-306)	/* compile only */
57*7c478bd9Sstevel@tonic-gate #define	IXL1394_EPKT_HDR_MISSING	(-307)	/* compile & update */
58*7c478bd9Sstevel@tonic-gate #define	IXL1394_ENULL_BUFFER_ADDR	(-308)	/* compile only */
59*7c478bd9Sstevel@tonic-gate #define	IXL1394_EPKTSIZE_MAX_OFLO	(-309)	/* compile & update */
60*7c478bd9Sstevel@tonic-gate #define	IXL1394_EPKTSIZE_RATIO		(-310)	/* compile only */
61*7c478bd9Sstevel@tonic-gate #define	IXL1394_EUNAPPLIED_SET_CMD	(-311)	/* compile only */
62*7c478bd9Sstevel@tonic-gate #define	IXL1394_EDUPLICATE_SET_CMD	(-312)	/* compile only */
63*7c478bd9Sstevel@tonic-gate #define	IXL1394_EJUMP_NOT_TO_LABEL	(-313)	/* compile & update */
64*7c478bd9Sstevel@tonic-gate #define	IXL1394_EUPDATE_DISALLOWED	(-314)	/* compile & update */
65*7c478bd9Sstevel@tonic-gate #define	IXL1394_EBAD_SKIPMODE		(-315)	/* compile & update */
66*7c478bd9Sstevel@tonic-gate #define	IXL1394_EWRONG_XR_CMD_MODE	(-316)	/* compile only */
67*7c478bd9Sstevel@tonic-gate #define	IXL1394_EINTERNAL_ERROR		(-317)	/* compile & update */
68*7c478bd9Sstevel@tonic-gate #define	IXL1394_ENOT_IMPLEMENTED	(-318)	/* compile only */
69*7c478bd9Sstevel@tonic-gate #define	IXL1394_EOPCODE_MISMATCH	(-319)	/* update only */
70*7c478bd9Sstevel@tonic-gate #define	IXL1394_EOPCODE_DISALLOWED	(-320)	/* update only */
71*7c478bd9Sstevel@tonic-gate #define	IXL1394_EBAD_SKIP_LABEL		(-321)	/* update only */
72*7c478bd9Sstevel@tonic-gate #define	IXL1394_EXFER_BUF_MISSING	(-322)	/* update only */
73*7c478bd9Sstevel@tonic-gate #define	IXL1394_EXFER_BUF_CNT_DIFF	(-323)	/* update only */
74*7c478bd9Sstevel@tonic-gate #define	IXL1394_EORIG_IXL_CORRUPTED	(-324)	/* update only */
75*7c478bd9Sstevel@tonic-gate #define	IXL1394_ECOUNT_MISMATCH		(-325)	/* update only */
76*7c478bd9Sstevel@tonic-gate #define	IXL1394_EPRE_UPD_DMALOST	(-326)	/* update only */
77*7c478bd9Sstevel@tonic-gate #define	IXL1394_EPOST_UPD_DMALOST	(-327)	/* update only */
78*7c478bd9Sstevel@tonic-gate #define	IXL1394_ERISK_PROHIBITS_UPD	(-328)	/* update only */
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate #define	IXL1394_COMP_ERR_FIRST		IXL1394_EMEM_ALLOC_FAIL
81*7c478bd9Sstevel@tonic-gate #define	IXL1394_COMP_ERR_LAST		IXL1394_ERISK_PROHIBITS_UPD
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate #define	IXL1394_ENO_DMA_RESRCS		(-200)
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate /*
87*7c478bd9Sstevel@tonic-gate  * IXL command opcodes
88*7c478bd9Sstevel@tonic-gate  *
89*7c478bd9Sstevel@tonic-gate  * IXL opcodes contain a unique opcode identifier and various flags to
90*7c478bd9Sstevel@tonic-gate  * speed compilation.
91*7c478bd9Sstevel@tonic-gate  */
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate /* 5 flag bits at high end of opcode field. */
94*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_MASK	0xF800
95*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_UPDATE	0x8000	/* cmd update allowed during exec */
96*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ONRECV	0x4000	/* cmd is allowed on recv */
97*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ONXMIT	0x2000	/* cmd is allowed on xmit */
98*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ENDSXFER	0x1000	/* cmd ends cur pkt xfer build */
99*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ISXFER	0x0800	/* cmd is data transfer command */
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate /* Useful flag composites. */
102*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ONXFER	(IXL1394_OPF_ONXMIT | IXL1394_OPF_ONRECV)
103*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ONXFER_ENDS (IXL1394_OPF_ONXFER | IXL1394_OPF_ENDSXFER)
104*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ONRECV_ENDS (IXL1394_OPF_ONRECV | IXL1394_OPF_ENDSXFER)
105*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPF_ONXMIT_ENDS (IXL1394_OPF_ONXMIT | IXL1394_OPF_ENDSXFER)
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate /* 2 type bits whose contents are interpreted based on isxr setting */
108*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPTY_MASK		0x0600
109*7c478bd9Sstevel@tonic-gate 
110*7c478bd9Sstevel@tonic-gate /* type bits when isxfer == 0 */
111*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPTY_OTHER		0x0000
112*7c478bd9Sstevel@tonic-gate 
113*7c478bd9Sstevel@tonic-gate /* type bits when isxr == 1 */
114*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPTY_XFER_PKT		(0x0000 | IXL1394_OPF_ISXFER)
115*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPTY_XFER_PKT_ST	(0x0200 | IXL1394_OPF_ISXFER)
116*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPTY_XFER_BUF_ST	(0x0400 | IXL1394_OPF_ISXFER)
117*7c478bd9Sstevel@tonic-gate #define	IXL1394_OPTY_XFER_SPCL_ST	(0x0600 | IXL1394_OPF_ISXFER)
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate /*
120*7c478bd9Sstevel@tonic-gate  * IXL Command Opcodes.
121*7c478bd9Sstevel@tonic-gate  */
122*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_LABEL    (1 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER_ENDS)
123*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_JUMP	    (2 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER_ENDS)
124*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_CALLBACK (3 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER)
125*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_RECV_PKT (4 | IXL1394_OPTY_XFER_PKT | IXL1394_OPF_ONRECV)
126*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_RECV_PKT_ST \
127*7c478bd9Sstevel@tonic-gate 		(5 | IXL1394_OPTY_XFER_PKT_ST |	IXL1394_OPF_ONRECV_ENDS)
128*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_RECV_BUF \
129*7c478bd9Sstevel@tonic-gate 		(6 | IXL1394_OPTY_XFER_BUF_ST |	IXL1394_OPF_ONRECV_ENDS)
130*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_PKT (7 | IXL1394_OPTY_XFER_PKT | IXL1394_OPF_ONXMIT)
131*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_PKT_ST \
132*7c478bd9Sstevel@tonic-gate 		(8 | IXL1394_OPTY_XFER_PKT_ST |	IXL1394_OPF_ONXMIT_ENDS)
133*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_PKT_WHDR_ST \
134*7c478bd9Sstevel@tonic-gate 		(9  | IXL1394_OPTY_XFER_PKT_ST | IXL1394_OPF_ONXMIT_ENDS)
135*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_BUF \
136*7c478bd9Sstevel@tonic-gate 		(10 | IXL1394_OPTY_XFER_BUF_ST | IXL1394_OPF_ONXMIT_ENDS)
137*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_HDR_ONLY \
138*7c478bd9Sstevel@tonic-gate 		(12 | IXL1394_OPTY_XFER_SPCL_ST | IXL1394_OPF_ONXMIT_ENDS)
139*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_NO_PKT \
140*7c478bd9Sstevel@tonic-gate 		(13 | IXL1394_OPTY_XFER_SPCL_ST | IXL1394_OPF_ONXMIT_ENDS)
141*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_STORE_TIMESTAMP \
142*7c478bd9Sstevel@tonic-gate 		(14 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER)
143*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SET_TAGSYNC \
144*7c478bd9Sstevel@tonic-gate 		(15 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXMIT_ENDS)
145*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SET_SKIPMODE \
146*7c478bd9Sstevel@tonic-gate 		(16 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXMIT_ENDS)
147*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SET_SYNCWAIT \
148*7c478bd9Sstevel@tonic-gate 		(17 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONRECV_ENDS)
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate /*
151*7c478bd9Sstevel@tonic-gate  * The dynamic UPDATE versions of each updatable command.
152*7c478bd9Sstevel@tonic-gate  */
153*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_JUMP_U	(IXL1394_OP_JUMP | IXL1394_OPF_UPDATE)
154*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_CALLBACK_U	(IXL1394_OP_CALLBACK | IXL1394_OPF_UPDATE)
155*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_RECV_PKT_U	(IXL1394_OP_RECV_PKT | IXL1394_OPF_UPDATE)
156*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_RECV_PKT_ST_U (IXL1394_OP_RECV_PKT_ST | IXL1394_OPF_UPDATE)
157*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_RECV_BUF_U	(IXL1394_OP_RECV_BUF | IXL1394_OPF_UPDATE)
158*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_PKT_U	(IXL1394_OP_SEND_PKT | IXL1394_OPF_UPDATE)
159*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_PKT_ST_U (IXL1394_OP_SEND_PKT_ST | IXL1394_OPF_UPDATE)
160*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_PKT_WHDR_ST_U (IXL1394_OP_SEND_PKT_WHDR_ST |	\
161*7c478bd9Sstevel@tonic-gate 	    IXL1394_OPF_UPDATE)
162*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SEND_BUF_U	(IXL1394_OP_SEND_BUF | IXL1394_OPF_UPDATE)
163*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SET_TAGSYNC_U (IXL1394_OP_SET_TAGSYNC | IXL1394_OPF_UPDATE)
164*7c478bd9Sstevel@tonic-gate #define	IXL1394_OP_SET_SKIPMODE_U (IXL1394_OP_SET_SKIPMODE | IXL1394_OPF_UPDATE)
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate /* Opaque type for the ixl private data */
168*7c478bd9Sstevel@tonic-gate typedef struct ixl_priv_handle	*ixl1394_priv_t;
169*7c478bd9Sstevel@tonic-gate 
170*7c478bd9Sstevel@tonic-gate /* IXL1394_OP_SET_SKIPMODE values (used only with isoch transmit) */
171*7c478bd9Sstevel@tonic-gate typedef enum {
172*7c478bd9Sstevel@tonic-gate 	IXL1394_SKIP_TO_SELF	= 0,
173*7c478bd9Sstevel@tonic-gate 	IXL1394_SKIP_TO_NEXT	= 1,
174*7c478bd9Sstevel@tonic-gate 	IXL1394_SKIP_TO_STOP	= 2,
175*7c478bd9Sstevel@tonic-gate 	IXL1394_SKIP_TO_LABEL	= 3
176*7c478bd9Sstevel@tonic-gate } ixl1394_skip_t;
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate /*
179*7c478bd9Sstevel@tonic-gate  * IXL Program Command Primitives
180*7c478bd9Sstevel@tonic-gate  */
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate /* The general command format.  The operands vary depending on the opcode */
183*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_command {
184*7c478bd9Sstevel@tonic-gate 	struct ixl1394_command	*next_ixlp;
185*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
186*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
187*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
188*7c478bd9Sstevel@tonic-gate 	uint32_t		operands[1];
189*7c478bd9Sstevel@tonic-gate } ixl1394_command_t;
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
192*7c478bd9Sstevel@tonic-gate 	ixl1394_command::compiler_privatep \
193*7c478bd9Sstevel@tonic-gate 	ixl1394_command::compiler_resv))
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate /*
196*7c478bd9Sstevel@tonic-gate  * command structure used for a DDI_DMA bound buffer. For portability,
197*7c478bd9Sstevel@tonic-gate  * set this _dmac_ll to the buffer's allocated and bound
198*7c478bd9Sstevel@tonic-gate  * ddi_dma_cookie_t's _dmac_ll.
199*7c478bd9Sstevel@tonic-gate  */
200*7c478bd9Sstevel@tonic-gate typedef union ixl1394_buf_u {
201*7c478bd9Sstevel@tonic-gate 	uint64_t		_dmac_ll;	/* 64-bit DMA address */
202*7c478bd9Sstevel@tonic-gate 	uint32_t		_dmac_la[2];	/* 2 x 32-bit address */
203*7c478bd9Sstevel@tonic-gate } ixl1394_buf_t;
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate /* shorthand access to IXL command buffers.  similar to defs in dditypes.h */
206*7c478bd9Sstevel@tonic-gate #define	ixldmac_laddr	_dmac_ll
207*7c478bd9Sstevel@tonic-gate #ifdef _LONG_LONG_HTOL
208*7c478bd9Sstevel@tonic-gate #define	ixldmac_notused	_dmac_la[0]
209*7c478bd9Sstevel@tonic-gate #define	ixldmac_addr	_dmac_la[1]
210*7c478bd9Sstevel@tonic-gate #else
211*7c478bd9Sstevel@tonic-gate #define	ixldmac_addr	_dmac_la[0]
212*7c478bd9Sstevel@tonic-gate #define	ixldmac_notused	_dmac_la[1]
213*7c478bd9Sstevel@tonic-gate #endif
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate /*
217*7c478bd9Sstevel@tonic-gate  * ixl1394_xfer_pkt
218*7c478bd9Sstevel@tonic-gate  * Specifies a packet fragment.
219*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_SEND_PKT_ST, IXL1394_OP_SEND_PKT_WHDR_ST,
220*7c478bd9Sstevel@tonic-gate  * IXL1394_OP_SEND_PKT, IXL1394_OP_RECV_PKT_ST and IXL1394_OP_RECV_PKT.
221*7c478bd9Sstevel@tonic-gate  */
222*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_xfer_pkt {
223*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
224*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
225*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
226*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
227*7c478bd9Sstevel@tonic-gate 	uint16_t		size;		/* bytes in ixl_buf */
228*7c478bd9Sstevel@tonic-gate 	uint16_t		resv;
229*7c478bd9Sstevel@tonic-gate 	ixl1394_buf_t		ixl_buf;	/* ddi_dma bound address */
230*7c478bd9Sstevel@tonic-gate 	caddr_t			mem_bufp;	/* kernel virtual addr */
231*7c478bd9Sstevel@tonic-gate } ixl1394_xfer_pkt_t;
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
234*7c478bd9Sstevel@tonic-gate 	ixl1394_xfer_pkt::ixl_buf._dmac_ll \
235*7c478bd9Sstevel@tonic-gate         ixl1394_xfer_pkt::ixl_buf._dmac_la \
236*7c478bd9Sstevel@tonic-gate         ixl1394_xfer_pkt::mem_bufp \
237*7c478bd9Sstevel@tonic-gate         ixl1394_xfer_pkt::size))
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate /*
240*7c478bd9Sstevel@tonic-gate  * ixl1394_xfer_buf
241*7c478bd9Sstevel@tonic-gate  * Specifies a buffer of multiple packets.
242*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_SEND_BUF and IXL1394_OP_RECV_BUF.
243*7c478bd9Sstevel@tonic-gate  */
244*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_xfer_buf {
245*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
246*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
247*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
248*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
249*7c478bd9Sstevel@tonic-gate 	uint16_t		size;		/* bytes in ixl_buf */
250*7c478bd9Sstevel@tonic-gate 	uint16_t		pkt_size;	/* bytes in each packet */
251*7c478bd9Sstevel@tonic-gate 	ixl1394_buf_t		ixl_buf;	/* ddi_dma bound address */
252*7c478bd9Sstevel@tonic-gate 	caddr_t			mem_bufp;	/* kernel (not bound) addrss */
253*7c478bd9Sstevel@tonic-gate } ixl1394_xfer_buf_t;
254*7c478bd9Sstevel@tonic-gate 
255*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
256*7c478bd9Sstevel@tonic-gate 	ixl1394_xfer_buf::compiler_privatep \
257*7c478bd9Sstevel@tonic-gate 	ixl1394_xfer_buf::ixl_buf._dmac_ll \
258*7c478bd9Sstevel@tonic-gate 	ixl1394_xfer_buf::ixl_buf._dmac_la \
259*7c478bd9Sstevel@tonic-gate 	ixl1394_xfer_buf::mem_bufp \
260*7c478bd9Sstevel@tonic-gate 	ixl1394_xfer_buf::pkt_size \
261*7c478bd9Sstevel@tonic-gate 	ixl1394_xfer_buf::size))
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate /*
264*7c478bd9Sstevel@tonic-gate  * ixl1394_xmit_special
265*7c478bd9Sstevel@tonic-gate  * Specifies how many cycles are to be skipped before the next packet
266*7c478bd9Sstevel@tonic-gate  * is sent.  Specifies number of header only packets to be sent, next.
267*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_SEND_HDR_ONLY and IXL1394_OP_SEND_NO_PKT.
268*7c478bd9Sstevel@tonic-gate  */
269*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_xmit_special {
270*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
271*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
272*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
273*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
274*7c478bd9Sstevel@tonic-gate 	uint16_t		count;
275*7c478bd9Sstevel@tonic-gate 	uint16_t		resv;
276*7c478bd9Sstevel@tonic-gate } ixl1394_xmit_special_t;
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate /*
279*7c478bd9Sstevel@tonic-gate  * ixl1394_callback
280*7c478bd9Sstevel@tonic-gate  * Specifies a callback function and callback data.
281*7c478bd9Sstevel@tonic-gate  * When the callback is invoked, it is passed the addr of this IXL
282*7c478bd9Sstevel@tonic-gate  * command, which it can use to retrieve the arg it has stored in
283*7c478bd9Sstevel@tonic-gate  * this struct. Used with IXL1394_OP_CALLBACK.
284*7c478bd9Sstevel@tonic-gate  */
285*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_callback {
286*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t   *next_ixlp;
287*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t	    compiler_privatep;
288*7c478bd9Sstevel@tonic-gate 	uint16_t	    compiler_resv;
289*7c478bd9Sstevel@tonic-gate 	uint16_t	    ixl_opcode;
290*7c478bd9Sstevel@tonic-gate 	void		    (*callback)(opaque_t, struct ixl1394_callback *);
291*7c478bd9Sstevel@tonic-gate 	opaque_t	    callback_arg;
292*7c478bd9Sstevel@tonic-gate } ixl1394_callback_t;
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
295*7c478bd9Sstevel@tonic-gate         ixl1394_callback::callback \
296*7c478bd9Sstevel@tonic-gate 	ixl1394_callback::callback_arg))
297*7c478bd9Sstevel@tonic-gate 
298*7c478bd9Sstevel@tonic-gate /*
299*7c478bd9Sstevel@tonic-gate  * ixl1394_label
300*7c478bd9Sstevel@tonic-gate  * Specifies a label (location) which can be used as the target of a jump.
301*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_LABEL.
302*7c478bd9Sstevel@tonic-gate  */
303*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_label {
304*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
305*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
306*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
307*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
308*7c478bd9Sstevel@tonic-gate } ixl1394_label_t;
309*7c478bd9Sstevel@tonic-gate 
310*7c478bd9Sstevel@tonic-gate /*
311*7c478bd9Sstevel@tonic-gate  * ixl1394_jump
312*7c478bd9Sstevel@tonic-gate  * Specifies a label (location) which can then be used as the target of a jump.
313*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_JUMP.
314*7c478bd9Sstevel@tonic-gate  */
315*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_jump {
316*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
317*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
318*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
319*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
320*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*label;
321*7c478bd9Sstevel@tonic-gate } ixl1394_jump_t;
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
324*7c478bd9Sstevel@tonic-gate 	ixl1394_jump::label))
325*7c478bd9Sstevel@tonic-gate 
326*7c478bd9Sstevel@tonic-gate /*
327*7c478bd9Sstevel@tonic-gate  * ixl1394_set_tagsync
328*7c478bd9Sstevel@tonic-gate  * Specifies the tag and sync bits used for the port.
329*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_SET_TAGSYNC.
330*7c478bd9Sstevel@tonic-gate  */
331*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_set_tagsync {
332*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
333*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
334*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
335*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
336*7c478bd9Sstevel@tonic-gate 	uint16_t		tag;
337*7c478bd9Sstevel@tonic-gate 	uint16_t		sync;
338*7c478bd9Sstevel@tonic-gate } ixl1394_set_tagsync_t;
339*7c478bd9Sstevel@tonic-gate 
340*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
341*7c478bd9Sstevel@tonic-gate 	ixl1394_set_tagsync::sync \
342*7c478bd9Sstevel@tonic-gate 	ixl1394_set_tagsync::tag))
343*7c478bd9Sstevel@tonic-gate 
344*7c478bd9Sstevel@tonic-gate /*
345*7c478bd9Sstevel@tonic-gate  * ixl1394_set_skipmode
346*7c478bd9Sstevel@tonic-gate  * Specifies the tag and sync bits used for the port.
347*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_SET_SKIPMODE.
348*7c478bd9Sstevel@tonic-gate  */
349*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_set_skipmode {
350*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
351*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
352*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
353*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
354*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t 	*label;
355*7c478bd9Sstevel@tonic-gate 	ixl1394_skip_t		skipmode;
356*7c478bd9Sstevel@tonic-gate } ixl1394_set_skipmode_t;
357*7c478bd9Sstevel@tonic-gate 
358*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
359*7c478bd9Sstevel@tonic-gate 	ixl1394_set_skipmode::compiler_privatep \
360*7c478bd9Sstevel@tonic-gate 	ixl1394_set_skipmode::label \
361*7c478bd9Sstevel@tonic-gate 	ixl1394_set_skipmode::skipmode))
362*7c478bd9Sstevel@tonic-gate 
363*7c478bd9Sstevel@tonic-gate /*
364*7c478bd9Sstevel@tonic-gate  * ixl1394_set_syncwait
365*7c478bd9Sstevel@tonic-gate  * Specifies that next receive is to wait for sync before accepting input.
366*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_SET_SYNCWAIT.
367*7c478bd9Sstevel@tonic-gate  */
368*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_set_syncwait {
369*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
370*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
371*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
372*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
373*7c478bd9Sstevel@tonic-gate } ixl1394_set_syncwait_t;
374*7c478bd9Sstevel@tonic-gate 
375*7c478bd9Sstevel@tonic-gate /*
376*7c478bd9Sstevel@tonic-gate  * ixl1394_store_timestamp
377*7c478bd9Sstevel@tonic-gate  * Specifies that the timestamp value of the most recently sent
378*7c478bd9Sstevel@tonic-gate  * packet be stored into the timestamp field of this ixl command.
379*7c478bd9Sstevel@tonic-gate  * Used with IXL1394_OP_STORE_TIMESTAMP.
380*7c478bd9Sstevel@tonic-gate  */
381*7c478bd9Sstevel@tonic-gate typedef struct ixl1394_store_timestamp {
382*7c478bd9Sstevel@tonic-gate 	ixl1394_command_t	*next_ixlp;
383*7c478bd9Sstevel@tonic-gate 	ixl1394_priv_t		compiler_privatep;
384*7c478bd9Sstevel@tonic-gate 	uint16_t		compiler_resv;
385*7c478bd9Sstevel@tonic-gate 	uint16_t		ixl_opcode;
386*7c478bd9Sstevel@tonic-gate 	uint16_t		timestamp;
387*7c478bd9Sstevel@tonic-gate 	uint16_t		resv;
388*7c478bd9Sstevel@tonic-gate } ixl1394_store_timestamp_t;
389*7c478bd9Sstevel@tonic-gate 
390*7c478bd9Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
391*7c478bd9Sstevel@tonic-gate 	ixl1394_store_timestamp::timestamp))
392*7c478bd9Sstevel@tonic-gate 
393*7c478bd9Sstevel@tonic-gate /*
394*7c478bd9Sstevel@tonic-gate  * Macros for extracting isochronous packet header fields when receiving
395*7c478bd9Sstevel@tonic-gate  * packets via IXL1394_OP_RECV_PKT_ST or IXL1394_OP_RECV_BUF with
396*7c478bd9Sstevel@tonic-gate  * ID1394_RECV_HEADERS mode enabled.
397*7c478bd9Sstevel@tonic-gate  * The argument to each macro is a quadlet of data.
398*7c478bd9Sstevel@tonic-gate  * Prior to using the macro, target drivers first retrieve this quadlet from
399*7c478bd9Sstevel@tonic-gate  * bound memory by using ddi_get32(9F).
400*7c478bd9Sstevel@tonic-gate  */
401*7c478bd9Sstevel@tonic-gate 
402*7c478bd9Sstevel@tonic-gate /*
403*7c478bd9Sstevel@tonic-gate  * timestamp is the first quadlet in an IXL1394_OP_RECV_PKT_ST packet, and is
404*7c478bd9Sstevel@tonic-gate  * the last quadlet (after the data payload) in an IXL1394_OP_RECV_BUF packet.
405*7c478bd9Sstevel@tonic-gate  */
406*7c478bd9Sstevel@tonic-gate #define	IXL1394_GET_IR_TIMESTAMP(PKT_QUADLET) ((PKT_QUADLET) & 0x0000FFFF)
407*7c478bd9Sstevel@tonic-gate 
408*7c478bd9Sstevel@tonic-gate /*
409*7c478bd9Sstevel@tonic-gate  * the following macros apply to the second quadlet in an
410*7c478bd9Sstevel@tonic-gate  * IXL1394_OP_RECV_PKT_ST packet, and the first quadlet in an
411*7c478bd9Sstevel@tonic-gate  * IXL1394_OP_RECV_BUF packet.
412*7c478bd9Sstevel@tonic-gate  */
413*7c478bd9Sstevel@tonic-gate #define	IXL1394_GET_IR_DATALEN(PKT_QUADLET) (((PKT_QUADLET) & 0xFFFF0000) >> 16)
414*7c478bd9Sstevel@tonic-gate #define	IXL1394_GET_IR_TAG(PKT_QUADLET)	    (((PKT_QUADLET) & 0x0000C000) >> 14)
415*7c478bd9Sstevel@tonic-gate #define	IXL1394_GET_IR_CHAN(PKT_QUADLET)    (((PKT_QUADLET) & 0x00003F00) >> 8)
416*7c478bd9Sstevel@tonic-gate #define	IXL1394_GET_IR_SYNC(PKT_QUADLET)    ((PKT_QUADLET) & 0x0000000F)
417*7c478bd9Sstevel@tonic-gate 
418*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
419*7c478bd9Sstevel@tonic-gate }
420*7c478bd9Sstevel@tonic-gate #endif
421*7c478bd9Sstevel@tonic-gate 
422*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_1394_IXL1394_H */
423