Lines Matching refs:mpt
103 static int mpt_raid_reply_frame_handler(struct mpt_softc *mpt, request_t *req,
105 static int mpt_spawn_raid_thread(struct mpt_softc *mpt);
106 static void mpt_terminate_raid_thread(struct mpt_softc *mpt);
110 static void mpt_enable_vol(struct mpt_softc *mpt,
121 static void mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol,
123 static void mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk,
126 static int mpt_issue_raid_req(struct mpt_softc *mpt,
131 static int mpt_refresh_raid_data(struct mpt_softc *mpt);
132 static void mpt_schedule_raid_refresh(struct mpt_softc *mpt);
192 mpt_vol_prt(struct mpt_softc *mpt, struct mpt_raid_volume *vol, in mpt_vol_prt() argument
197 printf("%s:vol%d(%s:%d:%d): ", device_get_nameunit(mpt->dev), in mpt_vol_prt()
198 (u_int)(vol - mpt->raid_volumes), device_get_nameunit(mpt->dev), in mpt_vol_prt()
206 mpt_disk_prt(struct mpt_softc *mpt, struct mpt_raid_disk *disk, in mpt_disk_prt() argument
213 device_get_nameunit(mpt->dev), in mpt_disk_prt()
217 printf("(%s:%d:%d): ", device_get_nameunit(mpt->dev), in mpt_disk_prt()
230 struct mpt_softc *mpt; in mpt_raid_async() local
232 mpt = (struct mpt_softc*)callback_arg; in mpt_raid_async()
244 mpt_lprt(mpt, MPT_PRT_DEBUG, "Callback for %d\n", in mpt_raid_async()
247 RAID_VOL_FOREACH(mpt, mpt_vol) { in mpt_raid_async()
253 mpt_adjust_queue_depth(mpt, mpt_vol, path); in mpt_raid_async()
264 mpt_raid_probe(struct mpt_softc *mpt) in mpt_raid_probe() argument
267 if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) { in mpt_raid_probe()
274 mpt_raid_attach(struct mpt_softc *mpt) in mpt_raid_attach() argument
280 mpt_callout_init(mpt, &mpt->raid_timer); in mpt_raid_attach()
282 error = mpt_spawn_raid_thread(mpt); in mpt_raid_attach()
284 mpt_prt(mpt, "Unable to spawn RAID thread!\n"); in mpt_raid_attach()
288 MPT_LOCK(mpt); in mpt_raid_attach()
290 error = mpt_register_handler(mpt, MPT_HANDLER_REPLY, handler, in mpt_raid_attach()
293 mpt_prt(mpt, "Unable to register RAID haandler!\n"); in mpt_raid_attach()
298 xpt_setup_ccb(&csa.ccb_h, mpt->path, 5); in mpt_raid_attach()
302 csa.callback_arg = mpt; in mpt_raid_attach()
305 mpt_prt(mpt, "mpt_raid_attach: Unable to register " in mpt_raid_attach()
308 MPT_UNLOCK(mpt); in mpt_raid_attach()
310 mpt_raid_sysctl_attach(mpt); in mpt_raid_attach()
313 MPT_UNLOCK(mpt); in mpt_raid_attach()
314 mpt_raid_detach(mpt); in mpt_raid_attach()
319 mpt_raid_enable(struct mpt_softc *mpt) in mpt_raid_enable() argument
326 mpt_raid_detach(struct mpt_softc *mpt) in mpt_raid_detach() argument
331 mpt_callout_drain(mpt, &mpt->raid_timer); in mpt_raid_detach()
333 MPT_LOCK(mpt); in mpt_raid_detach()
334 mpt_terminate_raid_thread(mpt); in mpt_raid_detach()
336 mpt_deregister_handler(mpt, MPT_HANDLER_REPLY, handler, in mpt_raid_detach()
339 xpt_setup_ccb(&csa.ccb_h, mpt->path, /*priority*/5); in mpt_raid_detach()
343 csa.callback_arg = mpt; in mpt_raid_detach()
345 MPT_UNLOCK(mpt); in mpt_raid_detach()
349 mpt_raid_ioc_reset(struct mpt_softc *mpt, int type) in mpt_raid_ioc_reset() argument
372 mpt_raid_event(struct mpt_softc *mpt, request_t *req, in mpt_raid_event() argument
390 if (mpt->raid_volumes != NULL && mpt->ioc_page2 != NULL) { in mpt_raid_event()
391 for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) { in mpt_raid_event()
392 mpt_vol = &mpt->raid_volumes[i]; in mpt_raid_event()
402 if (i >= mpt->ioc_page2->MaxVolumes) { in mpt_raid_event()
409 if (raid_event->PhysDiskNum != 0xFF && mpt->raid_disks != NULL) { in mpt_raid_event()
410 mpt_disk = mpt->raid_disks + raid_event->PhysDiskNum; in mpt_raid_event()
438 mpt->raid_rescan++; in mpt_raid_event()
445 mpt->raid_rescan++; in mpt_raid_event()
449 mpt->raid_rescan++; in mpt_raid_event()
455 mpt->raid_rescan++; in mpt_raid_event()
464 mpt_disk_prt(mpt, mpt_disk, ""); in mpt_raid_event()
466 mpt_vol_prt(mpt, mpt_vol, ""); in mpt_raid_event()
468 mpt_prt(mpt, "Volume(%d:%d", raid_event->VolumeBus, in mpt_raid_event()
472 mpt_prtc(mpt, ":%d): ", in mpt_raid_event()
475 mpt_prtc(mpt, "): "); in mpt_raid_event()
479 mpt_prtc(mpt, "Unhandled RaidEvent %#x\n", in mpt_raid_event()
482 mpt_prtc(mpt, "%s\n", in mpt_raid_event()
489 mpt_disk_prt(mpt, mpt_disk, ""); in mpt_raid_event()
491 mpt_prt(mpt, "Volume(%d:%d:%d: ", in mpt_raid_event()
494 mpt_prtc(mpt, "ASC 0x%x, ASCQ 0x%x)\n", in mpt_raid_event()
498 mpt_raid_wakeup(mpt); in mpt_raid_event()
503 mpt_raid_shutdown(struct mpt_softc *mpt) in mpt_raid_shutdown() argument
507 if (mpt->raid_mwce_setting != MPT_RAID_MWCE_REBUILD_ONLY) { in mpt_raid_shutdown()
511 mpt->raid_mwce_setting = MPT_RAID_MWCE_OFF; in mpt_raid_shutdown()
512 RAID_VOL_FOREACH(mpt, mpt_vol) { in mpt_raid_shutdown()
513 mpt_verify_mwce(mpt, mpt_vol); in mpt_raid_shutdown()
518 mpt_raid_reply_handler(struct mpt_softc *mpt, request_t *req, in mpt_raid_reply_handler() argument
528 free_req = mpt_raid_reply_frame_handler(mpt, req, reply_frame); in mpt_raid_reply_handler()
537 TAILQ_REMOVE(&mpt->request_pending_list, req, links); in mpt_raid_reply_handler()
542 mpt_free_request(mpt, req); in mpt_raid_reply_handler()
553 mpt_raid_reply_frame_handler(struct mpt_softc *mpt, request_t *req, in mpt_raid_reply_frame_handler() argument
566 mpt_prt(mpt, "QUIESCE PHYSIO DONE\n"); in mpt_raid_reply_frame_handler()
569 mpt_prt(mpt, "ENABLY PHYSIO DONE\n"); in mpt_raid_reply_frame_handler()
585 mpt_issue_raid_req(struct mpt_softc *mpt, struct mpt_raid_volume *vol, in mpt_issue_raid_req() argument
614 mpt_check_doorbell(mpt); in mpt_issue_raid_req()
615 mpt_send_cmd(mpt, req); in mpt_issue_raid_req()
618 return (mpt_wait_req(mpt, req, REQ_STATE_DONE, REQ_STATE_DONE, in mpt_issue_raid_req()
627 mpt_spawn_raid_thread(struct mpt_softc *mpt) in mpt_spawn_raid_thread() argument
638 MPT_LOCK(mpt); in mpt_spawn_raid_thread()
639 xpt_freeze_simq(mpt->phydisk_sim, 1); in mpt_spawn_raid_thread()
640 MPT_UNLOCK(mpt); in mpt_spawn_raid_thread()
641 error = kproc_create(mpt_raid_thread, mpt, in mpt_spawn_raid_thread()
642 &mpt->raid_thread, /*flags*/0, /*altstack*/0, in mpt_spawn_raid_thread()
643 "mpt_raid%d", mpt->unit); in mpt_spawn_raid_thread()
645 MPT_LOCK(mpt); in mpt_spawn_raid_thread()
646 xpt_release_simq(mpt->phydisk_sim, /*run_queue*/FALSE); in mpt_spawn_raid_thread()
647 MPT_UNLOCK(mpt); in mpt_spawn_raid_thread()
653 mpt_terminate_raid_thread(struct mpt_softc *mpt) in mpt_terminate_raid_thread() argument
656 if (mpt->raid_thread == NULL) { in mpt_terminate_raid_thread()
659 mpt->shutdwn_raid = 1; in mpt_terminate_raid_thread()
660 wakeup(&mpt->raid_volumes); in mpt_terminate_raid_thread()
665 mpt_sleep(mpt, &mpt->raid_thread, PUSER, "thtrm", 0); in mpt_terminate_raid_thread()
671 struct mpt_softc *mpt; in mpt_raid_thread() local
674 mpt = (struct mpt_softc *)arg; in mpt_raid_thread()
676 MPT_LOCK(mpt); in mpt_raid_thread()
677 while (mpt->shutdwn_raid == 0) { in mpt_raid_thread()
678 if (mpt->raid_wakeup == 0) { in mpt_raid_thread()
679 mpt_sleep(mpt, &mpt->raid_volumes, PUSER, "idle", 0); in mpt_raid_thread()
683 mpt->raid_wakeup = 0; in mpt_raid_thread()
685 if (mpt_refresh_raid_data(mpt)) { in mpt_raid_thread()
686 mpt_schedule_raid_refresh(mpt); /* XX NOT QUITE RIGHT */ in mpt_raid_thread()
696 xpt_release_simq(mpt->phydisk_sim, TRUE); in mpt_raid_thread()
699 if (mpt->raid_rescan != 0) { in mpt_raid_thread()
703 mpt->raid_rescan = 0; in mpt_raid_thread()
704 MPT_UNLOCK(mpt); in mpt_raid_thread()
708 MPT_LOCK(mpt); in mpt_raid_thread()
710 cam_sim_path(mpt->phydisk_sim), in mpt_raid_thread()
714 mpt_prt(mpt, "Unable to rescan RAID Bus!\n"); in mpt_raid_thread()
720 mpt->raid_thread = NULL; in mpt_raid_thread()
721 wakeup(&mpt->raid_thread); in mpt_raid_thread()
722 MPT_UNLOCK(mpt); in mpt_raid_thread()
737 mpt_raid_quiesce_disk(struct mpt_softc *mpt, struct mpt_raid_disk *mpt_disk,
752 rv = mpt_issue_raid_req(mpt, mpt_disk->volume, mpt_disk, req,
763 mpt_disk_prt(mpt, mpt_disk, "mpt_raid_quiesce_disk: "
773 mpt_disk_prt(mpt, mpt_disk, "Quiece Failed"
788 mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, target_id_t *tgt) in mpt_map_physdisk() argument
792 mpt_disk = mpt->raid_disks + ccb->ccb_h.target_id; in mpt_map_physdisk()
793 if (ccb->ccb_h.target_id < mpt->raid_max_disks in mpt_map_physdisk()
798 mpt_lprt(mpt, MPT_PRT_DEBUG1, "mpt_map_physdisk(%d) - Not Active\n", in mpt_map_physdisk()
805 mpt_is_raid_member(struct mpt_softc *mpt, target_id_t tgt) in mpt_is_raid_member() argument
810 if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) in mpt_is_raid_member()
812 for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { in mpt_is_raid_member()
813 mpt_disk = &mpt->raid_disks[i]; in mpt_is_raid_member()
824 mpt_is_raid_volume(struct mpt_softc *mpt, target_id_t tgt) in mpt_is_raid_volume() argument
829 if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) { in mpt_is_raid_volume()
832 ioc_vol = mpt->ioc_page2->RaidVolume; in mpt_is_raid_volume()
833 ioc_last_vol = ioc_vol + mpt->ioc_page2->NumActiveVolumes; in mpt_is_raid_volume()
844 mpt_enable_vol(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol,
864 req = mpt_get_request(mpt, /*sleep_ok*/TRUE);
866 mpt_vol_prt(mpt, mpt_vol,
871 rv = mpt_issue_raid_req(mpt, mpt_vol, /*disk*/NULL, req,
877 mpt_vol_prt(mpt, mpt_vol, "mpt_enable_vol: "
886 mpt_vol_prt(mpt, mpt_vol, "%s Volume Failed: %d:%x:%x\n",
891 mpt_free_request(mpt, req);
896 mpt_verify_mwce(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol) in mpt_verify_mwce() argument
916 switch (mpt->raid_mwce_setting) { in mpt_verify_mwce()
943 req = mpt_get_request(mpt, /*sleep_ok*/TRUE); in mpt_verify_mwce()
945 mpt_vol_prt(mpt, mpt_vol, in mpt_verify_mwce()
955 rv = mpt_issue_raid_req(mpt, mpt_vol, /*disk*/NULL, req, in mpt_verify_mwce()
960 mpt_vol_prt(mpt, mpt_vol, "mpt_verify_mwce: " in mpt_verify_mwce()
968 mpt_vol_prt(mpt, mpt_vol, "Write Cache Enable Failed: " in mpt_verify_mwce()
975 mpt_free_request(mpt, req); in mpt_verify_mwce()
979 mpt_verify_resync_rate(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol) in mpt_verify_resync_rate() argument
989 if (mpt->raid_resync_rate == MPT_RAID_RESYNC_RATE_NC) in mpt_verify_resync_rate()
999 && vol_pg->ResyncRate != mpt->raid_resync_rate) { in mpt_verify_resync_rate()
1000 req = mpt_get_request(mpt, /*sleep_ok*/TRUE); in mpt_verify_resync_rate()
1002 mpt_vol_prt(mpt, mpt_vol, "mpt_verify_resync_rate: " in mpt_verify_resync_rate()
1007 rv = mpt_issue_raid_req(mpt, mpt_vol, /*disk*/NULL, req, in mpt_verify_resync_rate()
1009 mpt->raid_resync_rate, /*addr*/0, in mpt_verify_resync_rate()
1012 mpt_vol_prt(mpt, mpt_vol, "mpt_refresh_raid_data: " in mpt_verify_resync_rate()
1021 mpt_vol_prt(mpt, mpt_vol, "Resync Rate Setting Failed: " in mpt_verify_resync_rate()
1025 vol_pg->ResyncRate = mpt->raid_resync_rate; in mpt_verify_resync_rate()
1026 mpt_free_request(mpt, req); in mpt_verify_resync_rate()
1027 } else if ((prio && mpt->raid_resync_rate < 128) in mpt_verify_resync_rate()
1028 || (!prio && mpt->raid_resync_rate >= 128)) { in mpt_verify_resync_rate()
1031 req = mpt_get_request(mpt, /*sleep_ok*/TRUE); in mpt_verify_resync_rate()
1033 mpt_vol_prt(mpt, mpt_vol, "mpt_verify_resync_rate: " in mpt_verify_resync_rate()
1043 rv = mpt_issue_raid_req(mpt, mpt_vol, /*disk*/NULL, req, in mpt_verify_resync_rate()
1048 mpt_vol_prt(mpt, mpt_vol, "mpt_refresh_raid_data: " in mpt_verify_resync_rate()
1056 mpt_vol_prt(mpt, mpt_vol, "Resync Rate Setting Failed: " in mpt_verify_resync_rate()
1064 mpt_free_request(mpt, req); in mpt_verify_resync_rate()
1069 mpt_adjust_queue_depth(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol, in mpt_adjust_queue_depth() argument
1079 crs.openings = mpt->raid_queue_depth; in mpt_adjust_queue_depth()
1082 mpt_vol_prt(mpt, mpt_vol, "mpt_adjust_queue_depth failed " in mpt_adjust_queue_depth()
1087 mpt_announce_vol(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol) in mpt_announce_vol() argument
1093 mpt_vol_prt(mpt, mpt_vol, "Settings ("); in mpt_announce_vol()
1097 mpt_prtc(mpt, " Member-WCE"); in mpt_announce_vol()
1100 mpt_prtc(mpt, " Offline-On-SMART-Err"); in mpt_announce_vol()
1103 mpt_prtc(mpt, " Hot-Plug-Spares"); in mpt_announce_vol()
1106 mpt_prtc(mpt, " High-Priority-ReSync"); in mpt_announce_vol()
1112 mpt_prtc(mpt, " )\n"); in mpt_announce_vol()
1114 mpt_vol_prt(mpt, mpt_vol, "Using Spare Pool%s", in mpt_announce_vol()
1123 mpt_prtc(mpt, " %d", i); in mpt_announce_vol()
1125 mpt_prtc(mpt, "\n"); in mpt_announce_vol()
1127 mpt_vol_prt(mpt, mpt_vol, "%d Members:\n", vol_pg->NumPhysDisks); in mpt_announce_vol()
1131 int pt_bus = cam_sim_bus(mpt->phydisk_sim); in mpt_announce_vol()
1134 mpt_disk = mpt->raid_disks + vol_pg->PhysDisk[i].PhysDiskNum; in mpt_announce_vol()
1136 mpt_prtc(mpt, " "); in mpt_announce_vol()
1137 mpt_prtc(mpt, "(%s:%d:%d:0): ", device_get_nameunit(mpt->dev), in mpt_announce_vol()
1140 mpt_prtc(mpt, "%s", mpt_disk->member_number == 0? in mpt_announce_vol()
1143 mpt_prtc(mpt, "Stripe Position %d", in mpt_announce_vol()
1149 mpt_prtc(mpt, " Out of Sync"); in mpt_announce_vol()
1152 mpt_prtc(mpt, " Quiesced"); in mpt_announce_vol()
1155 mpt_prtc(mpt, " Inactive"); in mpt_announce_vol()
1158 mpt_prtc(mpt, " Was Optimal"); in mpt_announce_vol()
1161 mpt_prtc(mpt, " Was Non-Optimal"); in mpt_announce_vol()
1165 mpt_prtc(mpt, " Online"); in mpt_announce_vol()
1168 mpt_prtc(mpt, " Missing"); in mpt_announce_vol()
1171 mpt_prtc(mpt, " Incompatible"); in mpt_announce_vol()
1174 mpt_prtc(mpt, " Failed"); in mpt_announce_vol()
1177 mpt_prtc(mpt, " Initializing"); in mpt_announce_vol()
1180 mpt_prtc(mpt, " Requested Offline"); in mpt_announce_vol()
1183 mpt_prtc(mpt, " Requested Failed"); in mpt_announce_vol()
1187 mpt_prtc(mpt, " Offline Other (%x)", s); in mpt_announce_vol()
1190 mpt_prtc(mpt, "\n"); in mpt_announce_vol()
1195 mpt_announce_disk(struct mpt_softc *mpt, struct mpt_raid_disk *mpt_disk) in mpt_announce_disk() argument
1198 int rd_bus = cam_sim_bus(mpt->sim); in mpt_announce_disk()
1199 int pt_bus = cam_sim_bus(mpt->phydisk_sim); in mpt_announce_disk()
1203 mpt_disk_prt(mpt, mpt_disk, in mpt_announce_disk()
1205 device_get_nameunit(mpt->dev), rd_bus, in mpt_announce_disk()
1206 disk_pg->PhysDiskID, device_get_nameunit(mpt->dev), in mpt_announce_disk()
1207 pt_bus, mpt_disk - mpt->raid_disks); in mpt_announce_disk()
1210 mpt_disk_prt(mpt, mpt_disk, "Member of Hot Spare Pool%s", in mpt_announce_disk()
1219 mpt_prtc(mpt, " %d", i); in mpt_announce_disk()
1221 mpt_prtc(mpt, "\n"); in mpt_announce_disk()
1225 mpt_refresh_raid_disk(struct mpt_softc *mpt, struct mpt_raid_disk *mpt_disk, in mpt_refresh_raid_disk() argument
1230 rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_RAID_PHYSDISK, in mpt_refresh_raid_disk()
1235 mpt_prt(mpt, "mpt_refresh_raid_disk: " in mpt_refresh_raid_disk()
1240 rv = mpt_read_cur_cfg_page(mpt, ioc_disk->PhysDiskNum, in mpt_refresh_raid_disk()
1245 mpt_prt(mpt, "mpt_refresh_raid_disk: " in mpt_refresh_raid_disk()
1252 mpt_refresh_raid_vol(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol, in mpt_refresh_raid_vol() argument
1264 rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_RAID_VOLUME, 0, in mpt_refresh_raid_vol()
1267 mpt_vol_prt(mpt, mpt_vol, in mpt_refresh_raid_vol()
1273 rv = mpt_read_cur_cfg_page(mpt, ioc_vol->VolumePageNumber, in mpt_refresh_raid_vol()
1274 &vol_pg->Header, mpt->raid_page0_len, TRUE, 5000); in mpt_refresh_raid_vol()
1276 mpt_vol_prt(mpt, mpt_vol, in mpt_refresh_raid_vol()
1288 mpt_disk = mpt->raid_disks + vol_pg->PhysDisk[i].PhysDiskNum; in mpt_refresh_raid_vol()
1300 req = mpt_get_request(mpt, TRUE); in mpt_refresh_raid_vol()
1302 mpt_vol_prt(mpt, mpt_vol, in mpt_refresh_raid_vol()
1306 rv = mpt_issue_raid_req(mpt, mpt_vol, NULL, req, in mpt_refresh_raid_vol()
1309 mpt_vol_prt(mpt, mpt_vol, in mpt_refresh_raid_vol()
1311 mpt_free_request(mpt, req); in mpt_refresh_raid_vol()
1324 mpt_vol_prt(mpt, mpt_vol, in mpt_refresh_raid_vol()
1327 mpt_free_request(mpt, req); in mpt_refresh_raid_vol()
1337 mpt_refresh_raid_data(struct mpt_softc *mpt) in mpt_refresh_raid_data() argument
1349 if (mpt->ioc_page2 == NULL || mpt->ioc_page3 == NULL) { in mpt_refresh_raid_data()
1358 for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { in mpt_refresh_raid_data()
1359 mpt->raid_disks[i].flags &= ~MPT_RDF_REFERENCED; in mpt_refresh_raid_data()
1361 for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) { in mpt_refresh_raid_data()
1362 mpt->raid_volumes[i].flags &= ~MPT_RVF_REFERENCED; in mpt_refresh_raid_data()
1368 len = mpt->ioc_page3->Header.PageLength * sizeof(uint32_t); in mpt_refresh_raid_data()
1369 rv = mpt_read_cur_cfg_page(mpt, /*PageAddress*/0, in mpt_refresh_raid_data()
1370 &mpt->ioc_page3->Header, len, in mpt_refresh_raid_data()
1373 mpt_prt(mpt, in mpt_refresh_raid_data()
1377 mpt2host_config_page_ioc3(mpt->ioc_page3); in mpt_refresh_raid_data()
1379 ioc_disk = mpt->ioc_page3->PhysDisk; in mpt_refresh_raid_data()
1380 ioc_last_disk = ioc_disk + mpt->ioc_page3->NumPhysDisks; in mpt_refresh_raid_data()
1384 mpt_disk = mpt->raid_disks + ioc_disk->PhysDiskNum; in mpt_refresh_raid_data()
1388 mpt_refresh_raid_disk(mpt, mpt_disk, ioc_disk); in mpt_refresh_raid_data()
1391 mpt->raid_rescan++; in mpt_refresh_raid_data()
1397 len = mpt->ioc_page2->Header.PageLength * sizeof(uint32_t); in mpt_refresh_raid_data()
1398 rv = mpt_read_cur_cfg_page(mpt, /*PageAddress*/0, in mpt_refresh_raid_data()
1399 &mpt->ioc_page2->Header, len, in mpt_refresh_raid_data()
1402 mpt_prt(mpt, "mpt_refresh_raid_data: " in mpt_refresh_raid_data()
1406 mpt2host_config_page_ioc2(mpt->ioc_page2); in mpt_refresh_raid_data()
1408 ioc_vol = mpt->ioc_page2->RaidVolume; in mpt_refresh_raid_data()
1409 ioc_last_vol = ioc_vol + mpt->ioc_page2->NumActiveVolumes; in mpt_refresh_raid_data()
1413 mpt_vol = mpt->raid_volumes + ioc_vol->VolumePageNumber; in mpt_refresh_raid_data()
1422 mpt_refresh_raid_vol(mpt, mpt_vol, ioc_vol); in mpt_refresh_raid_data()
1428 for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) { in mpt_refresh_raid_data()
1435 mpt_vol = &mpt->raid_volumes[i]; in mpt_refresh_raid_data()
1444 mpt_vol_prt(mpt, mpt_vol, "No longer configured\n"); in mpt_refresh_raid_data()
1450 mpt_announce_vol(mpt, mpt_vol); in mpt_refresh_raid_data()
1462 mpt_vol_prt(mpt, mpt_vol, "%s - %s\n", in mpt_refresh_raid_data()
1464 mpt_verify_mwce(mpt, mpt_vol); in mpt_refresh_raid_data()
1470 mpt_vol_prt(mpt, mpt_vol, "Status ("); in mpt_refresh_raid_data()
1474 mpt_prtc(mpt, " Enabled"); in mpt_refresh_raid_data()
1477 mpt_prtc(mpt, " Quiesced"); in mpt_refresh_raid_data()
1480 mpt_prtc(mpt, " Re-Syncing"); in mpt_refresh_raid_data()
1483 mpt_prtc(mpt, " Inactive"); in mpt_refresh_raid_data()
1489 mpt_prtc(mpt, " )\n"); in mpt_refresh_raid_data()
1495 mpt_verify_resync_rate(mpt, mpt_vol); in mpt_refresh_raid_data()
1501 mpt_vol_prt(mpt, mpt_vol, "Rate %d.%d%%\n", in mpt_refresh_raid_data()
1506 mpt_vol_prt(mpt, mpt_vol, "%s Priority Re-Sync\n", in mpt_refresh_raid_data()
1509 mpt_vol_prt(mpt, mpt_vol, "%ju of %ju " in mpt_refresh_raid_data()
1514 mpt_schedule_raid_refresh(mpt); in mpt_refresh_raid_data()
1517 for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { in mpt_refresh_raid_data()
1522 mpt_disk = &mpt->raid_disks[i]; in mpt_refresh_raid_data()
1530 mpt_disk_prt(mpt, mpt_disk, "No longer configured\n"); in mpt_refresh_raid_data()
1532 mpt->raid_rescan++; in mpt_refresh_raid_data()
1537 mpt_announce_disk(mpt, mpt_disk); in mpt_refresh_raid_data()
1545 mpt_disk_prt(mpt, mpt_disk, "%s\n", mpt_disk_state(mpt_disk)); in mpt_refresh_raid_data()
1549 mpt_disk_prt(mpt, mpt_disk, "Status ("); in mpt_refresh_raid_data()
1553 mpt_prtc(mpt, " Out-Of-Sync"); in mpt_refresh_raid_data()
1556 mpt_prtc(mpt, " Quiesced"); in mpt_refresh_raid_data()
1562 mpt_prtc(mpt, " )\n"); in mpt_refresh_raid_data()
1565 mpt->raid_nonopt_volumes = nonopt_volumes; in mpt_refresh_raid_data()
1572 struct mpt_softc *mpt; in mpt_raid_timer() local
1574 mpt = (struct mpt_softc *)arg; in mpt_raid_timer()
1575 MPT_LOCK_ASSERT(mpt); in mpt_raid_timer()
1576 mpt_raid_wakeup(mpt); in mpt_raid_timer()
1580 mpt_schedule_raid_refresh(struct mpt_softc *mpt) in mpt_schedule_raid_refresh() argument
1583 callout_reset(&mpt->raid_timer, MPT_RAID_SYNC_REPORT_INTERVAL, in mpt_schedule_raid_refresh()
1584 mpt_raid_timer, mpt); in mpt_schedule_raid_refresh()
1588 mpt_raid_free_mem(struct mpt_softc *mpt) in mpt_raid_free_mem() argument
1591 if (mpt->raid_volumes) { in mpt_raid_free_mem()
1594 for (i = 0; i < mpt->raid_max_volumes; i++) { in mpt_raid_free_mem()
1595 mpt_raid = &mpt->raid_volumes[i]; in mpt_raid_free_mem()
1601 free(mpt->raid_volumes, M_DEVBUF); in mpt_raid_free_mem()
1602 mpt->raid_volumes = NULL; in mpt_raid_free_mem()
1604 if (mpt->raid_disks) { in mpt_raid_free_mem()
1605 free(mpt->raid_disks, M_DEVBUF); in mpt_raid_free_mem()
1606 mpt->raid_disks = NULL; in mpt_raid_free_mem()
1608 if (mpt->ioc_page2) { in mpt_raid_free_mem()
1609 free(mpt->ioc_page2, M_DEVBUF); in mpt_raid_free_mem()
1610 mpt->ioc_page2 = NULL; in mpt_raid_free_mem()
1612 if (mpt->ioc_page3) { in mpt_raid_free_mem()
1613 free(mpt->ioc_page3, M_DEVBUF); in mpt_raid_free_mem()
1614 mpt->ioc_page3 = NULL; in mpt_raid_free_mem()
1616 mpt->raid_max_volumes = 0; in mpt_raid_free_mem()
1617 mpt->raid_max_disks = 0; in mpt_raid_free_mem()
1621 mpt_raid_set_vol_resync_rate(struct mpt_softc *mpt, u_int rate) in mpt_raid_set_vol_resync_rate() argument
1630 MPT_LOCK(mpt); in mpt_raid_set_vol_resync_rate()
1631 mpt->raid_resync_rate = rate; in mpt_raid_set_vol_resync_rate()
1632 RAID_VOL_FOREACH(mpt, mpt_vol) { in mpt_raid_set_vol_resync_rate()
1636 mpt_verify_resync_rate(mpt, mpt_vol); in mpt_raid_set_vol_resync_rate()
1638 MPT_UNLOCK(mpt); in mpt_raid_set_vol_resync_rate()
1643 mpt_raid_set_vol_queue_depth(struct mpt_softc *mpt, u_int vol_queue_depth) in mpt_raid_set_vol_queue_depth() argument
1650 MPT_LOCK(mpt); in mpt_raid_set_vol_queue_depth()
1651 mpt->raid_queue_depth = vol_queue_depth; in mpt_raid_set_vol_queue_depth()
1652 RAID_VOL_FOREACH(mpt, mpt_vol) { in mpt_raid_set_vol_queue_depth()
1659 mpt->raid_rescan = 0; in mpt_raid_set_vol_queue_depth()
1662 cam_sim_path(mpt->sim), in mpt_raid_set_vol_queue_depth()
1666 mpt_vol_prt(mpt, mpt_vol, "Unable to allocate path!\n"); in mpt_raid_set_vol_queue_depth()
1669 mpt_adjust_queue_depth(mpt, mpt_vol, path); in mpt_raid_set_vol_queue_depth()
1672 MPT_UNLOCK(mpt); in mpt_raid_set_vol_queue_depth()
1677 mpt_raid_set_vol_mwce(struct mpt_softc *mpt, mpt_raid_mwce_t mwce) in mpt_raid_set_vol_mwce() argument
1682 MPT_LOCK(mpt); in mpt_raid_set_vol_mwce()
1683 if (mwce == mpt->raid_mwce_setting) { in mpt_raid_set_vol_mwce()
1684 MPT_UNLOCK(mpt); in mpt_raid_set_vol_mwce()
1695 if (mpt->raid_mwce_set == 0 in mpt_raid_set_vol_mwce()
1696 && mpt->raid_mwce_setting == MPT_RAID_MWCE_NC in mpt_raid_set_vol_mwce()
1700 mpt->raid_mwce_setting = mwce; in mpt_raid_set_vol_mwce()
1701 RAID_VOL_FOREACH(mpt, mpt_vol) { in mpt_raid_set_vol_mwce()
1720 mpt_vol_prt(mpt, mpt_vol, "WARNING - Unsafe shutdown " in mpt_raid_set_vol_mwce()
1723 mpt_verify_mwce(mpt, mpt_vol); in mpt_raid_set_vol_mwce()
1725 mpt->raid_mwce_set = 1; in mpt_raid_set_vol_mwce()
1726 MPT_UNLOCK(mpt); in mpt_raid_set_vol_mwce()
1742 struct mpt_softc *mpt; in mpt_raid_sysctl_vol_member_wce() local
1748 mpt = (struct mpt_softc *)arg1; in mpt_raid_sysctl_vol_member_wce()
1749 str = mpt_vol_mwce_strs[mpt->raid_mwce_setting]; in mpt_raid_sysctl_vol_member_wce()
1767 return (mpt_raid_set_vol_mwce(mpt, i)); in mpt_raid_sysctl_vol_member_wce()
1776 struct mpt_softc *mpt; in mpt_raid_sysctl_vol_resync_rate() local
1780 mpt = (struct mpt_softc *)arg1; in mpt_raid_sysctl_vol_resync_rate()
1781 raid_resync_rate = mpt->raid_resync_rate; in mpt_raid_sysctl_vol_resync_rate()
1788 return (mpt_raid_set_vol_resync_rate(mpt, raid_resync_rate)); in mpt_raid_sysctl_vol_resync_rate()
1794 struct mpt_softc *mpt; in mpt_raid_sysctl_vol_queue_depth() local
1798 mpt = (struct mpt_softc *)arg1; in mpt_raid_sysctl_vol_queue_depth()
1799 raid_queue_depth = mpt->raid_queue_depth; in mpt_raid_sysctl_vol_queue_depth()
1806 return (mpt_raid_set_vol_queue_depth(mpt, raid_queue_depth)); in mpt_raid_sysctl_vol_queue_depth()
1810 mpt_raid_sysctl_attach(struct mpt_softc *mpt) in mpt_raid_sysctl_attach() argument
1812 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(mpt->dev); in mpt_raid_sysctl_attach()
1813 struct sysctl_oid *tree = device_get_sysctl_tree(mpt->dev); in mpt_raid_sysctl_attach()
1817 mpt, 0, mpt_raid_sysctl_vol_member_wce, "A", in mpt_raid_sysctl_attach()
1822 mpt, 0, mpt_raid_sysctl_vol_queue_depth, "I", in mpt_raid_sysctl_attach()
1827 mpt, 0, mpt_raid_sysctl_vol_resync_rate, "I", in mpt_raid_sysctl_attach()
1831 &mpt->raid_nonopt_volumes, 0, in mpt_raid_sysctl_attach()