diff options
Diffstat (limited to 'include/uapi/linux/firewire-cdev.h')
| -rw-r--r-- | include/uapi/linux/firewire-cdev.h | 1039 |
1 files changed, 1039 insertions, 0 deletions
diff --git a/include/uapi/linux/firewire-cdev.h b/include/uapi/linux/firewire-cdev.h new file mode 100644 index 000000000000..d50036953497 --- /dev/null +++ b/include/uapi/linux/firewire-cdev.h | |||
| @@ -0,0 +1,1039 @@ | |||
| 1 | /* | ||
| 2 | * Char device interface. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005-2007 Kristian Hoegsberg <krh@bitplanet.net> | ||
| 5 | * | ||
| 6 | * 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: | ||
| 12 | * | ||
| 13 | * 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. | ||
| 16 | * | ||
| 17 | * 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 | ||
| 20 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 21 | * 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. | ||
| 24 | */ | ||
| 25 | |||
| 26 | #ifndef _LINUX_FIREWIRE_CDEV_H | ||
| 27 | #define _LINUX_FIREWIRE_CDEV_H | ||
| 28 | |||
| 29 | #include <linux/ioctl.h> | ||
| 30 | #include <linux/types.h> | ||
| 31 | #include <linux/firewire-constants.h> | ||
| 32 | |||
| 33 | /* available since kernel version 2.6.22 */ | ||
| 34 | #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 | ||
| 38 | |||
| 39 | /* available since kernel version 2.6.30 */ | ||
| 40 | #define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED 0x04 | ||
| 41 | #define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED 0x05 | ||
| 42 | |||
| 43 | /* available since kernel version 2.6.36 */ | ||
| 44 | #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 | ||
| 48 | |||
| 49 | /** | ||
| 50 | * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types | ||
| 51 | * @closure: For arbitrary use by userspace | ||
| 52 | * @type: Discriminates the fw_cdev_event_ types | ||
| 53 | * | ||
| 54 | * This struct may be used to access generic members of all fw_cdev_event_ | ||
| 55 | * 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 | */ | ||
| 61 | struct fw_cdev_event_common { | ||
| 62 | __u64 closure; | ||
| 63 | __u32 type; | ||
| 64 | }; | ||
| 65 | |||
| 66 | /** | ||
| 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. | ||
| 80 | * | ||
| 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. | ||
| 84 | */ | ||
| 85 | struct fw_cdev_event_bus_reset { | ||
| 86 | __u64 closure; | ||
| 87 | __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 | |||
| 96 | /** | ||
| 97 | * struct fw_cdev_event_response - Sent when a response packet was received | ||
| 98 | * @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 | ||
| 101 | * @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. | ||
| 110 | * | ||
| 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. | ||
| 115 | */ | ||
| 116 | struct fw_cdev_event_response { | ||
| 117 | __u64 closure; | ||
| 118 | __u32 type; | ||
| 119 | __u32 rcode; | ||
| 120 | __u32 length; | ||
| 121 | __u32 data[0]; | ||
| 122 | }; | ||
| 123 | |||
| 124 | /** | ||
| 125 | * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2 | ||
| 126 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST | ||
| 127 | * | ||
| 128 | * This event is sent instead of &fw_cdev_event_request2 if the kernel or | ||
| 129 | * the client implements ABI version <= 3. &fw_cdev_event_request lacks | ||
| 130 | * essential information; use &fw_cdev_event_request2 instead. | ||
| 131 | */ | ||
| 132 | struct fw_cdev_event_request { | ||
| 133 | __u64 closure; | ||
| 134 | __u32 type; | ||
| 135 | __u32 tcode; | ||
| 136 | __u64 offset; | ||
| 137 | __u32 handle; | ||
| 138 | __u32 length; | ||
| 139 | __u32 data[0]; | ||
| 140 | }; | ||
| 141 | |||
| 142 | /** | ||
| 143 | * struct fw_cdev_event_request2 - Sent on incoming request to an address region | ||
| 144 | * @closure: See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl | ||
| 145 | * @type: See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2 | ||
| 146 | * @tcode: Transaction code of the incoming request | ||
| 147 | * @offset: The offset into the 48-bit per-node address space | ||
| 148 | * @source_node_id: Sender node ID | ||
| 149 | * @destination_node_id: Destination node ID | ||
| 150 | * @card: The index of the card from which the request came | ||
| 151 | * @generation: Bus generation in which the request is valid | ||
| 152 | * @handle: Reference to the kernel-side pending request | ||
| 153 | * @length: Data length, i.e. the request's payload size in bytes | ||
| 154 | * @data: Incoming data, if any | ||
| 155 | * | ||
| 156 | * This event is sent when the stack receives an incoming request to an address | ||
| 157 | * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl. The request is | ||
| 158 | * guaranteed to be completely contained in the specified region. Userspace is | ||
| 159 | * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl, | ||
| 160 | * using the same @handle. | ||
| 161 | * | ||
| 162 | * The payload data for requests carrying data (write and lock requests) | ||
| 163 | * follows immediately and can be accessed through the @data field. | ||
| 164 | * | ||
| 165 | * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the | ||
| 166 | * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT, | ||
| 167 | * i.e. encodes the extended transaction code. | ||
| 168 | * | ||
| 169 | * @card may differ from &fw_cdev_get_info.card because requests are received | ||
| 170 | * from all cards of the Linux host. @source_node_id, @destination_node_id, and | ||
| 171 | * @generation pertain to that card. Destination node ID and bus generation may | ||
| 172 | * therefore differ from the corresponding fields of the last | ||
| 173 | * &fw_cdev_event_bus_reset. | ||
| 174 | * | ||
| 175 | * @destination_node_id may also differ from the current node ID because of a | ||
| 176 | * non-local bus ID part or in case of a broadcast write request. Note, a | ||
| 177 | * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a | ||
| 178 | * broadcast write request; the kernel will then release the kernel-side pending | ||
| 179 | * request but will not actually send a response packet. | ||
| 180 | * | ||
| 181 | * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already | ||
| 182 | * sent a write response immediately after the request was received; in this | ||
| 183 | * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to | ||
| 184 | * release the kernel-side pending request, though another response won't be | ||
| 185 | * sent. | ||
| 186 | * | ||
| 187 | * If the client subsequ | ||
