Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 172670
b: refs/heads/master
c: cb7c96d
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Oct 14, 2009
1 parent 3f4a7e7 commit 079e74f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 32 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: fe242579e9f33150868f1bb79c7e262ad7953f17
refs/heads/master: cb7c96da3651111efbe088fa12f9bed61836ea93
17 changes: 2 additions & 15 deletions trunk/drivers/firewire/core-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#include "core.h"

static int __compute_block_crc(__be32 *block)
int fw_compute_block_crc(__be32 *block)
{
int length;
u16 crc;
Expand All @@ -50,19 +50,6 @@ static int __compute_block_crc(__be32 *block)
return length;
}

int fw_compute_block_crc(u32 *block)
{
__be32 be32_block[256];
int i, length;

length = (*block >> 16) & 0xff;
for (i = 0; i < length; i++)
be32_block[i] = cpu_to_be32(block[i + 1]);
*block |= crc_itu_t(0, (u8 *) be32_block, length * 4);

return length;
}

static DEFINE_MUTEX(card_mutex);
static LIST_HEAD(card_list);

Expand Down Expand Up @@ -141,7 +128,7 @@ static size_t generate_config_rom(struct fw_card *card, __be32 *config_rom)
* the bus info block, which is always the case for this
* implementation. */
for (i = 0; i < j; i += length + 1)
length = __compute_block_crc(config_rom + i);
length = fw_compute_block_crc(config_rom + i);

return j;
}
Expand Down
17 changes: 10 additions & 7 deletions trunk/drivers/firewire/core-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>

#include <asm/atomic.h>
#include <asm/byteorder.h>
#include <asm/system.h>

#include "core.h"
Expand Down Expand Up @@ -510,13 +510,16 @@ static void update_tree(struct fw_card *card, struct fw_node *root)
static void update_topology_map(struct fw_card *card,
u32 *self_ids, int self_id_count)
{
int node_count;
int node_count = (card->root_node->node_id & 0x3f) + 1;
__be32 *map = card->topology_map;

*map++ = cpu_to_be32((self_id_count + 2) << 16);
*map++ = cpu_to_be32(be32_to_cpu(card->topology_map[1]) + 1);
*map++ = cpu_to_be32((node_count << 16) | self_id_count);

while (self_id_count--)
*map++ = cpu_to_be32p(self_ids++);

card->topology_map[1]++;
node_count = (card->root_node->node_id & 0x3f) + 1;
card->topology_map[2] = (node_count << 16) | self_id_count;
card->topology_map[0] = (self_id_count + 2) << 16;
memcpy(&card->topology_map[3], self_ids, self_id_count * 4);
fw_compute_block_crc(card->topology_map);
}

Expand Down
9 changes: 2 additions & 7 deletions trunk/drivers/firewire/core-transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,7 @@ static void handle_topology_map(struct fw_card *card, struct fw_request *request
int speed, unsigned long long offset,
void *payload, size_t length, void *callback_data)
{
int i, start, end;
__be32 *map;
int start;

if (!TCODE_IS_READ_REQUEST(tcode)) {
fw_send_response(card, request, RCODE_TYPE_ERROR);
Expand All @@ -824,11 +823,7 @@ static void handle_topology_map(struct fw_card *card, struct fw_request *request
}

start = (offset - topology_map_region.start) / 4;
end = start + length / 4;
map = payload;

for (i = 0; i < length / 4; i++)
map[i] = cpu_to_be32(card->topology_map[start + i]);
memcpy(payload, &card->topology_map[start], length);

fw_send_response(card, request, RCODE_COMPLETE);
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/firewire/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int fw_card_add(struct fw_card *card,
u32 max_receive, u32 link_speed, u64 guid);
void fw_core_remove_card(struct fw_card *card);
int fw_core_initiate_bus_reset(struct fw_card *card, int short_reset);
int fw_compute_block_crc(u32 *block);
int fw_compute_block_crc(__be32 *block);
void fw_schedule_bm_work(struct fw_card *card, unsigned long delay);

static inline struct fw_card *fw_card_get(struct fw_card *card)
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/firewire.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct fw_card {

bool broadcast_channel_allocated;
u32 broadcast_channel;
u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
__be32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
};

struct fw_attribute_group {
Expand Down

0 comments on commit 079e74f

Please sign in to comment.