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