isp_pci.c (153462) | isp_pci.c (154704) |
---|---|
1/*- 2 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 3 * FreeBSD Version. 4 * | 1/*- 2 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 3 * FreeBSD Version. 4 * |
5 * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob | 5 * Copyright (c) 1997-2006 by Matthew Jacob 6 * All rights reserved. |
6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice immediately at the beginning of the file, without modification, 12 * this list of conditions, and the following disclaimer. 13 * 2. The name of the author may not be used to endorse or promote products --- 5 unchanged lines hidden (view full) --- 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. | 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice immediately at the beginning of the file, without modification, 13 * this list of conditions, and the following disclaimer. 14 * 2. The name of the author may not be used to endorse or promote products --- 5 unchanged lines hidden (view full) --- 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. |
28 * |
|
27 */ 28 29#include <sys/cdefs.h> | 29 */ 30 31#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 153462 2005-12-15 22:12:27Z jhb $"); | 32__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 154704 2006-01-23 06:23:37Z mjacob $"); |
31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/bus.h> 37#include <sys/stdint.h> 38 --- 176 unchanged lines hidden (view full) --- 215#ifndef PCI_PRODUCT_QLOGIC_ISP2300 216#define PCI_PRODUCT_QLOGIC_ISP2300 0x2300 217#endif 218 219#ifndef PCI_PRODUCT_QLOGIC_ISP2312 220#define PCI_PRODUCT_QLOGIC_ISP2312 0x2312 221#endif 222 | 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/kernel.h> 37#include <sys/module.h> 38#include <sys/bus.h> 39#include <sys/stdint.h> 40 --- 176 unchanged lines hidden (view full) --- 217#ifndef PCI_PRODUCT_QLOGIC_ISP2300 218#define PCI_PRODUCT_QLOGIC_ISP2300 0x2300 219#endif 220 221#ifndef PCI_PRODUCT_QLOGIC_ISP2312 222#define PCI_PRODUCT_QLOGIC_ISP2312 0x2312 223#endif 224 |
225#ifndef PCI_PRODUCT_QLOGIC_ISP2322 226#define PCI_PRODUCT_QLOGIC_ISP2322 0x2322 227#endif 228 |
|
223#ifndef PCI_PRODUCT_QLOGIC_ISP6312 224#define PCI_PRODUCT_QLOGIC_ISP6312 0x6312 225#endif 226 227#define PCI_QLOGIC_ISP1020 \ 228 ((PCI_PRODUCT_QLOGIC_ISP1020 << 16) | PCI_VENDOR_QLOGIC) 229 230#define PCI_QLOGIC_ISP1080 \ --- 18 unchanged lines hidden (view full) --- 249 ((PCI_PRODUCT_QLOGIC_ISP2200 << 16) | PCI_VENDOR_QLOGIC) 250 251#define PCI_QLOGIC_ISP2300 \ 252 ((PCI_PRODUCT_QLOGIC_ISP2300 << 16) | PCI_VENDOR_QLOGIC) 253 254#define PCI_QLOGIC_ISP2312 \ 255 ((PCI_PRODUCT_QLOGIC_ISP2312 << 16) | PCI_VENDOR_QLOGIC) 256 | 229#ifndef PCI_PRODUCT_QLOGIC_ISP6312 230#define PCI_PRODUCT_QLOGIC_ISP6312 0x6312 231#endif 232 233#define PCI_QLOGIC_ISP1020 \ 234 ((PCI_PRODUCT_QLOGIC_ISP1020 << 16) | PCI_VENDOR_QLOGIC) 235 236#define PCI_QLOGIC_ISP1080 \ --- 18 unchanged lines hidden (view full) --- 255 ((PCI_PRODUCT_QLOGIC_ISP2200 << 16) | PCI_VENDOR_QLOGIC) 256 257#define PCI_QLOGIC_ISP2300 \ 258 ((PCI_PRODUCT_QLOGIC_ISP2300 << 16) | PCI_VENDOR_QLOGIC) 259 260#define PCI_QLOGIC_ISP2312 \ 261 ((PCI_PRODUCT_QLOGIC_ISP2312 << 16) | PCI_VENDOR_QLOGIC) 262 |
263#define PCI_QLOGIC_ISP2322 \ 264 ((PCI_PRODUCT_QLOGIC_ISP2322 << 16) | PCI_VENDOR_QLOGIC) 265 |
|
257#define PCI_QLOGIC_ISP6312 \ 258 ((PCI_PRODUCT_QLOGIC_ISP6312 << 16) | PCI_VENDOR_QLOGIC) 259 260/* 261 * Odd case for some AMI raid cards... We need to *not* attach to this. 262 */ 263#define AMI_RAID_SUBVENDOR_ID 0x101e 264 --- 66 unchanged lines hidden (view full) --- 331 device_set_desc(dev, "Qlogic ISP 2200 PCI FC-AL Adapter"); 332 break; 333 case PCI_QLOGIC_ISP2300: 334 device_set_desc(dev, "Qlogic ISP 2300 PCI FC-AL Adapter"); 335 break; 336 case PCI_QLOGIC_ISP2312: 337 device_set_desc(dev, "Qlogic ISP 2312 PCI FC-AL Adapter"); 338 break; | 266#define PCI_QLOGIC_ISP6312 \ 267 ((PCI_PRODUCT_QLOGIC_ISP6312 << 16) | PCI_VENDOR_QLOGIC) 268 269/* 270 * Odd case for some AMI raid cards... We need to *not* attach to this. 271 */ 272#define AMI_RAID_SUBVENDOR_ID 0x101e 273 --- 66 unchanged lines hidden (view full) --- 340 device_set_desc(dev, "Qlogic ISP 2200 PCI FC-AL Adapter"); 341 break; 342 case PCI_QLOGIC_ISP2300: 343 device_set_desc(dev, "Qlogic ISP 2300 PCI FC-AL Adapter"); 344 break; 345 case PCI_QLOGIC_ISP2312: 346 device_set_desc(dev, "Qlogic ISP 2312 PCI FC-AL Adapter"); 347 break; |
348 case PCI_QLOGIC_ISP2322: 349 device_set_desc(dev, "Qlogic ISP 2322 PCI FC-AL Adapter"); 350 break; |
|
339 case PCI_QLOGIC_ISP6312: 340 device_set_desc(dev, "Qlogic ISP 6312 PCI FC-AL Adapter"); 341 break; 342 default: 343 return (ENXIO); 344 } 345 if (isp_announced == 0 && bootverbose) { 346 printf("Qlogic ISP Driver, FreeBSD Version %d.%d, " --- 182 unchanged lines hidden (view full) --- 529 if (pci_get_devid(dev) == PCI_QLOGIC_ISP2312 || 530 pci_get_devid(dev) == PCI_QLOGIC_ISP6312) { 531 mdvp = &mdvec_2300; 532 basetype = ISP_HA_FC_2312; 533 psize = sizeof (fcparam); 534 pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = 535 PCI_MBOX_REGS2300_OFF; 536 } | 351 case PCI_QLOGIC_ISP6312: 352 device_set_desc(dev, "Qlogic ISP 6312 PCI FC-AL Adapter"); 353 break; 354 default: 355 return (ENXIO); 356 } 357 if (isp_announced == 0 && bootverbose) { 358 printf("Qlogic ISP Driver, FreeBSD Version %d.%d, " --- 182 unchanged lines hidden (view full) --- 541 if (pci_get_devid(dev) == PCI_QLOGIC_ISP2312 || 542 pci_get_devid(dev) == PCI_QLOGIC_ISP6312) { 543 mdvp = &mdvec_2300; 544 basetype = ISP_HA_FC_2312; 545 psize = sizeof (fcparam); 546 pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = 547 PCI_MBOX_REGS2300_OFF; 548 } |
549 if (pci_get_devid(dev) == PCI_QLOGIC_ISP2322) { 550 mdvp = &mdvec_2300; 551 basetype = ISP_HA_FC_2322; 552 psize = sizeof (fcparam); 553 pcs->pci_poff[MBOX_BLOCK >> _BLK_REG_SHFT] = 554 PCI_MBOX_REGS2300_OFF; 555 } |
|
537 isp = &pcs->pci_isp; 538 isp->isp_param = malloc(psize, M_DEVBUF, M_NOWAIT | M_ZERO); 539 if (isp->isp_param == NULL) { 540 device_printf(dev, "cannot allocate parameter data\n"); 541 goto bad; 542 } 543 isp->isp_mdvec = mdvp; 544 isp->isp_type = basetype; 545 isp->isp_revision = pci_get_revid(dev); 546 isp->isp_role = role; 547 isp->isp_dev = dev; 548 549 /* 550 * Try and find firmware for this device. 551 */ 552 | 556 isp = &pcs->pci_isp; 557 isp->isp_param = malloc(psize, M_DEVBUF, M_NOWAIT | M_ZERO); 558 if (isp->isp_param == NULL) { 559 device_printf(dev, "cannot allocate parameter data\n"); 560 goto bad; 561 } 562 isp->isp_mdvec = mdvp; 563 isp->isp_type = basetype; 564 isp->isp_revision = pci_get_revid(dev); 565 isp->isp_role = role; 566 isp->isp_dev = dev; 567 568 /* 569 * Try and find firmware for this device. 570 */ 571 |
553 if (isp_get_firmware_p) { | 572 /* 573 * Don't even attempt to get firmware for the 2322/2422 (yet) 574 */ 575 if (IS_2322(isp) == 0 && IS_24XX(isp) == 0 && isp_get_firmware_p) { |
554 int device = (int) pci_get_device(dev); 555#ifdef ISP_TARGET_MODE 556 (*isp_get_firmware_p)(0, 1, device, &mdvp->dv_ispfw); 557#else 558 (*isp_get_firmware_p)(0, 0, device, &mdvp->dv_ispfw); 559#endif 560 } 561 --- 177 unchanged lines hidden (view full) --- 739 isp->isp_dblev = ISP_LOGWARN|ISP_LOGERR; 740 } 741 if (bootverbose) 742 isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; 743 744 /* 745 * Last minute checks... 746 */ | 576 int device = (int) pci_get_device(dev); 577#ifdef ISP_TARGET_MODE 578 (*isp_get_firmware_p)(0, 1, device, &mdvp->dv_ispfw); 579#else 580 (*isp_get_firmware_p)(0, 0, device, &mdvp->dv_ispfw); 581#endif 582 } 583 --- 177 unchanged lines hidden (view full) --- 761 isp->isp_dblev = ISP_LOGWARN|ISP_LOGERR; 762 } 763 if (bootverbose) 764 isp->isp_dblev |= ISP_LOGCONFIG|ISP_LOGINFO; 765 766 /* 767 * Last minute checks... 768 */ |
747 if (IS_2312(isp)) { | 769 if (IS_23XX(isp)) { |
748 isp->isp_port = pci_get_function(dev); 749 } 750 751 /* 752 * Make sure we're in reset state. 753 */ 754 ISP_LOCK(isp); 755 isp_reset(isp); --- 1334 unchanged lines hidden --- | 770 isp->isp_port = pci_get_function(dev); 771 } 772 773 /* 774 * Make sure we're in reset state. 775 */ 776 ISP_LOCK(isp); 777 isp_reset(isp); --- 1334 unchanged lines hidden --- |