diff options
Diffstat (limited to 'include/linux/firewire.h')
| -rw-r--r-- | include/linux/firewire.h | 78 |
1 files changed, 52 insertions, 26 deletions
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index a0e67150a729..1cd637ef62d2 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
| @@ -32,11 +32,13 @@ | |||
| 32 | #define CSR_CYCLE_TIME 0x200 | 32 | #define CSR_CYCLE_TIME 0x200 |
| 33 | #define CSR_BUS_TIME 0x204 | 33 | #define CSR_BUS_TIME 0x204 |
| 34 | #define CSR_BUSY_TIMEOUT 0x210 | 34 | #define CSR_BUSY_TIMEOUT 0x210 |
| 35 | #define CSR_PRIORITY_BUDGET 0x218 | ||
| 35 | #define CSR_BUS_MANAGER_ID 0x21c | 36 | #define CSR_BUS_MANAGER_ID 0x21c |
| 36 | #define CSR_BANDWIDTH_AVAILABLE 0x220 | 37 | #define CSR_BANDWIDTH_AVAILABLE 0x220 |
| 37 | #define CSR_CHANNELS_AVAILABLE 0x224 | 38 | #define CSR_CHANNELS_AVAILABLE 0x224 |
| 38 | #define CSR_CHANNELS_AVAILABLE_HI 0x224 | 39 | #define CSR_CHANNELS_AVAILABLE_HI 0x224 |
| 39 | #define CSR_CHANNELS_AVAILABLE_LO 0x228 | 40 | #define CSR_CHANNELS_AVAILABLE_LO 0x228 |
| 41 | #define CSR_MAINT_UTILITY 0x230 | ||
| 40 | #define CSR_BROADCAST_CHANNEL 0x234 | 42 | #define CSR_BROADCAST_CHANNEL 0x234 |
| 41 | #define CSR_CONFIG_ROM 0x400 | 43 | #define CSR_CONFIG_ROM 0x400 |
| 42 | #define CSR_CONFIG_ROM_END 0x800 | 44 | #define CSR_CONFIG_ROM_END 0x800 |
| @@ -55,22 +57,21 @@ | |||
| 55 | #define CSR_DESCRIPTOR 0x01 | 57 | #define CSR_DESCRIPTOR 0x01 |
| 56 | #define CSR_VENDOR 0x03 | 58 | #define CSR_VENDOR 0x03 |
| 57 | #define CSR_HARDWARE_VERSION 0x04 | 59 | #define CSR_HARDWARE_VERSION 0x04 |
| 58 | #define CSR_NODE_CAPABILITIES 0x0c | ||
| 59 | #define CSR_UNIT 0x11 | 60 | #define CSR_UNIT 0x11 |
| 60 | #define CSR_SPECIFIER_ID 0x12 | 61 | #define CSR_SPECIFIER_ID 0x12 |
| 61 | #define CSR_VERSION 0x13 | 62 | #define CSR_VERSION 0x13 |
| 62 | #define CSR_DEPENDENT_INFO 0x14 | 63 | #define CSR_DEPENDENT_INFO 0x14 |
| 63 | #define CSR_MODEL 0x17 | 64 | #define CSR_MODEL 0x17 |
| 64 | #define CSR_INSTANCE 0x18 | ||
| 65 | #define CSR_DIRECTORY_ID 0x20 | 65 | #define CSR_DIRECTORY_ID 0x20 |
| 66 | 66 | ||
| 67 | struct fw_csr_iterator { | 67 | struct fw_csr_iterator { |
| 68 | u32 *p; | 68 | const u32 *p; |
| 69 | u32 *end; | 69 | const u32 *end; |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p); | 72 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p); |
| 73 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); | 73 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); |
| 74 | int fw_csr_string(const u32 *directory, int key, char *buf, size_t size); | ||
| 74 | 75 | ||
| 75 | extern struct bus_type fw_bus_type; | 76 | extern struct bus_type fw_bus_type; |
| 76 | 77 | ||
| @@ -88,9 +89,13 @@ struct fw_card { | |||
| 88 | int current_tlabel; | 89 | int current_tlabel; |
| 89 | u64 tlabel_mask; | 90 | u64 tlabel_mask; |
| 90 | struct list_head transaction_list; | 91 | struct list_head transaction_list; |
| 91 | struct timer_list flush_timer; | ||
| 92 | unsigned long reset_jiffies; | 92 | unsigned long reset_jiffies; |
| 93 | 93 | ||
| 94 | u32 split_timeout_hi; | ||
| 95 | u32 split_timeout_lo; | ||
| 96 | unsigned int split_timeout_cycles; | ||
| 97 | unsigned int split_timeout_jiffies; | ||
| 98 | |||
| 94 | unsigned long long guid; | 99 | unsigned long long guid; |
| 95 | unsigned max_receive; | 100 | unsigned max_receive; |
| 96 | int link_speed; | 101 | int link_speed; |
| @@ -106,18 +111,28 @@ struct fw_card { | |||
| 106 | bool beta_repeaters_present; | 111 | bool beta_repeaters_present; |
| 107 | 112 | ||
| 108 | int index; | 113 | int index; |
| 109 | |||
| 110 | struct list_head link; | 114 | struct list_head link; |
| 111 | 115 | ||
| 112 | /* Work struct for BM duties. */ | 116 | struct list_head phy_receiver_list; |
| 113 | struct delayed_work work; | 117 | |
| 118 | struct delayed_work br_work; /* bus reset job */ | ||
| 119 | bool br_short; | ||
| 120 | |||
| 121 | struct delayed_work bm_work; /* bus manager job */ | ||
| 114 | int bm_retries; | 122 | int bm_retries; |
| 115 | int bm_generation; | 123 | int bm_generation; |
| 116 | __be32 bm_transaction_data[2]; | 124 | __be32 bm_transaction_data[2]; |
| 125 | int bm_node_id; | ||
| 126 | bool bm_abdicate; | ||
| 127 | |||
| 128 | bool priority_budget_implemented; /* controller feature */ | ||
| 129 | bool broadcast_channel_auto_allocated; /* controller feature */ | ||
| 117 | 130 | ||
| 118 | bool broadcast_channel_allocated; | 131 | bool broadcast_channel_allocated; |
| 119 | u32 broadcast_channel; | 132 | u32 broadcast_channel; |
| 120 | __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; | 133 | __be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; |
| 134 | |||
| 135 | __be32 maint_utility_register; | ||
| 121 | }; | 136 | }; |
| 122 | 137 | ||
| 123 | struct fw_attribute_group { | 138 | struct fw_attribute_group { |
| @@ -162,7 +177,7 @@ struct fw_device { | |||
| 162 | struct mutex client_list_mutex; | 177 | struct mutex client_list_mutex; |
| 163 | struct list_head client_list; | 178 | struct list_head client_list; |
| 164 | 179 | ||
| 165 | u32 *config_rom; | 180 | const u32 *config_rom; |
| 166 | size_t config_rom_length; | 181 | size_t config_rom_length; |
| 167 | int config_rom_retries; | 182 | int config_rom_retries; |
| 168 | unsigned is_local:1; | 183 | unsigned is_local:1; |
| @@ -204,7 +219,7 @@ int fw_device_enable_phys_dma(struct fw_device *device); | |||
| 204 | */ | 219 | */ |
| 205 | struct fw_unit { | 220 | struct fw_unit { |
| 206 | struct device device; | 221 | struct device device; |
| 207 | u32 *directory; | 222 | const u32 *directory; |
| 208 | struct fw_attribute_group attribute_group; | 223 | struct fw_attribute_group attribute_group; |
| 209 | }; | 224 | }; |
| 210 | 225 | ||
| @@ -254,7 +269,7 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | |||
| 254 | typedef void (*fw_address_callback_t)(struct fw_card *card, | 269 | typedef void (*fw_address_callback_t)(struct fw_card *card, |
| 255 | struct fw_request *request, | 270 | struct fw_request *request, |
| 256 | int tcode, int destination, int source, | 271 | int tcode, int destination, int source, |
| 257 | int generation, int speed, | 272 | int generation, |
| 258 | unsigned long long offset, | 273 | unsigned long long offset, |
| 259 | void *data, size_t length, | 274 | void *data, size_t length, |
| 260 | void *callback_data); | 275 | void *callback_data); |
| @@ -271,10 +286,10 @@ struct fw_packet { | |||
| 271 | u32 timestamp; | 286 | u32 timestamp; |
| 272 | 287 | ||
| 273 | /* | 288 | /* |
| 274 | * This callback is called when the packet transmission has | 289 | * This callback is called when the packet transmission has completed. |
| 275 | * completed; for successful transmission, the status code is | 290 | * For successful transmission, the status code is the ack received |
| 276 | * the ack received from the destination, otherwise it's a | 291 | * from the destination. Otherwise it is one of the juju-specific |
| 277 | * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO. | 292 | * rcodes: RCODE_SEND_ERROR, _CANCELLED, _BUSY, _GENERATION, _NO_ACK. |
| 278 | * The callback can be called from tasklet context and thus | 293 | * The callback can be called from tasklet context and thus |
| 279 | * must never block. | 294 | * must never block. |
| 280 | */ | 295 | */ |
| @@ -289,6 +304,8 @@ struct fw_transaction { | |||
| 289 | int tlabel; | 304 | int tlabel; |
| 290 | int timestamp; | 305 | int timestamp; |
| 291 | struct list_head link; | 306 | struct list_head link; |
| 307 | struct fw_card *card; | ||
| 308 | struct timer_list split_timeout_timer; | ||
| 292 | 309 | ||
| 293 | struct fw_packet packet; | 310 | struct fw_packet packet; |
| 294 | 311 | ||
| @@ -355,17 +372,19 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc); | |||
| 355 | * scatter-gather streaming (e.g. assembling video frame automatically). | 372 | * scatter-gather streaming (e.g. assembling video frame automatically). |
| 356 | */ | 373 | */ |
| 357 | struct fw_iso_packet { | 374 | struct fw_iso_packet { |
| 358 | u16 payload_length; /* Length of indirect payload. */ | 375 | u16 payload_length; /* Length of indirect payload */ |
| 359 | u32 interrupt:1; /* Generate interrupt on this packet */ | 376 | u32 interrupt:1; /* Generate interrupt on this packet */ |
| 360 | u32 skip:1; /* Set to not send packet at all. */ | 377 | u32 skip:1; /* tx: Set to not send packet at all */ |
| 361 | u32 tag:2; | 378 | /* rx: Sync bit, wait for matching sy */ |
| 362 | u32 sy:4; | 379 | u32 tag:2; /* tx: Tag in packet header */ |
| 363 | u32 header_length:8; /* Length of immediate header. */ | 380 | u32 sy:4; /* tx: Sy in packet header */ |
| 364 | u32 header[0]; | 381 | u32 header_length:8; /* Length of immediate header */ |
| 382 | u32 header[0]; /* tx: Top of 1394 isoch. data_block */ | ||
| 365 | }; | 383 | }; |
| 366 | 384 | ||
| 367 | #define FW_ISO_CONTEXT_TRANSMIT 0 | 385 | #define FW_ISO_CONTEXT_TRANSMIT 0 |
| 368 | #define FW_ISO_CONTEXT_RECEIVE 1 | 386 | #define FW_ISO_CONTEXT_RECEIVE 1 |
| 387 | #define FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL 2 | ||
| 369 | 388 | ||
| 370 | #define FW_ISO_CONTEXT_MATCH_TAG0 1 | 389 | #define FW_ISO_CONTEXT_MATCH_TAG0 1 |
| 371 | #define FW_ISO_CONTEXT_MATCH_TAG1 2 | 390 | #define FW_ISO_CONTEXT_MATCH_TAG1 2 |
| @@ -389,24 +408,31 @@ struct fw_iso_buffer { | |||
| 389 | int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, | 408 | int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card, |
| 390 | int page_count, enum dma_data_direction direction); | 409 | int page_count, enum dma_data_direction direction); |
| 391 | void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); | 410 | void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card); |
| 411 | size_t fw_iso_buffer_lookup(struct fw_iso_buffer *buffer, dma_addr_t completed); | ||
| 392 | 412 | ||
| 393 | struct fw_iso_context; | 413 | struct fw_iso_context; |
| 394 | typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, | 414 | typedef void (*fw_iso_callback_t)(struct fw_iso_context *context, |
| 395 | u32 cycle, size_t header_length, | 415 | u32 cycle, size_t header_length, |
| 396 | void *header, void *data); | 416 | void *header, void *data); |
| 417 | typedef void (*fw_iso_mc_callback_t)(struct fw_iso_context *context, | ||
| 418 | dma_addr_t completed, void *data); | ||
| 397 | struct fw_iso_context { | 419 | struct fw_iso_context { |
| 398 | struct fw_card *card; | 420 | struct fw_card *card; |
| 399 | int type; | 421 | int type; |
| 400 | int channel; | 422 | int channel; |
| 401 | int speed; | 423 | int speed; |
| 402 | size_t header_size; | 424 | size_t header_size; |
| 403 | fw_iso_callback_t callback; | 425 | union { |
| 426 | fw_iso_callback_t sc; | ||
| 427 | fw_iso_mc_callback_t mc; | ||
| 428 | } callback; | ||
| 404 | void *callback_data; | 429 | void *callback_data; |
| 405 | }; | 430 | }; |
| 406 | 431 | ||
| 407 | struct fw_iso_context *fw_iso_context_create(struct fw_card *card, | 432 | struct fw_iso_context *fw_iso_context_create(struct fw_card *card, |
| 408 | int type, int channel, int speed, size_t header_size, | 433 | int type, int channel, int speed, size_t header_size, |
| 409 | fw_iso_callback_t callback, void *callback_data); | 434 | fw_iso_callback_t callback, void *callback_data); |
| 435 | int fw_iso_context_set_channels(struct fw_iso_context *ctx, u64 *channels); | ||
| 410 | int fw_iso_context_queue(struct fw_iso_context *ctx, | 436 | int fw_iso_context_queue(struct fw_iso_context *ctx, |
| 411 | struct fw_iso_packet *packet, | 437 | struct fw_iso_packet *packet, |
| 412 | struct fw_iso_buffer *buffer, | 438 | struct fw_iso_buffer *buffer, |
