isp_pci.c (154850) | isp_pci.c (155228) |
---|---|
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 154850 2006-01-26 06:15:58Z mjacob $"); | 32__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 155228 2006-02-02 21:31:34Z 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 --- 831 unchanged lines hidden (view full) --- 872 _BLK_REG_SHFT] + ((x) & 0xff)) 873 874#define BXR2(pcs, off) \ 875 bus_space_read_2(pcs->pci_st, pcs->pci_sh, off) 876#define BXW2(pcs, off, v) \ 877 bus_space_write_2(pcs->pci_st, pcs->pci_sh, off, v) 878 879 | 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 --- 831 unchanged lines hidden (view full) --- 872 _BLK_REG_SHFT] + ((x) & 0xff)) 873 874#define BXR2(pcs, off) \ 875 bus_space_read_2(pcs->pci_st, pcs->pci_sh, off) 876#define BXW2(pcs, off, v) \ 877 bus_space_write_2(pcs->pci_st, pcs->pci_sh, off, v) 878 879 |
880static INLINE int | 880static __inline int |
881isp_pci_rd_debounced(struct ispsoftc *isp, int off, u_int16_t *rp) 882{ 883 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; 884 u_int16_t val0, val1; 885 int i = 0; 886 887 do { 888 val0 = BXR2(pcs, IspVirt2Off(isp, off)); --- 234 unchanged lines hidden (view full) --- 1123 1124static int 1125isp_pci_mbxdma(struct ispsoftc *isp) 1126{ 1127 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp; 1128 caddr_t base; 1129 u_int32_t len; 1130 int i, error, ns; | 881isp_pci_rd_debounced(struct ispsoftc *isp, int off, u_int16_t *rp) 882{ 883 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; 884 u_int16_t val0, val1; 885 int i = 0; 886 887 do { 888 val0 = BXR2(pcs, IspVirt2Off(isp, off)); --- 234 unchanged lines hidden (view full) --- 1123 1124static int 1125isp_pci_mbxdma(struct ispsoftc *isp) 1126{ 1127 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp; 1128 caddr_t base; 1129 u_int32_t len; 1130 int i, error, ns; |
1131 bus_size_t alim, slim, xlim; | 1131 bus_size_t slim; /* segment size */ 1132 bus_size_t llim; /* low limit of unavailable dma */ 1133 bus_size_t hlim; /* low limit of unavailable dma */ |
1132 struct imush im; 1133 1134 /* 1135 * Already been here? If so, leave... 1136 */ 1137 if (isp->isp_rquest) { 1138 return (0); 1139 } 1140 1141#ifdef ISP_DAC_SUPPORTED | 1134 struct imush im; 1135 1136 /* 1137 * Already been here? If so, leave... 1138 */ 1139 if (isp->isp_rquest) { 1140 return (0); 1141 } 1142 1143#ifdef ISP_DAC_SUPPORTED |
1142 alim = BUS_SPACE_UNRESTRICTED; 1143 xlim = BUS_SPACE_MAXADDR_32BIT; | 1144 llim = hlim = BUS_SPACE_MAXADDR; |
1144#else | 1145#else |
1145 xlim = alim = BUS_SPACE_MAXADDR_32BIT; | 1146 llim = BUS_SPACE_MAXADDR_32BIT; 1147 hlim = BUS_SPACE_MAXADDR; |
1146#endif 1147 if (IS_ULTRA2(isp) || IS_FC(isp) || IS_1240(isp)) { | 1148#endif 1149 if (IS_ULTRA2(isp) || IS_FC(isp) || IS_1240(isp)) { |
1148 slim = BUS_SPACE_MAXADDR_32BIT; | 1150 slim = (bus_size_t) (1ULL << 32); |
1149 } else { | 1151 } else { |
1150 slim = BUS_SPACE_MAXADDR_24BIT; | 1152 slim = (1 << 24); |
1151 } 1152 1153 ISP_UNLOCK(isp); | 1153 } 1154 1155 ISP_UNLOCK(isp); |
1154 if (bus_dma_tag_create(NULL, 1, slim+1, alim, alim, | 1156 if (bus_dma_tag_create(NULL, 1, slim, llim, hlim, |
1155 NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, 1156 busdma_lock_mutex, &Giant, &pcs->dmat)) { 1157 isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); 1158 ISP_LOCK(isp); 1159 return(1); 1160 } 1161 1162 --- 30 unchanged lines hidden (view full) --- 1193 */ 1194 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1195 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1196 if (IS_FC(isp)) { 1197 len += ISP2100_SCRLEN; 1198 } 1199 1200 ns = (len / PAGE_SIZE) + 1; | 1157 NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, 1158 busdma_lock_mutex, &Giant, &pcs->dmat)) { 1159 isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); 1160 ISP_LOCK(isp); 1161 return(1); 1162 } 1163 1164 --- 30 unchanged lines hidden (view full) --- 1195 */ 1196 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1197 len += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1198 if (IS_FC(isp)) { 1199 len += ISP2100_SCRLEN; 1200 } 1201 1202 ns = (len / PAGE_SIZE) + 1; |
1201 if (bus_dma_tag_create(pcs->dmat, QENTRY_LEN, slim+1, xlim, xlim, | 1203 /* 1204 * Create a tag for the control spaces- force it to within 32 bits. 1205 */ 1206 if (bus_dma_tag_create(pcs->dmat, QENTRY_LEN, slim, 1207 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, |
1202 NULL, NULL, len, ns, slim, 0, busdma_lock_mutex, &Giant, 1203 &isp->isp_cdmat)) { 1204 isp_prt(isp, ISP_LOGERR, 1205 "cannot create a dma tag for control spaces"); 1206 free(pcs->dmaps, M_DEVBUF); 1207 free(isp->isp_xflist, M_DEVBUF); 1208#ifdef ISP_TARGET_MODE 1209 free(isp->isp_tgtlist, M_DEVBUF); --- 919 unchanged lines hidden --- | 1208 NULL, NULL, len, ns, slim, 0, busdma_lock_mutex, &Giant, 1209 &isp->isp_cdmat)) { 1210 isp_prt(isp, ISP_LOGERR, 1211 "cannot create a dma tag for control spaces"); 1212 free(pcs->dmaps, M_DEVBUF); 1213 free(isp->isp_xflist, M_DEVBUF); 1214#ifdef ISP_TARGET_MODE 1215 free(isp->isp_tgtlist, M_DEVBUF); --- 919 unchanged lines hidden --- |