Deleted Added
full compact
isp_pci.c (158817) isp_pci.c (160080)
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

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

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>
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

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

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 158817 2006-05-22 06:51:48Z mjacob $");
32__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 160080 2006-07-03 08:24:09Z 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#if __FreeBSD_version < 500000
40#include <sys/bus.h>

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

160#define PCIM_CMD_BUSMASTEREN 0x0004
161#endif
162#ifndef PCIM_CMD_PERRESPEN
163#define PCIM_CMD_PERRESPEN 0x0040
164#endif
165#ifndef PCIM_CMD_SEREN
166#define PCIM_CMD_SEREN 0x0100
167#endif
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#if __FreeBSD_version < 500000
40#include <sys/bus.h>

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

160#define PCIM_CMD_BUSMASTEREN 0x0004
161#endif
162#ifndef PCIM_CMD_PERRESPEN
163#define PCIM_CMD_PERRESPEN 0x0040
164#endif
165#ifndef PCIM_CMD_SEREN
166#define PCIM_CMD_SEREN 0x0100
167#endif
168#ifndef PCIM_CMD_INTX_DISABLE
169#define PCIM_CMD_INTX_DISABLE 0x0400
170#endif
168
169#ifndef PCIR_COMMAND
170#define PCIR_COMMAND 0x04
171#endif
172
173#ifndef PCIR_CACHELNSZ
174#define PCIR_CACHELNSZ 0x0c
175#endif

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

869 isp->isp_type = basetype;
870 isp->isp_revision = pci_get_revid(dev);
871 isp->isp_dev = dev;
872
873 /*
874 * Try and find firmware for this device.
875 */
876
171
172#ifndef PCIR_COMMAND
173#define PCIR_COMMAND 0x04
174#endif
175
176#ifndef PCIR_CACHELNSZ
177#define PCIR_CACHELNSZ 0x0c
178#endif

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

872 isp->isp_type = basetype;
873 isp->isp_revision = pci_get_revid(dev);
874 isp->isp_dev = dev;
875
876 /*
877 * Try and find firmware for this device.
878 */
879
877 /*
878 * Don't even attempt to get firmware for the 2322/2422 (yet)
879 */
880 if (IS_2322(isp) == 0 && IS_24XX(isp) == 0 && isp_get_firmware_p) {
880 if (isp_get_firmware_p) {
881 int device = (int) pci_get_device(dev);
882#ifdef ISP_TARGET_MODE
883 (*isp_get_firmware_p)(0, 1, device, &mdvp->dv_ispfw);
884#else
885 (*isp_get_firmware_p)(0, 0, device, &mdvp->dv_ispfw);
886#endif
887 }
888

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

897 }
898 if (IS_23XX(isp)) {
899 /*
900 * Can't tell if ROM will hang on 'ABOUT FIRMWARE' command.
901 */
902 isp->isp_touched = 1;
903
904 }
881 int device = (int) pci_get_device(dev);
882#ifdef ISP_TARGET_MODE
883 (*isp_get_firmware_p)(0, 1, device, &mdvp->dv_ispfw);
884#else
885 (*isp_get_firmware_p)(0, 0, device, &mdvp->dv_ispfw);
886#endif
887 }
888

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

897 }
898 if (IS_23XX(isp)) {
899 /*
900 * Can't tell if ROM will hang on 'ABOUT FIRMWARE' command.
901 */
902 isp->isp_touched = 1;
903
904 }
905
906 if (IS_2322(isp) || pci_get_devid(dev) == PCI_QLOGIC_ISP6312) {
907 cmd &= ~PCIM_CMD_INTX_DISABLE;
908 }
909
905 pci_write_config(dev, PCIR_COMMAND, cmd, 2);
906
907 /*
908 * Make sure the Cache Line Size register is set sensibly.
909 */
910 data = pci_read_config(dev, PCIR_CACHELNSZ, 1);
911 if (data != linesz) {
912 data = PCI_DFLT_LNSZ;

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

1109 return (1);
1110}
1111
1112static int
1113isp_pci_rd_isr_2300(ispsoftc_t *isp, uint16_t *isrp,
1114 uint16_t *semap, uint16_t *mbox0p)
1115{
1116 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
910 pci_write_config(dev, PCIR_COMMAND, cmd, 2);
911
912 /*
913 * Make sure the Cache Line Size register is set sensibly.
914 */
915 data = pci_read_config(dev, PCIR_CACHELNSZ, 1);
916 if (data != linesz) {
917 data = PCI_DFLT_LNSZ;

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

1114 return (1);
1115}
1116
1117static int
1118isp_pci_rd_isr_2300(ispsoftc_t *isp, uint16_t *isrp,
1119 uint16_t *semap, uint16_t *mbox0p)
1120{
1121 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp;
1122 uint16_t hccr;
1117 uint32_t r2hisr;
1118
1119 if (!(BXR2(pcs, IspVirt2Off(isp, BIU_ISR) & BIU2100_ISR_RISC_INT))) {
1120 *isrp = 0;
1121 return (0);
1122 }
1123 r2hisr = bus_space_read_4(pcs->pci_st, pcs->pci_sh,
1124 IspVirt2Off(pcs, BIU_R2HSTSLO));

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

1153 *semap = 1;
1154 return (1);
1155 case ISPR2HST_RSPQ_UPDATE:
1156 *isrp = r2hisr & 0xffff;
1157 *mbox0p = 0;
1158 *semap = 0;
1159 return (1);
1160 default:
1123 uint32_t r2hisr;
1124
1125 if (!(BXR2(pcs, IspVirt2Off(isp, BIU_ISR) & BIU2100_ISR_RISC_INT))) {
1126 *isrp = 0;
1127 return (0);
1128 }
1129 r2hisr = bus_space_read_4(pcs->pci_st, pcs->pci_sh,
1130 IspVirt2Off(pcs, BIU_R2HSTSLO));

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

1159 *semap = 1;
1160 return (1);
1161 case ISPR2HST_RSPQ_UPDATE:
1162 *isrp = r2hisr & 0xffff;
1163 *mbox0p = 0;
1164 *semap = 0;
1165 return (1);
1166 default:
1167 hccr = ISP_READ(isp, HCCR);
1168 if (hccr & HCCR_PAUSE) {
1169 ISP_WRITE(isp, HCCR, HCCR_RESET);
1170 isp_prt(isp, ISP_LOGERR,
1171 "RISC paused at interrupt (%x->%x\n", hccr,
1172 ISP_READ(isp, HCCR));
1173 } else {
1174 isp_prt(isp, ISP_LOGERR, "unknown interrerupt 0x%x\n",
1175 r2hisr);
1176 }
1161 return (0);
1162 }
1163}
1164
1165static uint16_t
1166isp_pci_rd_reg(ispsoftc_t *isp, int regoff)
1167{
1168 uint16_t rv;

--- 1241 unchanged lines hidden ---
1177 return (0);
1178 }
1179}
1180
1181static uint16_t
1182isp_pci_rd_reg(ispsoftc_t *isp, int regoff)
1183{
1184 uint16_t rv;

--- 1241 unchanged lines hidden ---