bc5c26fc1c64bdd008d6107fa86fcbc9a8289e95
[cascardo/linux.git] / include / linux / firewire-cdev.h
1 /*
2  * Char device interface.
3  *
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
21 #ifndef _LINUX_FIREWIRE_CDEV_H
22 #define _LINUX_FIREWIRE_CDEV_H
23
24 #include <linux/ioctl.h>
25 #include <linux/types.h>
26 #include <linux/firewire-constants.h>
27
28 #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
34
35 /* available since kernel version 2.6.36 */
36 #define FW_CDEV_EVENT_REQUEST2                          0x06
37 #define FW_CDEV_EVENT_PHY_PACKET_SENT                   0x07
38 #define FW_CDEV_EVENT_PHY_PACKET_RECEIVED               0x08
39 #define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL        0x09
40
41 /**
42  * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
43  * @closure:    For arbitrary use by userspace
44  * @type:       Discriminates the fw_cdev_event_ types
45  *
46  * This struct may be used to access generic members of all fw_cdev_event_
47  * types regardless of the specific type.
48  *
49  * Data passed in the @closure field for a request will be returned in the
50  * corresponding event.  It is big enough to hold a pointer on all platforms.
51  * The ioctl used to set @closure depends on the @type of event.
52  */
53 struct fw_cdev_event_common {
54         __u64 closure;
55         __u32 type;
56 };
57
58 /**
59  * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred
60  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl
61  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET
62  * @node_id:       New node ID of this node
63  * @local_node_id: Node ID of the local node, i.e. of the controller
64  * @bm_node_id:    Node ID of the bus manager
65  * @irm_node_id:   Node ID of the iso resource manager
66  * @root_node_id:  Node ID of the root node
67  * @generation:    New bus generation
68  *
69  * This event is sent when the bus the device belongs to goes through a bus
70  * reset.  It provides information about the new bus configuration, such as
71  * new node ID for this device, new root ID, and others.
72  *
73  * If @bm_node_id is 0xffff right after bus reset it can be reread by an
74  * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished.
75  * Kernels with ABI version < 4 do not set @bm_node_id.
76  */
77 struct fw_cdev_event_bus_reset {
78         __u64 closure;
79         __u32 type;
80         __u32 node_id;
81         __u32 local_node_id;
82         __u32 bm_node_id;
83         __u32 irm_node_id;
84         __u32 root_node_id;
85         __u32 generation;
86 };
87
88 /**
89  * struct fw_cdev_event_response - Sent when a response packet was received
90  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
91  *              or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
92  *              or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
93  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
94  * @rcode:      Response code returned by the remote node
95  * @length:     Data length, i.e. the response's payload size in bytes
96  * @data:       Payload data, if any
97  *
98  * This event is sent when the stack receives a response to an outgoing request
99  * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl.  The payload data for responses
100  * carrying data (read and lock responses) follows immediately and can be
101  * accessed through the @data field.
102  *
103  * The event is also generated after conclusions of transactions that do not
104  * involve response packets.  This includes unified write transactions,
105  * broadcast write transactions, and transmission of asynchronous stream
106  * packets.  @rcode indicates success or failure of such transmissions.
107  */
108 struct fw_cdev_event_response {
109         __u64 closure;
110         __u32 type;
111         __u32 rcode;
112         __u32 length;
113         __u32 data[0];
114 };
115
116 /**
117  * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
118  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
119  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
120  * @tcode:      See &fw_cdev_event_request2
121  * @offset:     See &fw_cdev_event_request2
122  * @handle:     See &fw_cdev_event_request2
123  * @length:     See &fw_cdev_event_request2
124  * @data:       See &fw_cdev_event_request2
125  *
126  * This event is sent instead of &fw_cdev_event_request2 if the kernel or
127  * the client implements ABI version <= 3.
128  *
129  * Unlike &fw_cdev_event_request2, the sender identity cannot be established,
130  * broadcast write requests cannot be distinguished from unicast writes, and
131  * @tcode of lock requests is %TCODE_LOCK_REQUEST.
132  *
133  * Requests to the FCP_REQUEST or FCP_RESPONSE register are responded to as
134  * with &fw_cdev_event_request2, except in kernel 2.6.32 and older which send
135  * the response packet of the client's %FW_CDEV_IOC_SEND_RESPONSE ioctl.
136  */
137 struct fw_cdev_event_request {
138         __u64 closure;
139         __u32 type;
140         __u32 tcode;
141         __u64 offset;
142         __u32 handle;
143         __u32 length;
144         __u32 data[0];
145 };
146
147 /**
148  * struct fw_cdev_event_request2 - Sent on incoming request to an address region
149  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
150  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
151  * @tcode:      Transaction code of the incoming request
152  * @offset:     The offset into the 48-bit per-node address space
153  * @source_node_id: Sender node ID
154  * @destination_node_id: Destination node ID
155  * @card:       The index of the card from which the request came
156  * @generation: Bus generation in which the request is valid
157  * @handle:     Reference to the kernel-side pending request
158  * @length:     Data length, i.e. the request's payload size in bytes
159  * @data:       Incoming data, if any
160  *
161  * This event is sent when the stack receives an incoming request to an address
162  * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl.  The request is
163  * guaranteed to be completely contained in the specified region.  Userspace is
164  * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl,
165  * using the same @handle.
166  *
167  * The payload data for requests carrying data (write and lock requests)
168  * follows immediately and can be accessed through the @data field.
169  *
170  * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the
171  * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT,
172  * i.e. encodes the extended transaction code.
173  *
174  * @card may differ from &fw_cdev_get_info.card because requests are received
175  * from all cards of the Linux host.  @source_node_id, @destination_node_id, and
176  * @generation pertain to that card.  Destination node ID and bus generation may
177  * therefore differ from the corresponding fields of the last
178  * &fw_cdev_event_bus_reset.
179  *
180  * @destination_node_id may also differ from the current node ID because of a
181  * non-local bus ID part or in case of a broadcast write request.  Note, a
182  * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a
183  * broadcast write request; the kernel will then release the kernel-side pending
184  * request but will not actually send a response packet.
185  *
186  * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already
187  * sent a write response immediately after the request was received; in this
188  * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to
189  * release the kernel-side pending request, though another response won't be
190  * sent.
191  *
192  * If the client subsequently needs to initiate requests to the sender node of
193  * an &fw_cdev_event_request2, it needs to use a device file with matching
194  * card index, node ID, and generation for outbound requests.
195  */
196 struct fw_cdev_event_request2 {
197         __u64 closure;
198         __u32 type;
199         __u32 tcode;
200         __u64 offset;
201         __u32 source_node_id;
202         __u32 destination_node_id;
203         __u32 card;
204         __u32 generation;
205         __u32 handle;
206         __u32 length;
207         __u32 data[0];
208 };
209
210 /**
211  * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed
212  * @closure:    See &fw_cdev_event_common;
213  *              set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
214  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT
215  * @cycle:      Cycle counter of the interrupt packet
216  * @header_length: Total length of following headers, in bytes
217  * @header:     Stripped headers, if any
218  *
219  * This event is sent when the controller has completed an &fw_cdev_iso_packet
220  * with the %FW_CDEV_ISO_INTERRUPT bit set.
221  *
222  * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
223  *
224  * In version 3 and some implementations of version 2 of the ABI, &header_length
225  * is a multiple of 4 and &header contains timestamps of all packets up until
226  * the interrupt packet.  The format of the timestamps is as described below for
227  * isochronous reception.  In version 1 of the ABI, &header_length was 0.
228  *
229  * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE):
230  *
231  * The headers stripped of all packets up until and including the interrupt
232  * packet are returned in the @header field.  The amount of header data per
233  * packet is as specified at iso context creation by
234  * &fw_cdev_create_iso_context.header_size.
235  *
236  * Hence, _interrupt.header_length / _context.header_size is the number of
237  * packets received in this interrupt event.  The client can now iterate
238  * through the mmap()'ed DMA buffer according to this number of packets and
239  * to the buffer sizes as the client specified in &fw_cdev_queue_iso.
240  *
241  * Since version 2 of this ABI, the portion for each packet in _interrupt.header
242  * consists of the 1394 isochronous packet header, followed by a timestamp
243  * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets
244  * from the packet payload if &fw_cdev_create_iso_context.header_size > 8.
245  *
246  * Format of 1394 iso packet header:  16 bits data_length, 2 bits tag, 6 bits
247  * channel, 4 bits tcode, 4 bits sy, in big endian byte order.
248  * data_length is the actual received size of the packet without the four
249  * 1394 iso packet header bytes.
250  *
251  * Format of timestamp:  16 bits invalid, 3 bits cycleSeconds, 13 bits
252  * cycleCount, in big endian byte order.
253  *
254  * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload
255  * data followed directly after the 1394 is header if header_size > 4.
256  * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
257  */
258 struct fw_cdev_event_iso_interrupt {
259         __u64 closure;
260         __u32 type;
261         __u32 cycle;
262         __u32 header_length;
263         __u32 header[0];
264 };
265
266 /**
267  * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed
268  * @closure:    See &fw_cdev_event_common;
269  *              set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
270  * @type:       %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
271  * @completed:  Offset into the receive buffer; data before this offest is valid
272  *
273  * This event is sent in multichannel contexts (context type
274  * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
275  * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set.  Whether this happens
276  * when a packet is completed and/or when a buffer chunk is completed depends
277  * on the hardware implementation.
278  *
279  * The buffer is continuously filled with the following data, per packet:
280  *  - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
281  *    but in little endian byte order,
282  *  - packet payload (as many bytes as specified in the data_length field of
283  *    the 1394 iso packet header) in big endian byte order,
284  *  - 0...3 padding bytes as needed to align the following trailer quadlet,
285  *  - trailer quadlet, containing the reception timestamp as described at
286  *    &fw_cdev_event_iso_interrupt, but in little endian byte order.
287  *
288  * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8.
289  * When processing the data, stop before a packet that would cross the
290  * @completed offset.
291  *
292  * A packet near the end of a buffer chunk will typically spill over into the
293  * next queued buffer chunk.  It is the responsibility of the client to check
294  * for this condition, assemble a broken-up packet from its parts, and not to
295  * re-queue any buffer chunks in which as yet unread packet parts reside.
296  */
297 struct fw_cdev_event_iso_interrupt_mc {
298         __u64 closure;
299         __u32 type;
300         __u32 completed;
301 };
302
303 /**
304  * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
305  * @closure:    See &fw_cdev_event_common;
306  *              set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
307  * @type:       %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
308  *              %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
309  * @handle:     Reference by which an allocated resource can be deallocated
310  * @channel:    Isochronous channel which was (de)allocated, if any
311  * @bandwidth:  Bandwidth allocation units which were (de)allocated, if any
312  *
313  * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
314  * resource was allocated at the IRM.  The client has to check @channel and
315  * @bandwidth for whether the allocation actually succeeded.
316  *
317  * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
318  * resource was deallocated at the IRM.  It is also sent when automatic
319  * reallocation after a bus reset failed.
320  *
321  * @channel is <0 if no channel was (de)allocated or if reallocation failed.
322  * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
323  */
324 struct fw_cdev_event_iso_resource {
325         __u64 closure;
326         __u32 type;
327         __u32 handle;
328         __s32 channel;
329         __s32 bandwidth;
330 };
331
332 /**
333  * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received
334  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
335  *              or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
336  * @type:       %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
337  * @rcode:      %RCODE_..., indicates success or failure of transmission
338  * @length:     Data length in bytes
339  * @data:       Incoming data
340  *
341  * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
342  * except in case of a ping packet:  Then, @length is 4, and @data[0] is the
343  * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
344  *
345  * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
346  * consists of the two PHY packet quadlets, in host byte order.
347  */
348 struct fw_cdev_event_phy_packet {
349         __u64 closure;
350         __u32 type;
351         __u32 rcode;
352         __u32 length;
353         __u32 data[0];
354 };
355
356 /**
357  * union fw_cdev_event - Convenience union of fw_cdev_event_ types
358  * @common:             Valid for all types
359  * @bus_reset:          Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
360  * @response:           Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
361  * @request:            Valid if @common.type == %FW_CDEV_EVENT_REQUEST
362  * @request2:           Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
363  * @iso_interrupt:      Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
364  * @iso_interrupt_mc:   Valid if @common.type ==
365  *                              %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
366  * @iso_resource:       Valid if @common.type ==
367  *                              %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
368  *                              %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
369  * @phy_packet:         Valid if @common.type ==
370  *                              %FW_CDEV_EVENT_PHY_PACKET_SENT or
371  *                              %FW_CDEV_EVENT_PHY_PACKET_RECEIVED
372  *
373  * Convenience union for userspace use.  Events could be read(2) into an
374  * appropriately aligned char buffer and then cast to this union for further
375  * processing.  Note that for a request, response or iso_interrupt event,
376  * the data[] or header[] may make the size of the full event larger than
377  * sizeof(union fw_cdev_event).  Also note that if you attempt to read(2)
378  * an event into a buffer that is not large enough for it, the data that does
379  * not fit will be discarded so that the next read(2) will return a new event.
380  */
381 union fw_cdev_event {
382         struct fw_cdev_event_common             common;
383         struct fw_cdev_event_bus_reset          bus_reset;
384         struct fw_cdev_event_response           response;
385         struct fw_cdev_event_request            request;
386         struct fw_cdev_event_request2           request2;               /* added in 2.6.36 */
387         struct fw_cdev_event_iso_interrupt      iso_interrupt;
388         struct fw_cdev_event_iso_interrupt_mc   iso_interrupt_mc;       /* added in 2.6.36 */
389         struct fw_cdev_event_iso_resource       iso_resource;           /* added in 2.6.30 */
390         struct fw_cdev_event_phy_packet         phy_packet;             /* added in 2.6.36 */
391 };
392
393 /* available since kernel version 2.6.22 */
394 #define FW_CDEV_IOC_GET_INFO           _IOWR('#', 0x00, struct fw_cdev_get_info)
395 #define FW_CDEV_IOC_SEND_REQUEST        _IOW('#', 0x01, struct fw_cdev_send_request)
396 #define FW_CDEV_IOC_ALLOCATE           _IOWR('#', 0x02, struct fw_cdev_allocate)
397 #define FW_CDEV_IOC_DEALLOCATE          _IOW('#', 0x03, struct fw_cdev_deallocate)
398 #define FW_CDEV_IOC_SEND_RESPONSE       _IOW('#', 0x04, struct fw_cdev_send_response)
399 #define FW_CDEV_IOC_INITIATE_BUS_RESET  _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
400 #define FW_CDEV_IOC_ADD_DESCRIPTOR     _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
401 #define FW_CDEV_IOC_REMOVE_DESCRIPTOR   _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
402 #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
403 #define FW_CDEV_IOC_QUEUE_ISO          _IOWR('#', 0x09, struct fw_cdev_queue_iso)
404 #define FW_CDEV_IOC_START_ISO           _IOW('#', 0x0a, struct fw_cdev_start_iso)
405 #define FW_CDEV_IOC_STOP_ISO            _IOW('#', 0x0b, struct fw_cdev_stop_iso)
406
407 /* available since kernel version 2.6.24 */
408 #define FW_CDEV_IOC_GET_CYCLE_TIMER     _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
409
410 /* available since kernel version 2.6.30 */
411 #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE       _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
412 #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE      _IOW('#', 0x0e, struct fw_cdev_deallocate)
413 #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE   _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
414 #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
415 #define FW_CDEV_IOC_GET_SPEED                     _IO('#', 0x11) /* returns speed code */
416 #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST       _IOW('#', 0x12, struct fw_cdev_send_request)
417 #define FW_CDEV_IOC_SEND_STREAM_PACKET           _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
418
419 /* available since kernel version 2.6.34 */
420 #define FW_CDEV_IOC_GET_CYCLE_TIMER2   _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
421
422 /* available since kernel version 2.6.36 */
423 #define FW_CDEV_IOC_SEND_PHY_PACKET    _IOWR('#', 0x15, struct fw_cdev_send_phy_packet)
424 #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
425 #define FW_CDEV_IOC_SET_ISO_CHANNELS    _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
426
427 /*
428  * ABI version history
429  *  1  (2.6.22)  - initial version
430  *     (2.6.24)  - added %FW_CDEV_IOC_GET_CYCLE_TIMER
431  *  2  (2.6.30)  - changed &fw_cdev_event_iso_interrupt.header if
432  *                 &fw_cdev_create_iso_context.header_size is 8 or more
433  *               - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
434  *                 %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
435  *                 %FW_CDEV_IOC_SEND_STREAM_PACKET
436  *     (2.6.32)  - added time stamp to xmit &fw_cdev_event_iso_interrupt
437  *     (2.6.33)  - IR has always packet-per-buffer semantics now, not one of
438  *                 dual-buffer or packet-per-buffer depending on hardware
439  *               - shared use and auto-response for FCP registers
440  *  3  (2.6.34)  - made &fw_cdev_get_cycle_timer reliable
441  *               - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
442  *  4  (2.6.36)  - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*,
443  *                 and &fw_cdev_allocate.region_end
444  *               - implemented &fw_cdev_event_bus_reset.bm_node_id
445  *               - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS
446  *               - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
447  *                 %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
448  *                 %FW_CDEV_IOC_SET_ISO_CHANNELS
449  */
450 #define FW_CDEV_VERSION 3 /* Meaningless; don't use this macro. */
451
452 /**
453  * struct fw_cdev_get_info - General purpose information ioctl
454  * @version:    The version field is just a running serial number.  Both an
455  *              input parameter (ABI version implemented by the client) and
456  *              output parameter (ABI version implemented by the kernel).
457  *              A client must not fill in an %FW_CDEV_VERSION defined from an
458  *              included kernel header file but the actual version for which
459  *              the client was implemented.  This is necessary for forward
460  *              compatibility.  We never break backwards compatibility, but
461  *              may add more structs, events, and ioctls in later revisions.
462  * @rom_length: If @rom is non-zero, at most rom_length bytes of configuration
463  *              ROM will be copied into that user space address.  In either
464  *              case, @rom_length is updated with the actual length of the
465  *              configuration ROM.
466  * @rom:        If non-zero, address of a buffer to be filled by a copy of the
467  *              device's configuration ROM
468  * @bus_reset:  If non-zero, address of a buffer to be filled by a
469  *              &struct fw_cdev_event_bus_reset with the current state
470  *              of the bus.  This does not cause a bus reset to happen.
471  * @bus_reset_closure: Value of &closure in this and subsequent bus reset events
472  * @card:       The index of the card this device belongs to
473  */
474 struct fw_cdev_get_info {
475         __u32 version;
476         __u32 rom_length;
477         __u64 rom;
478         __u64 bus_reset;
479         __u64 bus_reset_closure;
480         __u32 card;
481 };
482
483 /**
484  * struct fw_cdev_send_request - Send an asynchronous request packet
485  * @tcode:      Transaction code of the request
486  * @length:     Length of outgoing payload, in bytes
487  * @offset:     48-bit offset at destination node
488  * @closure:    Passed back to userspace in the response event
489  * @data:       Userspace pointer to payload
490  * @generation: The bus generation where packet is valid
491  *
492  * Send a request to the device.  This ioctl implements all outgoing requests.
493  * Both quadlet and block request specify the payload as a pointer to the data
494  * in the @data field.  Once the transaction completes, the kernel writes an
495  * &fw_cdev_event_response event back.  The @closure field is passed back to
496  * user space in the response event.
497  */
498 struct fw_cdev_send_request {
499         __u32 tcode;
500         __u32 length;
501         __u64 offset;
502         __u64 closure;
503         __u64 data;
504         __u32 generation;
505 };
506
507 /**
508  * struct fw_cdev_send_response - Send an asynchronous response packet
509  * @rcode:      Response code as determined by the userspace handler
510  * @length:     Length of outgoing payload, in bytes
511  * @data:       Userspace pointer to payload
512  * @handle:     The handle from the &fw_cdev_event_request
513  *
514  * Send a response to an incoming request.  By setting up an address range using
515  * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests.  An
516  * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must
517  * send a reply using this ioctl.  The event has a handle to the kernel-side
518  * pending transaction, which should be used with this ioctl.
519  */
520 struct fw_cdev_send_response {
521         __u32 rcode;
522         __u32 length;
523         __u64 data;
524         __u32 handle;
525 };
526
527 /**
528  * struct fw_cdev_allocate - Allocate a CSR in an address range
529  * @offset:     Start offset of the address range
530  * @closure:    To be passed back to userspace in request events
531  * @length:     Length of the CSR, in bytes
532  * @handle:     Handle to the allocation, written by the kernel
533  * @region_end: First address above the address range (added in ABI v4, 2.6.36)
534  *
535  * Allocate an address range in the 48-bit address space on the local node
536  * (the controller).  This allows userspace to listen for requests with an
537  * offset within that address range.  Every time when the kernel receives a
538  * request within the range, an &fw_cdev_event_request2 event will be emitted.
539  * (If the kernel or the client implements ABI version <= 3, an
540  * &fw_cdev_event_request will be generated instead.)
541  *
542  * The @closure field is passed back to userspace in these request events.
543  * The @handle field is an out parameter, returning a handle to the allocated
544  * range to be used for later deallocation of the range.
545  *
546  * The address range is allocated on all local nodes.  The address allocation
547  * is exclusive except for the FCP command and response registers.  If an
548  * exclusive address region is already in use, the ioctl fails with errno set
549  * to %EBUSY.
550  *
551  * If kernel and client implement ABI version >= 4, the kernel looks up a free
552  * spot of size @length inside [@offset..@region_end) and, if found, writes
553  * the start address of the new CSR back in @offset.  I.e. @offset is an
554  * in and out parameter.  If this automatic placement of a CSR in a bigger
555  * address range is not desired, the client simply needs to set @region_end
556  * = @offset + @length.
557  *
558  * If the kernel or the client implements ABI version <= 3, @region_end is
559  * ignored and effectively assumed to be @offset + @length.
560  *
561  * @region_end is only present in a kernel header >= 2.6.36.  If necessary,
562  * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2.
563  */
564 struct fw_cdev_allocate {
565         __u64 offset;
566         __u64 closure;
567         __u32 length;
568         __u32 handle;
569         __u64 region_end;       /* available since kernel version 2.6.36 */
570 };
571
572 /**
573  * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
574  * @handle:     Handle to the address range or iso resource, as returned by the
575  *              kernel when the range or resource was allocated
576  */
577 struct fw_cdev_deallocate {
578         __u32 handle;
579 };
580
581 #define FW_CDEV_LONG_RESET      0
582 #define FW_CDEV_SHORT_RESET     1
583
584 /**
585  * struct fw_cdev_initiate_bus_reset - Initiate a bus reset
586  * @type:       %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET
587  *
588  * Initiate a bus reset for the bus this device is on.  The bus reset can be
589  * either the original (long) bus reset or the arbitrated (short) bus reset
590  * introduced in 1394a-2000.
591  *
592  * The ioctl returns immediately.  A subsequent &fw_cdev_event_bus_reset
593  * indicates when the reset actually happened.  Since ABI v4, this may be
594  * considerably later than the ioctl because the kernel ensures a grace period
595  * between subsequent bus resets as per IEEE 1394 bus management specification.
596  */
597 struct fw_cdev_initiate_bus_reset {
598         __u32 type;
599 };
600
601 /**
602  * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM
603  * @immediate:  If non-zero, immediate key to insert before pointer
604  * @key:        Upper 8 bits of root directory pointer
605  * @data:       Userspace pointer to contents of descriptor block
606  * @length:     Length of descriptor block data, in quadlets
607  * @handle:     Handle to the descriptor, written by the kernel
608  *
609  * Add a descriptor block and optionally a preceding immediate key to the local
610  * node's configuration ROM.
611  *
612  * The @key field specifies the upper 8 bits of the descriptor root directory
613  * pointer and the @data and @length fields specify the contents. The @key
614  * should be of the form 0xXX000000. The offset part of the root directory entry
615  * will be filled in by the kernel.
616  *
617  * If not 0, the @immediate field specifies an immediate key which will be
618  * inserted before the root directory pointer.
619  *
620  * @immediate, @key, and @data array elements are CPU-endian quadlets.
621  *
622  * If successful, the kernel adds the descriptor and writes back a @handle to
623  * the kernel-side object to be used for later removal of the descriptor block
624  * and immediate key.  The kernel will also generate a bus reset to signal the
625  * change of the configuration ROM to other nodes.
626  *
627  * This ioctl affects the configuration ROMs of all local nodes.
628  * The ioctl only succeeds on device files which represent a local node.
629  */
630 struct fw_cdev_add_descriptor {
631         __u32 immediate;
632         __u32 key;
633         __u64 data;
634         __u32 length;
635         __u32 handle;
636 };
637
638 /**
639  * struct fw_cdev_remove_descriptor - Remove contents from the configuration ROM
640  * @handle:     Handle to the descriptor, as returned by the kernel when the
641  *              descriptor was added
642  *
643  * Remove a descriptor block and accompanying immediate key from the local
644  * nodes' configuration ROMs.  The kernel will also generate a bus reset to
645  * signal the change of the configuration ROM to other nodes.
646  */
647 struct fw_cdev_remove_descriptor {
648         __u32 handle;
649 };
650
651 #define FW_CDEV_ISO_CONTEXT_TRANSMIT                    0
652 #define FW_CDEV_ISO_CONTEXT_RECEIVE                     1
653 #define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL        2 /* added in 2.6.36 */
654
655 /**
656  * struct fw_cdev_create_iso_context - Create a context for isochronous I/O
657  * @type:       %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or
658  *              %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL
659  * @header_size: Header size to strip in single-channel reception
660  * @channel:    Channel to bind to in single-channel reception or transmission
661  * @speed:      Transmission speed
662  * @closure:    To be returned in &fw_cdev_event_iso_interrupt or
663  *              &fw_cdev_event_iso_interrupt_multichannel
664  * @handle:     Handle to context, written back by kernel
665  *
666  * Prior to sending or receiving isochronous I/O, a context must be created.
667  * The context records information about the transmit or receive configuration
668  * and typically maps to an underlying hardware resource.  A context is set up
669  * for either sending or receiving.  It is bound to a specific isochronous
670  * @channel.
671  *
672  * In case of multichannel reception, @header_size and @channel are ignored
673  * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS.
674  *
675  * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4
676  * and must be a multiple of 4.  It is ignored in other context types.
677  *
678  * @speed is ignored in receive context types.
679  *
680  * If a context was successfully created, the kernel writes back a handle to the
681  * context, which must be passed in for subsequent operations on that context.
682  *
683  * Limitations:
684  * No more than one iso context can be created per fd.
685  * The total number of contexts that all userspace and kernelspace drivers can
686  * create on a card at a time is a hardware limit, typically 4 or 8 contexts per
687  * direction, and of them at most one multichannel receive context.
688  */
689 struct fw_cdev_create_iso_context {
690         __u32 type;
691         __u32 header_size;
692         __u32 channel;
693         __u32 speed;
694         __u64 closure;
695         __u32 handle;
696 };
697
698 /**
699  * struct fw_cdev_set_iso_channels - Select channels in multichannel reception
700  * @channels:   Bitmask of channels to listen to
701  * @handle:     Handle of the mutichannel receive context
702  *
703  * @channels is the bitwise or of 1ULL << n for each channel n to listen to.
704  *
705  * The ioctl fails with errno %EBUSY if there is already another receive context
706  * on a channel in @channels.  In that case, the bitmask of all unoccupied
707  * channels is returned in @channels.
708  */
709 struct fw_cdev_set_iso_channels {
710         __u64 channels;
711         __u32 handle;
712 };
713
714 #define FW_CDEV_ISO_PAYLOAD_LENGTH(v)   (v)
715 #define FW_CDEV_ISO_INTERRUPT           (1 << 16)
716 #define FW_CDEV_ISO_SKIP                (1 << 17)
717 #define FW_CDEV_ISO_SYNC                (1 << 17)
718 #define FW_CDEV_ISO_TAG(v)              ((v) << 18)
719 #define FW_CDEV_ISO_SY(v)               ((v) << 20)
720 #define FW_CDEV_ISO_HEADER_LENGTH(v)    ((v) << 24)
721
722 /**
723  * struct fw_cdev_iso_packet - Isochronous packet
724  * @control:    Contains the header length (8 uppermost bits),
725  *              the sy field (4 bits), the tag field (2 bits), a sync flag
726  *              or a skip flag (1 bit), an interrupt flag (1 bit), and the
727  *              payload length (16 lowermost bits)
728  * @header:     Header and payload in case of a transmit context.
729  *
730  * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
731  * Use the FW_CDEV_ISO_ macros to fill in @control.
732  * The @header array is empty in case of receive contexts.
733  *
734  * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT:
735  *
736  * @control.HEADER_LENGTH must be a multiple of 4.  It specifies the numbers of
737  * bytes in @header that will be prepended to the packet's payload.  These bytes
738  * are copied into the kernel and will not be accessed after the ioctl has
739  * returned.
740  *
741  * The @control.SY and TAG fields are copied to the iso packet header.  These
742  * fields are specified by IEEE 1394a and IEC 61883-1.
743  *
744  * The @control.SKIP flag specifies that no packet is to be sent in a frame.
745  * When using this, all other fields except @control.INTERRUPT must be zero.
746  *
747  * When a packet with the @control.INTERRUPT flag set has been completed, an
748  * &fw_cdev_event_iso_interrupt event will be sent.
749  *
750  * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE:
751  *
752  * @control.HEADER_LENGTH must be a multiple of the context's header_size.
753  * If the HEADER_LENGTH is larger than the context's header_size, multiple
754  * packets are queued for this entry.
755  *
756  * The @control.SY and TAG fields are ignored.
757  *
758  * If the @control.SYNC flag is set, the context drops all packets until a
759  * packet with a sy field is received which matches &fw_cdev_start_iso.sync.
760  *
761  * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for
762  * one packet (in addition to payload quadlets that have been defined as headers
763  * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure).
764  * If more bytes are received, the additional bytes are dropped.  If less bytes
765  * are received, the remaining bytes in this part of the payload buffer will not
766  * be written to, not even by the next packet.  I.e., packets received in
767  * consecutive frames will not necessarily be consecutive in memory.  If an
768  * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally
769  * among them.
770  *
771  * When a packet with the @control.INTERRUPT flag set has been completed, an
772  * &fw_cdev_event_iso_interrupt event will be sent.  An entry that has queued
773  * multiple receive packets is completed when its last packet is completed.
774  *
775  * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
776  *
777  * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since
778  * it specifies a chunk of the mmap()'ed buffer, while the number and alignment
779  * of packets to be placed into the buffer chunk is not known beforehand.
780  *
781  * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room
782  * for header, payload, padding, and trailer bytes of one or more packets.
783  * It must be a multiple of 4.
784  *
785  * @control.HEADER_LENGTH, TAG and SY are ignored.  SYNC is treated as described
786  * for single-channel reception.
787  *
788  * When a buffer chunk with the @control.INTERRUPT flag set has been filled
789  * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent.
790  */
791 struct fw_cdev_iso_packet {
792         __u32 control;
793         __u32 header[0];
794 };
795
796 /**
797  * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
798  * @packets:    Userspace pointer to an array of &fw_cdev_iso_packet
799  * @data:       Pointer into mmap()'ed payload buffer
800  * @size:       Size of the @packets array, in bytes
801  * @handle:     Isochronous context handle
802  *
803  * Queue a number of isochronous packets for reception or transmission.
804  * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
805  * which describe how to transmit from or receive into a contiguous region
806  * of a mmap()'ed payload buffer.  As part of transmit packet descriptors,
807  * a series of headers can be supplied, which will be prepended to the
808  * payload during DMA.
809  *
810  * The kernel may or may not queue all packets, but will write back updated
811  * values of the @packets, @data and @size fields, so the ioctl can be
812  * resubmitted easily.
813  *
814  * In case of a multichannel receive context, @data must be quadlet-aligned
815  * relative to the buffer start.
816  */
817 struct fw_cdev_queue_iso {
818         __u64 packets;
819         __u64 data;
820         __u32 size;
821         __u32 handle;
822 };
823
824 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG0           1
825 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG1           2
826 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG2           4
827 #define FW_CDEV_ISO_CONTEXT_MATCH_TAG3           8
828 #define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS      15
829
830 /**
831  * struct fw_cdev_start_iso - Start an isochronous transmission or reception
832  * @cycle:      Cycle in which to start I/O.  If @cycle is greater than or
833  *              equal to 0, the I/O will start on that cycle.
834  * @sync:       Determines the value to wait for for receive packets that have
835  *              the %FW_CDEV_ISO_SYNC bit set
836  * @tags:       Tag filter bit mask.  Only valid for isochronous reception.
837  *              Determines the tag values for which packets will be accepted.
838  *              Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags.
839  * @handle:     Isochronous context handle within which to transmit or receive
840  */
841 struct fw_cdev_start_iso {
842         __s32 cycle;
843         __u32 sync;
844         __u32 tags;
845         __u32 handle;
846 };
847
848 /**
849  * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception
850  * @handle:     Handle of isochronous context to stop
851  */
852 struct fw_cdev_stop_iso {
853         __u32 handle;
854 };
855
856 /**
857  * struct fw_cdev_get_cycle_timer - read cycle timer register
858  * @local_time:   system time, in microseconds since the Epoch
859  * @cycle_timer:  Cycle Time register contents
860  *
861  * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer
862  * and also the system clock (%CLOCK_REALTIME).  This allows to express the
863  * receive time of an isochronous packet as a system time.
864  *
865  * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
866  * 12 bits cycleOffset, in host byte order.  Cf. the Cycle Time register
867  * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
868  *
869  * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
870  * monotonic) @cycle_timer values on certain controllers.
871  */
872 struct fw_cdev_get_cycle_timer {
873         __u64 local_time;
874         __u32 cycle_timer;
875 };
876
877 /**
878  * struct fw_cdev_get_cycle_timer2 - read cycle timer register
879  * @tv_sec:       system time, seconds
880  * @tv_nsec:      system time, sub-seconds part in nanoseconds
881  * @clk_id:       input parameter, clock from which to get the system time
882  * @cycle_timer:  Cycle Time register contents
883  *
884  * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like
885  * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX'
886  * clock_gettime function.  Supported @clk_id values are POSIX' %CLOCK_REALTIME
887  * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW.
888  */
889 struct fw_cdev_get_cycle_timer2 {
890         __s64 tv_sec;
891         __s32 tv_nsec;
892         __s32 clk_id;
893         __u32 cycle_timer;
894 };
895
896 /**
897  * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
898  * @closure:    Passed back to userspace in correponding iso resource events
899  * @channels:   Isochronous channels of which one is to be (de)allocated
900  * @bandwidth:  Isochronous bandwidth units to be (de)allocated
901  * @handle:     Handle to the allocation, written by the kernel (only valid in
902  *              case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
903  *
904  * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
905  * isochronous channel and/or of isochronous bandwidth at the isochronous
906  * resource manager (IRM).  Only one of the channels specified in @channels is
907  * allocated.  An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
908  * communication with the IRM, indicating success or failure in the event data.
909  * The kernel will automatically reallocate the resources after bus resets.
910  * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
911  * will be sent.  The kernel will also automatically deallocate the resources
912  * when the file descriptor is closed.
913  *
914  * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
915  * deallocation of resources which were allocated as described above.
916  * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
917  *
918  * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
919  * without automatic re- or deallocation.
920  * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
921  * indicating success or failure in its data.
922  *
923  * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
924  * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
925  * instead of allocated.
926  * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
927  *
928  * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
929  * for the lifetime of the fd or @handle.
930  * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
931  * for the duration of a bus generation.
932  *
933  * @channels is a host-endian bitfield with the least significant bit
934  * representing channel 0 and the most significant bit representing channel 63:
935  * 1ULL << c for each channel c that is a candidate for (de)allocation.
936  *
937  * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
938  * one quadlet of data (payload or header data) at speed S1600.
939  */
940 struct fw_cdev_allocate_iso_resource {
941         __u64 closure;
942         __u64 channels;
943         __u32 bandwidth;
944         __u32 handle;
945 };
946
947 /**
948  * struct fw_cdev_send_stream_packet - send an asynchronous stream packet
949  * @length:     Length of outgoing payload, in bytes
950  * @tag:        Data format tag
951  * @channel:    Isochronous channel to transmit to
952  * @sy:         Synchronization code
953  * @closure:    Passed back to userspace in the response event
954  * @data:       Userspace pointer to payload
955  * @generation: The bus generation where packet is valid
956  * @speed:      Speed to transmit at
957  *
958  * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
959  * to every device which is listening to the specified channel.  The kernel
960  * writes an &fw_cdev_event_response event which indicates success or failure of
961  * the transmission.
962  */
963 struct fw_cdev_send_stream_packet {
964         __u32 length;
965         __u32 tag;
966         __u32 channel;
967         __u32 sy;
968         __u64 closure;
969         __u64 data;
970         __u32 generation;
971         __u32 speed;
972 };
973
974 /**
975  * struct fw_cdev_send_phy_packet - send a PHY packet
976  * @closure:    Passed back to userspace in the PHY-packet-sent event
977  * @data:       First and second quadlet of the PHY packet
978  * @generation: The bus generation where packet is valid
979  *
980  * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
981  * on the same card as this device.  After transmission, an
982  * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
983  *
984  * The payload @data[] shall be specified in host byte order.  Usually,
985  * @data[1] needs to be the bitwise inverse of @data[0].  VersaPHY packets
986  * are an exception to this rule.
987  *
988  * The ioctl is only permitted on device files which represent a local node.
989  */
990 struct fw_cdev_send_phy_packet {
991         __u64 closure;
992         __u32 data[2];
993         __u32 generation;
994 };
995
996 /**
997  * struct fw_cdev_receive_phy_packets - start reception of PHY packets
998  * @closure: Passed back to userspace in phy packet events
999  *
1000  * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
1001  * incoming PHY packets from any node on the same bus as the device.
1002  *
1003  * The ioctl is only permitted on device files which represent a local node.
1004  */
1005 struct fw_cdev_receive_phy_packets {
1006         __u64 closure;
1007 };
1008
1009 #endif /* _LINUX_FIREWIRE_CDEV_H */