316
317 raidvol = va_arg(ap, mptsas_raidvol_t *);
318
319 raidpage = (pMpi2RaidVolPage0_t)page_memp;
320 volstate = ddi_get8(accessp, &raidpage->VolumeState);
321 volsetting = ddi_get32(accessp,
322 (uint32_t *)(void *)&raidpage->VolumeSettings);
323 statusflags = ddi_get32(accessp, &raidpage->VolumeStatusFlags);
324 voltype = ddi_get8(accessp, &raidpage->VolumeType);
325
326 raidvol->m_state = volstate;
327 raidvol->m_statusflags = statusflags;
328 /*
329 * Volume size is not used right now. Set to 0.
330 */
331 raidvol->m_raidsize = 0;
332 raidvol->m_settings = volsetting;
333 raidvol->m_raidlevel = voltype;
334
335 if (statusflags & MPI2_RAIDVOL0_STATUS_FLAG_QUIESCED) {
336 mptsas_log(mpt, CE_NOTE, "?Volume %d is quiesced\n",
337 raidvol->m_raidhandle);
338 }
339
340 if (statusflags &
341 MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) {
342 mptsas_log(mpt, CE_NOTE, "?Volume %d is resyncing\n",
343 raidvol->m_raidhandle);
344 }
345
346 resync_flag = MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS;
347 switch (volstate) {
348 case MPI2_RAID_VOL_STATE_OPTIMAL:
349 mptsas_log(mpt, CE_NOTE, "?Volume %d is "
350 "optimal\n", raidvol->m_raidhandle);
351 break;
352 case MPI2_RAID_VOL_STATE_DEGRADED:
353 if ((statusflags & resync_flag) == 0) {
354 mptsas_log(mpt, CE_WARN, "Volume %d "
355 "is degraded\n",
356 raidvol->m_raidhandle);
357 }
358 break;
359 case MPI2_RAID_VOL_STATE_FAILED:
360 mptsas_log(mpt, CE_WARN, "Volume %d is "
361 "failed\n", raidvol->m_raidhandle);
362 break;
363 case MPI2_RAID_VOL_STATE_MISSING:
364 mptsas_log(mpt, CE_WARN, "Volume %d is "
365 "missing\n", raidvol->m_raidhandle);
366 break;
367 default:
368 break;
369 }
370 numdisks = raidpage->NumPhysDisks;
371 raidvol->m_ndisks = numdisks;
372 for (i = 0; i < numdisks; i++) {
373 physdisknum = raidpage->PhysDisk[i].PhysDiskNum;
374 raidvol->m_disknum[i] = physdisknum;
375 if (mptsas_get_physdisk_settings(mpt, raidvol,
376 physdisknum))
377 break;
378 }
379 return (rval);
380 }
381
382 int
383 mptsas_get_raid_settings(mptsas_t *mpt, mptsas_raidvol_t *raidvol)
384 {
385 int rval = DDI_SUCCESS;
590 (!ir_active); config++) {
591 for (vol = 0; vol < MPTSAS_MAX_RAIDVOLS; vol++) {
592 if (mpt->m_raidconfig[config].m_raidvol[vol].
593 m_israid) {
594 ir_active = TRUE;
595 break;
596 }
597 }
598 }
599 }
600 if (!ir_active) {
601 return;
602 }
603
604 /*
605 * If TM slot is already being used (highly unlikely), show message and
606 * don't issue the RAID action.
607 */
608 if (slots->m_slot[MPTSAS_TM_SLOT(mpt)] != NULL) {
609 mptsas_log(mpt, CE_WARN, "RAID Action slot in use. Cancelling"
610 " System Shutdown RAID Action.\n");
611 return;
612 }
613
614 /*
615 * Create the cmd and put it in the dedicated TM slot.
616 */
617 cmd = &(mpt->m_event_task_mgmt.m_event_cmd);
618 bzero((caddr_t)cmd, sizeof (*cmd));
619 cmd->cmd_pkt = NULL;
620 cmd->cmd_slot = MPTSAS_TM_SLOT(mpt);
621 slots->m_slot[MPTSAS_TM_SLOT(mpt)] = cmd;
622
623 /*
624 * Form message for raid action.
625 */
626 action = (pMpi2RaidActionRequest_t)(mpt->m_req_frame +
627 (mpt->m_req_frame_size * cmd->cmd_slot));
628 bzero(action, mpt->m_req_frame_size);
629 action->Function = MPI2_FUNCTION_RAID_ACTION;
630 action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
|
316
317 raidvol = va_arg(ap, mptsas_raidvol_t *);
318
319 raidpage = (pMpi2RaidVolPage0_t)page_memp;
320 volstate = ddi_get8(accessp, &raidpage->VolumeState);
321 volsetting = ddi_get32(accessp,
322 (uint32_t *)(void *)&raidpage->VolumeSettings);
323 statusflags = ddi_get32(accessp, &raidpage->VolumeStatusFlags);
324 voltype = ddi_get8(accessp, &raidpage->VolumeType);
325
326 raidvol->m_state = volstate;
327 raidvol->m_statusflags = statusflags;
328 /*
329 * Volume size is not used right now. Set to 0.
330 */
331 raidvol->m_raidsize = 0;
332 raidvol->m_settings = volsetting;
333 raidvol->m_raidlevel = voltype;
334
335 if (statusflags & MPI2_RAIDVOL0_STATUS_FLAG_QUIESCED) {
336 mptsas_log(mpt, CE_NOTE, "Volume %d is quiesced",
337 raidvol->m_raidhandle);
338 }
339
340 if (statusflags &
341 MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS) {
342 mptsas_log(mpt, CE_NOTE, "Volume %d is resyncing",
343 raidvol->m_raidhandle);
344 }
345
346 resync_flag = MPI2_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS;
347 switch (volstate) {
348 case MPI2_RAID_VOL_STATE_OPTIMAL:
349 mptsas_log(mpt, CE_NOTE, "Volume %d is "
350 "optimal", raidvol->m_raidhandle);
351 break;
352 case MPI2_RAID_VOL_STATE_DEGRADED:
353 if ((statusflags & resync_flag) == 0) {
354 mptsas_log(mpt, CE_WARN, "Volume %d "
355 "is degraded",
356 raidvol->m_raidhandle);
357 }
358 break;
359 case MPI2_RAID_VOL_STATE_FAILED:
360 mptsas_log(mpt, CE_WARN, "Volume %d is "
361 "failed", raidvol->m_raidhandle);
362 break;
363 case MPI2_RAID_VOL_STATE_MISSING:
364 mptsas_log(mpt, CE_WARN, "Volume %d is "
365 "missing", raidvol->m_raidhandle);
366 break;
367 default:
368 break;
369 }
370 numdisks = raidpage->NumPhysDisks;
371 raidvol->m_ndisks = numdisks;
372 for (i = 0; i < numdisks; i++) {
373 physdisknum = raidpage->PhysDisk[i].PhysDiskNum;
374 raidvol->m_disknum[i] = physdisknum;
375 if (mptsas_get_physdisk_settings(mpt, raidvol,
376 physdisknum))
377 break;
378 }
379 return (rval);
380 }
381
382 int
383 mptsas_get_raid_settings(mptsas_t *mpt, mptsas_raidvol_t *raidvol)
384 {
385 int rval = DDI_SUCCESS;
590 (!ir_active); config++) {
591 for (vol = 0; vol < MPTSAS_MAX_RAIDVOLS; vol++) {
592 if (mpt->m_raidconfig[config].m_raidvol[vol].
593 m_israid) {
594 ir_active = TRUE;
595 break;
596 }
597 }
598 }
599 }
600 if (!ir_active) {
601 return;
602 }
603
604 /*
605 * If TM slot is already being used (highly unlikely), show message and
606 * don't issue the RAID action.
607 */
608 if (slots->m_slot[MPTSAS_TM_SLOT(mpt)] != NULL) {
609 mptsas_log(mpt, CE_WARN, "RAID Action slot in use. Cancelling"
610 " System Shutdown RAID Action.");
611 return;
612 }
613
614 /*
615 * Create the cmd and put it in the dedicated TM slot.
616 */
617 cmd = &(mpt->m_event_task_mgmt.m_event_cmd);
618 bzero((caddr_t)cmd, sizeof (*cmd));
619 cmd->cmd_pkt = NULL;
620 cmd->cmd_slot = MPTSAS_TM_SLOT(mpt);
621 slots->m_slot[MPTSAS_TM_SLOT(mpt)] = cmd;
622
623 /*
624 * Form message for raid action.
625 */
626 action = (pMpi2RaidActionRequest_t)(mpt->m_req_frame +
627 (mpt->m_req_frame_size * cmd->cmd_slot));
628 bzero(action, mpt->m_req_frame_size);
629 action->Function = MPI2_FUNCTION_RAID_ACTION;
630 action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
|