Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58446
b: refs/heads/master
c: f139749
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Jul 9, 2007
1 parent c053b2a commit dabaa91
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 17 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: 24d40125f1f59a6de9d9e6e046676bd60532596c
refs/heads/master: f1397490017e337446c6a8b0562b584679a604a6
2 changes: 1 addition & 1 deletion trunk/drivers/firewire/fw-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ static int ioctl_send_request(struct client *client, void *buffer)
request->tcode & 0x1f,
device->node->node_id,
request->generation,
device->node->max_speed,
device->max_speed,
request->offset,
response->response.data, request->length,
complete_transaction, response);
Expand Down
38 changes: 34 additions & 4 deletions trunk/drivers/firewire/fw-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,7 @@ static int read_rom(struct fw_device *device, int index, u32 * data)

offset = 0xfffff0000400ULL + index * 4;
fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST,
device->node_id,
device->generation, SCODE_100,
device->node_id, device->generation, device->max_speed,
offset, NULL, 4, complete_transaction, &callback_data);

wait_for_completion(&callback_data.done);
Expand All @@ -418,6 +417,8 @@ static int read_bus_info_block(struct fw_device *device)
u32 stack[16], sp, key;
int i, end, length;

device->max_speed = SCODE_100;

/* First read the bus info block. */
for (i = 0; i < 5; i++) {
if (read_rom(device, i, &rom[i]) != RCODE_COMPLETE)
Expand All @@ -434,6 +435,33 @@ static int read_bus_info_block(struct fw_device *device)
return -1;
}

device->max_speed = device->node->max_speed;

/*
* Determine the speed of
* - devices with link speed less than PHY speed,
* - devices with 1394b PHY (unless only connected to 1394a PHYs),
* - all devices if there are 1394b repeaters.
* Note, we cannot use the bus info block's link_spd as starting point
* because some buggy firmwares set it lower than necessary and because
* 1394-1995 nodes do not have the field.
*/
if ((rom[2] & 0x7) < device->max_speed ||
device->max_speed == SCODE_BETA ||
device->card->beta_repeaters_present) {
u32 dummy;

/* for S1600 and S3200 */
if (device->max_speed == SCODE_BETA)
device->max_speed = device->card->link_speed;

while (device->max_speed > SCODE_100) {
if (read_rom(device, 0, &dummy) == RCODE_COMPLETE)
break;
device->max_speed--;
}
}

/*
* Now parse the config rom. The config rom is a recursive
* directory structure so we parse it using a stack of
Expand Down Expand Up @@ -680,8 +708,10 @@ static void fw_device_init(struct work_struct *work)
FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN)
fw_device_shutdown(&device->work.work);
else
fw_notify("created new fw device %s (%d config rom retries)\n",
device->device.bus_id, device->config_rom_retries);
fw_notify("created new fw device %s "
"(%d config rom retries, S%d00)\n",
device->device.bus_id, device->config_rom_retries,
1 << device->max_speed);

/*
* Reschedule the IRM work if we just finished reading the
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/firewire/fw-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct fw_device {
struct fw_node *node;
int node_id;
int generation;
unsigned max_speed;
struct fw_card *card;
struct device device;
struct list_head link;
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/firewire/fw-sbp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit,
spin_unlock_irqrestore(&device->card->lock, flags);

fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST,
node_id, generation,
device->node->max_speed, offset,
node_id, generation, device->max_speed, offset,
&orb->pointer, sizeof(orb->pointer),
complete_transaction, orb);
}
Expand Down Expand Up @@ -1018,8 +1017,8 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
* if we set this to max_speed + 7, we get the right value.
*/
orb->request.misc =
COMMAND_ORB_MAX_PAYLOAD(device->node->max_speed + 7) |
COMMAND_ORB_SPEED(device->node->max_speed) |
COMMAND_ORB_MAX_PAYLOAD(device->max_speed + 7) |
COMMAND_ORB_SPEED(device->max_speed) |
COMMAND_ORB_NOTIFY;

if (cmd->sc_data_direction == DMA_FROM_DEVICE)
Expand Down
13 changes: 6 additions & 7 deletions trunk/drivers/firewire/fw-topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,18 @@ enum {

struct fw_port {
struct fw_node *node;
unsigned speed : 3; /* S100, S200, ... S3200 */
};

struct fw_node {
u16 node_id;
u8 color;
u8 port_count;
unsigned link_on : 1;
unsigned initiated_reset : 1;
unsigned b_path : 1;
u8 phy_speed : 3; /* As in the self ID packet. */
u8 max_speed : 5; /* Minimum of all phy-speeds and port speeds on
* the path from the local node to this node. */
u8 link_on : 1;
u8 initiated_reset : 1;
u8 b_path : 1;
u8 phy_speed : 2; /* As in the self ID packet. */
u8 max_speed : 2; /* Minimum of all phy-speeds on the path from the
* local node to this node. */
u8 max_depth : 4; /* Maximum depth to any leaf node */
u8 max_hops : 4; /* Max hops in this sub tree */
atomic_t ref_count;
Expand Down

0 comments on commit dabaa91

Please sign in to comment.