Date: Tue, 22 Dec 2015 13:19:30 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r292598 - in stable/10: share/man/man4 sys/dev/isp Message-ID: <201512221319.tBMDJUCc012838@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Tue Dec 22 13:19:29 2015 New Revision: 292598 URL: https://svnweb.freebsd.org/changeset/base/292598 Log: MFC r291654, r291727, r291821, r291872, r292034, r292041, r292249, r292042: Add initial support for 16Gbps FC QLogic chips. Modified: stable/10/share/man/man4/isp.4 stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/isp_pci.c stable/10/sys/dev/isp/isp_sbus.c stable/10/sys/dev/isp/ispmbox.h stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/isp.4 ============================================================================== --- stable/10/share/man/man4/isp.4 Tue Dec 22 12:54:13 2015 (r292597) +++ stable/10/share/man/man4/isp.4 Tue Dec 22 13:19:29 2015 (r292598) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2015 +.Dd December 9, 2015 .Dt ISP 4 .Os .Sh NAME @@ -107,10 +107,12 @@ Optical 2Gb Fibre Channel PCIe cards. Dell branded version of the QLogic 2312. .It Qlogic 2422 Optical 4Gb Fibre Channel PCI cards. -.It Qlogic 2432 +.It Qlogic 246x (aka 2432) Optical 4Gb Fibre Channel PCIe cards. -.It Qlogic 2532 +.It Qlogic 256x (aka 2532) Optical 8Gb Fibre Channel PCIe cards. +.It Qlogic 267x/836x (aka 2031/8031) +Optical 16Gb FC/FCoE PCIe cards. .El .Sh CONFIGURATION OPTIONS Target mode support for Fibre Channel adapters may be enabled with the @@ -127,12 +129,6 @@ They are: .It Va hint.isp.0.fwload_disable A hint value to disable loading of firmware .Xr ispfw 4 . -.It Va hint.isp.0.prefer_memmap -A hint value to use PCI memory space instead of I/O space -access for. -.It Va hint.isp.0.prefer_iomap -A hint value to use PCI I/O space instead of Memory space -access for. .It Va hint.isp.0.ignore_nvram A hint value to ignore board NVRAM settings for. Otherwise use NVRAM settings. Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Tue Dec 22 12:54:13 2015 (r292597) +++ stable/10/sys/dev/isp/isp.c Tue Dec 22 13:19:29 2015 (r292598) @@ -277,6 +277,9 @@ isp_reset(ispsoftc_t *isp, int do_load_d case ISP_HA_FC_2500: btype = "2532"; break; + case ISP_HA_FC_2600: + btype = "2031"; + break; default: break; } @@ -655,8 +658,10 @@ isp_reset(ispsoftc_t *isp, int do_load_d ISP_WRITE(isp, isp->isp_respinrp, 0); ISP_WRITE(isp, isp->isp_respoutrp, 0); if (IS_24XX(isp)) { - ISP_WRITE(isp, BIU2400_PRI_REQINP, 0); - ISP_WRITE(isp, BIU2400_PRI_REQOUTP, 0); + if (!IS_26XX(isp)) { + ISP_WRITE(isp, BIU2400_PRI_REQINP, 0); + ISP_WRITE(isp, BIU2400_PRI_REQOUTP, 0); + } ISP_WRITE(isp, BIU2400_ATIO_RSPINP, 0); ISP_WRITE(isp, BIU2400_ATIO_RSPOUTP, 0); } @@ -761,6 +766,7 @@ isp_reset(ispsoftc_t *isp, int do_load_d 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 +962,17 @@ isp_reset(ispsoftc_t *isp, int do_load_d 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 +981,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d */ 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 +1012,6 @@ isp_reset(ispsoftc_t *isp, int do_load_d } 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 +1872,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: @@ -2122,18 +2133,26 @@ isp_fibre_init_2400(ispsoftc_t *isp) break; } + if (IS_26XX(isp)) { + /* We don't support MSI-X yet, so set this unconditionally. */ + icbp->icb_fwoptions2 |= ICB2400_OPT2_ENA_IHR; + icbp->icb_fwoptions2 |= ICB2400_OPT2_ENA_IHA; + } + if ((icbp->icb_fwoptions3 & ICB2400_OPT3_RSPSZ_MASK) == 0) { 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 +6847,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 */ @@ -7602,6 +7621,8 @@ isp_setdfltfcparm(ispsoftc_t *isp, int c fcp->isp_wwnn_nvram = DEFAULT_NODEWWN(isp, chan); fcp->isp_wwpn_nvram = DEFAULT_PORTWWN(isp, chan); fcp->isp_fwoptions = 0; + fcp->isp_xfwoptions = 0; + fcp->isp_zfwoptions = 0; fcp->isp_lasthdl = NIL_HANDLE; if (IS_24XX(isp)) { @@ -7899,7 +7920,9 @@ isp_rd_2400_nvram(ispsoftc_t *isp, uint3 uint32_t base = 0x7ffe0000; uint32_t tmp = 0; - if (IS_25XX(isp)) { + if (IS_26XX(isp)) { + base = 0x7fe7c000; /* XXX: Observation, may be wrong. */ + } else if (IS_25XX(isp)) { base = 0x7ff00000 | 0x48000; } ISP_WRITE(isp, BIU2400_FLASH_ADDR, base | addr); Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Tue Dec 22 12:54:13 2015 (r292597) +++ stable/10/sys/dev/isp/isp_freebsd.h Tue Dec 22 13:19:29 2015 (r292598) @@ -38,6 +38,7 @@ #include <sys/malloc.h> #include <sys/mutex.h> #include <sys/condvar.h> +#include <sys/rman.h> #include <sys/sysctl.h> #include <sys/proc.h> @@ -286,9 +287,9 @@ struct isposinfo { /* * DMA related sdtuff */ - bus_space_tag_t bus_tag; + struct resource * regs; + struct resource * regs2; bus_dma_tag_t dmat; - bus_space_handle_t bus_handle; bus_dma_tag_t cdmat; bus_dmamap_t cdmap; @@ -361,8 +362,8 @@ struct isposinfo { #define FCP_NEXT_CRN isp_fcp_next_crn #define isp_lock isp_osinfo.lock -#define isp_bus_tag isp_osinfo.bus_tag -#define isp_bus_handle isp_osinfo.bus_handle +#define isp_regs isp_osinfo.regs +#define isp_regs2 isp_osinfo.regs2 /* * Locking macros... @@ -430,8 +431,7 @@ case SYNC_RESULT: \ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ break; \ case SYNC_REG: \ - bus_space_barrier(isp->isp_osinfo.bus_tag, \ - isp->isp_osinfo.bus_handle, offset, size, \ + bus_barrier(isp->isp_osinfo.regs, offset, size, \ BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); \ break; \ default: \ @@ -463,8 +463,7 @@ case SYNC_RESULT: \ isp->isp_osinfo.cdmap, BUS_DMASYNC_POSTWRITE); \ break; \ case SYNC_REG: \ - bus_space_barrier(isp->isp_osinfo.bus_tag, \ - isp->isp_osinfo.bus_handle, offset, size, \ + bus_barrier(isp->isp_osinfo.regs, offset, size, \ BUS_SPACE_BARRIER_WRITE); \ break; \ default: \ Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Tue Dec 22 12:54:13 2015 (r292597) +++ stable/10/sys/dev/isp/isp_pci.c Tue Dec 22 13:19:29 2015 (r292598) @@ -59,6 +59,8 @@ static uint32_t isp_pci_rd_reg_1080(isps static void isp_pci_wr_reg_1080(ispsoftc_t *, int, uint32_t); static uint32_t isp_pci_rd_reg_2400(ispsoftc_t *, int); static void isp_pci_wr_reg_2400(ispsoftc_t *, int, uint32_t); +static uint32_t isp_pci_rd_reg_2600(ispsoftc_t *, int); +static void isp_pci_wr_reg_2600(ispsoftc_t *, int, uint32_t); static int isp_pci_rd_isr(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); static int isp_pci_rd_isr_2300(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); static int isp_pci_rd_isr_2400(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); @@ -172,6 +174,18 @@ static struct ispmdvec mdvec_2500 = { NULL }; +static struct ispmdvec mdvec_2600 = { + isp_pci_rd_isr_2400, + isp_pci_rd_reg_2600, + isp_pci_wr_reg_2600, + 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 +290,14 @@ static struct ispmdvec mdvec_2500 = { #define PCI_PRODUCT_QLOGIC_ISP5432 0x5432 #endif +#ifndef PCI_PRODUCT_QLOGIC_ISP2031 +#define PCI_PRODUCT_QLOGIC_ISP2031 0x2031 +#endif + +#ifndef PCI_PRODUCT_QLOGIC_ISP8031 +#define PCI_PRODUCT_QLOGIC_ISP8031 0x8031 +#endif + #define PCI_QLOGIC_ISP5432 \ ((PCI_PRODUCT_QLOGIC_ISP5432 << 16) | PCI_VENDOR_QLOGIC) @@ -327,14 +349,17 @@ 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) + +#define PCI_QLOGIC_ISP8031 \ + ((PCI_PRODUCT_QLOGIC_ISP8031 << 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 @@ -348,10 +373,16 @@ struct isp_pcisoftc { ispsoftc_t pci_isp; device_t pci_dev; struct resource * regs; + struct resource * regs1; + struct resource * regs2; void * irq; int iqd; int rtp; int rgd; + int rtp1; + int rgd1; + int rtp2; + int rgd2; void * ih; int16_t pci_poff[_NREG_BLKS]; bus_dma_tag_t dmat; @@ -434,6 +465,12 @@ 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; + case PCI_QLOGIC_ISP8031: + device_set_desc(dev, "Qlogic ISP 8031 PCI FCoE Adapter"); + break; default: return (ENXIO); } @@ -485,31 +522,6 @@ isp_get_generic_options(device_t dev, is } 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) { const char *sptr; @@ -662,7 +674,7 @@ isp_get_specific_options(device_t dev, i 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 +701,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->irq = pcs->regs = pcs->regs2 = 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 +812,14 @@ 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: + case PCI_QLOGIC_ISP8031: + 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 +827,42 @@ 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); + pcs->rtp1 = SYS_RES_MEMORY; + pcs->rgd1 = PCIR_BAR(2); + pcs->regs1 = bus_alloc_resource_any(dev, pcs->rtp1, &pcs->rgd1, + RF_ACTIVE); + pcs->rtp2 = SYS_RES_MEMORY; + pcs->rgd2 = PCIR_BAR(4); + pcs->regs2 = bus_alloc_resource_any(dev, pcs->rtp2, &pcs->rgd2, + 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_regs = pcs->regs; + isp->isp_regs2 = pcs->regs2; + if (IS_FC(isp)) { psize = sizeof (fcparam); xsize = sizeof (struct isp_fc); @@ -910,20 +943,28 @@ isp_pci_attach(device_t dev) data &= ~1; pci_write_config(dev, PCIR_ROMADDR, data, 4); - /* - * Do MSI - * - * NB: MSI-X needs to be disabled for the 2432 (PCI-Express) - */ - if (IS_24XX(isp) || IS_2322(isp)) { - pcs->msicount = pci_msi_count(dev); - if (pcs->msicount > 1) { - pcs->msicount = 1; + if (IS_26XX(isp)) { + /* 26XX chips support only MSI-X, so start from them. */ + pcs->msicount = imin(pci_msix_count(dev), 1); + if (pcs->msicount > 0 && + (i = pci_alloc_msix(dev, &pcs->msicount)) == 0) { + pcs->iqd = 1; + } else { + pcs->msicount = 0; } - if (pci_alloc_msi(dev, &pcs->msicount) == 0) { + } + if (pcs->msicount == 0 && (IS_24XX(isp) || IS_2322(isp))) { + /* + * Older chips support both MSI and MSI-X, but I have + * feeling that older firmware may not support MSI-X, + * but we have no way to check the firmware flag here. + */ + pcs->msicount = imin(pci_msi_count(dev), 1); + if (pcs->msicount > 0 && + pci_alloc_msi(dev, &pcs->msicount) == 0) { pcs->iqd = 1; } else { - pcs->iqd = 0; + pcs->msicount = 0; } } pcs->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &pcs->iqd, RF_ACTIVE | RF_SHAREABLE); @@ -978,9 +1019,12 @@ bad: if (pcs->msicount) { pci_release_msi(dev); } - if (pcs->regs) { + if (pcs->regs) (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); - } + if (pcs->regs1) + (void) bus_release_resource(dev, pcs->rtp1, pcs->rgd1, pcs->regs1); + if (pcs->regs2) + (void) bus_release_resource(dev, pcs->rtp2, pcs->rgd2, pcs->regs2); if (pcs->pci_isp.isp_param) { free(pcs->pci_isp.isp_param, M_DEVBUF); pcs->pci_isp.isp_param = NULL; @@ -1019,6 +1063,10 @@ isp_pci_detach(device_t dev) pci_release_msi(dev); } (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); + if (pcs->regs1) + (void) bus_release_resource(dev, pcs->rtp1, pcs->rgd1, pcs->regs1); + if (pcs->regs2) + (void) bus_release_resource(dev, pcs->rtp2, pcs->rgd2, pcs->regs2); /* * XXX: THERE IS A LOT OF LEAKAGE HERE */ @@ -1037,15 +1085,12 @@ isp_pci_detach(device_t dev) (((struct isp_pcisoftc *)a)->pci_poff[((x) & _BLK_REG_MASK) >> \ _BLK_REG_SHFT] + ((x) & 0xfff)) -#define BXR2(isp, off) \ - bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, off) -#define BXW2(isp, off, v) \ - bus_space_write_2(isp->isp_bus_tag, isp->isp_bus_handle, off, v) -#define BXR4(isp, off) \ - bus_space_read_4(isp->isp_bus_tag, isp->isp_bus_handle, off) -#define BXW4(isp, off, v) \ - bus_space_write_4(isp->isp_bus_tag, isp->isp_bus_handle, off, v) - +#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off)) +#define BXW2(isp, off, v) bus_write_2((isp)->isp_regs, (off), (v)) +#define BXR4(isp, off) bus_read_4((isp)->isp_regs, (off)) +#define BXW4(isp, off, v) bus_write_4((isp)->isp_regs, (off), (v)) +#define B2R4(isp, off) bus_read_4((isp)->isp_regs2, (off)) +#define B2W4(isp, off, v) bus_write_4((isp)->isp_regs2, (off), (v)) static ISP_INLINE int isp_pci_rd_debounced(ispsoftc_t *isp, int off, uint16_t *rp) @@ -1308,20 +1353,19 @@ isp_pci_rd_reg_2400(ispsoftc_t *isp, int case MBOX_BLOCK: return (BXR2(isp, IspVirt2Off(isp, regoff))); case SXP_BLOCK: - isp_prt(isp, ISP_LOGWARN, "SXP_BLOCK read at 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "SXP_BLOCK read at 0x%x", regoff); return (0xffffffff); case RISC_BLOCK: - isp_prt(isp, ISP_LOGWARN, "RISC_BLOCK read at 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "RISC_BLOCK read at 0x%x", regoff); return (0xffffffff); case DMA_BLOCK: - isp_prt(isp, ISP_LOGWARN, "DMA_BLOCK read at 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "DMA_BLOCK read at 0x%x", regoff); return (0xffffffff); default: - isp_prt(isp, ISP_LOGWARN, "unknown block read at 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "unknown block read at 0x%x", regoff); return (0xffffffff); } - switch (regoff) { case BIU2400_FLASH_ADDR: case BIU2400_FLASH_DATA: @@ -1349,8 +1393,8 @@ isp_pci_rd_reg_2400(ispsoftc_t *isp, int rv = BXR4(isp, IspVirt2Off(isp, regoff)) >> 16; break; default: - isp_prt(isp, ISP_LOGERR, - "isp_pci_rd_reg_2400: unknown offset %x", regoff); + isp_prt(isp, ISP_LOGERR, "unknown register read at 0x%x", + regoff); rv = 0xffffffff; break; } @@ -1370,17 +1414,16 @@ isp_pci_wr_reg_2400(ispsoftc_t *isp, int MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 2, -1); return; case SXP_BLOCK: - isp_prt(isp, ISP_LOGWARN, "SXP_BLOCK write at 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "SXP_BLOCK write at 0x%x", regoff); return; case RISC_BLOCK: - isp_prt(isp, ISP_LOGWARN, "RISC_BLOCK write at 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "RISC_BLOCK write at 0x%x", regoff); return; case DMA_BLOCK: - isp_prt(isp, ISP_LOGWARN, "DMA_BLOCK write at 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "DMA_BLOCK write at 0x%x", regoff); return; default: - isp_prt(isp, ISP_LOGWARN, "unknown block write at 0x%x", - regoff); + isp_prt(isp, ISP_LOGERR, "unknown block write at 0x%x", regoff); break; } @@ -1415,10 +1458,83 @@ isp_pci_wr_reg_2400(ispsoftc_t *isp, int MEMORYBARRIER(isp, SYNC_REG, IspVirt2Off(isp, regoff), 4, -1); break; default: - isp_prt(isp, ISP_LOGERR, - "isp_pci_wr_reg_2400: bad offset 0x%x", regoff); + isp_prt(isp, ISP_LOGERR, "unknown register write at 0x%x", + regoff); + break; + } +} + +static uint32_t +isp_pci_rd_reg_2600(ispsoftc_t *isp, int regoff) +{ + uint32_t rv; + + switch (regoff) { + case BIU2400_PRI_REQINP: + case BIU2400_PRI_REQOUTP: + isp_prt(isp, ISP_LOGERR, "unknown register read at 0x%x", + regoff); + rv = 0xffffffff; + break; + case BIU2400_REQINP: + rv = B2R4(isp, 0x00); + break; + case BIU2400_REQOUTP: + rv = B2R4(isp, 0x04); break; + case BIU2400_RSPINP: + rv = B2R4(isp, 0x08); + break; + case BIU2400_RSPOUTP: + rv = B2R4(isp, 0x0c); + break; + case BIU2400_ATIO_RSPINP: + rv = B2R4(isp, 0x10); + break; + case BIU2400_ATIO_RSPOUTP: + rv = B2R4(isp, 0x14); + break; + default: + rv = isp_pci_rd_reg_2400(isp, regoff); + break; + } + return (rv); +} + +static void +isp_pci_wr_reg_2600(ispsoftc_t *isp, int regoff, uint32_t val) +{ + int off; + + switch (regoff) { + case BIU2400_PRI_REQINP: + case BIU2400_PRI_REQOUTP: + isp_prt(isp, ISP_LOGERR, "unknown register write at 0x%x", + regoff); + return; + case BIU2400_REQINP: + off = 0x00; + break; + case BIU2400_REQOUTP: + off = 0x04; + break; + case BIU2400_RSPINP: + off = 0x08; + break; + case BIU2400_RSPOUTP: + off = 0x0c; + break; + case BIU2400_ATIO_RSPINP: + off = 0x10; + break; + case BIU2400_ATIO_RSPOUTP: + off = 0x14; + break; + default: + isp_pci_wr_reg_2400(isp, regoff, val); + return; } + B2W4(isp, off, val); } Modified: stable/10/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/10/sys/dev/isp/isp_sbus.c Tue Dec 22 12:54:13 2015 (r292597) +++ stable/10/sys/dev/isp/isp_sbus.c Tue Dec 22 13:19:29 2015 (r292598) @@ -180,8 +180,7 @@ isp_sbus_attach(device_t dev) sbs->sbus_poff[RISC_BLOCK >> _BLK_REG_SHFT] = SBUS_RISC_REGS_OFF; sbs->sbus_poff[DMA_BLOCK >> _BLK_REG_SHFT] = DMA_REGS_OFF; isp = &sbs->sbus_isp; - isp->isp_bus_tag = rman_get_bustag(sbs->regs); - isp->isp_bus_handle = rman_get_bushandle(sbs->regs); + isp->isp_regs = sbs->regs; isp->isp_mdvec = &sbs->sbus_mdvec; isp->isp_bustype = ISP_BT_SBUS; isp->isp_type = ISP_HA_SCSI_UNKNOWN; @@ -367,16 +366,15 @@ isp_sbus_detach(device_t dev) (((struct isp_sbussoftc *)a)->sbus_poff[((x) & _BLK_REG_MASK) >> \ _BLK_REG_SHFT] + ((x) & 0xff)) -#define BXR2(sbc, off) \ - bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, off) +#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off)) static int isp_sbus_rd_isr(ispsoftc_t *isp, uint16_t *isrp, uint16_t *semap, uint16_t *info) { uint16_t isr, sema; - isr = BXR2(sbc, IspVirt2Off(isp, BIU_ISR)); - sema = BXR2(sbc, IspVirt2Off(isp, BIU_SEMA)); + isr = BXR2(isp, IspVirt2Off(isp, BIU_ISR)); + sema = BXR2(isp, IspVirt2Off(isp, BIU_SEMA)); isp_prt(isp, ISP_LOGDEBUG3, "ISR 0x%x SEMA 0x%x", isr, sema); isr &= INT_PENDING_MASK(isp); sema &= BIU_SEMA_LOCK; @@ -385,7 +383,7 @@ isp_sbus_rd_isr(ispsoftc_t *isp, uint16_ } *isrp = isr; if ((*semap = sema) != 0) - *info = BXR2(sbc, IspVirt2Off(isp, OUTMAILBOX0)); + *info = BXR2(isp, IspVirt2Off(isp, OUTMAILBOX0)); return (1); } @@ -396,7 +394,7 @@ isp_sbus_rd_reg(ispsoftc_t *isp, int reg struct isp_sbussoftc *sbs = (struct isp_sbussoftc *) isp; int offset = sbs->sbus_poff[(regoff & _BLK_REG_MASK) >> _BLK_REG_SHFT]; offset += (regoff & 0xff); - rval = bus_space_read_2(isp->isp_bus_tag, isp->isp_bus_handle, offset); + rval = BXR2(isp, offset); isp_prt(isp, ISP_LOGDEBUG3, "isp_sbus_rd_reg(off %x) = %x", regoff, rval); return (rval); @@ -410,7 +408,7 @@ isp_sbus_wr_reg(ispsoftc_t *isp, int reg offset += (regoff & 0xff); isp_prt(isp, ISP_LOGDEBUG3, "isp_sbus_wr_reg(off %x) = %x", regoff, val); - bus_space_write_2(isp->isp_bus_tag, isp->isp_bus_handle, offset, val); + bus_write_2(isp->isp_regs, offset, val); MEMORYBARRIER(isp, SYNC_REG, offset, 2, -1); } Modified: stable/10/sys/dev/isp/ispmbox.h ============================================================================== --- stable/10/sys/dev/isp/ispmbox.h Tue Dec 22 12:54:13 2015 (r292597) +++ stable/10/sys/dev/isp/ispmbox.h Tue Dec 22 13:19:29 2015 (r292598) @@ -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 Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Tue Dec 22 12:54:13 2015 (r292597) +++ stable/10/sys/dev/isp/ispvar.h Tue Dec 22 13:19:29 2015 (r292598) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512221319.tBMDJUCc012838>