44 #include <linux/module.h>
45 #include <linux/kernel.h>
47 #include <linux/errno.h>
49 #include <linux/sched.h>
52 #include <linux/pci.h>
53 #include <linux/slab.h>
60 #define MPT2_CONFIG_PAGE_DEFAULT_TIMEOUT 15
63 #define MPT2_CONFIG_COMMON_SGLFLAGS ((MPI2_SGE_FLAGS_SIMPLE_ELEMENT | \
64 MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER \
65 | MPI2_SGE_FLAGS_END_OF_LIST) << MPI2_SGE_FLAGS_SHIFT)
68 #define MPT2_CONFIG_COMMON_WRITE_SGLFLAGS ((MPI2_SGE_FLAGS_SIMPLE_ELEMENT | \
69 MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER \
70 | MPI2_SGE_FLAGS_END_OF_LIST | MPI2_SGE_FLAGS_HOST_TO_IOC) \
71 << MPI2_SGE_FLAGS_SHIFT)
86 #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
120 desc =
"raid_volume";
123 desc =
"manufaucturing";
131 desc =
"sas_io_unit";
134 desc =
"sas_expander";
149 desc =
"raid_config";
152 desc =
"driver_mapping";
162 "smid(%d)\n", ioc->
name, calling_function_name, desc,
171 "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
197 " failed asking for (%d) bytes!!\n",
198 ioc->
name, __func__, mem->
sz);
257 #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
258 _config_display_some_debug(ioc, smid,
"config_done", mpi_reply);
287 void *config_page,
u16 config_page_sz)
291 unsigned long timeleft;
295 u16 wait_state_count;
296 struct config_request mem;
301 ioc->
name, __func__);
307 memset(&mem, 0,
sizeof(
struct config_request));
309 mpi_request->
VF_ID = 0;
310 mpi_request->
VP_ID = 0;
323 r = _config_alloc_config_dma_memory(ioc, &mem);
326 if (mpi_request->
Action ==
336 memset(config_page, 0, config_page_sz);
344 if (retry_count > 2) {
349 ioc->
name, __func__, retry_count);
351 wait_state_count = 0;
356 "%s: failed due to ioc not operational\n",
357 ioc->
name, __func__);
365 "operational state(count=%d)\n", ioc->
name,
366 __func__, wait_state_count);
368 if (wait_state_count)
370 ioc->
name, __func__);
375 ioc->
name, __func__);
387 #ifdef CONFIG_SCSI_MPT2SAS_LOGGING
388 _config_display_some_debug(ioc, smid,
"config_request",
NULL);
396 ioc->
name, __func__);
405 issue_host_reset = 1;
415 ioc->
name, __func__, retry_count);
416 if (config_page && mpi_request->
Action ==
422 _config_free_config_dma_memory(ioc, &mem);
427 if (issue_host_reset)
456 r = _config_request(ioc, &mpi_request, mpi_reply,
462 r = _config_request(ioc, &mpi_request, mpi_reply,
464 sizeof(*config_page));
492 r = _config_request(ioc, &mpi_request, mpi_reply,
498 r = _config_request(ioc, &mpi_request, mpi_reply,
500 sizeof(*config_page));
528 r = _config_request(ioc, &mpi_request, mpi_reply,
534 r = _config_request(ioc, &mpi_request, mpi_reply,
536 sizeof(*config_page));
564 r = _config_request(ioc, &mpi_request, mpi_reply,
570 r = _config_request(ioc, &mpi_request, mpi_reply,
572 sizeof(*config_page));
600 r = _config_request(ioc, &mpi_request, mpi_reply,
606 r = _config_request(ioc, &mpi_request, mpi_reply,
608 sizeof(*config_page));
636 r = _config_request(ioc, &mpi_request, mpi_reply,
642 r = _config_request(ioc, &mpi_request, mpi_reply,
644 sizeof(*config_page));
672 r = _config_request(ioc, &mpi_request, mpi_reply,
678 r = _config_request(ioc, &mpi_request, mpi_reply,
680 sizeof(*config_page));
709 r = _config_request(ioc, &mpi_request, mpi_reply,
715 r = _config_request(ioc, &mpi_request, mpi_reply,
744 r = _config_request(ioc, &mpi_request, mpi_reply,
750 r = _config_request(ioc, &mpi_request, mpi_reply,
752 sizeof(*config_page));
783 r = _config_request(ioc, &mpi_request, mpi_reply,
790 r = _config_request(ioc, &mpi_request, mpi_reply,
792 sizeof(*config_page));
823 r = _config_request(ioc, &mpi_request, mpi_reply,
830 r = _config_request(ioc, &mpi_request, mpi_reply,
832 sizeof(*config_page));
863 r = _config_request(ioc, &mpi_request, &mpi_reply,
869 r = _config_request(ioc, &mpi_request, &mpi_reply,
876 *num_phys = config_page.
NumPhys;
910 r = _config_request(ioc, &mpi_request, mpi_reply,
916 r = _config_request(ioc, &mpi_request, mpi_reply,
950 r = _config_request(ioc, &mpi_request, mpi_reply,
956 r = _config_request(ioc, &mpi_request, mpi_reply,
990 r = _config_request(ioc, &mpi_request, mpi_reply,
996 _config_request(ioc, &mpi_request, mpi_reply,
999 r = _config_request(ioc, &mpi_request, mpi_reply,
1031 r = _config_request(ioc, &mpi_request, mpi_reply,
1038 r = _config_request(ioc, &mpi_request, mpi_reply,
1040 sizeof(*config_page));
1072 r = _config_request(ioc, &mpi_request, mpi_reply,
1081 r = _config_request(ioc, &mpi_request, mpi_reply,
1083 sizeof(*config_page));
1114 r = _config_request(ioc, &mpi_request, mpi_reply,
1121 r = _config_request(ioc, &mpi_request, mpi_reply,
1123 sizeof(*config_page));
1153 r = _config_request(ioc, &mpi_request, mpi_reply,
1161 r = _config_request(ioc, &mpi_request, mpi_reply,
1163 sizeof(*config_page));
1193 r = _config_request(ioc, &mpi_request, mpi_reply,
1201 r = _config_request(ioc, &mpi_request, mpi_reply,
1203 sizeof(*config_page));
1234 r = _config_request(ioc, &mpi_request, mpi_reply,
1241 r = _config_request(ioc, &mpi_request, mpi_reply,
1243 sizeof(*config_page));
1275 r = _config_request(ioc, &mpi_request, &mpi_reply,
1283 r = _config_request(ioc, &mpi_request, &mpi_reply,
1324 r = _config_request(ioc, &mpi_request, mpi_reply,
1331 r = _config_request(ioc, &mpi_request, mpi_reply,
1363 r = _config_request(ioc, &mpi_request, mpi_reply,
1370 r = _config_request(ioc, &mpi_request, mpi_reply,
1372 sizeof(*config_page));
1393 int r,
i, config_page_sz;
1397 u16 phys_disk_dev_handle;
1408 r = _config_request(ioc, &mpi_request, &mpi_reply,
1424 r = _config_request(ioc, &mpi_request, &mpi_reply,
1436 ConfigElement[i].ElementFlags) &
1442 phys_disk_dev_handle =
1445 if (phys_disk_dev_handle == pd_handle) {
1448 ConfigElement[i].VolDevHandle);
1452 }
else if (element_type ==