Commit a77754a7 authored by Kristian Høgsberg's avatar Kristian Høgsberg Committed by Stefan Richter

firewire: Uppercase most macro names.

Signed-off-by: default avatarKristian Hoegsberg <krh@redhat.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent a98e2719
...@@ -44,20 +44,20 @@ static LIST_HEAD(card_list); ...@@ -44,20 +44,20 @@ static LIST_HEAD(card_list);
static LIST_HEAD(descriptor_list); static LIST_HEAD(descriptor_list);
static int descriptor_count; static int descriptor_count;
#define bib_crc(v) ((v) << 0) #define BIB_CRC(v) ((v) << 0)
#define bib_crc_length(v) ((v) << 16) #define BIB_CRC_LENGTH(v) ((v) << 16)
#define bib_info_length(v) ((v) << 24) #define BIB_INFO_LENGTH(v) ((v) << 24)
#define bib_link_speed(v) ((v) << 0) #define BIB_LINK_SPEED(v) ((v) << 0)
#define bib_generation(v) ((v) << 4) #define BIB_GENERATION(v) ((v) << 4)
#define bib_max_rom(v) ((v) << 8) #define BIB_MAX_ROM(v) ((v) << 8)
#define bib_max_receive(v) ((v) << 12) #define BIB_MAX_RECEIVE(v) ((v) << 12)
#define bib_cyc_clk_acc(v) ((v) << 16) #define BIB_CYC_CLK_ACC(v) ((v) << 16)
#define bib_pmc ((1) << 27) #define BIB_PMC ((1) << 27)
#define bib_bmc ((1) << 28) #define BIB_BMC ((1) << 28)
#define bib_isc ((1) << 29) #define BIB_ISC ((1) << 29)
#define bib_cmc ((1) << 30) #define BIB_CMC ((1) << 30)
#define bib_imc ((1) << 31) #define BIB_IMC ((1) << 31)
static u32 * static u32 *
generate_config_rom(struct fw_card *card, size_t *config_rom_length) generate_config_rom(struct fw_card *card, size_t *config_rom_length)
...@@ -76,15 +76,15 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length) ...@@ -76,15 +76,15 @@ generate_config_rom(struct fw_card *card, size_t *config_rom_length)
*/ */
memset(config_rom, 0, sizeof config_rom); memset(config_rom, 0, sizeof config_rom);
config_rom[0] = bib_crc_length(4) | bib_info_length(4) | bib_crc(0); config_rom[0] = BIB_CRC_LENGTH(4) | BIB_INFO_LENGTH(4) | BIB_CRC(0);
config_rom[1] = 0x31333934; config_rom[1] = 0x31333934;
config_rom[2] = config_rom[2] =
bib_link_speed(card->link_speed) | BIB_LINK_SPEED(card->link_speed) |
bib_generation(card->config_rom_generation++ % 14 + 2) | BIB_GENERATION(card->config_rom_generation++ % 14 + 2) |
bib_max_rom(2) | BIB_MAX_ROM(2) |
bib_max_receive(card->max_receive) | BIB_MAX_RECEIVE(card->max_receive) |
bib_bmc | bib_isc | bib_cmc | bib_imc; BIB_BMC | BIB_ISC | BIB_CMC | BIB_IMC;
config_rom[3] = card->guid >> 32; config_rom[3] = card->guid >> 32;
config_rom[4] = card->guid; config_rom[4] = card->guid;
...@@ -318,7 +318,7 @@ fw_card_bm_work(struct work_struct *work) ...@@ -318,7 +318,7 @@ fw_card_bm_work(struct work_struct *work)
*/ */
spin_unlock_irqrestore(&card->lock, flags); spin_unlock_irqrestore(&card->lock, flags);
return; return;
} else if (root->config_rom[2] & bib_cmc) { } else if (root->config_rom[2] & BIB_CMC) {
/* /*
* FIXME: I suppose we should set the cmstr bit in the * FIXME: I suppose we should set the cmstr bit in the
* STATE_CLEAR register of this node, as described in * STATE_CLEAR register of this node, as described in
......
This diff is collapsed.
...@@ -123,14 +123,14 @@ struct sbp2_device { ...@@ -123,14 +123,14 @@ struct sbp2_device {
#define SBP2_STATUS_ILLEGAL_REQUEST 0x2 #define SBP2_STATUS_ILLEGAL_REQUEST 0x2
#define SBP2_STATUS_VENDOR_DEPENDENT 0x3 #define SBP2_STATUS_VENDOR_DEPENDENT 0x3
#define status_get_orb_high(v) ((v).status & 0xffff) #define STATUS_GET_ORB_HIGH(v) ((v).status & 0xffff)
#define status_get_sbp_status(v) (((v).status >> 16) & 0xff) #define STATUS_GET_SBP_STATUS(v) (((v).status >> 16) & 0xff)
#define status_get_len(v) (((v).status >> 24) & 0x07) #define STATUS_GET_LEN(v) (((v).status >> 24) & 0x07)
#define status_get_dead(v) (((v).status >> 27) & 0x01) #define STATUS_GET_DEAD(v) (((v).status >> 27) & 0x01)
#define status_get_response(v) (((v).status >> 28) & 0x03) #define STATUS_GET_RESPONSE(v) (((v).status >> 28) & 0x03)
#define status_get_source(v) (((v).status >> 30) & 0x03) #define STATUS_GET_SOURCE(v) (((v).status >> 30) & 0x03)
#define status_get_orb_low(v) ((v).orb_low) #define STATUS_GET_ORB_LOW(v) ((v).orb_low)
#define status_get_data(v) ((v).data) #define STATUS_GET_DATA(v) ((v).data)
struct sbp2_status { struct sbp2_status {
u32 status; u32 status;
...@@ -152,15 +152,15 @@ struct sbp2_orb { ...@@ -152,15 +152,15 @@ struct sbp2_orb {
struct list_head link; struct list_head link;
}; };
#define management_orb_lun(v) ((v)) #define MANAGEMENT_ORB_LUN(v) ((v))
#define management_orb_function(v) ((v) << 16) #define MANAGEMENT_ORB_FUNCTION(v) ((v) << 16)
#define management_orb_reconnect(v) ((v) << 20) #define MANAGEMENT_ORB_RECONNECT(v) ((v) << 20)
#define management_orb_exclusive ((1) << 28) #define MANAGEMENT_ORB_EXCLUSIVE ((1) << 28)
#define management_orb_request_format(v) ((v) << 29) #define MANAGEMENT_ORB_REQUEST_FORMAT(v) ((v) << 29)
#define management_orb_notify ((1) << 31) #define MANAGEMENT_ORB_NOTIFY ((1) << 31)
#define management_orb_response_length(v) ((v)) #define MANAGEMENT_ORB_RESPONSE_LENGTH(v) ((v))
#define management_orb_password_length(v) ((v) << 16) #define MANAGEMENT_ORB_PASSWORD_LENGTH(v) ((v) << 16)
struct sbp2_management_orb { struct sbp2_management_orb {
struct sbp2_orb base; struct sbp2_orb base;
...@@ -177,23 +177,22 @@ struct sbp2_management_orb { ...@@ -177,23 +177,22 @@ struct sbp2_management_orb {
struct sbp2_status status; struct sbp2_status status;
}; };
#define login_response_get_login_id(v) ((v).misc & 0xffff) #define LOGIN_RESPONSE_GET_LOGIN_ID(v) ((v).misc & 0xffff)
#define login_response_get_length(v) (((v).misc >> 16) & 0xffff) #define LOGIN_RESPONSE_GET_LENGTH(v) (((v).misc >> 16) & 0xffff)
struct sbp2_login_response { struct sbp2_login_response {
u32 misc; u32 misc;
struct sbp2_pointer command_block_agent; struct sbp2_pointer command_block_agent;
u32 reconnect_hold; u32 reconnect_hold;
}; };
#define COMMAND_ORB_DATA_SIZE(v) ((v))
#define command_orb_data_size(v) ((v)) #define COMMAND_ORB_PAGE_SIZE(v) ((v) << 16)
#define command_orb_page_size(v) ((v) << 16) #define COMMAND_ORB_PAGE_TABLE_PRESENT ((1) << 19)
#define command_orb_page_table_present ((1) << 19) #define COMMAND_ORB_MAX_PAYLOAD(v) ((v) << 20)
#define command_orb_max_payload(v) ((v) << 20) #define COMMAND_ORB_SPEED(v) ((v) << 24)
#define command_orb_speed(v) ((v) << 24) #define COMMAND_ORB_DIRECTION(v) ((v) << 27)
#define command_orb_direction(v) ((v) << 27) #define COMMAND_ORB_REQUEST_FORMAT(v) ((v) << 29)
#define command_orb_request_format(v) ((v) << 29) #define COMMAND_ORB_NOTIFY ((1) << 31)
#define command_orb_notify ((1) << 31)
struct sbp2_command_orb { struct sbp2_command_orb {
struct sbp2_orb base; struct sbp2_orb base;
...@@ -290,7 +289,7 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request, ...@@ -290,7 +289,7 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request,
fw_memcpy_from_be32(&status, payload, header_size); fw_memcpy_from_be32(&status, payload, header_size);
if (length > header_size) if (length > header_size)
memcpy(status.data, payload + 8, length - header_size); memcpy(status.data, payload + 8, length - header_size);
if (status_get_source(status) == 2 || status_get_source(status) == 3) { if (STATUS_GET_SOURCE(status) == 2 || STATUS_GET_SOURCE(status) == 3) {
fw_notify("non-orb related status write, not handled\n"); fw_notify("non-orb related status write, not handled\n");
fw_send_response(card, request, RCODE_COMPLETE); fw_send_response(card, request, RCODE_COMPLETE);
return; return;
...@@ -299,8 +298,8 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request, ...@@ -299,8 +298,8 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request,
/* Lookup the orb corresponding to this status write. */ /* Lookup the orb corresponding to this status write. */
spin_lock_irqsave(&card->lock, flags); spin_lock_irqsave(&card->lock, flags);
list_for_each_entry(orb, &sd->orb_list, link) { list_for_each_entry(orb, &sd->orb_list, link) {
if (status_get_orb_high(status) == 0 && if (STATUS_GET_ORB_HIGH(status) == 0 &&
status_get_orb_low(status) == orb->request_bus && STATUS_GET_ORB_LOW(status) == orb->request_bus &&
orb->rcode == RCODE_COMPLETE) { orb->rcode == RCODE_COMPLETE) {
list_del(&orb->link); list_del(&orb->link);
break; break;
...@@ -425,11 +424,11 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation, ...@@ -425,11 +424,11 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
orb->request.response.low = orb->response_bus; orb->request.response.low = orb->response_bus;
orb->request.misc = orb->request.misc =
management_orb_notify | MANAGEMENT_ORB_NOTIFY |
management_orb_function(function) | MANAGEMENT_ORB_FUNCTION(function) |
management_orb_lun(lun); MANAGEMENT_ORB_LUN(lun);
orb->request.length = orb->request.length =
management_orb_response_length(sizeof orb->response); MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof orb->response);
orb->request.status_fifo.high = sd->address_handler.offset >> 32; orb->request.status_fifo.high = sd->address_handler.offset >> 32;
orb->request.status_fifo.low = sd->address_handler.offset; orb->request.status_fifo.low = sd->address_handler.offset;
...@@ -441,8 +440,8 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation, ...@@ -441,8 +440,8 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
*/ */
if (function == SBP2_LOGIN_REQUEST) { if (function == SBP2_LOGIN_REQUEST) {
orb->request.misc |= orb->request.misc |=
management_orb_exclusive | MANAGEMENT_ORB_EXCLUSIVE |
management_orb_reconnect(0); MANAGEMENT_ORB_RECONNECT(0);
} }
fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request); fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request);
...@@ -469,11 +468,11 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation, ...@@ -469,11 +468,11 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation,
goto out; goto out;
} }
if (status_get_response(orb->status) != 0 || if (STATUS_GET_RESPONSE(orb->status) != 0 ||
status_get_sbp_status(orb->status) != 0) { STATUS_GET_SBP_STATUS(orb->status) != 0) {
fw_error("error status: %d:%d\n", fw_error("error status: %d:%d\n",
status_get_response(orb->status), STATUS_GET_RESPONSE(orb->status),
status_get_sbp_status(orb->status)); STATUS_GET_SBP_STATUS(orb->status));
goto out; goto out;
} }
...@@ -577,7 +576,7 @@ static void sbp2_login(struct work_struct *work) ...@@ -577,7 +576,7 @@ static void sbp2_login(struct work_struct *work)
sd->command_block_agent_address = sd->command_block_agent_address =
((u64) (response.command_block_agent.high & 0xffff) << 32) | ((u64) (response.command_block_agent.high & 0xffff) << 32) |
response.command_block_agent.low; response.command_block_agent.low;
sd->login_id = login_response_get_login_id(response); sd->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response);
fw_notify("logged in to sbp2 unit %s (%d retries)\n", fw_notify("logged in to sbp2 unit %s (%d retries)\n",
unit->device.bus_id, sd->retries); unit->device.bus_id, sd->retries);
...@@ -828,10 +827,10 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) ...@@ -828,10 +827,10 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
int result; int result;
if (status != NULL) { if (status != NULL) {
if (status_get_dead(*status)) if (STATUS_GET_DEAD(*status))
sbp2_agent_reset(unit); sbp2_agent_reset(unit);
switch (status_get_response(*status)) { switch (STATUS_GET_RESPONSE(*status)) {
case SBP2_STATUS_REQUEST_COMPLETE: case SBP2_STATUS_REQUEST_COMPLETE:
result = DID_OK << 16; result = DID_OK << 16;
break; break;
...@@ -845,8 +844,8 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) ...@@ -845,8 +844,8 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status)
break; break;
} }
if (result == DID_OK << 16 && status_get_len(*status) > 1) if (result == DID_OK << 16 && STATUS_GET_LEN(*status) > 1)
result = sbp2_status_to_sense_data(status_get_data(*status), result = sbp2_status_to_sense_data(STATUS_GET_DATA(*status),
orb->cmd->sense_buffer); orb->cmd->sense_buffer);
} else { } else {
/* /*
...@@ -906,7 +905,7 @@ static void sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb) ...@@ -906,7 +905,7 @@ static void sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb)
orb->request.data_descriptor.high = sd->address_high; orb->request.data_descriptor.high = sd->address_high;
orb->request.data_descriptor.low = sg_dma_address(sg); orb->request.data_descriptor.low = sg_dma_address(sg);
orb->request.misc |= orb->request.misc |=
command_orb_data_size(sg_dma_len(sg)); COMMAND_ORB_DATA_SIZE(sg_dma_len(sg));
return; return;
} }
...@@ -943,8 +942,8 @@ static void sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb) ...@@ -943,8 +942,8 @@ static void sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb)
orb->request.data_descriptor.high = sd->address_high; orb->request.data_descriptor.high = sd->address_high;
orb->request.data_descriptor.low = orb->page_table_bus; orb->request.data_descriptor.low = orb->page_table_bus;
orb->request.misc |= orb->request.misc |=
command_orb_page_table_present | COMMAND_ORB_PAGE_TABLE_PRESENT |
command_orb_data_size(j); COMMAND_ORB_DATA_SIZE(j);
fw_memcpy_to_be32(orb->page_table, orb->page_table, size); fw_memcpy_to_be32(orb->page_table, orb->page_table, size);
} }
...@@ -969,7 +968,7 @@ static void sbp2_command_orb_map_buffer(struct sbp2_command_orb *orb) ...@@ -969,7 +968,7 @@ static void sbp2_command_orb_map_buffer(struct sbp2_command_orb *orb)
orb->request.data_descriptor.high = sd->address_high; orb->request.data_descriptor.high = sd->address_high;
orb->request.data_descriptor.low = orb->request_buffer_bus; orb->request.data_descriptor.low = orb->request_buffer_bus;
orb->request.misc |= orb->request.misc |=
command_orb_data_size(orb->cmd->request_bufflen); COMMAND_ORB_DATA_SIZE(orb->cmd->request_bufflen);
} }
/* SCSI stack integration */ /* SCSI stack integration */
...@@ -1017,16 +1016,16 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) ...@@ -1017,16 +1016,16 @@ 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. * if we set this to max_speed + 7, we get the right value.
*/ */
orb->request.misc = orb->request.misc =
command_orb_max_payload(device->node->max_speed + 7) | COMMAND_ORB_MAX_PAYLOAD(device->node->max_speed + 7) |
command_orb_speed(device->node->max_speed) | COMMAND_ORB_SPEED(device->node->max_speed) |
command_orb_notify; COMMAND_ORB_NOTIFY;
if (cmd->sc_data_direction == DMA_FROM_DEVICE) if (cmd->sc_data_direction == DMA_FROM_DEVICE)
orb->request.misc |= orb->request.misc |=
command_orb_direction(SBP2_DIRECTION_FROM_MEDIA); COMMAND_ORB_DIRECTION(SBP2_DIRECTION_FROM_MEDIA);
else if (cmd->sc_data_direction == DMA_TO_DEVICE) else if (cmd->sc_data_direction == DMA_TO_DEVICE)
orb->request.misc |= orb->request.misc |=
command_orb_direction(SBP2_DIRECTION_TO_MEDIA); COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA);
if (cmd->use_sg) { if (cmd->use_sg) {
sbp2_command_orb_map_scatterlist(orb); sbp2_command_orb_map_scatterlist(orb);
......
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
#include "fw-transaction.h" #include "fw-transaction.h"
#include "fw-topology.h" #include "fw-topology.h"
#define self_id_phy_id(q) (((q) >> 24) & 0x3f) #define SELF_ID_PHY_ID(q) (((q) >> 24) & 0x3f)
#define self_id_extended(q) (((q) >> 23) & 0x01) #define SELF_ID_EXTENDED(q) (((q) >> 23) & 0x01)
#define self_id_link_on(q) (((q) >> 22) & 0x01) #define SELF_ID_LINK_ON(q) (((q) >> 22) & 0x01)
#define self_id_gap_count(q) (((q) >> 16) & 0x3f) #define SELF_ID_GAP_COUNT(q) (((q) >> 16) & 0x3f)
#define self_id_phy_speed(q) (((q) >> 14) & 0x03) #define SELF_ID_PHY_SPEED(q) (((q) >> 14) & 0x03)
#define self_id_contender(q) (((q) >> 11) & 0x01) #define SELF_ID_CONTENDER(q) (((q) >> 11) & 0x01)
#define self_id_phy_initiator(q) (((q) >> 1) & 0x01) #define SELF_ID_PHY_INITIATOR(q) (((q) >> 1) & 0x01)
#define self_id_more_packets(q) (((q) >> 0) & 0x01) #define SELF_ID_MORE_PACKETS(q) (((q) >> 0) & 0x01)
#define self_id_ext_sequence(q) (((q) >> 20) & 0x07) #define SELF_ID_EXT_SEQUENCE(q) (((q) >> 20) & 0x07)
static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count) static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count)
{ {
...@@ -61,7 +61,7 @@ static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count) ...@@ -61,7 +61,7 @@ static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count)
shift -= 2; shift -= 2;
if (shift == 0) { if (shift == 0) {
if (!self_id_more_packets(q)) if (!SELF_ID_MORE_PACKETS(q))
return sid + 1; return sid + 1;
shift = 16; shift = 16;
...@@ -75,8 +75,8 @@ static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count) ...@@ -75,8 +75,8 @@ static u32 *count_ports(u32 *sid, int *total_port_count, int *child_port_count)
* packets increase as expected. * packets increase as expected.
*/ */
if (!self_id_extended(q) || if (!SELF_ID_EXTENDED(q) ||
seq != self_id_ext_sequence(q)) seq != SELF_ID_EXT_SEQUENCE(q))
return NULL; return NULL;
seq++; seq++;
...@@ -103,9 +103,9 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color) ...@@ -103,9 +103,9 @@ 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 = LOCAL_BUS | 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;
atomic_set(&node->ref_count, 1); atomic_set(&node->ref_count, 1);
...@@ -181,7 +181,7 @@ static struct fw_node *build_tree(struct fw_card *card, ...@@ -181,7 +181,7 @@ static struct fw_node *build_tree(struct fw_card *card,
end = sid + self_id_count; end = sid + self_id_count;
phy_id = 0; phy_id = 0;
irm_node = NULL; irm_node = NULL;
gap_count = self_id_gap_count(*sid); gap_count = SELF_ID_GAP_COUNT(*sid);
topology_type = 0; topology_type = 0;
while (sid < end) { while (sid < end) {
...@@ -193,9 +193,9 @@ static struct fw_node *build_tree(struct fw_card *card, ...@@ -193,9 +193,9 @@ static struct fw_node *build_tree(struct fw_card *card,
} }
q = *sid; q = *sid;
if (phy_id != self_id_phy_id(q)) { if (phy_id != SELF_ID_PHY_ID(q)) {
fw_error("PHY ID mismatch in self ID: %d != %d.\n", fw_error("PHY ID mismatch in self ID: %d != %d.\n",
phy_id, self_id_phy_id(q)); phy_id, SELF_ID_PHY_ID(q));
return NULL; return NULL;
} }
...@@ -221,7 +221,7 @@ static struct fw_node *build_tree(struct fw_card *card, ...@@ -221,7 +221,7 @@ static struct fw_node *build_tree(struct fw_card *card,
if (phy_id == (card->node_id & 0x3f)) if (phy_id == (card->node_id & 0x3f))
local_node = node; local_node = node;
if (self_id_contender(q)) if (SELF_ID_CONTENDER(q))
irm_node = node; irm_node = node;
if (node->phy_speed == SCODE_BETA) if (node->phy_speed == SCODE_BETA)
...@@ -283,7 +283,7 @@ static struct fw_node *build_tree(struct fw_card *card, ...@@ -283,7 +283,7 @@ static struct fw_node *build_tree(struct fw_card *card,
* setting, we fall back to 63 which will force a gap * setting, we fall back to 63 which will force a gap
* count reconfiguration and a reset. * count reconfiguration and a reset.
*/ */
if (self_id_gap_count(q) != gap_count) if (SELF_ID_GAP_COUNT(q) != gap_count)
gap_count = 63; gap_count = 63;
update_hop_count(node); update_hop_count(node);
......
...@@ -34,29 +34,29 @@ ...@@ -34,29 +34,29 @@
#include "fw-topology.h" #include "fw-topology.h"
#include "fw-device.h" #include "fw-device.h"
#define header_pri(pri) ((pri) << 0) #define HEADER_PRI(pri) ((pri) << 0)
#define header_tcode(tcode) ((tcode) << 4) #define HEADER_TCODE(tcode) ((tcode) << 4)
#define header_retry(retry) ((retry) << 8) #define HEADER_RETRY(retry) ((retry) << 8)
#define header_tlabel(tlabel) ((tlabel) << 10) #define HEADER_TLABEL(tlabel) ((tlabel) << 10)
#define header_destination(destination) ((destination) << 16) #define HEADER_DESTINATION(destination) ((destination) << 16)
#define header_source(source) ((source) << 16) #define HEADER_SOURCE(source) ((source) << 16)
#define header_rcode(rcode) ((rcode) << 12) #define HEADER_RCODE(rcode) ((rcode) << 12)
#define header_offset_high(offset_high) ((offset_high) << 0) #define HEADER_OFFSET_HIGH(offset_high) ((offset_high) << 0)
#define header_data_length(length) ((length) << 16) #define HEADER_DATA_LENGTH(length) ((length) << 16)
#define header_extended_tcode(tcode) ((tcode) << 0) #define HEADER_EXTENDED_TCODE(tcode) ((tcode) << 0)
#define header_get_tcode(q) (((q) >> 4) & 0x0f) #define HEADER_GET_TCODE(q) (((q) >> 4) & 0x0f)
#define header_get_tlabel(q) (((q) >> 10) & 0x3f) #define HEADER_GET_TLABEL(q) (((q) >> 10) & 0x3f)
#define header_get_rcode(q) (((q) >> 12) & 0x0f) #define HEADER_GET_RCODE(q) (((q) >> 12) & 0x0f)
#define header_get_destination(q) (((q) >> 16) & 0xffff) #define HEADER_GET_DESTINATION(q) (((q) >> 16) & 0xffff)
#define header_get_source(q) (((q) >> 16) & 0xffff) #define HEADER_GET_SOURCE(q) (((q) >> 16) & 0xffff)
#define header_get_offset_high(q) (((q) >> 0) & 0xffff) #define HEADER_GET_OFFSET_HIGH(q) (((q) >> 0) & 0xffff)
#define header_get_data_length(q) (((q) >> 16) & 0xffff) #define HEADER_GET_DATA_LENGTH(q) (((q) >> 16) & 0xffff)
#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) & 0x3f) << 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 int static int
close_transaction(struct fw_transaction *transaction, close_transaction(struct fw_transaction *transaction,
...@@ -159,12 +159,12 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel, ...@@ -159,12 +159,12 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
ext_tcode = 0; ext_tcode = 0;
packet->header[0] = packet->header[0] =
header_retry(RETRY_X) | HEADER_RETRY(RETRY_X) |
header_tlabel(tlabel) | HEADER_TLABEL(tlabel) |
header_tcode(tcode) | HEADER_TCODE(tcode) |
header_destination(node_id); HEADER_DESTINATION(node_id);
packet->header[1] = packet->header[1] =
header_offset_high(offset >> 32) | header_source(source_id); HEADER_OFFSET_HIGH(offset >> 32) | HEADER_SOURCE(source_id);
packet->header[2] = packet->header[2] =
offset; offset;
...@@ -178,8 +178,8 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel, ...@@ -178,8 +178,8 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
case TCODE_LOCK_REQUEST: case TCODE_LOCK_REQUEST:
case TCODE_WRITE_BLOCK_REQUEST: case TCODE_WRITE_BLOCK_REQUEST:
packet->header[3] = packet->header[3] =
header_data_length(length) | HEADER_DATA_LENGTH(length) |
header_extended_tcode(ext_tcode); HEADER_EXTENDED_TCODE(ext_tcode);
packet->header_length = 16; packet->header_length = 16;
packet->payload = payload; packet->payload = payload;
packet->payload_length = length; packet->payload_length = length;
...@@ -192,8 +192,8 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel, ...@@ -192,8 +192,8 @@ fw_fill_request(struct fw_packet *packet, int tcode, int tlabel,
case TCODE_READ_BLOCK_REQUEST: case TCODE_READ_BLOCK_REQUEST:
packet->header[3] = packet->header[3] =
header_data_length(length) | HEADER_DATA_LENGTH(length) |
header_extended_tcode(ext_tcode); HEADER_EXTENDED_TCODE(ext_tcode);
packet->header_length = 16; packet->header_length = 16;
packet->payload_length = 0; packet->payload_length = 0;
break; break;
...@@ -325,9 +325,9 @@ void fw_send_phy_config(struct fw_card *card, ...@@ -325,9 +325,9 @@ void fw_send_phy_config(struct fw_card *card,
{ {
u32 q; u32 q;
q = phy_identifier(PHY_PACKET_CONFIG) | q = PHY_IDENTIFIER(PHY_PACKET_CONFIG) |
phy_config_root_id(node_id) | PHY_CONFIG_ROOT_ID(node_id) |
phy_config_gap_count(gap_count); PHY_CONFIG_GAP_COUNT(gap_count);
send_phy_packet(card, q, generation); send_phy_packet(card, q, generation);
} }
...@@ -485,32 +485,32 @@ fw_fill_response(struct fw_packet *response, u32 *request_header, ...@@ -485,32 +485,32 @@ fw_fill_response(struct fw_packet *response, u32 *request_header,
{ {
int tcode, tlabel, extended_tcode, source, destination; int tcode, tlabel, extended_tcode, source, destination;
tcode = header_get_tcode(request_header[0]); tcode = HEADER_GET_TCODE(request_header[0]);
tlabel = header_get_tlabel(request_header[0]); tlabel = HEADER_GET_TLABEL(request_header[0]);
source = header_get_destination(request_header[0]); source = HEADER_GET_DESTINATION(request_header[0]);
destination = header_get_source(request_header[1]); destination = HEADER_GET_SOURCE(request_header[1]);
extended_tcode = header_get_extended_tcode(request_header[3]); extended_tcode = HEADER_GET_EXTENDED_TCODE(request_header[3]);
response->header[0] = response->header[0] =
header_retry(RETRY_1) | HEADER_RETRY(RETRY_1) |
header_tlabel(tlabel) | HEADER_TLABEL(tlabel) |
header_destination(destination); HEADER_DESTINATION(destination);
response->header[1] = response->header[1] =
header_source(source) | HEADER_SOURCE(source) |
header_rcode(rcode); HEADER_RCODE(rcode);
response->header[2] = 0; response->header[2] = 0;
switch (tcode) { switch (tcode) {
case TCODE_WRITE_QUADLET_REQUEST: case TCODE_WRITE_QUADLET_REQUEST:
case TCODE_WRITE_BLOCK_REQUEST: case TCODE_WRITE_BLOCK_REQUEST:
response->header[0] |= header_tcode(TCODE_WRITE_RESPONSE); response->header[0] |= HEADER_TCODE(TCODE_WRITE_RESPONSE);
response->header_length = 12; response->header_length = 12;
response->payload_length = 0; response->payload_length = 0;
break; break;
case TCODE_READ_QUADLET_REQUEST: case TCODE_READ_QUADLET_REQUEST:
response->header[0] |= response->header[0] |=
header_tcode(TCODE_READ_QUADLET_RESPONSE); HEADER_TCODE(TCODE_READ_QUADLET_RESPONSE);
if (payload != NULL) if (payload != NULL)
response->header[3] = *(u32 *)payload; response->header[3] = *(u32 *)payload;
else else
...@@ -521,10 +521,10 @@ fw_fill_response(struct fw_packet *response, u32 *request_header, ...@@ -521,10 +521,10 @@ fw_fill_response(struct fw_packet *response, u32 *request_header,
case TCODE_READ_BLOCK_REQUEST: case TCODE_READ_BLOCK_REQUEST:
case TCODE_LOCK_REQUEST: case TCODE_LOCK_REQUEST:
response->header[0] |= header_tcode(tcode + 2); response->header[0] |= HEADER_TCODE(tcode + 2);
response->header[3] = response->header[3] =
header_data_length(length) | HEADER_DATA_LENGTH(length) |
header_extended_tcode(extended_tcode); HEADER_EXTENDED_TCODE(extended_tcode);
response->header_length = 16; response->header_length = 16;
response->payload = payload; response->payload = payload;
response->payload_length = length; response->payload_length = length;
...@@ -544,7 +544,7 @@ allocate_request(struct fw_packet *p) ...@@ -544,7 +544,7 @@ allocate_request(struct fw_packet *p)
u32 *data, length; u32 *data, length;
int request_tcode, t; int request_tcode, t;
request_tcode = header_get_tcode(p->header[0]); request_tcode = HEADER_GET_TCODE(p->header[0]);
switch (request_tcode) { switch (request_tcode) {
case TCODE_WRITE_QUADLET_REQUEST: case TCODE_WRITE_QUADLET_REQUEST:
data = &p->header[3]; data = &p->header[3];
...@@ -554,7 +554,7 @@ allocate_request(struct fw_packet *p) ...@@ -554,7 +554,7 @@ allocate_request(struct fw_packet *p)
case TCODE_WRITE_BLOCK_REQUEST: case TCODE_WRITE_BLOCK_REQUEST:
case TCODE_LOCK_REQUEST: case TCODE_LOCK_REQUEST:
data = p->payload; data = p->payload;
length = header_get_data_length(p->header[3]); length = HEADER_GET_DATA_LENGTH(p->header[3]);
break; break;
case TCODE_READ_QUADLET_REQUEST: case TCODE_READ_QUADLET_REQUEST:
...@@ -564,7 +564,7 @@ allocate_request(struct fw_packet *p) ...@@ -564,7 +564,7 @@ allocate_request(struct fw_packet *p)
case TCODE_READ_BLOCK_REQUEST: case TCODE_READ_BLOCK_REQUEST:
data = NULL; data = NULL;
length = header_get_data_length(p->header[3]); length = HEADER_GET_DATA_LENGTH(p->header[3]);
break; break;
default: default:
...@@ -644,10 +644,10 @@ fw_core_handle_request(struct fw_card *card, struct fw_packet *p) ...@@ -644,10 +644,10 @@ fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
offset = offset =
((unsigned long long) ((unsigned long long)
header_get_offset_high(p->header[1]) << 32) | p->header[2]; HEADER_GET_OFFSET_HIGH(p->header[1]) << 32) | p->header[2];
tcode = header_get_tcode(p->header[0]); tcode = HEADER_GET_TCODE(p->header[0]);
destination = header_get_destination(p->header[0]); destination = HEADER_GET_DESTINATION(p->header[0]);
source = header_get_source(p->header[0]); source = HEADER_GET_SOURCE(p->header[0]);
spin_lock_irqsave(&address_handler_lock, flags); spin_lock_irqsave(&address_handler_lock, flags);
handler = lookup_enclosing_address_handler(&address_handler_list, handler = lookup_enclosing_address_handler(&address_handler_list,
...@@ -682,11 +682,11 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p) ...@@ -682,11 +682,11 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
size_t data_length; size_t data_length;
int tcode, tlabel, destination, source, rcode; int tcode, tlabel, destination, source, rcode;
tcode = header_get_tcode(p->header[0]); tcode = HEADER_GET_TCODE(p->header[0]);
tlabel = header_get_tlabel(p->header[0]); tlabel = HEADER_GET_TLABEL(p->header[0]);
destination = header_get_destination(p->header[0]); destination = HEADER_GET_DESTINATION(p->header[0]);
source = header_get_source(p->header[1]); source = HEADER_GET_SOURCE(p->header[1]);
rcode = header_get_rcode(p->header[1]); rcode = HEADER_GET_RCODE(p->header[1]);
spin_lock_irqsave(&card->lock, flags); spin_lock_irqsave(&card->lock, flags);
list_for_each_entry(t, &card->transaction_list, link) { list_for_each_entry(t, &card->transaction_list, link) {
...@@ -723,7 +723,7 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p) ...@@ -723,7 +723,7 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
case TCODE_READ_BLOCK_RESPONSE: case TCODE_READ_BLOCK_RESPONSE:
case TCODE_LOCK_RESPONSE: case TCODE_LOCK_RESPONSE:
data = p->payload; data = p->payload;
data_length = header_get_data_length(p->header[3]); data_length = HEADER_GET_DATA_LENGTH(p->header[3]);
break; break;
default: default:
......
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