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