summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2007-05-16 17:23:36 +0000
committerscottl <scottl@FreeBSD.org>2007-05-16 17:23:36 +0000
commitd98a9928ca4d6dfccb842a529e4ff10ee0263bf8 (patch)
tree3929baefd43ad6e53f53861b42a8a06b1af444d5 /sys/dev
parent1d6b078b4b48f0cb513b0e78393f053c1d5675e8 (diff)
downloadFreeBSD-src-d98a9928ca4d6dfccb842a529e4ff10ee0263bf8.zip
FreeBSD-src-d98a9928ca4d6dfccb842a529e4ff10ee0263bf8.tar.gz
Catch up to driver changes required for the mfip sub-driver.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/mfi/mfi.c20
-rw-r--r--sys/dev/mfi/mfireg.h6
-rw-r--r--sys/dev/mfi/mfivar.h5
3 files changed, 27 insertions, 4 deletions
diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c
index 2dae176..7bc7e41 100644
--- a/sys/dev/mfi/mfi.c
+++ b/sys/dev/mfi/mfi.c
@@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$");
#include <dev/mfi/mfivar.h>
static int mfi_alloc_commands(struct mfi_softc *);
-static void mfi_release_command(struct mfi_command *cm);
static int mfi_comms_init(struct mfi_softc *);
static int mfi_wait_command(struct mfi_softc *, struct mfi_command *);
static int mfi_get_controller_info(struct mfi_softc *);
@@ -188,6 +187,7 @@ mfi_attach(struct mfi_softc *sc)
mtx_init(&sc->mfi_io_lock, "MFI I/O lock", NULL, MTX_DEF);
TAILQ_INIT(&sc->mfi_ld_tqh);
TAILQ_INIT(&sc->mfi_aen_pids);
+ TAILQ_INIT(&sc->mfi_cam_ccbq);
mfi_initq_free(sc);
mfi_initq_ready(sc);
@@ -394,6 +394,9 @@ mfi_attach(struct mfi_softc *sc)
if (sc->mfi_cdev != NULL)
sc->mfi_cdev->si_drv1 = sc;
+ device_add_child(sc->mfi_dev, "mfip", -1);
+ bus_generic_attach(sc->mfi_dev);
+
/* Start the timeout watchdog */
callout_init(&sc->mfi_watchdog_callout, 1);
callout_reset(&sc->mfi_watchdog_callout, MFI_CMD_TIMEOUT * hz,
@@ -438,7 +441,7 @@ mfi_alloc_commands(struct mfi_softc *sc)
return (0);
}
-static void
+void
mfi_release_command(struct mfi_command *cm)
{
struct mfi_frame_header *hdr;
@@ -465,6 +468,7 @@ mfi_release_command(struct mfi_command *cm)
cm->cm_flags = 0;
cm->cm_complete = NULL;
cm->cm_private = NULL;
+ cm->cm_data = NULL;
cm->cm_sg = 0;
cm->cm_total_frame_size = 0;
@@ -1376,16 +1380,18 @@ mfi_add_ld_complete(struct mfi_command *cm)
}
mfi_release_command(cm);
+ mtx_unlock(&sc->mfi_io_lock);
+ mtx_lock(&Giant);
if ((child = device_add_child(sc->mfi_dev, "mfid", -1)) == NULL) {
device_printf(sc->mfi_dev, "Failed to add logical disk\n");
free(ld_info, M_MFIBUF);
+ mtx_unlock(&Giant);
+ mtx_lock(&sc->mfi_io_lock);
return;
}
device_set_ivars(child, ld_info);
device_set_desc(child, "MFI Logical Disk");
- mtx_unlock(&sc->mfi_io_lock);
- mtx_lock(&Giant);
bus_generic_attach(sc->mfi_dev);
mtx_unlock(&Giant);
mtx_lock(&sc->mfi_io_lock);
@@ -1469,6 +1475,7 @@ void
mfi_startio(struct mfi_softc *sc)
{
struct mfi_command *cm;
+ struct ccb_hdr *ccbh;
for (;;) {
/* Don't bother if we're short on resources */
@@ -1478,6 +1485,11 @@ mfi_startio(struct mfi_softc *sc)
/* Try a command that has already been prepared */
cm = mfi_dequeue_ready(sc);
+ if (cm == NULL) {
+ if ((ccbh = TAILQ_FIRST(&sc->mfi_cam_ccbq)) != NULL)
+ cm = sc->mfi_cam_start(ccbh);
+ }
+
/* Nope, so look for work on the bioq */
if (cm == NULL)
cm = mfi_bio_command(sc);
diff --git a/sys/dev/mfi/mfireg.h b/sys/dev/mfi/mfireg.h
index cb5ed39..da4df4e 100644
--- a/sys/dev/mfi/mfireg.h
+++ b/sys/dev/mfi/mfireg.h
@@ -1034,4 +1034,10 @@ struct mfi_config_data {
*/
} __packed;
+#define MFI_SCSI_MAX_TARGETS 128
+#define MFI_SCSI_MAX_LUNS 8
+#define MFI_SCSI_INITIATOR_ID 255
+#define MFI_SCSI_MAX_CMDS 8
+#define MFI_SCSI_MAX_CDB_LEN 16
+
#endif /* _MFIREG_H */
diff --git a/sys/dev/mfi/mfivar.h b/sys/dev/mfi/mfivar.h
index af5bb28..1230033 100644
--- a/sys/dev/mfi/mfivar.h
+++ b/sys/dev/mfi/mfivar.h
@@ -44,6 +44,7 @@ struct mfi_hwcomms {
struct mfi_softc;
struct disk;
+struct ccb_hdr;
struct mfi_command {
TAILQ_ENTRY(mfi_command) cm_link;
@@ -179,6 +180,8 @@ struct mfi_softc {
eventhandler_tag mfi_eh;
struct cdev *mfi_cdev;
+ TAILQ_HEAD(, ccb_hdr) mfi_cam_ccbq;
+ struct mfi_command * (* mfi_cam_start)(void *);
struct callout mfi_watchdog_callout;
struct mtx mfi_io_lock;
};
@@ -344,4 +347,6 @@ extern void mfi_validate_sg(struct mfi_softc *, struct mfi_command *, const char
#define MFI_VALIDATE_CMD(sc, cm)
#endif
+extern void mfi_release_command(struct mfi_command *cm);
+
#endif /* _MFIVAR_H */
OpenPOWER on IntegriCloud