aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2008-02-03 17:09:50 -0500
committerStefan Richter <stefanr@s5r6.in-berlin.de>2008-02-16 09:40:34 -0500
commit48f18c761c001a66ef1928b42799c717368b1d64 (patch)
treeccbc2567ea6974b45bd6b265fe1b5ac1b6f75563 /drivers/firewire
parente0e60215552d4d40caf581a8d3247203fe948fe7 (diff)
firewire: fw-sbp2: log bus_id at management request failures
for easier readable logs if more than one SBP-2 device is present. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/fw-sbp2.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index 32b50f13e7a8..077f1c09dad4 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -148,6 +148,7 @@ struct sbp2_logical_unit {
148struct sbp2_target { 148struct sbp2_target {
149 struct kref kref; 149 struct kref kref;
150 struct fw_unit *unit; 150 struct fw_unit *unit;
151 const char *bus_id;
151 struct list_head lu_list; 152 struct list_head lu_list;
152 153
153 u64 management_agent_address; 154 u64 management_agent_address;
@@ -566,20 +567,20 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
566 567
567 retval = -EIO; 568 retval = -EIO;
568 if (sbp2_cancel_orbs(lu) == 0) { 569 if (sbp2_cancel_orbs(lu) == 0) {
569 fw_error("orb reply timed out, rcode=0x%02x\n", 570 fw_error("%s: orb reply timed out, rcode=0x%02x\n",
570 orb->base.rcode); 571 lu->tgt->bus_id, orb->base.rcode);
571 goto out; 572 goto out;
572 } 573 }
573 574
574 if (orb->base.rcode != RCODE_COMPLETE) { 575 if (orb->base.rcode != RCODE_COMPLETE) {
575 fw_error("management write failed, rcode 0x%02x\n", 576 fw_error("%s: management write failed, rcode 0x%02x\n",
576 orb->base.rcode); 577 lu->tgt->bus_id, orb->base.rcode);
577 goto out; 578 goto out;
578 } 579 }
579 580
580 if (STATUS_GET_RESPONSE(orb->status) != 0 || 581 if (STATUS_GET_RESPONSE(orb->status) != 0 ||
581 STATUS_GET_SBP_STATUS(orb->status) != 0) { 582 STATUS_GET_SBP_STATUS(orb->status) != 0) {
582 fw_error("error status: %d:%d\n", 583 fw_error("%s: error status: %d:%d\n", lu->tgt->bus_id,
583 STATUS_GET_RESPONSE(orb->status), 584 STATUS_GET_RESPONSE(orb->status),
584 STATUS_GET_SBP_STATUS(orb->status)); 585 STATUS_GET_SBP_STATUS(orb->status));
585 goto out; 586 goto out;
@@ -664,7 +665,7 @@ static void sbp2_release_target(struct kref *kref)
664 kfree(lu); 665 kfree(lu);
665 } 666 }
666 scsi_remove_host(shost); 667 scsi_remove_host(shost);
667 fw_notify("released %s\n", tgt->unit->device.bus_id); 668 fw_notify("released %s\n", tgt->bus_id);
668 669
669 put_device(&tgt->unit->device); 670 put_device(&tgt->unit->device);
670 scsi_host_put(shost); 671 scsi_host_put(shost);
@@ -693,12 +694,11 @@ static void sbp2_login(struct work_struct *work)
693{ 694{
694 struct sbp2_logical_unit *lu = 695 struct sbp2_logical_unit *lu =
695 container_of(work, struct sbp2_logical_unit, work.work); 696 container_of(work, struct sbp2_logical_unit, work.work);
696 struct Scsi_Host *shost = 697 struct sbp2_target *tgt = lu->tgt;
697 container_of((void *)lu->tgt, struct Scsi_Host, hostdata[0]); 698 struct fw_device *device = fw_device(tgt->unit->device.parent);
699 struct Scsi_Host *shost;
698 struct scsi_device *sdev; 700 struct scsi_device *sdev;
699 struct scsi_lun eight_bytes_lun; 701 struct scsi_lun eight_bytes_lun;
700 struct fw_unit *unit = lu->tgt->unit;
701 struct fw_device *device = fw_device(unit->device.parent);
702 struct sbp2_login_response response; 702 struct sbp2_login_response response;
703 int generation, node_id, local_node_id; 703 int generation, node_id, local_node_id;
704 704
@@ -715,14 +715,14 @@ static void sbp2_login(struct work_struct *work)
715 if (lu->retries++ < 5) 715 if (lu->retries++ < 5)
716 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); 716 sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
717 else 717 else
718 fw_error("failed to login to %s LUN %04x\n", 718 fw_error("%s: failed to login to LUN %04x\n",
719 unit->device.bus_id, lu->lun); 719 tgt->bus_id, lu->lun);
720 goto out; 720 goto out;
721 } 721 }
722 722
723 lu->generation = generation; 723 lu->generation = generation;
724 lu->tgt->node_id = node_id; 724 tgt->node_id = node_id;
725 lu->tgt->address_high = local_node_id << 16; 725 tgt->address_high = local_node_id << 16;
726 726
727 /* Get command block agent offset and login id. */ 727 /* Get command block agent offset and login id. */
728 lu->command_block_agent_address = 728 lu->command_block_agent_address =
@@ -730,8 +730,8 @@ static void sbp2_login(struct work_struct *work)
730 response.command_block_agent.low; 730 response.command_block_agent.low;
731 lu->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response); 731 lu->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response);
732 732
733 fw_notify("logged in to %s LUN %04x (%d retries)\n", 733 fw_notify("%s: logged in to LUN %04x (%d retries)\n",
734 unit->device.bus_id, lu->lun, lu->retries); 734 tgt->bus_id, lu->lun, lu->retries);
735 735
736#if 0 736#if 0
737 /* FIXME: The linux1394 sbp2 does this last step. */ 737 /* FIXME: The linux1394 sbp2 does this last step. */
@@ -747,6 +747,7 @@ static void sbp2_login(struct work_struct *work)
747 memset(&eight_bytes_lun, 0, sizeof(eight_bytes_lun)); 747 memset(&eight_bytes_lun, 0, sizeof(eight_bytes_lun));
748 eight_bytes_lun.scsi_lun[0] = (lu->lun >> 8) & 0xff; 748 eight_bytes_lun.scsi_lun[0] = (lu->lun >> 8) & 0xff;
749 eight_bytes_lun.scsi_lun[1] = lu->lun & 0xff; 749 eight_bytes_lun.scsi_lun[1] = lu->lun & 0xff;
750 shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
750 751
751 sdev = __scsi_add_device(shost, 0, 0, 752 sdev = __scsi_add_device(shost, 0, 0,
752 scsilun_to_int(&eight_bytes_lun), lu); 753 scsilun_to_int(&eight_bytes_lun), lu);
@@ -767,7 +768,7 @@ static void sbp2_login(struct work_struct *work)
767 scsi_device_put(sdev); 768 scsi_device_put(sdev);
768 } 769 }
769 out: 770 out:
770 sbp2_target_put(lu->tgt); 771 sbp2_target_put(tgt);
771} 772}
772 773
773static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) 774static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry)
@@ -850,7 +851,7 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory,
850 if (timeout > tgt->mgt_orb_timeout) 851 if (timeout > tgt->mgt_orb_timeout)
851 fw_notify("%s: config rom contains %ds " 852 fw_notify("%s: config rom contains %ds "
852 "management ORB timeout, limiting " 853 "management ORB timeout, limiting "
853 "to %ds\n", tgt->unit->device.bus_id, 854 "to %ds\n", tgt->bus_id,
854 timeout / 1000, 855 timeout / 1000,
855 tgt->mgt_orb_timeout / 1000); 856 tgt->mgt_orb_timeout / 1000);
856 break; 857 break;
@@ -878,7 +879,7 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
878 if (w) 879 if (w)
879 fw_notify("Please notify linux1394-devel@lists.sourceforge.net " 880 fw_notify("Please notify linux1394-devel@lists.sourceforge.net "
880 "if you need the workarounds parameter for %s\n", 881 "if you need the workarounds parameter for %s\n",
881 tgt->unit->device.bus_id); 882 tgt->bus_id);
882 883
883 if (w & SBP2_WORKAROUND_OVERRIDE) 884 if (w & SBP2_WORKAROUND_OVERRIDE)
884 goto out; 885 goto out;
@@ -900,8 +901,7 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model,
900 if (w) 901 if (w)
901 fw_notify("Workarounds for %s: 0x%x " 902 fw_notify("Workarounds for %s: 0x%x "
902 "(firmware_revision 0x%06x, model_id 0x%06x)\n", 903 "(firmware_revision 0x%06x, model_id 0x%06x)\n",
903 tgt->unit->device.bus_id, 904 tgt->bus_id, w, firmware_revision, model);
904 w, firmware_revision, model);
905 tgt->workarounds = w; 905 tgt->workarounds = w;
906} 906}
907 907
@@ -925,6 +925,7 @@ static int sbp2_probe(struct device *dev)
925 tgt->unit = unit; 925 tgt->unit = unit;
926 kref_init(&tgt->kref); 926 kref_init(&tgt->kref);
927 INIT_LIST_HEAD(&tgt->lu_list); 927 INIT_LIST_HEAD(&tgt->lu_list);
928 tgt->bus_id = unit->device.bus_id;
928 929
929 if (fw_device_enable_phys_dma(device) < 0) 930 if (fw_device_enable_phys_dma(device) < 0)
930 goto fail_shost_put; 931 goto fail_shost_put;
@@ -975,8 +976,8 @@ static void sbp2_reconnect(struct work_struct *work)
975{ 976{
976 struct sbp2_logical_unit *lu = 977 struct sbp2_logical_unit *lu =
977 container_of(work, struct sbp2_logical_unit, work.work); 978 container_of(work, struct sbp2_logical_unit, work.work);
978 struct fw_unit *unit = lu->tgt->unit; 979 struct sbp2_target *tgt = lu->tgt;
979 struct fw_device *device = fw_device(unit->device.parent); 980 struct fw_device *device = fw_device(tgt->unit->device.parent);
980 int generation, node_id, local_node_id; 981 int generation, node_id, local_node_id;
981 982
982 if (fw_device_is_shutdown(device)) 983 if (fw_device_is_shutdown(device))
@@ -991,8 +992,7 @@ static void sbp2_reconnect(struct work_struct *work)
991 SBP2_RECONNECT_REQUEST, 992 SBP2_RECONNECT_REQUEST,
992 lu->login_id, NULL) < 0) { 993 lu->login_id, NULL) < 0) {
993 if (lu->retries++ >= 5) { 994 if (lu->retries++ >= 5) {
994 fw_error("failed to reconnect to %s\n", 995 fw_error("%s: failed to reconnect\n", tgt->bus_id);
995 unit->device.bus_id);
996 /* Fall back and try to log in again. */ 996 /* Fall back and try to log in again. */
997 lu->retries = 0; 997 lu->retries = 0;
998 PREPARE_DELAYED_WORK(&lu->work, sbp2_login); 998 PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
@@ -1001,17 +1001,17 @@ static void sbp2_reconnect(struct work_struct *work)
1001 goto out; 1001 goto out;
1002 } 1002 }
1003 1003
1004 lu->generation = generation; 1004 lu->generation = generation;
1005 lu->tgt->node_id = node_id; 1005 tgt->node_id = node_id;
1006 lu->tgt->address_high = local_node_id << 16; 1006 tgt->address_high = local_node_id << 16;
1007 1007
1008 fw_notify("reconnected to %s LUN %04x (%d retries)\n", 1008 fw_notify("%s: reconnected to LUN %04x (%d retries)\n",
1009 unit->device.bus_id, lu->lun, lu->retries); 1009 tgt->bus_id, lu->lun, lu->retries);
1010 1010
1011 sbp2_agent_reset(lu); 1011 sbp2_agent_reset(lu);
1012 sbp2_cancel_orbs(lu); 1012 sbp2_cancel_orbs(lu);
1013 out: 1013 out:
1014 sbp2_target_put(lu->tgt); 1014 sbp2_target_put(tgt);
1015} 1015}
1016 1016
1017static void sbp2_update(struct fw_unit *unit) 1017static void sbp2_update(struct fw_unit *unit)
@@ -1359,7 +1359,7 @@ static int sbp2_scsi_abort(struct scsi_cmnd *cmd)
1359{ 1359{
1360 struct sbp2_logical_unit *lu = cmd->device->hostdata; 1360 struct sbp2_logical_unit *lu = cmd->device->hostdata;
1361 1361
1362 fw_notify("sbp2_scsi_abort\n"); 1362 fw_notify("%s: sbp2_scsi_abort\n", lu->tgt->bus_id);
1363 sbp2_agent_reset(lu); 1363 sbp2_agent_reset(lu);
1364 sbp2_cancel_orbs(lu); 1364 sbp2_cancel_orbs(lu);
1365 1365