aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/firewire/fw-transaction.c')
-rw-r--r--drivers/firewire/fw-transaction.c52
1 files changed, 48 insertions, 4 deletions
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 3052698c13a6..38b286ed744f 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -140,7 +140,7 @@ transmit_complete_callback(struct fw_packet *packet,
140 140
141static void 141static void
142fw_fill_request(struct fw_packet *packet, int tcode, int tlabel, 142fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
143 int node_id, int generation, int speed, 143 int node_id, int source_id, int generation, int speed,
144 unsigned long long offset, void *payload, size_t length) 144 unsigned long long offset, void *payload, size_t length)
145{ 145{
146 int ext_tcode; 146 int ext_tcode;
@@ -157,7 +157,7 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
157 header_tcode(tcode) | 157 header_tcode(tcode) |
158 header_destination(node_id); 158 header_destination(node_id);
159 packet->header[1] = 159 packet->header[1] =
160 header_offset_high(offset >> 32) | header_source(0); 160 header_offset_high(offset >> 32) | header_source(source_id);
161 packet->header[2] = 161 packet->header[2] =
162 offset; 162 offset;
163 163
@@ -241,7 +241,7 @@ fw_send_request(struct fw_card *card, struct fw_transaction *t,
241 fw_transaction_callback_t callback, void *callback_data) 241 fw_transaction_callback_t callback, void *callback_data)
242{ 242{
243 unsigned long flags; 243 unsigned long flags;
244 int tlabel; 244 int tlabel, source;
245 245
246 /* Bump the flush timer up 100ms first of all so we 246 /* Bump the flush timer up 100ms first of all so we
247 * don't race with a flush timer callback. */ 247 * don't race with a flush timer callback. */
@@ -253,6 +253,7 @@ fw_send_request(struct fw_card *card, struct fw_transaction *t,
253 253
254 spin_lock_irqsave(&card->lock, flags); 254 spin_lock_irqsave(&card->lock, flags);
255 255
256 source = card->node_id;
256 tlabel = card->current_tlabel; 257 tlabel = card->current_tlabel;
257 if (card->tlabel_mask & (1 << tlabel)) { 258 if (card->tlabel_mask & (1 << tlabel)) {
258 spin_unlock_irqrestore(&card->lock, flags); 259 spin_unlock_irqrestore(&card->lock, flags);
@@ -274,7 +275,8 @@ fw_send_request(struct fw_card *card, struct fw_transaction *t,
274 t->callback_data = callback_data; 275 t->callback_data = callback_data;
275 276
276 fw_fill_request(&t->packet, tcode, t->tlabel, 277 fw_fill_request(&t->packet, tcode, t->tlabel,
277 node_id, generation, speed, offset, payload, length); 278 node_id, source, generation,
279 speed, offset, payload, length);
278 t->packet.callback = transmit_complete_callback; 280 t->packet.callback = transmit_complete_callback;
279 281
280 card->driver->send_request(card, &t->packet); 282 card->driver->send_request(card, &t->packet);
@@ -716,6 +718,44 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
716} 718}
717EXPORT_SYMBOL(fw_core_handle_response); 719EXPORT_SYMBOL(fw_core_handle_response);
718 720
721const struct fw_address_region topology_map_region =
722 { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, };
723
724static void
725handle_topology_map(struct fw_card *card, struct fw_request *request,
726 int tcode, int destination, int source,
727 int generation, int speed,
728 unsigned long long offset,
729 void *payload, size_t length, void *callback_data)
730{
731 int i, start, end;
732 u32 *map;
733
734 if (!TCODE_IS_READ_REQUEST(tcode)) {
735 fw_send_response(card, request, RCODE_TYPE_ERROR);
736 return;
737 }
738
739 if ((offset & 3) > 0 || (length & 3) > 0) {
740 fw_send_response(card, request, RCODE_ADDRESS_ERROR);
741 return;
742 }
743
744 start = (offset - topology_map_region.start) / 4;
745 end = start + length / 4;
746 map = payload;
747
748 for (i = 0; i < length / 4; i++)
749 map[i] = cpu_to_be32(card->topology_map[start + i]);
750
751 fw_send_response(card, request, RCODE_COMPLETE);
752}
753
754static struct fw_address_handler topology_map = {
755 .length = 0x400,
756 .address_callback = handle_topology_map,
757};
758
719MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>"); 759MODULE_AUTHOR("Kristian Hoegsberg <krh@bitplanet.net>");
720MODULE_DESCRIPTION("Core IEEE1394 transaction logic"); 760MODULE_DESCRIPTION("Core IEEE1394 transaction logic");
721MODULE_LICENSE("GPL"); 761MODULE_LICENSE("GPL");
@@ -767,6 +807,10 @@ static int __init fw_core_init(void)
767 return fw_cdev_major; 807 return fw_cdev_major;
768 } 808 }
769 809
810 retval = fw_core_add_address_handler(&topology_map,
811 &topology_map_region);
812 BUG_ON(retval < 0);
813
770 /* Add the vendor textual descriptor. */ 814 /* Add the vendor textual descriptor. */
771 retval = fw_core_add_descriptor(&vendor_id_descriptor); 815 retval = fw_core_add_descriptor(&vendor_id_descriptor);
772 BUG_ON(retval < 0); 816 BUG_ON(retval < 0);