Deleted Added
full compact
isp.c (41525) isp.c (42131)
1/* $Id: isp.c,v 1.7 1998/12/05 01:33:57 mjacob Exp $ */
2/* isp.c 1.28 */
1/* $Id: $ */
2/* release_12_28_98_A */
3/*
4 * Machine and OS Independent (well, as best as possible)
5 * code for the Qlogic ISP SCSI adapters.
6 *
7 *---------------------------------------
8 * Copyright (c) 1997, 1998 by Matthew Jacob
9 * NASA/Ames Research Center
10 * All rights reserved.

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

47
48#ifdef __NetBSD__
49#include <dev/ic/isp_netbsd.h>
50#endif
51#ifdef __FreeBSD__
52#include <dev/isp/isp_freebsd.h>
53#endif
54#ifdef __linux__
3/*
4 * Machine and OS Independent (well, as best as possible)
5 * code for the Qlogic ISP SCSI adapters.
6 *
7 *---------------------------------------
8 * Copyright (c) 1997, 1998 by Matthew Jacob
9 * NASA/Ames Research Center
10 * All rights reserved.

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

47
48#ifdef __NetBSD__
49#include <dev/ic/isp_netbsd.h>
50#endif
51#ifdef __FreeBSD__
52#include <dev/isp/isp_freebsd.h>
53#endif
54#ifdef __linux__
55#include <isp_linux.h>
55#include "isp_linux.h"
56#endif
57
58/*
59 * General defines
60 */
61
62#define MBOX_DELAY_COUNT 1000000 / 100
63

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

867#endif
868 } else {
869 PRINTF("%s: failed to go to FW READY state- will not attach\n",
870 isp->isp_name);
871 }
872}
873
874/*
56#endif
57
58/*
59 * General defines
60 */
61
62#define MBOX_DELAY_COUNT 1000000 / 100
63

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

867#endif
868 } else {
869 PRINTF("%s: failed to go to FW READY state- will not attach\n",
870 isp->isp_name);
871 }
872}
873
874/*
875 * Free any associated resources prior to decommissioning and
876 * set the card to a known state (so it doesn't wake up and kick
877 * us when we aren't expecting it to).
878 *
879 * Locks are held before coming here.
880 */
881void
882isp_uninit(isp)
883 struct ispsoftc *isp;
884{
885 /*
886 * Leave with interrupts disabled.
887 */
888 DISABLE_INTS(isp);
889
890 /*
891 * Stop the watchdog timer (if started).
892 */
893 STOP_WATCHDOG(isp_watch, isp);
894}
895
896
897/*
898 * Start a command. Locking is assumed done in the caller.
899 */
900
901int32_t
902ispscsicmd(xs)
903 ISP_SCSI_XFER_T *xs;
904{
905 struct ispsoftc *isp;

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

3096 if (isp->isp_nactive > 0)
3097 isp->isp_nactive--;
3098 XS_RESID(xs) = XS_XFRLEN(xs);
3099 XS_SETERR(xs, HBA_BUSRESET);
3100 XS_CMD_DONE(xs);
3101 }
3102}
3103
875 * Start a command. Locking is assumed done in the caller.
876 */
877
878int32_t
879ispscsicmd(xs)
880 ISP_SCSI_XFER_T *xs;
881{
882 struct ispsoftc *isp;

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

3073 if (isp->isp_nactive > 0)
3074 isp->isp_nactive--;
3075 XS_RESID(xs) = XS_XFRLEN(xs);
3076 XS_SETERR(xs, HBA_BUSRESET);
3077 XS_CMD_DONE(xs);
3078 }
3079}
3080
3104void
3105isp_watch(arg)
3106 void *arg;
3107{
3108 int i;
3109 struct ispsoftc *isp = arg;
3110 ISP_SCSI_XFER_T *xs;
3111 ISP_LOCKVAL_DECL;
3112
3113 /*
3114 * Look for completely dead commands (but not polled ones).
3115 */
3116 ISP_ILOCK(isp);
3117 for (i = 0; i < RQUEST_QUEUE_LEN; i++) {
3118 if ((xs = (ISP_SCSI_XFER_T *) isp->isp_xflist[i]) == NULL) {
3119 continue;
3120 }
3121 if (XS_TIME(xs) == 0) {
3122 continue;
3123 }
3124 XS_TIME(xs) -= (WATCH_INTERVAL * 1000);
3125 /*
3126 * Avoid later thinking that this
3127 * transaction is not being timed.
3128 * Then give ourselves to watchdog
3129 * periods of grace.
3130 */
3131 if (XS_TIME(xs) == 0)
3132 XS_TIME(xs) = 1;
3133 else if (XS_TIME(xs) > -(2 * WATCH_INTERVAL * 1000)) {
3134 continue;
3135 }
3136 if (isp_control(isp, ISPCTL_ABORT_CMD, xs)) {
3137 PRINTF("%s: isp_watch failed to abort command\n",
3138 isp->isp_name);
3139 isp_restart(isp);
3140 break;
3141 }
3142 }
3143 ISP_IUNLOCK(isp);
3144 RESTART_WATCHDOG(isp_watch, isp);
3145}
3146
3147/*
3148 * Miscellaneous debug statements.
3149 */
3150static void
3151isp_prtstst(sp)
3152 ispstatusreq_t *sp;
3153{
3154 PRINTF("states->");

--- 321 unchanged lines hidden ---
3081/*
3082 * Miscellaneous debug statements.
3083 */
3084static void
3085isp_prtstst(sp)
3086 ispstatusreq_t *sp;
3087{
3088 PRINTF("states->");

--- 321 unchanged lines hidden ---