Commit 1a4320fa authored by James Bottomley's avatar James Bottomley

qla2xxx - perform proper SNS scans with ISP2200 HBAs. [1/3]

From: 	Andrew Vasquez <andrew.vasquez@qlogic.com>

The 2200 firmware doesn't support the MS IOCB interface the driver 
uses to issue CT commands to the SNS.  Basically, I had to 
forward-port some code from the 6.x driver to get the SNS calls 
to go through.  I've had several machines (mixture of 2200s/
2300s/others with loop and fabric connections) running with this
patch for the past week.
parent 36ce46ce
...@@ -1895,6 +1895,60 @@ struct ct_sns_pkt { ...@@ -1895,6 +1895,60 @@ struct ct_sns_pkt {
} p; } p;
}; };
/*
* SNS command structures -- for 2200 compatability.
*/
#define RFT_ID_SNS_SCMD_LEN 22
#define RFT_ID_SNS_CMD_SIZE 60
#define RFT_ID_SNS_DATA_SIZE 16
#define RFF_ID_SNS_SCMD_LEN 8
#define RFF_ID_SNS_CMD_SIZE 32
#define RFF_ID_SNS_DATA_SIZE 16
#define RNN_ID_SNS_SCMD_LEN 10
#define RNN_ID_SNS_CMD_SIZE 36
#define RNN_ID_SNS_DATA_SIZE 16
#define GA_NXT_SNS_SCMD_LEN 6
#define GA_NXT_SNS_CMD_SIZE 28
#define GA_NXT_SNS_DATA_SIZE (620 + 16)
#define GID_PT_SNS_SCMD_LEN 6
#define GID_PT_SNS_CMD_SIZE 28
#define GID_PT_SNS_DATA_SIZE (MAX_FIBRE_DEVICES * 4 + 16)
#define GPN_ID_SNS_SCMD_LEN 6
#define GPN_ID_SNS_CMD_SIZE 28
#define GPN_ID_SNS_DATA_SIZE (8 + 16)
#define GNN_ID_SNS_SCMD_LEN 6
#define GNN_ID_SNS_CMD_SIZE 28
#define GNN_ID_SNS_DATA_SIZE (8 + 16)
struct sns_cmd_pkt {
union {
struct {
uint16_t buffer_length;
uint16_t reserved_1;
uint32_t buffer_address[2];
uint16_t subcommand_length;
uint16_t reserved_2;
uint16_t subcommand;
uint16_t size;
uint32_t reserved_3;
uint8_t param[36];
} cmd;
uint8_t rft_data[RFT_ID_SNS_DATA_SIZE];
uint8_t rff_data[RFF_ID_SNS_DATA_SIZE];
uint8_t rnn_data[RNN_ID_SNS_DATA_SIZE];
uint8_t gan_data[GA_NXT_SNS_DATA_SIZE];
uint8_t gid_data[GID_PT_SNS_DATA_SIZE];
uint8_t gpn_data[GPN_ID_SNS_DATA_SIZE];
uint8_t gnn_data[GNN_ID_SNS_DATA_SIZE];
} p;
};
/* IO descriptors */ /* IO descriptors */
#define MAX_IO_DESCRIPTORS 32 #define MAX_IO_DESCRIPTORS 32
...@@ -2162,10 +2216,14 @@ typedef struct scsi_qla_host { ...@@ -2162,10 +2216,14 @@ typedef struct scsi_qla_host {
uint8_t rscn_in_ptr; uint8_t rscn_in_ptr;
uint8_t rscn_out_ptr; uint8_t rscn_out_ptr;
/* SNS command interfaces. */
ms_iocb_entry_t *ms_iocb; ms_iocb_entry_t *ms_iocb;
dma_addr_t ms_iocb_dma; dma_addr_t ms_iocb_dma;
struct ct_sns_pkt *ct_sns; struct ct_sns_pkt *ct_sns;
dma_addr_t ct_sns_dma; dma_addr_t ct_sns_dma;
/* SNS command interfaces for 2200. */
struct sns_cmd_pkt *sns_cmd;
dma_addr_t sns_cmd_dma;
pid_t dpc_pid; pid_t dpc_pid;
int dpc_should_die; int dpc_should_die;
......
This diff is collapsed.
...@@ -2921,6 +2921,24 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) ...@@ -2921,6 +2921,24 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
continue; continue;
} }
/* Allocate memory for SNS commands */
if (IS_QLA2200(ha)) {
/* Get consistent memory allocated for SNS commands */
ha->sns_cmd = pci_alloc_consistent(ha->pdev,
sizeof(struct sns_cmd_pkt), &ha->sns_cmd_dma);
if (ha->sns_cmd == NULL) {
/* error */
qla_printk(KERN_WARNING, ha,
"Memory Allocation failed - sns_cmd\n");
qla2x00_mem_free(ha);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ/10);
continue;
}
memset(ha->sns_cmd, 0, sizeof(struct sns_cmd_pkt));
} else if (!IS_QLA2100(ha)) {
/* Get consistent memory allocated for MS IOCB */ /* Get consistent memory allocated for MS IOCB */
ha->ms_iocb = pci_alloc_consistent(ha->pdev, ha->ms_iocb = pci_alloc_consistent(ha->pdev,
sizeof(ms_iocb_entry_t), &ha->ms_iocb_dma); sizeof(ms_iocb_entry_t), &ha->ms_iocb_dma);
...@@ -2937,7 +2955,10 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) ...@@ -2937,7 +2955,10 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
} }
memset(ha->ms_iocb, 0, sizeof(ms_iocb_entry_t)); memset(ha->ms_iocb, 0, sizeof(ms_iocb_entry_t));
/* Get consistent memory allocated for CT SNS commands */ /*
* Get consistent memory allocated for CT SNS
* commands
*/
ha->ct_sns = pci_alloc_consistent(ha->pdev, ha->ct_sns = pci_alloc_consistent(ha->pdev,
sizeof(struct ct_sns_pkt), &ha->ct_sns_dma); sizeof(struct ct_sns_pkt), &ha->ct_sns_dma);
if (ha->ct_sns == NULL) { if (ha->ct_sns == NULL) {
...@@ -2952,6 +2973,7 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha) ...@@ -2952,6 +2973,7 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
continue; continue;
} }
memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt)); memset(ha->ct_sns, 0, sizeof(struct ct_sns_pkt));
}
/* Get consistent memory allocated for Get Port Database cmd */ /* Get consistent memory allocated for Get Port Database cmd */
ha->iodesc_pd = pci_alloc_consistent(ha->pdev, ha->iodesc_pd = pci_alloc_consistent(ha->pdev,
...@@ -3027,6 +3049,12 @@ qla2x00_mem_free(scsi_qla_host_t *ha) ...@@ -3027,6 +3049,12 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
pci_free_consistent(ha->pdev, PORT_DATABASE_SIZE, pci_free_consistent(ha->pdev, PORT_DATABASE_SIZE,
ha->iodesc_pd, ha->iodesc_pd_dma); ha->iodesc_pd, ha->iodesc_pd_dma);
} }
if (ha->sns_cmd) {
pci_free_consistent(ha->pdev,
sizeof(struct sns_cmd_pkt), ha->sns_cmd, ha->sns_cmd_dma);
}
if (ha->ct_sns) { if (ha->ct_sns) {
pci_free_consistent(ha->pdev, pci_free_consistent(ha->pdev,
sizeof(struct ct_sns_pkt), ha->ct_sns, ha->ct_sns_dma); sizeof(struct ct_sns_pkt), ha->ct_sns, ha->ct_sns_dma);
......
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