summaryrefslogtreecommitdiffstats
path: root/sys/dev/amr/amr.c
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2008-11-03 00:53:54 +0000
committerscottl <scottl@FreeBSD.org>2008-11-03 00:53:54 +0000
commit6de3633d944db2576d517db9f4b51a88a9df6670 (patch)
treed8bbdf137911f37c46a1ac784c971f0fa237d5f7 /sys/dev/amr/amr.c
parentbd5c63c83ea976832f7550a827fef3e15159b558 (diff)
downloadFreeBSD-src-6de3633d944db2576d517db9f4b51a88a9df6670.zip
FreeBSD-src-6de3633d944db2576d517db9f4b51a88a9df6670.tar.gz
Move the CAM passthrough code into a true module so that it doesn't have to be
compiled into the main AMR driver. It's code that is nice to have but not required for normal operation, and it is reported to cause problems for some people.
Diffstat (limited to 'sys/dev/amr/amr.c')
-rw-r--r--sys/dev/amr/amr.c31
1 files changed, 12 insertions, 19 deletions
diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c
index 192f128..6b75ebb 100644
--- a/sys/dev/amr/amr.c
+++ b/sys/dev/amr/amr.c
@@ -88,13 +88,6 @@ __FBSDID("$FreeBSD$");
#define AMR_DEFINE_TABLES
#include <dev/amr/amr_tables.h>
-/*
- * The CAM interface appears to be completely broken. Disable it.
- */
-#ifndef AMR_ENABLE_CAM
-#define AMR_ENABLE_CAM 1
-#endif
-
SYSCTL_NODE(_hw, OID_AUTO, amr, CTLFLAG_RD, 0, "AMR driver parameters");
static d_open_t amr_open;
@@ -202,6 +195,7 @@ MALLOC_DEFINE(M_AMR, "amr", "AMR memory");
int
amr_attach(struct amr_softc *sc)
{
+ device_t child;
debug_called(1);
@@ -259,14 +253,16 @@ amr_attach(struct amr_softc *sc)
*/
amr_init_sysctl(sc);
-#if AMR_ENABLE_CAM != 0
/*
* Attach our 'real' SCSI channels to CAM.
*/
- if (amr_cam_attach(sc))
- return(ENXIO);
- debug(2, "CAM attach done");
-#endif
+ child = device_add_child(sc->amr_dev, "amrp", -1);
+ sc->amr_pass = child;
+ if (child != NULL) {
+ device_set_softc(child, sc);
+ device_set_desc(child, "SCSI Passthrough Bus");
+ bus_generic_attach(sc->amr_dev);
+ }
/*
* Create the control device.
@@ -391,10 +387,9 @@ amr_free(struct amr_softc *sc)
{
struct amr_command_cluster *acc;
-#if AMR_ENABLE_CAM != 0
/* detach from CAM */
- amr_cam_detach(sc);
-#endif
+ if (sc->amr_pass != NULL)
+ device_delete_child(sc->amr_dev, sc->amr_pass);
/* cancel status timeout */
untimeout(amr_periodic, sc, sc->amr_timeout);
@@ -1240,11 +1235,9 @@ amr_startio(struct amr_softc *sc)
if (ac == NULL)
(void)amr_bio_command(sc, &ac);
-#if AMR_ENABLE_CAM != 0
/* if that failed, build a command from a ccb */
- if (ac == NULL)
- (void)amr_cam_command(sc, &ac);
-#endif
+ if ((ac == NULL) && (sc->amr_cam_command != NULL))
+ sc->amr_cam_command(sc, &ac);
/* if we don't have anything to do, give up */
if (ac == NULL)
OpenPOWER on IntegriCloud