summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormjacob <mjacob@FreeBSD.org>2000-06-18 04:50:26 +0000
committermjacob <mjacob@FreeBSD.org>2000-06-18 04:50:26 +0000
commit7376e4df8ddc4548c70e100fe0a7424802ad721e (patch)
tree33db563d7730a671e8de4dfb4645e07e80dfc784
parent5d92bae67f78e73d9203a351f24dfa081d2bda69 (diff)
downloadFreeBSD-src-7376e4df8ddc4548c70e100fe0a7424802ad721e.zip
FreeBSD-src-7376e4df8ddc4548c70e100fe0a7424802ad721e.tar.gz
Remove all ISP2100_SCCLUN define protected code and replace it with
runtime checks.
-rw-r--r--sys/dev/isp/isp_freebsd.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c
index d0094a0..db5e64b 100644
--- a/sys/dev/isp/isp_freebsd.c
+++ b/sys/dev/isp/isp_freebsd.c
@@ -490,28 +490,17 @@ isp_en_lun(struct ispsoftc *isp, union ccb *ccb)
* Do some sanity checking first.
*/
+ if (lun < 0 || lun >= (lun_id_t) isp->isp_maxluns) {
+ ccb->ccb_h.status = CAM_LUN_INVALID;
+ return;
+ }
if (IS_SCSI(isp)) {
- if (lun < 0 || lun >= 32) {
- ccb->ccb_h.status = CAM_LUN_INVALID;
- return;
- }
if (tgt != CAM_TARGET_WILDCARD &&
tgt != ((sdparam *) isp->isp_param)->isp_initiator_id) {
ccb->ccb_h.status = CAM_TID_INVALID;
return;
}
} else {
-#ifdef ISP2100_SCCLUN
- if (lun < 0 || lun >= 65536) {
- ccb->ccb_h.status = CAM_LUN_INVALID;
- return;
- }
-#else
- if (lun < 0 || lun >= 16) {
- ccb->ccb_h.status = CAM_LUN_INVALID;
- return;
- }
-#endif
if (tgt != CAM_TARGET_WILDCARD &&
tgt != ((fcparam *) isp->isp_param)->isp_loopid) {
ccb->ccb_h.status = CAM_TID_INVALID;
@@ -709,9 +698,9 @@ isp_target_start_ctio(struct ispsoftc *isp, union ccb *ccb)
cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
cto->ct_header.rqs_entry_count = 1;
cto->ct_iid = cso->init_id;
-#ifndef ISP2100_SCCLUN
- cto->ct_lun = ccb->ccb_h.target_lun;
-#endif
+ if (isp->isp_maxluns <= 16) {
+ cto->ct_lun = ccb->ccb_h.target_lun;
+ }
cto->ct_rxid = cso->tag_id;
cto->ct_flags = CT2_CCINCR;
if (cso->dxfer_len == 0) {
@@ -950,11 +939,11 @@ isp_handle_platform_atio2(struct ispsoftc *isp, at2_entry_t *aep)
return (0);
}
-#ifdef ISP2100_SCCLUN
- lun = aep->at_scclun;
-#else
- lun = aep->at_lun;
-#endif
+ if (isp->isp_maxluns > 16) {
+ lun = aep->at_scclun;
+ } else {
+ lun = aep->at_lun;
+ }
tptr = get_lun_statep(isp, lun);
if (tptr == NULL) {
tptr = get_lun_statep(isp, CAM_LUN_WILDCARD);
OpenPOWER on IntegriCloud