isp_freebsd.c (291162) | isp_freebsd.c (291188) |
---|---|
1/*- 2 * Copyright (c) 1997-2009 by Matthew Jacob 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 29 */ 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2009 by Matthew Jacob 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 29 */ 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 291162 2015-11-22 16:55:43Z mav $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 291188 2015-11-23 10:06:19Z mav $"); |
32 33#include <dev/isp/isp_freebsd.h> 34#include <sys/unistd.h> 35#include <sys/kthread.h> 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> --- 396 unchanged lines hidden (view full) --- 436 chan = *(int *)addr; 437 if (chan < 0 || chan >= isp->isp_nchan) { 438 retval = -ENXIO; 439 break; 440 } 441 if (IS_FC(isp)) { 442 *(int *)addr = FCPARAM(isp, chan)->role; 443 } else { | 32 33#include <dev/isp/isp_freebsd.h> 34#include <sys/unistd.h> 35#include <sys/kthread.h> 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> --- 396 unchanged lines hidden (view full) --- 436 chan = *(int *)addr; 437 if (chan < 0 || chan >= isp->isp_nchan) { 438 retval = -ENXIO; 439 break; 440 } 441 if (IS_FC(isp)) { 442 *(int *)addr = FCPARAM(isp, chan)->role; 443 } else { |
444 *(int *)addr = SDPARAM(isp, chan)->role; | 444 *(int *)addr = ISP_ROLE_INITIATOR; |
445 } 446 retval = 0; 447 break; 448 case ISP_SETROLE: | 445 } 446 retval = 0; 447 break; 448 case ISP_SETROLE: |
449 if (IS_SCSI(isp)) 450 break; |
|
449 nr = *(int *)addr; 450 chan = nr >> 8; 451 if (chan < 0 || chan >= isp->isp_nchan) { 452 retval = -ENXIO; 453 break; 454 } 455 nr &= 0xff; 456 if (nr & ~(ISP_ROLE_INITIATOR|ISP_ROLE_TARGET)) { 457 retval = EINVAL; 458 break; 459 } 460 ISP_LOCK(isp); | 451 nr = *(int *)addr; 452 chan = nr >> 8; 453 if (chan < 0 || chan >= isp->isp_nchan) { 454 retval = -ENXIO; 455 break; 456 } 457 nr &= 0xff; 458 if (nr & ~(ISP_ROLE_INITIATOR|ISP_ROLE_TARGET)) { 459 retval = EINVAL; 460 break; 461 } 462 ISP_LOCK(isp); |
461 if (IS_FC(isp)) 462 *(int *)addr = FCPARAM(isp, chan)->role; 463 else 464 *(int *)addr = SDPARAM(isp, chan)->role; | 463 *(int *)addr = FCPARAM(isp, chan)->role; |
465 retval = isp_control(isp, ISPCTL_CHANGE_ROLE, chan, nr); 466 ISP_UNLOCK(isp); 467 retval = 0; 468 break; 469 470 case ISP_RESETHBA: 471 ISP_LOCK(isp); 472 isp_reinit(isp, 0); --- 296 unchanged lines hidden (view full) --- 769} 770 771static void 772isp_intr_enable(void *arg) 773{ 774 int chan; 775 ispsoftc_t *isp = arg; 776 ISP_LOCK(isp); | 464 retval = isp_control(isp, ISPCTL_CHANGE_ROLE, chan, nr); 465 ISP_UNLOCK(isp); 466 retval = 0; 467 break; 468 469 case ISP_RESETHBA: 470 ISP_LOCK(isp); 471 isp_reinit(isp, 0); --- 296 unchanged lines hidden (view full) --- 768} 769 770static void 771isp_intr_enable(void *arg) 772{ 773 int chan; 774 ispsoftc_t *isp = arg; 775 ISP_LOCK(isp); |
777 for (chan = 0; chan < isp->isp_nchan; chan++) { 778 if (IS_FC(isp)) { | 776 if (IS_FC(isp)) { 777 for (chan = 0; chan < isp->isp_nchan; chan++) { |
779 if (FCPARAM(isp, chan)->role != ISP_ROLE_NONE) { 780 ISP_ENABLE_INTS(isp); 781 break; 782 } | 778 if (FCPARAM(isp, chan)->role != ISP_ROLE_NONE) { 779 ISP_ENABLE_INTS(isp); 780 break; 781 } |
783 } else { 784 if (SDPARAM(isp, chan)->role != ISP_ROLE_NONE) { 785 ISP_ENABLE_INTS(isp); 786 break; 787 } | |
788 } | 782 } |
783 } else { 784 ISP_ENABLE_INTS(isp); |
|
789 } 790 isp->isp_osinfo.ehook_active = 0; 791 ISP_UNLOCK(isp); 792 /* Release our hook so that the boot can continue. */ 793 config_intrhook_disestablish(&isp->isp_osinfo.ehook); 794} 795 796/* --- 29 unchanged lines hidden (view full) --- 826 ISP_PCMD(ccb) = NULL; 827 } 828} 829 830/* 831 * Put the target mode functions here, because some are inlines 832 */ 833#ifdef ISP_TARGET_MODE | 785 } 786 isp->isp_osinfo.ehook_active = 0; 787 ISP_UNLOCK(isp); 788 /* Release our hook so that the boot can continue. */ 789 config_intrhook_disestablish(&isp->isp_osinfo.ehook); 790} 791 792/* --- 29 unchanged lines hidden (view full) --- 822 ISP_PCMD(ccb) = NULL; 823 } 824} 825 826/* 827 * Put the target mode functions here, because some are inlines 828 */ 829#ifdef ISP_TARGET_MODE |
834static ISP_INLINE void isp_tmlock(ispsoftc_t *, const char *); 835static ISP_INLINE void isp_tmunlk(ispsoftc_t *); 836static ISP_INLINE int is_any_lun_enabled(ispsoftc_t *, int); | |
837static ISP_INLINE int is_lun_enabled(ispsoftc_t *, int, lun_id_t); 838static ISP_INLINE tstate_t *get_lun_statep(ispsoftc_t *, int, lun_id_t); 839static ISP_INLINE tstate_t *get_lun_statep_from_tag(ispsoftc_t *, int, uint32_t); 840static ISP_INLINE void rls_lun_statep(ispsoftc_t *, tstate_t *); 841static ISP_INLINE inot_private_data_t *get_ntp_from_tagdata(ispsoftc_t *, uint32_t, uint32_t, tstate_t **); 842static ISP_INLINE atio_private_data_t *isp_get_atpd(ispsoftc_t *, tstate_t *, uint32_t); 843static ISP_INLINE atio_private_data_t *isp_find_atpd(ispsoftc_t *, tstate_t *, uint32_t); 844static ISP_INLINE void isp_put_atpd(ispsoftc_t *, tstate_t *, atio_private_data_t *); 845static ISP_INLINE inot_private_data_t *isp_get_ntpd(ispsoftc_t *, tstate_t *); 846static ISP_INLINE inot_private_data_t *isp_find_ntpd(ispsoftc_t *, tstate_t *, uint32_t, uint32_t); 847static ISP_INLINE void isp_put_ntpd(ispsoftc_t *, tstate_t *, inot_private_data_t *); 848static cam_status create_lun_state(ispsoftc_t *, int, struct cam_path *, tstate_t **); 849static void destroy_lun_state(ispsoftc_t *, tstate_t *); 850static void isp_enable_lun(ispsoftc_t *, union ccb *); | 830static ISP_INLINE int is_lun_enabled(ispsoftc_t *, int, lun_id_t); 831static ISP_INLINE tstate_t *get_lun_statep(ispsoftc_t *, int, lun_id_t); 832static ISP_INLINE tstate_t *get_lun_statep_from_tag(ispsoftc_t *, int, uint32_t); 833static ISP_INLINE void rls_lun_statep(ispsoftc_t *, tstate_t *); 834static ISP_INLINE inot_private_data_t *get_ntp_from_tagdata(ispsoftc_t *, uint32_t, uint32_t, tstate_t **); 835static ISP_INLINE atio_private_data_t *isp_get_atpd(ispsoftc_t *, tstate_t *, uint32_t); 836static ISP_INLINE atio_private_data_t *isp_find_atpd(ispsoftc_t *, tstate_t *, uint32_t); 837static ISP_INLINE void isp_put_atpd(ispsoftc_t *, tstate_t *, atio_private_data_t *); 838static ISP_INLINE inot_private_data_t *isp_get_ntpd(ispsoftc_t *, tstate_t *); 839static ISP_INLINE inot_private_data_t *isp_find_ntpd(ispsoftc_t *, tstate_t *, uint32_t, uint32_t); 840static ISP_INLINE void isp_put_ntpd(ispsoftc_t *, tstate_t *, inot_private_data_t *); 841static cam_status create_lun_state(ispsoftc_t *, int, struct cam_path *, tstate_t **); 842static void destroy_lun_state(ispsoftc_t *, tstate_t *); 843static void isp_enable_lun(ispsoftc_t *, union ccb *); |
851static cam_status isp_enable_deferred_luns(ispsoftc_t *, int); 852static cam_status isp_enable_deferred(ispsoftc_t *, int, lun_id_t); | |
853static void isp_disable_lun(ispsoftc_t *, union ccb *); | 844static void isp_disable_lun(ispsoftc_t *, union ccb *); |
854static int isp_enable_target_mode(ispsoftc_t *, int); 855static int isp_disable_target_mode(ispsoftc_t *, int); 856static void isp_ledone(ispsoftc_t *, lun_entry_t *); | |
857static timeout_t isp_refire_putback_atio; 858static timeout_t isp_refire_notify_ack; 859static void isp_complete_ctio(union ccb *); 860static void isp_target_putback_atio(union ccb *); 861enum Start_Ctio_How { FROM_CAM, FROM_TIMER, FROM_SRR, FROM_CTIO_DONE }; 862static void isp_target_start_ctio(ispsoftc_t *, union ccb *, enum Start_Ctio_How); | 845static timeout_t isp_refire_putback_atio; 846static timeout_t isp_refire_notify_ack; 847static void isp_complete_ctio(union ccb *); 848static void isp_target_putback_atio(union ccb *); 849enum Start_Ctio_How { FROM_CAM, FROM_TIMER, FROM_SRR, FROM_CTIO_DONE }; 850static void isp_target_start_ctio(ispsoftc_t *, union ccb *, enum Start_Ctio_How); |
863static void isp_handle_platform_atio(ispsoftc_t *, at_entry_t *); | |
864static void isp_handle_platform_atio2(ispsoftc_t *, at2_entry_t *); 865static void isp_handle_platform_atio7(ispsoftc_t *, at7_entry_t *); 866static void isp_handle_platform_ctio(ispsoftc_t *, void *); | 851static void isp_handle_platform_atio2(ispsoftc_t *, at2_entry_t *); 852static void isp_handle_platform_atio7(ispsoftc_t *, at7_entry_t *); 853static void isp_handle_platform_ctio(ispsoftc_t *, void *); |
867static void isp_handle_platform_notify_scsi(ispsoftc_t *, in_entry_t *); | |
868static void isp_handle_platform_notify_fc(ispsoftc_t *, in_fcentry_t *); 869static void isp_handle_platform_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *); 870static int isp_handle_platform_target_notify_ack(ispsoftc_t *, isp_notify_t *); 871static void isp_handle_platform_target_tmf(ispsoftc_t *, isp_notify_t *); 872static void isp_target_mark_aborted(ispsoftc_t *, union ccb *); 873static void isp_target_mark_aborted_early(ispsoftc_t *, tstate_t *, uint32_t); 874 | 854static void isp_handle_platform_notify_fc(ispsoftc_t *, in_fcentry_t *); 855static void isp_handle_platform_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *); 856static int isp_handle_platform_target_notify_ack(ispsoftc_t *, isp_notify_t *); 857static void isp_handle_platform_target_tmf(ispsoftc_t *, isp_notify_t *); 858static void isp_target_mark_aborted(ispsoftc_t *, union ccb *); 859static void isp_target_mark_aborted_early(ispsoftc_t *, tstate_t *, uint32_t); 860 |
875static ISP_INLINE void 876isp_tmlock(ispsoftc_t *isp, const char *msg) 877{ 878 while (isp->isp_osinfo.tmbusy) { 879 isp->isp_osinfo.tmwanted = 1; 880 mtx_sleep(isp, &isp->isp_lock, PRIBIO, msg, 0); 881 } 882 isp->isp_osinfo.tmbusy = 1; 883} 884 885static ISP_INLINE void 886isp_tmunlk(ispsoftc_t *isp) 887{ 888 isp->isp_osinfo.tmbusy = 0; 889 if (isp->isp_osinfo.tmwanted) { 890 isp->isp_osinfo.tmwanted = 0; 891 wakeup(isp); 892 } 893} 894 | |
895static ISP_INLINE int | 861static ISP_INLINE int |
896is_any_lun_enabled(ispsoftc_t *isp, int bus) 897{ 898 struct tslist *lhp; 899 int i; 900 901 for (i = 0; i < LUN_HASH_SIZE; i++) { 902 ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp); 903 if (SLIST_FIRST(lhp)) 904 return (1); 905 } 906 return (0); 907} 908 909static ISP_INLINE int | |
910is_lun_enabled(ispsoftc_t *isp, int bus, lun_id_t lun) 911{ 912 tstate_t *tptr; 913 struct tslist *lhp; 914 915 ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp); 916 SLIST_FOREACH(tptr, lhp, next) { 917 if (tptr->ts_lun == lun) { --- 299 unchanged lines hidden (view full) --- 1217 } while (ccb); 1218 ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(tptr->ts_lun)], lhp); 1219 SLIST_REMOVE(lhp, tptr, tstate, next); 1220 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "destroyed tstate\n"); 1221 xpt_free_path(tptr->owner); 1222 free(tptr, M_DEVBUF); 1223} 1224 | 862is_lun_enabled(ispsoftc_t *isp, int bus, lun_id_t lun) 863{ 864 tstate_t *tptr; 865 struct tslist *lhp; 866 867 ISP_GET_PC_ADDR(isp, bus, lun_hash[LUN_HASH_FUNC(lun)], lhp); 868 SLIST_FOREACH(tptr, lhp, next) { 869 if (tptr->ts_lun == lun) { --- 299 unchanged lines hidden (view full) --- 1169 } while (ccb); 1170 ISP_GET_PC_ADDR(isp, cam_sim_bus(xpt_path_sim(tptr->owner)), lun_hash[LUN_HASH_FUNC(tptr->ts_lun)], lhp); 1171 SLIST_REMOVE(lhp, tptr, tstate, next); 1172 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0, tptr->owner, "destroyed tstate\n"); 1173 xpt_free_path(tptr->owner); 1174 free(tptr, M_DEVBUF); 1175} 1176 |
1225/* 1226 * Enable a lun. 1227 */ | |
1228static void 1229isp_enable_lun(ispsoftc_t *isp, union ccb *ccb) 1230{ | 1177static void 1178isp_enable_lun(ispsoftc_t *isp, union ccb *ccb) 1179{ |
1231 tstate_t *tptr = NULL; 1232 int bus, tm_enabled, target_role; | 1180 tstate_t *tptr; 1181 int bus; |
1233 target_id_t target; 1234 lun_id_t lun; 1235 | 1182 target_id_t target; 1183 lun_id_t lun; 1184 |
1185 if (!IS_FC(isp) || !ISP_CAP_TMODE(isp) || !ISP_CAP_SCCFW(isp)) { 1186 xpt_print(ccb->ccb_h.path, "Target mode is not supported\n"); 1187 ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; 1188 xpt_done(ccb); 1189 return; 1190 } |
|
1236 1237 /* | 1191 1192 /* |
1238 * We only support either a wildcard target/lun or a target ID of zero and a non-wildcard lun | 1193 * We only support either target and lun both wildcard 1194 * or target and lun both non-wildcard. |
1239 */ 1240 bus = XS_CHANNEL(ccb); 1241 target = ccb->ccb_h.target_id; 1242 lun = ccb->ccb_h.target_lun; 1243 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, 1244 "enabling lun %jx\n", (uintmax_t)lun); | 1195 */ 1196 bus = XS_CHANNEL(ccb); 1197 target = ccb->ccb_h.target_id; 1198 lun = ccb->ccb_h.target_lun; 1199 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, 1200 "enabling lun %jx\n", (uintmax_t)lun); |
1245 if (target == CAM_TARGET_WILDCARD && lun != CAM_LUN_WILDCARD) { | 1201 if ((target == CAM_TARGET_WILDCARD) != (lun == CAM_LUN_WILDCARD)) { |
1246 ccb->ccb_h.status = CAM_LUN_INVALID; 1247 xpt_done(ccb); 1248 return; 1249 } 1250 | 1202 ccb->ccb_h.status = CAM_LUN_INVALID; 1203 xpt_done(ccb); 1204 return; 1205 } 1206 |
1251 if (target != CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { 1252 ccb->ccb_h.status = CAM_LUN_INVALID; 1253 xpt_done(ccb); 1254 return; 1255 } 1256 if (isp->isp_dblev & ISP_LOGTDEBUG0) { 1257 xpt_print(ccb->ccb_h.path, 1258 "enabling lun 0x%jx on channel %d\n", (uintmax_t)lun, bus); 1259 } 1260 1261 /* 1262 * Wait until we're not busy with the lun enables subsystem 1263 */ 1264 isp_tmlock(isp, "isp_enable_lun"); 1265 1266 /* 1267 * This is as a good a place as any to check f/w capabilities. 1268 */ 1269 1270 if (IS_FC(isp)) { 1271 if (ISP_CAP_TMODE(isp) == 0) { 1272 xpt_print(ccb->ccb_h.path, "firmware does not support target mode\n"); 1273 ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; 1274 goto done; 1275 } 1276 /* 1277 * We *could* handle non-SCCLUN f/w, but we'd have to 1278 * dork with our already fragile enable/disable code. 1279 */ 1280 if (ISP_CAP_SCCFW(isp) == 0) { 1281 xpt_print(ccb->ccb_h.path, "firmware not SCCLUN capable\n"); 1282 ccb->ccb_h.status = CAM_FUNC_NOTAVAIL; 1283 goto done; 1284 } 1285 1286 target_role = (FCPARAM(isp, bus)->role & ISP_ROLE_TARGET) != 0; 1287 1288 } else { 1289 target_role = (SDPARAM(isp, bus)->role & ISP_ROLE_TARGET) != 0; 1290 } 1291 1292 /* 1293 * Create the state pointer. 1294 * It should not already exist. 1295 */ | 1207 /* Create the state pointer. It should not already exist. */ |
1296 tptr = get_lun_statep(isp, bus, lun); 1297 if (tptr) { 1298 ccb->ccb_h.status = CAM_LUN_ALRDY_ENA; | 1208 tptr = get_lun_statep(isp, bus, lun); 1209 if (tptr) { 1210 ccb->ccb_h.status = CAM_LUN_ALRDY_ENA; |
1299 goto done; | 1211 xpt_done(ccb); 1212 return; |
1300 } 1301 ccb->ccb_h.status = create_lun_state(isp, bus, ccb->ccb_h.path, &tptr); 1302 if (ccb->ccb_h.status != CAM_REQ_CMP) { | 1213 } 1214 ccb->ccb_h.status = create_lun_state(isp, bus, ccb->ccb_h.path, &tptr); 1215 if (ccb->ccb_h.status != CAM_REQ_CMP) { |
1303 goto done; | 1216 xpt_done(ccb); 1217 return; |
1304 } 1305 | 1218 } 1219 |
1306 /* 1307 * We have a tricky maneuver to perform here. 1308 * 1309 * If target mode isn't already enabled here, 1310 * *and* our current role includes target mode, 1311 * we enable target mode here. 1312 * 1313 */ 1314 ISP_GET_PC(isp, bus, tm_enabled, tm_enabled); 1315 if (tm_enabled == 0 && target_role != 0) { 1316 if (isp_enable_target_mode(isp, bus)) { 1317 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 1318 destroy_lun_state(isp, tptr); 1319 tptr = NULL; 1320 goto done; 1321 } 1322 tm_enabled = 1; 1323 } 1324 1325 /* 1326 * Now check to see whether this bus is in target mode already. 1327 * 1328 * If not, a later role change into target mode will finish the job. 1329 */ 1330 if (tm_enabled == 0) { 1331 ISP_SET_PC(isp, bus, tm_enable_defer, 1); 1332 ccb->ccb_h.status = CAM_REQ_CMP; 1333 xpt_print(ccb->ccb_h.path, "Target Mode not enabled yet- lun enable deferred\n"); 1334 goto done1; 1335 } 1336 1337 /* 1338 * Enable the lun. 1339 */ 1340 ccb->ccb_h.status = isp_enable_deferred(isp, bus, lun); 1341 1342done: 1343 if (ccb->ccb_h.status != CAM_REQ_CMP) { 1344 if (tptr) { 1345 destroy_lun_state(isp, tptr); 1346 tptr = NULL; 1347 } 1348 } else { 1349 tptr->enabled = 1; 1350 } 1351done1: 1352 if (tptr) { 1353 rls_lun_statep(isp, tptr); 1354 } 1355 1356 /* 1357 * And we're outta here.... 1358 */ 1359 isp_tmunlk(isp); | 1220 rls_lun_statep(isp, tptr); 1221 ccb->ccb_h.status = CAM_REQ_CMP; |
1360 xpt_done(ccb); 1361} 1362 | 1222 xpt_done(ccb); 1223} 1224 |
1363static cam_status 1364isp_enable_deferred_luns(ispsoftc_t *isp, int bus) 1365{ 1366 tstate_t *tptr = NULL; 1367 struct tslist *lhp; 1368 int i, n; 1369 1370 1371 ISP_GET_PC(isp, bus, tm_enabled, i); 1372 if (i == 1) { 1373 return (CAM_REQ_CMP); 1374 } 1375 ISP_GET_PC(isp, bus, tm_enable_defer, i); 1376 if (i == 0) { 1377 return (CAM_REQ_CMP); 1378 } 1379 /* 1380 * If this succeeds, it will set tm_enable 1381 */ 1382 if (isp_enable_target_mode(isp, bus)) { 1383 return (CAM_REQ_CMP_ERR); 1384 } 1385 isp_tmlock(isp, "isp_enable_deferred_luns"); 1386 for (n = i = 0; i < LUN_HASH_SIZE; i++) { 1387 ISP_GET_PC_ADDR(isp, bus, lun_hash[i], lhp); 1388 SLIST_FOREACH(tptr, lhp, next) { 1389 tptr->hold++; 1390 if (tptr->enabled == 0) { 1391 if (isp_enable_deferred(isp, bus, tptr->ts_lun) == CAM_REQ_CMP) { 1392 tptr->enabled = 1; 1393 n++; 1394 } 1395 } else { 1396 n++; 1397 } 1398 tptr->hold--; 1399 } 1400 } 1401 isp_tmunlk(isp); 1402 if (n == 0) { 1403 return (CAM_REQ_CMP_ERR); 1404 } 1405 ISP_SET_PC(isp, bus, tm_enable_defer, 0); 1406 return (CAM_REQ_CMP); 1407} 1408 1409static cam_status 1410isp_enable_deferred(ispsoftc_t *isp, int bus, lun_id_t lun) 1411{ 1412 cam_status status; 1413 int luns_already_enabled; 1414 1415 ISP_GET_PC(isp, bus, tm_luns_enabled, luns_already_enabled); 1416 isp_prt(isp, ISP_LOGTINFO, "%s: bus %d lun %jx luns_enabled %d", __func__, bus, (uintmax_t)lun, luns_already_enabled); 1417 if (IS_23XX(isp) || IS_24XX(isp) || 1418 (IS_FC(isp) && luns_already_enabled)) { 1419 status = CAM_REQ_CMP; 1420 } else { 1421 int cmd_cnt, not_cnt; 1422 1423 if (IS_23XX(isp)) { 1424 cmd_cnt = DFLT_CMND_CNT; 1425 not_cnt = DFLT_INOT_CNT; 1426 } else { 1427 cmd_cnt = 64; 1428 not_cnt = 8; 1429 } 1430 status = CAM_REQ_INPROG; 1431 isp->isp_osinfo.rptr = &status; 1432 if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun == CAM_LUN_WILDCARD? 0 : lun, cmd_cnt, not_cnt)) { 1433 status = CAM_RESRC_UNAVAIL; 1434 } else { 1435 mtx_sleep(&status, &isp->isp_lock, PRIBIO, "isp_enable_deferred", 0); 1436 } 1437 isp->isp_osinfo.rptr = NULL; 1438 } 1439 if (status == CAM_REQ_CMP) { 1440 ISP_SET_PC(isp, bus, tm_luns_enabled, 1); 1441 isp_prt(isp, ISP_LOGCONFIG|ISP_LOGTINFO, "bus %d lun %jx now enabled for target mode", bus, (uintmax_t)lun); 1442 } 1443 return (status); 1444} 1445 | |
1446static void 1447isp_disable_lun(ispsoftc_t *isp, union ccb *ccb) 1448{ 1449 tstate_t *tptr = NULL; 1450 int bus; | 1225static void 1226isp_disable_lun(ispsoftc_t *isp, union ccb *ccb) 1227{ 1228 tstate_t *tptr = NULL; 1229 int bus; |
1451 cam_status status; | |
1452 target_id_t target; 1453 lun_id_t lun; 1454 1455 bus = XS_CHANNEL(ccb); 1456 target = ccb->ccb_h.target_id; 1457 lun = ccb->ccb_h.target_lun; 1458 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, 1459 "disabling lun %jx\n", (uintmax_t)lun); | 1230 target_id_t target; 1231 lun_id_t lun; 1232 1233 bus = XS_CHANNEL(ccb); 1234 target = ccb->ccb_h.target_id; 1235 lun = ccb->ccb_h.target_lun; 1236 ISP_PATH_PRT(isp, ISP_LOGTDEBUG0|ISP_LOGCONFIG, ccb->ccb_h.path, 1237 "disabling lun %jx\n", (uintmax_t)lun); |
1460 if (target == CAM_TARGET_WILDCARD && lun != CAM_LUN_WILDCARD) { | 1238 if ((target == CAM_TARGET_WILDCARD) != (lun == CAM_LUN_WILDCARD)) { |
1461 ccb->ccb_h.status = CAM_LUN_INVALID; 1462 xpt_done(ccb); 1463 return; 1464 } 1465 | 1239 ccb->ccb_h.status = CAM_LUN_INVALID; 1240 xpt_done(ccb); 1241 return; 1242 } 1243 |
1466 if (target != CAM_TARGET_WILDCARD && lun == CAM_LUN_WILDCARD) { 1467 ccb->ccb_h.status = CAM_LUN_INVALID; | 1244 /* Find the state pointer. */ 1245 if ((tptr = get_lun_statep(isp, bus, lun)) == NULL) { 1246 ccb->ccb_h.status = CAM_PATH_INVALID; |
1468 xpt_done(ccb); 1469 return; 1470 } 1471 | 1247 xpt_done(ccb); 1248 return; 1249 } 1250 |
1472 /* 1473 * See if we're busy disabling a lun now. 1474 */ 1475 isp_tmlock(isp, "isp_disable_lun"); 1476 status = CAM_REQ_INPROG; 1477 1478 /* 1479 * Find the state pointer. 1480 */ 1481 if ((tptr = get_lun_statep(isp, bus, lun)) == NULL) { 1482 status = CAM_PATH_INVALID; 1483 goto done; 1484 } 1485 1486 /* 1487 * If we're a 24XX card, we're done. 1488 */ 1489 if (IS_23XX(isp) || IS_24XX(isp)) { 1490 status = CAM_REQ_CMP; 1491 goto done; 1492 } 1493 1494 /* 1495 * For SCC FW, we only deal with lun zero. 1496 */ 1497 if (IS_FC(isp) && lun > 0) { 1498 status = CAM_REQ_CMP; 1499 goto done; 1500 } 1501 isp->isp_osinfo.rptr = &status; 1502 if (isp_lun_cmd(isp, RQSTYPE_ENABLE_LUN, bus, lun, 0, 0)) { 1503 status = CAM_RESRC_UNAVAIL; 1504 } else { 1505 mtx_sleep(&status, &isp->isp_lock, PRIBIO, "isp_disable_lun", 0); 1506 } 1507 isp->isp_osinfo.rptr = NULL; 1508done: 1509 if (status == CAM_REQ_CMP) { 1510 tptr->enabled = 0; 1511 if (is_any_lun_enabled(isp, bus) == 0) { 1512 if (isp_disable_target_mode(isp, bus)) { 1513 status = CAM_REQ_CMP_ERR; 1514 } 1515 } 1516 } 1517 ccb->ccb_h.status = status; 1518 if (status == CAM_REQ_CMP) { 1519 destroy_lun_state(isp, tptr); 1520 xpt_print(ccb->ccb_h.path, "lun now disabled for target mode\n"); 1521 } else { 1522 if (tptr) 1523 rls_lun_statep(isp, tptr); 1524 } 1525 isp_tmunlk(isp); | 1251 destroy_lun_state(isp, tptr); 1252 ccb->ccb_h.status = CAM_REQ_CMP; |
1526 xpt_done(ccb); 1527} 1528 | 1253 xpt_done(ccb); 1254} 1255 |
1529static int 1530isp_enable_target_mode(ispsoftc_t *isp, int bus) 1531{ 1532 int tm_enabled; 1533 1534 ISP_GET_PC(isp, bus, tm_enabled, tm_enabled); 1535 if (tm_enabled != 0) { 1536 return (0); 1537 } 1538 if (IS_SCSI(isp)) { 1539 mbreg_t mbs; 1540 MBSINIT(&mbs, MBOX_ENABLE_TARGET_MODE, MBLOGALL, 0); 1541 mbs.param[0] = MBOX_ENABLE_TARGET_MODE; 1542 mbs.param[1] = ENABLE_TARGET_FLAG|ENABLE_TQING_FLAG; 1543 mbs.param[2] = bus << 7; 1544 if (isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs) < 0 || mbs.param[0] != MBOX_COMMAND_COMPLETE) { 1545 isp_prt(isp, ISP_LOGERR, "Unable to enable Target Role on Bus %d", bus); 1546 return (EIO); 1547 } 1548 } 1549 ISP_SET_PC(isp, bus, tm_enabled, 1); 1550 isp_prt(isp, ISP_LOGINFO, "Target Role enabled on Bus %d", bus); 1551 return (0); 1552} 1553 1554static int 1555isp_disable_target_mode(ispsoftc_t *isp, int bus) 1556{ 1557 int tm_enabled; 1558 1559 ISP_GET_PC(isp, bus, tm_enabled, tm_enabled); 1560 if (tm_enabled == 0) { 1561 return (0); 1562 } 1563 if (IS_SCSI(isp)) { 1564 mbreg_t mbs; 1565 MBSINIT(&mbs, MBOX_ENABLE_TARGET_MODE, MBLOGALL, 0); 1566 mbs.param[2] = bus << 7; 1567 if (isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs) < 0 || mbs.param[0] != MBOX_COMMAND_COMPLETE) { 1568 isp_prt(isp, ISP_LOGERR, "Unable to disable Target Role on Bus %d", bus); 1569 return (EIO); 1570 } 1571 } 1572 ISP_SET_PC(isp, bus, tm_enabled, 0); 1573 isp_prt(isp, ISP_LOGINFO, "Target Role disabled on Bus %d", bus); 1574 return (0); 1575} 1576 | |
1577static void | 1256static void |
1578isp_ledone(ispsoftc_t *isp, lun_entry_t *lep) 1579{ 1580 uint32_t *rptr; 1581 1582 rptr = isp->isp_osinfo.rptr; 1583 if (lep->le_status != LUN_OK) { 1584 isp_prt(isp, ISP_LOGERR, "ENABLE/MODIFY LUN returned 0x%x", lep->le_status); 1585 if (rptr) { 1586 *rptr = CAM_REQ_CMP_ERR; 1587 wakeup_one(rptr); 1588 } 1589 } else { 1590 if (rptr) { 1591 *rptr = CAM_REQ_CMP; 1592 wakeup_one(rptr); 1593 } 1594 } 1595} 1596 1597static void | |
1598isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how) 1599{ 1600 int fctape, sendstatus, resid; 1601 tstate_t *tptr; 1602 fcparam *fcp; 1603 atio_private_data_t *atp; 1604 struct ccb_scsiio *cso; 1605 uint32_t dmaresult, handle, xfrlen, sense_length, tmp; --- 280 unchanged lines hidden (view full) --- 1886 atp->state = ATPD_STATE_CTIO; 1887 } 1888 } else { 1889 atp->state = ATPD_STATE_CTIO; 1890 } 1891 isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x xfrlen=%u off=%u", __func__, 1892 cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, xfrlen, atp->bytes_xfered); 1893 } | 1257isp_target_start_ctio(ispsoftc_t *isp, union ccb *ccb, enum Start_Ctio_How how) 1258{ 1259 int fctape, sendstatus, resid; 1260 tstate_t *tptr; 1261 fcparam *fcp; 1262 atio_private_data_t *atp; 1263 struct ccb_scsiio *cso; 1264 uint32_t dmaresult, handle, xfrlen, sense_length, tmp; --- 280 unchanged lines hidden (view full) --- 1545 atp->state = ATPD_STATE_CTIO; 1546 } 1547 } else { 1548 atp->state = ATPD_STATE_CTIO; 1549 } 1550 isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO7[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x xfrlen=%u off=%u", __func__, 1551 cto->ct_rxid, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cto->ct_scsi_status, cto->ct_flags, xfrlen, atp->bytes_xfered); 1552 } |
1894 } else if (IS_FC(isp)) { | 1553 } else { |
1895 ct2_entry_t *cto = (ct2_entry_t *) local; 1896 1897 if (isp->isp_osinfo.sixtyfourbit) 1898 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3; 1899 else 1900 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 1901 cto->ct_header.rqs_entry_count = 1; 1902 cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; --- 132 unchanged lines hidden (view full) --- 2035 atp->state = ATPD_STATE_CTIO; 2036 } 2037 } else { 2038 atp->state = ATPD_STATE_CTIO; 2039 } 2040 } 2041 isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[%x] seq %u nc %d CDB0=%x scsi status %x flags %x resid %d xfrlen %u offset %u", __func__, cto->ct_rxid, 2042 ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered); | 1554 ct2_entry_t *cto = (ct2_entry_t *) local; 1555 1556 if (isp->isp_osinfo.sixtyfourbit) 1557 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3; 1558 else 1559 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 1560 cto->ct_header.rqs_entry_count = 1; 1561 cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; --- 132 unchanged lines hidden (view full) --- 1694 atp->state = ATPD_STATE_CTIO; 1695 } 1696 } else { 1697 atp->state = ATPD_STATE_CTIO; 1698 } 1699 } 1700 isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[%x] seq %u nc %d CDB0=%x scsi status %x flags %x resid %d xfrlen %u offset %u", __func__, cto->ct_rxid, 1701 ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered); |
2043 } else { 2044 ct_entry_t *cto = (ct_entry_t *) local; 2045 2046 cto->ct_header.rqs_entry_type = RQSTYPE_CTIO; 2047 cto->ct_header.rqs_entry_count = 1; 2048 cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; 2049 ATPD_SET_SEQNO(cto, atp); 2050 cto->ct_iid = cso->init_id; 2051 cto->ct_iid |= XS_CHANNEL(ccb) << 7; 2052 cto->ct_tgt = ccb->ccb_h.target_id; 2053 cto->ct_lun = ccb->ccb_h.target_lun; 2054 cto->ct_fwhandle = cso->tag_id; 2055 if (atp->rxid) { 2056 cto->ct_tag_val = atp->rxid; 2057 cto->ct_flags |= CT_TQAE; 2058 } 2059 if (ccb->ccb_h.flags & CAM_DIS_DISCONNECT) { 2060 cto->ct_flags |= CT_NODISC; 2061 } 2062 if (cso->dxfer_len == 0) { 2063 cto->ct_flags |= CT_NO_DATA; 2064 } else if ((cso->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2065 cto->ct_flags |= CT_DATA_IN; 2066 } else { 2067 cto->ct_flags |= CT_DATA_OUT; 2068 } 2069 if (ccb->ccb_h.flags & CAM_SEND_STATUS) { 2070 cto->ct_flags |= CT_SENDSTATUS|CT_CCINCR; 2071 cto->ct_scsi_status = cso->scsi_status; 2072 cto->ct_resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit - xfrlen; 2073 isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] seq %u nc %d scsi status %x resid %d tag_id %x", __func__, 2074 cto->ct_fwhandle, ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), cso->scsi_status, cso->resid, cso->tag_id); 2075 } 2076 ccb->ccb_h.flags &= ~CAM_SEND_SENSE; 2077 cto->ct_timeout = 10; | |
2078 } 2079 2080 if (isp_get_pcmd(isp, ccb)) { 2081 ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "out of PCMDs\n"); 2082 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 2083 break; 2084 } 2085 if (isp_allocate_xs_tgt(isp, ccb, &handle)) { --- 13 unchanged lines hidden (view full) --- 2099 * any swizzling is done in the machine dependent layer. Because 2100 * of this, we put the request onto the queue area first in native 2101 * format. 2102 */ 2103 2104 if (IS_24XX(isp)) { 2105 ct7_entry_t *cto = (ct7_entry_t *) local; 2106 cto->ct_syshandle = handle; | 1702 } 1703 1704 if (isp_get_pcmd(isp, ccb)) { 1705 ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "out of PCMDs\n"); 1706 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 1707 break; 1708 } 1709 if (isp_allocate_xs_tgt(isp, ccb, &handle)) { --- 13 unchanged lines hidden (view full) --- 1723 * any swizzling is done in the machine dependent layer. Because 1724 * of this, we put the request onto the queue area first in native 1725 * format. 1726 */ 1727 1728 if (IS_24XX(isp)) { 1729 ct7_entry_t *cto = (ct7_entry_t *) local; 1730 cto->ct_syshandle = handle; |
2107 } else if (IS_FC(isp)) { | 1731 } else { |
2108 ct2_entry_t *cto = (ct2_entry_t *) local; 2109 cto->ct_syshandle = handle; | 1732 ct2_entry_t *cto = (ct2_entry_t *) local; 1733 cto->ct_syshandle = handle; |
2110 } else { 2111 ct_entry_t *cto = (ct_entry_t *) local; 2112 cto->ct_syshandle = handle; | |
2113 } 2114 2115 dmaresult = ISP_DMASETUP(isp, cso, (ispreq_t *) local); 2116 if (dmaresult != CMD_QUEUED) { 2117 isp_destroy_tgt_handle(isp, handle); 2118 isp_free_pcmd(isp, ccb); 2119 if (dmaresult == CMD_EAGAIN) { 2120 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); --- 41 unchanged lines hidden (view full) --- 2162 2163 2164static void 2165isp_target_putback_atio(union ccb *ccb) 2166{ 2167 ispsoftc_t *isp; 2168 struct ccb_scsiio *cso; 2169 void *qe; | 1734 } 1735 1736 dmaresult = ISP_DMASETUP(isp, cso, (ispreq_t *) local); 1737 if (dmaresult != CMD_QUEUED) { 1738 isp_destroy_tgt_handle(isp, handle); 1739 isp_free_pcmd(isp, ccb); 1740 if (dmaresult == CMD_EAGAIN) { 1741 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); --- 41 unchanged lines hidden (view full) --- 1783 1784 1785static void 1786isp_target_putback_atio(union ccb *ccb) 1787{ 1788 ispsoftc_t *isp; 1789 struct ccb_scsiio *cso; 1790 void *qe; |
1791 at2_entry_t local, *at = &local; |
|
2170 2171 isp = XS_ISP(ccb); 2172 2173 qe = isp_getrqentry(isp); 2174 if (qe == NULL) { 2175 xpt_print(ccb->ccb_h.path, 2176 "%s: Request Queue Overflow\n", __func__); 2177 callout_reset(&PISP_PCMD(ccb)->wdog, 10, 2178 isp_refire_putback_atio, ccb); 2179 return; 2180 } 2181 memset(qe, 0, QENTRY_LEN); 2182 cso = &ccb->csio; | 1792 1793 isp = XS_ISP(ccb); 1794 1795 qe = isp_getrqentry(isp); 1796 if (qe == NULL) { 1797 xpt_print(ccb->ccb_h.path, 1798 "%s: Request Queue Overflow\n", __func__); 1799 callout_reset(&PISP_PCMD(ccb)->wdog, 10, 1800 isp_refire_putback_atio, ccb); 1801 return; 1802 } 1803 memset(qe, 0, QENTRY_LEN); 1804 cso = &ccb->csio; |
2183 if (IS_FC(isp)) { 2184 at2_entry_t local, *at = &local; 2185 ISP_MEMZERO(at, sizeof (at2_entry_t)); 2186 at->at_header.rqs_entry_type = RQSTYPE_ATIO2; 2187 at->at_header.rqs_entry_count = 1; 2188 if (ISP_CAP_SCCFW(isp)) { 2189 at->at_scclun = (uint16_t) ccb->ccb_h.target_lun; | 1805 ISP_MEMZERO(at, sizeof (at2_entry_t)); 1806 at->at_header.rqs_entry_type = RQSTYPE_ATIO2; 1807 at->at_header.rqs_entry_count = 1; 1808 if (ISP_CAP_SCCFW(isp)) { 1809 at->at_scclun = (uint16_t) ccb->ccb_h.target_lun; |
2190#if __FreeBSD_version < 1000700 | 1810#if __FreeBSD_version < 1000700 |
2191 if (at->at_scclun >= 256) 2192 at->at_scclun |= 0x4000; | 1811 if (at->at_scclun >= 256) 1812 at->at_scclun |= 0x4000; |
2193#endif | 1813#endif |
2194 } else { 2195 at->at_lun = (uint8_t) ccb->ccb_h.target_lun; 2196 } 2197 at->at_status = CT_OK; 2198 at->at_rxid = cso->tag_id; 2199 at->at_iid = cso->ccb_h.target_id; 2200 isp_put_atio2(isp, at, qe); | |
2201 } else { | 1814 } else { |
2202 at_entry_t local, *at = &local; 2203 ISP_MEMZERO(at, sizeof (at_entry_t)); 2204 at->at_header.rqs_entry_type = RQSTYPE_ATIO; 2205 at->at_header.rqs_entry_count = 1; 2206 at->at_iid = cso->init_id; 2207 at->at_iid |= XS_CHANNEL(ccb) << 7; 2208 at->at_tgt = cso->ccb_h.target_id; 2209 at->at_lun = cso->ccb_h.target_lun; 2210 at->at_status = CT_OK; 2211 at->at_tag_val = AT_GET_TAG(cso->tag_id); 2212 at->at_handle = AT_GET_HANDLE(cso->tag_id); 2213 isp_put_atio(isp, at, qe); | 1815 at->at_lun = (uint8_t) ccb->ccb_h.target_lun; |
2214 } | 1816 } |
1817 at->at_status = CT_OK; 1818 at->at_rxid = cso->tag_id; 1819 at->at_iid = cso->ccb_h.target_id; 1820 isp_put_atio2(isp, at, qe); |
|
2215 ISP_TDQE(isp, "isp_target_putback_atio", isp->isp_reqidx, qe); 2216 ISP_SYNC_REQUEST(isp); 2217 isp_complete_ctio(ccb); 2218} 2219 2220static void 2221isp_complete_ctio(union ccb *ccb) 2222{ 2223 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) { 2224 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; 2225 xpt_done(ccb); 2226 } 2227} 2228 | 1821 ISP_TDQE(isp, "isp_target_putback_atio", isp->isp_reqidx, qe); 1822 ISP_SYNC_REQUEST(isp); 1823 isp_complete_ctio(ccb); 1824} 1825 1826static void 1827isp_complete_ctio(union ccb *ccb) 1828{ 1829 if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) { 1830 ccb->ccb_h.status &= ~CAM_SIM_QUEUED; 1831 xpt_done(ccb); 1832 } 1833} 1834 |
2229/* 2230 * Handle ATIO stuff that the generic code can't. 2231 * This means handling CDBs. 2232 */ 2233 | |
2234static void | 1835static void |
2235isp_handle_platform_atio(ispsoftc_t *isp, at_entry_t *aep) 2236{ 2237 tstate_t *tptr; 2238 int status, bus; 2239 struct ccb_accept_tio *atiop; 2240 atio_private_data_t *atp; 2241 2242 /* 2243 * The firmware status (except for the QLTM_SVALID bit) 2244 * indicates why this ATIO was sent to us. 2245 * 2246 * If QLTM_SVALID is set, the firmware has recommended Sense Data. 2247 * 2248 * If the DISCONNECTS DISABLED bit is set in the flags field, 2249 * we're still connected on the SCSI bus. 2250 */ 2251 status = aep->at_status; 2252 if ((status & ~QLTM_SVALID) == AT_PHASE_ERROR) { 2253 /* 2254 * Bus Phase Sequence error. We should have sense data 2255 * suggested by the f/w. I'm not sure quite yet what 2256 * to do about this for CAM. 2257 */ 2258 isp_prt(isp, ISP_LOGWARN, "PHASE ERROR"); 2259 isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0); 2260 return; 2261 } 2262 if ((status & ~QLTM_SVALID) != AT_CDB) { 2263 isp_prt(isp, ISP_LOGWARN, "bad atio (0x%x) leaked to platform", status); 2264 isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0); 2265 return; 2266 } 2267 2268 bus = GET_BUS_VAL(aep->at_iid); 2269 tptr = get_lun_statep(isp, bus, aep->at_lun); 2270 if (tptr == NULL) { 2271 tptr = get_lun_statep(isp, bus, CAM_LUN_WILDCARD); 2272 if (tptr == NULL) { 2273 /* 2274 * Because we can't autofeed sense data back with 2275 * a command for parallel SCSI, we can't give back 2276 * a CHECK CONDITION. We'll give back a BUSY status 2277 * instead. This works out okay because the only 2278 * time we should, in fact, get this, is in the 2279 * case that somebody configured us without the 2280 * blackhole driver, so they get what they deserve. 2281 */ 2282 isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0); 2283 return; 2284 } 2285 } 2286 2287 atp = isp_get_atpd(isp, tptr, aep->at_handle); 2288 atiop = (struct ccb_accept_tio *) SLIST_FIRST(&tptr->atios); 2289 if (atiop == NULL || atp == NULL) { 2290 /* 2291 * Because we can't autofeed sense data back with 2292 * a command for parallel SCSI, we can't give back 2293 * a CHECK CONDITION. We'll give back a QUEUE FULL status 2294 * instead. This works out okay because the only time we 2295 * should, in fact, get this, is in the case that we've 2296 * run out of ATIOS. 2297 */ 2298 xpt_print(tptr->owner, "no %s for lun %x from initiator %d\n", (atp == NULL && atiop == NULL)? "ATIOs *or* ATPS" : 2299 ((atp == NULL)? "ATPs" : "ATIOs"), aep->at_lun, aep->at_iid); 2300 isp_endcmd(isp, aep, SCSI_STATUS_BUSY, 0); 2301 if (atp) { 2302 isp_put_atpd(isp, tptr, atp); 2303 } 2304 rls_lun_statep(isp, tptr); 2305 return; 2306 } 2307 atp->rxid = aep->at_tag_val; 2308 atp->state = ATPD_STATE_ATIO; 2309 SLIST_REMOVE_HEAD(&tptr->atios, sim_links.sle); 2310 tptr->atio_count--; 2311 ISP_PATH_PRT(isp, ISP_LOGTDEBUG2, atiop->ccb_h.path, "Take FREE ATIO count now %d\n", tptr->atio_count); 2312 atiop->ccb_h.target_id = aep->at_tgt; 2313 atiop->ccb_h.target_lun = aep->at_lun; 2314 if (aep->at_flags & AT_NODISC) { 2315 atiop->ccb_h.flags |= CAM_DIS_DISCONNECT; 2316 } else { 2317 atiop->ccb_h.flags &= ~CAM_DIS_DISCONNECT; 2318 } 2319 2320 if (status & QLTM_SVALID) { 2321 size_t amt = ISP_MIN(QLTM_SENSELEN, sizeof (atiop->sense_data)); 2322 atiop->sense_len = amt; 2323 ISP_MEMCPY(&atiop->sense_data, aep->at_sense, amt); 2324 } else { 2325 atiop->sense_len = 0; 2326 } 2327 2328 atiop->init_id = GET_IID_VAL(aep->at_iid); 2329 atiop->cdb_len = aep->at_cdblen; 2330 ISP_MEMCPY(atiop->cdb_io.cdb_bytes, aep->at_cdb, aep->at_cdblen); 2331 atiop->ccb_h.status = CAM_CDB_RECVD; 2332 /* 2333 * Construct a tag 'id' based upon tag value (which may be 0..255) 2334 * and the handle (which we have to preserve). 2335 */ 2336 atiop->tag_id = atp->tag; 2337 if (aep->at_flags & AT_TQAE) { 2338 atiop->tag_action = aep->at_tag_type; 2339 atiop->ccb_h.status |= CAM_TAG_ACTION_VALID; 2340 } 2341 atp->orig_datalen = 0; 2342 atp->bytes_xfered = 0; 2343 atp->lun = aep->at_lun; 2344 atp->nphdl = aep->at_iid; 2345 atp->portid = PORT_ANY; 2346 atp->oxid = 0; 2347 atp->cdb0 = atiop->cdb_io.cdb_bytes[0]; 2348 atp->tattr = aep->at_tag_type; 2349 atp->state = ATPD_STATE_CAM; 2350 isp_prt(isp, ISP_LOGTDEBUG0, "ATIO[0x%x] CDB=0x%x lun %x", aep->at_tag_val, atp->cdb0, atp->lun); 2351 rls_lun_statep(isp, tptr); 2352} 2353 2354static void | |
2355isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep) 2356{ 2357 fcparam *fcp; 2358 lun_id_t lun; 2359 fcportdb_t *lp; 2360 tstate_t *tptr; 2361 struct ccb_accept_tio *atiop; 2362 uint16_t nphdl; --- 542 unchanged lines hidden (view full) --- 2905{ 2906 union ccb *ccb; 2907 int sentstatus = 0, ok = 0, notify_cam = 0, resid = 0, failure = 0; 2908 tstate_t *tptr = NULL; 2909 atio_private_data_t *atp = NULL; 2910 int bus; 2911 uint32_t handle, moved_data = 0, data_requested; 2912 | 1836isp_handle_platform_atio2(ispsoftc_t *isp, at2_entry_t *aep) 1837{ 1838 fcparam *fcp; 1839 lun_id_t lun; 1840 fcportdb_t *lp; 1841 tstate_t *tptr; 1842 struct ccb_accept_tio *atiop; 1843 uint16_t nphdl; --- 542 unchanged lines hidden (view full) --- 2386{ 2387 union ccb *ccb; 2388 int sentstatus = 0, ok = 0, notify_cam = 0, resid = 0, failure = 0; 2389 tstate_t *tptr = NULL; 2390 atio_private_data_t *atp = NULL; 2391 int bus; 2392 uint32_t handle, moved_data = 0, data_requested; 2393 |
2913 /* 2914 * CTIO handles are 16 bits. 2915 * CTIO2 and CTIO7 are 32 bits. 2916 */ 2917 2918 if (IS_SCSI(isp)) { 2919 handle = ((ct_entry_t *)arg)->ct_syshandle; 2920 } else { 2921 handle = ((ct2_entry_t *)arg)->ct_syshandle; 2922 } | 2394 handle = ((ct2_entry_t *)arg)->ct_syshandle; |
2923 ccb = isp_find_xs_tgt(isp, handle); 2924 if (ccb == NULL) { 2925 isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, arg); 2926 return; 2927 } 2928 isp_destroy_tgt_handle(isp, handle); 2929 data_requested = PISP_PCMD(ccb)->datalen; 2930 isp_free_pcmd(isp, ccb); --- 8 unchanged lines hidden (view full) --- 2939 } 2940 if (tptr == NULL) { 2941 isp_prt(isp, ISP_LOGERR, "%s: cannot find tptr for tag %x after I/O", __func__, ccb->csio.tag_id); 2942 return; 2943 } 2944 2945 if (IS_24XX(isp)) { 2946 atp = isp_find_atpd(isp, tptr, ((ct7_entry_t *)arg)->ct_rxid); | 2395 ccb = isp_find_xs_tgt(isp, handle); 2396 if (ccb == NULL) { 2397 isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, arg); 2398 return; 2399 } 2400 isp_destroy_tgt_handle(isp, handle); 2401 data_requested = PISP_PCMD(ccb)->datalen; 2402 isp_free_pcmd(isp, ccb); --- 8 unchanged lines hidden (view full) --- 2411 } 2412 if (tptr == NULL) { 2413 isp_prt(isp, ISP_LOGERR, "%s: cannot find tptr for tag %x after I/O", __func__, ccb->csio.tag_id); 2414 return; 2415 } 2416 2417 if (IS_24XX(isp)) { 2418 atp = isp_find_atpd(isp, tptr, ((ct7_entry_t *)arg)->ct_rxid); |
2947 } else if (IS_FC(isp)) { 2948 atp = isp_find_atpd(isp, tptr, ((ct2_entry_t *)arg)->ct_rxid); | |
2949 } else { | 2419 } else { |
2950 atp = isp_find_atpd(isp, tptr, ((ct_entry_t *)arg)->ct_fwhandle); | 2420 atp = isp_find_atpd(isp, tptr, ((ct2_entry_t *)arg)->ct_rxid); |
2951 } 2952 if (atp == NULL) { 2953 /* 2954 * XXX: isp_clear_commands() generates fake CTIO with zero 2955 * ct_rxid value, filling only ct_syshandle. Workaround 2956 * that using tag_id from the CCB, pointed by ct_syshandle. 2957 */ 2958 atp = isp_find_atpd(isp, tptr, ccb->csio.tag_id); --- 26 unchanged lines hidden (view full) --- 2985 notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0; 2986 if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA) { 2987 resid = ct->ct_resid; 2988 moved_data = data_requested - resid; 2989 } 2990 } 2991 isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO7[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct), 2992 notify_cam, ct->ct_nphdl, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID"); | 2421 } 2422 if (atp == NULL) { 2423 /* 2424 * XXX: isp_clear_commands() generates fake CTIO with zero 2425 * ct_rxid value, filling only ct_syshandle. Workaround 2426 * that using tag_id from the CCB, pointed by ct_syshandle. 2427 */ 2428 atp = isp_find_atpd(isp, tptr, ccb->csio.tag_id); --- 26 unchanged lines hidden (view full) --- 2455 notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0; 2456 if ((ct->ct_flags & CT7_DATAMASK) != CT7_NO_DATA) { 2457 resid = ct->ct_resid; 2458 moved_data = data_requested - resid; 2459 } 2460 } 2461 isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO7[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct), 2462 notify_cam, ct->ct_nphdl, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID"); |
2993 } else if (IS_FC(isp)) { | 2463 } else { |
2994 ct2_entry_t *ct = arg; 2995 if (ct->ct_status == CT_SRR) { 2996 atp->srr_ccb = ccb; 2997 if (atp->srr_notify_rcvd) 2998 isp_handle_srr_start(isp, tptr, atp); 2999 rls_lun_statep(isp, tptr); 3000 isp_target_putback_atio(ccb); 3001 return; --- 6 unchanged lines hidden (view full) --- 3008 notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0; 3009 if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) { 3010 resid = ct->ct_resid; 3011 moved_data = data_requested - resid; 3012 } 3013 } 3014 isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO2[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct), 3015 notify_cam, ct->ct_status, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID"); | 2464 ct2_entry_t *ct = arg; 2465 if (ct->ct_status == CT_SRR) { 2466 atp->srr_ccb = ccb; 2467 if (atp->srr_notify_rcvd) 2468 isp_handle_srr_start(isp, tptr, atp); 2469 rls_lun_statep(isp, tptr); 2470 isp_target_putback_atio(ccb); 2471 return; --- 6 unchanged lines hidden (view full) --- 2478 notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0; 2479 if ((ct->ct_flags & CT2_DATAMASK) != CT2_NO_DATA) { 2480 resid = ct->ct_resid; 2481 moved_data = data_requested - resid; 2482 } 2483 } 2484 isp_prt(isp, ok? ISP_LOGTDEBUG0 : ISP_LOGWARN, "%s: CTIO2[%x] seq %u nc %d sts 0x%x flg 0x%x sns %d resid %d %s", __func__, ct->ct_rxid, ATPD_GET_SEQNO(ct), 2485 notify_cam, ct->ct_status, ct->ct_flags, (ccb->ccb_h.status & CAM_SENT_SENSE) != 0, resid, sentstatus? "FIN" : "MID"); |
3016 } else { 3017 ct_entry_t *ct = arg; 3018 3019 if (ct->ct_status == (CT_HBA_RESET & 0xff)) { 3020 failure = CAM_UNREC_HBA_ERROR; 3021 } else { 3022 sentstatus = ct->ct_flags & CT_SENDSTATUS; 3023 ok = (ct->ct_status & ~QLTM_SVALID) == CT_OK; 3024 notify_cam = (ct->ct_header.rqs_seqno & ATPD_SEQ_NOTIFY_CAM) != 0; 3025 } 3026 if ((ct->ct_flags & CT_DATAMASK) != CT_NO_DATA) { 3027 resid = ct->ct_resid; 3028 moved_data = data_requested - resid; 3029 } 3030 isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO[%x] seq %u nc %d tag %x S_ID 0x%x lun %x sts %x flg %x resid %d %s", __func__, ct->ct_fwhandle, ATPD_GET_SEQNO(ct), 3031 notify_cam, ct->ct_tag_val, ct->ct_iid, ct->ct_lun, ct->ct_status, ct->ct_flags, resid, sentstatus? "FIN" : "MID"); | |
3032 } 3033 if (ok) { 3034 if (moved_data) { 3035 atp->bytes_xfered += moved_data; 3036 ccb->csio.resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit; 3037 } 3038 if (sentstatus && (ccb->ccb_h.flags & CAM_SEND_SENSE)) { 3039 ccb->ccb_h.status |= CAM_SENT_SENSE; --- 37 unchanged lines hidden (view full) --- 3077 if (ok || IS_24XX(isp)) { 3078 isp_complete_ctio(ccb); 3079 } else { 3080 isp_target_putback_atio(ccb); 3081 } 3082} 3083 3084static void | 2486 } 2487 if (ok) { 2488 if (moved_data) { 2489 atp->bytes_xfered += moved_data; 2490 ccb->csio.resid = atp->orig_datalen - atp->bytes_xfered - atp->bytes_in_transit; 2491 } 2492 if (sentstatus && (ccb->ccb_h.flags & CAM_SEND_SENSE)) { 2493 ccb->ccb_h.status |= CAM_SENT_SENSE; --- 37 unchanged lines hidden (view full) --- 2531 if (ok || IS_24XX(isp)) { 2532 isp_complete_ctio(ccb); 2533 } else { 2534 isp_target_putback_atio(ccb); 2535 } 2536} 2537 2538static void |
3085isp_handle_platform_notify_scsi(ispsoftc_t *isp, in_entry_t *inot) 3086{ 3087 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot); 3088} 3089 3090static void | |
3091isp_handle_platform_notify_fc(ispsoftc_t *isp, in_fcentry_t *inp) 3092{ 3093 int needack = 1; 3094 switch (inp->in_status) { 3095 case IN_PORT_LOGOUT: 3096 /* 3097 * XXX: Need to delete this initiator's WWN from the database 3098 * XXX: Need to send this LOGOUT upstream --- 514 unchanged lines hidden (view full) --- 3613 switch (code) { 3614 case AC_LOST_DEVICE: 3615 if (IS_SCSI(isp)) { 3616 uint16_t oflags, nflags; 3617 sdparam *sdp = SDPARAM(isp, bus); 3618 3619 if (tgt >= 0) { 3620 nflags = sdp->isp_devparam[tgt].nvrm_flags; | 2539isp_handle_platform_notify_fc(ispsoftc_t *isp, in_fcentry_t *inp) 2540{ 2541 int needack = 1; 2542 switch (inp->in_status) { 2543 case IN_PORT_LOGOUT: 2544 /* 2545 * XXX: Need to delete this initiator's WWN from the database 2546 * XXX: Need to send this LOGOUT upstream --- 514 unchanged lines hidden (view full) --- 3061 switch (code) { 3062 case AC_LOST_DEVICE: 3063 if (IS_SCSI(isp)) { 3064 uint16_t oflags, nflags; 3065 sdparam *sdp = SDPARAM(isp, bus); 3066 3067 if (tgt >= 0) { 3068 nflags = sdp->isp_devparam[tgt].nvrm_flags; |
3621#ifndef ISP_TARGET_MODE | |
3622 nflags &= DPARM_SAFE_DFLT; 3623 if (isp->isp_loaded_fw) { 3624 nflags |= DPARM_NARROW | DPARM_ASYNC; 3625 } | 3069 nflags &= DPARM_SAFE_DFLT; 3070 if (isp->isp_loaded_fw) { 3071 nflags |= DPARM_NARROW | DPARM_ASYNC; 3072 } |
3626#else 3627 nflags = DPARM_DEFAULT; 3628#endif | |
3629 oflags = sdp->isp_devparam[tgt].goal_flags; 3630 sdp->isp_devparam[tgt].goal_flags = nflags; 3631 sdp->isp_devparam[tgt].dev_update = 1; 3632 sdp->update = 1; 3633 (void) isp_control(isp, ISPCTL_UPDATE_PARAMS, bus); 3634 sdp->isp_devparam[tgt].goal_flags = oflags; 3635 } 3636 } --- 899 unchanged lines hidden (view full) --- 4536 if (fcp->role != ISP_ROLE_BOTH) { 4537 rchange = 1; 4538 newrole = ISP_ROLE_BOTH; 4539 } 4540 break; 4541 } 4542 if (rchange) { 4543 ISP_PATH_PRT(isp, ISP_LOGCONFIG, ccb->ccb_h.path, "changing role on from %d to %d\n", fcp->role, newrole); | 3073 oflags = sdp->isp_devparam[tgt].goal_flags; 3074 sdp->isp_devparam[tgt].goal_flags = nflags; 3075 sdp->isp_devparam[tgt].dev_update = 1; 3076 sdp->update = 1; 3077 (void) isp_control(isp, ISPCTL_UPDATE_PARAMS, bus); 3078 sdp->isp_devparam[tgt].goal_flags = oflags; 3079 } 3080 } --- 899 unchanged lines hidden (view full) --- 3980 if (fcp->role != ISP_ROLE_BOTH) { 3981 rchange = 1; 3982 newrole = ISP_ROLE_BOTH; 3983 } 3984 break; 3985 } 3986 if (rchange) { 3987 ISP_PATH_PRT(isp, ISP_LOGCONFIG, ccb->ccb_h.path, "changing role on from %d to %d\n", fcp->role, newrole); |
4544#ifdef ISP_TARGET_MODE 4545 ISP_SET_PC(isp, bus, tm_enabled, 0); 4546 ISP_SET_PC(isp, bus, tm_luns_enabled, 0); 4547#endif | |
4548 if (isp_control(isp, ISPCTL_CHANGE_ROLE, 4549 bus, newrole) != 0) { 4550 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 4551 xpt_done(ccb); 4552 break; 4553 } | 3988 if (isp_control(isp, ISPCTL_CHANGE_ROLE, 3989 bus, newrole) != 0) { 3990 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 3991 xpt_done(ccb); 3992 break; 3993 } |
4554#ifdef ISP_TARGET_MODE 4555 if (newrole == ISP_ROLE_TARGET || newrole == ISP_ROLE_BOTH) { 4556 /* 4557 * Give the new role a chance to complain and settle 4558 */ 4559 msleep(isp, &isp->isp_lock, PRIBIO, "taking a breather", 2); 4560 ccb->ccb_h.status = isp_enable_deferred_luns(isp, bus); 4561 } 4562#endif | |
4563 } 4564 } 4565 xpt_done(ccb); 4566 break; 4567 } 4568 case XPT_GET_SIM_KNOB: /* Get SIM knobs */ 4569 { 4570 struct ccb_sim_knob *kp = &ccb->knob; --- 29 unchanged lines hidden (view full) --- 4600 break; 4601 } 4602 case XPT_PATH_INQ: /* Path routing inquiry */ 4603 { 4604 struct ccb_pathinq *cpi = &ccb->cpi; 4605 4606 cpi->version_num = 1; 4607#ifdef ISP_TARGET_MODE | 3994 } 3995 } 3996 xpt_done(ccb); 3997 break; 3998 } 3999 case XPT_GET_SIM_KNOB: /* Get SIM knobs */ 4000 { 4001 struct ccb_sim_knob *kp = &ccb->knob; --- 29 unchanged lines hidden (view full) --- 4031 break; 4032 } 4033 case XPT_PATH_INQ: /* Path routing inquiry */ 4034 { 4035 struct ccb_pathinq *cpi = &ccb->cpi; 4036 4037 cpi->version_num = 1; 4038#ifdef ISP_TARGET_MODE |
4608 cpi->target_sprt = PIT_PROCESSOR | PIT_DISCONNECT | PIT_TERM_IO; 4609#else 4610 cpi->target_sprt = 0; | 4039 if (IS_FC(isp) && ISP_CAP_TMODE(isp) && ISP_CAP_SCCFW(isp)) 4040 cpi->target_sprt = PIT_PROCESSOR | PIT_DISCONNECT | PIT_TERM_IO; 4041 else |
4611#endif | 4042#endif |
4043 cpi->target_sprt = 0; |
|
4612 cpi->hba_eng_cnt = 0; 4613 cpi->max_target = ISP_MAX_TARGETS(isp) - 1; 4614 cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ? 4615 255 : ISP_MAX_LUNS(isp) - 1; 4616 cpi->bus_id = cam_sim_bus(sim); 4617 if (isp->isp_osinfo.sixtyfourbit) 4618 cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; 4619 else --- 473 unchanged lines hidden (view full) --- 5093 va_start(ap, cmd); 5094 hp = va_arg(ap, isphdr_t *); 5095 va_end(ap); 5096 switch (hp->rqs_entry_type) { 5097 default: 5098 isp_prt(isp, ISP_LOGWARN, "%s: unhandled target action 0x%x", __func__, hp->rqs_entry_type); 5099 break; 5100 case RQSTYPE_NOTIFY: | 4044 cpi->hba_eng_cnt = 0; 4045 cpi->max_target = ISP_MAX_TARGETS(isp) - 1; 4046 cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ? 4047 255 : ISP_MAX_LUNS(isp) - 1; 4048 cpi->bus_id = cam_sim_bus(sim); 4049 if (isp->isp_osinfo.sixtyfourbit) 4050 cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; 4051 else --- 473 unchanged lines hidden (view full) --- 4525 va_start(ap, cmd); 4526 hp = va_arg(ap, isphdr_t *); 4527 va_end(ap); 4528 switch (hp->rqs_entry_type) { 4529 default: 4530 isp_prt(isp, ISP_LOGWARN, "%s: unhandled target action 0x%x", __func__, hp->rqs_entry_type); 4531 break; 4532 case RQSTYPE_NOTIFY: |
5101 if (IS_SCSI(isp)) { 5102 isp_handle_platform_notify_scsi(isp, (in_entry_t *) hp); 5103 } else if (IS_24XX(isp)) { | 4533 if (IS_24XX(isp)) { |
5104 isp_handle_platform_notify_24xx(isp, (in_fcentry_24xx_t *) hp); 5105 } else { 5106 isp_handle_platform_notify_fc(isp, (in_fcentry_t *) hp); 5107 } 5108 break; 5109 case RQSTYPE_ATIO: | 4534 isp_handle_platform_notify_24xx(isp, (in_fcentry_24xx_t *) hp); 4535 } else { 4536 isp_handle_platform_notify_fc(isp, (in_fcentry_t *) hp); 4537 } 4538 break; 4539 case RQSTYPE_ATIO: |
5110 if (IS_24XX(isp)) { 5111 isp_handle_platform_atio7(isp, (at7_entry_t *) hp); 5112 } else { 5113 isp_handle_platform_atio(isp, (at_entry_t *) hp); 5114 } | 4540 isp_handle_platform_atio7(isp, (at7_entry_t *) hp); |
5115 break; 5116 case RQSTYPE_ATIO2: 5117 isp_handle_platform_atio2(isp, (at2_entry_t *) hp); 5118 break; 5119 case RQSTYPE_CTIO7: 5120 case RQSTYPE_CTIO3: 5121 case RQSTYPE_CTIO2: 5122 case RQSTYPE_CTIO: --- 48 unchanged lines hidden (view full) --- 5171 abts->abts_rxid_abts, abts->abts_nphdl, sid, abts->abts_rxid_task, abts->abts_rx_id, abts->abts_ox_id); 5172 } 5173 nt->nt_channel = chan; 5174 nt->nt_ncode = NT_ABORT_TASK; 5175 nt->nt_lreserved = hp; 5176 isp_handle_platform_target_tmf(isp, nt); 5177 break; 5178 } | 4541 break; 4542 case RQSTYPE_ATIO2: 4543 isp_handle_platform_atio2(isp, (at2_entry_t *) hp); 4544 break; 4545 case RQSTYPE_CTIO7: 4546 case RQSTYPE_CTIO3: 4547 case RQSTYPE_CTIO2: 4548 case RQSTYPE_CTIO: --- 48 unchanged lines hidden (view full) --- 4597 abts->abts_rxid_abts, abts->abts_nphdl, sid, abts->abts_rxid_task, abts->abts_rx_id, abts->abts_ox_id); 4598 } 4599 nt->nt_channel = chan; 4600 nt->nt_ncode = NT_ABORT_TASK; 4601 nt->nt_lreserved = hp; 4602 isp_handle_platform_target_tmf(isp, nt); 4603 break; 4604 } |
5179 case RQSTYPE_ENABLE_LUN: 5180 case RQSTYPE_MODIFY_LUN: 5181 isp_ledone(isp, (lun_entry_t *) hp); 5182 break; | |
5183 } 5184 break; 5185 } 5186#endif 5187 case ISPASYNC_FW_CRASH: 5188 { 5189 uint16_t mbox1, mbox6; 5190 mbox1 = ISP_READ(isp, OUTMAILBOX1); --- 403 unchanged lines hidden --- | 4605 } 4606 break; 4607 } 4608#endif 4609 case ISPASYNC_FW_CRASH: 4610 { 4611 uint16_t mbox1, mbox6; 4612 mbox1 = ISP_READ(isp, OUTMAILBOX1); --- 403 unchanged lines hidden --- |