diff --git a/qla_isp/firmware/asm_1000.h b/qla_isp/firmware/asm_1000.h index 025a96c54..24765adfd 100644 --- a/qla_isp/firmware/asm_1000.h +++ b/qla_isp/firmware/asm_1000.h @@ -1,4 +1,4 @@ -/* $Id: asm_1000.h,v 1.7 2006/07/03 05:45:01 mjacob Exp $ */ +/* $Id: asm_1000.h,v 1.8 2008/01/13 21:16:36 mjacob Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. @@ -3222,3 +3222,7 @@ static const uint16_t isp_1000_risc_code[] = { 0x300c, 0x817e, 0x872b, 0x8772, 0xa8af, 0x0000, 0xd66f }; #endif +#ifdef ISP_1000_RISC_CODE +#undef ISP_1000_RISC_CODE +#endif +#define ISP_1000_RISC_CODE (const uint16_t *) isp_1000_risc_code diff --git a/qla_isp/firmware/asm_1040.h b/qla_isp/firmware/asm_1040.h index 05a15f878..4ecc82e62 100644 --- a/qla_isp/firmware/asm_1040.h +++ b/qla_isp/firmware/asm_1040.h @@ -1,4 +1,4 @@ -/* $Id: asm_1040.h,v 1.7 2006/07/03 05:45:01 mjacob Exp $ */ +/* $Id: asm_1040.h,v 1.8 2008/01/13 21:16:36 mjacob Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. @@ -3543,3 +3543,7 @@ static const uint16_t isp_1040_risc_code[] = { 0x300c, 0x817e, 0x872b, 0x8772, 0xa8a8, 0x0000, 0xdf21 }; #endif +#ifdef ISP_1040_RISC_CODE +#undef ISP_1040_RISC_CODE +#endif +#define ISP_1040_RISC_CODE (const uint16_t *) isp_1040_risc_code diff --git a/qla_isp/firmware/asm_1080.h b/qla_isp/firmware/asm_1080.h index 6e5476b43..1e7042476 100644 --- a/qla_isp/firmware/asm_1080.h +++ b/qla_isp/firmware/asm_1080.h @@ -1,4 +1,4 @@ -/* $Id: asm_1080.h,v 1.7 2006/07/03 05:45:01 mjacob Exp $ */ +/* $Id: asm_1080.h,v 1.8 2008/01/13 21:16:36 mjacob Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. @@ -4552,3 +4552,7 @@ static const uint16_t isp_1080_risc_code[] = { 0x0000, 0xd27a }; #endif +#ifdef ISP_1080_RISC_CODE +#undef ISP_1080_RISC_CODE +#endif +#define ISP_1080_RISC_CODE (const uint16_t *) isp_1080_risc_code diff --git a/qla_isp/firmware/asm_12160.h b/qla_isp/firmware/asm_12160.h index 21c6d39e3..0d02df910 100644 --- a/qla_isp/firmware/asm_12160.h +++ b/qla_isp/firmware/asm_12160.h @@ -1,4 +1,4 @@ -/* $Id: asm_12160.h,v 1.9 2006/07/03 05:45:01 mjacob Exp $ */ +/* $Id: asm_12160.h,v 1.10 2008/01/13 21:16:37 mjacob Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. @@ -4336,3 +4336,7 @@ static const uint16_t isp_12160_risc_code[] = { 0x7021, 0x0014, 0xa300, 0xa8ca, 0x0000, 0x7a3c }; #endif +#ifdef ISP_12160_RISC_CODE +#undef ISP_12160_RISC_CODE +#endif +#define ISP_12160_RISC_CODE (const uint16_t *) isp_12160_risc_code diff --git a/qla_isp/firmware/asm_2100.h b/qla_isp/firmware/asm_2100.h index 554973810..bf45fb043 100644 --- a/qla_isp/firmware/asm_2100.h +++ b/qla_isp/firmware/asm_2100.h @@ -1,4 +1,4 @@ -/* $Id: asm_2100.h,v 1.10 2006/07/03 05:45:02 mjacob Exp $ */ +/* $Id: asm_2100.h,v 1.11 2008/01/13 21:16:37 mjacob Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 Qlogic, Inc. * All rights reserved. @@ -8145,3 +8145,7 @@ static const uint16_t isp_2100_risc_code[] = { 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0x687d }; #endif +#ifdef ISP_2100_RISC_CODE +#undef ISP_2100_RISC_CODE +#endif +#define ISP_2100_RISC_CODE (const uint16_t *) isp_2100_risc_code diff --git a/qla_isp/firmware/asm_2200.h b/qla_isp/firmware/asm_2200.h index 7b1e00fba..fec0bcd19 100644 --- a/qla_isp/firmware/asm_2200.h +++ b/qla_isp/firmware/asm_2200.h @@ -1,4 +1,4 @@ -/* $Id: asm_2200.h,v 1.11 2006/07/03 05:45:02 mjacob Exp $ */ +/* $Id: asm_2200.h,v 1.12 2008/01/13 21:16:37 mjacob Exp $ */ /* * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 by Qlogic, Inc. * All rights reserved. @@ -4863,3 +4863,7 @@ static const uint16_t isp_2200_risc_code[] = { 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0xa332 }; +#ifdef ISP_2200_RISC_CODE +#undef ISP_2200_RISC_CODE +#endif +#define ISP_2200_RISC_CODE (const uint16_t *) isp_2200_risc_code diff --git a/qla_isp/firmware/asm_2300.h b/qla_isp/firmware/asm_2300.h index 92c6f7ca6..26ba1d233 100644 --- a/qla_isp/firmware/asm_2300.h +++ b/qla_isp/firmware/asm_2300.h @@ -1,4 +1,4 @@ -/* $Id: asm_2300.h,v 1.16 2007/02/21 23:39:22 mjacob Exp $ */ +/* $Id: asm_2300.h,v 1.17 2008/01/13 21:16:38 mjacob Exp $ */ /* * Copyright (C) 2001, 2002, 2003, 2004, 2005 by Qlogic, Inc. * All rights reserved. @@ -6607,3 +6607,7 @@ static const uint16_t isp_2300_risc_code[] = { 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, 0x8000, 0xd24b }; +#ifdef ISP_2300_RISC_CODE +#undef ISP_2300_RISC_CODE +#endif +#define ISP_2300_RISC_CODE (const uint16_t *) isp_2300_risc_code diff --git a/qla_isp/firmware/asm_2322.h b/qla_isp/firmware/asm_2322.h index df8891106..a152873b9 100644 --- a/qla_isp/firmware/asm_2322.h +++ b/qla_isp/firmware/asm_2322.h @@ -1,4 +1,4 @@ -/* $Id: asm_2322.h,v 1.1 2006/07/03 05:45:04 mjacob Exp $ */ +/* $Id: asm_2322.h,v 1.2 2008/01/13 21:16:39 mjacob Exp $ */ /* * Copyright (C) 2004-2005 by Qlogic, Inc. * All rights reserved. @@ -7652,3 +7652,7 @@ static const uint16_t isp_2322_risc_code[] = { 0x0000, 0x0007, 0x0003, 0x48d5, 0x0000, 0xb838, 0x0017, 0x4000, 0x9f0a, 0xb6be }; +#ifdef ISP_2322_RISC_CODE +#undef ISP_2322_RISC_CODE +#endif +#define ISP_2322_RISC_CODE (const uint16_t *) isp_2322_risc_code diff --git a/qla_isp/firmware/asm_2400.h b/qla_isp/firmware/asm_2400.h index 2afc560f3..579985b07 100644 --- a/qla_isp/firmware/asm_2400.h +++ b/qla_isp/firmware/asm_2400.h @@ -1,4 +1,4 @@ -/* $Id: asm_2400.h,v 1.5 2007/12/02 22:02:06 mjacob Exp $ */ +/* $Id: asm_2400.h,v 1.6 2008/01/13 21:16:39 mjacob Exp $ */ /*- * Copyright (C) 1994-2007 by Qlogic, Inc. * All rights reserved. @@ -13917,3 +13917,7 @@ static const uint32_t isp_2400_risc_code[] = { 0x070fc0ff, 0x040f8013, 0x032fa009, 0x03800553, 0xe45e907b, 0xffeecc2a }; +#ifdef ISP_2400_RISC_CODE +#undef ISP_2400_RISC_CODE +#endif +#define ISP_2400_RISC_CODE (const uint32_t *) isp_2400_risc_code diff --git a/qla_isp/linux/isp_linux.c b/qla_isp/linux/isp_linux.c index fb0fdaf62..a71365083 100644 --- a/qla_isp/linux/isp_linux.c +++ b/qla_isp/linux/isp_linux.c @@ -1,4 +1,4 @@ -/* $Id: isp_linux.c,v 1.219 2008/01/08 22:15:01 mjacob Exp $ */ +/* $Id: isp_linux.c,v 1.220 2008/01/13 21:18:01 mjacob Exp $ */ /* * Copyright (c) 1997-2007 by Matthew Jacob * All rights reserved. @@ -4171,11 +4171,6 @@ isplinux_common_init(ispsoftc_t *isp) /* * Set up config options, etc... */ - if (isp_debug) { - isp->isp_dblev = isp_debug; - } else { - isp->isp_dblev = ISP_LOGCONFIG|ISP_LOGINFO|ISP_LOGWARN|ISP_LOGERR; - } if (isp_nofwreload & (1 << isp->isp_unit)) { isp->isp_confopts |= ISP_CFG_NORELOAD; diff --git a/qla_isp/linux/isp_linux.h b/qla_isp/linux/isp_linux.h index bf96fad42..24c307efb 100644 --- a/qla_isp/linux/isp_linux.h +++ b/qla_isp/linux/isp_linux.h @@ -1,4 +1,4 @@ -/* $Id: isp_linux.h,v 1.149 2008/01/09 05:41:45 mjacob Exp $ */ +/* $Id: isp_linux.h,v 1.150 2008/01/13 21:18:01 mjacob Exp $ */ /* * Copyright (c) 1997-2007 by Matthew Jacob * All rights reserved. @@ -286,6 +286,7 @@ struct isposinfo { void * storep; size_t storep_amt; size_t param_amt; + const struct firmware *fwp; #ifdef CONFIG_PROC_FS struct proc_dir_entry *pdp; #endif diff --git a/qla_isp/linux/isp_pci.c b/qla_isp/linux/isp_pci.c index 8b39ec49a..44f4be4ea 100644 --- a/qla_isp/linux/isp_pci.c +++ b/qla_isp/linux/isp_pci.c @@ -1,4 +1,4 @@ -/* $Id: isp_pci.c,v 1.151 2008/01/11 22:41:51 mjacob Exp $ */ +/* $Id: isp_pci.c,v 1.152 2008/01/13 21:18:01 mjacob Exp $ */ /* * Copyright (c) 1997-2007 by Matthew Jacob * All rights reserved. @@ -56,6 +56,8 @@ * Qlogic ISP Host Adapter PCI specific probe and attach routines */ #include "isp_linux.h" +#include + static int isp_pci_mapmem = 0xffffffff; #if defined(__sparc__) #undef ioremap_nocache @@ -111,60 +113,40 @@ static void isp_pci_dumpregs(ispsoftc_t *, const char *); static int isplinux_pci_exclude(struct pci_dev *); +#define ISP_1040_RISC_CODE NULL +#define ISP_1080_RISC_CODE NULL +#define ISP_12160_RISC_CODE NULL +#define ISP_2100_RISC_CODE NULL +#define ISP_2200_RISC_CODE NULL +#define ISP_2300_RISC_CODE NULL +#define ISP_2322_RISC_CODE NULL +#define ISP_2400_RISC_CODE NULL + +#if !(defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)) #ifndef ISP_DISABLE_1020_SUPPORT #include "asm_1040.h" -#define ISP_1040_RISC_CODE (void *) isp_1040_risc_code -#else -#define ISP_1040_RISC_CODE NULL #endif - #ifndef ISP_DISABLE_1080_SUPPORT #include "asm_1080.h" -#define ISP_1080_RISC_CODE (void *) isp_1080_risc_code -#else -#define ISP_1080_RISC_CODE NULL #endif - #ifndef ISP_DISABLE_12160_SUPPORT #include "asm_12160.h" -#define ISP_12160_RISC_CODE (void *) isp_12160_risc_code -#else -#define ISP_12160_RISC_CODE NULL #endif - #ifndef ISP_DISABLE_2100_SUPPORT #include "asm_2100.h" -#define ISP_2100_RISC_CODE (void *) isp_2100_risc_code -#else -#define ISP_2100_RISC_CODE NULL #endif - #ifndef ISP_DISABLE_2200_SUPPORT #include "asm_2200.h" -#define ISP_2200_RISC_CODE (void *) isp_2200_risc_code -#else -#define ISP_2200_RISC_CODE NULL #endif - #ifndef ISP_DISABLE_2300_SUPPORT #include "asm_2300.h" -#define ISP_2300_RISC_CODE (void *) isp_2300_risc_code -#else -#define ISP_2300_RISC_CODE NULL #endif - #ifndef ISP_DISABLE_2300_SUPPORT #include "asm_2322.h" -#define ISP_2322_RISC_CODE (void *) isp_2322_risc_code -#else -#define ISP_2322_RISC_CODE NULL #endif - #ifndef ISP_DISABLE_2400_SUPPORT #include "asm_2400.h" -#define ISP_2400_RISC_CODE (void *) isp_2400_risc_code -#else -#define ISP_2400_RISC_CODE NULL +#endif #endif #ifndef ISP_DISABLE_1020_SUPPORT @@ -522,10 +504,16 @@ isplinux_pci_init_one(struct Scsi_Host *host) struct isp_pcisoftc *isp_pci; struct pci_dev *pdev; ispsoftc_t *isp; + const char *fwname = NULL; isp_pci = (struct isp_pcisoftc *) ISP_HOST2ISP(host); pdev = isp_pci->pci_dev; isp = (ispsoftc_t *) isp_pci; + if (isp_debug) { + isp->isp_dblev = isp_debug; + } else { + isp->isp_dblev = ISP_LOGCONFIG|ISP_LOGINFO|ISP_LOGWARN|ISP_LOGERR; + } pci_read_config_word(pdev, PCI_COMMAND, &cmd); pci_read_config_dword(pdev, PCI_CLASS_REVISION, &rev); @@ -673,75 +661,93 @@ isplinux_pci_init_one(struct Scsi_Host *host) } host->irq = 0; host->max_channel = isp->isp_nchan - 1; - isp_pci->pci_isp.isp_revision = rev; + fwname = NULL; + isp->isp_revision = rev; #ifndef ISP_DISABLE_1020_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1020) { - isp_pci->pci_isp.isp_mdvec = &mdvec; - isp_pci->pci_isp.isp_type = ISP_HA_SCSI_UNKNOWN; + isp->isp_mdvec = &mdvec; + isp->isp_type = ISP_HA_SCSI_UNKNOWN; + fwname = "ql1020_fw.bin"; } #endif #ifndef ISP_DISABLE_1080_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1080) { - isp_pci->pci_isp.isp_mdvec = &mdvec_1080; - isp_pci->pci_isp.isp_type = ISP_HA_SCSI_1080; + isp->isp_mdvec = &mdvec_1080; + isp->isp_type = ISP_HA_SCSI_1080; + fwname = "ql1080_fw.bin"; } if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1240) { - isp_pci->pci_isp.isp_mdvec = &mdvec_1080; - isp_pci->pci_isp.isp_type = ISP_HA_SCSI_1240; + isp->isp_mdvec = &mdvec_1080; + isp->isp_type = ISP_HA_SCSI_1240; host->max_channel = 1; + fwname = "ql1080_fw.bin"; } if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1280) { - isp_pci->pci_isp.isp_mdvec = &mdvec_1080; - isp_pci->pci_isp.isp_type = ISP_HA_SCSI_1280; + isp->isp_mdvec = &mdvec_1080; + isp->isp_type = ISP_HA_SCSI_1280; host->max_channel = 1; + fwname = "ql1080_fw.bin"; } #endif #ifndef ISP_DISABLE_12160_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP10160) { - isp_pci->pci_isp.isp_mdvec = &mdvec_12160; - isp_pci->pci_isp.isp_type = ISP_HA_SCSI_12160; + isp->isp_mdvec = &mdvec_12160; + isp->isp_type = ISP_HA_SCSI_12160; + fwname = "ql12160_fw.bin"; } if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP12160) { - isp_pci->pci_isp.isp_mdvec = &mdvec_12160; - isp_pci->pci_isp.isp_type = ISP_HA_SCSI_12160; + isp->isp_mdvec = &mdvec_12160; + isp->isp_type = ISP_HA_SCSI_12160; host->max_channel = 1; + fwname = "ql12160_fw.bin"; } #endif #ifndef ISP_DISABLE_2100_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2100) { - isp_pci->pci_isp.isp_mdvec = &mdvec_2100; - isp_pci->pci_isp.isp_type = ISP_HA_FC_2100; + isp->isp_mdvec = &mdvec_2100; + isp->isp_type = ISP_HA_FC_2100; + fwname = "ql2100_fw.bin"; } #endif #ifndef ISP_DISABLE_2200_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2200) { - isp_pci->pci_isp.isp_mdvec = &mdvec_2200; - isp_pci->pci_isp.isp_type = ISP_HA_FC_2200; + isp->isp_mdvec = &mdvec_2200; + isp->isp_type = ISP_HA_FC_2200; + fwname = "ql2200_fw.bin"; } #endif #ifndef ISP_DISABLE_2300_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2300) { - isp_pci->pci_isp.isp_mdvec = &mdvec_2300; - isp_pci->pci_isp.isp_type = ISP_HA_FC_2300; + isp->isp_mdvec = &mdvec_2300; + isp->isp_type = ISP_HA_FC_2300; + fwname = "ql2300_fw.bin"; } if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2312) { - isp_pci->pci_isp.isp_mdvec = &mdvec_2300; - isp_pci->pci_isp.isp_type = ISP_HA_FC_2312; - } - if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322) { - isp_pci->pci_isp.isp_mdvec = &mdvec_2322; - isp_pci->pci_isp.isp_type = ISP_HA_FC_2322; + isp->isp_mdvec = &mdvec_2300; + isp->isp_type = ISP_HA_FC_2312; + fwname = "ql2300_fw.bin"; } if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6312) { - isp_pci->pci_isp.isp_mdvec = &mdvec_2300; - isp_pci->pci_isp.isp_type = ISP_HA_FC_2312; + isp->isp_mdvec = &mdvec_2300; + isp->isp_type = ISP_HA_FC_2312; + fwname = "ql2300_fw.bin"; + } + if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2322) { + isp->isp_mdvec = &mdvec_2322; + isp->isp_type = ISP_HA_FC_2322; + fwname = "ql2322_fw.bin"; + } + if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP6312) { + isp->isp_mdvec = &mdvec_2300; + isp->isp_type = ISP_HA_FC_2312; + fwname = "ql2322_fw.bin"; } - #endif #ifndef ISP_DISABLE_2400_SUPPORT if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 || pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2432) { - isp_pci->pci_isp.isp_mdvec = &mdvec_2400; - isp_pci->pci_isp.isp_type = ISP_HA_FC_2400; + isp->isp_mdvec = &mdvec_2400; + isp->isp_type = ISP_HA_FC_2400; + fwname = "ql2400_fw.bin"; } #endif @@ -794,7 +800,7 @@ isplinux_pci_init_one(struct Scsi_Host *host) goto bad; } } else { - isp_prt(isp, ISP_LOGCONFIG, "eanbling 64 bit DMA"); + isp_prt(isp, ISP_LOGCONFIG, "enabling 64 bit DMA"); } } else { if (pci_set_dma_mask(pdev, (u64)0xffffffff)) { @@ -803,6 +809,33 @@ isplinux_pci_init_one(struct Scsi_Host *host) } } + if (fwname) { + if (request_firmware(&isp->isp_osinfo.fwp, fwname, &pdev->dev) == 0) { + isp->isp_mdvec->dv_ispfw = isp->isp_osinfo.fwp->data; + isp_prt(isp, ISP_LOGCONFIG, "using loaded firmware set \"%s\"", fwname); + /* + * On little endian machines convert a byte stream of firmware to native 16 or 32 bit format. + */ +#if BYTE_ORDER == LITTLE_ENDIAN + if (IS_24XX(isp)) { + uint32_t *ptr = (uint32_t *)isp->isp_osinfo.fwp->data; + int i; + for (i = 0; i < isp->isp_osinfo.fwp->size >> 2; i++) { + ptr[i] = ISP_SWAP32(isp, ptr[i]); + } + } else { + uint16_t *ptr = (uint16_t *)isp->isp_osinfo.fwp->data; + int i; + for (i = 0; i < isp->isp_osinfo.fwp->size >> 1; i++) { + ptr[i] = ISP_SWAP16(isp, ptr[i]); + } + } +#endif + } else { + isp_prt(isp, ISP_LOGCONFIG, "unable to load firmware set \"%s\"", fwname); + } + } + if (isplinux_common_init(isp)) { isp_prt(isp, ISP_LOGERR, "isplinux_common_init failed"); goto bad; @@ -818,6 +851,10 @@ bad: isp_kfree(isp->isp_osinfo.storep, isp->isp_osinfo.storep_amt); isp->isp_osinfo.storep = NULL; } + if (isp->isp_osinfo.fwp) { + release_firmware(isp->isp_osinfo.fwp); + isp->isp_osinfo.fwp = NULL; + } if (host->irq) { ISP_DISABLE_INTS(isp); free_irq(host->irq, isp_pci); @@ -3299,6 +3336,10 @@ isplinux_pci_remove(struct pci_dev *pdev) isp_deinit_target(isp); #endif scsi_host_put(host); + if (isp->isp_osinfo.fwp) { + release_firmware(isp->isp_osinfo.fwp); + isp->isp_osinfo.fwp = NULL; + } pci_set_drvdata(pdev, NULL); }