blob: 1acd2b179aeff6a1bd560d9a50421d48faeaf451 [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 *
Stefan Richter19b3eec2010-04-11 11:52:12 +02004 * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net>
Kristian Høgsberg19a15b92006-12-19 19:58:31 -05005 *
Stefan Richter19b3eec2010-04-11 11:52:12 +02006 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050012 *
Stefan Richter19b3eec2010-04-11 11:52:12 +020013 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050016 *
Stefan Richter19b3eec2010-04-11 11:52:12 +020017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
Stefan Richtera2612cb2010-04-15 22:16:04 +020020 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
Stefan Richter19b3eec2010-04-11 11:52:12 +020021 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 * DEALINGS IN THE SOFTWARE.
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050024 */
25
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -040026#ifndef _LINUX_FIREWIRE_CDEV_H
27#define _LINUX_FIREWIRE_CDEV_H
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050028
Kristian Høgsberg04dfb8d2007-05-07 20:33:36 -040029#include <linux/ioctl.h>
30#include <linux/types.h>
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -040031#include <linux/firewire-constants.h>
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050032
Stefan Richterf6a7cd02011-07-14 21:08:39 +020033/* available since kernel version 2.6.22 */
Stefan Richter872e3302010-07-29 18:19:22 +020034#define FW_CDEV_EVENT_BUS_RESET 0x00
35#define FW_CDEV_EVENT_RESPONSE 0x01
36#define FW_CDEV_EVENT_REQUEST 0x02
37#define FW_CDEV_EVENT_ISO_INTERRUPT 0x03
Stefan Richterf6a7cd02011-07-14 21:08:39 +020038
39/* available since kernel version 2.6.30 */
Stefan Richter872e3302010-07-29 18:19:22 +020040#define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04
41#define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050042
Stefan Richtere2055972010-06-20 22:53:55 +020043/* available since kernel version 2.6.36 */
Stefan Richter872e3302010-07-29 18:19:22 +020044#define FW_CDEV_EVENT_REQUEST2 0x06
45#define FW_CDEV_EVENT_PHY_PACKET_SENT 0x07
46#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08
47#define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09
Kristian Høgsberg19a15b92006-12-19 19:58:31 -050048
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020049/**
Randy Dunlap9a400682018-09-04 17:02:21 -070050 * struct fw_cdev_event_common - Common part of all fw_cdev_event_* types
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020051 * @closure: For arbitrary use by userspace
Randy Dunlap9a400682018-09-04 17:02:21 -070052 * @type: Discriminates the fw_cdev_event_* types
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020053 *
Randy Dunlap9a400682018-09-04 17:02:21 -070054 * This struct may be used to access generic members of all fw_cdev_event_*
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020055 * types regardless of the specific type.
56 *
57 * Data passed in the @closure field for a request will be returned in the
58 * corresponding event. It is big enough to hold a pointer on all platforms.
59 * The ioctl used to set @closure depends on the @type of event.
60 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -040061struct fw_cdev_event_common {
62 __u64 closure;
63 __u32 type;
64};
65
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020066/**
67 * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred
68 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl
69 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET
70 * @node_id: New node ID of this node
71 * @local_node_id: Node ID of the local node, i.e. of the controller
72 * @bm_node_id: Node ID of the bus manager
73 * @irm_node_id: Node ID of the iso resource manager
74 * @root_node_id: Node ID of the root node
75 * @generation: New bus generation
76 *
77 * This event is sent when the bus the device belongs to goes through a bus
78 * reset. It provides information about the new bus configuration, such as
79 * new node ID for this device, new root ID, and others.
Stefan Richter250b2b62010-06-21 23:24:35 +020080 *
81 * If @bm_node_id is 0xffff right after bus reset it can be reread by an
82 * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished.
83 * Kernels with ABI version < 4 do not set @bm_node_id.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020084 */
Kristian Høgsberg97bd9ef2007-03-07 12:12:41 -050085struct fw_cdev_event_bus_reset {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -040086 __u64 closure;
Kristian Høgsberg97bd9ef2007-03-07 12:12:41 -050087 __u32 type;
88 __u32 node_id;
89 __u32 local_node_id;
90 __u32 bm_node_id;
91 __u32 irm_node_id;
92 __u32 root_node_id;
93 __u32 generation;
94};
95
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +020096/**
97 * struct fw_cdev_event_response - Sent when a response packet was received
Stefan Richterd505e6e2010-07-17 21:36:02 +020098 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
99 * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
100 * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200101 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
102 * @rcode: Response code returned by the remote node
103 * @length: Data length, i.e. the response's payload size in bytes
104 * @data: Payload data, if any
105 *
106 * This event is sent when the stack receives a response to an outgoing request
107 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses
108 * carrying data (read and lock responses) follows immediately and can be
109 * accessed through the @data field.
Stefan Richterd505e6e2010-07-17 21:36:02 +0200110 *
111 * The event is also generated after conclusions of transactions that do not
112 * involve response packets. This includes unified write transactions,
113 * broadcast write transactions, and transmission of asynchronous stream
114 * packets. @rcode indicates success or failure of such transmissions.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200115 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500116struct fw_cdev_event_response {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400117 __u64 closure;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500118 __u32 type;
119 __u32 rcode;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500120 __u32 length;
121 __u32 data[0];
122};
123
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200124/**
Stefan Richtere2055972010-06-20 22:53:55 +0200125 * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
Randy Dunlap9a400682018-09-04 17:02:21 -0700126 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200127 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
Randy Dunlap9a400682018-09-04 17:02:21 -0700128 * @tcode: Transaction code of the incoming request
129 * @offset: The offset into the 48-bit per-node address space
130 * @handle: Reference to the kernel-side pending request
131 * @length: Data length, i.e. the request's payload size in bytes
132 * @data: Incoming data, if any
Stefan Richtere2055972010-06-20 22:53:55 +0200133 *
134 * This event is sent instead of &fw_cdev_event_request2 if the kernel or
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200135 * the client implements ABI version <= 3. &fw_cdev_event_request lacks
136 * essential information; use &fw_cdev_event_request2 instead.
Stefan Richtere2055972010-06-20 22:53:55 +0200137 */
138struct fw_cdev_event_request {
139 __u64 closure;
140 __u32 type;
141 __u32 tcode;
142 __u64 offset;
143 __u32 handle;
144 __u32 length;
145 __u32 data[0];
146};
147
148/**
149 * struct fw_cdev_event_request2 - Sent on incoming request to an address region
150 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
151 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200152 * @tcode: Transaction code of the incoming request
153 * @offset: The offset into the 48-bit per-node address space
Stefan Richtere2055972010-06-20 22:53:55 +0200154 * @source_node_id: Sender node ID
155 * @destination_node_id: Destination node ID
156 * @card: The index of the card from which the request came
157 * @generation: Bus generation in which the request is valid
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200158 * @handle: Reference to the kernel-side pending request
159 * @length: Data length, i.e. the request's payload size in bytes
160 * @data: Incoming data, if any
161 *
162 * This event is sent when the stack receives an incoming request to an address
163 * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is
164 * guaranteed to be completely contained in the specified region. Userspace is
165 * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl,
166 * using the same @handle.
167 *
168 * The payload data for requests carrying data (write and lock requests)
169 * follows immediately and can be accessed through the @data field.
Stefan Richtere2055972010-06-20 22:53:55 +0200170 *
171 * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the
172 * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT,
173 * i.e. encodes the extended transaction code.
174 *
175 * @card may differ from &fw_cdev_get_info.card because requests are received
176 * from all cards of the Linux host. @source_node_id, @destination_node_id, and
177 * @generation pertain to that card. Destination node ID and bus generation may
178 * therefore differ from the corresponding fields of the last
179 * &fw_cdev_event_bus_reset.
180 *
181 * @destination_node_id may also differ from the current node ID because of a
182 * non-local bus ID part or in case of a broadcast write request. Note, a
183 * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a
184 * broadcast write request; the kernel will then release the kernel-side pending
185 * request but will not actually send a response packet.
186 *
187 * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already
188 * sent a write response immediately after the request was received; in this
189 * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to
190 * release the kernel-side pending request, though another response won't be
191 * sent.
192 *
193 * If the client subsequently needs to initiate requests to the sender node of
194 * an &fw_cdev_event_request2, it needs to use a device file with matching
195 * card index, node ID, and generation for outbound requests.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200196 */
Stefan Richtere2055972010-06-20 22:53:55 +0200197struct fw_cdev_event_request2 {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400198 __u64 closure;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500199 __u32 type;
200 __u32 tcode;
201 __u64 offset;
Stefan Richtere2055972010-06-20 22:53:55 +0200202 __u32 source_node_id;
203 __u32 destination_node_id;
204 __u32 card;
205 __u32 generation;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400206 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500207 __u32 length;
208 __u32 data[0];
209};
210
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200211/**
212 * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed
213 * @closure: See &fw_cdev_event_common;
214 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
215 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT
Clemens Ladisch18d62712012-03-18 19:05:29 +0100216 * @cycle: Cycle counter of the last completed packet
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200217 * @header_length: Total length of following headers, in bytes
218 * @header: Stripped headers, if any
219 *
220 * This event is sent when the controller has completed an &fw_cdev_iso_packet
Clemens Ladischd1bbd202012-03-18 19:06:39 +0100221 * with the %FW_CDEV_ISO_INTERRUPT bit set, when explicitly requested with
222 * %FW_CDEV_IOC_FLUSH_ISO, or when there have been so many completed packets
223 * without the interrupt bit set that the kernel's internal buffer for @header
Clemens Ladisch0699a732013-07-22 21:32:09 +0200224 * is about to overflow. (In the last case, ABI versions < 5 drop header data
225 * up to the next interrupt packet.)
Stefan Richter77258da2009-01-07 20:14:53 +0100226 *
Stefan Richter872e3302010-07-29 18:19:22 +0200227 * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
Stefan Richter77258da2009-01-07 20:14:53 +0100228 *
Stefan Richter872e3302010-07-29 18:19:22 +0200229 * In version 3 and some implementations of version 2 of the ABI, &header_length
230 * is a multiple of 4 and &header contains timestamps of all packets up until
231 * the interrupt packet. The format of the timestamps is as described below for
232 * isochronous reception. In version 1 of the ABI, &header_length was 0.
Stefan Richter77258da2009-01-07 20:14:53 +0100233 *
Stefan Richter872e3302010-07-29 18:19:22 +0200234 * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE):
Stefan Richter3b2b65d2010-06-20 22:54:22 +0200235 *
236 * The headers stripped of all packets up until and including the interrupt
237 * packet are returned in the @header field. The amount of header data per
238 * packet is as specified at iso context creation by
239 * &fw_cdev_create_iso_context.header_size.
Stefan Richter77258da2009-01-07 20:14:53 +0100240 *
Stefan Richter872e3302010-07-29 18:19:22 +0200241 * Hence, _interrupt.header_length / _context.header_size is the number of
242 * packets received in this interrupt event. The client can now iterate
243 * through the mmap()'ed DMA buffer according to this number of packets and
244 * to the buffer sizes as the client specified in &fw_cdev_queue_iso.
Stefan Richter77258da2009-01-07 20:14:53 +0100245 *
Stefan Richter872e3302010-07-29 18:19:22 +0200246 * Since version 2 of this ABI, the portion for each packet in _interrupt.header
247 * consists of the 1394 isochronous packet header, followed by a timestamp
248 * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets
249 * from the packet payload if &fw_cdev_create_iso_context.header_size > 8.
Stefan Richter77258da2009-01-07 20:14:53 +0100250 *
Stefan Richter872e3302010-07-29 18:19:22 +0200251 * Format of 1394 iso packet header: 16 bits data_length, 2 bits tag, 6 bits
252 * channel, 4 bits tcode, 4 bits sy, in big endian byte order.
253 * data_length is the actual received size of the packet without the four
254 * 1394 iso packet header bytes.
255 *
256 * Format of timestamp: 16 bits invalid, 3 bits cycleSeconds, 13 bits
257 * cycleCount, in big endian byte order.
258 *
259 * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload
260 * data followed directly after the 1394 is header if header_size > 4.
Stefan Richter77258da2009-01-07 20:14:53 +0100261 * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200262 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500263struct fw_cdev_event_iso_interrupt {
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400264 __u64 closure;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500265 __u32 type;
266 __u32 cycle;
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200267 __u32 header_length;
Kristian Høgsberg9b32d5f2007-02-16 17:34:44 -0500268 __u32 header[0];
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500269};
270
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200271/**
Stefan Richter872e3302010-07-29 18:19:22 +0200272 * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed
273 * @closure: See &fw_cdev_event_common;
274 * set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
275 * @type: %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400276 * @completed: Offset into the receive buffer; data before this offset is valid
Stefan Richter872e3302010-07-29 18:19:22 +0200277 *
278 * This event is sent in multichannel contexts (context type
279 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
Clemens Ladischa7611e82012-03-12 21:46:55 +0100280 * chunks that have been completely filled and that have the
Clemens Ladischd1bbd202012-03-18 19:06:39 +0100281 * %FW_CDEV_ISO_INTERRUPT bit set, or when explicitly requested with
282 * %FW_CDEV_IOC_FLUSH_ISO.
Stefan Richter872e3302010-07-29 18:19:22 +0200283 *
284 * The buffer is continuously filled with the following data, per packet:
285 * - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
286 * but in little endian byte order,
287 * - packet payload (as many bytes as specified in the data_length field of
288 * the 1394 iso packet header) in big endian byte order,
289 * - 0...3 padding bytes as needed to align the following trailer quadlet,
290 * - trailer quadlet, containing the reception timestamp as described at
291 * &fw_cdev_event_iso_interrupt, but in little endian byte order.
292 *
293 * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8.
294 * When processing the data, stop before a packet that would cross the
295 * @completed offset.
296 *
297 * A packet near the end of a buffer chunk will typically spill over into the
298 * next queued buffer chunk. It is the responsibility of the client to check
299 * for this condition, assemble a broken-up packet from its parts, and not to
300 * re-queue any buffer chunks in which as yet unread packet parts reside.
301 */
302struct fw_cdev_event_iso_interrupt_mc {
303 __u64 closure;
304 __u32 type;
305 __u32 completed;
306};
307
308/**
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100309 * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
310 * @closure: See &fw_cdev_event_common;
Stefan Richter1ec3c022009-01-04 16:23:29 +0100311 * set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100312 * @type: %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
313 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
314 * @handle: Reference by which an allocated resource can be deallocated
315 * @channel: Isochronous channel which was (de)allocated, if any
316 * @bandwidth: Bandwidth allocation units which were (de)allocated, if any
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100317 *
318 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
319 * resource was allocated at the IRM. The client has to check @channel and
320 * @bandwidth for whether the allocation actually succeeded.
321 *
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100322 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
323 * resource was deallocated at the IRM. It is also sent when automatic
324 * reallocation after a bus reset failed.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100325 *
326 * @channel is <0 if no channel was (de)allocated or if reallocation failed.
327 * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100328 */
329struct fw_cdev_event_iso_resource {
330 __u64 closure;
331 __u32 type;
332 __u32 handle;
333 __s32 channel;
334 __s32 bandwidth;
335};
336
337/**
Stefan Richterbf54e142010-07-16 22:25:51 +0200338 * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received
339 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
340 * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
341 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
Stefan Richter850bb6f2010-07-16 22:25:14 +0200342 * @rcode: %RCODE_..., indicates success or failure of transmission
Stefan Richterbf54e142010-07-16 22:25:51 +0200343 * @length: Data length in bytes
344 * @data: Incoming data
345 *
Stefan Richtercc550212010-07-18 13:00:50 +0200346 * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
347 * except in case of a ping packet: Then, @length is 4, and @data[0] is the
348 * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
349 *
Stefan Richterbf54e142010-07-16 22:25:51 +0200350 * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
351 * consists of the two PHY packet quadlets, in host byte order.
Stefan Richter850bb6f2010-07-16 22:25:14 +0200352 */
353struct fw_cdev_event_phy_packet {
354 __u64 closure;
355 __u32 type;
356 __u32 rcode;
Stefan Richterbf54e142010-07-16 22:25:51 +0200357 __u32 length;
358 __u32 data[0];
Stefan Richter850bb6f2010-07-16 22:25:14 +0200359};
360
361/**
Randy Dunlap9a400682018-09-04 17:02:21 -0700362 * union fw_cdev_event - Convenience union of fw_cdev_event_* types
Stefan Richter872e3302010-07-29 18:19:22 +0200363 * @common: Valid for all types
364 * @bus_reset: Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
365 * @response: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
366 * @request: Valid if @common.type == %FW_CDEV_EVENT_REQUEST
367 * @request2: Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
368 * @iso_interrupt: Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
369 * @iso_interrupt_mc: Valid if @common.type ==
370 * %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
371 * @iso_resource: Valid if @common.type ==
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100372 * %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
373 * %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
Stefan Richter872e3302010-07-29 18:19:22 +0200374 * @phy_packet: Valid if @common.type ==
Stefan Richterbf54e142010-07-16 22:25:51 +0200375 * %FW_CDEV_EVENT_PHY_PACKET_SENT or
376 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200377 *
Jay Fenlasonbe585c02008-10-01 18:13:20 -0400378 * Convenience union for userspace use. Events could be read(2) into an
379 * appropriately aligned char buffer and then cast to this union for further
380 * processing. Note that for a request, response or iso_interrupt event,
381 * the data[] or header[] may make the size of the full event larger than
382 * sizeof(union fw_cdev_event). Also note that if you attempt to read(2)
383 * an event into a buffer that is not large enough for it, the data that does
384 * not fit will be discarded so that the next read(2) will return a new event.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200385 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400386union fw_cdev_event {
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100387 struct fw_cdev_event_common common;
388 struct fw_cdev_event_bus_reset bus_reset;
389 struct fw_cdev_event_response response;
390 struct fw_cdev_event_request request;
Stefan Richter872e3302010-07-29 18:19:22 +0200391 struct fw_cdev_event_request2 request2; /* added in 2.6.36 */
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100392 struct fw_cdev_event_iso_interrupt iso_interrupt;
Stefan Richter872e3302010-07-29 18:19:22 +0200393 struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */
394 struct fw_cdev_event_iso_resource iso_resource; /* added in 2.6.30 */
395 struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400396};
397
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100398/* available since kernel version 2.6.22 */
Stefan Richterc8a25902009-03-10 20:59:16 +0100399#define FW_CDEV_IOC_GET_INFO _IOWR('#', 0x00, struct fw_cdev_get_info)
400#define FW_CDEV_IOC_SEND_REQUEST _IOW('#', 0x01, struct fw_cdev_send_request)
401#define FW_CDEV_IOC_ALLOCATE _IOWR('#', 0x02, struct fw_cdev_allocate)
402#define FW_CDEV_IOC_DEALLOCATE _IOW('#', 0x03, struct fw_cdev_deallocate)
403#define FW_CDEV_IOC_SEND_RESPONSE _IOW('#', 0x04, struct fw_cdev_send_response)
404#define FW_CDEV_IOC_INITIATE_BUS_RESET _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
405#define FW_CDEV_IOC_ADD_DESCRIPTOR _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
406#define FW_CDEV_IOC_REMOVE_DESCRIPTOR _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
407#define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
408#define FW_CDEV_IOC_QUEUE_ISO _IOWR('#', 0x09, struct fw_cdev_queue_iso)
409#define FW_CDEV_IOC_START_ISO _IOW('#', 0x0a, struct fw_cdev_start_iso)
410#define FW_CDEV_IOC_STOP_ISO _IOW('#', 0x0b, struct fw_cdev_stop_iso)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100411
412/* available since kernel version 2.6.24 */
Stefan Richterc8a25902009-03-10 20:59:16 +0100413#define FW_CDEV_IOC_GET_CYCLE_TIMER _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500414
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100415/* available since kernel version 2.6.30 */
Stefan Richter1ec3c022009-01-04 16:23:29 +0100416#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
417#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE _IOW('#', 0x0e, struct fw_cdev_deallocate)
418#define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
419#define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
Stefan Richterc8a25902009-03-10 20:59:16 +0100420#define FW_CDEV_IOC_GET_SPEED _IO('#', 0x11) /* returns speed code */
Jay Fenlason, Stefan Richteracfe8332009-01-04 16:23:29 +0100421#define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request)
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100422#define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100423
Stefan Richterabfe5a02010-02-20 12:13:49 +0100424/* available since kernel version 2.6.34 */
425#define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
426
Stefan Richter850bb6f2010-07-16 22:25:14 +0200427/* available since kernel version 2.6.36 */
428#define FW_CDEV_IOC_SEND_PHY_PACKET _IOWR('#', 0x15, struct fw_cdev_send_phy_packet)
Stefan Richterbf54e142010-07-16 22:25:51 +0200429#define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
Stefan Richter872e3302010-07-29 18:19:22 +0200430#define FW_CDEV_IOC_SET_ISO_CHANNELS _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
Stefan Richter850bb6f2010-07-16 22:25:14 +0200431
Clemens Ladischd1bbd202012-03-18 19:06:39 +0100432/* available since kernel version 3.4 */
433#define FW_CDEV_IOC_FLUSH_ISO _IOW('#', 0x18, struct fw_cdev_flush_iso)
434
Stefan Richter77258da2009-01-07 20:14:53 +0100435/*
Stefan Richter604f4512010-06-20 22:52:55 +0200436 * ABI version history
Stefan Richter77258da2009-01-07 20:14:53 +0100437 * 1 (2.6.22) - initial version
Stefan Richter604f4512010-06-20 22:52:55 +0200438 * (2.6.24) - added %FW_CDEV_IOC_GET_CYCLE_TIMER
Stefan Richter77258da2009-01-07 20:14:53 +0100439 * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if
440 * &fw_cdev_create_iso_context.header_size is 8 or more
Stefan Richter604f4512010-06-20 22:52:55 +0200441 * - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
442 * %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
443 * %FW_CDEV_IOC_SEND_STREAM_PACKET
Stefan Richtere94b6d72010-02-21 12:48:57 +0100444 * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt
445 * (2.6.33) - IR has always packet-per-buffer semantics now, not one of
446 * dual-buffer or packet-per-buffer depending on hardware
Stefan Richtere2055972010-06-20 22:53:55 +0200447 * - shared use and auto-response for FCP registers
Stefan Richtere94b6d72010-02-21 12:48:57 +0100448 * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
Stefan Richter604f4512010-06-20 22:52:55 +0200449 * - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
Stefan Richter872e3302010-07-29 18:19:22 +0200450 * 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*,
451 * and &fw_cdev_allocate.region_end
Stefan Richter250b2b62010-06-21 23:24:35 +0200452 * - implemented &fw_cdev_event_bus_reset.bm_node_id
Stefan Richterbf54e142010-07-16 22:25:51 +0200453 * - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS
Stefan Richter872e3302010-07-29 18:19:22 +0200454 * - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
455 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
456 * %FW_CDEV_IOC_SET_ISO_CHANNELS
Clemens Ladisch18d62712012-03-18 19:05:29 +0100457 * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to
458 * avoid dropping data
Clemens Ladischd1bbd202012-03-18 19:06:39 +0100459 * - added %FW_CDEV_IOC_FLUSH_ISO
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500460 */
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500461
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200462/**
463 * struct fw_cdev_get_info - General purpose information ioctl
Stefan Richter604f4512010-06-20 22:52:55 +0200464 * @version: The version field is just a running serial number. Both an
465 * input parameter (ABI version implemented by the client) and
466 * output parameter (ABI version implemented by the kernel).
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200467 * A client shall fill in the ABI @version for which the client
468 * was implemented. This is necessary for forward compatibility.
469 * @rom_length: If @rom is non-zero, up to @rom_length bytes of Configuration
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200470 * ROM will be copied into that user space address. In either
471 * case, @rom_length is updated with the actual length of the
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200472 * Configuration ROM.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200473 * @rom: If non-zero, address of a buffer to be filled by a copy of the
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200474 * device's Configuration ROM
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200475 * @bus_reset: If non-zero, address of a buffer to be filled by a
476 * &struct fw_cdev_event_bus_reset with the current state
477 * of the bus. This does not cause a bus reset to happen.
478 * @bus_reset_closure: Value of &closure in this and subsequent bus reset events
479 * @card: The index of the card this device belongs to
Stefan Richter93b37902011-07-09 16:43:22 +0200480 *
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200481 * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client
482 * performs right after it opened a /dev/fw* file.
483 *
Stefan Richter93b37902011-07-09 16:43:22 +0200484 * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2)
485 * is started by this ioctl.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200486 */
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500487struct fw_cdev_get_info {
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500488 __u32 version;
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500489 __u32 rom_length;
490 __u64 rom;
Kristian Høgsberg344bbc42007-03-07 12:12:43 -0500491 __u64 bus_reset;
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400492 __u64 bus_reset_closure;
Kristian Høgsberge7533502007-03-07 12:12:52 -0500493 __u32 card;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500494};
495
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200496/**
497 * struct fw_cdev_send_request - Send an asynchronous request packet
498 * @tcode: Transaction code of the request
499 * @length: Length of outgoing payload, in bytes
500 * @offset: 48-bit offset at destination node
501 * @closure: Passed back to userspace in the response event
502 * @data: Userspace pointer to payload
503 * @generation: The bus generation where packet is valid
504 *
505 * Send a request to the device. This ioctl implements all outgoing requests.
506 * Both quadlet and block request specify the payload as a pointer to the data
507 * in the @data field. Once the transaction completes, the kernel writes an
Stefan Richterbf8e3352008-12-05 22:43:41 +0100508 * &fw_cdev_event_response event back. The @closure field is passed back to
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200509 * user space in the response event.
510 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500511struct fw_cdev_send_request {
512 __u32 tcode;
513 __u32 length;
514 __u64 offset;
515 __u64 closure;
516 __u64 data;
Kristian Høgsberg97e35272007-03-07 12:12:53 -0500517 __u32 generation;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500518};
519
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200520/**
521 * struct fw_cdev_send_response - Send an asynchronous response packet
522 * @rcode: Response code as determined by the userspace handler
523 * @length: Length of outgoing payload, in bytes
524 * @data: Userspace pointer to payload
525 * @handle: The handle from the &fw_cdev_event_request
526 *
527 * Send a response to an incoming request. By setting up an address range using
528 * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests. An
529 * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must
530 * send a reply using this ioctl. The event has a handle to the kernel-side
531 * pending transaction, which should be used with this ioctl.
532 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500533struct fw_cdev_send_response {
534 __u32 rcode;
535 __u32 length;
536 __u64 data;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400537 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500538};
539
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200540/**
Stefan Richter8e2b2b42010-07-23 13:05:39 +0200541 * struct fw_cdev_allocate - Allocate a CSR in an address range
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200542 * @offset: Start offset of the address range
543 * @closure: To be passed back to userspace in request events
Stefan Richter8e2b2b42010-07-23 13:05:39 +0200544 * @length: Length of the CSR, in bytes
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200545 * @handle: Handle to the allocation, written by the kernel
Stefan Richter8e2b2b42010-07-23 13:05:39 +0200546 * @region_end: First address above the address range (added in ABI v4, 2.6.36)
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200547 *
548 * Allocate an address range in the 48-bit address space on the local node
549 * (the controller). This allows userspace to listen for requests with an
Stefan Richter8e2b2b42010-07-23 13:05:39 +0200550 * offset within that address range. Every time when the kernel receives a
551 * request within the range, an &fw_cdev_event_request2 event will be emitted.
552 * (If the kernel or the client implements ABI version <= 3, an
553 * &fw_cdev_event_request will be generated instead.)
554 *
555 * The @closure field is passed back to userspace in these request events.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200556 * The @handle field is an out parameter, returning a handle to the allocated
557 * range to be used for later deallocation of the range.
Clemens Ladischdb5d2472009-12-24 12:05:58 +0100558 *
559 * The address range is allocated on all local nodes. The address allocation
Stefan Richterd505e6e2010-07-17 21:36:02 +0200560 * is exclusive except for the FCP command and response registers. If an
561 * exclusive address region is already in use, the ioctl fails with errno set
562 * to %EBUSY.
Stefan Richter8e2b2b42010-07-23 13:05:39 +0200563 *
564 * If kernel and client implement ABI version >= 4, the kernel looks up a free
565 * spot of size @length inside [@offset..@region_end) and, if found, writes
566 * the start address of the new CSR back in @offset. I.e. @offset is an
567 * in and out parameter. If this automatic placement of a CSR in a bigger
568 * address range is not desired, the client simply needs to set @region_end
569 * = @offset + @length.
570 *
571 * If the kernel or the client implements ABI version <= 3, @region_end is
572 * ignored and effectively assumed to be @offset + @length.
573 *
574 * @region_end is only present in a kernel header >= 2.6.36. If necessary,
575 * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200576 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500577struct fw_cdev_allocate {
578 __u64 offset;
579 __u64 closure;
580 __u32 length;
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400581 __u32 handle;
Stefan Richter8e2b2b42010-07-23 13:05:39 +0200582 __u64 region_end; /* available since kernel version 2.6.36 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500583};
584
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200585/**
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100586 * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
587 * @handle: Handle to the address range or iso resource, as returned by the
588 * kernel when the range or resource was allocated
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200589 */
Kristian Høgsberg94723162007-03-14 17:34:55 -0400590struct fw_cdev_deallocate {
Kristian Høgsberg3964a442007-03-27 01:43:41 -0400591 __u32 handle;
Kristian Høgsberg94723162007-03-14 17:34:55 -0400592};
593
Kristian Høgsberg53718422007-03-07 12:12:42 -0500594#define FW_CDEV_LONG_RESET 0
595#define FW_CDEV_SHORT_RESET 1
596
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200597/**
598 * struct fw_cdev_initiate_bus_reset - Initiate a bus reset
599 * @type: %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET
600 *
601 * Initiate a bus reset for the bus this device is on. The bus reset can be
602 * either the original (long) bus reset or the arbitrated (short) bus reset
603 * introduced in 1394a-2000.
Stefan Richterd505e6e2010-07-17 21:36:02 +0200604 *
605 * The ioctl returns immediately. A subsequent &fw_cdev_event_bus_reset
606 * indicates when the reset actually happened. Since ABI v4, this may be
607 * considerably later than the ioctl because the kernel ensures a grace period
608 * between subsequent bus resets as per IEEE 1394 bus management specification.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200609 */
Kristian Høgsberg53718422007-03-07 12:12:42 -0500610struct fw_cdev_initiate_bus_reset {
Stefan Richterd505e6e2010-07-17 21:36:02 +0200611 __u32 type;
Kristian Høgsberg53718422007-03-07 12:12:42 -0500612};
613
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200614/**
615 * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM
616 * @immediate: If non-zero, immediate key to insert before pointer
617 * @key: Upper 8 bits of root directory pointer
618 * @data: Userspace pointer to contents of descriptor block
Stefan Richter6d3faf62010-01-24 14:48:00 +0100619 * @length: Length of descriptor block data, in quadlets
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200620 * @handle: Handle to the descriptor, written by the kernel
621 *
622 * Add a descriptor block and optionally a preceding immediate key to the local
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200623 * node's Configuration ROM.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200624 *
625 * The @key field specifies the upper 8 bits of the descriptor root directory
626 * pointer and the @data and @length fields specify the contents. The @key
627 * should be of the form 0xXX000000. The offset part of the root directory entry
628 * will be filled in by the kernel.
629 *
630 * If not 0, the @immediate field specifies an immediate key which will be
631 * inserted before the root directory pointer.
632 *
Stefan Richter6d3faf62010-01-24 14:48:00 +0100633 * @immediate, @key, and @data array elements are CPU-endian quadlets.
634 *
Stefan Richterd505e6e2010-07-17 21:36:02 +0200635 * If successful, the kernel adds the descriptor and writes back a @handle to
636 * the kernel-side object to be used for later removal of the descriptor block
637 * and immediate key. The kernel will also generate a bus reset to signal the
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200638 * change of the Configuration ROM to other nodes.
Stefan Richterde487da2009-03-10 21:00:23 +0100639 *
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200640 * This ioctl affects the Configuration ROMs of all local nodes.
Stefan Richterde487da2009-03-10 21:00:23 +0100641 * The ioctl only succeeds on device files which represent a local node.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200642 */
Kristian Høgsberg66dea3e2007-03-28 21:26:42 +0200643struct fw_cdev_add_descriptor {
644 __u32 immediate;
645 __u32 key;
646 __u64 data;
647 __u32 length;
648 __u32 handle;
649};
650
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200651/**
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200652 * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200653 * @handle: Handle to the descriptor, as returned by the kernel when the
654 * descriptor was added
655 *
656 * Remove a descriptor block and accompanying immediate key from the local
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200657 * nodes' Configuration ROMs. The kernel will also generate a bus reset to
658 * signal the change of the Configuration ROM to other nodes.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200659 */
Kristian Høgsberg66dea3e2007-03-28 21:26:42 +0200660struct fw_cdev_remove_descriptor {
661 __u32 handle;
662};
663
Stefan Richter872e3302010-07-29 18:19:22 +0200664#define FW_CDEV_ISO_CONTEXT_TRANSMIT 0
665#define FW_CDEV_ISO_CONTEXT_RECEIVE 1
666#define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 /* added in 2.6.36 */
Kristian Høgsberg295e3fe2007-02-16 17:34:40 -0500667
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200668/**
Stefan Richter872e3302010-07-29 18:19:22 +0200669 * struct fw_cdev_create_iso_context - Create a context for isochronous I/O
670 * @type: %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or
671 * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL
672 * @header_size: Header size to strip in single-channel reception
673 * @channel: Channel to bind to in single-channel reception or transmission
674 * @speed: Transmission speed
675 * @closure: To be returned in &fw_cdev_event_iso_interrupt or
676 * &fw_cdev_event_iso_interrupt_multichannel
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200677 * @handle: Handle to context, written back by kernel
678 *
679 * Prior to sending or receiving isochronous I/O, a context must be created.
680 * The context records information about the transmit or receive configuration
681 * and typically maps to an underlying hardware resource. A context is set up
682 * for either sending or receiving. It is bound to a specific isochronous
Stefan Richter872e3302010-07-29 18:19:22 +0200683 * @channel.
684 *
685 * In case of multichannel reception, @header_size and @channel are ignored
686 * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS.
687 *
688 * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4
689 * and must be a multiple of 4. It is ignored in other context types.
690 *
691 * @speed is ignored in receive context types.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200692 *
693 * If a context was successfully created, the kernel writes back a handle to the
694 * context, which must be passed in for subsequent operations on that context.
Stefan Richter77258da2009-01-07 20:14:53 +0100695 *
Stefan Richter872e3302010-07-29 18:19:22 +0200696 * Limitations:
Stefan Richterd505e6e2010-07-17 21:36:02 +0200697 * No more than one iso context can be created per fd.
Stefan Richter872e3302010-07-29 18:19:22 +0200698 * The total number of contexts that all userspace and kernelspace drivers can
699 * create on a card at a time is a hardware limit, typically 4 or 8 contexts per
700 * direction, and of them at most one multichannel receive context.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200701 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500702struct fw_cdev_create_iso_context {
Kristian Høgsberg295e3fe2007-02-16 17:34:40 -0500703 __u32 type;
704 __u32 header_size;
Kristian Høgsberg21efb3c2007-02-16 17:34:50 -0500705 __u32 channel;
706 __u32 speed;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400707 __u64 closure;
708 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500709};
710
Stefan Richter872e3302010-07-29 18:19:22 +0200711/**
712 * struct fw_cdev_set_iso_channels - Select channels in multichannel reception
713 * @channels: Bitmask of channels to listen to
714 * @handle: Handle of the mutichannel receive context
715 *
716 * @channels is the bitwise or of 1ULL << n for each channel n to listen to.
717 *
718 * The ioctl fails with errno %EBUSY if there is already another receive context
719 * on a channel in @channels. In that case, the bitmask of all unoccupied
720 * channels is returned in @channels.
721 */
722struct fw_cdev_set_iso_channels {
723 __u64 channels;
724 __u32 handle;
725};
726
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400727#define FW_CDEV_ISO_PAYLOAD_LENGTH(v) (v)
728#define FW_CDEV_ISO_INTERRUPT (1 << 16)
729#define FW_CDEV_ISO_SKIP (1 << 17)
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200730#define FW_CDEV_ISO_SYNC (1 << 17)
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400731#define FW_CDEV_ISO_TAG(v) ((v) << 18)
732#define FW_CDEV_ISO_SY(v) ((v) << 20)
733#define FW_CDEV_ISO_HEADER_LENGTH(v) ((v) << 24)
734
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200735/**
736 * struct fw_cdev_iso_packet - Isochronous packet
Stefan Richter872e3302010-07-29 18:19:22 +0200737 * @control: Contains the header length (8 uppermost bits),
738 * the sy field (4 bits), the tag field (2 bits), a sync flag
739 * or a skip flag (1 bit), an interrupt flag (1 bit), and the
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200740 * payload length (16 lowermost bits)
Stefan Richter872e3302010-07-29 18:19:22 +0200741 * @header: Header and payload in case of a transmit context.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200742 *
743 * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
Randy Dunlap9a400682018-09-04 17:02:21 -0700744 * Use the FW_CDEV_ISO_* macros to fill in @control.
Stefan Richter872e3302010-07-29 18:19:22 +0200745 * The @header array is empty in case of receive contexts.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200746 *
Stefan Richter872e3302010-07-29 18:19:22 +0200747 * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT:
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200748 *
Stefan Richter872e3302010-07-29 18:19:22 +0200749 * @control.HEADER_LENGTH must be a multiple of 4. It specifies the numbers of
750 * bytes in @header that will be prepended to the packet's payload. These bytes
751 * are copied into the kernel and will not be accessed after the ioctl has
752 * returned.
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200753 *
Stefan Richter872e3302010-07-29 18:19:22 +0200754 * The @control.SY and TAG fields are copied to the iso packet header. These
755 * fields are specified by IEEE 1394a and IEC 61883-1.
756 *
757 * The @control.SKIP flag specifies that no packet is to be sent in a frame.
758 * When using this, all other fields except @control.INTERRUPT must be zero.
759 *
760 * When a packet with the @control.INTERRUPT flag set has been completed, an
761 * &fw_cdev_event_iso_interrupt event will be sent.
762 *
763 * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE:
764 *
765 * @control.HEADER_LENGTH must be a multiple of the context's header_size.
766 * If the HEADER_LENGTH is larger than the context's header_size, multiple
767 * packets are queued for this entry.
768 *
769 * The @control.SY and TAG fields are ignored.
770 *
771 * If the @control.SYNC flag is set, the context drops all packets until a
772 * packet with a sy field is received which matches &fw_cdev_start_iso.sync.
773 *
774 * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for
775 * one packet (in addition to payload quadlets that have been defined as headers
776 * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure).
777 * If more bytes are received, the additional bytes are dropped. If less bytes
778 * are received, the remaining bytes in this part of the payload buffer will not
779 * be written to, not even by the next packet. I.e., packets received in
780 * consecutive frames will not necessarily be consecutive in memory. If an
781 * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally
782 * among them.
783 *
784 * When a packet with the @control.INTERRUPT flag set has been completed, an
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200785 * &fw_cdev_event_iso_interrupt event will be sent. An entry that has queued
786 * multiple receive packets is completed when its last packet is completed.
Stefan Richter872e3302010-07-29 18:19:22 +0200787 *
788 * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
789 *
790 * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since
791 * it specifies a chunk of the mmap()'ed buffer, while the number and alignment
792 * of packets to be placed into the buffer chunk is not known beforehand.
793 *
794 * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room
795 * for header, payload, padding, and trailer bytes of one or more packets.
796 * It must be a multiple of 4.
797 *
798 * @control.HEADER_LENGTH, TAG and SY are ignored. SYNC is treated as described
799 * for single-channel reception.
800 *
801 * When a buffer chunk with the @control.INTERRUPT flag set has been filled
802 * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200803 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500804struct fw_cdev_iso_packet {
Kristian Høgsberg1ca31ae2007-05-31 11:16:43 -0400805 __u32 control;
Stefan Richter5e20c282007-01-21 20:44:09 +0100806 __u32 header[0];
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500807};
808
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200809/**
810 * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
Stefan Richter872e3302010-07-29 18:19:22 +0200811 * @packets: Userspace pointer to an array of &fw_cdev_iso_packet
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200812 * @data: Pointer into mmap()'ed payload buffer
Stefan Richter872e3302010-07-29 18:19:22 +0200813 * @size: Size of the @packets array, in bytes
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200814 * @handle: Isochronous context handle
815 *
816 * Queue a number of isochronous packets for reception or transmission.
817 * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
818 * which describe how to transmit from or receive into a contiguous region
Clemens Ladischaa6fec32010-03-31 16:26:52 +0200819 * of a mmap()'ed payload buffer. As part of transmit packet descriptors,
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200820 * a series of headers can be supplied, which will be prepended to the
821 * payload during DMA.
822 *
823 * The kernel may or may not queue all packets, but will write back updated
824 * values of the @packets, @data and @size fields, so the ioctl can be
825 * resubmitted easily.
Stefan Richter872e3302010-07-29 18:19:22 +0200826 *
827 * In case of a multichannel receive context, @data must be quadlet-aligned
828 * relative to the buffer start.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200829 */
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500830struct fw_cdev_queue_iso {
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500831 __u64 packets;
832 __u64 data;
Kristian Høgsbergda8ecff2007-03-27 01:43:39 -0400833 __u32 size;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400834 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500835};
836
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200837#define FW_CDEV_ISO_CONTEXT_MATCH_TAG0 1
838#define FW_CDEV_ISO_CONTEXT_MATCH_TAG1 2
839#define FW_CDEV_ISO_CONTEXT_MATCH_TAG2 4
840#define FW_CDEV_ISO_CONTEXT_MATCH_TAG3 8
841#define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS 15
842
843/**
844 * struct fw_cdev_start_iso - Start an isochronous transmission or reception
845 * @cycle: Cycle in which to start I/O. If @cycle is greater than or
846 * equal to 0, the I/O will start on that cycle.
847 * @sync: Determines the value to wait for for receive packets that have
848 * the %FW_CDEV_ISO_SYNC bit set
849 * @tags: Tag filter bit mask. Only valid for isochronous reception.
850 * Determines the tag values for which packets will be accepted.
Randy Dunlap9a400682018-09-04 17:02:21 -0700851 * Use FW_CDEV_ISO_CONTEXT_MATCH_* macros to set @tags.
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200852 * @handle: Isochronous context handle within which to transmit or receive
853 */
Kristian Høgsberg69cdb722007-02-16 17:34:41 -0500854struct fw_cdev_start_iso {
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500855 __s32 cycle;
Kristian Høgsbergeb0306e2007-03-14 17:34:54 -0400856 __u32 sync;
857 __u32 tags;
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400858 __u32 handle;
859};
860
Kristian Høgsberg7ada60e2007-06-22 00:20:34 +0200861/**
862 * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception
863 * @handle: Handle of isochronous context to stop
864 */
Kristian Høgsbergabaa5742007-04-30 15:03:14 -0400865struct fw_cdev_stop_iso {
866 __u32 handle;
Kristian Høgsberg19a15b92006-12-19 19:58:31 -0500867};
868
Stefan Richtera64408b2007-09-29 10:41:58 +0200869/**
Clemens Ladischd1bbd202012-03-18 19:06:39 +0100870 * struct fw_cdev_flush_iso - flush completed iso packets
871 * @handle: handle of isochronous context to flush
872 *
873 * For %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE contexts,
874 * report any completed packets.
875 *
876 * For %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL contexts, report the current
877 * offset in the receive buffer, if it has changed; this is typically in the
878 * middle of some buffer chunk.
879 *
880 * Any %FW_CDEV_EVENT_ISO_INTERRUPT or %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
881 * events generated by this ioctl are sent synchronously, i.e., are available
882 * for reading from the file descriptor when this ioctl returns.
883 */
884struct fw_cdev_flush_iso {
885 __u32 handle;
886};
887
888/**
Stefan Richtera64408b2007-09-29 10:41:58 +0200889 * struct fw_cdev_get_cycle_timer - read cycle timer register
890 * @local_time: system time, in microseconds since the Epoch
Stefan Richterabfe5a02010-02-20 12:13:49 +0100891 * @cycle_timer: Cycle Time register contents
Stefan Richtera64408b2007-09-29 10:41:58 +0200892 *
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200893 * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME
894 * and only with microseconds resolution.
Stefan Richtere94b6d72010-02-21 12:48:57 +0100895 *
896 * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
897 * monotonic) @cycle_timer values on certain controllers.
Stefan Richtera64408b2007-09-29 10:41:58 +0200898 */
899struct fw_cdev_get_cycle_timer {
900 __u64 local_time;
901 __u32 cycle_timer;
902};
903
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100904/**
Stefan Richterabfe5a02010-02-20 12:13:49 +0100905 * struct fw_cdev_get_cycle_timer2 - read cycle timer register
906 * @tv_sec: system time, seconds
907 * @tv_nsec: system time, sub-seconds part in nanoseconds
908 * @clk_id: input parameter, clock from which to get the system time
909 * @cycle_timer: Cycle Time register contents
910 *
Stefan Richterf6a7cd02011-07-14 21:08:39 +0200911 * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer
912 * and also the system clock. This allows to correlate reception time of
913 * isochronous packets with system time.
914 *
915 * @clk_id lets you choose a clock like with POSIX' clock_gettime function.
916 * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC
917 * and Linux' %CLOCK_MONOTONIC_RAW.
918 *
919 * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
920 * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register
921 * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
Stefan Richterabfe5a02010-02-20 12:13:49 +0100922 */
923struct fw_cdev_get_cycle_timer2 {
924 __s64 tv_sec;
925 __s32 tv_nsec;
926 __s32 clk_id;
927 __u32 cycle_timer;
928};
929
930/**
Stefan Richter1ec3c022009-01-04 16:23:29 +0100931 * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300932 * @closure: Passed back to userspace in corresponding iso resource events
Stefan Richter1ec3c022009-01-04 16:23:29 +0100933 * @channels: Isochronous channels of which one is to be (de)allocated
934 * @bandwidth: Isochronous bandwidth units to be (de)allocated
935 * @handle: Handle to the allocation, written by the kernel (only valid in
936 * case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100937 *
938 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
939 * isochronous channel and/or of isochronous bandwidth at the isochronous
940 * resource manager (IRM). Only one of the channels specified in @channels is
941 * allocated. An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
942 * communication with the IRM, indicating success or failure in the event data.
943 * The kernel will automatically reallocate the resources after bus resets.
944 * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
945 * will be sent. The kernel will also automatically deallocate the resources
946 * when the file descriptor is closed.
947 *
Stefan Richter1ec3c022009-01-04 16:23:29 +0100948 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
949 * deallocation of resources which were allocated as described above.
950 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
951 *
952 * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
953 * without automatic re- or deallocation.
954 * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
955 * indicating success or failure in its data.
956 *
957 * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
958 * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
Stefan Richter5d9cb7d272009-01-08 23:07:40 +0100959 * instead of allocated.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100960 * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
961 *
Stefan Richterca658b12010-04-10 12:23:09 +0200962 * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
963 * for the lifetime of the fd or @handle.
Stefan Richter1ec3c022009-01-04 16:23:29 +0100964 * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
965 * for the duration of a bus generation.
966 *
Stefan Richter5d9cb7d272009-01-08 23:07:40 +0100967 * @channels is a host-endian bitfield with the least significant bit
968 * representing channel 0 and the most significant bit representing channel 63:
969 * 1ULL << c for each channel c that is a candidate for (de)allocation.
Jay Fenlason, Stefan Richterb1bda4c2009-01-04 16:23:29 +0100970 *
971 * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
972 * one quadlet of data (payload or header data) at speed S1600.
973 */
974struct fw_cdev_allocate_iso_resource {
975 __u64 closure;
976 __u64 channels;
977 __u32 bandwidth;
978 __u32 handle;
979};
980
Stefan Richter33580a32009-01-04 16:23:29 +0100981/**
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100982 * struct fw_cdev_send_stream_packet - send an asynchronous stream packet
Stefan Richter18e9b10f2009-03-10 21:02:21 +0100983 * @length: Length of outgoing payload, in bytes
984 * @tag: Data format tag
985 * @channel: Isochronous channel to transmit to
986 * @sy: Synchronization code
987 * @closure: Passed back to userspace in the response event
988 * @data: Userspace pointer to payload
989 * @generation: The bus generation where packet is valid
990 * @speed: Speed to transmit at
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100991 *
992 * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
Stefan Richter18e9b10f2009-03-10 21:02:21 +0100993 * to every device which is listening to the specified channel. The kernel
994 * writes an &fw_cdev_event_response event which indicates success or failure of
995 * the transmission.
Jay Fenlasonf8c22872009-03-05 19:08:40 +0100996 */
997struct fw_cdev_send_stream_packet {
Stefan Richter18e9b10f2009-03-10 21:02:21 +0100998 __u32 length;
999 __u32 tag;
Jay Fenlasonf8c22872009-03-05 19:08:40 +01001000 __u32 channel;
1001 __u32 sy;
Stefan Richter18e9b10f2009-03-10 21:02:21 +01001002 __u64 closure;
Jay Fenlasonf8c22872009-03-05 19:08:40 +01001003 __u64 data;
Stefan Richter18e9b10f2009-03-10 21:02:21 +01001004 __u32 generation;
1005 __u32 speed;
Jay Fenlasonf8c22872009-03-05 19:08:40 +01001006};
1007
Stefan Richter850bb6f2010-07-16 22:25:14 +02001008/**
1009 * struct fw_cdev_send_phy_packet - send a PHY packet
1010 * @closure: Passed back to userspace in the PHY-packet-sent event
1011 * @data: First and second quadlet of the PHY packet
1012 * @generation: The bus generation where packet is valid
1013 *
1014 * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
1015 * on the same card as this device. After transmission, an
1016 * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
1017 *
Randy Dunlap9a400682018-09-04 17:02:21 -07001018 * The payload @data\[\] shall be specified in host byte order. Usually,
1019 * @data\[1\] needs to be the bitwise inverse of @data\[0\]. VersaPHY packets
Stefan Richter850bb6f2010-07-16 22:25:14 +02001020 * are an exception to this rule.
1021 *
1022 * The ioctl is only permitted on device files which represent a local node.
1023 */
1024struct fw_cdev_send_phy_packet {
1025 __u64 closure;
1026 __u32 data[2];
1027 __u32 generation;
1028};
1029
Stefan Richterbf54e142010-07-16 22:25:51 +02001030/**
1031 * struct fw_cdev_receive_phy_packets - start reception of PHY packets
1032 * @closure: Passed back to userspace in phy packet events
1033 *
1034 * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
1035 * incoming PHY packets from any node on the same bus as the device.
1036 *
1037 * The ioctl is only permitted on device files which represent a local node.
1038 */
1039struct fw_cdev_receive_phy_packets {
1040 __u64 closure;
1041};
1042
Stefan Richterf6a7cd02011-07-14 21:08:39 +02001043#define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */
1044
Kristian Høgsberg4c5a4432007-05-07 20:33:37 -04001045#endif /* _LINUX_FIREWIRE_CDEV_H */