diff options
Diffstat (limited to 'drivers/firewire')
-rw-r--r-- | drivers/firewire/Kconfig | 44 | ||||
-rw-r--r-- | drivers/firewire/core-card.c | 41 | ||||
-rw-r--r-- | drivers/firewire/core-cdev.c | 39 | ||||
-rw-r--r-- | drivers/firewire/core-transaction.c | 118 | ||||
-rw-r--r-- | drivers/firewire/ohci.c | 8 |
5 files changed, 177 insertions, 73 deletions
diff --git a/drivers/firewire/Kconfig b/drivers/firewire/Kconfig index 13efcd362072..a9371b36a9b9 100644 --- a/drivers/firewire/Kconfig +++ b/drivers/firewire/Kconfig | |||
@@ -1,5 +1,10 @@ | |||
1 | menu "IEEE 1394 (FireWire) support" | ||
2 | depends on PCI || BROKEN | ||
3 | # firewire-core does not depend on PCI but is | ||
4 | # not useful without PCI controller driver | ||
5 | |||
1 | comment "You can enable one or both FireWire driver stacks." | 6 | comment "You can enable one or both FireWire driver stacks." |
2 | comment "See the help texts for more information." | 7 | comment "The newer stack is recommended." |
3 | 8 | ||
4 | config FIREWIRE | 9 | config FIREWIRE |
5 | tristate "FireWire driver stack" | 10 | tristate "FireWire driver stack" |
@@ -15,16 +20,6 @@ config FIREWIRE | |||
15 | To compile this driver as a module, say M here: the module will be | 20 | To compile this driver as a module, say M here: the module will be |
16 | called firewire-core. | 21 | called firewire-core. |
17 | 22 | ||
18 | This module functionally replaces ieee1394, raw1394, and video1394. | ||
19 | To access it from application programs, you generally need at least | ||
20 | libraw1394 v2. IIDC/DCAM applications need libdc1394 v2. | ||
21 | No libraries are required to access storage devices through the | ||
22 | firewire-sbp2 driver. | ||
23 | |||
24 | NOTE: | ||
25 | FireWire audio devices currently require the old drivers (ieee1394, | ||
26 | ohci1394, raw1394). | ||
27 | |||
28 | config FIREWIRE_OHCI | 23 | config FIREWIRE_OHCI |
29 | tristate "OHCI-1394 controllers" | 24 | tristate "OHCI-1394 controllers" |
30 | depends on PCI && FIREWIRE | 25 | depends on PCI && FIREWIRE |
@@ -34,22 +29,7 @@ config FIREWIRE_OHCI | |||
34 | is the only chipset in use, so say Y here. | 29 | is the only chipset in use, so say Y here. |
35 | 30 | ||
36 | To compile this driver as a module, say M here: The module will be | 31 | To compile this driver as a module, say M here: The module will be |
37 | called firewire-ohci. It replaces ohci1394 of the classic IEEE 1394 | 32 | called firewire-ohci. |
38 | stack. | ||
39 | |||
40 | NOTE: | ||
41 | If you want to install firewire-ohci and ohci1394 together, you | ||
42 | should configure them only as modules and blacklist the driver(s) | ||
43 | which you don't want to have auto-loaded. Add either | ||
44 | |||
45 | blacklist firewire-ohci | ||
46 | or | ||
47 | blacklist ohci1394 | ||
48 | blacklist video1394 | ||
49 | blacklist dv1394 | ||
50 | |||
51 | to /etc/modprobe.conf or /etc/modprobe.d/* and update modprobe.conf | ||
52 | depending on your distribution. | ||
53 | 33 | ||
54 | config FIREWIRE_OHCI_DEBUG | 34 | config FIREWIRE_OHCI_DEBUG |
55 | bool | 35 | bool |
@@ -66,8 +46,7 @@ config FIREWIRE_SBP2 | |||
66 | like scanners. | 46 | like scanners. |
67 | 47 | ||
68 | To compile this driver as a module, say M here: The module will be | 48 | To compile this driver as a module, say M here: The module will be |
69 | called firewire-sbp2. It replaces sbp2 of the classic IEEE 1394 | 49 | called firewire-sbp2. |
70 | stack. | ||
71 | 50 | ||
72 | You should also enable support for disks, CD-ROMs, etc. in the SCSI | 51 | You should also enable support for disks, CD-ROMs, etc. in the SCSI |
73 | configuration section. | 52 | configuration section. |
@@ -83,5 +62,8 @@ config FIREWIRE_NET | |||
83 | NOTE, this driver is not stable yet! | 62 | NOTE, this driver is not stable yet! |
84 | 63 | ||
85 | To compile this driver as a module, say M here: The module will be | 64 | To compile this driver as a module, say M here: The module will be |
86 | called firewire-net. It replaces eth1394 of the classic IEEE 1394 | 65 | called firewire-net. |
87 | stack. | 66 | |
67 | source "drivers/ieee1394/Kconfig" | ||
68 | |||
69 | endmenu | ||
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 7083bcc1b9c7..5045156c5313 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c | |||
@@ -57,6 +57,8 @@ static LIST_HEAD(descriptor_list); | |||
57 | static int descriptor_count; | 57 | static int descriptor_count; |
58 | 58 | ||
59 | static __be32 tmp_config_rom[256]; | 59 | static __be32 tmp_config_rom[256]; |
60 | /* ROM header, bus info block, root dir header, capabilities = 7 quadlets */ | ||
61 | static size_t config_rom_length = 1 + 4 + 1 + 1; | ||
60 | 62 | ||
61 | #define BIB_CRC(v) ((v) << 0) | 63 | #define BIB_CRC(v) ((v) << 0) |
62 | #define BIB_CRC_LENGTH(v) ((v) << 16) | 64 | #define BIB_CRC_LENGTH(v) ((v) << 16) |
@@ -73,7 +75,7 @@ static __be32 tmp_config_rom[256]; | |||
73 | #define BIB_CMC ((1) << 30) | 75 | #define BIB_CMC ((1) << 30) |
74 | #define BIB_IMC ((1) << 31) | 76 | #define BIB_IMC ((1) << 31) |
75 | 77 | ||
76 | static size_t generate_config_rom(struct fw_card *card, __be32 *config_rom) | 78 | static void generate_config_rom(struct fw_card *card, __be32 *config_rom) |
77 | { | 79 | { |
78 | struct fw_descriptor *desc; | 80 | struct fw_descriptor *desc; |
79 | int i, j, k, length; | 81 | int i, j, k, length; |
@@ -130,23 +132,30 @@ static size_t generate_config_rom(struct fw_card *card, __be32 *config_rom) | |||
130 | for (i = 0; i < j; i += length + 1) | 132 | for (i = 0; i < j; i += length + 1) |
131 | length = fw_compute_block_crc(config_rom + i); | 133 | length = fw_compute_block_crc(config_rom + i); |
132 | 134 | ||
133 | return j; | 135 | WARN_ON(j != config_rom_length); |
134 | } | 136 | } |
135 | 137 | ||
136 | static void update_config_roms(void) | 138 | static void update_config_roms(void) |
137 | { | 139 | { |
138 | struct fw_card *card; | 140 | struct fw_card *card; |
139 | size_t length; | ||
140 | 141 | ||
141 | list_for_each_entry (card, &card_list, link) { | 142 | list_for_each_entry (card, &card_list, link) { |
142 | length = generate_config_rom(card, tmp_config_rom); | 143 | generate_config_rom(card, tmp_config_rom); |
143 | card->driver->set_config_rom(card, tmp_config_rom, length); | 144 | card->driver->set_config_rom(card, tmp_config_rom, |
145 | config_rom_length); | ||
144 | } | 146 | } |
145 | } | 147 | } |
146 | 148 | ||
149 | static size_t required_space(struct fw_descriptor *desc) | ||
150 | { | ||
151 | /* descriptor + entry into root dir + optional immediate entry */ | ||
152 | return desc->length + 1 + (desc->immediate > 0 ? 1 : 0); | ||
153 | } | ||
154 | |||
147 | int fw_core_add_descriptor(struct fw_descriptor *desc) | 155 | int fw_core_add_descriptor(struct fw_descriptor *desc) |
148 | { | 156 | { |
149 | size_t i; | 157 | size_t i; |
158 | int ret; | ||
150 | 159 | ||
151 | /* | 160 | /* |
152 | * Check descriptor is valid; the length of all blocks in the | 161 | * Check descriptor is valid; the length of all blocks in the |
@@ -162,15 +171,21 @@ int fw_core_add_descriptor(struct fw_descriptor *desc) | |||
162 | 171 | ||
163 | mutex_lock(&card_mutex); | 172 | mutex_lock(&card_mutex); |
164 | 173 | ||
165 | list_add_tail(&desc->link, &descriptor_list); | 174 | if (config_rom_length + required_space(desc) > 256) { |
166 | descriptor_count++; | 175 | ret = -EBUSY; |
167 | if (desc->immediate > 0) | 176 | } else { |
177 | list_add_tail(&desc->link, &descriptor_list); | ||
178 | config_rom_length += required_space(desc); | ||
168 | descriptor_count++; | 179 | descriptor_count++; |
169 | update_config_roms(); | 180 | if (desc->immediate > 0) |
181 | descriptor_count++; | ||
182 | update_config_roms(); | ||
183 | ret = 0; | ||
184 | } | ||
170 | 185 | ||
171 | mutex_unlock(&card_mutex); | 186 | mutex_unlock(&card_mutex); |
172 | 187 | ||
173 | return 0; | 188 | return ret; |
174 | } | 189 | } |
175 | EXPORT_SYMBOL(fw_core_add_descriptor); | 190 | EXPORT_SYMBOL(fw_core_add_descriptor); |
176 | 191 | ||
@@ -179,6 +194,7 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc) | |||
179 | mutex_lock(&card_mutex); | 194 | mutex_lock(&card_mutex); |
180 | 195 | ||
181 | list_del(&desc->link); | 196 | list_del(&desc->link); |
197 | config_rom_length -= required_space(desc); | ||
182 | descriptor_count--; | 198 | descriptor_count--; |
183 | if (desc->immediate > 0) | 199 | if (desc->immediate > 0) |
184 | descriptor_count--; | 200 | descriptor_count--; |
@@ -428,7 +444,6 @@ EXPORT_SYMBOL(fw_card_initialize); | |||
428 | int fw_card_add(struct fw_card *card, | 444 | int fw_card_add(struct fw_card *card, |
429 | u32 max_receive, u32 link_speed, u64 guid) | 445 | u32 max_receive, u32 link_speed, u64 guid) |
430 | { | 446 | { |
431 | size_t length; | ||
432 | int ret; | 447 | int ret; |
433 | 448 | ||
434 | card->max_receive = max_receive; | 449 | card->max_receive = max_receive; |
@@ -437,8 +452,8 @@ int fw_card_add(struct fw_card *card, | |||
437 | 452 | ||
438 | mutex_lock(&card_mutex); | 453 | mutex_lock(&card_mutex); |
439 | 454 | ||
440 | length = generate_config_rom(card, tmp_config_rom); | 455 | generate_config_rom(card, tmp_config_rom); |
441 | ret = card->driver->enable(card, tmp_config_rom, length); | 456 | ret = card->driver->enable(card, tmp_config_rom, config_rom_length); |
442 | if (ret == 0) | 457 | if (ret == 0) |
443 | list_add_tail(&card->link, &card_list); | 458 | list_add_tail(&card->link, &card_list); |
444 | 459 | ||
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 231e6ee5ba43..4eeaed57e219 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/preempt.h> | 35 | #include <linux/preempt.h> |
36 | #include <linux/sched.h> | 36 | #include <linux/sched.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/string.h> | ||
38 | #include <linux/time.h> | 39 | #include <linux/time.h> |
39 | #include <linux/uaccess.h> | 40 | #include <linux/uaccess.h> |
40 | #include <linux/vmalloc.h> | 41 | #include <linux/vmalloc.h> |
@@ -595,14 +596,22 @@ static int ioctl_send_request(struct client *client, void *buffer) | |||
595 | client->device->max_speed); | 596 | client->device->max_speed); |
596 | } | 597 | } |
597 | 598 | ||
599 | static inline bool is_fcp_request(struct fw_request *request) | ||
600 | { | ||
601 | return request == NULL; | ||
602 | } | ||
603 | |||
598 | static void release_request(struct client *client, | 604 | static void release_request(struct client *client, |
599 | struct client_resource *resource) | 605 | struct client_resource *resource) |
600 | { | 606 | { |
601 | struct inbound_transaction_resource *r = container_of(resource, | 607 | struct inbound_transaction_resource *r = container_of(resource, |
602 | struct inbound_transaction_resource, resource); | 608 | struct inbound_transaction_resource, resource); |
603 | 609 | ||
604 | fw_send_response(client->device->card, r->request, | 610 | if (is_fcp_request(r->request)) |
605 | RCODE_CONFLICT_ERROR); | 611 | kfree(r->data); |
612 | else | ||
613 | fw_send_response(client->device->card, r->request, | ||
614 | RCODE_CONFLICT_ERROR); | ||
606 | kfree(r); | 615 | kfree(r); |
607 | } | 616 | } |
608 | 617 | ||
@@ -615,6 +624,7 @@ static void handle_request(struct fw_card *card, struct fw_request *request, | |||
615 | struct address_handler_resource *handler = callback_data; | 624 | struct address_handler_resource *handler = callback_data; |
616 | struct inbound_transaction_resource *r; | 625 | struct inbound_transaction_resource *r; |
617 | struct inbound_transaction_event *e; | 626 | struct inbound_transaction_event *e; |
627 | void *fcp_frame = NULL; | ||
618 | int ret; | 628 | int ret; |
619 | 629 | ||
620 | r = kmalloc(sizeof(*r), GFP_ATOMIC); | 630 | r = kmalloc(sizeof(*r), GFP_ATOMIC); |
@@ -626,6 +636,18 @@ static void handle_request(struct fw_card *card, struct fw_request *request, | |||
626 | r->data = payload; | 636 | r->data = payload; |
627 | r->length = length; | 637 | r->length = length; |
628 | 638 | ||
639 | if (is_fcp_request(request)) { | ||
640 | /* | ||
641 | * FIXME: Let core-transaction.c manage a | ||
642 | * single reference-counted copy? | ||
643 | */ | ||
644 | fcp_frame = kmemdup(payload, length, GFP_ATOMIC); | ||
645 | if (fcp_frame == NULL) | ||
646 | goto failed; | ||
647 | |||
648 | r->data = fcp_frame; | ||
649 | } | ||
650 | |||
629 | r->resource.release = release_request; | 651 | r->resource.release = release_request; |
630 | ret = add_client_resource(handler->client, &r->resource, GFP_ATOMIC); | 652 | ret = add_client_resource(handler->client, &r->resource, GFP_ATOMIC); |
631 | if (ret < 0) | 653 | if (ret < 0) |
@@ -639,13 +661,16 @@ static void handle_request(struct fw_card *card, struct fw_request *request, | |||
639 | e->request.closure = handler->closure; | 661 | e->request.closure = handler->closure; |
640 | 662 | ||
641 | queue_event(handler->client, &e->event, | 663 | queue_event(handler->client, &e->event, |
642 | &e->request, sizeof(e->request), payload, length); | 664 | &e->request, sizeof(e->request), r->data, length); |
643 | return; | 665 | return; |
644 | 666 | ||
645 | failed: | 667 | failed: |
646 | kfree(r); | 668 | kfree(r); |
647 | kfree(e); | 669 | kfree(e); |
648 | fw_send_response(card, request, RCODE_CONFLICT_ERROR); | 670 | kfree(fcp_frame); |
671 | |||
672 | if (!is_fcp_request(request)) | ||
673 | fw_send_response(card, request, RCODE_CONFLICT_ERROR); | ||
649 | } | 674 | } |
650 | 675 | ||
651 | static void release_address_handler(struct client *client, | 676 | static void release_address_handler(struct client *client, |
@@ -715,14 +740,16 @@ static int ioctl_send_response(struct client *client, void *buffer) | |||
715 | 740 | ||
716 | r = container_of(resource, struct inbound_transaction_resource, | 741 | r = container_of(resource, struct inbound_transaction_resource, |
717 | resource); | 742 | resource); |
743 | if (is_fcp_request(r->request)) | ||
744 | goto out; | ||
745 | |||
718 | if (request->length < r->length) | 746 | if (request->length < r->length) |
719 | r->length = request->length; | 747 | r->length = request->length; |
720 | |||
721 | if (copy_from_user(r->data, u64_to_uptr(request->data), r->length)) { | 748 | if (copy_from_user(r->data, u64_to_uptr(request->data), r->length)) { |
722 | ret = -EFAULT; | 749 | ret = -EFAULT; |
750 | kfree(r->request); | ||
723 | goto out; | 751 | goto out; |
724 | } | 752 | } |
725 | |||
726 | fw_send_response(client->device->card, r->request, request->rcode); | 753 | fw_send_response(client->device->card, r->request, request->rcode); |
727 | out: | 754 | out: |
728 | kfree(r); | 755 | kfree(r); |
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c index 842739df23e2..495849eb13cc 100644 --- a/drivers/firewire/core-transaction.c +++ b/drivers/firewire/core-transaction.c | |||
@@ -432,14 +432,20 @@ static struct fw_address_handler *lookup_overlapping_address_handler( | |||
432 | return NULL; | 432 | return NULL; |
433 | } | 433 | } |
434 | 434 | ||
435 | static bool is_enclosing_handler(struct fw_address_handler *handler, | ||
436 | unsigned long long offset, size_t length) | ||
437 | { | ||
438 | return handler->offset <= offset && | ||
439 | offset + length <= handler->offset + handler->length; | ||
440 | } | ||
441 | |||
435 | static struct fw_address_handler *lookup_enclosing_address_handler( | 442 | static struct fw_address_handler *lookup_enclosing_address_handler( |
436 | struct list_head *list, unsigned long long offset, size_t length) | 443 | struct list_head *list, unsigned long long offset, size_t length) |
437 | { | 444 | { |
438 | struct fw_address_handler *handler; | 445 | struct fw_address_handler *handler; |
439 | 446 | ||
440 | list_for_each_entry(handler, list, link) { | 447 | list_for_each_entry(handler, list, link) { |
441 | if (handler->offset <= offset && | 448 | if (is_enclosing_handler(handler, offset, length)) |
442 | offset + length <= handler->offset + handler->length) | ||
443 | return handler; | 449 | return handler; |
444 | } | 450 | } |
445 | 451 | ||
@@ -465,6 +471,12 @@ const struct fw_address_region fw_unit_space_region = | |||
465 | { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, }; | 471 | { .start = 0xfffff0000900ULL, .end = 0x1000000000000ULL, }; |
466 | #endif /* 0 */ | 472 | #endif /* 0 */ |
467 | 473 | ||
474 | static bool is_in_fcp_region(u64 offset, size_t length) | ||
475 | { | ||
476 | return offset >= (CSR_REGISTER_BASE | CSR_FCP_COMMAND) && | ||
477 | offset + length <= (CSR_REGISTER_BASE | CSR_FCP_END); | ||
478 | } | ||
479 | |||
468 | /** | 480 | /** |
469 | * fw_core_add_address_handler - register for incoming requests | 481 | * fw_core_add_address_handler - register for incoming requests |
470 | * @handler: callback | 482 | * @handler: callback |
@@ -477,8 +489,11 @@ const struct fw_address_region fw_unit_space_region = | |||
477 | * give the details of the particular request. | 489 | * give the details of the particular request. |
478 | * | 490 | * |
479 | * Return value: 0 on success, non-zero otherwise. | 491 | * Return value: 0 on success, non-zero otherwise. |
492 | * | ||
480 | * The start offset of the handler's address region is determined by | 493 | * The start offset of the handler's address region is determined by |
481 | * fw_core_add_address_handler() and is returned in handler->offset. | 494 | * fw_core_add_address_handler() and is returned in handler->offset. |
495 | * | ||
496 | * Address allocations are exclusive, except for the FCP registers. | ||
482 | */ | 497 | */ |
483 | int fw_core_add_address_handler(struct fw_address_handler *handler, | 498 | int fw_core_add_address_handler(struct fw_address_handler *handler, |
484 | const struct fw_address_region *region) | 499 | const struct fw_address_region *region) |
@@ -498,10 +513,12 @@ int fw_core_add_address_handler(struct fw_address_handler *handler, | |||
498 | 513 | ||
499 | handler->offset = region->start; | 514 | handler->offset = region->start; |
500 | while (handler->offset + handler->length <= region->end) { | 515 | while (handler->offset + handler->length <= region->end) { |
501 | other = | 516 | if (is_in_fcp_region(handler->offset, handler->length)) |
502 | lookup_overlapping_address_handler(&address_handler_list, | 517 | other = NULL; |
503 | handler->offset, | 518 | else |
504 | handler->length); | 519 | other = lookup_overlapping_address_handler |
520 | (&address_handler_list, | ||
521 | handler->offset, handler->length); | ||
505 | if (other != NULL) { | 522 | if (other != NULL) { |
506 | handler->offset += other->length; | 523 | handler->offset += other->length; |
507 | } else { | 524 | } else { |
@@ -668,6 +685,9 @@ static struct fw_request *allocate_request(struct fw_packet *p) | |||
668 | void fw_send_response(struct fw_card *card, | 685 | void fw_send_response(struct fw_card *card, |
669 | struct fw_request *request, int rcode) | 686 | struct fw_request *request, int rcode) |
670 | { | 687 | { |
688 | if (WARN_ONCE(!request, "invalid for FCP address handlers")) | ||
689 | return; | ||
690 | |||
671 | /* unified transaction or broadcast transaction: don't respond */ | 691 | /* unified transaction or broadcast transaction: don't respond */ |
672 | if (request->ack != ACK_PENDING || | 692 | if (request->ack != ACK_PENDING || |
673 | HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) { | 693 | HEADER_DESTINATION_IS_BROADCAST(request->request_header[0])) { |
@@ -686,26 +706,15 @@ void fw_send_response(struct fw_card *card, | |||
686 | } | 706 | } |
687 | EXPORT_SYMBOL(fw_send_response); | 707 | EXPORT_SYMBOL(fw_send_response); |
688 | 708 | ||
689 | void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | 709 | static void handle_exclusive_region_request(struct fw_card *card, |
710 | struct fw_packet *p, | ||
711 | struct fw_request *request, | ||
712 | unsigned long long offset) | ||
690 | { | 713 | { |
691 | struct fw_address_handler *handler; | 714 | struct fw_address_handler *handler; |
692 | struct fw_request *request; | ||
693 | unsigned long long offset; | ||
694 | unsigned long flags; | 715 | unsigned long flags; |
695 | int tcode, destination, source; | 716 | int tcode, destination, source; |
696 | 717 | ||
697 | if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE) | ||
698 | return; | ||
699 | |||
700 | request = allocate_request(p); | ||
701 | if (request == NULL) { | ||
702 | /* FIXME: send statically allocated busy packet. */ | ||
703 | return; | ||
704 | } | ||
705 | |||
706 | offset = | ||
707 | ((unsigned long long) | ||
708 | HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) | p->header[2]; | ||
709 | tcode = HEADER_GET_TCODE(p->header[0]); | 718 | tcode = HEADER_GET_TCODE(p->header[0]); |
710 | destination = HEADER_GET_DESTINATION(p->header[0]); | 719 | destination = HEADER_GET_DESTINATION(p->header[0]); |
711 | source = HEADER_GET_SOURCE(p->header[1]); | 720 | source = HEADER_GET_SOURCE(p->header[1]); |
@@ -732,6 +741,73 @@ void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | |||
732 | request->data, request->length, | 741 | request->data, request->length, |
733 | handler->callback_data); | 742 | handler->callback_data); |
734 | } | 743 | } |
744 | |||
745 | static void handle_fcp_region_request(struct fw_card *card, | ||
746 | struct fw_packet *p, | ||
747 | struct fw_request *request, | ||
748 | unsigned long long offset) | ||
749 | { | ||
750 | struct fw_address_handler *handler; | ||
751 | unsigned long flags; | ||
752 | int tcode, destination, source; | ||
753 | |||
754 | if ((offset != (CSR_REGISTER_BASE | CSR_FCP_COMMAND) && | ||
755 | offset != (CSR_REGISTER_BASE | CSR_FCP_RESPONSE)) || | ||
756 | request->length > 0x200) { | ||
757 | fw_send_response(card, request, RCODE_ADDRESS_ERROR); | ||
758 | |||
759 | return; | ||
760 | } | ||
761 | |||
762 | tcode = HEADER_GET_TCODE(p->header[0]); | ||
763 | destination = HEADER_GET_DESTINATION(p->header[0]); | ||
764 | source = HEADER_GET_SOURCE(p->header[1]); | ||
765 | |||
766 | if (tcode != TCODE_WRITE_QUADLET_REQUEST && | ||
767 | tcode != TCODE_WRITE_BLOCK_REQUEST) { | ||
768 | fw_send_response(card, request, RCODE_TYPE_ERROR); | ||
769 | |||
770 | return; | ||
771 | } | ||
772 | |||
773 | spin_lock_irqsave(&address_handler_lock, flags); | ||
774 | list_for_each_entry(handler, &address_handler_list, link) { | ||
775 | if (is_enclosing_handler(handler, offset, request->length)) | ||
776 | handler->address_callback(card, NULL, tcode, | ||
777 | destination, source, | ||
778 | p->generation, p->speed, | ||
779 | offset, request->data, | ||
780 | request->length, | ||
781 | handler->callback_data); | ||
782 | } | ||
783 | spin_unlock_irqrestore(&address_handler_lock, flags); | ||
784 | |||
785 | fw_send_response(card, request, RCODE_COMPLETE); | ||
786 | } | ||
787 | |||
788 | void fw_core_handle_request(struct fw_card *card, struct fw_packet *p) | ||
789 | { | ||
790 | struct fw_request *request; | ||
791 | unsigned long long offset; | ||
792 | |||
793 | if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE) | ||
794 | return; | ||
795 | |||
796 | request = allocate_request(p); | ||
797 | if (request == NULL) { | ||
798 | /* FIXME: send statically allocated busy packet. */ | ||
799 | return; | ||
800 | } | ||
801 | |||
802 | offset = ((u64)HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) | | ||
803 | p->header[2]; | ||
804 | |||
805 | if (!is_in_fcp_region(offset, request->length)) | ||
806 | handle_exclusive_region_request(card, p, request, offset); | ||
807 | else | ||
808 | handle_fcp_region_request(card, p, request, offset); | ||
809 | |||
810 | } | ||
735 | EXPORT_SYMBOL(fw_core_handle_request); | 811 | EXPORT_SYMBOL(fw_core_handle_request); |
736 | 812 | ||
737 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) | 813 | void fw_core_handle_response(struct fw_card *card, struct fw_packet *p) |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 96768e160866..2345d4103fe6 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -2226,7 +2226,6 @@ static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base, | |||
2226 | if (rest == 0) | 2226 | if (rest == 0) |
2227 | return -EINVAL; | 2227 | return -EINVAL; |
2228 | 2228 | ||
2229 | /* FIXME: make packet-per-buffer/dual-buffer a context option */ | ||
2230 | while (rest > 0) { | 2229 | while (rest > 0) { |
2231 | d = context_get_descriptors(&ctx->context, | 2230 | d = context_get_descriptors(&ctx->context, |
2232 | z + header_z, &d_bus); | 2231 | z + header_z, &d_bus); |
@@ -2421,6 +2420,7 @@ static void ohci_pmac_off(struct pci_dev *dev) | |||
2421 | 2420 | ||
2422 | #define PCI_VENDOR_ID_AGERE PCI_VENDOR_ID_ATT | 2421 | #define PCI_VENDOR_ID_AGERE PCI_VENDOR_ID_ATT |
2423 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 | 2422 | #define PCI_DEVICE_ID_AGERE_FW643 0x5901 |
2423 | #define PCI_DEVICE_ID_TI_TSB43AB23 0x8024 | ||
2424 | 2424 | ||
2425 | static int __devinit pci_probe(struct pci_dev *dev, | 2425 | static int __devinit pci_probe(struct pci_dev *dev, |
2426 | const struct pci_device_id *ent) | 2426 | const struct pci_device_id *ent) |
@@ -2470,7 +2470,10 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2470 | } | 2470 | } |
2471 | 2471 | ||
2472 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; | 2472 | version = reg_read(ohci, OHCI1394_Version) & 0x00ff00ff; |
2473 | #if 0 | ||
2474 | /* FIXME: make it a context option or remove dual-buffer mode */ | ||
2473 | ohci->use_dualbuffer = version >= OHCI_VERSION_1_1; | 2475 | ohci->use_dualbuffer = version >= OHCI_VERSION_1_1; |
2476 | #endif | ||
2474 | 2477 | ||
2475 | /* dual-buffer mode is broken if more than one IR context is active */ | 2478 | /* dual-buffer mode is broken if more than one IR context is active */ |
2476 | if (dev->vendor == PCI_VENDOR_ID_AGERE && | 2479 | if (dev->vendor == PCI_VENDOR_ID_AGERE && |
@@ -2486,7 +2489,8 @@ static int __devinit pci_probe(struct pci_dev *dev, | |||
2486 | #if !defined(CONFIG_X86_32) | 2489 | #if !defined(CONFIG_X86_32) |
2487 | /* dual-buffer mode is broken with descriptor addresses above 2G */ | 2490 | /* dual-buffer mode is broken with descriptor addresses above 2G */ |
2488 | if (dev->vendor == PCI_VENDOR_ID_TI && | 2491 | if (dev->vendor == PCI_VENDOR_ID_TI && |
2489 | dev->device == PCI_DEVICE_ID_TI_TSB43AB22) | 2492 | (dev->device == PCI_DEVICE_ID_TI_TSB43AB22 || |
2493 | dev->device == PCI_DEVICE_ID_TI_TSB43AB23)) | ||
2490 | ohci->use_dualbuffer = false; | 2494 | ohci->use_dualbuffer = false; |
2491 | #endif | 2495 | #endif |
2492 | 2496 | ||