summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2005-01-22 22:46:45 +0000
committermjacob <mjacob@FreeBSD.org>2005-01-22 22:46:45 +0000
commit2ae6a1b3d38800ef17388d88290c49dd138477b8 (patch)
treeaac3b3521b4874ec52212dd10b6ff5feeb96ec6b /sys/cam
parent96960d4e34bdb7e3535a85579f86c049a4131c65 (diff)
downloadFreeBSD-src-2ae6a1b3d38800ef17388d88290c49dd138477b8.zip
FreeBSD-src-2ae6a1b3d38800ef17388d88290c49dd138477b8.tar.gz
This is a somewhat imperfect means to try and bring FreeBSD forward in
its ability to automatically scan and attach luns for modern storage which has luns in the 0..1000 range, not 0..7. The correct thing would be to do REPORT LUNS for devices whose LUN0 version shows a version >= SCSI3, but lacking that we should be able to search higher than LUN 7 if we're >= SCSI3 with no ill effects. This change keeps all of the QUIRK_HILUNS quirks, obeys the QUIRK_NOLUNS, and introduces a QUIRK_NOHILUNS which will keep searches above LUN 7 happening for devices that report >= SCSI3 compliance. I doubt the latter will be needed, but you never know. This allowed me to randomly scan and attach > 500 disks at a time in a situation where quirking for QUIRK_HILUNS wasn't practical (the vendor id and product id changes of the virtualization changes constantly). Reviewed by: ken@freebsd.org, scottl@freebsd.org, gibbs@freebsd.org MFC after: 2 weeks
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_xpt.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 84c8f2a..29b836d 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -199,10 +199,20 @@ struct xpt_quirk_entry {
#define CAM_QUIRK_NOLUNS 0x01
#define CAM_QUIRK_NOSERIAL 0x02
#define CAM_QUIRK_HILUNS 0x04
+#define CAM_QUIRK_NOHILUNS 0x08
u_int mintags;
u_int maxtags;
};
#define CAM_SCSI2_MAXLUN 8
+/*
+ * If we're not quirked to search <= the first 8 luns
+ * and we are either quirked to search above lun 8,
+ * or we're > SCSI-2, we can look for luns above lun 8.
+ */
+#define CAN_SRCH_HI(dv) \
+ (((dv->quirk->quirks & CAM_QUIRK_NOHILUNS) == 0) \
+ && ((dv->quirk->quirks & CAM_QUIRK_HILUNS) \
+ || SID_ANSI_REV(&dv->inq_data) > SCSI_REV_2))
typedef enum {
XPT_FLAG_OPEN = 0x01
@@ -5294,7 +5304,7 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
s = splcam();
device = TAILQ_FIRST(&target->ed_entries);
if (device != NULL) {
- phl = device->quirk->quirks & CAM_QUIRK_HILUNS;
+ phl = CAN_SRCH_HI(device);
if (device->lun_id == 0)
device = TAILQ_NEXT(device, links);
}
@@ -5310,8 +5320,8 @@ xpt_scan_bus(struct cam_periph *periph, union ccb *request_ccb)
if ((device->quirk->quirks & CAM_QUIRK_NOLUNS) == 0) {
/* Try the next lun */
- if (lun_id < (CAM_SCSI2_MAXLUN-1) ||
- (device->quirk->quirks & CAM_QUIRK_HILUNS))
+ if (lun_id < (CAM_SCSI2_MAXLUN-1)
+ || CAN_SRCH_HI(device))
lun_id++;
}
}
OpenPOWER on IntegriCloud