Commit 907293d7 authored by Stefan Richter's avatar Stefan Richter

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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 366f5f4f
...@@ -238,7 +238,7 @@ static ssize_t ioctl_send_request(struct client *client, void __user *arg) ...@@ -238,7 +238,7 @@ static ssize_t ioctl_send_request(struct client *client, void __user *arg)
fw_send_request(device->card, &response->transaction, fw_send_request(device->card, &response->transaction,
request.tcode, request.tcode,
device->node->node_id | LOCAL_BUS, device->node->node_id,
device->card->generation, device->card->generation,
device->node->max_speed, device->node->max_speed,
request.offset, request.offset,
......
...@@ -257,7 +257,7 @@ static int read_rom(struct fw_device *device, int index, u32 * data) ...@@ -257,7 +257,7 @@ static int read_rom(struct fw_device *device, int index, u32 * data)
offset = 0xfffff0000400ULL + index * 4; offset = 0xfffff0000400ULL + index * 4;
fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST, fw_send_request(device->card, &t, TCODE_READ_QUADLET_REQUEST,
device->node_id | LOCAL_BUS, device->node_id,
device->generation, SCODE_100, device->generation, SCODE_100,
offset, NULL, 4, complete_transaction, &callback_data); offset, NULL, 4, complete_transaction, &callback_data);
...@@ -447,7 +447,7 @@ static void fw_device_init(struct work_struct *work) ...@@ -447,7 +447,7 @@ static void fw_device_init(struct work_struct *work)
device->config_rom_retries++; device->config_rom_retries++;
schedule_delayed_work(&device->work, RETRY_DELAY); schedule_delayed_work(&device->work, RETRY_DELAY);
} else { } else {
fw_notify("giving up on config rom for node id %d\n", fw_notify("giving up on config rom for node id %x\n",
device->node_id); device->node_id);
fw_device_release(&device->device); fw_device_release(&device->device);
} }
......
...@@ -828,10 +828,10 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation) ...@@ -828,10 +828,10 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation)
{ {
struct fw_ohci *ohci = fw_ohci(card); struct fw_ohci *ohci = fw_ohci(card);
unsigned long flags; unsigned long flags;
int retval = 0; int n, retval = 0;
/* FIXME: make sure this bitmask is cleared when we clear the /* FIXME: Make sure this bitmask is cleared when we clear the busReset
* busReset interrupt bit. */ * interrupt bit. Clear physReqResourceAllBuses on bus reset. */
spin_lock_irqsave(&ohci->lock, flags); spin_lock_irqsave(&ohci->lock, flags);
...@@ -840,12 +840,15 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation) ...@@ -840,12 +840,15 @@ ohci_enable_phys_dma(struct fw_card *card, int node_id, int generation)
goto out; goto out;
} }
if (node_id < 32) { /* NOTE, if the node ID contains a non-local bus ID, physical DMA is
reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << node_id); * enabled for _all_ nodes on remote buses. */
} else {
reg_write(ohci, OHCI1394_PhyReqFilterHiSet, n = (node_id & 0xffc0) == LOCAL_BUS ? node_id & 0x3f : 63;
1 << (node_id - 32)); if (n < 32)
} reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 1 << n);
else
reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 1 << (n - 32));
flush_writes(ohci); flush_writes(ohci);
out: out:
spin_unlock_irqrestore(&ohci->lock, flags); spin_unlock_irqrestore(&ohci->lock, flags);
......
...@@ -328,7 +328,7 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit, ...@@ -328,7 +328,7 @@ sbp2_send_orb(struct sbp2_orb *orb, struct fw_unit *unit,
spin_unlock_irqrestore(&device->card->lock, flags); spin_unlock_irqrestore(&device->card->lock, flags);
fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST, fw_send_request(device->card, &orb->t, TCODE_WRITE_BLOCK_REQUEST,
node_id | LOCAL_BUS, generation, node_id, generation,
device->node->max_speed, offset, device->node->max_speed, offset,
&orb->pointer, sizeof orb->pointer, &orb->pointer, sizeof orb->pointer,
complete_transaction, orb); complete_transaction, orb);
...@@ -485,7 +485,7 @@ static int sbp2_agent_reset(struct fw_unit *unit) ...@@ -485,7 +485,7 @@ static int sbp2_agent_reset(struct fw_unit *unit)
return -ENOMEM; return -ENOMEM;
fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST, fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST,
sd->node_id | LOCAL_BUS, sd->generation, SCODE_400, sd->node_id, sd->generation, SCODE_400,
sd->command_block_agent_address + SBP2_AGENT_RESET, sd->command_block_agent_address + SBP2_AGENT_RESET,
&zero, sizeof zero, complete_agent_reset_write, t); &zero, sizeof zero, complete_agent_reset_write, t);
...@@ -586,7 +586,7 @@ static int sbp2_probe(struct device *dev) ...@@ -586,7 +586,7 @@ static int sbp2_probe(struct device *dev)
sd->generation = generation; sd->generation = generation;
sd->node_id = node_id; sd->node_id = node_id;
sd->address_high = (LOCAL_BUS | local_node_id) << 16; sd->address_high = local_node_id << 16;
/* Get command block agent offset and login id. */ /* Get command block agent offset and login id. */
sd->command_block_agent_address = sd->command_block_agent_address =
...@@ -663,7 +663,7 @@ static void sbp2_reconnect(struct work_struct *work) ...@@ -663,7 +663,7 @@ static void sbp2_reconnect(struct work_struct *work)
sd->generation = generation; sd->generation = generation;
sd->node_id = node_id; sd->node_id = node_id;
sd->address_high = (LOCAL_BUS | local_node_id) << 16; sd->address_high = local_node_id << 16;
} }
static void sbp2_update(struct fw_unit *unit) static void sbp2_update(struct fw_unit *unit)
......
...@@ -102,7 +102,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color) ...@@ -102,7 +102,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color)
return NULL; return NULL;
node->color = color; node->color = color;
node->node_id = self_id_phy_id(sid); node->node_id = LOCAL_BUS | self_id_phy_id(sid);
node->link_on = self_id_link_on(sid); node->link_on = self_id_link_on(sid);
node->phy_speed = self_id_phy_speed(sid); node->phy_speed = self_id_phy_speed(sid);
node->port_count = port_count; node->port_count = port_count;
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#define header_get_extended_tcode(q) (((q) >> 0) & 0xffff) #define header_get_extended_tcode(q) (((q) >> 0) & 0xffff)
#define phy_config_gap_count(gap_count) (((gap_count) << 16) | (1 << 22)) #define phy_config_gap_count(gap_count) (((gap_count) << 16) | (1 << 22))
#define phy_config_root_id(node_id) (((node_id) << 24) | (1 << 23)) #define phy_config_root_id(node_id) ((((node_id) & 0x3f) << 24) | (1 << 23))
#define phy_identifier(id) ((id) << 30) #define phy_identifier(id) ((id) << 30)
static void static void
...@@ -123,7 +123,7 @@ fw_fill_packet(struct fw_packet *packet, int tcode, int tlabel, ...@@ -123,7 +123,7 @@ fw_fill_packet(struct fw_packet *packet, int tcode, int tlabel,
header_retry(RETRY_X) | header_retry(RETRY_X) |
header_tlabel(tlabel) | header_tlabel(tlabel) |
header_tcode(tcode) | header_tcode(tcode) |
header_destination(node_id | LOCAL_BUS); header_destination(node_id);
packet->header[1] = packet->header[1] =
header_offset_high(offset >> 32) | header_source(0); header_offset_high(offset >> 32) | header_source(0);
packet->header[2] = packet->header[2] =
...@@ -190,7 +190,7 @@ fw_fill_packet(struct fw_packet *packet, int tcode, int tlabel, ...@@ -190,7 +190,7 @@ fw_fill_packet(struct fw_packet *packet, int tcode, int tlabel,
* @param tcode the tcode for this transaction. Do not use * @param tcode the tcode for this transaction. Do not use
* TCODE_LOCK_REQUEST directly, insted use TCODE_LOCK_MASK_SWAP * TCODE_LOCK_REQUEST directly, insted use TCODE_LOCK_MASK_SWAP
* etc. to specify tcode and ext_tcode. * etc. to specify tcode and ext_tcode.
* @param node_id the node_id of the destination node * @param node_id the destination node ID (bus ID and PHY ID concatenated)
* @param generation the generation for which node_id is valid * @param generation the generation for which node_id is valid
* @param speed the speed to use for sending the request * @param speed the speed to use for sending the request
* @param offset the 48 bit offset on the destination node * @param offset the 48 bit offset on the destination node
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment