Lines Matching +full:cm +full:- +full:poll +full:- +full:mode
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2011-2015 LSI Corp.
5 * Copyright (c) 2013-2015 Avago Technologies
29 * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD
61 * mps_config_get_ioc_pg8 - obtain ioc page 8
67 * Returns 0 for success, non-zero for failure.
75 struct mps_command *cm; in mps_config_get_ioc_pg8() local
82 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_ioc_pg8()
88 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_ioc_pg8()
90 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_ioc_pg8()
91 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_ioc_pg8()
92 request->Header.PageType = MPI2_CONFIG_PAGETYPE_IOC; in mps_config_get_ioc_pg8()
93 request->Header.PageNumber = 8; in mps_config_get_ioc_pg8()
94 request->Header.PageVersion = MPI2_IOCPAGE8_PAGEVERSION; in mps_config_get_ioc_pg8()
95 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_ioc_pg8()
96 cm->cm_data = NULL; in mps_config_get_ioc_pg8()
97 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_ioc_pg8()
98 if (cm != NULL) in mps_config_get_ioc_pg8()
99 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_ioc_pg8()
111 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_ioc_pg8()
124 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_ioc_pg8()
125 * counters to match - Need to review the reply FIFO handling. in mps_config_get_ioc_pg8()
127 mps_free_command(sc, cm); in mps_config_get_ioc_pg8()
129 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_ioc_pg8()
135 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_ioc_pg8()
137 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_ioc_pg8()
138 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; in mps_config_get_ioc_pg8()
139 request->Header.PageType = MPI2_CONFIG_PAGETYPE_IOC; in mps_config_get_ioc_pg8()
140 request->Header.PageNumber = 8; in mps_config_get_ioc_pg8()
141 request->Header.PageVersion = MPI2_IOCPAGE8_PAGEVERSION; in mps_config_get_ioc_pg8()
142 request->Header.PageLength = mpi_reply->Header.PageLength; in mps_config_get_ioc_pg8()
143 cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; in mps_config_get_ioc_pg8()
144 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_ioc_pg8()
145 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_ioc_pg8()
146 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_ioc_pg8()
147 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_ioc_pg8()
148 page = malloc((cm->cm_length), M_MPT2, M_ZERO | M_NOWAIT); in mps_config_get_ioc_pg8()
154 cm->cm_data = page; in mps_config_get_ioc_pg8()
156 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_ioc_pg8()
157 if (cm != NULL) in mps_config_get_ioc_pg8()
158 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_ioc_pg8()
170 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_ioc_pg8()
183 bcopy(page, config_page, MIN(cm->cm_length, (sizeof(Mpi2IOCPage8_t)))); in mps_config_get_ioc_pg8()
187 if (cm) in mps_config_get_ioc_pg8()
188 mps_free_command(sc, cm); in mps_config_get_ioc_pg8()
193 * mps_config_get_man_pg10 - obtain Manufacturing Page 10 data and set flags
199 * Returns 0 for success, non-zero for failure.
206 struct mps_command *cm; in mps_config_get_man_pg10() local
215 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_man_pg10()
221 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_man_pg10()
223 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_man_pg10()
224 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_man_pg10()
225 request->Header.PageType = MPI2_CONFIG_PAGETYPE_MANUFACTURING; in mps_config_get_man_pg10()
226 request->Header.PageNumber = 10; in mps_config_get_man_pg10()
227 request->Header.PageVersion = MPI2_MANUFACTURING10_PAGEVERSION; in mps_config_get_man_pg10()
228 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_man_pg10()
229 cm->cm_data = NULL; in mps_config_get_man_pg10()
235 error = mps_wait_command(sc, &cm, 60, 0); in mps_config_get_man_pg10()
236 if (cm != NULL) in mps_config_get_man_pg10()
237 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_man_pg10()
240 /* If the poll returns error then we need to do diag reset */ in mps_config_get_man_pg10()
241 printf("%s: poll for header completed with error %d\n", in mps_config_get_man_pg10()
246 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_man_pg10()
250 /* If the poll returns error then we need to do diag reset */ in mps_config_get_man_pg10()
256 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_man_pg10()
257 * counters to match - Need to review the reply FIFO handling. in mps_config_get_man_pg10()
259 mps_free_command(sc, cm); in mps_config_get_man_pg10()
261 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_man_pg10()
267 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_man_pg10()
269 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_man_pg10()
270 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; in mps_config_get_man_pg10()
271 request->Header.PageType = MPI2_CONFIG_PAGETYPE_MANUFACTURING; in mps_config_get_man_pg10()
272 request->Header.PageNumber = 10; in mps_config_get_man_pg10()
273 request->Header.PageVersion = MPI2_MANUFACTURING10_PAGEVERSION; in mps_config_get_man_pg10()
274 request->Header.PageLength = mpi_reply->Header.PageLength; in mps_config_get_man_pg10()
275 cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; in mps_config_get_man_pg10()
276 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_man_pg10()
277 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_man_pg10()
278 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_man_pg10()
279 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_man_pg10()
286 cm->cm_data = page; in mps_config_get_man_pg10()
292 error = mps_wait_command(sc, &cm, 60, 0); in mps_config_get_man_pg10()
293 if (cm != NULL) in mps_config_get_man_pg10()
294 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_man_pg10()
297 /* If the poll returns error then we need to do diag reset */ in mps_config_get_man_pg10()
298 printf("%s: poll for page completed with error %d\n", in mps_config_get_man_pg10()
303 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_man_pg10()
307 /* If the poll returns error then we need to do diag reset */ in mps_config_get_man_pg10()
317 sc->WD_hide_expose = MPS_WD_HIDE_ALWAYS; in mps_config_get_man_pg10()
318 OEM_Value = (uint8_t)(page->ProductSpecificInfo & 0x000000FF); in mps_config_get_man_pg10()
329 pPS_info = &page->ProductSpecificInfo; in mps_config_get_man_pg10()
330 sc->WD_hide_expose = (uint8_t)(pPS_info[5]); in mps_config_get_man_pg10()
331 sc->WD_hide_expose &= MPS_WD_HIDE_EXPOSE_MASK; in mps_config_get_man_pg10()
332 if ((sc->WD_hide_expose != MPS_WD_HIDE_ALWAYS) && in mps_config_get_man_pg10()
333 (sc->WD_hide_expose != MPS_WD_EXPOSE_ALWAYS) && in mps_config_get_man_pg10()
334 (sc->WD_hide_expose != MPS_WD_HIDE_IF_VOLUME)) { in mps_config_get_man_pg10()
336 "hide/expose: 0x%x\n", sc->WD_hide_expose); in mps_config_get_man_pg10()
343 if (cm) in mps_config_get_man_pg10()
344 mps_free_command(sc, cm); in mps_config_get_man_pg10()
349 * mps_base_static_config_pages - static start of day config pages.
361 while (mps_config_get_ioc_pg8(sc, &mpi_reply, &sc->ioc_pg8)) { in mps_base_static_config_pages()
372 * mps_wd_config_pages - get info required to support WarpDrive. This needs to
398 sc->WD_valid_config = FALSE; in mps_wd_config_pages()
399 if (sc->mps_flags & MPS_FLAGS_WD_AVAILABLE) { in mps_wd_config_pages()
404 sc->WD_hide_expose = MPS_WD_HIDE_ALWAYS; in mps_wd_config_pages()
422 "WarpDrive IT mode.\n"); in mps_wd_config_pages()
431 if ((raid_vol_pg0->VolumeType != MPI2_RAID_VOL_TYPE_RAID0) || in mps_wd_config_pages()
432 (raid_vol_pg0->NumPhysDisks > 8)) { in mps_wd_config_pages()
442 sc->DD_max_lba = le64toh((uint64_t)raid_vol_pg0->MaxLBA.High << in mps_wd_config_pages()
443 32 | (uint64_t)raid_vol_pg0->MaxLBA.Low); in mps_wd_config_pages()
444 sc->DD_num_phys_disks = raid_vol_pg0->NumPhysDisks; in mps_wd_config_pages()
445 sc->DD_dev_handle = raid_vol_pg0->DevHandle; in mps_wd_config_pages()
446 sc->DD_stripe_size = raid_vol_pg0->StripeSize; in mps_wd_config_pages()
447 sc->DD_block_size = raid_vol_pg0->BlockSize; in mps_wd_config_pages()
453 stripe_size = raid_vol_pg0->StripeSize; in mps_wd_config_pages()
466 sc->DD_stripe_exponent = stripe_exp; in mps_wd_config_pages()
472 block_size = raid_vol_pg0->BlockSize; in mps_wd_config_pages()
485 sc->DD_block_exponent = block_exp; in mps_wd_config_pages()
492 pRVPD = (pMpi2RaidVol0PhysDisk_t)&raid_vol_pg0->PhysDisk; in mps_wd_config_pages()
493 for (index = 0; index < raid_vol_pg0->NumPhysDisks; index++) { in mps_wd_config_pages()
494 sc->DD_column_map[pRVPD->PhysDiskMap].phys_disk_num = in mps_wd_config_pages()
495 pRVPD->PhysDiskNum; in mps_wd_config_pages()
505 raid_vol_pg0, (u32)raid_vol_pg0->DevHandle)) { in mps_wd_config_pages()
524 for (index = 0; index < raid_vol_pg0->NumPhysDisks; index++) { in mps_wd_config_pages()
527 sc->DD_column_map[index].phys_disk_num; in mps_wd_config_pages()
541 sc->DD_column_map[index].dev_handle = in mps_wd_config_pages()
544 sc->WD_valid_config = TRUE; in mps_wd_config_pages()
552 * mps_config_get_dpm_pg0 - obtain driver persistent mapping page0
559 * Returns 0 for success, non-zero for failure.
567 struct mps_command *cm; in mps_config_get_dpm_pg0() local
575 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_dpm_pg0()
581 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_dpm_pg0()
583 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_dpm_pg0()
584 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_dpm_pg0()
585 request->Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; in mps_config_get_dpm_pg0()
586 request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING; in mps_config_get_dpm_pg0()
587 request->Header.PageNumber = 0; in mps_config_get_dpm_pg0()
588 request->Header.PageVersion = MPI2_DRIVERMAPPING0_PAGEVERSION; in mps_config_get_dpm_pg0()
589 request->PageAddress = sc->max_dpm_entries << in mps_config_get_dpm_pg0()
591 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_dpm_pg0()
592 cm->cm_data = NULL; in mps_config_get_dpm_pg0()
593 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_dpm_pg0()
594 if (cm != NULL) in mps_config_get_dpm_pg0()
595 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_dpm_pg0()
607 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_dpm_pg0()
620 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_dpm_pg0()
621 * counters to match - Need to review the reply FIFO handling. in mps_config_get_dpm_pg0()
623 mps_free_command(sc, cm); in mps_config_get_dpm_pg0()
625 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_dpm_pg0()
631 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_dpm_pg0()
633 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_dpm_pg0()
634 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_NVRAM; in mps_config_get_dpm_pg0()
635 request->Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; in mps_config_get_dpm_pg0()
636 request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING; in mps_config_get_dpm_pg0()
637 request->Header.PageNumber = 0; in mps_config_get_dpm_pg0()
638 request->Header.PageVersion = MPI2_DRIVERMAPPING0_PAGEVERSION; in mps_config_get_dpm_pg0()
639 request->PageAddress = sc->max_dpm_entries << in mps_config_get_dpm_pg0()
641 request->ExtPageLength = mpi_reply->ExtPageLength; in mps_config_get_dpm_pg0()
642 cm->cm_length = le16toh(request->ExtPageLength) * 4; in mps_config_get_dpm_pg0()
643 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_dpm_pg0()
644 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_dpm_pg0()
645 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_dpm_pg0()
646 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_dpm_pg0()
647 page = malloc(cm->cm_length, M_MPT2, M_ZERO|M_NOWAIT); in mps_config_get_dpm_pg0()
653 cm->cm_data = page; in mps_config_get_dpm_pg0()
654 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_dpm_pg0()
655 if (cm != NULL) in mps_config_get_dpm_pg0()
656 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_dpm_pg0()
668 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_dpm_pg0()
681 bcopy(page, config_page, MIN(cm->cm_length, sz)); in mps_config_get_dpm_pg0()
684 if (cm) in mps_config_get_dpm_pg0()
685 mps_free_command(sc, cm); in mps_config_get_dpm_pg0()
690 * mps_config_set_dpm_pg0 - write an entry in driver persistent mapping page0
697 * Returns 0 for success, non-zero for failure.
705 struct mps_command *cm; in mps_config_set_dpm_pg0() local
712 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_set_dpm_pg0()
718 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_set_dpm_pg0()
720 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_set_dpm_pg0()
721 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_set_dpm_pg0()
722 request->Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; in mps_config_set_dpm_pg0()
723 request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING; in mps_config_set_dpm_pg0()
724 request->Header.PageNumber = 0; in mps_config_set_dpm_pg0()
725 request->Header.PageVersion = MPI2_DRIVERMAPPING0_PAGEVERSION; in mps_config_set_dpm_pg0()
727 request->PageAddress = 1 << MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; in mps_config_set_dpm_pg0()
728 request->PageAddress |= htole16(entry_idx); in mps_config_set_dpm_pg0()
729 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_set_dpm_pg0()
730 cm->cm_data = NULL; in mps_config_set_dpm_pg0()
731 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_set_dpm_pg0()
732 if (cm != NULL) in mps_config_set_dpm_pg0()
733 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_set_dpm_pg0()
745 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_set_dpm_pg0()
758 /* We have to do free and alloc for the reply-free and reply-post in mps_config_set_dpm_pg0()
759 * counters to match - Need to review the reply FIFO handling. in mps_config_set_dpm_pg0()
761 mps_free_command(sc, cm); in mps_config_set_dpm_pg0()
763 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_set_dpm_pg0()
769 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_set_dpm_pg0()
771 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_set_dpm_pg0()
772 request->Action = MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM; in mps_config_set_dpm_pg0()
773 request->Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; in mps_config_set_dpm_pg0()
774 request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING; in mps_config_set_dpm_pg0()
775 request->Header.PageNumber = 0; in mps_config_set_dpm_pg0()
776 request->Header.PageVersion = MPI2_DRIVERMAPPING0_PAGEVERSION; in mps_config_set_dpm_pg0()
777 request->ExtPageLength = mpi_reply->ExtPageLength; in mps_config_set_dpm_pg0()
778 request->PageAddress = 1 << MPI2_DPM_PGAD_ENTRY_COUNT_SHIFT; in mps_config_set_dpm_pg0()
779 request->PageAddress |= htole16(entry_idx); in mps_config_set_dpm_pg0()
780 cm->cm_length = le16toh(mpi_reply->ExtPageLength) * 4; in mps_config_set_dpm_pg0()
781 cm->cm_sge = &request->PageBufferSGE; in mps_config_set_dpm_pg0()
782 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_set_dpm_pg0()
783 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAOUT; in mps_config_set_dpm_pg0()
784 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_set_dpm_pg0()
785 page = malloc(cm->cm_length, M_MPT2, M_ZERO | M_NOWAIT); in mps_config_set_dpm_pg0()
791 bcopy(config_page, page, MIN(cm->cm_length, in mps_config_set_dpm_pg0()
793 cm->cm_data = page; in mps_config_set_dpm_pg0()
794 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_set_dpm_pg0()
795 if (cm != NULL) in mps_config_set_dpm_pg0()
796 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_set_dpm_pg0()
808 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_set_dpm_pg0()
823 if (cm) in mps_config_set_dpm_pg0()
824 mps_free_command(sc, cm); in mps_config_set_dpm_pg0()
829 * mps_config_get_sas_device_pg0 - obtain sas device page 0
837 * Returns 0 for success, non-zero for failure.
845 struct mps_command *cm; in mps_config_get_sas_device_pg0() local
852 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_sas_device_pg0()
858 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_sas_device_pg0()
860 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_sas_device_pg0()
861 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_sas_device_pg0()
862 request->Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; in mps_config_get_sas_device_pg0()
863 request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_SAS_DEVICE; in mps_config_get_sas_device_pg0()
864 request->Header.PageNumber = 0; in mps_config_get_sas_device_pg0()
865 request->Header.PageVersion = MPI2_SASDEVICE0_PAGEVERSION; in mps_config_get_sas_device_pg0()
866 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_sas_device_pg0()
867 cm->cm_data = NULL; in mps_config_get_sas_device_pg0()
868 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_sas_device_pg0()
869 if (cm != NULL) in mps_config_get_sas_device_pg0()
870 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_sas_device_pg0()
882 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_sas_device_pg0()
895 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_sas_device_pg0()
896 * counters to match - Need to review the reply FIFO handling. in mps_config_get_sas_device_pg0()
898 mps_free_command(sc, cm); in mps_config_get_sas_device_pg0()
900 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_sas_device_pg0()
906 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_sas_device_pg0()
908 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_sas_device_pg0()
909 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; in mps_config_get_sas_device_pg0()
910 request->Header.PageType = MPI2_CONFIG_PAGETYPE_EXTENDED; in mps_config_get_sas_device_pg0()
911 request->ExtPageType = MPI2_CONFIG_EXTPAGETYPE_SAS_DEVICE; in mps_config_get_sas_device_pg0()
912 request->Header.PageNumber = 0; in mps_config_get_sas_device_pg0()
913 request->Header.PageVersion = MPI2_SASDEVICE0_PAGEVERSION; in mps_config_get_sas_device_pg0()
914 request->ExtPageLength = mpi_reply->ExtPageLength; in mps_config_get_sas_device_pg0()
915 request->PageAddress = htole32(form | handle); in mps_config_get_sas_device_pg0()
916 cm->cm_length = le16toh(mpi_reply->ExtPageLength) * 4; in mps_config_get_sas_device_pg0()
917 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_sas_device_pg0()
918 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_sas_device_pg0()
919 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_sas_device_pg0()
920 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_sas_device_pg0()
921 page = malloc(cm->cm_length, M_MPT2, M_ZERO | M_NOWAIT); in mps_config_get_sas_device_pg0()
927 cm->cm_data = page; in mps_config_get_sas_device_pg0()
929 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_sas_device_pg0()
930 if (cm != NULL) in mps_config_get_sas_device_pg0()
931 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_sas_device_pg0()
943 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_sas_device_pg0()
956 bcopy(page, config_page, MIN(cm->cm_length, in mps_config_get_sas_device_pg0()
960 if (cm) in mps_config_get_sas_device_pg0()
961 mps_free_command(sc, cm); in mps_config_get_sas_device_pg0()
966 * mps_config_get_bios_pg3 - obtain BIOS page 3
972 * Returns 0 for success, non-zero for failure.
980 struct mps_command *cm; in mps_config_get_bios_pg3() local
987 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_bios_pg3()
993 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_bios_pg3()
995 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_bios_pg3()
996 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_bios_pg3()
997 request->Header.PageType = MPI2_CONFIG_PAGETYPE_BIOS; in mps_config_get_bios_pg3()
998 request->Header.PageNumber = 3; in mps_config_get_bios_pg3()
999 request->Header.PageVersion = MPI2_BIOSPAGE3_PAGEVERSION; in mps_config_get_bios_pg3()
1000 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_bios_pg3()
1001 cm->cm_data = NULL; in mps_config_get_bios_pg3()
1002 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_bios_pg3()
1003 if (cm != NULL) in mps_config_get_bios_pg3()
1004 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_bios_pg3()
1016 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_bios_pg3()
1029 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_bios_pg3()
1030 * counters to match - Need to review the reply FIFO handling. in mps_config_get_bios_pg3()
1032 mps_free_command(sc, cm); in mps_config_get_bios_pg3()
1034 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_bios_pg3()
1040 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_bios_pg3()
1042 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_bios_pg3()
1043 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; in mps_config_get_bios_pg3()
1044 request->Header.PageType = MPI2_CONFIG_PAGETYPE_BIOS; in mps_config_get_bios_pg3()
1045 request->Header.PageNumber = 3; in mps_config_get_bios_pg3()
1046 request->Header.PageVersion = MPI2_BIOSPAGE3_PAGEVERSION; in mps_config_get_bios_pg3()
1047 request->Header.PageLength = mpi_reply->Header.PageLength; in mps_config_get_bios_pg3()
1048 cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; in mps_config_get_bios_pg3()
1049 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_bios_pg3()
1050 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_bios_pg3()
1051 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_bios_pg3()
1052 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_bios_pg3()
1053 page = malloc(cm->cm_length, M_MPT2, M_ZERO | M_NOWAIT); in mps_config_get_bios_pg3()
1059 cm->cm_data = page; in mps_config_get_bios_pg3()
1061 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_bios_pg3()
1062 if (cm != NULL) in mps_config_get_bios_pg3()
1063 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_bios_pg3()
1075 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_bios_pg3()
1088 bcopy(page, config_page, MIN(cm->cm_length, sizeof(Mpi2BiosPage3_t))); in mps_config_get_bios_pg3()
1091 if (cm) in mps_config_get_bios_pg3()
1092 mps_free_command(sc, cm); in mps_config_get_bios_pg3()
1097 * mps_config_get_raid_volume_pg0 - obtain raid volume page 0
1104 * Returns 0 for success, non-zero for failure.
1112 struct mps_command *cm; in mps_config_get_raid_volume_pg0() local
1119 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_raid_volume_pg0()
1125 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_raid_volume_pg0()
1127 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_raid_volume_pg0()
1128 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_raid_volume_pg0()
1129 request->Header.PageType = MPI2_CONFIG_PAGETYPE_RAID_VOLUME; in mps_config_get_raid_volume_pg0()
1130 request->Header.PageNumber = 0; in mps_config_get_raid_volume_pg0()
1131 request->Header.PageVersion = MPI2_RAIDVOLPAGE0_PAGEVERSION; in mps_config_get_raid_volume_pg0()
1132 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_raid_volume_pg0()
1133 cm->cm_data = NULL; in mps_config_get_raid_volume_pg0()
1139 error = mps_wait_command(sc, &cm, 60, 0); in mps_config_get_raid_volume_pg0()
1140 if (cm != NULL) in mps_config_get_raid_volume_pg0()
1141 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_raid_volume_pg0()
1144 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_volume_pg0()
1145 printf("%s: poll for header completed with error %d\n", in mps_config_get_raid_volume_pg0()
1150 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_raid_volume_pg0()
1154 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_volume_pg0()
1160 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_raid_volume_pg0()
1161 * counters to match - Need to review the reply FIFO handling. in mps_config_get_raid_volume_pg0()
1163 mps_free_command(sc, cm); in mps_config_get_raid_volume_pg0()
1165 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_raid_volume_pg0()
1171 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_raid_volume_pg0()
1173 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_raid_volume_pg0()
1174 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; in mps_config_get_raid_volume_pg0()
1175 request->Header.PageType = MPI2_CONFIG_PAGETYPE_RAID_VOLUME; in mps_config_get_raid_volume_pg0()
1176 request->Header.PageNumber = 0; in mps_config_get_raid_volume_pg0()
1177 request->Header.PageLength = mpi_reply->Header.PageLength; in mps_config_get_raid_volume_pg0()
1178 request->Header.PageVersion = mpi_reply->Header.PageVersion; in mps_config_get_raid_volume_pg0()
1179 request->PageAddress = page_address; in mps_config_get_raid_volume_pg0()
1180 cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; in mps_config_get_raid_volume_pg0()
1181 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_raid_volume_pg0()
1182 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_raid_volume_pg0()
1183 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_raid_volume_pg0()
1184 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_raid_volume_pg0()
1185 page = malloc(cm->cm_length, M_MPT2, M_ZERO | M_NOWAIT); in mps_config_get_raid_volume_pg0()
1191 cm->cm_data = page; in mps_config_get_raid_volume_pg0()
1197 error = mps_wait_command(sc, &cm, 60, 0); in mps_config_get_raid_volume_pg0()
1198 if (cm != NULL) in mps_config_get_raid_volume_pg0()
1199 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_raid_volume_pg0()
1202 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_volume_pg0()
1203 printf("%s: poll for page completed with error %d\n", in mps_config_get_raid_volume_pg0()
1208 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_raid_volume_pg0()
1212 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_volume_pg0()
1218 bcopy(page, config_page, cm->cm_length); in mps_config_get_raid_volume_pg0()
1221 if (cm) in mps_config_get_raid_volume_pg0()
1222 mps_free_command(sc, cm); in mps_config_get_raid_volume_pg0()
1227 * mps_config_get_raid_volume_pg1 - obtain raid volume page 1
1235 * Returns 0 for success, non-zero for failure.
1243 struct mps_command *cm; in mps_config_get_raid_volume_pg1() local
1250 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_raid_volume_pg1()
1256 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_raid_volume_pg1()
1258 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_raid_volume_pg1()
1259 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_raid_volume_pg1()
1260 request->Header.PageType = MPI2_CONFIG_PAGETYPE_RAID_VOLUME; in mps_config_get_raid_volume_pg1()
1261 request->Header.PageNumber = 1; in mps_config_get_raid_volume_pg1()
1262 request->Header.PageVersion = MPI2_RAIDVOLPAGE1_PAGEVERSION; in mps_config_get_raid_volume_pg1()
1263 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_raid_volume_pg1()
1264 cm->cm_data = NULL; in mps_config_get_raid_volume_pg1()
1265 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_raid_volume_pg1()
1266 if (cm != NULL) in mps_config_get_raid_volume_pg1()
1267 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_raid_volume_pg1()
1279 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_raid_volume_pg1()
1292 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_raid_volume_pg1()
1293 * counters to match - Need to review the reply FIFO handling. in mps_config_get_raid_volume_pg1()
1295 mps_free_command(sc, cm); in mps_config_get_raid_volume_pg1()
1297 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_raid_volume_pg1()
1303 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_raid_volume_pg1()
1305 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_raid_volume_pg1()
1306 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; in mps_config_get_raid_volume_pg1()
1307 request->Header.PageType = MPI2_CONFIG_PAGETYPE_RAID_VOLUME; in mps_config_get_raid_volume_pg1()
1308 request->Header.PageNumber = 1; in mps_config_get_raid_volume_pg1()
1309 request->Header.PageLength = mpi_reply->Header.PageLength; in mps_config_get_raid_volume_pg1()
1310 request->Header.PageVersion = mpi_reply->Header.PageVersion; in mps_config_get_raid_volume_pg1()
1311 request->PageAddress = htole32(form | handle); in mps_config_get_raid_volume_pg1()
1312 cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; in mps_config_get_raid_volume_pg1()
1313 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_raid_volume_pg1()
1314 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_raid_volume_pg1()
1315 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_raid_volume_pg1()
1316 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_raid_volume_pg1()
1317 page = malloc(cm->cm_length, M_MPT2, M_ZERO | M_NOWAIT); in mps_config_get_raid_volume_pg1()
1323 cm->cm_data = page; in mps_config_get_raid_volume_pg1()
1325 error = mps_wait_command(sc, &cm, 60, CAN_SLEEP); in mps_config_get_raid_volume_pg1()
1326 if (cm != NULL) in mps_config_get_raid_volume_pg1()
1327 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_raid_volume_pg1()
1339 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_raid_volume_pg1()
1352 bcopy(page, config_page, MIN(cm->cm_length, in mps_config_get_raid_volume_pg1()
1356 if (cm) in mps_config_get_raid_volume_pg1()
1357 mps_free_command(sc, cm); in mps_config_get_raid_volume_pg1()
1362 * mps_config_get_volume_wwid - returns wwid given the volume handle
1368 * Returns 0 for success, non-zero for failure.
1383 return -1; in mps_config_get_volume_wwid()
1387 * mps_config_get_pd_pg0 - obtain raid phys disk page 0
1394 * Returns 0 for success, non-zero for failure.
1402 struct mps_command *cm; in mps_config_get_raid_pd_pg0() local
1409 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_raid_pd_pg0()
1415 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_raid_pd_pg0()
1417 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_raid_pd_pg0()
1418 request->Action = MPI2_CONFIG_ACTION_PAGE_HEADER; in mps_config_get_raid_pd_pg0()
1419 request->Header.PageType = MPI2_CONFIG_PAGETYPE_RAID_PHYSDISK; in mps_config_get_raid_pd_pg0()
1420 request->Header.PageNumber = 0; in mps_config_get_raid_pd_pg0()
1421 request->Header.PageVersion = MPI2_RAIDPHYSDISKPAGE0_PAGEVERSION; in mps_config_get_raid_pd_pg0()
1422 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_raid_pd_pg0()
1423 cm->cm_data = NULL; in mps_config_get_raid_pd_pg0()
1429 error = mps_wait_command(sc, &cm, 60, 0); in mps_config_get_raid_pd_pg0()
1430 if (cm != NULL) in mps_config_get_raid_pd_pg0()
1431 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_raid_pd_pg0()
1434 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_pd_pg0()
1435 printf("%s: poll for header completed with error %d\n", in mps_config_get_raid_pd_pg0()
1440 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_raid_pd_pg0()
1444 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_pd_pg0()
1450 /* We have to do free and alloc for the reply-free and reply-post in mps_config_get_raid_pd_pg0()
1451 * counters to match - Need to review the reply FIFO handling. in mps_config_get_raid_pd_pg0()
1453 mps_free_command(sc, cm); in mps_config_get_raid_pd_pg0()
1455 if ((cm = mps_alloc_command(sc)) == NULL) { in mps_config_get_raid_pd_pg0()
1461 request = (MPI2_CONFIG_REQUEST *)cm->cm_req; in mps_config_get_raid_pd_pg0()
1463 request->Function = MPI2_FUNCTION_CONFIG; in mps_config_get_raid_pd_pg0()
1464 request->Action = MPI2_CONFIG_ACTION_PAGE_READ_CURRENT; in mps_config_get_raid_pd_pg0()
1465 request->Header.PageType = MPI2_CONFIG_PAGETYPE_RAID_PHYSDISK; in mps_config_get_raid_pd_pg0()
1466 request->Header.PageNumber = 0; in mps_config_get_raid_pd_pg0()
1467 request->Header.PageLength = mpi_reply->Header.PageLength; in mps_config_get_raid_pd_pg0()
1468 request->Header.PageVersion = mpi_reply->Header.PageVersion; in mps_config_get_raid_pd_pg0()
1469 request->PageAddress = page_address; in mps_config_get_raid_pd_pg0()
1470 cm->cm_length = le16toh(mpi_reply->Header.PageLength) * 4; in mps_config_get_raid_pd_pg0()
1471 cm->cm_sge = &request->PageBufferSGE; in mps_config_get_raid_pd_pg0()
1472 cm->cm_sglsize = sizeof(MPI2_SGE_IO_UNION); in mps_config_get_raid_pd_pg0()
1473 cm->cm_flags = MPS_CM_FLAGS_SGE_SIMPLE | MPS_CM_FLAGS_DATAIN; in mps_config_get_raid_pd_pg0()
1474 cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; in mps_config_get_raid_pd_pg0()
1475 page = malloc(cm->cm_length, M_MPT2, M_ZERO | M_NOWAIT); in mps_config_get_raid_pd_pg0()
1481 cm->cm_data = page; in mps_config_get_raid_pd_pg0()
1487 error = mps_wait_command(sc, &cm, 60, 0); in mps_config_get_raid_pd_pg0()
1488 if (cm != NULL) in mps_config_get_raid_pd_pg0()
1489 reply = (MPI2_CONFIG_REPLY *)cm->cm_reply; in mps_config_get_raid_pd_pg0()
1492 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_pd_pg0()
1493 printf("%s: poll for page completed with error %d\n", in mps_config_get_raid_pd_pg0()
1498 ioc_status = le16toh(reply->IOCStatus) & MPI2_IOCSTATUS_MASK; in mps_config_get_raid_pd_pg0()
1502 /* If the poll returns error then we need to do diag reset */ in mps_config_get_raid_pd_pg0()
1508 bcopy(page, config_page, MIN(cm->cm_length, in mps_config_get_raid_pd_pg0()
1512 if (cm) in mps_config_get_raid_pd_pg0()
1513 mps_free_command(sc, cm); in mps_config_get_raid_pd_pg0()