Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 6a6a9745a020c90596fc5e6ffbb1676891f3ce8d Mon Sep 17 00:00:00 2001
- From: Eric <[email protected]>
- Date: Thu, 26 Mar 2015 15:38:48 -0600
- Subject: [PATCH] add firewire traces
- ---
- drivers/firewire/ohci.c | 1 +
- drivers/firewire/sbp2.c | 54 ++++++++++++++++++++++++++++++++++--------------
- drivers/scsi/scsi_scan.c | 13 +++++++++---
- 3 files changed, 50 insertions(+), 18 deletions(-)
- diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
- index 2ff8f2a..41a1cb38 100644
- --- a/drivers/firewire/ohci.c
- +++ b/drivers/firewire/ohci.c
- @@ -2037,6 +2037,7 @@ static void bus_reset_work(struct work_struct *work)
- spin_lock_irq(&ohci->lock);
- ohci->generation = generation;
- + printk("firewire_ohci: bus_reset_work: clearing OHCI1394_busReset");
- reg_write(ohci, OHCI1394_IntEventClear, OHCI1394_busReset);
- if (ohci->quirks & QUIRK_RESET_PACKET)
- diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
- index 47674b9..cfb4b92 100644
- --- a/drivers/firewire/sbp2.c
- +++ b/drivers/firewire/sbp2.c
- @@ -486,7 +486,7 @@ static void complete_transaction(struct fw_card *card, int rcode,
- if (orb->rcode != RCODE_COMPLETE) {
- list_del(&orb->link);
- spin_unlock_irqrestore(&card->lock, flags);
- -
- + printk("sbp2-complete_transaction: complete_transaction() sending NULL status due to rcode != RCODE_COMPLETE\n");
- orb->callback(orb, NULL);
- kref_put(&orb->kref, free_orb); /* orb callback reference */
- } else {
- @@ -536,6 +536,7 @@ static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
- if (fw_cancel_transaction(device->card, &orb->t) == 0)
- continue;
- + printk("sbp2_cancel_orbs: setting rcode = RCODE_CANCELLED\n");
- orb->rcode = RCODE_CANCELLED;
- orb->callback(orb, NULL);
- kref_put(&orb->kref, free_orb); /* orb callback reference */
- @@ -653,15 +654,19 @@ static int sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id,
- return retval;
- }
- -static void sbp2_agent_reset(struct sbp2_logical_unit *lu)
- +static int sbp2_agent_reset(struct sbp2_logical_unit *lu)
- {
- struct fw_device *device = target_parent_device(lu->tgt);
- __be32 d = 0;
- + int code;
- + printk("sbp2_agent_reset: command_block_agent_address is %lld, generation is %d\n", lu->command_block_agent_address, lu->generation);
- - fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
- + code = fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
- lu->tgt->node_id, lu->generation, device->max_speed,
- lu->command_block_agent_address + SBP2_AGENT_RESET,
- &d, 4);
- + printk("sbp2_agent_reset returned rcode 0x%X (%s)\n", code, fw_rcode_string(code));
- + return code;
- }
- static void complete_agent_reset_write_no_wait(struct fw_card *card,
- @@ -804,9 +809,11 @@ static void sbp2_set_busy_timeout(struct sbp2_logical_unit *lu)
- struct fw_device *device = target_parent_device(lu->tgt);
- __be32 d = cpu_to_be32(SBP2_CYCLE_LIMIT | SBP2_RETRY_LIMIT);
- - fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
- + int code;
- + code = fw_run_transaction(device->card, TCODE_WRITE_QUADLET_REQUEST,
- lu->tgt->node_id, lu->generation, device->max_speed,
- CSR_REGISTER_BASE + CSR_BUSY_TIMEOUT, &d, 4);
- + printk("sbp2_set_busy_timeout returned rcode 0x%X (%s)\n", code, fw_rcode_string(code));
- }
- static void sbp2_reconnect(struct work_struct *work);
- @@ -831,10 +838,12 @@ static void sbp2_login(struct work_struct *work)
- local_node_id = device->card->node_id;
- /* If this is a re-login attempt, log out, or we might be rejected. */
- - if (lu->has_sdev)
- - sbp2_send_management_orb(lu, device->node_id, generation,
- - SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
- -
- + if (lu->has_sdev){
- + if(sbp2_send_management_orb(lu, device->node_id, generation,
- + SBP2_LOGOUT_REQUEST, lu->login_id, NULL) < 0){
- + printk("sbp2_login: re-login attempt failed to logout of LUN %04x\n", lu->lun);
- + }
- + }
- if (sbp2_send_management_orb(lu, node_id, generation,
- SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) {
- if (lu->retries++ < 5) {
- @@ -862,16 +871,21 @@ static void sbp2_login(struct work_struct *work)
- lu->lun, lu->retries);
- /* set appropriate retry limit(s) in BUSY_TIMEOUT register */
- + printk("sbp2_login: command_block_agent_address is %lld, generation is %d\n", lu->command_block_agent_address, lu->generation);
- sbp2_set_busy_timeout(lu);
- +
- PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect);
- - sbp2_agent_reset(lu);
- +
- + if(sbp2_agent_reset(lu)){
- + /*goto out_logout_login;*/
- + }
- /* This was a re-login. */
- if (lu->has_sdev) {
- sbp2_cancel_orbs(lu);
- sbp2_conditionally_unblock(lu);
- -
- + printk("sbp2_login: lu->has_sdev is true... returning\n");
- return;
- }
- @@ -880,6 +894,7 @@ static void sbp2_login(struct work_struct *work)
- shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]);
- sdev = __scsi_add_device(shost, 0, 0, sbp2_lun2int(lu->lun), lu);
- + printk("sbp2_login: scsi sdev = %d(0x%X)\n", (int)sdev, (int)sdev);
- /*
- * FIXME: We are unable to perform reconnects while in sbp2_login().
- * Therefore __scsi_add_device() will get into trouble if a bus reset
- @@ -889,9 +904,10 @@ static void sbp2_login(struct work_struct *work)
- */
- /* Reported error during __scsi_add_device() */
- - if (IS_ERR(sdev))
- + if (IS_ERR(sdev)){
- + printk("sbp2_login: IS_ERR(sdev) is true... attempt logout_login\n");
- goto out_logout_login;
- -
- + }
- /* Unreported error during __scsi_add_device() */
- smp_rmb(); /* get current card generation */
- if (generation != device->card->generation) {
- @@ -911,13 +927,14 @@ static void sbp2_login(struct work_struct *work)
- smp_rmb(); /* generation may have changed */
- generation = device->generation;
- smp_rmb(); /* node_id must not be older than generation */
- -
- + printk("sbp2_login: out_logout_login: sending SBP2_LOGOUT_REQUEST.\n");
- sbp2_send_management_orb(lu, device->node_id, generation,
- SBP2_LOGOUT_REQUEST, lu->login_id, NULL);
- /*
- * If a bus reset happened, sbp2_update will have requeued
- * lu->work already. Reset the work from reconnect to login.
- */
- + printk("sbp2_login: out_logout_login: rescheduling login.\n");
- PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
- }
- @@ -928,9 +945,12 @@ static void sbp2_reconnect(struct work_struct *work)
- struct sbp2_target *tgt = lu->tgt;
- struct fw_device *device = target_parent_device(tgt);
- int generation, node_id, local_node_id;
- -
- + printk("sbp2_reconnect: sbp2_reconnect start..\n");
- if (fw_device_is_shutdown(device))
- + {
- + printk("sbp2_reconnect: returning because device is shut down.\n");
- return;
- + }
- generation = device->generation;
- smp_rmb(); /* node IDs must not be older than generation */
- @@ -940,6 +960,7 @@ static void sbp2_reconnect(struct work_struct *work)
- if (sbp2_send_management_orb(lu, node_id, generation,
- SBP2_RECONNECT_REQUEST,
- lu->login_id, NULL) < 0) {
- + printk("sbp2_reconnect: sbp2_send_management_orb SBP2_RECONNECT_REQUEST returned non 0.\n");
- /*
- * If reconnect was impossible even though we are in the
- * current generation, fall back and try to log in again.
- @@ -952,10 +973,11 @@ static void sbp2_reconnect(struct work_struct *work)
- lu->retries++ >= 5) {
- dev_err(tgt_dev(tgt), "failed to reconnect\n");
- lu->retries = 0;
- + printk("sbp2_reconnect: failed to reconnect, rescheduling sbp2_login.\n");
- PREPARE_DELAYED_WORK(&lu->work, sbp2_login);
- }
- sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5));
- -
- + printk("sbp2_reconnect: exit after sbp2_queue_work..\n");
- return;
- }
- @@ -1365,6 +1387,7 @@ static void complete_command_orb(struct sbp2_orb *base_orb,
- result = DID_OK << 16;
- break;
- case SBP2_STATUS_TRANSPORT_FAILURE:
- + printk("sbp2-complete_command_orb: Setting DID_BUS_BUSY due to SBP2_STATUS_TRANSPORT_FAILURE\n");
- result = DID_BUS_BUSY << 16;
- break;
- case SBP2_STATUS_ILLEGAL_REQUEST:
- @@ -1383,6 +1406,7 @@ static void complete_command_orb(struct sbp2_orb *base_orb,
- * went wrong, typically a bus reset happened mid-orb
- * or when sending the write (less likely).
- */
- + printk("sbp2-complete_command_orb: Setting DID_BUS_BUSY due to status == NULL\n");
- result = DID_BUS_BUSY << 16;
- sbp2_conditionally_block(orb->lu);
- }
- diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
- index 3e58b22..e351f8f 100644
- --- a/drivers/scsi/scsi_scan.c
- +++ b/drivers/scsi/scsi_scan.c
- @@ -1014,6 +1014,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
- * host adapter calls into here with rescan == 0.
- */
- sdev = scsi_device_lookup_by_target(starget, lun);
- + printk("scsi_probe_and_add_lun: scsi_device_lookup_by_target(0x%X, 0x%X) returned sdev of 0x%X\n", (int)starget, lun, (int)sdev);
- if (sdev) {
- if (rescan || !scsi_device_created(sdev)) {
- SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
- @@ -1041,8 +1042,10 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
- if (!result)
- goto out_free_sdev;
- - if (scsi_probe_lun(sdev, result, result_len, &bflags))
- + if (scsi_probe_lun(sdev, result, result_len, &bflags)){
- + printk("scsi_probe_and_add_lun: scsi_probe_lun returned non 0!\n");
- goto out_free_result;
- + }
- if (bflagsp)
- *bflagsp = bflags;
- @@ -1508,9 +1511,12 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
- struct scsi_device *sdev = ERR_PTR(-ENODEV);
- struct device *parent = &shost->shost_gendev;
- struct scsi_target *starget;
- + int val;
- - if (strncmp(scsi_scan_type, "none", 4) == 0)
- + if (strncmp(scsi_scan_type, "none", 4) == 0){
- + printk("__scsi_add_device: scsi_scan_type is none!\n");
- return ERR_PTR(-ENODEV);
- + }
- starget = scsi_alloc_target(parent, channel, id);
- if (!starget)
- @@ -1522,7 +1528,8 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
- scsi_complete_async_scans();
- if (scsi_host_scan_allowed(shost) && scsi_autopm_get_host(shost) == 0) {
- - scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata);
- + val = scsi_probe_and_add_lun(starget, lun, NULL, &sdev, 1, hostdata);
- + printk("__scsi_add_device: scsi_probe_add_lun returned %d(0x%X): sdev = %d (0x%X)\n", val, val, (int)sdev, (int)sdev);
- scsi_autopm_put_host(shost);
- }
- mutex_unlock(&shost->scan_mutex);
- --
- 1.8.3.1
Advertisement
Add Comment
Please, Sign In to add comment