isp_freebsd.c (155228) | isp_freebsd.c (155704) |
---|---|
1/*- 2 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 3 * 4 * Copyright (c) 1997-2006 by Matthew Jacob 5 * 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 --- 13 unchanged lines hidden (view full) --- 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. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 3 * 4 * Copyright (c) 1997-2006 by Matthew Jacob 5 * 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 --- 13 unchanged lines hidden (view full) --- 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. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 155228 2006-02-02 21:31:34Z mjacob $"); | 30__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 155704 2006-02-15 00:31:48Z mjacob $"); |
31 32#include <dev/isp/isp_freebsd.h> 33#include <sys/unistd.h> 34#include <sys/kthread.h> 35#include <machine/stdarg.h> /* for use by isp_prt below */ 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> 40 41 42MODULE_VERSION(isp, 1); 43MODULE_DEPEND(isp, cam, 1, 1, 1); 44int isp_announced = 0; 45ispfwfunc *isp_get_firmware_p = NULL; 46 47static d_ioctl_t ispioctl; 48static void isp_intr_enable(void *); | 31 32#include <dev/isp/isp_freebsd.h> 33#include <sys/unistd.h> 34#include <sys/kthread.h> 35#include <machine/stdarg.h> /* for use by isp_prt below */ 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> 40 41 42MODULE_VERSION(isp, 1); 43MODULE_DEPEND(isp, cam, 1, 1, 1); 44int isp_announced = 0; 45ispfwfunc *isp_get_firmware_p = NULL; 46 47static d_ioctl_t ispioctl; 48static void isp_intr_enable(void *); |
49static void isp_cam_async(void *, u_int32_t, struct cam_path *, void *); | 49static void isp_cam_async(void *, uint32_t, struct cam_path *, void *); |
50static void isp_poll(struct cam_sim *); 51static timeout_t isp_watchdog; 52static void isp_kthread(void *); 53static void isp_action(struct cam_sim *, union ccb *); 54 55 56static struct cdevsw isp_cdevsw = { 57 .d_version = D_VERSION, --- 195 unchanged lines hidden (view full) --- 253 } 254 if (isp == NULL) 255 return (ENXIO); 256 257 switch (cmd) { 258#ifdef ISP_FW_CRASH_DUMP 259 case ISP_GET_FW_CRASH_DUMP: 260 { | 50static void isp_poll(struct cam_sim *); 51static timeout_t isp_watchdog; 52static void isp_kthread(void *); 53static void isp_action(struct cam_sim *, union ccb *); 54 55 56static struct cdevsw isp_cdevsw = { 57 .d_version = D_VERSION, --- 195 unchanged lines hidden (view full) --- 253 } 254 if (isp == NULL) 255 return (ENXIO); 256 257 switch (cmd) { 258#ifdef ISP_FW_CRASH_DUMP 259 case ISP_GET_FW_CRASH_DUMP: 260 { |
261 u_int16_t *ptr = FCPARAM(isp)->isp_dump_data; | 261 uint16_t *ptr = FCPARAM(isp)->isp_dump_data; |
262 size_t sz; 263 264 retval = 0; 265 if (IS_2200(isp)) 266 sz = QLA2200_RISC_IMAGE_DUMP_SIZE; 267 else 268 sz = QLA2300_RISC_IMAGE_DUMP_SIZE; 269 ISP_LOCK(isp); --- 177 unchanged lines hidden (view full) --- 447 break; 448 } 449 retval = EINVAL; 450 break; 451 } 452 case ISP_SET_FC_PARAM: 453 { 454 struct isp_fc_param *f = (struct isp_fc_param *) addr; | 262 size_t sz; 263 264 retval = 0; 265 if (IS_2200(isp)) 266 sz = QLA2200_RISC_IMAGE_DUMP_SIZE; 267 else 268 sz = QLA2300_RISC_IMAGE_DUMP_SIZE; 269 ISP_LOCK(isp); --- 177 unchanged lines hidden (view full) --- 447 break; 448 } 449 retval = EINVAL; 450 break; 451 } 452 case ISP_SET_FC_PARAM: 453 { 454 struct isp_fc_param *f = (struct isp_fc_param *) addr; |
455 u_int32_t param = f->parameter; | 455 uint32_t param = f->parameter; |
456 457 if (!IS_FC(isp)) { 458 retval = EINVAL; 459 break; 460 } 461 f->parameter = 0; 462 if (strcmp(f->param_name, "framelength") == 0) { 463 if (param != 512 && param != 1024 && param != 1024) { --- 39 unchanged lines hidden (view full) --- 503 } 504 retval = EINVAL; 505 break; 506 } 507 case ISP_TSK_MGMT: 508 { 509 int needmarker; 510 struct isp_fc_tsk_mgmt *fct = (struct isp_fc_tsk_mgmt *) addr; | 456 457 if (!IS_FC(isp)) { 458 retval = EINVAL; 459 break; 460 } 461 f->parameter = 0; 462 if (strcmp(f->param_name, "framelength") == 0) { 463 if (param != 512 && param != 1024 && param != 1024) { --- 39 unchanged lines hidden (view full) --- 503 } 504 retval = EINVAL; 505 break; 506 } 507 case ISP_TSK_MGMT: 508 { 509 int needmarker; 510 struct isp_fc_tsk_mgmt *fct = (struct isp_fc_tsk_mgmt *) addr; |
511 u_int16_t loopid; | 511 uint16_t loopid; |
512 mbreg_t mbs; 513 514 if (IS_SCSI(isp)) { 515 retval = EINVAL; 516 break; 517 } 518 519 memset(&mbs, 0, sizeof (mbs)); --- 258 unchanged lines hidden (view full) --- 778/* 779 * Enable luns. 780 */ 781static int 782isp_en_lun(struct ispsoftc *isp, union ccb *ccb) 783{ 784 struct ccb_en_lun *cel = &ccb->cel; 785 tstate_t *tptr; | 512 mbreg_t mbs; 513 514 if (IS_SCSI(isp)) { 515 retval = EINVAL; 516 break; 517 } 518 519 memset(&mbs, 0, sizeof (mbs)); --- 258 unchanged lines hidden (view full) --- 778/* 779 * Enable luns. 780 */ 781static int 782isp_en_lun(struct ispsoftc *isp, union ccb *ccb) 783{ 784 struct ccb_en_lun *cel = &ccb->cel; 785 tstate_t *tptr; |
786 u_int32_t seq; | 786 uint32_t seq; |
787 int bus, cmd, av, wildcard, tm_on; 788 lun_id_t lun; 789 target_id_t tgt; 790 791 bus = XS_CHANNEL(ccb); 792 if (bus > 1) { 793 xpt_print_path(ccb->ccb_h.path); 794 printf("illegal bus %d\n", bus); --- 226 unchanged lines hidden (view full) --- 1021 return (-1); 1022} 1023 1024static void 1025isp_ledone(struct ispsoftc *isp, lun_entry_t *lep) 1026{ 1027 const char lfmt[] = "lun %d now %sabled for target mode on channel %d"; 1028 union ccb *ccb; | 787 int bus, cmd, av, wildcard, tm_on; 788 lun_id_t lun; 789 target_id_t tgt; 790 791 bus = XS_CHANNEL(ccb); 792 if (bus > 1) { 793 xpt_print_path(ccb->ccb_h.path); 794 printf("illegal bus %d\n", bus); --- 226 unchanged lines hidden (view full) --- 1021 return (-1); 1022} 1023 1024static void 1025isp_ledone(struct ispsoftc *isp, lun_entry_t *lep) 1026{ 1027 const char lfmt[] = "lun %d now %sabled for target mode on channel %d"; 1028 union ccb *ccb; |
1029 u_int32_t seq; | 1029 uint32_t seq; |
1030 tstate_t *tptr; 1031 int av; 1032 struct ccb_en_lun *cel; 1033 1034 seq = lep->le_reserved - 1; 1035 if (seq >= NLEACT) { 1036 isp_prt(isp, ISP_LOGERR, 1037 "seq out of range (%u) in isp_ledone", seq); --- 158 unchanged lines hidden (view full) --- 1196 return (CAM_PATH_INVALID); 1197} 1198 1199static cam_status 1200isp_target_start_ctio(struct ispsoftc *isp, union ccb *ccb) 1201{ 1202 void *qe; 1203 struct ccb_scsiio *cso = &ccb->csio; | 1030 tstate_t *tptr; 1031 int av; 1032 struct ccb_en_lun *cel; 1033 1034 seq = lep->le_reserved - 1; 1035 if (seq >= NLEACT) { 1036 isp_prt(isp, ISP_LOGERR, 1037 "seq out of range (%u) in isp_ledone", seq); --- 158 unchanged lines hidden (view full) --- 1196 return (CAM_PATH_INVALID); 1197} 1198 1199static cam_status 1200isp_target_start_ctio(struct ispsoftc *isp, union ccb *ccb) 1201{ 1202 void *qe; 1203 struct ccb_scsiio *cso = &ccb->csio; |
1204 u_int16_t *hp, save_handle; 1205 u_int16_t nxti, optr; 1206 u_int8_t local[QENTRY_LEN]; | 1204 uint16_t *hp, save_handle; 1205 uint16_t nxti, optr; 1206 uint8_t local[QENTRY_LEN]; |
1207 1208 1209 if (isp_getrqentry(isp, &nxti, &optr, &qe)) { 1210 xpt_print_path(ccb->ccb_h.path); 1211 printf("Request Queue Overflow in isp_target_start_ctio\n"); 1212 return (CAM_RESRC_UNAVAIL); 1213 } 1214 bzero(local, QENTRY_LEN); --- 91 unchanged lines hidden (view full) --- 1306 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO; 1307 cto->ct_header.rqs_entry_count = 1; 1308 cto->ct_iid = cso->init_id; 1309 cto->ct_iid |= XS_CHANNEL(ccb) << 7; 1310 cto->ct_tgt = ccb->ccb_h.target_id; 1311 cto->ct_lun = ccb->ccb_h.target_lun; 1312 cto->ct_fwhandle = AT_GET_HANDLE(cso->tag_id); 1313 if (AT_HAS_TAG(cso->tag_id)) { | 1207 1208 1209 if (isp_getrqentry(isp, &nxti, &optr, &qe)) { 1210 xpt_print_path(ccb->ccb_h.path); 1211 printf("Request Queue Overflow in isp_target_start_ctio\n"); 1212 return (CAM_RESRC_UNAVAIL); 1213 } 1214 bzero(local, QENTRY_LEN); --- 91 unchanged lines hidden (view full) --- 1306 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO; 1307 cto->ct_header.rqs_entry_count = 1; 1308 cto->ct_iid = cso->init_id; 1309 cto->ct_iid |= XS_CHANNEL(ccb) << 7; 1310 cto->ct_tgt = ccb->ccb_h.target_id; 1311 cto->ct_lun = ccb->ccb_h.target_lun; 1312 cto->ct_fwhandle = AT_GET_HANDLE(cso->tag_id); 1313 if (AT_HAS_TAG(cso->tag_id)) { |
1314 cto->ct_tag_val = (u_int8_t) AT_GET_TAG(cso->tag_id); | 1314 cto->ct_tag_val = (uint8_t) AT_GET_TAG(cso->tag_id); |
1315 cto->ct_flags |= CT_TQAE; 1316 } 1317 if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) { 1318 cto->ct_flags |= CT_NODISC; 1319 } 1320 if (cso->dxfer_len == 0) { 1321 cto->ct_flags |= CT_NO_DATA; 1322 } else if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { --- 57 unchanged lines hidden (view full) --- 1380 splx(s); 1381} 1382 1383static void 1384isp_target_putback_atio(union ccb *ccb) 1385{ 1386 struct ispsoftc *isp; 1387 struct ccb_scsiio *cso; | 1315 cto->ct_flags |= CT_TQAE; 1316 } 1317 if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) { 1318 cto->ct_flags |= CT_NODISC; 1319 } 1320 if (cso->dxfer_len == 0) { 1321 cto->ct_flags |= CT_NO_DATA; 1322 } else if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { --- 57 unchanged lines hidden (view full) --- 1380 splx(s); 1381} 1382 1383static void 1384isp_target_putback_atio(union ccb *ccb) 1385{ 1386 struct ispsoftc *isp; 1387 struct ccb_scsiio *cso; |
1388 u_int16_t nxti, optr; | 1388 uint16_t nxti, optr; |
1389 void *qe; 1390 1391 isp = XS_ISP(ccb); 1392 1393 if (isp_getrqentry(isp, &nxti, &optr, &qe)) { 1394 (void) timeout(isp_refire_putback_atio, ccb, 10); 1395 isp_prt(isp, ISP_LOGWARN, 1396 "isp_target_putback_atio: Request Queue Overflow"); --- 295 unchanged lines hidden (view full) --- 1692 return (0); 1693} 1694 1695static int 1696isp_handle_platform_ctio(struct ispsoftc *isp, void *arg) 1697{ 1698 union ccb *ccb; 1699 int sentstatus, ok, notify_cam, resid = 0; | 1389 void *qe; 1390 1391 isp = XS_ISP(ccb); 1392 1393 if (isp_getrqentry(isp, &nxti, &optr, &qe)) { 1394 (void) timeout(isp_refire_putback_atio, ccb, 10); 1395 isp_prt(isp, ISP_LOGWARN, 1396 "isp_target_putback_atio: Request Queue Overflow"); --- 295 unchanged lines hidden (view full) --- 1692 return (0); 1693} 1694 1695static int 1696isp_handle_platform_ctio(struct ispsoftc *isp, void *arg) 1697{ 1698 union ccb *ccb; 1699 int sentstatus, ok, notify_cam, resid = 0; |
1700 u_int16_t tval; | 1700 uint16_t tval; |
1701 1702 /* 1703 * CTIO and CTIO2 are close enough.... 1704 */ 1705 1706 ccb = isp_find_xs_tgt(isp, ((ct_entry_t *)arg)->ct_syshandle); 1707 KASSERT((ccb != NULL), ("null ccb in isp_handle_platform_ctio")); 1708 isp_destroy_tgt_handle(isp, ((ct_entry_t *)arg)->ct_syshandle); --- 154 unchanged lines hidden (view full) --- 1863 default: 1864 break; 1865 } 1866 return (0); 1867} 1868#endif 1869 1870static void | 1701 1702 /* 1703 * CTIO and CTIO2 are close enough.... 1704 */ 1705 1706 ccb = isp_find_xs_tgt(isp, ((ct_entry_t *)arg)->ct_syshandle); 1707 KASSERT((ccb != NULL), ("null ccb in isp_handle_platform_ctio")); 1708 isp_destroy_tgt_handle(isp, ((ct_entry_t *)arg)->ct_syshandle); --- 154 unchanged lines hidden (view full) --- 1863 default: 1864 break; 1865 } 1866 return (0); 1867} 1868#endif 1869 1870static void |
1871isp_cam_async(void *cbarg, u_int32_t code, struct cam_path *path, void *arg) | 1871isp_cam_async(void *cbarg, uint32_t code, struct cam_path *path, void *arg) |
1872{ 1873 struct cam_sim *sim; 1874 struct ispsoftc *isp; 1875 1876 sim = (struct cam_sim *)cbarg; 1877 isp = (struct ispsoftc *) cam_sim_softc(sim); 1878 switch (code) { 1879 case AC_LOST_DEVICE: 1880 if (IS_SCSI(isp)) { | 1872{ 1873 struct cam_sim *sim; 1874 struct ispsoftc *isp; 1875 1876 sim = (struct cam_sim *)cbarg; 1877 isp = (struct ispsoftc *) cam_sim_softc(sim); 1878 switch (code) { 1879 case AC_LOST_DEVICE: 1880 if (IS_SCSI(isp)) { |
1881 u_int16_t oflags, nflags; | 1881 uint16_t oflags, nflags; |
1882 sdparam *sdp = isp->isp_param; 1883 int tgt; 1884 1885 tgt = xpt_path_target_id(path); 1886 if (tgt >= 0) { 1887 sdp += cam_sim_bus(sim); 1888 ISP_LOCK(isp); 1889 nflags = sdp->isp_devparam[tgt].nvrm_flags; --- 21 unchanged lines hidden (view full) --- 1911 break; 1912 } 1913} 1914 1915static void 1916isp_poll(struct cam_sim *sim) 1917{ 1918 struct ispsoftc *isp = cam_sim_softc(sim); | 1882 sdparam *sdp = isp->isp_param; 1883 int tgt; 1884 1885 tgt = xpt_path_target_id(path); 1886 if (tgt >= 0) { 1887 sdp += cam_sim_bus(sim); 1888 ISP_LOCK(isp); 1889 nflags = sdp->isp_devparam[tgt].nvrm_flags; --- 21 unchanged lines hidden (view full) --- 1911 break; 1912 } 1913} 1914 1915static void 1916isp_poll(struct cam_sim *sim) 1917{ 1918 struct ispsoftc *isp = cam_sim_softc(sim); |
1919 u_int16_t isr, sema, mbox; | 1919 uint16_t isr, sema, mbox; |
1920 1921 ISP_LOCK(isp); 1922 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) { 1923 isp_intr(isp, isr, sema, mbox); 1924 } 1925 ISP_UNLOCK(isp); 1926} 1927 1928 1929static void 1930isp_watchdog(void *arg) 1931{ 1932 XS_T *xs = arg; 1933 struct ispsoftc *isp = XS_ISP(xs); | 1920 1921 ISP_LOCK(isp); 1922 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) { 1923 isp_intr(isp, isr, sema, mbox); 1924 } 1925 ISP_UNLOCK(isp); 1926} 1927 1928 1929static void 1930isp_watchdog(void *arg) 1931{ 1932 XS_T *xs = arg; 1933 struct ispsoftc *isp = XS_ISP(xs); |
1934 u_int32_t handle; | 1934 uint32_t handle; |
1935 int iok; 1936 1937 /* 1938 * We've decided this command is dead. Make sure we're not trying 1939 * to kill a command that's already dead by getting it's handle and 1940 * and seeing whether it's still alive. 1941 */ 1942 ISP_LOCK(isp); 1943 iok = isp->isp_osinfo.intsok; 1944 isp->isp_osinfo.intsok = 0; 1945 handle = isp_find_handle(isp, xs); 1946 if (handle) { | 1935 int iok; 1936 1937 /* 1938 * We've decided this command is dead. Make sure we're not trying 1939 * to kill a command that's already dead by getting it's handle and 1940 * and seeing whether it's still alive. 1941 */ 1942 ISP_LOCK(isp); 1943 iok = isp->isp_osinfo.intsok; 1944 isp->isp_osinfo.intsok = 0; 1945 handle = isp_find_handle(isp, xs); 1946 if (handle) { |
1947 u_int16_t isr, sema, mbox; | 1947 uint16_t isr, sema, mbox; |
1948 1949 if (XS_CMD_DONE_P(xs)) { 1950 isp_prt(isp, ISP_LOGDEBUG1, 1951 "watchdog found done cmd (handle 0x%x)", handle); 1952 ISP_UNLOCK(isp); 1953 return; 1954 } 1955 --- 28 unchanged lines hidden (view full) --- 1984 isp_destroy_handle(isp, handle); 1985 xpt_print_path(xs->ccb_h.path); 1986 isp_prt(isp, ISP_LOGWARN, 1987 "watchdog timeout for handle 0x%x", handle); 1988 XS_SETERR(xs, CAM_CMD_TIMEOUT); 1989 XS_CMD_C_WDOG(xs); 1990 isp_done(xs); 1991 } else { | 1948 1949 if (XS_CMD_DONE_P(xs)) { 1950 isp_prt(isp, ISP_LOGDEBUG1, 1951 "watchdog found done cmd (handle 0x%x)", handle); 1952 ISP_UNLOCK(isp); 1953 return; 1954 } 1955 --- 28 unchanged lines hidden (view full) --- 1984 isp_destroy_handle(isp, handle); 1985 xpt_print_path(xs->ccb_h.path); 1986 isp_prt(isp, ISP_LOGWARN, 1987 "watchdog timeout for handle 0x%x", handle); 1988 XS_SETERR(xs, CAM_CMD_TIMEOUT); 1989 XS_CMD_C_WDOG(xs); 1990 isp_done(xs); 1991 } else { |
1992 u_int16_t nxti, optr; | 1992 uint16_t nxti, optr; |
1993 ispreq_t local, *mp= &local, *qe; 1994 1995 XS_CMD_C_WDOG(xs); 1996 xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz); 1997 if (isp_getrqentry(isp, &nxti, &optr, (void **) &qe)) { 1998 ISP_UNLOCK(isp); 1999 return; 2000 } --- 131 unchanged lines hidden (view full) --- 2132#endif 2133 ((struct ccb_scsiio *) ccb)->scsi_status = SCSI_STATUS_OK; 2134 CAMLOCK_2_ISPLOCK(isp); 2135 error = isp_start((XS_T *) ccb); 2136 switch (error) { 2137 case CMD_QUEUED: 2138 ccb->ccb_h.status |= CAM_SIM_QUEUED; 2139 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) { | 1993 ispreq_t local, *mp= &local, *qe; 1994 1995 XS_CMD_C_WDOG(xs); 1996 xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz); 1997 if (isp_getrqentry(isp, &nxti, &optr, (void **) &qe)) { 1998 ISP_UNLOCK(isp); 1999 return; 2000 } --- 131 unchanged lines hidden (view full) --- 2132#endif 2133 ((struct ccb_scsiio *) ccb)->scsi_status = SCSI_STATUS_OK; 2134 CAMLOCK_2_ISPLOCK(isp); 2135 error = isp_start((XS_T *) ccb); 2136 switch (error) { 2137 case CMD_QUEUED: 2138 ccb->ccb_h.status |= CAM_SIM_QUEUED; 2139 if (ccb->ccb_h.timeout != CAM_TIME_INFINITY) { |
2140 u_int64_t ticks = (u_int64_t) hz; | 2140 uint64_t ticks = (uint64_t) hz; |
2141 if (ccb->ccb_h.timeout == CAM_TIME_DEFAULT) 2142 ticks = 60 * 1000 * ticks; 2143 else 2144 ticks = ccb->ccb_h.timeout * hz; 2145 ticks = ((ticks + 999) / 1000) + hz + hz; 2146 if (ticks >= 0x80000000) { 2147 isp_prt(isp, ISP_LOGERR, 2148 "timeout overflow"); --- 57 unchanged lines hidden (view full) --- 2206 seq = isp_en_lun(isp, ccb); 2207 if (seq < 0) { 2208 isp->isp_osinfo.intsok = iok; 2209 ISPLOCK_2_CAMLOCK(isp); 2210 xpt_done(ccb); 2211 break; 2212 } 2213 for (i = 0; isp->isp_osinfo.leact[seq] && i < 30 * 1000; i++) { | 2141 if (ccb->ccb_h.timeout == CAM_TIME_DEFAULT) 2142 ticks = 60 * 1000 * ticks; 2143 else 2144 ticks = ccb->ccb_h.timeout * hz; 2145 ticks = ((ticks + 999) / 1000) + hz + hz; 2146 if (ticks >= 0x80000000) { 2147 isp_prt(isp, ISP_LOGERR, 2148 "timeout overflow"); --- 57 unchanged lines hidden (view full) --- 2206 seq = isp_en_lun(isp, ccb); 2207 if (seq < 0) { 2208 isp->isp_osinfo.intsok = iok; 2209 ISPLOCK_2_CAMLOCK(isp); 2210 xpt_done(ccb); 2211 break; 2212 } 2213 for (i = 0; isp->isp_osinfo.leact[seq] && i < 30 * 1000; i++) { |
2214 u_int16_t isr, sema, mbox; | 2214 uint16_t isr, sema, mbox; |
2215 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) { 2216 isp_intr(isp, isr, sema, mbox); 2217 } 2218 DELAY(1000); 2219 } 2220 isp->isp_osinfo.intsok = iok; 2221 ISPLOCK_2_CAMLOCK(isp); 2222 break; --- 117 unchanged lines hidden (view full) --- 2340 xpt_done(ccb); 2341 break; 2342 } 2343 tgt = cts->ccb_h.target_id; 2344 CAMLOCK_2_ISPLOCK(isp); 2345 if (IS_SCSI(isp)) { 2346#ifndef CAM_NEW_TRAN_CODE 2347 sdparam *sdp = isp->isp_param; | 2215 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) { 2216 isp_intr(isp, isr, sema, mbox); 2217 } 2218 DELAY(1000); 2219 } 2220 isp->isp_osinfo.intsok = iok; 2221 ISPLOCK_2_CAMLOCK(isp); 2222 break; --- 117 unchanged lines hidden (view full) --- 2340 xpt_done(ccb); 2341 break; 2342 } 2343 tgt = cts->ccb_h.target_id; 2344 CAMLOCK_2_ISPLOCK(isp); 2345 if (IS_SCSI(isp)) { 2346#ifndef CAM_NEW_TRAN_CODE 2347 sdparam *sdp = isp->isp_param; |
2348 u_int16_t *dptr; | 2348 uint16_t *dptr; |
2349 2350 bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path)); 2351 2352 sdp += bus; 2353 /* 2354 * We always update (internally) from goal_flags 2355 * so any request to change settings just gets 2356 * vectored to that location. --- 46 unchanged lines hidden (view full) --- 2403 } 2404 *dptr |= DPARM_SAFE_DFLT; 2405#else 2406 struct ccb_trans_settings_scsi *scsi = 2407 &cts->proto_specific.scsi; 2408 struct ccb_trans_settings_spi *spi = 2409 &cts->xport_specific.spi; 2410 sdparam *sdp = isp->isp_param; | 2349 2350 bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path)); 2351 2352 sdp += bus; 2353 /* 2354 * We always update (internally) from goal_flags 2355 * so any request to change settings just gets 2356 * vectored to that location. --- 46 unchanged lines hidden (view full) --- 2403 } 2404 *dptr |= DPARM_SAFE_DFLT; 2405#else 2406 struct ccb_trans_settings_scsi *scsi = 2407 &cts->proto_specific.scsi; 2408 struct ccb_trans_settings_spi *spi = 2409 &cts->xport_specific.spi; 2410 sdparam *sdp = isp->isp_param; |
2411 u_int16_t *dptr; | 2411 uint16_t *dptr; |
2412 2413 bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path)); 2414 sdp += bus; 2415 /* 2416 * We always update (internally) from goal_flags 2417 * so any request to change settings just gets 2418 * vectored to that location. 2419 */ --- 97 unchanged lines hidden (view full) --- 2517#ifdef CAM_NEW_TRAN_CODE 2518 struct ccb_trans_settings_scsi *scsi = 2519 &cts->proto_specific.scsi; 2520 struct ccb_trans_settings_spi *spi = 2521 &cts->xport_specific.spi; 2522#endif 2523 sdparam *sdp = isp->isp_param; 2524 int bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path)); | 2412 2413 bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path)); 2414 sdp += bus; 2415 /* 2416 * We always update (internally) from goal_flags 2417 * so any request to change settings just gets 2418 * vectored to that location. 2419 */ --- 97 unchanged lines hidden (view full) --- 2517#ifdef CAM_NEW_TRAN_CODE 2518 struct ccb_trans_settings_scsi *scsi = 2519 &cts->proto_specific.scsi; 2520 struct ccb_trans_settings_spi *spi = 2521 &cts->xport_specific.spi; 2522#endif 2523 sdparam *sdp = isp->isp_param; 2524 int bus = cam_sim_bus(xpt_path_sim(cts->ccb_h.path)); |
2525 u_int16_t dval, pval, oval; | 2525 uint16_t dval, pval, oval; |
2526 2527 sdp += bus; 2528 2529 if (IS_CURRENT_SETTINGS(cts)) { 2530 sdp->isp_devparam[tgt].dev_refresh = 1; 2531 isp->isp_update |= (1 << bus); 2532 (void) isp_control(isp, ISPCTL_UPDATE_PARAMS, 2533 NULL); --- 381 unchanged lines hidden (view full) --- 2915 fcparam *fcp = isp->isp_param; 2916 int tgt = *((int *) arg); 2917 int is_tgt_mask = (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT); 2918 struct lportdb *lp = &fcp->portdb[tgt]; 2919 2920 isp_prt(isp, ISP_LOGINFO, fmt, tgt, lp->loopid, lp->portid, 2921 roles[lp->roles & 0x3], 2922 (lp->valid)? "Arrived" : "Departed", | 2526 2527 sdp += bus; 2528 2529 if (IS_CURRENT_SETTINGS(cts)) { 2530 sdp->isp_devparam[tgt].dev_refresh = 1; 2531 isp->isp_update |= (1 << bus); 2532 (void) isp_control(isp, ISPCTL_UPDATE_PARAMS, 2533 NULL); --- 381 unchanged lines hidden (view full) --- 2915 fcparam *fcp = isp->isp_param; 2916 int tgt = *((int *) arg); 2917 int is_tgt_mask = (SVC3_TGT_ROLE >> SVC3_ROLE_SHIFT); 2918 struct lportdb *lp = &fcp->portdb[tgt]; 2919 2920 isp_prt(isp, ISP_LOGINFO, fmt, tgt, lp->loopid, lp->portid, 2921 roles[lp->roles & 0x3], 2922 (lp->valid)? "Arrived" : "Departed", |
2923 (u_int32_t) (lp->port_wwn >> 32), 2924 (u_int32_t) (lp->port_wwn & 0xffffffffLL), 2925 (u_int32_t) (lp->node_wwn >> 32), 2926 (u_int32_t) (lp->node_wwn & 0xffffffffLL)); | 2923 (uint32_t) (lp->port_wwn >> 32), 2924 (uint32_t) (lp->port_wwn & 0xffffffffLL), 2925 (uint32_t) (lp->node_wwn >> 32), 2926 (uint32_t) (lp->node_wwn & 0xffffffffLL)); |
2927 2928 ISPLOCK_2_CAMLOCK(isp); 2929 if (xpt_create_path(&tmppath, NULL, cam_sim_path(isp->isp_sim), 2930 (target_id_t)tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { 2931 CAMLOCK_2_ISPLOCK(isp); 2932 break; 2933 } 2934 /* --- 174 unchanged lines hidden (view full) --- 3109 case RQSTYPE_MODIFY_LUN: 3110 isp_ledone(isp, (lun_entry_t *) arg); 3111 break; 3112 } 3113 break; 3114#endif 3115 case ISPASYNC_FW_CRASH: 3116 { | 2927 2928 ISPLOCK_2_CAMLOCK(isp); 2929 if (xpt_create_path(&tmppath, NULL, cam_sim_path(isp->isp_sim), 2930 (target_id_t)tgt, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { 2931 CAMLOCK_2_ISPLOCK(isp); 2932 break; 2933 } 2934 /* --- 174 unchanged lines hidden (view full) --- 3109 case RQSTYPE_MODIFY_LUN: 3110 isp_ledone(isp, (lun_entry_t *) arg); 3111 break; 3112 } 3113 break; 3114#endif 3115 case ISPASYNC_FW_CRASH: 3116 { |
3117 u_int16_t mbox1, mbox6; | 3117 uint16_t mbox1, mbox6; |
3118 mbox1 = ISP_READ(isp, OUTMAILBOX1); 3119 if (IS_DUALBUS(isp)) { 3120 mbox6 = ISP_READ(isp, OUTMAILBOX6); 3121 } else { 3122 mbox6 = 0; 3123 } 3124 isp_prt(isp, ISP_LOGERR, 3125 "Internal Firmware Error on bus %d @ RISC Address 0x%x", --- 49 unchanged lines hidden --- | 3118 mbox1 = ISP_READ(isp, OUTMAILBOX1); 3119 if (IS_DUALBUS(isp)) { 3120 mbox6 = ISP_READ(isp, OUTMAILBOX6); 3121 } else { 3122 mbox6 = 0; 3123 } 3124 isp_prt(isp, ISP_LOGERR, 3125 "Internal Firmware Error on bus %d @ RISC Address 0x%x", --- 49 unchanged lines hidden --- |