Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206836
b: refs/heads/master
c: 250b2b6
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Jul 8, 2010
1 parent bda9ca9 commit bbbbbc6
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae948011071c12ff6a328348859c717ea885ed40
refs/heads/master: 250b2b6dd421c9f8844a867d2ac06e0661e0ad93
12 changes: 9 additions & 3 deletions trunk/drivers/firewire/core-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ static void fw_card_bm_work(struct work_struct *work)
struct fw_card *card = container_of(work, struct fw_card, work.work);
struct fw_device *root_device;
struct fw_node *root_node;
int root_id, new_root_id, irm_id, local_id;
int root_id, new_root_id, irm_id, bm_id, local_id;
int gap_count, generation, grace, rcode;
bool do_reset = false;
bool root_device_is_running;
Expand Down Expand Up @@ -301,9 +301,15 @@ static void fw_card_bm_work(struct work_struct *work)
/* Another bus reset, BM work has been rescheduled. */
goto out;

if (rcode == RCODE_COMPLETE &&
card->bm_transaction_data[0] != cpu_to_be32(0x3f)) {
bm_id = be32_to_cpu(card->bm_transaction_data[0]);

spin_lock_irq(&card->lock);
if (rcode == RCODE_COMPLETE && generation == card->generation)
card->bm_node_id =
bm_id == 0x3f ? local_id : 0xffc0 | bm_id;
spin_unlock_irq(&card->lock);

if (rcode == RCODE_COMPLETE && bm_id != 0x3f) {
/* Somebody else is BM. Only act as IRM. */
if (local_id == irm_id)
allocate_broadcast_channel(card, generation);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/firewire/core-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static void fill_bus_reset_event(struct fw_cdev_event_bus_reset *event,
event->generation = client->device->generation;
event->node_id = client->device->node_id;
event->local_node_id = card->local_node->node_id;
event->bm_node_id = 0; /* FIXME: We don't track the BM. */
event->bm_node_id = card->bm_node_id;
event->irm_node_id = card->irm_node->node_id;
event->root_node_id = card->root_node->node_id;

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/firewire/core-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
smp_wmb();
card->generation = generation;
card->reset_jiffies = jiffies;
card->bm_node_id = 0xffff;
card->bm_abdicate = bm_abdicate;
fw_schedule_bm_work(card, 0);

Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/firewire-cdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ struct fw_cdev_event_common {
* This event is sent when the bus the device belongs to goes through a bus
* reset. It provides information about the new bus configuration, such as
* new node ID for this device, new root ID, and others.
*
* If @bm_node_id is 0xffff right after bus reset it can be reread by an
* %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished.
* Kernels with ABI version < 4 do not set @bm_node_id.
*/
struct fw_cdev_event_bus_reset {
__u64 closure;
Expand Down Expand Up @@ -348,6 +352,7 @@ union fw_cdev_event {
* 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable
* - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
* 4 (2.6.36) - added %FW_CDEV_EVENT_REQUEST2
* - implemented &fw_cdev_event_bus_reset.bm_node_id
*/
#define FW_CDEV_VERSION 3 /* Meaningless; don't use this macro. */

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/firewire.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct fw_card {
int bm_retries;
int bm_generation;
__be32 bm_transaction_data[2];
int bm_node_id;
bool bm_abdicate;

bool priority_budget_implemented; /* controller feature */
Expand Down

0 comments on commit bbbbbc6

Please sign in to comment.