aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnirban Chakraborty <anirban.chakraborty@qlogic.com>2009-04-07 01:33:50 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-05-20 18:21:11 -0400
commite5b68a61e15ca8e200c60cfd4dbe1818e6beb4e1 (patch)
tree3efb29e4cca6868e7a5775589d877fb6e30639ac
parente337d9070e5821e7c8e5973679bdd34376263bd1 (diff)
[SCSI] qla2xxx: Use port number to compute nvram/vpd parameter offsets.
Read adapter's physical port number from interrupt pin register and use it instead of pci function number to offset into the nvram to obtain the port's configuration parameters. Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com> Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h4
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c19
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_sup.c18
4 files changed, 30 insertions, 18 deletions
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6911b9b32fe..721bae94e43 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2222,6 +2222,7 @@ struct qla_hw_data {
2222 uint32_t fce_enabled :1; 2222 uint32_t fce_enabled :1;
2223 uint32_t fac_supported :1; 2223 uint32_t fac_supported :1;
2224 uint32_t chip_reset_done :1; 2224 uint32_t chip_reset_done :1;
2225 uint32_t port0 :1;
2225 } flags; 2226 } flags;
2226 2227
2227 /* This spinlock is used to protect "io transactions", you must 2228 /* This spinlock is used to protect "io transactions", you must
@@ -2256,6 +2257,9 @@ struct qla_hw_data {
2256#define FLOGI_MID_SUPPORT BIT_10 2257#define FLOGI_MID_SUPPORT BIT_10
2257#define FLOGI_VSAN_SUPPORT BIT_12 2258#define FLOGI_VSAN_SUPPORT BIT_12
2258#define FLOGI_SP_SUPPORT BIT_13 2259#define FLOGI_SP_SUPPORT BIT_13
2260
2261 uint8_t port_no; /* Physical port of adapter */
2262
2259 /* Timeout timers. */ 2263 /* Timeout timers. */
2260 uint8_t loop_down_abort_time; /* port down timer */ 2264 uint8_t loop_down_abort_time; /* port down timer */
2261 atomic_t loop_down_timer; /* loop down timer */ 2265 atomic_t loop_down_timer; /* loop down timer */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 4952fc19aa2..33e92481066 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3573,14 +3573,15 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
3573 nv = ha->nvram; 3573 nv = ha->nvram;
3574 3574
3575 /* Determine NVRAM starting address. */ 3575 /* Determine NVRAM starting address. */
3576 ha->nvram_size = sizeof(struct nvram_24xx); 3576 if (ha->flags.port0) {
3577 ha->nvram_base = FA_NVRAM_FUNC0_ADDR; 3577 ha->nvram_base = FA_NVRAM_FUNC0_ADDR;
3578 ha->vpd_size = FA_NVRAM_VPD_SIZE; 3578 ha->vpd_base = FA_NVRAM_VPD0_ADDR;
3579 ha->vpd_base = FA_NVRAM_VPD0_ADDR; 3579 } else {
3580 if (PCI_FUNC(ha->pdev->devfn)) {
3581 ha->nvram_base = FA_NVRAM_FUNC1_ADDR; 3580 ha->nvram_base = FA_NVRAM_FUNC1_ADDR;
3582 ha->vpd_base = FA_NVRAM_VPD1_ADDR; 3581 ha->vpd_base = FA_NVRAM_VPD1_ADDR;
3583 } 3582 }
3583 ha->nvram_size = sizeof(struct nvram_24xx);
3584 ha->vpd_size = FA_NVRAM_VPD_SIZE;
3584 3585
3585 /* Get VPD data into cache */ 3586 /* Get VPD data into cache */
3586 ha->vpd = ha->nvram + VPD_OFFSET; 3587 ha->vpd = ha->nvram + VPD_OFFSET;
@@ -3619,7 +3620,7 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
3619 nv->exchange_count = __constant_cpu_to_le16(0); 3620 nv->exchange_count = __constant_cpu_to_le16(0);
3620 nv->hard_address = __constant_cpu_to_le16(124); 3621 nv->hard_address = __constant_cpu_to_le16(124);
3621 nv->port_name[0] = 0x21; 3622 nv->port_name[0] = 0x21;
3622 nv->port_name[1] = 0x00 + PCI_FUNC(ha->pdev->devfn); 3623 nv->port_name[1] = 0x00 + ha->port_no;
3623 nv->port_name[2] = 0x00; 3624 nv->port_name[2] = 0x00;
3624 nv->port_name[3] = 0xe0; 3625 nv->port_name[3] = 0xe0;
3625 nv->port_name[4] = 0x8b; 3626 nv->port_name[4] = 0x8b;
@@ -4348,7 +4349,7 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
4348 nv->execution_throttle = __constant_cpu_to_le16(0xFFFF); 4349 nv->execution_throttle = __constant_cpu_to_le16(0xFFFF);
4349 nv->exchange_count = __constant_cpu_to_le16(0); 4350 nv->exchange_count = __constant_cpu_to_le16(0);
4350 nv->port_name[0] = 0x21; 4351 nv->port_name[0] = 0x21;
4351 nv->port_name[1] = 0x00 + PCI_FUNC(ha->pdev->devfn); 4352 nv->port_name[1] = 0x00 + ha->port_no;
4352 nv->port_name[2] = 0x00; 4353 nv->port_name[2] = 0x00;
4353 nv->port_name[3] = 0xe0; 4354 nv->port_name[3] = 0xe0;
4354 nv->port_name[4] = 0x8b; 4355 nv->port_name[4] = 0x8b;
@@ -4382,7 +4383,7 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
4382 nv->enode_mac[2] = 0x03; 4383 nv->enode_mac[2] = 0x03;
4383 nv->enode_mac[3] = 0x04; 4384 nv->enode_mac[3] = 0x04;
4384 nv->enode_mac[4] = 0x05; 4385 nv->enode_mac[4] = 0x05;
4385 nv->enode_mac[5] = 0x06 + PCI_FUNC(ha->pdev->devfn); 4386 nv->enode_mac[5] = 0x06 + ha->port_no;
4386 4387
4387 rval = 1; 4388 rval = 1;
4388 } 4389 }
@@ -4415,7 +4416,7 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
4415 icb->enode_mac[2] = 0x03; 4416 icb->enode_mac[2] = 0x03;
4416 icb->enode_mac[3] = 0x04; 4417 icb->enode_mac[3] = 0x04;
4417 icb->enode_mac[4] = 0x05; 4418 icb->enode_mac[4] = 0x05;
4418 icb->enode_mac[5] = 0x06 + PCI_FUNC(ha->pdev->devfn); 4419 icb->enode_mac[5] = 0x06 + ha->port_no;
4419 } 4420 }
4420 4421
4421 /* Use extended-initialization control block. */ 4422 /* Use extended-initialization control block. */
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 88a75d0a8d7..f4f53553695 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1581,6 +1581,13 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
1581 ha->fw_srisc_address = RISC_START_ADDRESS_2400; 1581 ha->fw_srisc_address = RISC_START_ADDRESS_2400;
1582 break; 1582 break;
1583 } 1583 }
1584
1585 /* Get adapter physical port no from interrupt pin register. */
1586 pci_read_config_byte(ha->pdev, PCI_INTERRUPT_PIN, &ha->port_no);
1587 if (ha->port_no & 1)
1588 ha->flags.port0 = 1;
1589 else
1590 ha->flags.port0 = 0;
1584} 1591}
1585 1592
1586static int 1593static int
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 2a9b3f83ba6..22f97eb50cf 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -702,30 +702,30 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
702 break; 702 break;
703 case FLT_REG_VPD_0: 703 case FLT_REG_VPD_0:
704 ha->flt_region_vpd_nvram = start; 704 ha->flt_region_vpd_nvram = start;
705 if (!(PCI_FUNC(ha->pdev->devfn) & 1)) 705 if (ha->flags.port0)
706 ha->flt_region_vpd = start; 706 ha->flt_region_vpd = start;
707 break; 707 break;
708 case FLT_REG_VPD_1: 708 case FLT_REG_VPD_1:
709 if (PCI_FUNC(ha->pdev->devfn) & 1) 709 if (!ha->flags.port0)
710 ha->flt_region_vpd = start; 710 ha->flt_region_vpd = start;
711 break; 711 break;
712 case FLT_REG_NVRAM_0: 712 case FLT_REG_NVRAM_0:
713 if (!(PCI_FUNC(ha->pdev->devfn) & 1)) 713 if (ha->flags.port0)
714 ha->flt_region_nvram = start; 714 ha->flt_region_nvram = start;
715 break; 715 break;
716 case FLT_REG_NVRAM_1: 716 case FLT_REG_NVRAM_1:
717 if (PCI_FUNC(ha->pdev->devfn) & 1) 717 if (!ha->flags.port0)
718 ha->flt_region_nvram = start; 718 ha->flt_region_nvram = start;
719 break; 719 break;
720 case FLT_REG_FDT: 720 case FLT_REG_FDT:
721 ha->flt_region_fdt = start; 721 ha->flt_region_fdt = start;
722 break; 722 break;
723 case FLT_REG_NPIV_CONF_0: 723 case FLT_REG_NPIV_CONF_0:
724 if (!(PCI_FUNC(ha->pdev->devfn) & 1)) 724 if (ha->flags.port0)
725 ha->flt_region_npiv_conf = start; 725 ha->flt_region_npiv_conf = start;
726 break; 726 break;
727 case FLT_REG_NPIV_CONF_1: 727 case FLT_REG_NPIV_CONF_1:
728 if (PCI_FUNC(ha->pdev->devfn) & 1) 728 if (!ha->flags.port0)
729 ha->flt_region_npiv_conf = start; 729 ha->flt_region_npiv_conf = start;
730 break; 730 break;
731 } 731 }
@@ -745,12 +745,12 @@ no_flash_data:
745 ha->flt_region_fw = def_fw[def]; 745 ha->flt_region_fw = def_fw[def];
746 ha->flt_region_boot = def_boot[def]; 746 ha->flt_region_boot = def_boot[def];
747 ha->flt_region_vpd_nvram = def_vpd_nvram[def]; 747 ha->flt_region_vpd_nvram = def_vpd_nvram[def];
748 ha->flt_region_vpd = !(PCI_FUNC(ha->pdev->devfn) & 1) ? 748 ha->flt_region_vpd = ha->flags.port0 ?
749 def_vpd0[def]: def_vpd1[def]; 749 def_vpd0[def]: def_vpd1[def];
750 ha->flt_region_nvram = !(PCI_FUNC(ha->pdev->devfn) & 1) ? 750 ha->flt_region_nvram = ha->flags.port0 ?
751 def_nvram0[def]: def_nvram1[def]; 751 def_nvram0[def]: def_nvram1[def];
752 ha->flt_region_fdt = def_fdt[def]; 752 ha->flt_region_fdt = def_fdt[def];
753 ha->flt_region_npiv_conf = !(PCI_FUNC(ha->pdev->devfn) & 1) ? 753 ha->flt_region_npiv_conf = ha->flags.port0 ?
754 def_npiv_conf0[def]: def_npiv_conf1[def]; 754 def_npiv_conf0[def]: def_npiv_conf1[def];
755done: 755done:
756 DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x " 756 DEBUG2(qla_printk(KERN_DEBUG, ha, "FLT[%s]: boot=0x%x fw=0x%x "