summaryrefslogtreecommitdiffstats
path: root/sys/dev/mpt/mpt_pci.c
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2006-04-11 16:47:30 +0000
committermjacob <mjacob@FreeBSD.org>2006-04-11 16:47:30 +0000
commit7eedb7c68d960c0f2a92de91580cb2b17fad2b2e (patch)
tree141461e657300e33bc4131a22621d7e5de62bd9f /sys/dev/mpt/mpt_pci.c
parent02cd847e4fc2724e14e2dfc39aa9144c6f0097f1 (diff)
downloadFreeBSD-src-7eedb7c68d960c0f2a92de91580cb2b17fad2b2e.zip
FreeBSD-src-7eedb7c68d960c0f2a92de91580cb2b17fad2b2e.tar.gz
A large set of changes:
+ Add boatloads of KASSERTs and *really* check out more locking issues (to catch recursions when we actually go to real locking in CAM soon). The KASSERTs also caught lots of other issues like using commands that were put back on free lists, etc. + Target mode: role setting is derived directly from port capabilities. There is no need to set a role any more. Some target mode resources are allocated early on (ELS), but target command buffer allocation is deferred until the first lun enable. + Fix some breakages I introduced with target mode in that some commands are *repeating* commands. That is, the reply shows up but the command isn't really done (we don't free it). We still need to take it off the pending list because when we resubmit it, bad things then happen. + Fix more of the way that timed out commands and bus reset is done. The actual TMF response code was being ignored. + For SPI, honor BIOS settings. This doesn't quite fix the problems we've seen where we can't seem to (re)negotiate U320 on all drives but avoids it instead by letting us honor the BIOS settings. I'm sure this is not quite right and will have to change again soon.
Diffstat (limited to 'sys/dev/mpt/mpt_pci.c')
-rw-r--r--sys/dev/mpt/mpt_pci.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/sys/dev/mpt/mpt_pci.c b/sys/dev/mpt/mpt_pci.c
index 9be1bc5..1f07379 100644
--- a/sys/dev/mpt/mpt_pci.c
+++ b/sys/dev/mpt/mpt_pci.c
@@ -254,7 +254,6 @@ mpt_set_options(struct mpt_softc *mpt)
mpt->disabled = 1;
}
}
-
bitmap = 0;
if (getenv_int("mpt_debug", &bitmap)) {
if (bitmap & (1 << mpt->unit)) {
@@ -262,21 +261,21 @@ mpt_set_options(struct mpt_softc *mpt)
}
}
bitmap = 0;
- if (getenv_int("mpt_target", &bitmap)) {
+ if (getenv_int("mpt_debug1", &bitmap)) {
if (bitmap & (1 << mpt->unit)) {
- mpt->role = MPT_ROLE_TARGET;
+ mpt->verbose = MPT_PRT_DEBUG1;
}
}
bitmap = 0;
- if (getenv_int("mpt_none", &bitmap)) {
+ if (getenv_int("mpt_debug2", &bitmap)) {
if (bitmap & (1 << mpt->unit)) {
- mpt->role = MPT_ROLE_NONE;
+ mpt->verbose = MPT_PRT_DEBUG2;
}
}
bitmap = 0;
- if (getenv_int("mpt_initiator", &bitmap)) {
+ if (getenv_int("mpt_debug3", &bitmap)) {
if (bitmap & (1 << mpt->unit)) {
- mpt->role = MPT_ROLE_INITIATOR;
+ mpt->verbose = MPT_PRT_DEBUG3;
}
}
}
@@ -311,9 +310,9 @@ mpt_link_peer(struct mpt_softc *mpt)
{
struct mpt_softc *mpt2;
- if (mpt->unit == 0)
+ if (mpt->unit == 0) {
return;
-
+ }
/*
* XXX: depends on probe order
*/
@@ -336,6 +335,14 @@ mpt_link_peer(struct mpt_softc *mpt)
}
}
+static void
+mpt_unlink_peer(struct mpt_softc *mpt)
+{
+ if (mpt->mpt2) {
+ mpt->mpt2->mpt2 = NULL;
+ }
+}
+
static int
mpt_pci_attach(device_t dev)
@@ -377,7 +384,7 @@ mpt_pci_attach(device_t dev)
mpt->raid_mwce_setting = MPT_RAID_MWCE_DEFAULT;
mpt->raid_queue_depth = MPT_RAID_QUEUE_DEPTH_DEFAULT;
mpt->verbose = MPT_PRT_NONE;
- mpt->role = MPT_ROLE_DEFAULT;
+ mpt->role = MPT_ROLE_NONE;
mpt_set_options(mpt);
if (mpt->verbose == MPT_PRT_NONE) {
mpt->verbose = MPT_PRT_WARN;
@@ -388,7 +395,7 @@ mpt_pci_attach(device_t dev)
cmd = pci_read_config(dev, PCIR_COMMAND, 2);
if ((cmd & PCIM_CMD_MEMEN) == 0) {
device_printf(dev, "Memory accesses disabled");
- goto bad;
+ return (ENXIO);
}
/*
@@ -498,21 +505,6 @@ mpt_pci_attach(device_t dev)
*/
pci_disable_io(dev, SYS_RES_IOPORT);
- switch (mpt->role) {
- case MPT_ROLE_TARGET:
- break;
- case MPT_ROLE_INITIATOR:
- break;
- case MPT_ROLE_TARGET|MPT_ROLE_INITIATOR:
- mpt->disabled = 1;
- mpt_prt(mpt, "dual roles unsupported\n");
- goto bad;
- case MPT_ROLE_NONE:
- device_printf(dev, "role of NONE same as disable\n");
- mpt->disabled = 1;
- goto bad;
- }
-
/* Initialize the hardware */
if (mpt->disabled == 0) {
MPT_LOCK(mpt);
@@ -536,11 +528,15 @@ mpt_pci_attach(device_t dev)
MPT_UNLOCK(mpt);
goto bad;
}
+ KASSERT(MPT_OWNED(mpt) == 0, ("leaving attach with device locked"));
return (0);
bad:
mpt_dma_mem_free(mpt);
mpt_free_bus_resources(mpt);
+ mpt_unlink_peer(mpt);
+
+ MPT_LOCK_DESTROY(mpt);
/*
* but return zero to preserve unit numbering
OpenPOWER on IntegriCloud