Lines Matching +full:refresh +full:- +full:rate +full:- +full:hz

1 /*-
4 * SPDX-License-Identifier: BSD-3-Clause
36 /*-
41 * Support from LSI-Logic has also gone a great deal toward making this a
74 (((MSG_RAID_ACTION_REQUEST *)(req->req_vbuf)) + 1))
76 #define REQ_IOCSTATUS(req) ((req)->IOCStatus & MPI_IOCSTATUS_MASK)
138 switch (vol->config_page->VolumeType) { in mpt_vol_type()
140 return ("RAID-0"); in mpt_vol_type()
142 return ("RAID-1E"); in mpt_vol_type()
144 return ("RAID-1"); in mpt_vol_type()
153 switch (vol->config_page->VolumeStatus.State) { in mpt_vol_state()
168 switch (disk->config_page.PhysDiskStatus.State) { in mpt_disk_state()
196 printf("%s:vol%d(%s:%d:%d): ", device_get_nameunit(mpt->dev), in mpt_vol_prt()
197 (u_int)(vol - mpt->raid_volumes), device_get_nameunit(mpt->dev), in mpt_vol_prt()
198 vol->config_page->VolumeBus, vol->config_page->VolumeID); in mpt_vol_prt()
210 if (disk->volume != NULL) { in mpt_disk_prt()
212 device_get_nameunit(mpt->dev), in mpt_disk_prt()
213 disk->volume->config_page->VolumeID, in mpt_disk_prt()
214 disk->member_number); in mpt_disk_prt()
216 printf("(%s:%d:%d): ", device_get_nameunit(mpt->dev), in mpt_disk_prt()
217 disk->config_page.PhysDiskBus, in mpt_disk_prt()
218 disk->config_page.PhysDiskID); in mpt_disk_prt()
244 cgd->ccb_h.target_id); in mpt_raid_async()
247 if ((mpt_vol->flags & MPT_RVF_ACTIVE) == 0) in mpt_raid_async()
250 if (mpt_vol->config_page->VolumeID in mpt_raid_async()
251 == cgd->ccb_h.target_id) { in mpt_raid_async()
266 if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) { in mpt_raid_probe()
279 mpt_callout_init(mpt, &mpt->raid_timer); in mpt_raid_attach()
297 xpt_setup_ccb(&csa.ccb_h, mpt->path, 5); in mpt_raid_attach()
330 mpt_callout_drain(mpt, &mpt->raid_timer); in mpt_raid_detach()
338 xpt_setup_ccb(&csa.ccb_h, mpt->path, /*priority*/5); in mpt_raid_detach()
381 if (msg->Event != MPI_EVENT_INTEGRATED_RAID) { in mpt_raid_event()
385 raid_event = (EVENT_DATA_RAID *)&msg->Data; in mpt_raid_event()
389 if (mpt->raid_volumes != NULL && mpt->ioc_page2 != NULL) { in mpt_raid_event()
390 for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) { in mpt_raid_event()
391 mpt_vol = &mpt->raid_volumes[i]; in mpt_raid_event()
392 vol_pg = mpt_vol->config_page; in mpt_raid_event()
394 if ((mpt_vol->flags & MPT_RVF_ACTIVE) == 0) in mpt_raid_event()
397 if (vol_pg->VolumeID == raid_event->VolumeID in mpt_raid_event()
398 && vol_pg->VolumeBus == raid_event->VolumeBus) in mpt_raid_event()
401 if (i >= mpt->ioc_page2->MaxVolumes) { in mpt_raid_event()
408 if (raid_event->PhysDiskNum != 0xFF && mpt->raid_disks != NULL) { in mpt_raid_event()
409 mpt_disk = mpt->raid_disks + raid_event->PhysDiskNum; in mpt_raid_event()
410 if ((mpt_disk->flags & MPT_RDF_ACTIVE) == 0) { in mpt_raid_event()
416 switch(raid_event->ReasonCode) { in mpt_raid_event()
422 if ((mpt_vol->flags & MPT_RVF_UP2DATE) != 0) { in mpt_raid_event()
423 mpt_vol->flags &= ~MPT_RVF_UP2DATE; in mpt_raid_event()
437 mpt->raid_rescan++; in mpt_raid_event()
439 mpt_vol->flags &= ~(MPT_RVF_UP2DATE|MPT_RVF_ANNOUNCED); in mpt_raid_event()
444 mpt->raid_rescan++; in mpt_raid_event()
448 mpt->raid_rescan++; in mpt_raid_event()
450 mpt_disk->flags &= ~MPT_RDF_UP2DATE; in mpt_raid_event()
454 mpt->raid_rescan++; in mpt_raid_event()
467 mpt_prt(mpt, "Volume(%d:%d", raid_event->VolumeBus, in mpt_raid_event()
468 raid_event->VolumeID); in mpt_raid_event()
470 if (raid_event->PhysDiskNum != 0xFF) in mpt_raid_event()
472 raid_event->PhysDiskNum); in mpt_raid_event()
477 if (raid_event->ReasonCode >= NUM_ELEMENTS(raid_event_txt)) in mpt_raid_event()
479 raid_event->ReasonCode); in mpt_raid_event()
482 raid_event_txt[raid_event->ReasonCode]); in mpt_raid_event()
485 if (raid_event->ReasonCode == MPI_EVENT_RAID_RC_SMART_DATA) { in mpt_raid_event()
491 raid_event->VolumeBus, raid_event->VolumeID, in mpt_raid_event()
492 raid_event->PhysDiskNum); in mpt_raid_event()
494 raid_event->ASC, raid_event->ASCQ); in mpt_raid_event()
506 if (mpt->raid_mwce_setting != MPT_RAID_MWCE_REBUILD_ONLY) { in mpt_raid_shutdown()
510 mpt->raid_mwce_setting = MPT_RAID_MWCE_OFF; in mpt_raid_shutdown()
529 else if (req->ccb != NULL) { in mpt_raid_reply_handler()
534 req->state &= ~REQ_STATE_QUEUED; in mpt_raid_reply_handler()
535 req->state |= REQ_STATE_DONE; in mpt_raid_reply_handler()
536 TAILQ_REMOVE(&mpt->request_pending_list, req, links); in mpt_raid_reply_handler()
538 if ((req->state & REQ_STATE_NEED_WAKEUP) != 0) { in mpt_raid_reply_handler()
560 req->IOCStatus = le16toh(reply->IOCStatus); in mpt_raid_reply_frame_handler()
561 rap = (MSG_RAID_ACTION_REQUEST *)req->req_vbuf; in mpt_raid_reply_frame_handler()
563 switch (rap->Action) { in mpt_raid_reply_frame_handler()
574 memcpy(&action_result->action_data, &reply->ActionData, in mpt_raid_reply_frame_handler()
575 sizeof(action_result->action_data)); in mpt_raid_reply_frame_handler()
576 action_result->action_status = le16toh(reply->ActionStatus); in mpt_raid_reply_frame_handler()
592 rap = req->req_vbuf; in mpt_issue_raid_req()
594 rap->Action = Action; in mpt_issue_raid_req()
595 rap->ActionDataWord = htole32(ActionDataWord); in mpt_issue_raid_req()
596 rap->Function = MPI_FUNCTION_RAID_ACTION; in mpt_issue_raid_req()
597 rap->VolumeID = vol->config_page->VolumeID; in mpt_issue_raid_req()
598 rap->VolumeBus = vol->config_page->VolumeBus; in mpt_issue_raid_req()
600 rap->PhysDiskNum = disk->config_page.PhysDiskNum; in mpt_issue_raid_req()
602 rap->PhysDiskNum = 0xFF; in mpt_issue_raid_req()
603 se = (SGE_SIMPLE32 *)&rap->ActionDataSGE; in mpt_issue_raid_req()
604 se->Address = htole32(addr); in mpt_issue_raid_req()
610 se->FlagsLength = htole32(se->FlagsLength); in mpt_issue_raid_req()
611 rap->MsgContext = htole32(req->index | raid_handler_id); in mpt_issue_raid_req()
638 xpt_freeze_simq(mpt->phydisk_sim, 1); in mpt_spawn_raid_thread()
641 &mpt->raid_thread, /*flags*/0, /*altstack*/0, in mpt_spawn_raid_thread()
642 "mpt_raid%d", mpt->unit); in mpt_spawn_raid_thread()
645 xpt_release_simq(mpt->phydisk_sim, /*run_queue*/FALSE); in mpt_spawn_raid_thread()
655 if (mpt->raid_thread == NULL) { in mpt_terminate_raid_thread()
658 mpt->shutdwn_raid = 1; in mpt_terminate_raid_thread()
659 wakeup(&mpt->raid_volumes); in mpt_terminate_raid_thread()
664 mpt_sleep(mpt, &mpt->raid_thread, PUSER, "thtrm", 0); in mpt_terminate_raid_thread()
676 while (mpt->shutdwn_raid == 0) { in mpt_raid_thread()
677 if (mpt->raid_wakeup == 0) { in mpt_raid_thread()
678 mpt_sleep(mpt, &mpt->raid_volumes, PUSER, "idle", 0); in mpt_raid_thread()
682 mpt->raid_wakeup = 0; in mpt_raid_thread()
695 xpt_release_simq(mpt->phydisk_sim, TRUE); in mpt_raid_thread()
698 if (mpt->raid_rescan != 0) { in mpt_raid_thread()
702 mpt->raid_rescan = 0; in mpt_raid_thread()
708 error = xpt_create_path(&ccb->ccb_h.path, NULL, in mpt_raid_thread()
709 cam_sim_path(mpt->phydisk_sim), in mpt_raid_thread()
719 mpt->raid_thread = NULL; in mpt_raid_thread()
720 wakeup(&mpt->raid_thread); in mpt_raid_thread()
741 ccb = req->ccb;
742 if ((mpt_disk->flags & MPT_RDF_QUIESCED) != 0)
745 if ((mpt_disk->flags & MPT_RDF_QUIESCING) == 0) {
748 mpt_disk->flags |= MPT_RDF_QUIESCING;
749 xpt_freeze_devq(ccb->ccb_h.path, 1);
751 rv = mpt_issue_raid_req(mpt, mpt_disk->volume, mpt_disk, req,
759 mpt_req_timeout(req, mpt_raid_quiesce_timeout, ccb, 5 * hz);
763 "Quiece Timed-out\n");
764 xpt_release_devq(ccb->ccb_h.path, 1, /*run*/0);
771 || (ar->action_status != MPI_RAID_ACTION_ASTATUS_SUCCESS)) {
773 "%d:%x:%x\n", rv, req->IOCStatus,
774 ar->action_status);
775 xpt_release_devq(ccb->ccb_h.path, 1, /*run*/0);
791 mpt_disk = mpt->raid_disks + ccb->ccb_h.target_id; in mpt_map_physdisk()
792 if (ccb->ccb_h.target_id < mpt->raid_max_disks in mpt_map_physdisk()
793 && (mpt_disk->flags & MPT_RDF_ACTIVE) != 0) { in mpt_map_physdisk()
794 *tgt = mpt_disk->config_page.PhysDiskID; in mpt_map_physdisk()
797 mpt_lprt(mpt, MPT_PRT_DEBUG1, "mpt_map_physdisk(%d) - Not Active\n", in mpt_map_physdisk()
798 ccb->ccb_h.target_id); in mpt_map_physdisk()
799 return (-1); in mpt_map_physdisk()
809 if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) in mpt_is_raid_member()
811 for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { in mpt_is_raid_member()
812 mpt_disk = &mpt->raid_disks[i]; in mpt_is_raid_member()
813 if ((mpt_disk->flags & MPT_RDF_ACTIVE) != 0 && in mpt_is_raid_member()
814 mpt_disk->config_page.PhysDiskID == tgt) in mpt_is_raid_member()
828 if (mpt->ioc_page2 == NULL || mpt->ioc_page2->MaxPhysDisks == 0) { in mpt_is_raid_volume()
831 ioc_vol = mpt->ioc_page2->RaidVolume; in mpt_is_raid_volume()
832 ioc_last_vol = ioc_vol + mpt->ioc_page2->NumActiveVolumes; in mpt_is_raid_volume()
834 if (ioc_vol->VolumeID == tgt) { in mpt_is_raid_volume()
852 vol_pg = mpt_vol->config_page;
853 enabled = vol_pg->VolumeStatus.Flags & MPI_RAIDVOL0_STATUS_FLAG_ENABLED;
877 "%s Volume Timed-out\n",
884 || (ar->action_status != MPI_RAID_ACTION_ASTATUS_SUCCESS)) {
887 rv, req->IOCStatus, ar->action_status);
905 vol_pg = mpt_vol->config_page; in mpt_verify_mwce()
906 resyncing = vol_pg->VolumeStatus.Flags in mpt_verify_mwce()
908 mwce = vol_pg->VolumeSettings.Settings in mpt_verify_mwce()
915 switch (mpt->raid_mwce_setting) { in mpt_verify_mwce()
920 mpt_vol->flags ^= MPT_RVF_WCE_CHANGED; in mpt_verify_mwce()
921 if ((mpt_vol->flags & MPT_RVF_WCE_CHANGED) == 0) { in mpt_verify_mwce()
949 vol_pg->VolumeSettings.Settings ^= in mpt_verify_mwce()
951 memcpy(&data, &vol_pg->VolumeSettings, sizeof(data)); in mpt_verify_mwce()
952 vol_pg->VolumeSettings.Settings ^= in mpt_verify_mwce()
960 "Write Cache Enable Timed-out\n"); in mpt_verify_mwce()
966 || (ar->action_status != MPI_RAID_ACTION_ASTATUS_SUCCESS)) { in mpt_verify_mwce()
968 "%d:%x:%x\n", rv, req->IOCStatus, in mpt_verify_mwce()
969 ar->action_status); in mpt_verify_mwce()
971 vol_pg->VolumeSettings.Settings ^= in mpt_verify_mwce()
986 vol_pg = mpt_vol->config_page; in mpt_verify_resync_rate()
988 if (mpt->raid_resync_rate == MPT_RAID_RESYNC_RATE_NC) in mpt_verify_resync_rate()
992 * If the current RAID resync rate does not in mpt_verify_resync_rate()
993 * match our configured rate, update it. in mpt_verify_resync_rate()
995 prio = vol_pg->VolumeSettings.Settings in mpt_verify_resync_rate()
997 if (vol_pg->ResyncRate != 0 in mpt_verify_resync_rate()
998 && vol_pg->ResyncRate != mpt->raid_resync_rate) { in mpt_verify_resync_rate()
1008 mpt->raid_resync_rate, /*addr*/0, in mpt_verify_resync_rate()
1012 "Resync Rate Setting Timed-out\n"); in mpt_verify_resync_rate()
1019 || (ar->action_status != MPI_RAID_ACTION_ASTATUS_SUCCESS)) { in mpt_verify_resync_rate()
1020 mpt_vol_prt(mpt, mpt_vol, "Resync Rate Setting Failed: " in mpt_verify_resync_rate()
1021 "%d:%x:%x\n", rv, req->IOCStatus, in mpt_verify_resync_rate()
1022 ar->action_status); in mpt_verify_resync_rate()
1024 vol_pg->ResyncRate = mpt->raid_resync_rate; in mpt_verify_resync_rate()
1026 } else if ((prio && mpt->raid_resync_rate < 128) in mpt_verify_resync_rate()
1027 || (!prio && mpt->raid_resync_rate >= 128)) { in mpt_verify_resync_rate()
1037 vol_pg->VolumeSettings.Settings ^= in mpt_verify_resync_rate()
1039 memcpy(&data, &vol_pg->VolumeSettings, sizeof(data)); in mpt_verify_resync_rate()
1040 vol_pg->VolumeSettings.Settings ^= in mpt_verify_resync_rate()
1048 "Resync Rate Setting Timed-out\n"); in mpt_verify_resync_rate()
1054 || (ar->action_status != MPI_RAID_ACTION_ASTATUS_SUCCESS)) { in mpt_verify_resync_rate()
1055 mpt_vol_prt(mpt, mpt_vol, "Resync Rate Setting Failed: " in mpt_verify_resync_rate()
1056 "%d:%x:%x\n", rv, req->IOCStatus, in mpt_verify_resync_rate()
1057 ar->action_status); in mpt_verify_resync_rate()
1059 vol_pg->VolumeSettings.Settings ^= in mpt_verify_resync_rate()
1078 crs.openings = mpt->raid_queue_depth; in mpt_adjust_queue_depth()
1091 vol_pg = mpt_vol->config_page; in mpt_announce_vol()
1094 switch (vol_pg->VolumeSettings.Settings & i) { in mpt_announce_vol()
1096 mpt_prtc(mpt, " Member-WCE"); in mpt_announce_vol()
1099 mpt_prtc(mpt, " Offline-On-SMART-Err"); in mpt_announce_vol()
1102 mpt_prtc(mpt, " Hot-Plug-Spares"); in mpt_announce_vol()
1105 mpt_prtc(mpt, " High-Priority-ReSync"); in mpt_announce_vol()
1112 if (vol_pg->VolumeSettings.HotSparePool != 0) { in mpt_announce_vol()
1114 powerof2(vol_pg->VolumeSettings.HotSparePool) in mpt_announce_vol()
1120 if ((vol_pg->VolumeSettings.HotSparePool & mask) == 0) in mpt_announce_vol()
1126 mpt_vol_prt(mpt, mpt_vol, "%d Members:\n", vol_pg->NumPhysDisks); in mpt_announce_vol()
1127 for (i = 0; i < vol_pg->NumPhysDisks; i++){ in mpt_announce_vol()
1130 int pt_bus = cam_sim_bus(mpt->phydisk_sim); in mpt_announce_vol()
1133 mpt_disk = mpt->raid_disks + vol_pg->PhysDisk[i].PhysDiskNum; in mpt_announce_vol()
1134 disk_pg = &mpt_disk->config_page; in mpt_announce_vol()
1136 mpt_prtc(mpt, "(%s:%d:%d:0): ", device_get_nameunit(mpt->dev), in mpt_announce_vol()
1137 pt_bus, disk_pg->PhysDiskID); in mpt_announce_vol()
1138 if (vol_pg->VolumeType == MPI_RAID_VOL_TYPE_IM) { in mpt_announce_vol()
1139 mpt_prtc(mpt, "%s", mpt_disk->member_number == 0? in mpt_announce_vol()
1143 mpt_disk->member_number); in mpt_announce_vol()
1145 f = disk_pg->PhysDiskStatus.Flags; in mpt_announce_vol()
1146 s = disk_pg->PhysDiskStatus.State; in mpt_announce_vol()
1160 mpt_prtc(mpt, " Was Non-Optimal"); in mpt_announce_vol()
1197 int rd_bus = cam_sim_bus(mpt->sim); in mpt_announce_disk()
1198 int pt_bus = cam_sim_bus(mpt->phydisk_sim); in mpt_announce_disk()
1201 disk_pg = &mpt_disk->config_page; in mpt_announce_disk()
1203 "Physical (%s:%d:%d:0), Pass-thru (%s:%d:%d:0)\n", in mpt_announce_disk()
1204 device_get_nameunit(mpt->dev), rd_bus, in mpt_announce_disk()
1205 disk_pg->PhysDiskID, device_get_nameunit(mpt->dev), in mpt_announce_disk()
1206 pt_bus, mpt_disk - mpt->raid_disks); in mpt_announce_disk()
1207 if (disk_pg->PhysDiskSettings.HotSparePool == 0) in mpt_announce_disk()
1210 powerof2(disk_pg->PhysDiskSettings.HotSparePool) in mpt_announce_disk()
1216 if ((disk_pg->PhysDiskSettings.HotSparePool & mask) == 0) in mpt_announce_disk()
1230 /*PageNumber*/0, ioc_disk->PhysDiskNum, in mpt_refresh_raid_disk()
1231 &mpt_disk->config_page.Header, in mpt_refresh_raid_disk()
1236 ioc_disk->PhysDiskNum); in mpt_refresh_raid_disk()
1239 rv = mpt_read_cur_cfg_page(mpt, ioc_disk->PhysDiskNum, in mpt_refresh_raid_disk()
1240 &mpt_disk->config_page.Header, in mpt_refresh_raid_disk()
1241 sizeof(mpt_disk->config_page), in mpt_refresh_raid_disk()
1246 ioc_disk->PhysDiskNum); in mpt_refresh_raid_disk()
1247 mpt2host_config_page_raid_phys_disk_0(&mpt_disk->config_page); in mpt_refresh_raid_disk()
1260 vol_pg = mpt_vol->config_page; in mpt_refresh_raid_vol()
1261 mpt_vol->flags &= ~MPT_RVF_UP2DATE; in mpt_refresh_raid_vol()
1264 ioc_vol->VolumePageNumber, &vol_pg->Header, TRUE, 5000); in mpt_refresh_raid_vol()
1268 ioc_vol->VolumePageNumber); in mpt_refresh_raid_vol()
1272 rv = mpt_read_cur_cfg_page(mpt, ioc_vol->VolumePageNumber, in mpt_refresh_raid_vol()
1273 &vol_pg->Header, mpt->raid_page0_len, TRUE, 5000); in mpt_refresh_raid_vol()
1277 ioc_vol->VolumePageNumber); in mpt_refresh_raid_vol()
1282 mpt_vol->flags |= MPT_RVF_ACTIVE; in mpt_refresh_raid_vol()
1285 for (i = 0; i < vol_pg->NumPhysDisks; i++) { in mpt_refresh_raid_vol()
1287 mpt_disk = mpt->raid_disks + vol_pg->PhysDisk[i].PhysDiskNum; in mpt_refresh_raid_vol()
1288 mpt_disk->volume = mpt_vol; in mpt_refresh_raid_vol()
1289 mpt_disk->member_number = vol_pg->PhysDisk[i].PhysDiskMap; in mpt_refresh_raid_vol()
1290 if (vol_pg->VolumeType == MPI_RAID_VOL_TYPE_IM) { in mpt_refresh_raid_vol()
1291 mpt_disk->member_number--; in mpt_refresh_raid_vol()
1295 if ((vol_pg->VolumeStatus.Flags in mpt_refresh_raid_vol()
1316 && ar->action_status == MPI_RAID_ACTION_ASTATUS_SUCCESS in mpt_refresh_raid_vol()
1318 memcpy(&mpt_vol->sync_progress, in mpt_refresh_raid_vol()
1319 &ar->action_data.indicator_struct, in mpt_refresh_raid_vol()
1320 sizeof(mpt_vol->sync_progress)); in mpt_refresh_raid_vol()
1321 mpt2host_mpi_raid_vol_indicator(&mpt_vol->sync_progress); in mpt_refresh_raid_vol()
1330 * Update in-core information about RAID support. We update any entries
1348 if (mpt->ioc_page2 == NULL || mpt->ioc_page3 == NULL) { in mpt_refresh_raid_data()
1357 for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { in mpt_refresh_raid_data()
1358 mpt->raid_disks[i].flags &= ~MPT_RDF_REFERENCED; in mpt_refresh_raid_data()
1360 for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) { in mpt_refresh_raid_data()
1361 mpt->raid_volumes[i].flags &= ~MPT_RVF_REFERENCED; in mpt_refresh_raid_data()
1367 len = mpt->ioc_page3->Header.PageLength * sizeof(uint32_t); in mpt_refresh_raid_data()
1369 &mpt->ioc_page3->Header, len, in mpt_refresh_raid_data()
1374 return (-1); in mpt_refresh_raid_data()
1376 mpt2host_config_page_ioc3(mpt->ioc_page3); in mpt_refresh_raid_data()
1378 ioc_disk = mpt->ioc_page3->PhysDisk; in mpt_refresh_raid_data()
1379 ioc_last_disk = ioc_disk + mpt->ioc_page3->NumPhysDisks; in mpt_refresh_raid_data()
1383 mpt_disk = mpt->raid_disks + ioc_disk->PhysDiskNum; in mpt_refresh_raid_data()
1384 mpt_disk->flags |= MPT_RDF_REFERENCED; in mpt_refresh_raid_data()
1385 if ((mpt_disk->flags & (MPT_RDF_ACTIVE|MPT_RDF_UP2DATE)) in mpt_refresh_raid_data()
1389 mpt_disk->flags |= MPT_RDF_ACTIVE; in mpt_refresh_raid_data()
1390 mpt->raid_rescan++; in mpt_refresh_raid_data()
1394 * Refresh volume data. in mpt_refresh_raid_data()
1396 len = mpt->ioc_page2->Header.PageLength * sizeof(uint32_t); in mpt_refresh_raid_data()
1398 &mpt->ioc_page2->Header, len, in mpt_refresh_raid_data()
1403 return (-1); in mpt_refresh_raid_data()
1405 mpt2host_config_page_ioc2(mpt->ioc_page2); in mpt_refresh_raid_data()
1407 ioc_vol = mpt->ioc_page2->RaidVolume; in mpt_refresh_raid_data()
1408 ioc_last_vol = ioc_vol + mpt->ioc_page2->NumActiveVolumes; in mpt_refresh_raid_data()
1412 mpt_vol = mpt->raid_volumes + ioc_vol->VolumePageNumber; in mpt_refresh_raid_data()
1413 mpt_vol->flags |= MPT_RVF_REFERENCED; in mpt_refresh_raid_data()
1414 vol_pg = mpt_vol->config_page; in mpt_refresh_raid_data()
1417 if (((mpt_vol->flags & (MPT_RVF_ACTIVE|MPT_RVF_UP2DATE)) in mpt_refresh_raid_data()
1419 || (vol_pg->VolumeStatus.Flags in mpt_refresh_raid_data()
1423 mpt_vol->flags |= MPT_RVF_ACTIVE; in mpt_refresh_raid_data()
1427 for (i = 0; i < mpt->ioc_page2->MaxVolumes; i++) { in mpt_refresh_raid_data()
1434 mpt_vol = &mpt->raid_volumes[i]; in mpt_refresh_raid_data()
1436 if ((mpt_vol->flags & MPT_RVF_ACTIVE) == 0) { in mpt_refresh_raid_data()
1440 vol_pg = mpt_vol->config_page; in mpt_refresh_raid_data()
1441 if ((mpt_vol->flags & (MPT_RVF_REFERENCED|MPT_RVF_ANNOUNCED)) in mpt_refresh_raid_data()
1444 mpt_vol->flags = 0; in mpt_refresh_raid_data()
1448 if ((mpt_vol->flags & MPT_RVF_ANNOUNCED) == 0) { in mpt_refresh_raid_data()
1450 mpt_vol->flags |= MPT_RVF_ANNOUNCED; in mpt_refresh_raid_data()
1453 if (vol_pg->VolumeStatus.State != in mpt_refresh_raid_data()
1457 if ((mpt_vol->flags & MPT_RVF_UP2DATE) != 0) in mpt_refresh_raid_data()
1460 mpt_vol->flags |= MPT_RVF_UP2DATE; in mpt_refresh_raid_data()
1461 mpt_vol_prt(mpt, mpt_vol, "%s - %s\n", in mpt_refresh_raid_data()
1465 if (vol_pg->VolumeStatus.Flags == 0) { in mpt_refresh_raid_data()
1471 switch (vol_pg->VolumeStatus.Flags & m) { in mpt_refresh_raid_data()
1479 mpt_prtc(mpt, " Re-Syncing"); in mpt_refresh_raid_data()
1490 if ((vol_pg->VolumeStatus.Flags in mpt_refresh_raid_data()
1496 left = MPT_U64_2_SCALAR(mpt_vol->sync_progress.BlocksRemaining); in mpt_refresh_raid_data()
1497 total = MPT_U64_2_SCALAR(mpt_vol->sync_progress.TotalBlocks); in mpt_refresh_raid_data()
1498 if (vol_pg->ResyncRate != 0) { in mpt_refresh_raid_data()
1499 prio = ((u_int)vol_pg->ResyncRate * 100000) / 0xFF; in mpt_refresh_raid_data()
1500 mpt_vol_prt(mpt, mpt_vol, "Rate %d.%d%%\n", in mpt_refresh_raid_data()
1503 prio = vol_pg->VolumeSettings.Settings in mpt_refresh_raid_data()
1505 mpt_vol_prt(mpt, mpt_vol, "%s Priority Re-Sync\n", in mpt_refresh_raid_data()
1516 for (i = 0; i < mpt->ioc_page2->MaxPhysDisks; i++) { in mpt_refresh_raid_data()
1521 mpt_disk = &mpt->raid_disks[i]; in mpt_refresh_raid_data()
1522 disk_pg = &mpt_disk->config_page; in mpt_refresh_raid_data()
1524 if ((mpt_disk->flags & MPT_RDF_ACTIVE) == 0) in mpt_refresh_raid_data()
1527 if ((mpt_disk->flags & (MPT_RDF_REFERENCED|MPT_RDF_ANNOUNCED)) in mpt_refresh_raid_data()
1530 mpt_disk->flags = 0; in mpt_refresh_raid_data()
1531 mpt->raid_rescan++; in mpt_refresh_raid_data()
1535 if ((mpt_disk->flags & MPT_RDF_ANNOUNCED) == 0) { in mpt_refresh_raid_data()
1537 mpt_disk->flags |= MPT_RVF_ANNOUNCED; in mpt_refresh_raid_data()
1540 if ((mpt_disk->flags & MPT_RDF_UP2DATE) != 0) in mpt_refresh_raid_data()
1543 mpt_disk->flags |= MPT_RDF_UP2DATE; in mpt_refresh_raid_data()
1545 if (disk_pg->PhysDiskStatus.Flags == 0) in mpt_refresh_raid_data()
1550 switch (disk_pg->PhysDiskStatus.Flags & m) { in mpt_refresh_raid_data()
1552 mpt_prtc(mpt, " Out-Of-Sync"); in mpt_refresh_raid_data()
1564 mpt->raid_nonopt_volumes = nonopt_volumes; in mpt_refresh_raid_data()
1582 callout_reset(&mpt->raid_timer, MPT_RAID_SYNC_REPORT_INTERVAL, in mpt_schedule_raid_refresh()
1590 if (mpt->raid_volumes) { in mpt_raid_free_mem()
1593 for (i = 0; i < mpt->raid_max_volumes; i++) { in mpt_raid_free_mem()
1594 mpt_raid = &mpt->raid_volumes[i]; in mpt_raid_free_mem()
1595 if (mpt_raid->config_page) { in mpt_raid_free_mem()
1596 free(mpt_raid->config_page, M_DEVBUF); in mpt_raid_free_mem()
1597 mpt_raid->config_page = NULL; in mpt_raid_free_mem()
1600 free(mpt->raid_volumes, M_DEVBUF); in mpt_raid_free_mem()
1601 mpt->raid_volumes = NULL; in mpt_raid_free_mem()
1603 if (mpt->raid_disks) { in mpt_raid_free_mem()
1604 free(mpt->raid_disks, M_DEVBUF); in mpt_raid_free_mem()
1605 mpt->raid_disks = NULL; in mpt_raid_free_mem()
1607 if (mpt->ioc_page2) { in mpt_raid_free_mem()
1608 free(mpt->ioc_page2, M_DEVBUF); in mpt_raid_free_mem()
1609 mpt->ioc_page2 = NULL; in mpt_raid_free_mem()
1611 if (mpt->ioc_page3) { in mpt_raid_free_mem()
1612 free(mpt->ioc_page3, M_DEVBUF); in mpt_raid_free_mem()
1613 mpt->ioc_page3 = NULL; in mpt_raid_free_mem()
1615 mpt->raid_max_volumes = 0; in mpt_raid_free_mem()
1616 mpt->raid_max_disks = 0; in mpt_raid_free_mem()
1620 mpt_raid_set_vol_resync_rate(struct mpt_softc *mpt, u_int rate) in mpt_raid_set_vol_resync_rate() argument
1624 if ((rate > MPT_RAID_RESYNC_RATE_MAX in mpt_raid_set_vol_resync_rate()
1625 || rate < MPT_RAID_RESYNC_RATE_MIN) in mpt_raid_set_vol_resync_rate()
1626 && rate != MPT_RAID_RESYNC_RATE_NC) in mpt_raid_set_vol_resync_rate()
1630 mpt->raid_resync_rate = rate; in mpt_raid_set_vol_resync_rate()
1632 if ((mpt_vol->flags & MPT_RVF_ACTIVE) == 0) { in mpt_raid_set_vol_resync_rate()
1650 mpt->raid_queue_depth = vol_queue_depth; in mpt_raid_set_vol_queue_depth()
1655 if ((mpt_vol->flags & MPT_RVF_ACTIVE) == 0) in mpt_raid_set_vol_queue_depth()
1658 mpt->raid_rescan = 0; in mpt_raid_set_vol_queue_depth()
1661 cam_sim_path(mpt->sim), in mpt_raid_set_vol_queue_depth()
1662 mpt_vol->config_page->VolumeID, in mpt_raid_set_vol_queue_depth()
1682 if (mwce == mpt->raid_mwce_setting) { in mpt_raid_set_vol_mwce()
1694 if (mpt->raid_mwce_set == 0 in mpt_raid_set_vol_mwce()
1695 && mpt->raid_mwce_setting == MPT_RAID_MWCE_NC in mpt_raid_set_vol_mwce()
1699 mpt->raid_mwce_setting = mwce; in mpt_raid_set_vol_mwce()
1705 if ((mpt_vol->flags & MPT_RVF_ACTIVE) == 0) in mpt_raid_set_vol_mwce()
1708 vol_pg = mpt_vol->config_page; in mpt_raid_set_vol_mwce()
1709 resyncing = vol_pg->VolumeStatus.Flags in mpt_raid_set_vol_mwce()
1711 mwce = vol_pg->VolumeSettings.Settings in mpt_raid_set_vol_mwce()
1719 mpt_vol_prt(mpt, mpt_vol, "WARNING - Unsafe shutdown " in mpt_raid_set_vol_mwce()
1724 mpt->raid_mwce_set = 1; in mpt_raid_set_vol_mwce()
1733 "On-During-Rebuild",
1748 str = mpt_vol_mwce_strs[mpt->raid_mwce_setting]; in mpt_raid_sysctl_vol_member_wce()
1750 if (error || !req->newptr) { in mpt_raid_sysctl_vol_member_wce()
1754 size = req->newlen - req->newidx; in mpt_raid_sysctl_vol_member_wce()
1780 raid_resync_rate = mpt->raid_resync_rate; in mpt_raid_sysctl_vol_resync_rate()
1783 if (error || !req->newptr) { in mpt_raid_sysctl_vol_resync_rate()
1798 raid_queue_depth = mpt->raid_queue_depth; in mpt_raid_sysctl_vol_queue_depth()
1801 if (error || !req->newptr) { in mpt_raid_sysctl_vol_queue_depth()
1811 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(mpt->dev); in mpt_raid_sysctl_attach()
1812 struct sysctl_oid *tree = device_get_sysctl_tree(mpt->dev); in mpt_raid_sysctl_attach()
1817 "volume member WCE(On,Off,On-During-Rebuild,NC)"); in mpt_raid_sysctl_attach()
1827 "volume resync priority (0 == NC, 1 - 255)"); in mpt_raid_sysctl_attach()
1830 &mpt->raid_nonopt_volumes, 0, in mpt_raid_sysctl_attach()