aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-01-23 15:11:43 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-03-09 16:02:43 -0500
commit907293d78872ee492ce6a114258dd853ec5082ae (patch)
tree9384ac58621706b7d3846b34944fa5475f084502 /drivers/firewire
parent366f5f4fa31cd3f3d5901f5edfe255a48906505d (diff)
firewire: consistent usage of node_id
Definitions as per IEEE 1212 and IEEE 1394: Node ID: Concatenation of bus ID and local ID. 16 bits long. Bus ID: Identifies a particular bus within a group of buses interconnected by bus bridges. Local ID: Identifies a particular node on a bus. PHY ID: Local ID of IEEE 1394 nodes. 6 bits long. Never ever use a variable called node_id for anything else than a node ID. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-device-cdev.c2
-rw-r--r--drivers/firewire/fw-device.c4
-rw-r--r--drivers/firewire/fw-ohci.c21
-rw-r--r--drivers/firewire/fw-sbp2.c8
-rw-r--r--drivers/firewire/fw-topology.c2
-rw-r--r--drivers/firewire/fw-transaction.c6
6 files changed, 23 insertions, 20 deletions
diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c
index 5ffc58c6624c..1b9e5f7c0129 100644
--- a/drivers/firewire/fw-device-cdev.c
+++ b/drivers/firewire/fw-device-cdev.c
@@ -238,7 +238,7 @@ static ssize_t ioctl_send_request(struct client *client, void __user *arg)
238 238
239 fw_send_request(device->card, &response->transaction, 239 fw_send_request(device->card, &response->transaction,
240 request.tcode, 240 request.tcode,
241 device->node->node_id | LOCAL_BUS, 241 device->node->node_id,
242 device->card->generation, 242 device->card->generation,
243 device->node->max_speed, 243 device->node->max_speed,
244 request.offset, 244 request.offset,
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c
index f1b0e75fd91e..4fb5587252a9 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -257,7 +257,7 @@ static int read_rom(struct fw_device *device, int index, u32 * data)
257 257
258 offset = 0xfffff0000400ULL + index * 4; 258 offset = 0xfffff0000400ULL + index * 4;
259 fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST, 259 fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST,
260 device->node_id | LOCAL_BUS, 260 device->node_id,
261 device->generation, SCODE_100, 261 device->generation, SCODE_100,
262 offset, NULL, 4, complete_transaction, &callback_data); 262 offset, NULL, 4, complete_transaction, &callback_data);
263 263
@@ -447,7 +447,7 @@ static void fw_device_init(struct work_struct *work)
447 device->config_rom_retries++; 447 device->config_rom_retries++;
448 schedule_delayed_work(&device->work, RETRY_DELAY); 448 schedule_delayed_work(&device->work, RETRY_DELAY);
449 } else { 449 } else {
450 fw_notify("giving up on config rom for node id %d\n", 450 fw_notify("giving up on config rom for node id %x\n",
451 device->node_id); 451 device->node_id);
452 fw_device_release(&device->device); 452 fw_device_release(&device->device);
453 } 453 }
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c
index ba10203725c1..d6f0644b05d4 100644
--- a/drivers/firewire/fw-ohci.c
+++ b/drivers/firewire/fw-ohci.c
@@ -828,10 +828,10 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation)
828{ 828{
829 struct fw_ohci *ohci = fw_ohci(card); 829 struct fw_ohci *ohci = fw_ohci(card);
830 unsigned long flags; 830 unsigned long flags;
831 int retval = 0; 831 int n, retval = 0;
832 832
833 /* FIXME: make sure this bitmask is cleared when we clear the 833 /* FIXME: Make sure this bitmask is cleared when we clear the busReset
834 * busReset interrupt bit. */ 834 * interrupt bit. Clear physReqResourceAllBuses on bus reset. */
835 835
836 spin_lock_irqsave(&ohci->lock, flags); 836 spin_lock_irqsave(&ohci->lock, flags);
837 837
@@ -840,12 +840,15 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation)
840 goto out; 840 goto out;
841 } 841 }
842 842
843 if (node_id < 32) { 843 /* NOTE, if the node ID contains a non-local bus ID, physical DMA is
844 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << node_id); 844 * enabled for _all_ nodes on remote buses. */
845 } else { 845
846 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 846 n = (node_id & 0xffc0) == LOCAL_BUS ? node_id & 0x3f : 63;
847 1 << (node_id - 32)); 847 if (n < 32)
848 } 848 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << n);
849 else
850 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 1 << (n - 32));
851
849 flush_writes(ohci); 852 flush_writes(ohci);
850 out: 853 out:
851 spin_unlock_irqrestore(&ohci->lock, flags); 854 spin_unlock_irqrestore(&ohci->lock, flags);
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index f5c46822b7d8..4e42b73f1e3e 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -328,7 +328,7 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit,
328 spin_unlock_irqrestore(&device->card->lock, flags); 328 spin_unlock_irqrestore(&device->card->lock, flags);
329 329
330 fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST, 330 fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST,
331 node_id | LOCAL_BUS, generation, 331 node_id, generation,
332 device->node->max_speed, offset, 332 device->node->max_speed, offset,
333 &orb->pointer, sizeof orb->pointer, 333 &orb->pointer, sizeof orb->pointer,
334 complete_transaction, orb); 334 complete_transaction, orb);
@@ -485,7 +485,7 @@ static int sbp2_agent_reset(struct fw_unit *unit)
485 return -ENOMEM; 485 return -ENOMEM;
486 486
487 fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST, 487 fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST,
488 sd->node_id | LOCAL_BUS, sd->generation, SCODE_400, 488 sd->node_id, sd->generation, SCODE_400,
489 sd->command_block_agent_address + SBP2_AGENT_RESET, 489 sd->command_block_agent_address + SBP2_AGENT_RESET,
490 &zero, sizeof zero, complete_agent_reset_write, t); 490 &zero, sizeof zero, complete_agent_reset_write, t);
491 491
@@ -586,7 +586,7 @@ static int sbp2_probe(struct device *dev)
586 586
587 sd->generation = generation; 587 sd->generation = generation;
588 sd->node_id = node_id; 588 sd->node_id = node_id;
589 sd->address_high = (LOCAL_BUS | local_node_id) << 16; 589 sd->address_high = local_node_id << 16;
590 590
591 /* Get command block agent offset and login id. */ 591 /* Get command block agent offset and login id. */
592 sd->command_block_agent_address = 592 sd->command_block_agent_address =
@@ -663,7 +663,7 @@ static void sbp2_reconnect(struct work_struct *work)
663 663
664 sd->generation = generation; 664 sd->generation = generation;
665 sd->node_id = node_id; 665 sd->node_id = node_id;
666 sd->address_high = (LOCAL_BUS | local_node_id) << 16; 666 sd->address_high = local_node_id << 16;
667} 667}
668 668
669static void sbp2_update(struct fw_unit *unit) 669static void sbp2_update(struct fw_unit *unit)
diff --git a/drivers/firewire/fw-topology.c b/drivers/firewire/fw-topology.c
index 1938f36cfaa3..684d87d99775 100644
--- a/drivers/firewire/fw-topology.c
+++ b/drivers/firewire/fw-topology.c
@@ -102,7 +102,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color)
102 return NULL; 102 return NULL;
103 103
104 node->color = color; 104 node->color = color;
105 node->node_id = self_id_phy_id(sid); 105 node->node_id = LOCAL_BUS | self_id_phy_id(sid);
106 node->link_on = self_id_link_on(sid); 106 node->link_on = self_id_link_on(sid);
107 node->phy_speed = self_id_phy_speed(sid); 107 node->phy_speed = self_id_phy_speed(sid);
108 node->port_count = port_count; 108 node->port_count = port_count;
diff --git a/drivers/firewire/fw-transaction.c b/drivers/firewire/fw-transaction.c
index 4c1275f9a3b4..439a3e3ee2f0 100644
--- a/drivers/firewire/fw-transaction.c
+++ b/drivers/firewire/fw-transaction.c
@@ -56,7 +56,7 @@
56#define header_get_extended_tcode(q) (((q) >> 0) & 0xffff) 56#define header_get_extended_tcode(q) (((q) >> 0) & 0xffff)
57 57
58#define phy_config_gap_count(gap_count) (((gap_count) << 16) | (1 << 22)) 58#define phy_config_gap_count(gap_count) (((gap_count) << 16) | (1 << 22))
59#define phy_config_root_id(node_id) (((node_id) << 24) | (1 << 23)) 59#define phy_config_root_id(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23))
60#define phy_identifier(id) ((id) << 30) 60#define phy_identifier(id) ((id) << 30)
61 61
62static void 62static void
@@ -123,7 +123,7 @@ fw_fill_packet(struct fw_packet *packet, int tcode, int tlabel,
123 header_retry(RETRY_X) | 123 header_retry(RETRY_X) |
124 header_tlabel(tlabel) | 124 header_tlabel(tlabel) |
125 header_tcode(tcode) | 125 header_tcode(tcode) |
126 header_destination(node_id | LOCAL_BUS); 126 header_destination(node_id);
127 packet->header[1] = 127 packet->header[1] =
128 header_offset_high(offset >> 32) | header_source(0); 128 header_offset_high(offset >> 32) | header_source(0);
129 packet->header[2] = 129 packet->header[2] =
@@ -190,7 +190,7 @@ fw_fill_packet(struct fw_packet *packet, int tcode, int tlabel,
190 * @param tcode the tcode for this transaction. Do not use 190 * @param tcode the tcode for this transaction. Do not use
191 * TCODE_LOCK_REQUEST directly, insted use TCODE_LOCK_MASK_SWAP 191 * TCODE_LOCK_REQUEST directly, insted use TCODE_LOCK_MASK_SWAP
192 * etc. to specify tcode and ext_tcode. 192 * etc. to specify tcode and ext_tcode.
193 * @param node_id the node_id of the destination node 193 * @param node_id the destination node ID (bus ID and PHY ID concatenated)
194 * @param generation the generation for which node_id is valid 194 * @param generation the generation for which node_id is valid
195 * @param speed the speed to use for sending the request 195 * @param speed the speed to use for sending the request
196 * @param offset the 48 bit offset on the destination node 196 * @param offset the 48 bit offset on the destination node