blob: 52c7ffe934ad1dd4d065314676bcc1eceed54f5e [file] [log] [blame]
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -04001/*
2 * Char device interface.
Kristian Høgsberg19a15b92006-12-19 19:58:31 -05003 *
4 * Copyright (C) 2005-2006 Kristian Hoegsberg <krh@bitplanet.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -040021#ifndef _LINUX_FIREWIRE_CDEV_H
22#define _LINUX_FIREWIRE_CDEV_H
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050023
Kristian Høgsberg04dfb8d2007-05-07 20:33:36 -040024#include <linux/ioctl.h>
25#include <linux/types.h>
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -040026#include <linux/firewire-constants.h>
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050027
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +010028#define FW_CDEV_EVENT_BUS_RESET 0x00
29#define FW_CDEV_EVENT_RESPONSE 0x01
30#define FW_CDEV_EVENT_REQUEST 0x02
31#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
32#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
33#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050034
Stefan Richtere2055972010-06-20 22:53:55 +020035/* available since kernel version 2.6.36 */
36#define FW_CDEV_EVENT_REQUEST2 0x06
37
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020038/**
39 * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
40 * @closure: For arbitrary use by userspace
41 * @type: Discriminates the fw_cdev_event_ types
42 *
43 * This struct may be used to access generic members of all fw_cdev_event_
44 * types regardless of the specific type.
45 *
46 * Data passed in the @closure field for a request will be returned in the
47 * corresponding event. It is big enough to hold a pointer on all platforms.
48 * The ioctl used to set @closure depends on the @type of event.
49 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -040050struct fw_cdev_event_common {
51 __u64 closure;
52 __u32 type;
53};
54
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020055/**
56 * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred
57 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl
58 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET
59 * @node_id: New node ID of this node
60 * @local_node_id: Node ID of the local node, i.e. of the controller
61 * @bm_node_id: Node ID of the bus manager
62 * @irm_node_id: Node ID of the iso resource manager
63 * @root_node_id: Node ID of the root node
64 * @generation: New bus generation
65 *
66 * This event is sent when the bus the device belongs to goes through a bus
67 * reset. It provides information about the new bus configuration, such as
68 * new node ID for this device, new root ID, and others.
69 */
Kristian Høgsberg97bd9ef2007-03-07 12:12:41 -050070struct fw_cdev_event_bus_reset {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -040071 __u64 closure;
Kristian Høgsberg97bd9ef2007-03-07 12:12:41 -050072 __u32 type;
73 __u32 node_id;
74 __u32 local_node_id;
75 __u32 bm_node_id;
76 __u32 irm_node_id;
77 __u32 root_node_id;
78 __u32 generation;
79};
80
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020081/**
82 * struct fw_cdev_event_response - Sent when a response packet was received
83 * @closure: See &fw_cdev_event_common;
84 * set by %FW_CDEV_IOC_SEND_REQUEST ioctl
85 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
86 * @rcode: Response code returned by the remote node
87 * @length: Data length, i.e. the response's payload size in bytes
88 * @data: Payload data, if any
89 *
90 * This event is sent when the stack receives a response to an outgoing request
91 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses
92 * carrying data (read and lock responses) follows immediately and can be
93 * accessed through the @data field.
94 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050095struct fw_cdev_event_response {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -040096 __u64 closure;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050097 __u32 type;
98 __u32 rcode;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050099 __u32 length;
100 __u32 data[0];
101};
102
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200103/**
Stefan Richtere2055972010-06-20 22:53:55 +0200104 * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200105 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
106 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
Stefan Richtere2055972010-06-20 22:53:55 +0200107 * @tcode: See &fw_cdev_event_request2
108 * @offset: See &fw_cdev_event_request2
109 * @handle: See &fw_cdev_event_request2
110 * @length: See &fw_cdev_event_request2
111 * @data: See &fw_cdev_event_request2
112 *
113 * This event is sent instead of &fw_cdev_event_request2 if the kernel or
114 * the client implements ABI version <= 3.
115 *
116 * Unlike &fw_cdev_event_request2, the sender identity cannot be established,
117 * broadcast write requests cannot be distinguished from unicast writes, and
118 * @tcode of lock requests is %TCODE_LOCK_REQUEST.
119 *
120 * Requests to the FCP_REQUEST or FCP_RESPONSE register are responded to as
121 * with &fw_cdev_event_request2, except in kernel 2.6.32 and older which send
122 * the response packet of the client's %FW_CDEV_IOC_SEND_RESPONSE ioctl.
123 */
124struct fw_cdev_event_request {
125 __u64 closure;
126 __u32 type;
127 __u32 tcode;
128 __u64 offset;
129 __u32 handle;
130 __u32 length;
131 __u32 data[0];
132};
133
134/**
135 * struct fw_cdev_event_request2 - Sent on incoming request to an address region
136 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
137 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200138 * @tcode: Transaction code of the incoming request
139 * @offset: The offset into the 48-bit per-node address space
Stefan Richtere2055972010-06-20 22:53:55 +0200140 * @source_node_id: Sender node ID
141 * @destination_node_id: Destination node ID
142 * @card: The index of the card from which the request came
143 * @generation: Bus generation in which the request is valid
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200144 * @handle: Reference to the kernel-side pending request
145 * @length: Data length, i.e. the request's payload size in bytes
146 * @data: Incoming data, if any
147 *
148 * This event is sent when the stack receives an incoming request to an address
149 * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is
150 * guaranteed to be completely contained in the specified region. Userspace is
151 * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl,
152 * using the same @handle.
153 *
154 * The payload data for requests carrying data (write and lock requests)
155 * follows immediately and can be accessed through the @data field.
Stefan Richtere2055972010-06-20 22:53:55 +0200156 *
157 * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the
158 * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT,
159 * i.e. encodes the extended transaction code.
160 *
161 * @card may differ from &fw_cdev_get_info.card because requests are received
162 * from all cards of the Linux host. @source_node_id, @destination_node_id, and
163 * @generation pertain to that card. Destination node ID and bus generation may
164 * therefore differ from the corresponding fields of the last
165 * &fw_cdev_event_bus_reset.
166 *
167 * @destination_node_id may also differ from the current node ID because of a
168 * non-local bus ID part or in case of a broadcast write request. Note, a
169 * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a
170 * broadcast write request; the kernel will then release the kernel-side pending
171 * request but will not actually send a response packet.
172 *
173 * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already
174 * sent a write response immediately after the request was received; in this
175 * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to
176 * release the kernel-side pending request, though another response won't be
177 * sent.
178 *
179 * If the client subsequently needs to initiate requests to the sender node of
180 * an &fw_cdev_event_request2, it needs to use a device file with matching
181 * card index, node ID, and generation for outbound requests.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200182 */
Stefan Richtere2055972010-06-20 22:53:55 +0200183struct fw_cdev_event_request2 {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400184 __u64 closure;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500185 __u32 type;
186 __u32 tcode;
187 __u64 offset;
Stefan Richtere2055972010-06-20 22:53:55 +0200188 __u32 source_node_id;
189 __u32 destination_node_id;
190 __u32 card;
191 __u32 generation;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400192 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500193 __u32 length;
194 __u32 data[0];
195};
196
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200197/**
198 * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed
199 * @closure: See &fw_cdev_event_common;
200 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
201 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT
202 * @cycle: Cycle counter of the interrupt packet
203 * @header_length: Total length of following headers, in bytes
204 * @header: Stripped headers, if any
205 *
206 * This event is sent when the controller has completed an &fw_cdev_iso_packet
207 * with the %FW_CDEV_ISO_INTERRUPT bit set. In the receive case, the headers
208 * stripped of all packets up until and including the interrupt packet are
Stefan Richter77258da2009-01-07 20:14:53 +0100209 * returned in the @header field. The amount of header data per packet is as
210 * specified at iso context creation by &fw_cdev_create_iso_context.header_size.
211 *
212 * In version 1 of this ABI, header data consisted of the 1394 isochronous
213 * packet header, followed by quadlets from the packet payload if
214 * &fw_cdev_create_iso_context.header_size > 4.
215 *
216 * In version 2 of this ABI, header data consist of the 1394 isochronous
217 * packet header, followed by a timestamp quadlet if
218 * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the
219 * packet payload if &fw_cdev_create_iso_context.header_size > 8.
220 *
221 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
222 *
223 * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel,
224 * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp:
225 * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte
226 * order.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200227 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500228struct fw_cdev_event_iso_interrupt {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400229 __u64 closure;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500230 __u32 type;
231 __u32 cycle;
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200232 __u32 header_length;
Kristian Høgsberg9b32d5f2007-02-16 17:34:44 -0500233 __u32 header[0];
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500234};
235
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200236/**
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100237 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
238 * @closure: See &fw_cdev_event_common;
Stefan Richter1ec3c022009-01-04 16:23:29 +0100239 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100240 * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
241 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
242 * @handle: Reference by which an allocated resource can be deallocated
243 * @channel: Isochronous channel which was (de)allocated, if any
244 * @bandwidth: Bandwidth allocation units which were (de)allocated, if any
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100245 *
246 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
247 * resource was allocated at the IRM. The client has to check @channel and
248 * @bandwidth for whether the allocation actually succeeded.
249 *
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100250 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
251 * resource was deallocated at the IRM. It is also sent when automatic
252 * reallocation after a bus reset failed.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100253 *
254 * @channel is <0 if no channel was (de)allocated or if reallocation failed.
255 * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100256 */
257struct fw_cdev_event_iso_resource {
258 __u64 closure;
259 __u32 type;
260 __u32 handle;
261 __s32 channel;
262 __s32 bandwidth;
263};
264
265/**
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200266 * union fw_cdev_event - Convenience union of fw_cdev_event_ types
267 * @common: Valid for all types
268 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
269 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
270 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
Stefan Richtere2055972010-06-20 22:53:55 +0200271 * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200272 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100273 * @iso_resource: Valid if @common.type ==
274 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
275 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200276 *
Jay Fenlasonbe585c02008-10-01 18:13:20 -0400277 * Convenience union for userspace use. Events could be read(2) into an
278 * appropriately aligned char buffer and then cast to this union for further
279 * processing. Note that for a request, response or iso_interrupt event,
280 * the data[] or header[] may make the size of the full event larger than
281 * sizeof(union fw_cdev_event). Also note that if you attempt to read(2)
282 * an event into a buffer that is not large enough for it, the data that does
283 * not fit will be discarded so that the next read(2) will return a new event.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200284 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400285union fw_cdev_event {
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100286 struct fw_cdev_event_common common;
287 struct fw_cdev_event_bus_reset bus_reset;
288 struct fw_cdev_event_response response;
289 struct fw_cdev_event_request request;
Stefan Richtere2055972010-06-20 22:53:55 +0200290 struct fw_cdev_event_request2 request2; /* added in 2.6.36 */
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100291 struct fw_cdev_event_iso_interrupt iso_interrupt;
Stefan Richter604f4512010-06-20 22:52:55 +0200292 struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400293};
294
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100295/* available since kernel version 2.6.22 */
Stefan Richterc8a25902009-03-10 20:59:16 +0100296#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info)
297#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request)
298#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate)
299#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate)
300#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response)
301#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
302#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
303#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
304#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
305#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso)
306#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
307#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100308
309/* available since kernel version 2.6.24 */
Stefan Richterc8a25902009-03-10 20:59:16 +0100310#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500311
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100312/* available since kernel version 2.6.30 */
Stefan Richter1ec3c022009-01-04 16:23:29 +0100313#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
314#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate)
315#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
316#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
Stefan Richterc8a25902009-03-10 20:59:16 +0100317#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */
Jay Fenlason, Stefan Richteracfe8332009-01-04 16:23:29 +0100318#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100319#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100320
Stefan Richterabfe5a02010-02-20 12:13:49 +0100321/* available since kernel version 2.6.34 */
322#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
323
Stefan Richter77258da2009-01-07 20:14:53 +0100324/*
Stefan Richter604f4512010-06-20 22:52:55 +0200325 * ABI version history
Stefan Richter77258da2009-01-07 20:14:53 +0100326 * 1 (2.6.22) - initial version
Stefan Richter604f4512010-06-20 22:52:55 +0200327 * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER
Stefan Richter77258da2009-01-07 20:14:53 +0100328 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
329 * &fw_cdev_create_iso_context.header_size is 8 or more
Stefan Richter604f4512010-06-20 22:52:55 +0200330 * - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
331 * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
332 * %FW_CDEV_IOC_SEND_STREAM_PACKET
Stefan Richtere94b6d72010-02-21 12:48:57 +0100333 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
334 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of
335 * dual-buffer or packet-per-buffer depending on hardware
Stefan Richtere2055972010-06-20 22:53:55 +0200336 * - shared use and auto-response for FCP registers
Stefan Richtere94b6d72010-02-21 12:48:57 +0100337 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
Stefan Richter604f4512010-06-20 22:52:55 +0200338 * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
Stefan Richtere2055972010-06-20 22:53:55 +0200339 * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500340 */
Stefan Richter604f4512010-06-20 22:52:55 +0200341#define FW_CDEV_VERSION 3 /* Meaningless; don't use this macro. */
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500342
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200343/**
344 * struct fw_cdev_get_info - General purpose information ioctl
Stefan Richter604f4512010-06-20 22:52:55 +0200345 * @version: The version field is just a running serial number. Both an
346 * input parameter (ABI version implemented by the client) and
347 * output parameter (ABI version implemented by the kernel).
348 * A client must not fill in an %FW_CDEV_VERSION defined from an
349 * included kernel header file but the actual version for which
350 * the client was implemented. This is necessary for forward
351 * compatibility. We never break backwards compatibility, but
352 * may add more structs, events, and ioctls in later revisions.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200353 * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration
354 * ROM will be copied into that user space address. In either
355 * case, @rom_length is updated with the actual length of the
356 * configuration ROM.
357 * @rom: If non-zero, address of a buffer to be filled by a copy of the
Stefan Richter632321e2009-01-02 12:47:13 +0100358 * device's configuration ROM
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200359 * @bus_reset: If non-zero, address of a buffer to be filled by a
360 * &struct fw_cdev_event_bus_reset with the current state
361 * of the bus. This does not cause a bus reset to happen.
362 * @bus_reset_closure: Value of &closure in this and subsequent bus reset events
363 * @card: The index of the card this device belongs to
364 */
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500365struct fw_cdev_get_info {
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500366 __u32 version;
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500367 __u32 rom_length;
368 __u64 rom;
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500369 __u64 bus_reset;
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400370 __u64 bus_reset_closure;
Kristian Høgsberge7533502007-03-07 12:12:52 -0500371 __u32 card;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500372};
373
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200374/**
375 * struct fw_cdev_send_request - Send an asynchronous request packet
376 * @tcode: Transaction code of the request
377 * @length: Length of outgoing payload, in bytes
378 * @offset: 48-bit offset at destination node
379 * @closure: Passed back to userspace in the response event
380 * @data: Userspace pointer to payload
381 * @generation: The bus generation where packet is valid
382 *
383 * Send a request to the device. This ioctl implements all outgoing requests.
384 * Both quadlet and block request specify the payload as a pointer to the data
385 * in the @data field. Once the transaction completes, the kernel writes an
Stefan Richterbf8e3352008-12-05 22:43:41 +0100386 * &fw_cdev_event_response event back. The @closure field is passed back to
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200387 * user space in the response event.
388 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500389struct fw_cdev_send_request {
390 __u32 tcode;
391 __u32 length;
392 __u64 offset;
393 __u64 closure;
394 __u64 data;
Kristian Høgsberg97e35272007-03-07 12:12:53 -0500395 __u32 generation;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500396};
397
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200398/**
399 * struct fw_cdev_send_response - Send an asynchronous response packet
400 * @rcode: Response code as determined by the userspace handler
401 * @length: Length of outgoing payload, in bytes
402 * @data: Userspace pointer to payload
403 * @handle: The handle from the &fw_cdev_event_request
404 *
405 * Send a response to an incoming request. By setting up an address range using
406 * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An
407 * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must
408 * send a reply using this ioctl. The event has a handle to the kernel-side
409 * pending transaction, which should be used with this ioctl.
410 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500411struct fw_cdev_send_response {
412 __u32 rcode;
413 __u32 length;
414 __u64 data;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400415 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500416};
417
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200418/**
419 * struct fw_cdev_allocate - Allocate a CSR address range
420 * @offset: Start offset of the address range
421 * @closure: To be passed back to userspace in request events
422 * @length: Length of the address range, in bytes
423 * @handle: Handle to the allocation, written by the kernel
424 *
425 * Allocate an address range in the 48-bit address space on the local node
426 * (the controller). This allows userspace to listen for requests with an
427 * offset within that address range. When the kernel receives a request
428 * within the range, an &fw_cdev_event_request event will be written back.
429 * The @closure field is passed back to userspace in the response event.
430 * The @handle field is an out parameter, returning a handle to the allocated
431 * range to be used for later deallocation of the range.
Clemens Ladischdb5d2472009-12-24 12:05:58 +0100432 *
433 * The address range is allocated on all local nodes. The address allocation
434 * is exclusive except for the FCP command and response registers.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200435 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500436struct fw_cdev_allocate {
437 __u64 offset;
438 __u64 closure;
439 __u32 length;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400440 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500441};
442
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200443/**
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100444 * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
445 * @handle: Handle to the address range or iso resource, as returned by the
446 * kernel when the range or resource was allocated
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200447 */
Kristian Høgsberg94723162007-03-14 17:34:55 -0400448struct fw_cdev_deallocate {
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400449 __u32 handle;
Kristian Høgsberg94723162007-03-14 17:34:55 -0400450};
451
Kristian Høgsberg53718422007-03-07 12:12:42 -0500452#define FW_CDEV_LONG_RESET 0
453#define FW_CDEV_SHORT_RESET 1
454
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200455/**
456 * struct fw_cdev_initiate_bus_reset - Initiate a bus reset
457 * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET
458 *
459 * Initiate a bus reset for the bus this device is on. The bus reset can be
460 * either the original (long) bus reset or the arbitrated (short) bus reset
461 * introduced in 1394a-2000.
462 */
Kristian Høgsberg53718422007-03-07 12:12:42 -0500463struct fw_cdev_initiate_bus_reset {
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200464 __u32 type; /* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */
Kristian Høgsberg53718422007-03-07 12:12:42 -0500465};
466
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200467/**
468 * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM
469 * @immediate: If non-zero, immediate key to insert before pointer
470 * @key: Upper 8 bits of root directory pointer
471 * @data: Userspace pointer to contents of descriptor block
Stefan Richter6d3faf62010-01-24 14:48:00 +0100472 * @length: Length of descriptor block data, in quadlets
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200473 * @handle: Handle to the descriptor, written by the kernel
474 *
475 * Add a descriptor block and optionally a preceding immediate key to the local
476 * node's configuration ROM.
477 *
478 * The @key field specifies the upper 8 bits of the descriptor root directory
479 * pointer and the @data and @length fields specify the contents. The @key
480 * should be of the form 0xXX000000. The offset part of the root directory entry
481 * will be filled in by the kernel.
482 *
483 * If not 0, the @immediate field specifies an immediate key which will be
484 * inserted before the root directory pointer.
485 *
Stefan Richter6d3faf62010-01-24 14:48:00 +0100486 * @immediate, @key, and @data array elements are CPU-endian quadlets.
487 *
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200488 * If successful, the kernel adds the descriptor and writes back a handle to the
489 * kernel-side object to be used for later removal of the descriptor block and
490 * immediate key.
Stefan Richterde487da2009-03-10 21:00:23 +0100491 *
492 * This ioctl affects the configuration ROMs of all local nodes.
493 * The ioctl only succeeds on device files which represent a local node.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200494 */
Kristian Høgsberg66dea3e2007-03-28 21:26:42 +0200495struct fw_cdev_add_descriptor {
496 __u32 immediate;
497 __u32 key;
498 __u64 data;
499 __u32 length;
500 __u32 handle;
501};
502
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200503/**
504 * struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM
505 * @handle: Handle to the descriptor, as returned by the kernel when the
506 * descriptor was added
507 *
508 * Remove a descriptor block and accompanying immediate key from the local
Stefan Richterde487da2009-03-10 21:00:23 +0100509 * nodes' configuration ROMs.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200510 */
Kristian Høgsberg66dea3e2007-03-28 21:26:42 +0200511struct fw_cdev_remove_descriptor {
512 __u32 handle;
513};
514
Kristian Høgsberg295e3fe2007-02-16 17:34:40 -0500515#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0
516#define FW_CDEV_ISO_CONTEXT_RECEIVE 1
517
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200518/**
519 * struct fw_cdev_create_iso_context - Create a context for isochronous IO
520 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE
521 * @header_size: Header size to strip for receive contexts
522 * @channel: Channel to bind to
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200523 * @speed: Speed for transmit contexts
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200524 * @closure: To be returned in &fw_cdev_event_iso_interrupt
525 * @handle: Handle to context, written back by kernel
526 *
527 * Prior to sending or receiving isochronous I/O, a context must be created.
528 * The context records information about the transmit or receive configuration
529 * and typically maps to an underlying hardware resource. A context is set up
530 * for either sending or receiving. It is bound to a specific isochronous
531 * channel.
532 *
533 * If a context was successfully created, the kernel writes back a handle to the
534 * context, which must be passed in for subsequent operations on that context.
Stefan Richter77258da2009-01-07 20:14:53 +0100535 *
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200536 * For receive contexts, @header_size must be at least 4 and must be a multiple
537 * of 4.
538 *
Stefan Richter77258da2009-01-07 20:14:53 +0100539 * Note that the effect of a @header_size > 4 depends on
540 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200541 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500542struct fw_cdev_create_iso_context {
Kristian Høgsberg295e3fe2007-02-16 17:34:40 -0500543 __u32 type;
544 __u32 header_size;
Kristian Høgsberg21efb3c2007-02-16 17:34:50 -0500545 __u32 channel;
546 __u32 speed;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400547 __u64 closure;
548 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500549};
550
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400551#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v)
552#define FW_CDEV_ISO_INTERRUPT (1 << 16)
553#define FW_CDEV_ISO_SKIP (1 << 17)
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200554#define FW_CDEV_ISO_SYNC (1 << 17)
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400555#define FW_CDEV_ISO_TAG(v) ((v) << 18)
556#define FW_CDEV_ISO_SY(v) ((v) << 20)
557#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24)
558
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200559/**
560 * struct fw_cdev_iso_packet - Isochronous packet
561 * @control: Contains the header length (8 uppermost bits), the sy field
562 * (4 bits), the tag field (2 bits), a sync flag (1 bit),
563 * a skip flag (1 bit), an interrupt flag (1 bit), and the
564 * payload length (16 lowermost bits)
565 * @header: Header and payload
566 *
567 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
568 *
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200569 * Use the FW_CDEV_ISO_ macros to fill in @control.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200570 *
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200571 * For transmit packets, the header length must be a multiple of 4 and specifies
572 * the numbers of bytes in @header that will be prepended to the packet's
573 * payload; these bytes are copied into the kernel and will not be accessed
574 * after the ioctl has returned. The sy and tag fields are copied to the iso
575 * packet header (these fields are specified by IEEE 1394a and IEC 61883-1).
576 * The skip flag specifies that no packet is to be sent in a frame; when using
577 * this, all other fields except the interrupt flag must be zero.
578 *
579 * For receive packets, the header length must be a multiple of the context's
580 * header size; if the header length is larger than the context's header size,
581 * multiple packets are queued for this entry. The sy and tag fields are
582 * ignored. If the sync flag is set, the context drops all packets until
583 * a packet with a matching sy field is received (the sync value to wait for is
584 * specified in the &fw_cdev_start_iso structure). The payload length defines
585 * how many payload bytes can be received for one packet (in addition to payload
586 * quadlets that have been defined as headers and are stripped and returned in
587 * the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the
588 * additional bytes are dropped. If less bytes are received, the remaining
589 * bytes in this part of the payload buffer will not be written to, not even by
590 * the next packet, i.e., packets received in consecutive frames will not
591 * necessarily be consecutive in memory. If an entry has queued multiple
592 * packets, the payload length is divided equally among them.
593 *
594 * When a packet with the interrupt flag set has been completed, the
595 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
596 * multiple receive packets is completed when its last packet is completed.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200597 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500598struct fw_cdev_iso_packet {
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400599 __u32 control;
Stefan Richter5e20c282007-01-21 20:44:09 +0100600 __u32 header[0];
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500601};
602
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200603/**
604 * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
605 * @packets: Userspace pointer to packet data
606 * @data: Pointer into mmap()'ed payload buffer
607 * @size: Size of packet data in bytes
608 * @handle: Isochronous context handle
609 *
610 * Queue a number of isochronous packets for reception or transmission.
611 * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
612 * which describe how to transmit from or receive into a contiguous region
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200613 * of a mmap()'ed payload buffer. As part of transmit packet descriptors,
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200614 * a series of headers can be supplied, which will be prepended to the
615 * payload during DMA.
616 *
617 * The kernel may or may not queue all packets, but will write back updated
618 * values of the @packets, @data and @size fields, so the ioctl can be
619 * resubmitted easily.
620 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500621struct fw_cdev_queue_iso {
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500622 __u64 packets;
623 __u64 data;
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400624 __u32 size;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400625 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500626};
627
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200628#define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1
629#define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2
630#define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4
631#define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8
632#define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15
633
634/**
635 * struct fw_cdev_start_iso - Start an isochronous transmission or reception
636 * @cycle: Cycle in which to start I/O. If @cycle is greater than or
637 * equal to 0, the I/O will start on that cycle.
638 * @sync: Determines the value to wait for for receive packets that have
639 * the %FW_CDEV_ISO_SYNC bit set
640 * @tags: Tag filter bit mask. Only valid for isochronous reception.
641 * Determines the tag values for which packets will be accepted.
642 * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags.
643 * @handle: Isochronous context handle within which to transmit or receive
644 */
Kristian Høgsberg69cdb722007-02-16 17:34:41 -0500645struct fw_cdev_start_iso {
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500646 __s32 cycle;
Kristian Høgsbergeb0306e2007-03-14 17:34:54 -0400647 __u32 sync;
648 __u32 tags;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400649 __u32 handle;
650};
651
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200652/**
653 * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception
654 * @handle: Handle of isochronous context to stop
655 */
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400656struct fw_cdev_stop_iso {
657 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500658};
659
Stefan Richtera64408b2007-09-29 10:41:58 +0200660/**
661 * struct fw_cdev_get_cycle_timer - read cycle timer register
662 * @local_time: system time, in microseconds since the Epoch
Stefan Richterabfe5a02010-02-20 12:13:49 +0100663 * @cycle_timer: Cycle Time register contents
Stefan Richtera64408b2007-09-29 10:41:58 +0200664 *
665 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
Stefan Richterabfe5a02010-02-20 12:13:49 +0100666 * and also the system clock (%CLOCK_REALTIME). This allows to express the
667 * receive time of an isochronous packet as a system time.
Stefan Richter77258da2009-01-07 20:14:53 +0100668 *
669 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
Stefan Richterabfe5a02010-02-20 12:13:49 +0100670 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
671 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
Stefan Richtere94b6d72010-02-21 12:48:57 +0100672 *
673 * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
674 * monotonic) @cycle_timer values on certain controllers.
Stefan Richtera64408b2007-09-29 10:41:58 +0200675 */
676struct fw_cdev_get_cycle_timer {
677 __u64 local_time;
678 __u32 cycle_timer;
679};
680
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100681/**
Stefan Richterabfe5a02010-02-20 12:13:49 +0100682 * struct fw_cdev_get_cycle_timer2 - read cycle timer register
683 * @tv_sec: system time, seconds
684 * @tv_nsec: system time, sub-seconds part in nanoseconds
685 * @clk_id: input parameter, clock from which to get the system time
686 * @cycle_timer: Cycle Time register contents
687 *
688 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like
689 * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX'
690 * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME
691 * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW.
692 */
693struct fw_cdev_get_cycle_timer2 {
694 __s64 tv_sec;
695 __s32 tv_nsec;
696 __s32 clk_id;
697 __u32 cycle_timer;
698};
699
700/**
Stefan Richter1ec3c022009-01-04 16:23:29 +0100701 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100702 * @closure: Passed back to userspace in correponding iso resource events
Stefan Richter1ec3c022009-01-04 16:23:29 +0100703 * @channels: Isochronous channels of which one is to be (de)allocated
704 * @bandwidth: Isochronous bandwidth units to be (de)allocated
705 * @handle: Handle to the allocation, written by the kernel (only valid in
706 * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100707 *
708 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
709 * isochronous channel and/or of isochronous bandwidth at the isochronous
710 * resource manager (IRM). Only one of the channels specified in @channels is
711 * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
712 * communication with the IRM, indicating success or failure in the event data.
713 * The kernel will automatically reallocate the resources after bus resets.
714 * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
715 * will be sent. The kernel will also automatically deallocate the resources
716 * when the file descriptor is closed.
717 *
Stefan Richter1ec3c022009-01-04 16:23:29 +0100718 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
719 * deallocation of resources which were allocated as described above.
720 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
721 *
722 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
723 * without automatic re- or deallocation.
724 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
725 * indicating success or failure in its data.
726 *
727 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
728 * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
Stefan Richter5d9cb7d2009-01-08 23:07:40 +0100729 * instead of allocated.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100730 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
731 *
Stefan Richterca658b12010-04-10 12:23:09 +0200732 * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
733 * for the lifetime of the fd or @handle.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100734 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
735 * for the duration of a bus generation.
736 *
Stefan Richter5d9cb7d2009-01-08 23:07:40 +0100737 * @channels is a host-endian bitfield with the least significant bit
738 * representing channel 0 and the most significant bit representing channel 63:
739 * 1ULL << c for each channel c that is a candidate for (de)allocation.
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100740 *
741 * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
742 * one quadlet of data (payload or header data) at speed S1600.
743 */
744struct fw_cdev_allocate_iso_resource {
745 __u64 closure;
746 __u64 channels;
747 __u32 bandwidth;
748 __u32 handle;
749};
750
Stefan Richter33580a32009-01-04 16:23:29 +0100751/**
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100752 * struct fw_cdev_send_stream_packet - send an asynchronous stream packet
Stefan Richter18e9b102009-03-10 21:02:21 +0100753 * @length: Length of outgoing payload, in bytes
754 * @tag: Data format tag
755 * @channel: Isochronous channel to transmit to
756 * @sy: Synchronization code
757 * @closure: Passed back to userspace in the response event
758 * @data: Userspace pointer to payload
759 * @generation: The bus generation where packet is valid
760 * @speed: Speed to transmit at
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100761 *
762 * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
Stefan Richter18e9b102009-03-10 21:02:21 +0100763 * to every device which is listening to the specified channel. The kernel
764 * writes an &fw_cdev_event_response event which indicates success or failure of
765 * the transmission.
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100766 */
767struct fw_cdev_send_stream_packet {
Stefan Richter18e9b102009-03-10 21:02:21 +0100768 __u32 length;
769 __u32 tag;
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100770 __u32 channel;
771 __u32 sy;
Stefan Richter18e9b102009-03-10 21:02:21 +0100772 __u64 closure;
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100773 __u64 data;
Stefan Richter18e9b102009-03-10 21:02:21 +0100774 __u32 generation;
775 __u32 speed;
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100776};
777
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -0400778#endif /* _LINUX_FIREWIRE_CDEV_H */