summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>1998-12-28 19:22:27 +0000
committermjacob <mjacob@FreeBSD.org>1998-12-28 19:22:27 +0000
commit13ecc0c78ff9fb8ff85fb5bbc22804ce475e84d5 (patch)
tree70f6096d6e8fc87c1122cfe617c7526abc27c4b3
parent24486a76747904adab3e7d5419dc656fa77611fd (diff)
downloadFreeBSD-src-13ecc0c78ff9fb8ff85fb5bbc22804ce475e84d5.zip
FreeBSD-src-13ecc0c78ff9fb8ff85fb5bbc22804ce475e84d5.tar.gz
clarify headers;move uninit to outer layer;remove watchdog
-rw-r--r--sys/dev/isp/asm_pci.h2
-rw-r--r--sys/dev/isp/asm_sbus.h4
-rw-r--r--sys/dev/isp/isp.c72
-rw-r--r--sys/dev/isp/isp_freebsd.c128
-rw-r--r--sys/dev/isp/isp_freebsd.h11
-rw-r--r--sys/dev/isp/isp_freebsd_cam.h14
-rw-r--r--sys/dev/isp/ispmbox.h2
-rw-r--r--sys/dev/isp/ispreg.h4
-rw-r--r--sys/dev/isp/ispvar.h72
9 files changed, 173 insertions, 136 deletions
diff --git a/sys/dev/isp/asm_pci.h b/sys/dev/isp/asm_pci.h
index 05afd30..b7e0f9a 100644
--- a/sys/dev/isp/asm_pci.h
+++ b/sys/dev/isp/asm_pci.h
@@ -1,5 +1,5 @@
/* $Id: $ */
-/* asm_pci.h 1.10 */
+/* release_12_28_98_A */
/*
* Copyright (c) 1995, 1996, 1997, 1998 by Qlogic Corporation
*/
diff --git a/sys/dev/isp/asm_sbus.h b/sys/dev/isp/asm_sbus.h
index 6222ee0..b5df5f5 100644
--- a/sys/dev/isp/asm_sbus.h
+++ b/sys/dev/isp/asm_sbus.h
@@ -1,5 +1,5 @@
-/* $Id: asm_sbus.h,v 1.1 1998/04/22 17:54:45 mjacob Exp $ */
-/* asm_sbus.h 1.5 */
+/* $Id: $ */
+/* release_12_28_98_A */
/*
* SBus Qlogic Host Adapter Firmware Tables
* Copyright (c) 1996, 1997, 1998 by Qlogic Corporation
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index 75a9644..2e10c87 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -1,5 +1,5 @@
-/* $Id: isp.c,v 1.7 1998/12/05 01:33:57 mjacob Exp $ */
-/* isp.c 1.28 */
+/* $Id: $ */
+/* release_12_28_98_A */
/*
* Machine and OS Independent (well, as best as possible)
* code for the Qlogic ISP SCSI adapters.
@@ -52,7 +52,7 @@
#include <dev/isp/isp_freebsd.h>
#endif
#ifdef __linux__
-#include <isp_linux.h>
+#include "isp_linux.h"
#endif
/*
@@ -872,29 +872,6 @@ isp_fibre_init(isp)
}
/*
- * Free any associated resources prior to decommissioning and
- * set the card to a known state (so it doesn't wake up and kick
- * us when we aren't expecting it to).
- *
- * Locks are held before coming here.
- */
-void
-isp_uninit(isp)
- struct ispsoftc *isp;
-{
- /*
- * Leave with interrupts disabled.
- */
- DISABLE_INTS(isp);
-
- /*
- * Stop the watchdog timer (if started).
- */
- STOP_WATCHDOG(isp_watch, isp);
-}
-
-
-/*
* Start a command. Locking is assumed done in the caller.
*/
@@ -3101,49 +3078,6 @@ isp_restart(isp)
}
}
-void
-isp_watch(arg)
- void *arg;
-{
- int i;
- struct ispsoftc *isp = arg;
- ISP_SCSI_XFER_T *xs;
- ISP_LOCKVAL_DECL;
-
- /*
- * Look for completely dead commands (but not polled ones).
- */
- ISP_ILOCK(isp);
- for (i = 0; i < RQUEST_QUEUE_LEN; i++) {
- if ((xs = (ISP_SCSI_XFER_T *) isp->isp_xflist[i]) == NULL) {
- continue;
- }
- if (XS_TIME(xs) == 0) {
- continue;
- }
- XS_TIME(xs) -= (WATCH_INTERVAL * 1000);
- /*
- * Avoid later thinking that this
- * transaction is not being timed.
- * Then give ourselves to watchdog
- * periods of grace.
- */
- if (XS_TIME(xs) == 0)
- XS_TIME(xs) = 1;
- else if (XS_TIME(xs) > -(2 * WATCH_INTERVAL * 1000)) {
- continue;
- }
- if (isp_control(isp, ISPCTL_ABORT_CMD, xs)) {
- PRINTF("%s: isp_watch failed to abort command\n",
- isp->isp_name);
- isp_restart(isp);
- break;
- }
- }
- ISP_IUNLOCK(isp);
- RESTART_WATCHDOG(isp_watch, isp);
-}
-
/*
* Miscellaneous debug statements.
*/
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index 18c4b29..21d1acd 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -1,5 +1,5 @@
/* $Id: $ */
-/* isp_freebsd.c 1.13 */
+/* release_12_28_98_A */
/*
* Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
*
@@ -42,8 +42,7 @@ static void isp_poll __P((struct cam_sim *));
static void isp_action __P((struct cam_sim *, union ccb *));
void
-isp_attach(isp)
- struct ispsoftc *isp;
+isp_attach(struct ispsoftc *isp)
{
struct ccb_setasync csa;
struct cam_devq *devq;
@@ -97,11 +96,7 @@ isp_attach(isp)
}
static void
-isp_async(cbarg, code, path, arg)
- void *cbarg;
- u_int32_t code;
- struct cam_path *path;
- void *arg;
+isp_async(void *cbarg, u_int32_t code, struct cam_path *path, void *arg)
{
struct cam_sim *sim;
struct ispsoftc *isp;
@@ -135,17 +130,14 @@ isp_async(cbarg, code, path, arg)
}
static void
-isp_poll(sim)
- struct cam_sim *sim;
+isp_poll(struct cam_sim *sim)
{
isp_intr((struct ispsoftc *) cam_sim_softc(sim));
}
static void
-isp_action(sim, ccb)
- struct cam_sim *sim;
- union ccb *ccb;
+isp_action(struct cam_sim *sim, union ccb *ccb)
{
int s, tgt, error;
struct ispsoftc *isp;
@@ -213,7 +205,14 @@ isp_action(sim, ccb)
break;
}
+ CAM_DEBUG(ccb->ccb_h.path, CAM_DEBUG_INFO,
+ ("cdb[0]=0x%x dlen%d\n",
+ (ccb->ccb_h.flags & CAM_CDB_POINTER)?
+ ccb->csio.cdb_io.cdb_ptr[0]:
+ ccb->csio.cdb_io.cdb_bytes[0], ccb->csio.dxfer_len));
+
s = splcam();
+ DISABLE_INTS(isp);
switch (ispscsicmd((ISP_SCSI_XFER_T *) ccb)) {
case CMD_QUEUED:
ccb->ccb_h.status |= CAM_SIM_QUEUED;
@@ -241,6 +240,7 @@ isp_action(sim, ccb)
xpt_done(ccb);
break;
}
+ ENABLE_INTS(isp);
splx(s);
break;
@@ -485,9 +485,9 @@ isp_action(sim, ccb)
cpi->initiator_id =
((fcparam *)isp->isp_param)->isp_loopid;
#ifdef SCCLUN
- cpi->max_lun = 65535;
+ cpi->max_lun = (1 << 16) - 1;
#else
- cpi->max_lun = 15;
+ cpi->max_lun = (1 << 4) - 1;
#endif
} else {
cpi->initiator_id =
@@ -498,12 +498,12 @@ isp_action(sim, ccb)
/*
* Too much breakage.
*/
- cpi->max_lun = 31;
+ cpi->max_lun = (1 << 5) - 1;
#else
- cpi->max_lun = 7;
+ cpi->max_lun = (1 << 3) - 1;
#endif
} else {
- cpi->max_lun = 7;
+ cpi->max_lun = (1 << 3) - 1;
}
}
@@ -525,8 +525,7 @@ isp_action(sim, ccb)
#define ISPDDB (CAM_DEBUG_INFO|CAM_DEBUG_TRACE|CAM_DEBUG_CDB)
void
-isp_done(sccb)
- struct ccb_scsiio *sccb;
+isp_done(struct ccb_scsiio *sccb)
{
struct ispsoftc *isp = XS_ISP(sccb);
@@ -566,6 +565,7 @@ isp_done(sccb)
static void ispminphys __P((struct buf *));
static u_int32_t isp_adapter_info __P((int));
static int ispcmd __P((ISP_SCSI_XFER_T *));
+static void isp_watch __P((void *arg));
static struct scsi_adapter isp_switch = {
ispcmd, ispminphys, 0, 0, isp_adapter_info, "isp", { 0, 0 }
@@ -580,8 +580,7 @@ static int isp_poll __P((struct ispsoftc *, ISP_SCSI_XFER_T *, int));
* Complete attachment of hardware, include subdevices.
*/
void
-isp_attach(isp)
- struct ispsoftc *isp;
+isp_attach(struct ispsoftc *isp)
{
struct scsibus_data *scbus;
@@ -590,6 +589,7 @@ isp_attach(isp)
return;
}
isp->isp_state = ISP_RUNSTATE;
+ START_WATCHDOG(isp);
isp->isp_osinfo._link.adapter_unit = isp->isp_osinfo.unit;
isp->isp_osinfo._link.adapter_softc = isp;
@@ -626,8 +626,7 @@ isp_attach(isp)
*/
static void
-ispminphys(bp)
- struct buf *bp;
+ispminphys(struct buf *bp)
{
/*
* Only the 10X0 has a 24 bit limit.
@@ -638,8 +637,7 @@ ispminphys(bp)
}
static u_int32_t
-isp_adapter_info(unit)
- int unit;
+isp_adapter_info(int unit)
{
/*
* XXX: FIND ISP BASED UPON UNIT AND GET REAL QUEUE LIMIT FROM THAT
@@ -648,8 +646,7 @@ isp_adapter_info(unit)
}
static int
-ispcmd(xs)
- ISP_SCSI_XFER_T *xs;
+ispcmd(ISP_SCSI_XFER_T *xs)
{
struct ispsoftc *isp;
int r;
@@ -686,10 +683,7 @@ ispcmd(xs)
}
static int
-isp_poll(isp, xs, mswait)
- struct ispsoftc *isp;
- ISP_SCSI_XFER_T *xs;
- int mswait;
+isp_poll(struct ispsoftc *isp, ISP_SCSI_XFER_T *xs, int mswait)
{
while (mswait) {
@@ -704,4 +698,74 @@ isp_poll(isp, xs, mswait)
}
return (1);
}
+
+static void
+isp_watch(void *arg)
+{
+ int i;
+ struct ispsoftc *isp = arg;
+ ISP_SCSI_XFER_T *xs;
+ ISP_ILOCKVAL_DECL;
+
+ /*
+ * Look for completely dead commands (but not polled ones).
+ */
+ ISP_ILOCK(isp);
+ for (i = 0; i < RQUEST_QUEUE_LEN; i++) {
+ if ((xs = (ISP_SCSI_XFER_T *) isp->isp_xflist[i]) == NULL) {
+ continue;
+ }
+ if (XS_TIME(xs) == 0) {
+ continue;
+ }
+ XS_TIME(xs) -= (WATCH_INTERVAL * 1000);
+ /*
+ * Avoid later thinking that this
+ * transaction is not being timed.
+ * Then give ourselves to watchdog
+ * periods of grace.
+ */
+ if (XS_TIME(xs) == 0)
+ XS_TIME(xs) = 1;
+ else if (XS_TIME(xs) > -(2 * WATCH_INTERVAL * 1000)) {
+ continue;
+ }
+ if (isp_control(isp, ISPCTL_ABORT_CMD, xs)) {
+ printf("%s: isp_watch failed to abort command\n",
+ isp->isp_name);
+ isp_restart(isp);
+ break;
+ }
+ }
+ RESTART_WATCHDOG(isp_watch, arg);
+ ISP_IUNLOCK(isp);
+}
#endif
+
+/*
+ * Free any associated resources prior to decommissioning and
+ * set the card to a known state (so it doesn't wake up and kick
+ * us when we aren't expecting it to).
+ *
+ * Locks are held before coming here.
+ */
+void
+isp_uninit(struct ispsoftc *isp)
+{
+ ISP_ILOCKVAL_DECL;
+ ISP_ILOCK(isp);
+ /*
+ * Leave with interrupts disabled.
+ */
+ DISABLE_INTS(isp);
+
+ /*
+ * Turn off the watchdog (if active).
+ */
+ STOP_WATCHDOG(isp_watch, isp);
+
+ /*
+ * And out...
+ */
+ ISP_IUNLOCK(isp);
+}
diff --git a/sys/dev/isp/isp_freebsd.h b/sys/dev/isp/isp_freebsd.h
index 7c4fddf..4ef3aac 100644
--- a/sys/dev/isp/isp_freebsd.h
+++ b/sys/dev/isp/isp_freebsd.h
@@ -1,5 +1,5 @@
/* $Id: $ */
-/* isp_freebsd.h 1.16 */
+/* release_12_28_98_A */
/*
* Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (non CAM version)
*---------------------------------------
@@ -36,7 +36,7 @@
#define _ISP_FREEBSD_H
#define ISP_PLATFORM_VERSION_MAJOR 0
-#define ISP_PLATFORM_VERSION_MINOR 97
+#define ISP_PLATFORM_VERSION_MINOR 98
#include <sys/param.h>
@@ -81,6 +81,7 @@ struct isposinfo {
#define DFLT_DBLEVEL 1
#define ISP_LOCKVAL_DECL int isp_spl_save
+#define ISP_ILOCKVAL_DECL ISP_LOCKVAL_DECL
#define ISP_UNLOCK(isp) (void) splx(isp_spl_save)
#define ISP_LOCK(isp) isp_spl_save = splbio()
#define ISP_ILOCK(isp) ISP_LOCK(isp)
@@ -131,18 +132,15 @@ struct isposinfo {
/*
* Our default tag
*/
-#define XS_KINDOF_TAG(xs) REQFLAG_OTAG
+#define XS_KINDOF_TAG(xs) REQFLAG_STAG
#define CMD_COMPLETE COMPLETE
#define CMD_EAGAIN TRY_AGAIN_LATER
#define CMD_QUEUED SUCCESSFULLY_QUEUED
-
-
#define isp_name isp_osinfo.name
-
#define SYS_DELAY(x) DELAY(x)
#define WATCH_INTERVAL 30
@@ -160,6 +158,7 @@ struct isposinfo {
#define RESTART_WATCHDOG(f, s) START_WATCHDOG(f, s)
extern void isp_attach __P((struct ispsoftc *));
+extern void isp_uninit __P((struct ispsoftc *));
#define PVS "Qlogic ISP Driver, FreeBSD Non-Cam"
diff --git a/sys/dev/isp/isp_freebsd_cam.h b/sys/dev/isp/isp_freebsd_cam.h
index af92625..4818689 100644
--- a/sys/dev/isp/isp_freebsd_cam.h
+++ b/sys/dev/isp/isp_freebsd_cam.h
@@ -1,5 +1,5 @@
/* $Id: $ */
-/* isp_freebsd_cam.h 1.10 */
+/* release_12_28_98_A */
/*
* Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (CAM version)
*---------------------------------------
@@ -69,7 +69,6 @@ struct isposinfo {
int unit;
struct cam_sim *sim;
struct cam_path *path;
- struct callout_handle watchid;
volatile char simqfrozen;
};
@@ -97,6 +96,7 @@ struct isposinfo {
#endif
#define ISP_LOCKVAL_DECL int isp_spl_save
+#define ISP_ILOCKVAL_DECL ISP_LOCKVAL_DECL
#define ISP_UNLOCK(isp) (void) splx(isp_spl_save)
#define ISP_LOCK(isp) isp_spl_save = splcam()
#define ISP_ILOCK(isp) ISP_LOCK(isp)
@@ -171,14 +171,8 @@ extern void isp_done(struct ccb_scsiio *);
#define CMD_QUEUED 2
#define SYS_DELAY(x) DELAY(x)
-
-#define WATCH_INTERVAL 30
-#define START_WATCHDOG(f, s) \
- (s)->isp_osinfo.watchid = timeout(f, s, WATCH_INTERVAL * hz), \
- s->isp_dogactive = 1
-#define STOP_WATCHDOG(f, s) untimeout(f, s, (s)->isp_osinfo.watchid),\
- (s)->isp_dogactive = 0
-#define RESTART_WATCHDOG(f, s) START_WATCHDOG(f, s)
+#define STOP_WATCHDOG(f, s)
extern void isp_attach __P((struct ispsoftc *));
+extern void isp_uninit __P((struct ispsoftc *));
#endif /* _ISP_FREEBSD_CAM_H */
diff --git a/sys/dev/isp/ispmbox.h b/sys/dev/isp/ispmbox.h
index 8ab5fa8..24de5ae 100644
--- a/sys/dev/isp/ispmbox.h
+++ b/sys/dev/isp/ispmbox.h
@@ -1,5 +1,5 @@
/* $Id: $ */
-/* ispmbox 1.10 */
+/* release_12_28_98_A */
/*
* Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters.
*
diff --git a/sys/dev/isp/ispreg.h b/sys/dev/isp/ispreg.h
index ce578c8..122a297 100644
--- a/sys/dev/isp/ispreg.h
+++ b/sys/dev/isp/ispreg.h
@@ -1,5 +1,5 @@
-/* $Id: ispreg.h,v 1.6 1998/09/08 01:09:46 mjacob Exp mjacob $ */
-/* ispreg.h 1.7 */
+/* $Id: $ */
+/* release_12_28_98_A */
/*
* Machine Independent (well, as best as possible) register
* definitions for Qlogic ISP SCSI adapters.
diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h
index e08ad29..89a295b 100644
--- a/sys/dev/isp/ispvar.h
+++ b/sys/dev/isp/ispvar.h
@@ -1,5 +1,5 @@
/* $Id: $ */
-/* ispvar.h 1.21 */
+/* release_12_28_98_A */
/*
* Soft Definitions for for Qlogic ISP SCSI adapters.
*
@@ -44,11 +44,11 @@
#include <dev/isp/ispmbox.h>
#endif
#ifdef __linux__
-#include <ispmbox.h>
+#include "ispmbox.h"
#endif
#define ISP_CORE_VERSION_MAJOR 1
-#define ISP_CORE_VERSION_MINOR 4
+#define ISP_CORE_VERSION_MINOR 5
/*
* Vector for MD code to provide specific services.
@@ -177,6 +177,41 @@ typedef struct {
#define FW_REINIT 0x0006
#define FW_NON_PART 0x0007
+#ifdef ISP_TARGET_MODE
+/*
+ * Some temporary Target Mode definitions
+ */
+typedef struct tmd_cmd {
+ u_int8_t cd_iid; /* initiator */
+ u_int8_t cd_tgt; /* target */
+ u_int8_t cd_lun; /* LUN for this command */
+ u_int8_t cd_state;
+ u_int8_t cd_cdb[16]; /* command bytes */
+ u_int8_t cd_sensedata[20];
+ u_int16_t cd_rxid;
+ u_int32_t cd_datalen;
+ u_int32_t cd_totbytes;
+ void * cd_hba;
+} tmd_cmd_t;
+
+/*
+ * Async Target Mode Event Definitions
+ */
+#define TMD_BUS_RESET 0
+#define TMD_BDR 1
+
+/*
+ * Immediate Notify data structure.
+ */
+#define NOTIFY_MSGLEN 5
+typedef struct {
+ u_int8_t nt_iid; /* initiator */
+ u_int8_t nt_tgt; /* target */
+ u_int8_t nt_lun; /* LUN for this command */
+ u_int8_t nt_msg[NOTIFY_MSGLEN]; /* SCSI message byte(s) */
+} tmd_notify_t;
+
+#endif
/*
* Soft Structure per host adapter
@@ -247,6 +282,27 @@ struct ispsoftc {
u_int32_t isp_rquest_dma;
u_int32_t isp_result_dma;
+#ifdef ISP_TARGET_MODE
+ /*
+ * Vectors for handling target mode support.
+ *
+ * isp_tmd_newcmd is for feeding a newly arrived command to some
+ * upper layer.
+ *
+ * isp_tmd_event is for notifying some upper layer that an event has
+ * occurred that is not necessarily tied to any target (e.g., a SCSI
+ * Bus Reset).
+ *
+ * isp_tmd_notify is for notifying some upper layer that some
+ * event is now occurring that is either pertinent for a specific
+ * device or for a specific command (e.g., BDR or ABORT TAG).
+ *
+ * It is left undefined (for now) how pools of commands are managed.
+ */
+ void (*isp_tmd_newcmd) __P((void *, tmd_cmd_t *));
+ void (*isp_tmd_event) __P((void *, int));
+ void (*isp_tmd_notify) __P((void *, tmd_notify_t *));
+#endif
};
/*
@@ -332,11 +388,6 @@ void isp_reset __P((struct ispsoftc *));
void isp_init __P((struct ispsoftc *));
/*
- * Free any associated resources prior to decommissioning.
- */
-void isp_uninit __P((struct ispsoftc *));
-
-/*
* Reset the ISP and call completion for any orphaned commands.
*/
void isp_restart __P((struct ispsoftc *));
@@ -347,11 +398,6 @@ void isp_restart __P((struct ispsoftc *));
int isp_intr __P((void *));
/*
- * Watchdog Routine
- */
-void isp_watch __P((void *));
-
-/*
* Command Entry Point
*/
int32_t ispscsicmd __P((ISP_SCSI_XFER_T *));
OpenPOWER on IntegriCloud