1/*- 2 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 3 * FreeBSD Version. 4 * |
5 * Copyright (c) 1997-2006 by Matthew Jacob 6 * All rights reserved. |
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 * |
29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 154704 2006-01-23 06:23:37Z mjacob $"); |
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 |
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 |
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; |
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 } |
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 |
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) { |
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 */ |
769 if (IS_23XX(isp)) { |
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 --- |