blob: 8b9b27373219366a8bbcc53b4c991bb6f3fbc957 [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
Stefan Richter3b2b65d2010-06-20 22:54:22 +0200207 * with the %FW_CDEV_ISO_INTERRUPT bit set.
208 *
209 * Isochronous transmit events:
210 *
211 * In version 1 of the ABI, &header_length is 0. In version 3 and some
212 * implementations of version 2 of the ABI, &header_length is a multiple of 4
213 * and &header contains timestamps of all packets up until the interrupt packet.
214 * The format of the timestamps is as described below for isochronous reception.
215 *
216 * Isochronous receive events:
217 *
218 * The headers stripped of all packets up until and including the interrupt
219 * packet are returned in the @header field. The amount of header data per
220 * packet is as specified at iso context creation by
221 * &fw_cdev_create_iso_context.header_size.
Stefan Richter77258da2009-01-07 20:14:53 +0100222 *
223 * In version 1 of this ABI, header data consisted of the 1394 isochronous
224 * packet header, followed by quadlets from the packet payload if
225 * &fw_cdev_create_iso_context.header_size > 4.
226 *
227 * In version 2 of this ABI, header data consist of the 1394 isochronous
228 * packet header, followed by a timestamp quadlet if
229 * &fw_cdev_create_iso_context.header_size > 4, followed by quadlets from the
230 * packet payload if &fw_cdev_create_iso_context.header_size > 8.
231 *
232 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
233 *
234 * Format of 1394 iso packet header: 16 bits len, 2 bits tag, 6 bits channel,
235 * 4 bits tcode, 4 bits sy, in big endian byte order. Format of timestamp:
236 * 16 bits invalid, 3 bits cycleSeconds, 13 bits cycleCount, in big endian byte
237 * order.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200238 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500239struct fw_cdev_event_iso_interrupt {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400240 __u64 closure;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500241 __u32 type;
242 __u32 cycle;
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200243 __u32 header_length;
Kristian Høgsberg9b32d5f2007-02-16 17:34:44 -0500244 __u32 header[0];
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500245};
246
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200247/**
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100248 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
249 * @closure: See &fw_cdev_event_common;
Stefan Richter1ec3c022009-01-04 16:23:29 +0100250 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100251 * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
252 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
253 * @handle: Reference by which an allocated resource can be deallocated
254 * @channel: Isochronous channel which was (de)allocated, if any
255 * @bandwidth: Bandwidth allocation units which were (de)allocated, if any
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100256 *
257 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
258 * resource was allocated at the IRM. The client has to check @channel and
259 * @bandwidth for whether the allocation actually succeeded.
260 *
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100261 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
262 * resource was deallocated at the IRM. It is also sent when automatic
263 * reallocation after a bus reset failed.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100264 *
265 * @channel is <0 if no channel was (de)allocated or if reallocation failed.
266 * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100267 */
268struct fw_cdev_event_iso_resource {
269 __u64 closure;
270 __u32 type;
271 __u32 handle;
272 __s32 channel;
273 __s32 bandwidth;
274};
275
276/**
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200277 * union fw_cdev_event - Convenience union of fw_cdev_event_ types
278 * @common: Valid for all types
279 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
280 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
281 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
Stefan Richtere2055972010-06-20 22:53:55 +0200282 * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200283 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100284 * @iso_resource: Valid if @common.type ==
285 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
286 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200287 *
Jay Fenlasonbe585c02008-10-01 18:13:20 -0400288 * Convenience union for userspace use. Events could be read(2) into an
289 * appropriately aligned char buffer and then cast to this union for further
290 * processing. Note that for a request, response or iso_interrupt event,
291 * the data[] or header[] may make the size of the full event larger than
292 * sizeof(union fw_cdev_event). Also note that if you attempt to read(2)
293 * an event into a buffer that is not large enough for it, the data that does
294 * not fit will be discarded so that the next read(2) will return a new event.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200295 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400296union fw_cdev_event {
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100297 struct fw_cdev_event_common common;
298 struct fw_cdev_event_bus_reset bus_reset;
299 struct fw_cdev_event_response response;
300 struct fw_cdev_event_request request;
Stefan Richtere2055972010-06-20 22:53:55 +0200301 struct fw_cdev_event_request2 request2; /* added in 2.6.36 */
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100302 struct fw_cdev_event_iso_interrupt iso_interrupt;
Stefan Richter604f4512010-06-20 22:52:55 +0200303 struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400304};
305
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100306/* available since kernel version 2.6.22 */
Stefan Richterc8a25902009-03-10 20:59:16 +0100307#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info)
308#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request)
309#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate)
310#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate)
311#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response)
312#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
313#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
314#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
315#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
316#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso)
317#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
318#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100319
320/* available since kernel version 2.6.24 */
Stefan Richterc8a25902009-03-10 20:59:16 +0100321#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500322
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100323/* available since kernel version 2.6.30 */
Stefan Richter1ec3c022009-01-04 16:23:29 +0100324#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
325#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate)
326#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
327#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
Stefan Richterc8a25902009-03-10 20:59:16 +0100328#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */
Jay Fenlason, Stefan Richteracfe8332009-01-04 16:23:29 +0100329#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100330#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100331
Stefan Richterabfe5a02010-02-20 12:13:49 +0100332/* available since kernel version 2.6.34 */
333#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
334
Stefan Richter77258da2009-01-07 20:14:53 +0100335/*
Stefan Richter604f4512010-06-20 22:52:55 +0200336 * ABI version history
Stefan Richter77258da2009-01-07 20:14:53 +0100337 * 1 (2.6.22) - initial version
Stefan Richter604f4512010-06-20 22:52:55 +0200338 * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER
Stefan Richter77258da2009-01-07 20:14:53 +0100339 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
340 * &fw_cdev_create_iso_context.header_size is 8 or more
Stefan Richter604f4512010-06-20 22:52:55 +0200341 * - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
342 * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
343 * %FW_CDEV_IOC_SEND_STREAM_PACKET
Stefan Richtere94b6d72010-02-21 12:48:57 +0100344 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
345 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of
346 * dual-buffer or packet-per-buffer depending on hardware
Stefan Richtere2055972010-06-20 22:53:55 +0200347 * - shared use and auto-response for FCP registers
Stefan Richtere94b6d72010-02-21 12:48:57 +0100348 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
Stefan Richter604f4512010-06-20 22:52:55 +0200349 * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
Stefan Richtere2055972010-06-20 22:53:55 +0200350 * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500351 */
Stefan Richter604f4512010-06-20 22:52:55 +0200352#define FW_CDEV_VERSION 3 /* Meaningless; don't use this macro. */
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500353
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200354/**
355 * struct fw_cdev_get_info - General purpose information ioctl
Stefan Richter604f4512010-06-20 22:52:55 +0200356 * @version: The version field is just a running serial number. Both an
357 * input parameter (ABI version implemented by the client) and
358 * output parameter (ABI version implemented by the kernel).
359 * A client must not fill in an %FW_CDEV_VERSION defined from an
360 * included kernel header file but the actual version for which
361 * the client was implemented. This is necessary for forward
362 * compatibility. We never break backwards compatibility, but
363 * may add more structs, events, and ioctls in later revisions.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200364 * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration
365 * ROM will be copied into that user space address. In either
366 * case, @rom_length is updated with the actual length of the
367 * configuration ROM.
368 * @rom: If non-zero, address of a buffer to be filled by a copy of the
Stefan Richter632321e2009-01-02 12:47:13 +0100369 * device's configuration ROM
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200370 * @bus_reset: If non-zero, address of a buffer to be filled by a
371 * &struct fw_cdev_event_bus_reset with the current state
372 * of the bus. This does not cause a bus reset to happen.
373 * @bus_reset_closure: Value of &closure in this and subsequent bus reset events
374 * @card: The index of the card this device belongs to
375 */
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500376struct fw_cdev_get_info {
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500377 __u32 version;
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500378 __u32 rom_length;
379 __u64 rom;
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500380 __u64 bus_reset;
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400381 __u64 bus_reset_closure;
Kristian Høgsberge7533502007-03-07 12:12:52 -0500382 __u32 card;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500383};
384
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200385/**
386 * struct fw_cdev_send_request - Send an asynchronous request packet
387 * @tcode: Transaction code of the request
388 * @length: Length of outgoing payload, in bytes
389 * @offset: 48-bit offset at destination node
390 * @closure: Passed back to userspace in the response event
391 * @data: Userspace pointer to payload
392 * @generation: The bus generation where packet is valid
393 *
394 * Send a request to the device. This ioctl implements all outgoing requests.
395 * Both quadlet and block request specify the payload as a pointer to the data
396 * in the @data field. Once the transaction completes, the kernel writes an
Stefan Richterbf8e3352008-12-05 22:43:41 +0100397 * &fw_cdev_event_response event back. The @closure field is passed back to
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200398 * user space in the response event.
399 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500400struct fw_cdev_send_request {
401 __u32 tcode;
402 __u32 length;
403 __u64 offset;
404 __u64 closure;
405 __u64 data;
Kristian Høgsberg97e35272007-03-07 12:12:53 -0500406 __u32 generation;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500407};
408
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200409/**
410 * struct fw_cdev_send_response - Send an asynchronous response packet
411 * @rcode: Response code as determined by the userspace handler
412 * @length: Length of outgoing payload, in bytes
413 * @data: Userspace pointer to payload
414 * @handle: The handle from the &fw_cdev_event_request
415 *
416 * Send a response to an incoming request. By setting up an address range using
417 * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An
418 * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must
419 * send a reply using this ioctl. The event has a handle to the kernel-side
420 * pending transaction, which should be used with this ioctl.
421 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500422struct fw_cdev_send_response {
423 __u32 rcode;
424 __u32 length;
425 __u64 data;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400426 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500427};
428
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200429/**
430 * struct fw_cdev_allocate - Allocate a CSR address range
431 * @offset: Start offset of the address range
432 * @closure: To be passed back to userspace in request events
433 * @length: Length of the address range, in bytes
434 * @handle: Handle to the allocation, written by the kernel
435 *
436 * Allocate an address range in the 48-bit address space on the local node
437 * (the controller). This allows userspace to listen for requests with an
438 * offset within that address range. When the kernel receives a request
439 * within the range, an &fw_cdev_event_request event will be written back.
440 * The @closure field is passed back to userspace in the response event.
441 * The @handle field is an out parameter, returning a handle to the allocated
442 * range to be used for later deallocation of the range.
Clemens Ladischdb5d2472009-12-24 12:05:58 +0100443 *
444 * The address range is allocated on all local nodes. The address allocation
445 * is exclusive except for the FCP command and response registers.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200446 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500447struct fw_cdev_allocate {
448 __u64 offset;
449 __u64 closure;
450 __u32 length;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400451 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500452};
453
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200454/**
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100455 * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
456 * @handle: Handle to the address range or iso resource, as returned by the
457 * kernel when the range or resource was allocated
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200458 */
Kristian Høgsberg94723162007-03-14 17:34:55 -0400459struct fw_cdev_deallocate {
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400460 __u32 handle;
Kristian Høgsberg94723162007-03-14 17:34:55 -0400461};
462
Kristian Høgsberg53718422007-03-07 12:12:42 -0500463#define FW_CDEV_LONG_RESET 0
464#define FW_CDEV_SHORT_RESET 1
465
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200466/**
467 * struct fw_cdev_initiate_bus_reset - Initiate a bus reset
468 * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET
469 *
470 * Initiate a bus reset for the bus this device is on. The bus reset can be
471 * either the original (long) bus reset or the arbitrated (short) bus reset
472 * introduced in 1394a-2000.
473 */
Kristian Høgsberg53718422007-03-07 12:12:42 -0500474struct fw_cdev_initiate_bus_reset {
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200475 __u32 type; /* FW_CDEV_SHORT_RESET or FW_CDEV_LONG_RESET */
Kristian Høgsberg53718422007-03-07 12:12:42 -0500476};
477
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200478/**
479 * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM
480 * @immediate: If non-zero, immediate key to insert before pointer
481 * @key: Upper 8 bits of root directory pointer
482 * @data: Userspace pointer to contents of descriptor block
Stefan Richter6d3faf62010-01-24 14:48:00 +0100483 * @length: Length of descriptor block data, in quadlets
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200484 * @handle: Handle to the descriptor, written by the kernel
485 *
486 * Add a descriptor block and optionally a preceding immediate key to the local
487 * node's configuration ROM.
488 *
489 * The @key field specifies the upper 8 bits of the descriptor root directory
490 * pointer and the @data and @length fields specify the contents. The @key
491 * should be of the form 0xXX000000. The offset part of the root directory entry
492 * will be filled in by the kernel.
493 *
494 * If not 0, the @immediate field specifies an immediate key which will be
495 * inserted before the root directory pointer.
496 *
Stefan Richter6d3faf62010-01-24 14:48:00 +0100497 * @immediate, @key, and @data array elements are CPU-endian quadlets.
498 *
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200499 * If successful, the kernel adds the descriptor and writes back a handle to the
500 * kernel-side object to be used for later removal of the descriptor block and
501 * immediate key.
Stefan Richterde487da2009-03-10 21:00:23 +0100502 *
503 * This ioctl affects the configuration ROMs of all local nodes.
504 * The ioctl only succeeds on device files which represent a local node.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200505 */
Kristian Høgsberg66dea3e2007-03-28 21:26:42 +0200506struct fw_cdev_add_descriptor {
507 __u32 immediate;
508 __u32 key;
509 __u64 data;
510 __u32 length;
511 __u32 handle;
512};
513
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200514/**
515 * struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM
516 * @handle: Handle to the descriptor, as returned by the kernel when the
517 * descriptor was added
518 *
519 * Remove a descriptor block and accompanying immediate key from the local
Stefan Richterde487da2009-03-10 21:00:23 +0100520 * nodes' configuration ROMs.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200521 */
Kristian Høgsberg66dea3e2007-03-28 21:26:42 +0200522struct fw_cdev_remove_descriptor {
523 __u32 handle;
524};
525
Kristian Høgsberg295e3fe2007-02-16 17:34:40 -0500526#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0
527#define FW_CDEV_ISO_CONTEXT_RECEIVE 1
528
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200529/**
530 * struct fw_cdev_create_iso_context - Create a context for isochronous IO
531 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE
532 * @header_size: Header size to strip for receive contexts
533 * @channel: Channel to bind to
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200534 * @speed: Speed for transmit contexts
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200535 * @closure: To be returned in &fw_cdev_event_iso_interrupt
536 * @handle: Handle to context, written back by kernel
537 *
538 * Prior to sending or receiving isochronous I/O, a context must be created.
539 * The context records information about the transmit or receive configuration
540 * and typically maps to an underlying hardware resource. A context is set up
541 * for either sending or receiving. It is bound to a specific isochronous
542 * channel.
543 *
544 * If a context was successfully created, the kernel writes back a handle to the
545 * context, which must be passed in for subsequent operations on that context.
Stefan Richter77258da2009-01-07 20:14:53 +0100546 *
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200547 * For receive contexts, @header_size must be at least 4 and must be a multiple
548 * of 4.
549 *
Stefan Richter77258da2009-01-07 20:14:53 +0100550 * Note that the effect of a @header_size > 4 depends on
551 * &fw_cdev_get_info.version, as documented at &fw_cdev_event_iso_interrupt.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200552 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500553struct fw_cdev_create_iso_context {
Kristian Høgsberg295e3fe2007-02-16 17:34:40 -0500554 __u32 type;
555 __u32 header_size;
Kristian Høgsberg21efb3c2007-02-16 17:34:50 -0500556 __u32 channel;
557 __u32 speed;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400558 __u64 closure;
559 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500560};
561
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400562#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v)
563#define FW_CDEV_ISO_INTERRUPT (1 << 16)
564#define FW_CDEV_ISO_SKIP (1 << 17)
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200565#define FW_CDEV_ISO_SYNC (1 << 17)
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400566#define FW_CDEV_ISO_TAG(v) ((v) << 18)
567#define FW_CDEV_ISO_SY(v) ((v) << 20)
568#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24)
569
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200570/**
571 * struct fw_cdev_iso_packet - Isochronous packet
572 * @control: Contains the header length (8 uppermost bits), the sy field
573 * (4 bits), the tag field (2 bits), a sync flag (1 bit),
574 * a skip flag (1 bit), an interrupt flag (1 bit), and the
575 * payload length (16 lowermost bits)
576 * @header: Header and payload
577 *
578 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
579 *
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200580 * Use the FW_CDEV_ISO_ macros to fill in @control.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200581 *
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200582 * For transmit packets, the header length must be a multiple of 4 and specifies
583 * the numbers of bytes in @header that will be prepended to the packet's
584 * payload; these bytes are copied into the kernel and will not be accessed
585 * after the ioctl has returned. The sy and tag fields are copied to the iso
586 * packet header (these fields are specified by IEEE 1394a and IEC 61883-1).
587 * The skip flag specifies that no packet is to be sent in a frame; when using
588 * this, all other fields except the interrupt flag must be zero.
589 *
590 * For receive packets, the header length must be a multiple of the context's
591 * header size; if the header length is larger than the context's header size,
592 * multiple packets are queued for this entry. The sy and tag fields are
593 * ignored. If the sync flag is set, the context drops all packets until
594 * a packet with a matching sy field is received (the sync value to wait for is
595 * specified in the &fw_cdev_start_iso structure). The payload length defines
596 * how many payload bytes can be received for one packet (in addition to payload
597 * quadlets that have been defined as headers and are stripped and returned in
598 * the &fw_cdev_event_iso_interrupt structure). If more bytes are received, the
599 * additional bytes are dropped. If less bytes are received, the remaining
600 * bytes in this part of the payload buffer will not be written to, not even by
601 * the next packet, i.e., packets received in consecutive frames will not
602 * necessarily be consecutive in memory. If an entry has queued multiple
603 * packets, the payload length is divided equally among them.
604 *
605 * When a packet with the interrupt flag set has been completed, the
606 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
607 * multiple receive packets is completed when its last packet is completed.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200608 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500609struct fw_cdev_iso_packet {
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400610 __u32 control;
Stefan Richter5e20c282007-01-21 20:44:09 +0100611 __u32 header[0];
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500612};
613
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200614/**
615 * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
616 * @packets: Userspace pointer to packet data
617 * @data: Pointer into mmap()'ed payload buffer
618 * @size: Size of packet data in bytes
619 * @handle: Isochronous context handle
620 *
621 * Queue a number of isochronous packets for reception or transmission.
622 * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
623 * which describe how to transmit from or receive into a contiguous region
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200624 * of a mmap()'ed payload buffer. As part of transmit packet descriptors,
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200625 * a series of headers can be supplied, which will be prepended to the
626 * payload during DMA.
627 *
628 * The kernel may or may not queue all packets, but will write back updated
629 * values of the @packets, @data and @size fields, so the ioctl can be
630 * resubmitted easily.
631 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500632struct fw_cdev_queue_iso {
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500633 __u64 packets;
634 __u64 data;
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400635 __u32 size;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400636 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500637};
638
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200639#define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1
640#define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2
641#define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4
642#define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8
643#define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15
644
645/**
646 * struct fw_cdev_start_iso - Start an isochronous transmission or reception
647 * @cycle: Cycle in which to start I/O. If @cycle is greater than or
648 * equal to 0, the I/O will start on that cycle.
649 * @sync: Determines the value to wait for for receive packets that have
650 * the %FW_CDEV_ISO_SYNC bit set
651 * @tags: Tag filter bit mask. Only valid for isochronous reception.
652 * Determines the tag values for which packets will be accepted.
653 * Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags.
654 * @handle: Isochronous context handle within which to transmit or receive
655 */
Kristian Høgsberg69cdb722007-02-16 17:34:41 -0500656struct fw_cdev_start_iso {
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500657 __s32 cycle;
Kristian Høgsbergeb0306e2007-03-14 17:34:54 -0400658 __u32 sync;
659 __u32 tags;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400660 __u32 handle;
661};
662
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200663/**
664 * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception
665 * @handle: Handle of isochronous context to stop
666 */
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400667struct fw_cdev_stop_iso {
668 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500669};
670
Stefan Richtera64408b2007-09-29 10:41:58 +0200671/**
672 * struct fw_cdev_get_cycle_timer - read cycle timer register
673 * @local_time: system time, in microseconds since the Epoch
Stefan Richterabfe5a02010-02-20 12:13:49 +0100674 * @cycle_timer: Cycle Time register contents
Stefan Richtera64408b2007-09-29 10:41:58 +0200675 *
676 * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
Stefan Richterabfe5a02010-02-20 12:13:49 +0100677 * and also the system clock (%CLOCK_REALTIME). This allows to express the
678 * receive time of an isochronous packet as a system time.
Stefan Richter77258da2009-01-07 20:14:53 +0100679 *
680 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
Stefan Richterabfe5a02010-02-20 12:13:49 +0100681 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
682 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
Stefan Richtere94b6d72010-02-21 12:48:57 +0100683 *
684 * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
685 * monotonic) @cycle_timer values on certain controllers.
Stefan Richtera64408b2007-09-29 10:41:58 +0200686 */
687struct fw_cdev_get_cycle_timer {
688 __u64 local_time;
689 __u32 cycle_timer;
690};
691
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100692/**
Stefan Richterabfe5a02010-02-20 12:13:49 +0100693 * struct fw_cdev_get_cycle_timer2 - read cycle timer register
694 * @tv_sec: system time, seconds
695 * @tv_nsec: system time, sub-seconds part in nanoseconds
696 * @clk_id: input parameter, clock from which to get the system time
697 * @cycle_timer: Cycle Time register contents
698 *
699 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like
700 * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX'
701 * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME
702 * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW.
703 */
704struct fw_cdev_get_cycle_timer2 {
705 __s64 tv_sec;
706 __s32 tv_nsec;
707 __s32 clk_id;
708 __u32 cycle_timer;
709};
710
711/**
Stefan Richter1ec3c022009-01-04 16:23:29 +0100712 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100713 * @closure: Passed back to userspace in correponding iso resource events
Stefan Richter1ec3c022009-01-04 16:23:29 +0100714 * @channels: Isochronous channels of which one is to be (de)allocated
715 * @bandwidth: Isochronous bandwidth units to be (de)allocated
716 * @handle: Handle to the allocation, written by the kernel (only valid in
717 * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100718 *
719 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
720 * isochronous channel and/or of isochronous bandwidth at the isochronous
721 * resource manager (IRM). Only one of the channels specified in @channels is
722 * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
723 * communication with the IRM, indicating success or failure in the event data.
724 * The kernel will automatically reallocate the resources after bus resets.
725 * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
726 * will be sent. The kernel will also automatically deallocate the resources
727 * when the file descriptor is closed.
728 *
Stefan Richter1ec3c022009-01-04 16:23:29 +0100729 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
730 * deallocation of resources which were allocated as described above.
731 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
732 *
733 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
734 * without automatic re- or deallocation.
735 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
736 * indicating success or failure in its data.
737 *
738 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
739 * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
Stefan Richter5d9cb7d272009-01-08 23:07:40 +0100740 * instead of allocated.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100741 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
742 *
Stefan Richterca658b12010-04-10 12:23:09 +0200743 * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
744 * for the lifetime of the fd or @handle.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100745 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
746 * for the duration of a bus generation.
747 *
Stefan Richter5d9cb7d272009-01-08 23:07:40 +0100748 * @channels is a host-endian bitfield with the least significant bit
749 * representing channel 0 and the most significant bit representing channel 63:
750 * 1ULL << c for each channel c that is a candidate for (de)allocation.
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100751 *
752 * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
753 * one quadlet of data (payload or header data) at speed S1600.
754 */
755struct fw_cdev_allocate_iso_resource {
756 __u64 closure;
757 __u64 channels;
758 __u32 bandwidth;
759 __u32 handle;
760};
761
Stefan Richter33580a32009-01-04 16:23:29 +0100762/**
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100763 * struct fw_cdev_send_stream_packet - send an asynchronous stream packet
Stefan Richter18e9b102009-03-10 21:02:21 +0100764 * @length: Length of outgoing payload, in bytes
765 * @tag: Data format tag
766 * @channel: Isochronous channel to transmit to
767 * @sy: Synchronization code
768 * @closure: Passed back to userspace in the response event
769 * @data: Userspace pointer to payload
770 * @generation: The bus generation where packet is valid
771 * @speed: Speed to transmit at
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100772 *
773 * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
Stefan Richter18e9b102009-03-10 21:02:21 +0100774 * to every device which is listening to the specified channel. The kernel
775 * writes an &fw_cdev_event_response event which indicates success or failure of
776 * the transmission.
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100777 */
778struct fw_cdev_send_stream_packet {
Stefan Richter18e9b102009-03-10 21:02:21 +0100779 __u32 length;
780 __u32 tag;
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100781 __u32 channel;
782 __u32 sy;
Stefan Richter18e9b102009-03-10 21:02:21 +0100783 __u64 closure;
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100784 __u64 data;
Stefan Richter18e9b102009-03-10 21:02:21 +0100785 __u32 generation;
786 __u32 speed;
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100787};
788
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -0400789#endif /* _LINUX_FIREWIRE_CDEV_H */