Skip to content

Commit

Permalink
firewire: reread config ROM when device reset the bus
Browse files Browse the repository at this point in the history
When a device changes its configuration ROM, it announces this with a
bus reset.  firewire-core has to check which node initiated a bus reset
and whether any unit directories went away or were added on this node.

Tested with an IOI FWB-IDE01AB which has its link-on bit set if bus
power is available but does not respond to ROM read requests if self
power is off.  This implements
  - recognition of the units if self power is switched on after fw-core
    gave up the initial attempt to read the config ROM,
  - shutdown of the units when self power is switched off.

Also tested with a second PC running Linux/ieee1394.  When the eth1394
driver is inserted and removed on that node, fw-core now notices the
addition and removal of the IPv4 unit on the ieee1394 node.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
  • Loading branch information
Stefan Richter committed Apr 18, 2008
1 parent 1dadff7 commit c9755e1
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 47 deletions.
2 changes: 1 addition & 1 deletion drivers/firewire/fw-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ fw_card_bm_work(struct work_struct *work)
*/
spin_unlock_irqrestore(&card->lock, flags);
goto out;
} else if (root_device->config_rom[2] & BIB_CMC) {
} else if (root_device->cmc) {
/*
* FIXME: I suppose we should set the cmstr bit in the
* STATE_CLEAR register of this node, as described in
Expand Down
13 changes: 10 additions & 3 deletions drivers/firewire/fw-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,28 @@ static int ioctl_get_info(struct client *client, void *buffer)
{
struct fw_cdev_get_info *get_info = buffer;
struct fw_cdev_event_bus_reset bus_reset;
unsigned long ret = 0;

client->version = get_info->version;
get_info->version = FW_CDEV_VERSION;

down_read(&fw_device_rwsem);

if (get_info->rom != 0) {
void __user *uptr = u64_to_uptr(get_info->rom);
size_t want = get_info->rom_length;
size_t have = client->device->config_rom_length * 4;

if (copy_to_user(uptr, client->device->config_rom,
min(want, have)))
return -EFAULT;
ret = copy_to_user(uptr, client->device->config_rom,
min(want, have));
}
get_info->rom_length = client->device->config_rom_length * 4;

up_read(&fw_device_rwsem);

if (ret != 0)
return -EFAULT;

client->bus_reset_closure = get_info->bus_reset_closure;
if (get_info->bus_reset != 0) {
void __user *uptr = u64_to_uptr(get_info->bus_reset);
Expand Down
Loading

0 comments on commit c9755e1

Please sign in to comment.