summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimokawa <simokawa@FreeBSD.org>2003-02-21 02:09:04 +0000
committersimokawa <simokawa@FreeBSD.org>2003-02-21 02:09:04 +0000
commitb27f8830371518a6d8c9406b187287333013574c (patch)
tree274a318a2a84b79bcef1fc999acb14a30011b473
parentf3417fa7ac285f769ac275d962f83e5b4da22394 (diff)
downloadFreeBSD-src-b27f8830371518a6d8c9406b187287333013574c.zip
FreeBSD-src-b27f8830371518a6d8c9406b187287333013574c.tar.gz
Don't scan lun by myself while boot process leave it CAM to scan the bus.
Some drives seem to be confused by simultaneous probes. Tested by: marcel As a side effect, logical units whose lun is greater than 0 might not be probed correctly if the lun of 0 doesn't exist in the target because CAM doesn't scan such luns. I have a SCSI-FireWire bridge which maps SCSI-ID to LUN and it is an example of such targets.
-rw-r--r--sys/dev/firewire/sbp.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c
index eec79bb..c2abec7 100644
--- a/sys/dev/firewire/sbp.c
+++ b/sys/dev/firewire/sbp.c
@@ -131,9 +131,10 @@ static char *orb_fun_name[] = {
#define ORB_RES_ILLE 2
#define ORB_RES_VEND 3
-static int debug = 0;
+static int debug = 1;
static int auto_login = 1;
static int max_speed = 2;
+static int sbp_cold = 1;
SYSCTL_DECL(_hw_firewire);
SYSCTL_NODE(_hw_firewire, OID_AUTO, sbp, CTLFLAG_RD, 0, "SBP-II Subsystem");
@@ -640,12 +641,14 @@ sbp_post_explore(void *arg)
struct fw_device *fwdev;
int i, alive;
-SBP_DEBUG(1)
- printf("sbp_post_explore\n");
+SBP_DEBUG(0)
+ printf("sbp_post_explore (sbp_cold=%d)\n", sbp_cold);
END_DEBUG
#if 0
xpt_freeze_simq(sbp->sim, /*count*/ 1);
#endif
+ if (sbp_cold > 0)
+ sbp_cold --;
/* Gabage Collection */
for(i = 0 ; i < SBP_NUM_TARGETS ; i ++){
target = &sbp->targets[i];
@@ -879,11 +882,22 @@ SBP_DEBUG(0)
printf("sbp_do_attach\n");
END_DEBUG
fw_xfer_free(xfer);
+
if (sdev->path == NULL)
xpt_create_path(&sdev->path, xpt_periph,
cam_sim_path(sdev->target->sbp->sim),
sdev->target->target_id, sdev->lun_id);
+ /*
+ * Let CAM scan the bus if we are in the boot process.
+ * XXX xpt_scan_bus cannot detect LUN larger than 0
+ * if LUN 0 doesn't exists.
+ */
+ if (sbp_cold > 0) {
+ sdev->status = SBP_DEV_PROBE;
+ return;
+ }
+
if (sdev->status == SBP_DEV_RETRY)
sbp_ping_unit(sdev);
else
@@ -1615,9 +1629,11 @@ sbp_attach(device_t dev)
int i, s, error;
SBP_DEBUG(0)
- printf("sbp_attach\n");
+ printf("sbp_attach (cold=%d)\n", cold);
END_DEBUG
+ if (cold)
+ sbp_cold ++;
sbp = ((struct sbp_softc *)device_get_softc(dev));
bzero(sbp, sizeof(struct sbp_softc));
sbp->fd.dev = dev;
@@ -1694,9 +1710,12 @@ END_DEBUG
fw_bindadd(sbp->fd.fc, &sbp->fwb);
sbp->fd.post_explore = sbp_post_explore;
- s = splfw();
- sbp_post_explore((void *)sbp);
- splx(s);
+
+ if (sbp->fd.fc->status != -1) {
+ s = splfw();
+ sbp_post_explore((void *)sbp);
+ splx(s);
+ }
return (0);
}
@@ -2069,7 +2088,7 @@ END_DEBUG
cpi->version_num = 1; /* XXX??? */
cpi->hba_inquiry = 0;
cpi->target_sprt = 0;
- cpi->hba_misc = 0;
+ cpi->hba_misc = PIM_NOBUSRESET;
cpi->hba_eng_cnt = 0;
cpi->max_target = SBP_NUM_TARGETS - 1;
cpi->max_lun = SBP_NUM_LUNS - 1;
OpenPOWER on IntegriCloud