Deleted Added
full compact
isp_pci.c (291147) isp_pci.c (291188)
1/*-
2 * Copyright (c) 1997-2008 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 14 unchanged lines hidden (view full) ---

23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26/*
27 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
28 * FreeBSD Version.
29 */
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997-2008 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 14 unchanged lines hidden (view full) ---

23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26/*
27 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters.
28 * FreeBSD Version.
29 */
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 291147 2015-11-21 21:44:11Z mav $");
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 291188 2015-11-23 10:06:19Z mav $");
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/linker.h>
38#include <sys/firmware.h>
39#include <sys/bus.h>

--- 506 unchanged lines hidden (view full) ---

546 if (IS_FC(isp)) {
547 ISP_FC_PC(isp, chan)->default_id = tval - chan;
548 } else {
549 ISP_SPI_PC(isp, chan)->iid = tval;
550 }
551 isp->isp_confopts |= ISP_CFG_OWNLOOPID;
552 }
553
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/linker.h>
38#include <sys/firmware.h>
39#include <sys/bus.h>

--- 506 unchanged lines hidden (view full) ---

546 if (IS_FC(isp)) {
547 ISP_FC_PC(isp, chan)->default_id = tval - chan;
548 } else {
549 ISP_SPI_PC(isp, chan)->iid = tval;
550 }
551 isp->isp_confopts |= ISP_CFG_OWNLOOPID;
552 }
553
554 if (IS_SCSI(isp))
555 return;
556
554 tval = -1;
555 snprintf(name, sizeof(name), "%srole", prefix);
556 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
557 name, &tval) == 0) {
558 switch (tval) {
559 case ISP_ROLE_NONE:
560 case ISP_ROLE_INITIATOR:
561 case ISP_ROLE_TARGET:
562 case ISP_ROLE_BOTH:
563 device_printf(dev, "Chan %d setting role to 0x%x\n", chan, tval);
564 break;
565 default:
566 tval = -1;
567 break;
568 }
569 }
570 if (tval == -1) {
571 tval = ISP_DEFAULT_ROLES;
572 }
557 tval = -1;
558 snprintf(name, sizeof(name), "%srole", prefix);
559 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
560 name, &tval) == 0) {
561 switch (tval) {
562 case ISP_ROLE_NONE:
563 case ISP_ROLE_INITIATOR:
564 case ISP_ROLE_TARGET:
565 case ISP_ROLE_BOTH:
566 device_printf(dev, "Chan %d setting role to 0x%x\n", chan, tval);
567 break;
568 default:
569 tval = -1;
570 break;
571 }
572 }
573 if (tval == -1) {
574 tval = ISP_DEFAULT_ROLES;
575 }
573
574 if (IS_SCSI(isp)) {
575 ISP_SPI_PC(isp, chan)->def_role = tval;
576 return;
577 }
578 ISP_FC_PC(isp, chan)->def_role = tval;
579
580 tval = 0;
581 snprintf(name, sizeof(name), "%sfullduplex", prefix);
582 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
583 name, &tval) == 0 && tval != 0) {
584 isp->isp_confopts |= ISP_CFG_FULL_DUPLEX;
585 }

--- 298 unchanged lines hidden (view full) ---

884
885 /*
886 * Now that we know who we are (roughly) get/set specific options
887 */
888 for (i = 0; i < isp->isp_nchan; i++) {
889 isp_get_specific_options(dev, i, isp);
890 }
891
576 ISP_FC_PC(isp, chan)->def_role = tval;
577
578 tval = 0;
579 snprintf(name, sizeof(name), "%sfullduplex", prefix);
580 if (resource_int_value(device_get_name(dev), device_get_unit(dev),
581 name, &tval) == 0 && tval != 0) {
582 isp->isp_confopts |= ISP_CFG_FULL_DUPLEX;
583 }

--- 298 unchanged lines hidden (view full) ---

882
883 /*
884 * Now that we know who we are (roughly) get/set specific options
885 */
886 for (i = 0; i < isp->isp_nchan; i++) {
887 isp_get_specific_options(dev, i, isp);
888 }
889
892 /*
893 * The 'it' suffix really only matters for SCSI cards in target mode.
894 */
895 isp->isp_osinfo.fw = NULL;
890 isp->isp_osinfo.fw = NULL;
896 if (IS_SCSI(isp) && (ISP_SPI_PC(isp, 0)->def_role & ISP_ROLE_TARGET)) {
897 snprintf(fwname, sizeof (fwname), "isp_%04x_it", did);
898 isp->isp_osinfo.fw = firmware_get(fwname);
899 }
900 if (isp->isp_osinfo.fw == NULL) {
901 snprintf(fwname, sizeof (fwname), "isp_%04x", did);
902 isp->isp_osinfo.fw = firmware_get(fwname);
903 }
904 if (isp->isp_osinfo.fw != NULL) {
905 isp_prt(isp, ISP_LOGCONFIG, "loaded firmware %s", fwname);
906 isp->isp_mdvec->dv_ispfw = isp->isp_osinfo.fw->data;
907 }

--- 674 unchanged lines hidden (view full) ---

1582 return (1);
1583 }
1584
1585 if (isp->isp_osinfo.sixtyfourbit) {
1586 nsegs = ISP_NSEG64_MAX;
1587 } else {
1588 nsegs = ISP_NSEG_MAX;
1589 }
891 if (isp->isp_osinfo.fw == NULL) {
892 snprintf(fwname, sizeof (fwname), "isp_%04x", did);
893 isp->isp_osinfo.fw = firmware_get(fwname);
894 }
895 if (isp->isp_osinfo.fw != NULL) {
896 isp_prt(isp, ISP_LOGCONFIG, "loaded firmware %s", fwname);
897 isp->isp_mdvec->dv_ispfw = isp->isp_osinfo.fw->data;
898 }

--- 674 unchanged lines hidden (view full) ---

1573 return (1);
1574 }
1575
1576 if (isp->isp_osinfo.sixtyfourbit) {
1577 nsegs = ISP_NSEG64_MAX;
1578 } else {
1579 nsegs = ISP_NSEG_MAX;
1580 }
1590#ifdef ISP_TARGET_MODE
1591 /*
1592 * XXX: We don't really support 64 bit target mode for parallel scsi yet
1593 */
1594 if (IS_SCSI(isp) && isp->isp_osinfo.sixtyfourbit) {
1595 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
1596 isp_prt(isp, ISP_LOGERR, "we cannot do DAC for SPI cards yet");
1597 ISP_LOCK(isp);
1598 return (1);
1599 }
1600#endif
1601
1602 if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, nsegs, slim, 0, &isp->isp_osinfo.dmat)) {
1603 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
1604 ISP_LOCK(isp);
1605 isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
1606 return (1);
1607 }
1608

--- 440 unchanged lines hidden ---
1581
1582 if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, nsegs, slim, 0, &isp->isp_osinfo.dmat)) {
1583 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
1584 ISP_LOCK(isp);
1585 isp_prt(isp, ISP_LOGERR, "could not create master dma tag");
1586 return (1);
1587 }
1588

--- 440 unchanged lines hidden ---