aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-transaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-transaction.h')
-rw-r--r--drivers/firewire/fw-transaction.h174
1 files changed, 87 insertions, 87 deletions
diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h
index a664fc3380c6..22d2871131b1 100644
--- a/drivers/firewire/fw-transaction.h
+++ b/drivers/firewire/fw-transaction.h
@@ -36,9 +36,9 @@
36#define TCODE_READ_QUADLET_RESPONSE 6 36#define TCODE_READ_QUADLET_RESPONSE 6
37#define TCODE_READ_BLOCK_RESPONSE 7 37#define TCODE_READ_BLOCK_RESPONSE 7
38#define TCODE_CYCLE_START 8 38#define TCODE_CYCLE_START 8
39#define TCODE_LOCK_REQUEST 9 39#define TCODE_LOCK_REQUEST 9
40#define TCODE_STREAM_DATA 10 40#define TCODE_STREAM_DATA 10
41#define TCODE_LOCK_RESPONSE 11 41#define TCODE_LOCK_RESPONSE 11
42 42
43#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0) 43#define TCODE_IS_BLOCK_PACKET(tcode) (((tcode) & 1) != 0)
44#define TCODE_IS_REQUEST(tcode) (((tcode) & 2) == 0) 44#define TCODE_IS_REQUEST(tcode) (((tcode) & 2) == 0)
@@ -61,26 +61,26 @@
61#define SCODE_400 0x2 61#define SCODE_400 0x2
62#define SCODE_BETA 0x3 62#define SCODE_BETA 0x3
63 63
64#define EXTCODE_MASK_SWAP 0x1 64#define EXTCODE_MASK_SWAP 0x1
65#define EXTCODE_COMPARE_SWAP 0x2 65#define EXTCODE_COMPARE_SWAP 0x2
66#define EXTCODE_FETCH_ADD 0x3 66#define EXTCODE_FETCH_ADD 0x3
67#define EXTCODE_LITTLE_ADD 0x4 67#define EXTCODE_LITTLE_ADD 0x4
68#define EXTCODE_BOUNDED_ADD 0x5 68#define EXTCODE_BOUNDED_ADD 0x5
69#define EXTCODE_WRAP_ADD 0x6 69#define EXTCODE_WRAP_ADD 0x6
70 70
71#define ACK_COMPLETE 0x1 71#define ACK_COMPLETE 0x1
72#define ACK_PENDING 0x2 72#define ACK_PENDING 0x2
73#define ACK_BUSY_X 0x4 73#define ACK_BUSY_X 0x4
74#define ACK_BUSY_A 0x5 74#define ACK_BUSY_A 0x5
75#define ACK_BUSY_B 0x6 75#define ACK_BUSY_B 0x6
76#define ACK_DATA_ERROR 0xd 76#define ACK_DATA_ERROR 0xd
77#define ACK_TYPE_ERROR 0xe 77#define ACK_TYPE_ERROR 0xe
78 78
79#define RCODE_COMPLETE 0x0 79#define RCODE_COMPLETE 0x0
80#define RCODE_CONFLICT_ERROR 0x4 80#define RCODE_CONFLICT_ERROR 0x4
81#define RCODE_DATA_ERROR 0x5 81#define RCODE_DATA_ERROR 0x5
82#define RCODE_TYPE_ERROR 0x6 82#define RCODE_TYPE_ERROR 0x6
83#define RCODE_ADDRESS_ERROR 0x7 83#define RCODE_ADDRESS_ERROR 0x7
84 84
85/* Juju specific rcodes */ 85/* Juju specific rcodes */
86#define RCODE_SEND_ERROR 0x10 86#define RCODE_SEND_ERROR 0x10
@@ -94,10 +94,10 @@
94 94
95#define LOCAL_BUS 0xffc0 95#define LOCAL_BUS 0xffc0
96 96
97#define SELFID_PORT_CHILD 0x3 97#define SELFID_PORT_CHILD 0x3
98#define SELFID_PORT_PARENT 0x2 98#define SELFID_PORT_PARENT 0x2
99#define SELFID_PORT_NCONN 0x1 99#define SELFID_PORT_NCONN 0x1
100#define SELFID_PORT_NONE 0x0 100#define SELFID_PORT_NONE 0x0
101 101
102#define PHY_PACKET_CONFIG 0x0 102#define PHY_PACKET_CONFIG 0x0
103#define PHY_PACKET_LINK_ON 0x1 103#define PHY_PACKET_LINK_ON 0x1
@@ -162,54 +162,54 @@ typedef void (*fw_bus_reset_callback_t)(struct fw_card *handle,
162 void *callback_data); 162 void *callback_data);
163 163
164struct fw_packet { 164struct fw_packet {
165 int speed; 165 int speed;
166 int generation; 166 int generation;
167 u32 header[4]; 167 u32 header[4];
168 size_t header_length; 168 size_t header_length;
169 void *payload; 169 void *payload;
170 size_t payload_length; 170 size_t payload_length;
171 u32 timestamp; 171 u32 timestamp;
172 172
173 dma_addr_t payload_bus; 173 dma_addr_t payload_bus;
174 174
175 /* This callback is called when the packet transmission has 175 /* This callback is called when the packet transmission has
176 * completed; for successful transmission, the status code is 176 * completed; for successful transmission, the status code is
177 * the ack received from the destination, otherwise it's a 177 * the ack received from the destination, otherwise it's a
178 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO. 178 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
179 * The callback can be called from tasklet context and thus 179 * The callback can be called from tasklet context and thus
180 * must never block. 180 * must never block.
181 */ 181 */
182 fw_packet_callback_t callback; 182 fw_packet_callback_t callback;
183 int status; 183 int status;
184 struct list_head link; 184 struct list_head link;
185}; 185};
186 186
187struct fw_transaction { 187struct fw_transaction {
188 int node_id; /* The generation is implied; it is always the current. */ 188 int node_id; /* The generation is implied; it is always the current. */
189 int tlabel; 189 int tlabel;
190 int timestamp; 190 int timestamp;
191 struct list_head link; 191 struct list_head link;
192 192
193 struct fw_packet packet; 193 struct fw_packet packet;
194 194
195 /* The data passed to the callback is valid only during the 195 /* The data passed to the callback is valid only during the
196 * callback. */ 196 * callback. */
197 fw_transaction_callback_t callback; 197 fw_transaction_callback_t callback;
198 void *callback_data; 198 void *callback_data;
199}; 199};
200 200
201static inline struct fw_packet * 201static inline struct fw_packet *
202fw_packet(struct list_head *l) 202fw_packet(struct list_head *l)
203{ 203{
204 return list_entry (l, struct fw_packet, link); 204 return list_entry (l, struct fw_packet, link);
205} 205}
206 206
207struct fw_address_handler { 207struct fw_address_handler {
208 u64 offset; 208 u64 offset;
209 size_t length; 209 size_t length;
210 fw_address_callback_t address_callback; 210 fw_address_callback_t address_callback;
211 void *callback_data; 211 void *callback_data;
212 struct list_head link; 212 struct list_head link;
213}; 213};
214 214
215 215
@@ -236,22 +236,22 @@ struct fw_card {
236 const struct fw_card_driver *driver; 236 const struct fw_card_driver *driver;
237 struct device *device; 237 struct device *device;
238 238
239 int node_id; 239 int node_id;
240 int generation; 240 int generation;
241 /* This is the generation used for timestamping incoming requests. */ 241 /* This is the generation used for timestamping incoming requests. */
242 int request_generation; 242 int request_generation;
243 int current_tlabel, tlabel_mask; 243 int current_tlabel, tlabel_mask;
244 struct list_head transaction_list; 244 struct list_head transaction_list;
245 struct timer_list flush_timer; 245 struct timer_list flush_timer;
246 246
247 unsigned long long guid; 247 unsigned long long guid;
248 int max_receive; 248 int max_receive;
249 int link_speed; 249 int link_speed;
250 int config_rom_generation; 250 int config_rom_generation;
251 251
252 /* We need to store up to 4 self ID for a maximum of 63 devices. */ 252 /* We need to store up to 4 self ID for a maximum of 63 devices. */
253 int self_id_count; 253 int self_id_count;
254 u32 self_ids[252]; 254 u32 self_ids[252];
255 255
256 spinlock_t lock; /* Take this lock when handling the lists in 256 spinlock_t lock; /* Take this lock when handling the lists in
257 * this struct. */ 257 * this struct. */
@@ -282,13 +282,13 @@ void fw_card_put(struct fw_card *card);
282 * scatter-gather streaming (e.g. assembling video frame automatically). */ 282 * scatter-gather streaming (e.g. assembling video frame automatically). */
283 283
284struct fw_iso_packet { 284struct fw_iso_packet {
285 u16 payload_length; /* Length of indirect payload. */ 285 u16 payload_length; /* Length of indirect payload. */
286 u32 interrupt : 1; /* Generate interrupt on this packet */ 286 u32 interrupt : 1; /* Generate interrupt on this packet */
287 u32 skip : 1; /* Set to not send packet at all. */ 287 u32 skip : 1; /* Set to not send packet at all. */
288 u32 tag : 2; 288 u32 tag : 2;
289 u32 sy : 4; 289 u32 sy : 4;
290 u32 header_length : 8; /* Length of immediate header. */ 290 u32 header_length : 8; /* Length of immediate header. */
291 u32 header[0]; 291 u32 header[0];
292}; 292};
293 293
294#define FW_ISO_CONTEXT_TRANSMIT 0 294#define FW_ISO_CONTEXT_TRANSMIT 0
@@ -335,25 +335,25 @@ fw_iso_context_send(struct fw_iso_context *ctx,
335 int channel, int speed, int cycle); 335 int channel, int speed, int cycle);
336 336
337struct fw_card_driver { 337struct fw_card_driver {
338 const char *name; 338 const char *name;
339 339
340 /* Enable the given card with the given initial config rom. 340 /* Enable the given card with the given initial config rom.
341 * This function is expected to activate the card, and either 341 * This function is expected to activate the card, and either
342 * enable the PHY or set the link_on bit and initiate a bus 342 * enable the PHY or set the link_on bit and initiate a bus
343 * reset. */ 343 * reset. */
344 int (*enable) (struct fw_card *card, u32 *config_rom, size_t length); 344 int (*enable) (struct fw_card *card, u32 *config_rom, size_t length);
345 345
346 int (*update_phy_reg) (struct fw_card *card, int address, 346 int (*update_phy_reg) (struct fw_card *card, int address,
347 int clear_bits, int set_bits); 347 int clear_bits, int set_bits);
348 348
349 /* Update the config rom for an enabled card. This function 349 /* Update the config rom for an enabled card. This function
350 * should change the config rom that is presented on the bus 350 * should change the config rom that is presented on the bus
351 * an initiate a bus reset. */ 351 * an initiate a bus reset. */
352 int (*set_config_rom) (struct fw_card *card, 352 int (*set_config_rom) (struct fw_card *card,
353 u32 *config_rom, size_t length); 353 u32 *config_rom, size_t length);
354 354
355 void (*send_request) (struct fw_card *card, struct fw_packet *packet); 355 void (*send_request) (struct fw_card *card, struct fw_packet *packet);
356 void (*send_response) (struct fw_card *card, struct fw_packet *packet); 356 void (*send_response) (struct fw_card *card, struct fw_packet *packet);
357 357
358 /* Allow the specified node ID to do direct DMA out and in of 358 /* Allow the specified node ID to do direct DMA out and in of
359 * host memory. The card will disable this for all node when 359 * host memory. The card will disable this for all node when
@@ -419,8 +419,8 @@ fw_core_handle_request(struct fw_card *card,
419 u32 length, u32 *payload); 419 u32 length, u32 *payload);
420void 420void
421fw_core_handle_response(struct fw_card *card, 421fw_core_handle_response(struct fw_card *card,
422 int speed, int ack, int timestamp, 422 int speed, int ack, int timestamp,
423 u32 length, u32 *payload); 423 u32 length, u32 *payload);
424 424
425 425
426#endif /* __fw_transaction_h */ 426#endif /* __fw_transaction_h */