diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-05-07 20:33:35 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-05-10 12:24:13 -0400 |
commit | a77754a75d58d534fd34a5add8ac1bb91d4ffc0f (patch) | |
tree | 773885568a19a8ed354acba1bf5c1d5a63a828d1 /drivers/firewire/fw-sbp2.c | |
parent | a98e27198771d066934a263177673ebde797e8fb (diff) |
firewire: Uppercase most macro names.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-sbp2.c')
-rw-r--r-- | drivers/firewire/fw-sbp2.c | 107 |
1 files changed, 53 insertions, 54 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c index 3308bc089beb..196de46c00b6 100644 --- a/drivers/firewire/fw-sbp2.c +++ b/drivers/firewire/fw-sbp2.c | |||
@@ -123,14 +123,14 @@ struct sbp2_device { | |||
123 | #define SBP2_STATUS_ILLEGAL_REQUEST 0x2 | 123 | #define SBP2_STATUS_ILLEGAL_REQUEST 0x2 |
124 | #define SBP2_STATUS_VENDOR_DEPENDENT 0x3 | 124 | #define SBP2_STATUS_VENDOR_DEPENDENT 0x3 |
125 | 125 | ||
126 | #define status_get_orb_high(v) ((v).status & 0xffff) | 126 | #define STATUS_GET_ORB_HIGH(v) ((v).status & 0xffff) |
127 | #define status_get_sbp_status(v) (((v).status >> 16) & 0xff) | 127 | #define STATUS_GET_SBP_STATUS(v) (((v).status >> 16) & 0xff) |
128 | #define status_get_len(v) (((v).status >> 24) & 0x07) | 128 | #define STATUS_GET_LEN(v) (((v).status >> 24) & 0x07) |
129 | #define status_get_dead(v) (((v).status >> 27) & 0x01) | 129 | #define STATUS_GET_DEAD(v) (((v).status >> 27) & 0x01) |
130 | #define status_get_response(v) (((v).status >> 28) & 0x03) | 130 | #define STATUS_GET_RESPONSE(v) (((v).status >> 28) & 0x03) |
131 | #define status_get_source(v) (((v).status >> 30) & 0x03) | 131 | #define STATUS_GET_SOURCE(v) (((v).status >> 30) & 0x03) |
132 | #define status_get_orb_low(v) ((v).orb_low) | 132 | #define STATUS_GET_ORB_LOW(v) ((v).orb_low) |
133 | #define status_get_data(v) ((v).data) | 133 | #define STATUS_GET_DATA(v) ((v).data) |
134 | 134 | ||
135 | struct sbp2_status { | 135 | struct sbp2_status { |
136 | u32 status; | 136 | u32 status; |
@@ -152,15 +152,15 @@ struct sbp2_orb { | |||
152 | struct list_head link; | 152 | struct list_head link; |
153 | }; | 153 | }; |
154 | 154 | ||
155 | #define management_orb_lun(v) ((v)) | 155 | #define MANAGEMENT_ORB_LUN(v) ((v)) |
156 | #define management_orb_function(v) ((v) << 16) | 156 | #define MANAGEMENT_ORB_FUNCTION(v) ((v) << 16) |
157 | #define management_orb_reconnect(v) ((v) << 20) | 157 | #define MANAGEMENT_ORB_RECONNECT(v) ((v) << 20) |
158 | #define management_orb_exclusive ((1) << 28) | 158 | #define MANAGEMENT_ORB_EXCLUSIVE ((1) << 28) |
159 | #define management_orb_request_format(v) ((v) << 29) | 159 | #define MANAGEMENT_ORB_REQUEST_FORMAT(v) ((v) << 29) |
160 | #define management_orb_notify ((1) << 31) | 160 | #define MANAGEMENT_ORB_NOTIFY ((1) << 31) |
161 | 161 | ||
162 | #define management_orb_response_length(v) ((v)) | 162 | #define MANAGEMENT_ORB_RESPONSE_LENGTH(v) ((v)) |
163 | #define management_orb_password_length(v) ((v) << 16) | 163 | #define MANAGEMENT_ORB_PASSWORD_LENGTH(v) ((v) << 16) |
164 | 164 | ||
165 | struct sbp2_management_orb { | 165 | struct sbp2_management_orb { |
166 | struct sbp2_orb base; | 166 | struct sbp2_orb base; |
@@ -177,23 +177,22 @@ struct sbp2_management_orb { | |||
177 | struct sbp2_status status; | 177 | struct sbp2_status status; |
178 | }; | 178 | }; |
179 | 179 | ||
180 | #define login_response_get_login_id(v) ((v).misc & 0xffff) | 180 | #define LOGIN_RESPONSE_GET_LOGIN_ID(v) ((v).misc & 0xffff) |
181 | #define login_response_get_length(v) (((v).misc >> 16) & 0xffff) | 181 | #define LOGIN_RESPONSE_GET_LENGTH(v) (((v).misc >> 16) & 0xffff) |
182 | 182 | ||
183 | struct sbp2_login_response { | 183 | struct sbp2_login_response { |
184 | u32 misc; | 184 | u32 misc; |
185 | struct sbp2_pointer command_block_agent; | 185 | struct sbp2_pointer command_block_agent; |
186 | u32 reconnect_hold; | 186 | u32 reconnect_hold; |
187 | }; | 187 | }; |
188 | 188 | #define COMMAND_ORB_DATA_SIZE(v) ((v)) | |
189 | #define command_orb_data_size(v) ((v)) | 189 | #define COMMAND_ORB_PAGE_SIZE(v) ((v) << 16) |
190 | #define command_orb_page_size(v) ((v) << 16) | 190 | #define COMMAND_ORB_PAGE_TABLE_PRESENT ((1) << 19) |
191 | #define command_orb_page_table_present ((1) << 19) | 191 | #define COMMAND_ORB_MAX_PAYLOAD(v) ((v) << 20) |
192 | #define command_orb_max_payload(v) ((v) << 20) | 192 | #define COMMAND_ORB_SPEED(v) ((v) << 24) |
193 | #define command_orb_speed(v) ((v) << 24) | 193 | #define COMMAND_ORB_DIRECTION(v) ((v) << 27) |
194 | #define command_orb_direction(v) ((v) << 27) | 194 | #define COMMAND_ORB_REQUEST_FORMAT(v) ((v) << 29) |
195 | #define command_orb_request_format(v) ((v) << 29) | 195 | #define COMMAND_ORB_NOTIFY ((1) << 31) |
196 | #define command_orb_notify ((1) << 31) | ||
197 | 196 | ||
198 | struct sbp2_command_orb { | 197 | struct sbp2_command_orb { |
199 | struct sbp2_orb base; | 198 | struct sbp2_orb base; |
@@ -290,7 +289,7 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request, | |||
290 | fw_memcpy_from_be32(&status, payload, header_size); | 289 | fw_memcpy_from_be32(&status, payload, header_size); |
291 | if (length > header_size) | 290 | if (length > header_size) |
292 | memcpy(status.data, payload + 8, length - header_size); | 291 | memcpy(status.data, payload + 8, length - header_size); |
293 | if (status_get_source(status) == 2 || status_get_source(status) == 3) { | 292 | if (STATUS_GET_SOURCE(status) == 2 || STATUS_GET_SOURCE(status) == 3) { |
294 | fw_notify("non-orb related status write, not handled\n"); | 293 | fw_notify("non-orb related status write, not handled\n"); |
295 | fw_send_response(card, request, RCODE_COMPLETE); | 294 | fw_send_response(card, request, RCODE_COMPLETE); |
296 | return; | 295 | return; |
@@ -299,8 +298,8 @@ sbp2_status_write(struct fw_card *card, struct fw_request *request, | |||
299 | /* Lookup the orb corresponding to this status write. */ | 298 | /* Lookup the orb corresponding to this status write. */ |
300 | spin_lock_irqsave(&card->lock, flags); | 299 | spin_lock_irqsave(&card->lock, flags); |
301 | list_for_each_entry(orb, &sd->orb_list, link) { | 300 | list_for_each_entry(orb, &sd->orb_list, link) { |
302 | if (status_get_orb_high(status) == 0 && | 301 | if (STATUS_GET_ORB_HIGH(status) == 0 && |
303 | status_get_orb_low(status) == orb->request_bus && | 302 | STATUS_GET_ORB_LOW(status) == orb->request_bus && |
304 | orb->rcode == RCODE_COMPLETE) { | 303 | orb->rcode == RCODE_COMPLETE) { |
305 | list_del(&orb->link); | 304 | list_del(&orb->link); |
306 | break; | 305 | break; |
@@ -425,11 +424,11 @@ sbp2_send_management_orb(struct fw_unit *unit, int node_id, int generation, | |||
425 | orb->request.response.low = orb->response_bus; | 424 | orb->request.response.low = orb->response_bus; |
426 | 425 | ||
427 | orb->request.misc = | 426 | orb->request.misc = |
428 | management_orb_notify | | 427 | MANAGEMENT_ORB_NOTIFY | |
429 | management_orb_function(function) | | 428 | MANAGEMENT_ORB_FUNCTION(function) | |
430 | management_orb_lun(lun); | 429 | MANAGEMENT_ORB_LUN(lun); |
431 | orb->request.length = | 430 | orb->request.length = |
432 | management_orb_response_length(sizeof orb->response); | 431 | MANAGEMENT_ORB_RESPONSE_LENGTH(sizeof orb->response); |
433 | 432 | ||
434 | orb->request.status_fifo.high = sd->address_handler.offset >> 32; | 433 | orb->request.status_fifo.high = sd->address_handler.offset >> 32; |
435 | orb->request.status_fifo.low = sd->address_handler.offset; | 434 | 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 | */ | 440 | */ |
442 | if (function == SBP2_LOGIN_REQUEST) { | 441 | if (function == SBP2_LOGIN_REQUEST) { |
443 | orb->request.misc |= | 442 | orb->request.misc |= |
444 | management_orb_exclusive | | 443 | MANAGEMENT_ORB_EXCLUSIVE | |
445 | management_orb_reconnect(0); | 444 | MANAGEMENT_ORB_RECONNECT(0); |
446 | } | 445 | } |
447 | 446 | ||
448 | fw_memcpy_to_be32(&orb->request, &orb->request, sizeof orb->request); | 447 | 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 | goto out; | 468 | goto out; |
470 | } | 469 | } |
471 | 470 | ||
472 | if (status_get_response(orb->status) != 0 || | 471 | if (STATUS_GET_RESPONSE(orb->status) != 0 || |
473 | status_get_sbp_status(orb->status) != 0) { | 472 | STATUS_GET_SBP_STATUS(orb->status) != 0) { |
474 | fw_error("error status: %d:%d\n", | 473 | fw_error("error status: %d:%d\n", |
475 | status_get_response(orb->status), | 474 | STATUS_GET_RESPONSE(orb->status), |
476 | status_get_sbp_status(orb->status)); | 475 | STATUS_GET_SBP_STATUS(orb->status)); |
477 | goto out; | 476 | goto out; |
478 | } | 477 | } |
479 | 478 | ||
@@ -577,7 +576,7 @@ static void sbp2_login(struct work_struct *work) | |||
577 | sd->command_block_agent_address = | 576 | sd->command_block_agent_address = |
578 | ((u64) (response.command_block_agent.high & 0xffff) << 32) | | 577 | ((u64) (response.command_block_agent.high & 0xffff) << 32) | |
579 | response.command_block_agent.low; | 578 | response.command_block_agent.low; |
580 | sd->login_id = login_response_get_login_id(response); | 579 | sd->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response); |
581 | 580 | ||
582 | fw_notify("logged in to sbp2 unit %s (%d retries)\n", | 581 | fw_notify("logged in to sbp2 unit %s (%d retries)\n", |
583 | unit->device.bus_id, sd->retries); | 582 | unit->device.bus_id, sd->retries); |
@@ -828,10 +827,10 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) | |||
828 | int result; | 827 | int result; |
829 | 828 | ||
830 | if (status != NULL) { | 829 | if (status != NULL) { |
831 | if (status_get_dead(*status)) | 830 | if (STATUS_GET_DEAD(*status)) |
832 | sbp2_agent_reset(unit); | 831 | sbp2_agent_reset(unit); |
833 | 832 | ||
834 | switch (status_get_response(*status)) { | 833 | switch (STATUS_GET_RESPONSE(*status)) { |
835 | case SBP2_STATUS_REQUEST_COMPLETE: | 834 | case SBP2_STATUS_REQUEST_COMPLETE: |
836 | result = DID_OK << 16; | 835 | result = DID_OK << 16; |
837 | break; | 836 | break; |
@@ -845,8 +844,8 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) | |||
845 | break; | 844 | break; |
846 | } | 845 | } |
847 | 846 | ||
848 | if (result == DID_OK << 16 && status_get_len(*status) > 1) | 847 | if (result == DID_OK << 16 && STATUS_GET_LEN(*status) > 1) |
849 | result = sbp2_status_to_sense_data(status_get_data(*status), | 848 | result = sbp2_status_to_sense_data(STATUS_GET_DATA(*status), |
850 | orb->cmd->sense_buffer); | 849 | orb->cmd->sense_buffer); |
851 | } else { | 850 | } else { |
852 | /* | 851 | /* |
@@ -906,7 +905,7 @@ static void sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb) | |||
906 | orb->request.data_descriptor.high = sd->address_high; | 905 | orb->request.data_descriptor.high = sd->address_high; |
907 | orb->request.data_descriptor.low = sg_dma_address(sg); | 906 | orb->request.data_descriptor.low = sg_dma_address(sg); |
908 | orb->request.misc |= | 907 | orb->request.misc |= |
909 | command_orb_data_size(sg_dma_len(sg)); | 908 | COMMAND_ORB_DATA_SIZE(sg_dma_len(sg)); |
910 | return; | 909 | return; |
911 | } | 910 | } |
912 | 911 | ||
@@ -943,8 +942,8 @@ static void sbp2_command_orb_map_scatterlist(struct sbp2_command_orb *orb) | |||
943 | orb->request.data_descriptor.high = sd->address_high; | 942 | orb->request.data_descriptor.high = sd->address_high; |
944 | orb->request.data_descriptor.low = orb->page_table_bus; | 943 | orb->request.data_descriptor.low = orb->page_table_bus; |
945 | orb->request.misc |= | 944 | orb->request.misc |= |
946 | command_orb_page_table_present | | 945 | COMMAND_ORB_PAGE_TABLE_PRESENT | |
947 | command_orb_data_size(j); | 946 | COMMAND_ORB_DATA_SIZE(j); |
948 | 947 | ||
949 | fw_memcpy_to_be32(orb->page_table, orb->page_table, size); | 948 | fw_memcpy_to_be32(orb->page_table, orb->page_table, size); |
950 | } | 949 | } |
@@ -969,7 +968,7 @@ static void sbp2_command_orb_map_buffer(struct sbp2_command_orb *orb) | |||
969 | orb->request.data_descriptor.high = sd->address_high; | 968 | orb->request.data_descriptor.high = sd->address_high; |
970 | orb->request.data_descriptor.low = orb->request_buffer_bus; | 969 | orb->request.data_descriptor.low = orb->request_buffer_bus; |
971 | orb->request.misc |= | 970 | orb->request.misc |= |
972 | command_orb_data_size(orb->cmd->request_bufflen); | 971 | COMMAND_ORB_DATA_SIZE(orb->cmd->request_bufflen); |
973 | } | 972 | } |
974 | 973 | ||
975 | /* SCSI stack integration */ | 974 | /* SCSI stack integration */ |
@@ -1017,16 +1016,16 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) | |||
1017 | * if we set this to max_speed + 7, we get the right value. | 1016 | * if we set this to max_speed + 7, we get the right value. |
1018 | */ | 1017 | */ |
1019 | orb->request.misc = | 1018 | orb->request.misc = |
1020 | command_orb_max_payload(device->node->max_speed + 7) | | 1019 | COMMAND_ORB_MAX_PAYLOAD(device->node->max_speed + 7) | |
1021 | command_orb_speed(device->node->max_speed) | | 1020 | COMMAND_ORB_SPEED(device->node->max_speed) | |
1022 | command_orb_notify; | 1021 | COMMAND_ORB_NOTIFY; |
1023 | 1022 | ||
1024 | if (cmd->sc_data_direction == DMA_FROM_DEVICE) | 1023 | if (cmd->sc_data_direction == DMA_FROM_DEVICE) |
1025 | orb->request.misc |= | 1024 | orb->request.misc |= |
1026 | command_orb_direction(SBP2_DIRECTION_FROM_MEDIA); | 1025 | COMMAND_ORB_DIRECTION(SBP2_DIRECTION_FROM_MEDIA); |
1027 | else if (cmd->sc_data_direction == DMA_TO_DEVICE) | 1026 | else if (cmd->sc_data_direction == DMA_TO_DEVICE) |
1028 | orb->request.misc |= | 1027 | orb->request.misc |= |
1029 | command_orb_direction(SBP2_DIRECTION_TO_MEDIA); | 1028 | COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA); |
1030 | 1029 | ||
1031 | if (cmd->use_sg) { | 1030 | if (cmd->use_sg) { |
1032 | sbp2_command_orb_map_scatterlist(orb); | 1031 | sbp2_command_orb_map_scatterlist(orb); |