Add initial support for 16Gbps FC QLogic chips.

I still don't know how to read NVRAM there, so WWNs and other parameters
are incorrect, but other then that driver seems like attaching normally.
This commit is contained in:
mav 2015-12-02 20:22:50 +00:00
parent f4698eb999
commit 7a42e48a34
4 changed files with 105 additions and 85 deletions

View File

@ -277,6 +277,9 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
case ISP_HA_FC_2500:
btype = "2532";
break;
case ISP_HA_FC_2600:
btype = "2031";
break;
default:
break;
}
@ -761,6 +764,7 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
code_org = ISP_CODE_ORG;
}
isp->isp_loaded_fw = 0;
if (dodnld && IS_24XX(isp)) {
const uint32_t *ptr = isp->isp_mdvec->dv_ispfw;
int wordload;
@ -956,8 +960,17 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
ISP_RESET0(isp);
return;
}
} else if (IS_26XX(isp)) {
MBSINIT(&mbs, MBOX_LOAD_FLASH_FIRMWARE, MBLOGALL, 5000000);
mbs.ibitm = 0x01;
mbs.obitm = 0x07;
isp_mboxcmd(isp, &mbs);
if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
isp_prt(isp, ISP_LOGERR, "Flash F/W load failed");
ISP_RESET0(isp);
return;
}
} else {
isp->isp_loaded_fw = 0;
isp_prt(isp, ISP_LOGDEBUG2, "skipping f/w download");
}
@ -966,7 +979,6 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
*/
if (isp->isp_loaded_fw) {
MBSINIT(&mbs, MBOX_VERIFY_CHECKSUM, MBLOGNONE, 0);
mbs.param[0] = MBOX_VERIFY_CHECKSUM;
if (IS_24XX(isp)) {
mbs.param[1] = code_org >> 16;
mbs.param[2] = code_org;
@ -998,9 +1010,6 @@ isp_reset(ispsoftc_t *isp, int do_load_defaults)
} else {
mbs.param[3] = 1;
}
if (IS_25XX(isp)) {
mbs.ibits |= 0x10;
}
} else if (IS_2322(isp)) {
mbs.param[1] = code_org;
if (isp->isp_loaded_fw) {
@ -1861,16 +1870,16 @@ isp_fibre_init(ispsoftc_t *isp)
icbp->icb_idelaytimer = 10;
}
icbp->icb_zfwoptions = fcp->isp_zfwoptions;
if (isp->isp_confopts & ISP_CFG_ONEGB) {
if (isp->isp_confopts & ISP_CFG_1GB) {
icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK;
icbp->icb_zfwoptions |= ICBZOPT_RATE_ONEGB;
} else if (isp->isp_confopts & ISP_CFG_TWOGB) {
icbp->icb_zfwoptions |= ICBZOPT_RATE_1GB;
} else if (isp->isp_confopts & ISP_CFG_2GB) {
icbp->icb_zfwoptions &= ~ICBZOPT_RATE_MASK;
icbp->icb_zfwoptions |= ICBZOPT_RATE_TWOGB;
icbp->icb_zfwoptions |= ICBZOPT_RATE_2GB;
} else {
switch (icbp->icb_zfwoptions & ICBZOPT_RATE_MASK) {
case ICBZOPT_RATE_ONEGB:
case ICBZOPT_RATE_TWOGB:
case ICBZOPT_RATE_1GB:
case ICBZOPT_RATE_2GB:
case ICBZOPT_RATE_AUTO:
break;
default:
@ -2126,14 +2135,16 @@ isp_fibre_init_2400(ispsoftc_t *isp)
icbp->icb_fwoptions3 |= ICB2400_OPT3_RSPSZ_24;
}
icbp->icb_fwoptions3 &= ~ICB2400_OPT3_RATE_AUTO;
if (isp->isp_confopts & ISP_CFG_ONEGB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_ONEGB;
} else if (isp->isp_confopts & ISP_CFG_TWOGB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_TWOGB;
} else if (isp->isp_confopts & ISP_CFG_FOURGB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_FOURGB;
} else if (IS_25XX(isp) && (isp->isp_confopts & ISP_CFG_EIGHTGB)) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_EIGHTGB;
if (isp->isp_confopts & ISP_CFG_1GB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_1GB;
} else if (isp->isp_confopts & ISP_CFG_2GB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_2GB;
} else if (isp->isp_confopts & ISP_CFG_4GB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_4GB;
} else if (isp->isp_confopts & ISP_CFG_8GB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_8GB;
} else if (isp->isp_confopts & ISP_CFG_16GB) {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_16GB;
} else {
icbp->icb_fwoptions3 |= ICB2400_OPT3_RATE_AUTO;
}
@ -6828,7 +6839,7 @@ static const char *scsi_mbcmd_names[] = {
static const uint32_t mbpfc[] = {
ISP_FC_OPMAP(0x01, 0x01), /* 0x00: MBOX_NO_OP */
ISP_FC_OPMAP(0x1f, 0x01), /* 0x01: MBOX_LOAD_RAM */
ISP_FC_OPMAP(0x0f, 0x01), /* 0x02: MBOX_EXEC_FIRMWARE */
ISP_FC_OPMAP_HALF(0x07, 0xff, 0x00, 0x03), /* 0x02: MBOX_EXEC_FIRMWARE */
ISP_FC_OPMAP(0xdf, 0x01), /* 0x03: MBOX_DUMP_RAM */
ISP_FC_OPMAP(0x07, 0x07), /* 0x04: MBOX_WRITE_RAM_WORD */
ISP_FC_OPMAP(0x03, 0x07), /* 0x05: MBOX_READ_RAM_WORD */

View File

@ -172,6 +172,18 @@ static struct ispmdvec mdvec_2500 = {
NULL
};
static struct ispmdvec mdvec_2600 = {
isp_pci_rd_isr_2400,
isp_pci_rd_reg_2400,
isp_pci_wr_reg_2400,
isp_pci_mbxdma,
isp_pci_dmasetup,
isp_common_dmateardown,
isp_pci_reset0,
isp_pci_reset1,
NULL
};
#ifndef PCIM_CMD_INVEN
#define PCIM_CMD_INVEN 0x10
#endif
@ -276,6 +288,10 @@ static struct ispmdvec mdvec_2500 = {
#define PCI_PRODUCT_QLOGIC_ISP5432 0x5432
#endif
#ifndef PCI_PRODUCT_QLOGIC_ISP2031
#define PCI_PRODUCT_QLOGIC_ISP2031 0x2031
#endif
#define PCI_QLOGIC_ISP5432 \
((PCI_PRODUCT_QLOGIC_ISP5432 << 16) | PCI_VENDOR_QLOGIC)
@ -327,14 +343,14 @@ static struct ispmdvec mdvec_2500 = {
#define PCI_QLOGIC_ISP6322 \
((PCI_PRODUCT_QLOGIC_ISP6322 << 16) | PCI_VENDOR_QLOGIC)
#define PCI_QLOGIC_ISP2031 \
((PCI_PRODUCT_QLOGIC_ISP2031 << 16) | PCI_VENDOR_QLOGIC)
/*
* Odd case for some AMI raid cards... We need to *not* attach to this.
*/
#define AMI_RAID_SUBVENDOR_ID 0x101e
#define IO_MAP_REG 0x10
#define MEM_MAP_REG 0x14
#define PCI_DFLT_LTNCY 0x40
#define PCI_DFLT_LNSZ 0x10
@ -434,6 +450,9 @@ isp_pci_probe(device_t dev)
case PCI_QLOGIC_ISP6322:
device_set_desc(dev, "Qlogic ISP 6322 PCI FC-AL Adapter");
break;
case PCI_QLOGIC_ISP2031:
device_set_desc(dev, "Qlogic ISP 2031 PCI FC-AL Adapter");
break;
default:
return (ENXIO);
}
@ -484,31 +503,6 @@ isp_get_generic_options(device_t dev, ispsoftc_t *isp)
isp_quickboot_time = tval;
}
static void
isp_get_pci_options(device_t dev, int *m1, int *m2)
{
int tval;
/*
* Which we should try first - memory mapping or i/o mapping?
*
* We used to try memory first followed by i/o on alpha, otherwise
* the reverse, but we should just try memory first all the time now.
*/
*m1 = PCIM_CMD_MEMEN;
*m2 = PCIM_CMD_PORTEN;
tval = 0;
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "prefer_iomap", &tval) == 0 && tval != 0) {
*m1 = PCIM_CMD_PORTEN;
*m2 = PCIM_CMD_MEMEN;
}
tval = 0;
if (resource_int_value(device_get_name(dev), device_get_unit(dev), "prefer_memmap", &tval) == 0 && tval != 0) {
*m1 = PCIM_CMD_MEMEN;
*m2 = PCIM_CMD_PORTEN;
}
}
static void
isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
{
@ -662,7 +656,7 @@ isp_get_specific_options(device_t dev, int chan, ispsoftc_t *isp)
static int
isp_pci_attach(device_t dev)
{
int i, m1, m2, locksetup = 0;
int i, locksetup = 0;
uint32_t data, cmd, linesz, did;
struct isp_pcisoftc *pcs;
ispsoftc_t *isp;
@ -689,33 +683,10 @@ isp_pci_attach(device_t dev)
isp_nvports = 0;
isp_get_generic_options(dev, isp);
/*
* Get PCI options- which in this case are just mapping preferences.
*/
isp_get_pci_options(dev, &m1, &m2);
linesz = PCI_DFLT_LNSZ;
pcs->irq = pcs->regs = NULL;
pcs->rgd = pcs->rtp = pcs->iqd = 0;
pcs->rtp = (m1 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
pcs->rgd = (m1 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG;
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd, RF_ACTIVE);
if (pcs->regs == NULL) {
pcs->rtp = (m2 == PCIM_CMD_MEMEN)? SYS_RES_MEMORY : SYS_RES_IOPORT;
pcs->rgd = (m2 == PCIM_CMD_MEMEN)? MEM_MAP_REG : IO_MAP_REG;
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd, RF_ACTIVE);
}
if (pcs->regs == NULL) {
device_printf(dev, "unable to map any ports\n");
goto bad;
}
if (bootverbose) {
device_printf(dev, "using %s space register mapping\n", (pcs->rgd == IO_MAP_REG)? "I/O" : "Memory");
}
isp->isp_bus_tag = rman_get_bustag(pcs->regs);
isp->isp_bus_handle = rman_get_bushandle(pcs->regs);
pcs->pci_dev = dev;
pcs->pci_poff[BIU_BLOCK >> _BLK_REG_SHFT] = BIU_REGS_OFF;
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS_OFF;
@ -823,6 +794,13 @@ isp_pci_attach(device_t dev)
isp->isp_type = ISP_HA_FC_2500;
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
break;
case PCI_QLOGIC_ISP2031:
did = 0x2600;
isp->isp_nchan += isp_nvports;
isp->isp_mdvec = &mdvec_2600;
isp->isp_type = ISP_HA_FC_2600;
pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = PCI_MBOX_REGS2400_OFF;
break;
default:
device_printf(dev, "unknown device type\n");
goto bad;
@ -830,6 +808,34 @@ isp_pci_attach(device_t dev)
}
isp->isp_revision = pci_get_revid(dev);
if (IS_26XX(isp)) {
pcs->rtp = SYS_RES_MEMORY;
pcs->rgd = PCIR_BAR(0);
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd,
RF_ACTIVE);
} else {
pcs->rtp = SYS_RES_MEMORY;
pcs->rgd = PCIR_BAR(1);
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp, &pcs->rgd,
RF_ACTIVE);
if (pcs->regs == NULL) {
pcs->rtp = SYS_RES_IOPORT;
pcs->rgd = PCIR_BAR(0);
pcs->regs = bus_alloc_resource_any(dev, pcs->rtp,
&pcs->rgd, RF_ACTIVE);
}
}
if (pcs->regs == NULL) {
device_printf(dev, "Unable to map any ports\n");
goto bad;
}
if (bootverbose) {
device_printf(dev, "Using %s space register mapping\n",
(pcs->rtp == SYS_RES_IOPORT)? "I/O" : "Memory");
}
isp->isp_bus_tag = rman_get_bustag(pcs->regs);
isp->isp_bus_handle = rman_get_bushandle(pcs->regs);
if (IS_FC(isp)) {
psize = sizeof (fcparam);
xsize = sizeof (struct isp_fc);

View File

@ -122,6 +122,7 @@
#define MBOX_GET_TARGET_STATUS 0x0056
/* These are for the ISP2X00 FC cards */
#define MBOX_LOAD_FLASH_FIRMWARE 0x0003
#define MBOX_WRITE_FC_SERDES_REG 0x0003 /* FC only */
#define MBOX_READ_FC_SERDES_REG 0x0004 /* FC only */
#define MBOX_GET_IO_STATUS 0x0012
@ -1007,9 +1008,9 @@ typedef struct {
#define ICBXOPT_TIMER_MASK 0x7
#define ICBZOPT_RATE_MASK 0xC000
#define ICBZOPT_RATE_ONEGB 0x0000
#define ICBZOPT_RATE_1GB 0x0000
#define ICBZOPT_RATE_AUTO 0x8000
#define ICBZOPT_RATE_TWOGB 0x4000
#define ICBZOPT_RATE_2GB 0x4000
#define ICBZOPT_50_OHM 0x2000
#define ICBZOPT_NO_LOCAL_PLOGI 0x0080
#define ICBZOPT_ENA_OOF 0x0040 /* out of order frame handling */
@ -1058,14 +1059,14 @@ typedef struct {
#define ICB2400_OPT3_ENA_ETH_RESP 0x08000000
#define ICB2400_OPT3_ENA_ETH_ATIO 0x04000000
#define ICB2400_OPT3_ENA_MFCF 0x00020000
#define ICB2400_OPT3_SKIP_FOURGB 0x00010000
#define ICB2400_OPT3_SKIP_4GB 0x00010000
#define ICB2400_OPT3_RATE_MASK 0x0000E000
#define ICB2400_OPT3_RATE_ONEGB 0x00000000
#define ICB2400_OPT3_RATE_TWOGB 0x00002000
#define ICB2400_OPT3_RATE_1GB 0x00000000
#define ICB2400_OPT3_RATE_2GB 0x00002000
#define ICB2400_OPT3_RATE_AUTO 0x00004000
#define ICB2400_OPT3_RATE_FOURGB 0x00006000
#define ICB2400_OPT3_RATE_EIGHTGB 0x00008000
#define ICB2400_OPT3_RATE_SIXTEENGB 0x0000A000
#define ICB2400_OPT3_RATE_4GB 0x00006000
#define ICB2400_OPT3_RATE_8GB 0x00008000
#define ICB2400_OPT3_RATE_16GB 0x0000A000
#define ICB2400_OPT3_ENA_OOF_XFRDY 0x00000200
#define ICB2400_OPT3_NO_N2N_LOGI 0x00000100
#define ICB2400_OPT3_NO_LOCAL_PLOGI 0x00000080

View File

@ -653,8 +653,8 @@ struct ispsoftc {
#define ISP_CFG_NPORT 0x04 /* prefer {N/F}-Port connection */
#define ISP_CFG_NPORT_ONLY 0x08 /* insist on {N/F}-Port connection */
#define ISP_CFG_LPORT_ONLY 0x0c /* insist on {N/F}L-Port connection */
#define ISP_CFG_ONEGB 0x10 /* force 1GB connection (23XX only) */
#define ISP_CFG_TWOGB 0x20 /* force 2GB connection (23XX only) */
#define ISP_CFG_1GB 0x10 /* force 1GB connection (23XX only) */
#define ISP_CFG_2GB 0x20 /* force 2GB connection (23XX only) */
#define ISP_CFG_NORELOAD 0x80 /* don't download f/w */
#define ISP_CFG_NONVRAM 0x40 /* ignore NVRAM */
#define ISP_CFG_NOFCTAPE 0x100 /* disable FC-Tape */
@ -662,9 +662,9 @@ struct ispsoftc {
#define ISP_CFG_OWNFSZ 0x400 /* override NVRAM frame size */
#define ISP_CFG_OWNLOOPID 0x800 /* override NVRAM loopid */
#define ISP_CFG_OWNEXCTHROTTLE 0x1000 /* override NVRAM execution throttle */
#define ISP_CFG_FOURGB 0x2000 /* force 4GB connection (24XX only) */
#define ISP_CFG_EIGHTGB 0x4000 /* force 8GB connection (25XX only) */
#define ISP_CFG_SIXTEENGB 0x8000 /* force 16GB connection (82XX only) */
#define ISP_CFG_4GB 0x2000 /* force 4GB connection (24XX only) */
#define ISP_CFG_8GB 0x4000 /* force 8GB connection (25XX only) */
#define ISP_CFG_16GB 0x8000 /* force 16GB connection (82XX only) */
/*
* For each channel, the outer layers should know what role that channel
@ -764,6 +764,7 @@ struct ispsoftc {
#define ISP_HA_FC_2322 0x50
#define ISP_HA_FC_2400 0x60
#define ISP_HA_FC_2500 0x70
#define ISP_HA_FC_2600 0x80
#define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI)
#define IS_1020(isp) (isp->isp_type < ISP_HA_SCSI_1240)
@ -789,6 +790,7 @@ struct ispsoftc {
#define IS_2322(isp) ((isp)->isp_type == ISP_HA_FC_2322)
#define IS_24XX(isp) ((isp)->isp_type >= ISP_HA_FC_2400)
#define IS_25XX(isp) ((isp)->isp_type >= ISP_HA_FC_2500)
#define IS_26XX(isp) ((isp)->isp_type >= ISP_HA_FC_2600)
/*
* DMA related macros