diff options
| author | Sumant Patro <sumantp@lsil.com> | 2006-10-03 16:09:14 -0400 |
|---|---|---|
| committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-10-04 13:52:15 -0400 |
| commit | 658dcedb4e35d77f7f6552b5a640d7d82c372053 (patch) | |
| tree | 9d86c5a80429716111498e6b1f4f948b00fc2c73 | |
| parent | b274cab779219325fd480cc696a456d1c3893bd8 (diff) | |
[SCSI] megaraid_sas: prints pending cmds before setting hw_crit_error
This patch adds function to print the pending frame details before returning
failure from the reset routine. It also exposes a new variable megasas_dbg_lvl
that allows the user to set the debug level for logging.
Signed-off-by: Sumant Patro <Sumant.Patro@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
| -rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 92 | ||||
| -rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 2 |
2 files changed, 94 insertions, 0 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index c3b50b375799..0791d62b167f 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
| @@ -71,6 +71,8 @@ static struct megasas_mgmt_info megasas_mgmt_info; | |||
| 71 | static struct fasync_struct *megasas_async_queue; | 71 | static struct fasync_struct *megasas_async_queue; |
| 72 | static DEFINE_MUTEX(megasas_async_queue_mutex); | 72 | static DEFINE_MUTEX(megasas_async_queue_mutex); |
| 73 | 73 | ||
| 74 | static u32 megasas_dbg_lvl; | ||
| 75 | |||
| 74 | /** | 76 | /** |
| 75 | * megasas_get_cmd - Get a command from the free pool | 77 | * megasas_get_cmd - Get a command from the free pool |
| 76 | * @instance: Adapter soft state | 78 | * @instance: Adapter soft state |
| @@ -758,6 +760,69 @@ static inline int megasas_is_ldio(struct scsi_cmnd *cmd) | |||
| 758 | } | 760 | } |
| 759 | } | 761 | } |
| 760 | 762 | ||
| 763 | /** | ||
| 764 | * megasas_dump_pending_frames - Dumps the frame address of all pending cmds | ||
| 765 | * in FW | ||
| 766 | * @instance: Adapter soft state | ||
| 767 | */ | ||
| 768 | static inline void | ||
| 769 | megasas_dump_pending_frames(struct megasas_instance *instance) | ||
| 770 | { | ||
| 771 | struct megasas_cmd *cmd; | ||
| 772 | int i,n; | ||
| 773 | union megasas_sgl *mfi_sgl; | ||
| 774 | struct megasas_io_frame *ldio; | ||
| 775 | struct megasas_pthru_frame *pthru; | ||
| 776 | u32 sgcount; | ||
| 777 | u32 max_cmd = instance->max_fw_cmds; | ||
| 778 | |||
| 779 | printk(KERN_ERR "\nmegasas[%d]: Dumping Frame Phys Address of all pending cmds in FW\n",instance->host->host_no); | ||
| 780 | printk(KERN_ERR "megasas[%d]: Total OS Pending cmds : %d\n",instance->host->host_no,atomic_read(&instance->fw_outstanding)); | ||
| 781 | if (IS_DMA64) | ||
| 782 | printk(KERN_ERR "\nmegasas[%d]: 64 bit SGLs were sent to FW\n",instance->host->host_no); | ||
| 783 | else | ||
| 784 | printk(KERN_ERR "\nmegasas[%d]: 32 bit SGLs were sent to FW\n",instance->host->host_no); | ||
| 785 | |||
| 786 | printk(KERN_ERR "megasas[%d]: Pending OS cmds in FW : \n",instance->host->host_no); | ||
| 787 | for (i = 0; i < max_cmd; i++) { | ||
| 788 | cmd = instance->cmd_list[i]; | ||
| 789 | if(!cmd->scmd) | ||
| 790 | continue; | ||
| 791 | printk(KERN_ERR "megasas[%d]: Frame addr :0x%08lx : ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr); | ||
| 792 | if (megasas_is_ldio(cmd->scmd)){ | ||
| 793 | ldio = (struct megasas_io_frame *)cmd->frame; | ||
| 794 | mfi_sgl = &ldio->sgl; | ||
| 795 | sgcount = ldio->sge_count; | ||
| 796 | printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, lba lo : 0x%x, lba_hi : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",instance->host->host_no, cmd->frame_count,ldio->cmd,ldio->target_id, ldio->start_lba_lo,ldio->start_lba_hi,ldio->sense_buf_phys_addr_lo,sgcount); | ||
| 797 | } | ||
| 798 | else { | ||
| 799 | pthru = (struct megasas_pthru_frame *) cmd->frame; | ||
| 800 | mfi_sgl = &pthru->sgl; | ||
| 801 | sgcount = pthru->sge_count; | ||
| 802 | printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, lun : 0x%x, cdb_len : 0x%x, data xfer len : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",instance->host->host_no,cmd->frame_count,pthru->cmd,pthru->target_id,pthru->lun,pthru->cdb_len , pthru->data_xfer_len,pthru->sense_buf_phys_addr_lo,sgcount); | ||
| 803 | } | ||
| 804 | if(megasas_dbg_lvl & MEGASAS_DBG_LVL){ | ||
| 805 | for (n = 0; n < sgcount; n++){ | ||
| 806 | if (IS_DMA64) | ||
| 807 | printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%08lx ",mfi_sgl->sge64[n].length , (unsigned long)mfi_sgl->sge64[n].phys_addr) ; | ||
| 808 | else | ||
| 809 | printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%x ",mfi_sgl->sge32[n].length , mfi_sgl->sge32[n].phys_addr) ; | ||
| 810 | } | ||
| 811 | } | ||
| 812 | printk(KERN_ERR "\n"); | ||
| 813 | } /*for max_cmd*/ | ||
| 814 | printk(KERN_ERR "\nmegasas[%d]: Pending Internal cmds in FW : \n",instance->host->host_no); | ||
| 815 | for (i = 0; i < max_cmd; i++) { | ||
| 816 | |||
| 817 | cmd = instance->cmd_list[i]; | ||
| 818 | |||
| 819 | if(cmd->sync_cmd == 1){ | ||
| 820 | printk(KERN_ERR "0x%08lx : ", (unsigned long)cmd->frame_phys_addr); | ||
| 821 | } | ||
| 822 | } | ||
| 823 | printk(KERN_ERR "megasas[%d]: Dumping Done.\n\n",instance->host->host_no); | ||
| 824 | } | ||
| 825 | |||
| 761 | /** | 826 | /** |
| 762 | * megasas_queue_command - Queue entry point | 827 | * megasas_queue_command - Queue entry point |
| 763 | * @scmd: SCSI command to be queued | 828 | * @scmd: SCSI command to be queued |
| @@ -869,6 +934,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance) | |||
| 869 | */ | 934 | */ |
| 870 | writel(MFI_STOP_ADP, | 935 | writel(MFI_STOP_ADP, |
| 871 | &instance->reg_set->inbound_doorbell); | 936 | &instance->reg_set->inbound_doorbell); |
| 937 | megasas_dump_pending_frames(instance); | ||
| 872 | instance->hw_crit_error = 1; | 938 | instance->hw_crit_error = 1; |
| 873 | return FAILED; | 939 | return FAILED; |
| 874 | } | 940 | } |
| @@ -2236,6 +2302,8 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2236 | instance->unique_id = pdev->bus->number << 8 | pdev->devfn; | 2302 | instance->unique_id = pdev->bus->number << 8 | pdev->devfn; |
| 2237 | instance->init_id = MEGASAS_DEFAULT_INIT_ID; | 2303 | instance->init_id = MEGASAS_DEFAULT_INIT_ID; |
| 2238 | 2304 | ||
| 2305 | megasas_dbg_lvl = 0; | ||
| 2306 | |||
| 2239 | /* | 2307 | /* |
| 2240 | * Initialize MFI Firmware | 2308 | * Initialize MFI Firmware |
| 2241 | */ | 2309 | */ |
| @@ -2862,6 +2930,26 @@ megasas_sysfs_show_release_date(struct device_driver *dd, char *buf) | |||
| 2862 | static DRIVER_ATTR(release_date, S_IRUGO, megasas_sysfs_show_release_date, | 2930 | static DRIVER_ATTR(release_date, S_IRUGO, megasas_sysfs_show_release_date, |
| 2863 | NULL); | 2931 | NULL); |
| 2864 | 2932 | ||
| 2933 | static ssize_t | ||
| 2934 | megasas_sysfs_show_dbg_lvl(struct device_driver *dd, char *buf) | ||
| 2935 | { | ||
| 2936 | return sprintf(buf,"%u",megasas_dbg_lvl); | ||
| 2937 | } | ||
| 2938 | |||
| 2939 | static ssize_t | ||
| 2940 | megasas_sysfs_set_dbg_lvl(struct device_driver *dd, const char *buf, size_t count) | ||
| 2941 | { | ||
| 2942 | int retval = count; | ||
| 2943 | if(sscanf(buf,"%u",&megasas_dbg_lvl)<1){ | ||
| 2944 | printk(KERN_ERR "megasas: could not set dbg_lvl\n"); | ||
| 2945 | retval = -EINVAL; | ||
| 2946 | } | ||
| 2947 | return retval; | ||
| 2948 | } | ||
| 2949 | |||
| 2950 | static DRIVER_ATTR(dbg_lvl, S_IRUGO|S_IWUGO, megasas_sysfs_show_dbg_lvl, | ||
| 2951 | megasas_sysfs_set_dbg_lvl); | ||
| 2952 | |||
| 2865 | /** | 2953 | /** |
| 2866 | * megasas_init - Driver load entry point | 2954 | * megasas_init - Driver load entry point |
| 2867 | */ | 2955 | */ |
| @@ -2902,6 +2990,8 @@ static int __init megasas_init(void) | |||
| 2902 | driver_create_file(&megasas_pci_driver.driver, &driver_attr_version); | 2990 | driver_create_file(&megasas_pci_driver.driver, &driver_attr_version); |
| 2903 | driver_create_file(&megasas_pci_driver.driver, | 2991 | driver_create_file(&megasas_pci_driver.driver, |
| 2904 | &driver_attr_release_date); | 2992 | &driver_attr_release_date); |
| 2993 | driver_create_file(&megasas_pci_driver.driver, | ||
| 2994 | &driver_attr_dbg_lvl); | ||
| 2905 | 2995 | ||
| 2906 | return rval; | 2996 | return rval; |
| 2907 | } | 2997 | } |
| @@ -2914,6 +3004,8 @@ static void __exit megasas_exit(void) | |||
| 2914 | driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); | 3004 | driver_remove_file(&megasas_pci_driver.driver, &driver_attr_version); |
| 2915 | driver_remove_file(&megasas_pci_driver.driver, | 3005 | driver_remove_file(&megasas_pci_driver.driver, |
| 2916 | &driver_attr_release_date); | 3006 | &driver_attr_release_date); |
| 3007 | driver_remove_file(&megasas_pci_driver.driver, | ||
| 3008 | &driver_attr_dbg_lvl); | ||
| 2917 | 3009 | ||
| 2918 | pci_unregister_driver(&megasas_pci_driver); | 3010 | pci_unregister_driver(&megasas_pci_driver); |
| 2919 | unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); | 3011 | unregister_chrdev(megasas_mgmt_majorno, "megaraid_sas_ioctl"); |
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 74feffe2fff3..ad7ef7444069 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
| @@ -537,6 +537,8 @@ struct megasas_ctrl_info { | |||
| 537 | #define MEGASAS_MAX_LUN 8 | 537 | #define MEGASAS_MAX_LUN 8 |
| 538 | #define MEGASAS_MAX_LD 64 | 538 | #define MEGASAS_MAX_LD 64 |
| 539 | 539 | ||
| 540 | #define MEGASAS_DBG_LVL 1 | ||
| 541 | |||
| 540 | /* | 542 | /* |
| 541 | * When SCSI mid-layer calls driver's reset routine, driver waits for | 543 | * When SCSI mid-layer calls driver's reset routine, driver waits for |
| 542 | * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note | 544 | * MEGASAS_RESET_WAIT_TIME seconds for all outstanding IO to complete. Note |
