History

Merge tag 'firewire-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394

Pull firewire updates from Takashi Sakamoto: "This consist of three parts; UAPI update, OHCI driver update, and several bug fixes. Firstly, the 1394 OHCI specification defines method to retrieve hardware time stamps for asynchronous communication, which was previously unavailable in user space. This adds new events to the UAPI, allowing applications to retrieve the time when asynchronous packet are received and sent. The new events are tested in the bleeding edge of libhinawa and look to work well. The new version of libhinawa will be released after current merge window is closed: https://git.kernel.org/pub/scm/libs/ieee1394/libhinawa.git/ Secondly, the FireWire stack includes a PCM device driver for 1394 OHCI hardware, This change modernizes the driver by managed resource (devres) framework. Lastly, bug fixes for firewire-net and firewire-core" * tag 'firewire-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394: (25 commits) firewire: net: fix use after free in fwnet_finish_incoming_packet() firewire: core: obsolete usage of GFP_ATOMIC at building node tree firewire: ohci: release buffer for AR req/resp contexts when managed resource is released firewire: ohci: use devres for content of configuration ROM firewire: ohci: use devres for IT, IR, AT/receive, and AT/request contexts firewire: ohci: use devres for list of isochronous contexts firewire: ohci: use devres for requested IRQ firewire: ohci: use devres for misc DMA buffer firewire: ohci: use devres for MMIO region mapping firewire: ohci: use devres for PCI-related resources firewire: ohci: use devres for memory object of ohci structure firewire: fix warnings to generate UAPI documentation firewire: fix build failure due to missing module license firewire: cdev: implement new event relevant to phy packet with time stamp firewire: cdev: add new event to notify phy packet with time stamp firewire: cdev: code refactoring to dispatch event for phy packet firewire: cdev: implement new event to notify response subaction with time stamp firewire: cdev: add new event to notify response subaction with time stamp firewire: cdev: code refactoring to operate event of response firewire: core: implement variations to send request and wait for response with time stamp ...

Linus Torvalds committed 3 years ago

Commit 406fb9e2 parents f196220 3ff256713 files · +694 −231Browse files

Showing the changes to include/uapi/linux (1 of 13 files). Show all

Unified · Split

include/uapi/linux/firewire-cdev.h+156−22
@@ -46,6 +46,12 @@ · 45 unmodified lines
46#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x0846#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED 0x08
47#define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x0947#define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL 0x09
48 48
49/* available since kernel version 6.5 */
50#define FW_CDEV_EVENT_REQUEST3 0x0a
51#define FW_CDEV_EVENT_RESPONSE2 0x0b
52#define FW_CDEV_EVENT_PHY_PACKET_SENT2 0x0c
53#define FW_CDEV_EVENT_PHY_PACKET_RECEIVED2 0x0d
54
49/**55/**
50 * struct fw_cdev_event_common - Common part of all fw_cdev_event_* types56 * struct fw_cdev_event_common - Common part of all fw_cdev_event_* types
51 * @closure: For arbitrary use by userspace57 * @closure: For arbitrary use by userspace
@@ -103,6 +109,32 @@ struct fw_cdev_event_bus_reset { · 51 unmodified lines
103 * @length: Data length, i.e. the response's payload size in bytes109 * @length: Data length, i.e. the response's payload size in bytes
104 * @data: Payload data, if any110 * @data: Payload data, if any
105 *111 *
112 * This event is sent instead of &fw_cdev_event_response if the kernel or the client implements
113 * ABI version <= 5. It has the lack of time stamp field comparing to &fw_cdev_event_response2.
114 */
115struct fw_cdev_event_response {
116 __u64 closure;
117 __u32 type;
118 __u32 rcode;
119 __u32 length;
120 __u32 data[];
121};
122
123/**
124 * struct fw_cdev_event_response2 - Sent when a response packet was received
125 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
126 * or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
127 * or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
128 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
129 * @rcode: Response code returned by the remote node
130 * @length: Data length, i.e. the response's payload size in bytes
131 * @request_tstamp: The time stamp of isochronous cycle at which the request was sent.
132 * @response_tstamp: The time stamp of isochronous cycle at which the response was sent.
133 * @padding: Padding to keep the size of structure as multiples of 8 in various architectures
134 * since 4 byte alignment is used for 8 byte of object type in System V ABI for i386
135 * architecture.
136 * @data: Payload data, if any
137 *
106 * This event is sent when the stack receives a response to an outgoing request138 * 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 responses139 * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl. The payload data for responses
108 * carrying data (read and lock responses) follows immediately and can be140 * carrying data (read and lock responses) follows immediately and can be
@@ -112,12 +144,21 @@ struct fw_cdev_event_bus_reset { · 3 unmodified lines
112 * involve response packets. This includes unified write transactions,144 * involve response packets. This includes unified write transactions,
113 * broadcast write transactions, and transmission of asynchronous stream145 * broadcast write transactions, and transmission of asynchronous stream
114 * packets. @rcode indicates success or failure of such transmissions.146 * packets. @rcode indicates success or failure of such transmissions.
147 *
148 * The value of @request_tstamp expresses the isochronous cycle at which the request was sent to
149 * initiate the transaction. The value of @response_tstamp expresses the isochronous cycle at which
150 * the response arrived to complete the transaction. Each value is unsigned 16 bit integer
151 * containing three low order bits of second field and all 13 bits of cycle field in format of
152 * CYCLE_TIMER register.
115 */153 */
116struct fw_cdev_event_response {154struct fw_cdev_event_response2 {
117 __u64 closure;155 __u64 closure;
118 __u32 type;156 __u32 type;
119 __u32 rcode;157 __u32 rcode;
120 __u32 length;158 __u32 length;
159 __u32 request_tstamp;
160 __u32 response_tstamp;
161 __u32 padding;
121 __u32 data[];162 __u32 data[];
122};163};
123 164
@@ -159,6 +200,41 @@ struct fw_cdev_event_request { · 35 unmodified lines
159 * @length: Data length, i.e. the request's payload size in bytes200 * @length: Data length, i.e. the request's payload size in bytes
160 * @data: Incoming data, if any201 * @data: Incoming data, if any
161 *202 *
203 * This event is sent instead of &fw_cdev_event_request3 if the kernel or the client implements
204 * ABI version <= 5. It has the lack of time stamp field comparing to &fw_cdev_event_request3.
205 */
206struct fw_cdev_event_request2 {
207 __u64 closure;
208 __u32 type;
209 __u32 tcode;
210 __u64 offset;
211 __u32 source_node_id;
212 __u32 destination_node_id;
213 __u32 card;
214 __u32 generation;
215 __u32 handle;
216 __u32 length;
217 __u32 data[];
218};
219
220/**
221 * struct fw_cdev_event_request3 - Sent on incoming request to an address region
222 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
223 * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
224 * @tcode: Transaction code of the incoming request
225 * @offset: The offset into the 48-bit per-node address space
226 * @source_node_id: Sender node ID
227 * @destination_node_id: Destination node ID
228 * @card: The index of the card from which the request came
229 * @generation: Bus generation in which the request is valid
230 * @handle: Reference to the kernel-side pending request
231 * @length: Data length, i.e. the request's payload size in bytes
232 * @tstamp: The time stamp of isochronous cycle at which the request arrived.
233 * @padding: Padding to keep the size of structure as multiples of 8 in various architectures
234 * since 4 byte alignment is used for 8 byte of object type in System V ABI for i386
235 * architecture.
236 * @data: Incoming data, if any
237 *
162 * This event is sent when the stack receives an incoming request to an address238 * 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 is239 * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is
164 * guaranteed to be completely contained in the specified region. Userspace is240 * guaranteed to be completely contained in the specified region. Userspace is
@@ -191,10 +267,14 @@ struct fw_cdev_event_request { · 26 unmodified lines
191 * sent.267 * sent.
192 *268 *
193 * If the client subsequently needs to initiate requests to the sender node of269 * 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 matching270 * an &fw_cdev_event_request3, it needs to use a device file with matching
195 * card index, node ID, and generation for outbound requests.271 * card index, node ID, and generation for outbound requests.
272 *
273 * @tstamp is isochronous cycle at which the request arrived. It is 16 bit integer value and the
274 * higher 3 bits expresses three low order bits of second field in the format of CYCLE_TIME
275 * register and the rest 13 bits expresses cycle field.
196 */276 */
197struct fw_cdev_event_request2 {277struct fw_cdev_event_request3 {
198 __u64 closure;278 __u64 closure;
199 __u32 type;279 __u32 type;
200 __u32 tcode;280 __u32 tcode;
@@ -205,6 +285,8 @@ struct fw_cdev_event_request2 { · 4 unmodified lines
205 __u32 generation;285 __u32 generation;
206 __u32 handle;286 __u32 handle;
207 __u32 length;287 __u32 length;
288 __u32 tstamp;
289 __u32 padding;
208 __u32 data[];290 __u32 data[];
209};291};
210 292
@@ -341,20 +423,59 @@ struct fw_cdev_event_iso_resource { · 130 unmodified lines
341 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED423 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
342 * @rcode: %RCODE_..., indicates success or failure of transmission424 * @rcode: %RCODE_..., indicates success or failure of transmission
343 * @length: Data length in bytes425 * @length: Data length in bytes
426 * @data: Incoming data for %FW_CDEV_IOC_RECEIVE_PHY_PACKETS. For %FW_CDEV_IOC_SEND_PHY_PACKET
427 * the field has the same data in the request, thus the length of 8 bytes.
428 *
429 * This event is sent instead of &fw_cdev_event_phy_packet2 if the kernel or
430 * the client implements ABI version <= 5. It has the lack of time stamp field comparing to
431 * &fw_cdev_event_phy_packet2.
432 */
433struct fw_cdev_event_phy_packet {
434 __u64 closure;
435 __u32 type;
436 __u32 rcode;
437 __u32 length;
438 __u32 data[];
439};
440
441/**
442 * struct fw_cdev_event_phy_packet2 - A PHY packet was transmitted or received with time stamp.
443 * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
444 * or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
445 * @type: %FW_CDEV_EVENT_PHY_PACKET_SENT2 or %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
446 * @rcode: %RCODE_..., indicates success or failure of transmission
447 * @length: Data length in bytes
448 * @tstamp: For %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, the time stamp of isochronous cycle at
449 * which the packet arrived. For %FW_CDEV_EVENT_PHY_PACKET_SENT2 and non-ping packet,
450 * the time stamp of isochronous cycle at which the packet was sent. For ping packet,
451 * the tick count for round-trip time measured by 1394 OHCI controller.
452 * The time stamp of isochronous cycle at which either the response was sent for
453 * %FW_CDEV_EVENT_PHY_PACKET_SENT2 or the request arrived for
454 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2.
344 * @data: Incoming data455 * @data: Incoming data
345 *456 *
346 * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,457 * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT2, @length is 8 and @data consists of the two PHY
347 * except in case of a ping packet: Then, @length is 4, and @data[0] is the458 * packet quadlets to be sent, in host byte order,
348 * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
349 *459 *
350 * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data460 * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, @length is 8 and @data consists of the two PHY
351 * consists of the two PHY packet quadlets, in host byte order.461 * packet quadlets, in host byte order.
462 *
463 * For %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2, the @tstamp is the isochronous cycle at which the
464 * packet arrived. It is 16 bit integer value and the higher 3 bits expresses three low order bits
465 * of second field and the rest 13 bits expresses cycle field in the format of CYCLE_TIME register.
466 *
467 * For %FW_CDEV_EVENT_PHY_PACKET_SENT2, the @tstamp has different meanings whether to sent the
468 * packet for ping or not. If it's not for ping, the @tstamp is the isochronous cycle at which the
469 * packet was sent, and use the same format as the case of %FW_CDEV_EVENT_PHY_PACKET_SENT2. If it's
470 * for ping, the @tstamp is for round-trip time measured by 1394 OHCI controller with 42.195 MHz
471 * resolution.
352 */472 */
353struct fw_cdev_event_phy_packet {473struct fw_cdev_event_phy_packet2 {
354 __u64 closure;474 __u64 closure;
355 __u32 type;475 __u32 type;
356 __u32 rcode;476 __u32 rcode;
357 __u32 length;477 __u32 length;
478 __u32 tstamp;
358 __u32 data[];479 __u32 data[];
359};480};
360 481
@@ -375,6 +496,11 @@ struct fw_cdev_event_phy_packet { · 14 unmodified lines
375 * %FW_CDEV_EVENT_PHY_PACKET_SENT or496 * %FW_CDEV_EVENT_PHY_PACKET_SENT or
376 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED497 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED
377 *498 *
499 * @request3: Valid if @common.type == %FW_CDEV_EVENT_REQUEST3
500 * @response2: Valid if @common.type == %FW_CDEV_EVENT_RESPONSE2
501 * @phy_packet2: Valid if @common.type == %FW_CDEV_EVENT_PHY_PACKET_SENT2 or
502 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
503 *
378 * Convenience union for userspace use. Events could be read(2) into an504 * Convenience union for userspace use. Events could be read(2) into an
379 * appropriately aligned char buffer and then cast to this union for further505 * appropriately aligned char buffer and then cast to this union for further
380 * processing. Note that for a request, response or iso_interrupt event,506 * processing. Note that for a request, response or iso_interrupt event,
@@ -393,6 +519,9 @@ union fw_cdev_event { · 12 unmodified lines
393 struct fw_cdev_event_iso_interrupt_mc iso_interrupt_mc; /* added in 2.6.36 */519 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 */520 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 */521 struct fw_cdev_event_phy_packet phy_packet; /* added in 2.6.36 */
522 struct fw_cdev_event_request3 request3; /* added in 6.5 */
523 struct fw_cdev_event_response2 response2; /* added in 6.5 */
524 struct fw_cdev_event_phy_packet2 phy_packet2; /* added in 6.5 */
396};525};
397 526
398/* available since kernel version 2.6.22 */527/* available since kernel version 2.6.22 */
@@ -457,6 +586,11 @@ union fw_cdev_event { · 58 unmodified lines
457 * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to586 * 5 (3.4) - send %FW_CDEV_EVENT_ISO_INTERRUPT events when needed to
458 * avoid dropping data587 * avoid dropping data
459 * - added %FW_CDEV_IOC_FLUSH_ISO588 * - added %FW_CDEV_IOC_FLUSH_ISO
589 * 6 (6.5) - added some event for subactions of asynchronous transaction with time stamp
590 * - %FW_CDEV_EVENT_REQUEST3
591 * - %FW_CDEV_EVENT_RESPONSE2
592 * - %FW_CDEV_EVENT_PHY_PACKET_SENT2
593 * - %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2
460 */594 */
461 595
462/**596/**
@@ -502,11 +636,11 @@ struct fw_cdev_get_info { · 39 unmodified lines
502 * @data: Userspace pointer to payload636 * @data: Userspace pointer to payload
503 * @generation: The bus generation where packet is valid637 * @generation: The bus generation where packet is valid
504 *638 *
505 * Send a request to the device. This ioctl implements all outgoing requests.639 * Send a request to the device. This ioctl implements all outgoing requests. Both quadlet and
506 * Both quadlet and block request specify the payload as a pointer to the data640 * block request specify the payload as a pointer to the data in the @data field. Once the
507 * in the @data field. Once the transaction completes, the kernel writes an641 * transaction completes, the kernel writes either &fw_cdev_event_response event or
508 * &fw_cdev_event_response event back. The @closure field is passed back to642 * &fw_cdev_event_response event back. The @closure field is passed back to user space in the
509 * user space in the response event.643 * response event.
510 */644 */
511struct fw_cdev_send_request {645struct fw_cdev_send_request {
512 __u32 tcode;646 __u32 tcode;
@@ -989,10 +1123,9 @@ struct fw_cdev_allocate_iso_resource { · 476 unmodified lines
989 * @generation: The bus generation where packet is valid1123 * @generation: The bus generation where packet is valid
990 * @speed: Speed to transmit at1124 * @speed: Speed to transmit at
991 *1125 *
992 * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet1126 * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet to every device
993 * to every device which is listening to the specified channel. The kernel1127 * which is listening to the specified channel. The kernel writes either &fw_cdev_event_response
994 * writes an &fw_cdev_event_response event which indicates success or failure of1128 * event or &fw_cdev_event_response2 event which indicates success or failure of the transmission.
995 * the transmission.
996 */1129 */
997struct fw_cdev_send_stream_packet {1130struct fw_cdev_send_stream_packet {
998 __u32 length;1131 __u32 length;
@@ -1011,8 +1144,8 @@ struct fw_cdev_send_stream_packet { · 12 unmodified lines
1011 * @data: First and second quadlet of the PHY packet1144 * @data: First and second quadlet of the PHY packet
1012 * @generation: The bus generation where packet is valid1145 * @generation: The bus generation where packet is valid
1013 *1146 *
1014 * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes1147 * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes on the same card as this
1015 * on the same card as this device. After transmission, an1148 * device. After transmission, either %FW_CDEV_EVENT_PHY_PACKET_SENT event or
1016 * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.1149 * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
1017 *1150 *
1018 * The payload @data\[\] shall be specified in host byte order. Usually,1151 * The payload @data\[\] shall be specified in host byte order. Usually,
@@ -1031,8 +1164,9 @@ struct fw_cdev_send_phy_packet { · 12 unmodified lines
1031 * struct fw_cdev_receive_phy_packets - start reception of PHY packets1164 * struct fw_cdev_receive_phy_packets - start reception of PHY packets
1032 * @closure: Passed back to userspace in phy packet events1165 * @closure: Passed back to userspace in phy packet events
1033 *1166 *
1034 * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to1167 * This ioctl activates issuing of either %FW_CDEV_EVENT_PHY_PACKET_RECEIVED or
1035 * incoming PHY packets from any node on the same bus as the device.1168 * %FW_CDEV_EVENT_PHY_PACKET_RECEIVED2 due to incoming PHY packets from any node on the same bus
1169 * as the device.
1036 *1170 *
1037 * The ioctl is only permitted on device files which represent a local node.1171 * The ioctl is only permitted on device files which represent a local node.
1038 */1172 */