2 * This module provides common API for accessing firmware configuration pages
4 * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.c
5 * Copyright (C) 2012-2014 LSI Corporation
6 * Copyright (C) 2013-2014 Avago Technologies
7 * (mailto: MPT-FusionLinux.pdl@avagotech.com)
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
21 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
22 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
23 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
24 * solely responsible for determining the appropriateness of using and
25 * distributing the Program and assumes all risks associated with its
26 * exercise of rights under this Agreement, including but not limited to
27 * the risks and costs of program errors, damage to or loss of data,
28 * programs or equipment, and unavailability or interruption of operations.
30 * DISCLAIMER OF LIABILITY
31 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
32 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
34 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
35 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
36 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
37 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
39 * You should have received a copy of the GNU General Public License
40 * along with this program; if not, write to the Free Software
41 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
45 #include <linux/module.h>
46 #include <linux/kernel.h>
47 #include <linux/init.h>
48 #include <linux/errno.h>
49 #include <linux/blkdev.h>
50 #include <linux/sched.h>
51 #include <linux/workqueue.h>
52 #include <linux/delay.h>
53 #include <linux/pci.h>
55 #include "mpt3sas_base.h"
57 /* local definitions */
59 /* Timeout for config page request (in seconds) */
60 #define MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT 15
62 /* Common sgl flags for READING a config page. */
63 #define MPT3_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)
67 /* Common sgl flags for WRITING a config page. */
68 #define MPT3_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)
74 * struct config_request - obtain dma memory via routine
77 * @page_dma: phys pointer
80 struct config_request
{
87 * _config_display_some_debug - debug routine
88 * @ioc: per adapter object
89 * @smid: system request message index
90 * @calling_function_name: string pass from calling function
91 * @mpi_reply: reply message frame
94 * Function for displaying debug info helpful when debugging issues
98 _config_display_some_debug(struct MPT3SAS_ADAPTER
*ioc
, u16 smid
,
99 char *calling_function_name
, MPI2DefaultReply_t
*mpi_reply
)
101 Mpi2ConfigRequest_t
*mpi_request
;
104 mpi_request
= mpt3sas_base_get_msg_frame(ioc
, smid
);
105 switch (mpi_request
->Header
.PageType
& MPI2_CONFIG_PAGETYPE_MASK
) {
106 case MPI2_CONFIG_PAGETYPE_IO_UNIT
:
109 case MPI2_CONFIG_PAGETYPE_IOC
:
112 case MPI2_CONFIG_PAGETYPE_BIOS
:
115 case MPI2_CONFIG_PAGETYPE_RAID_VOLUME
:
116 desc
= "raid_volume";
118 case MPI2_CONFIG_PAGETYPE_MANUFACTURING
:
119 desc
= "manufacturing";
121 case MPI2_CONFIG_PAGETYPE_RAID_PHYSDISK
:
124 case MPI2_CONFIG_PAGETYPE_EXTENDED
:
125 switch (mpi_request
->ExtPageType
) {
126 case MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT
:
127 desc
= "sas_io_unit";
129 case MPI2_CONFIG_EXTPAGETYPE_SAS_EXPANDER
:
130 desc
= "sas_expander";
132 case MPI2_CONFIG_EXTPAGETYPE_SAS_DEVICE
:
135 case MPI2_CONFIG_EXTPAGETYPE_SAS_PHY
:
138 case MPI2_CONFIG_EXTPAGETYPE_LOG
:
141 case MPI2_CONFIG_EXTPAGETYPE_ENCLOSURE
:
144 case MPI2_CONFIG_EXTPAGETYPE_RAID_CONFIG
:
145 desc
= "raid_config";
147 case MPI2_CONFIG_EXTPAGETYPE_DRIVER_MAPPING
:
148 desc
= "driver_mapping";
150 case MPI2_CONFIG_EXTPAGETYPE_SAS_PORT
:
153 case MPI2_CONFIG_EXTPAGETYPE_EXT_MANUFACTURING
:
154 desc
= "ext_manufacturing";
156 case MPI2_CONFIG_EXTPAGETYPE_PCIE_IO_UNIT
:
157 desc
= "pcie_io_unit";
159 case MPI2_CONFIG_EXTPAGETYPE_PCIE_SWITCH
:
160 desc
= "pcie_switch";
162 case MPI2_CONFIG_EXTPAGETYPE_PCIE_DEVICE
:
163 desc
= "pcie_device";
165 case MPI2_CONFIG_EXTPAGETYPE_PCIE_LINK
:
175 ioc_info(ioc
, "%s: %s(%d), action(%d), form(0x%08x), smid(%d)\n",
176 calling_function_name
, desc
,
177 mpi_request
->Header
.PageNumber
, mpi_request
->Action
,
178 le32_to_cpu(mpi_request
->PageAddress
), smid
);
183 if (mpi_reply
->IOCStatus
|| mpi_reply
->IOCLogInfo
)
184 ioc_info(ioc
, "\tiocstatus(0x%04x), loginfo(0x%08x)\n",
185 le16_to_cpu(mpi_reply
->IOCStatus
),
186 le32_to_cpu(mpi_reply
->IOCLogInfo
));
190 * _config_alloc_config_dma_memory - obtain physical memory
191 * @ioc: per adapter object
192 * @mem: struct config_request
194 * A wrapper for obtaining dma-able memory for config page request.
196 * Return: 0 for success, non-zero for failure.
199 _config_alloc_config_dma_memory(struct MPT3SAS_ADAPTER
*ioc
,
200 struct config_request
*mem
)
204 if (mem
->sz
> ioc
->config_page_sz
) {
205 mem
->page
= dma_alloc_coherent(&ioc
->pdev
->dev
, mem
->sz
,
206 &mem
->page_dma
, GFP_KERNEL
);
208 ioc_err(ioc
, "%s: dma_alloc_coherent failed asking for (%d) bytes!!\n",
212 } else { /* use tmp buffer if less than 512 bytes */
213 mem
->page
= ioc
->config_page
;
214 mem
->page_dma
= ioc
->config_page_dma
;
216 ioc
->config_vaddr
= mem
->page
;
221 * _config_free_config_dma_memory - wrapper to free the memory
222 * @ioc: per adapter object
223 * @mem: struct config_request
225 * A wrapper to free dma-able memory when using _config_alloc_config_dma_memory.
227 * Return: 0 for success, non-zero for failure.
230 _config_free_config_dma_memory(struct MPT3SAS_ADAPTER
*ioc
,
231 struct config_request
*mem
)
233 if (mem
->sz
> ioc
->config_page_sz
)
234 dma_free_coherent(&ioc
->pdev
->dev
, mem
->sz
, mem
->page
,
239 * mpt3sas_config_done - config page completion routine
240 * @ioc: per adapter object
241 * @smid: system request message index
242 * @msix_index: MSIX table index supplied by the OS
243 * @reply: reply message frame(lower 32bit addr)
246 * The callback handler when using _config_request.
248 * Return: 1 meaning mf should be freed from _base_interrupt
249 * 0 means the mf is freed from this function.
252 mpt3sas_config_done(struct MPT3SAS_ADAPTER
*ioc
, u16 smid
, u8 msix_index
,
255 MPI2DefaultReply_t
*mpi_reply
;
257 if (ioc
->config_cmds
.status
== MPT3_CMD_NOT_USED
)
259 if (ioc
->config_cmds
.smid
!= smid
)
261 ioc
->config_cmds
.status
|= MPT3_CMD_COMPLETE
;
262 mpi_reply
= mpt3sas_base_get_reply_virt_addr(ioc
, reply
);
264 ioc
->config_cmds
.status
|= MPT3_CMD_REPLY_VALID
;
265 memcpy(ioc
->config_cmds
.reply
, mpi_reply
,
266 mpi_reply
->MsgLength
*4);
268 ioc
->config_cmds
.status
&= ~MPT3_CMD_PENDING
;
269 if (ioc
->logging_level
& MPT_DEBUG_CONFIG
)
270 _config_display_some_debug(ioc
, smid
, "config_done", mpi_reply
);
271 ioc
->config_cmds
.smid
= USHRT_MAX
;
272 complete(&ioc
->config_cmds
.done
);
277 * _config_request - main routine for sending config page requests
278 * @ioc: per adapter object
279 * @mpi_request: request message frame
280 * @mpi_reply: reply mf payload returned from firmware
281 * @timeout: timeout in seconds
282 * @config_page: contents of the config page
283 * @config_page_sz: size of config page
286 * A generic API for config page requests to firmware.
288 * The ioc->config_cmds.status flag should be MPT3_CMD_NOT_USED before calling
291 * The callback index is set inside `ioc->config_cb_idx.
293 * Return: 0 for success, non-zero for failure.
296 _config_request(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigRequest_t
297 *mpi_request
, Mpi2ConfigReply_t
*mpi_reply
, int timeout
,
298 void *config_page
, u16 config_page_sz
)
301 Mpi2ConfigRequest_t
*config_request
;
303 u8 retry_count
, issue_host_reset
= 0;
304 struct config_request mem
;
305 u32 ioc_status
= UINT_MAX
;
307 mutex_lock(&ioc
->config_cmds
.mutex
);
308 if (ioc
->config_cmds
.status
!= MPT3_CMD_NOT_USED
) {
309 ioc_err(ioc
, "%s: config_cmd in use\n", __func__
);
310 mutex_unlock(&ioc
->config_cmds
.mutex
);
315 memset(&mem
, 0, sizeof(struct config_request
));
317 mpi_request
->VF_ID
= 0; /* TODO */
318 mpi_request
->VP_ID
= 0;
321 mpi_request
->Header
.PageVersion
= mpi_reply
->Header
.PageVersion
;
322 mpi_request
->Header
.PageNumber
= mpi_reply
->Header
.PageNumber
;
323 mpi_request
->Header
.PageType
= mpi_reply
->Header
.PageType
;
324 mpi_request
->Header
.PageLength
= mpi_reply
->Header
.PageLength
;
325 mpi_request
->ExtPageLength
= mpi_reply
->ExtPageLength
;
326 mpi_request
->ExtPageType
= mpi_reply
->ExtPageType
;
327 if (mpi_request
->Header
.PageLength
)
328 mem
.sz
= mpi_request
->Header
.PageLength
* 4;
330 mem
.sz
= le16_to_cpu(mpi_reply
->ExtPageLength
) * 4;
331 r
= _config_alloc_config_dma_memory(ioc
, &mem
);
334 if (mpi_request
->Action
==
335 MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
||
336 mpi_request
->Action
==
337 MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM
) {
338 ioc
->base_add_sg_single(&mpi_request
->PageBufferSGE
,
339 MPT3_CONFIG_COMMON_WRITE_SGLFLAGS
| mem
.sz
,
341 memcpy(mem
.page
, config_page
, min_t(u16
, mem
.sz
,
344 memset(config_page
, 0, config_page_sz
);
345 ioc
->base_add_sg_single(&mpi_request
->PageBufferSGE
,
346 MPT3_CONFIG_COMMON_SGLFLAGS
| mem
.sz
, mem
.page_dma
);
347 memset(mem
.page
, 0, min_t(u16
, mem
.sz
, config_page_sz
));
353 if (retry_count
> 2) { /* attempt only 2 retries */
357 ioc_info(ioc
, "%s: attempting retry (%d)\n",
358 __func__
, retry_count
);
361 r
= mpt3sas_wait_for_ioc(ioc
, MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
);
364 issue_host_reset
= 1;
368 smid
= mpt3sas_base_get_smid(ioc
, ioc
->config_cb_idx
);
370 ioc_err(ioc
, "%s: failed obtaining a smid\n", __func__
);
371 ioc
->config_cmds
.status
= MPT3_CMD_NOT_USED
;
377 memset(ioc
->config_cmds
.reply
, 0, sizeof(Mpi2ConfigReply_t
));
378 ioc
->config_cmds
.status
= MPT3_CMD_PENDING
;
379 config_request
= mpt3sas_base_get_msg_frame(ioc
, smid
);
380 ioc
->config_cmds
.smid
= smid
;
381 memcpy(config_request
, mpi_request
, sizeof(Mpi2ConfigRequest_t
));
382 if (ioc
->logging_level
& MPT_DEBUG_CONFIG
)
383 _config_display_some_debug(ioc
, smid
, "config_request", NULL
);
384 init_completion(&ioc
->config_cmds
.done
);
385 ioc
->put_smid_default(ioc
, smid
);
386 wait_for_completion_timeout(&ioc
->config_cmds
.done
, timeout
*HZ
);
387 if (!(ioc
->config_cmds
.status
& MPT3_CMD_COMPLETE
)) {
388 if (!(ioc
->logging_level
& MPT_DEBUG_CONFIG
))
389 _config_display_some_debug(ioc
,
390 smid
, "config_request", NULL
);
391 ioc_err(ioc
, "%s: command timeout\n", __func__
);
392 mpt3sas_base_check_cmd_timeout(ioc
, ioc
->config_cmds
.status
,
393 mpi_request
, sizeof(Mpi2ConfigRequest_t
) / 4);
395 if (ioc
->config_cmds
.smid
== smid
)
396 mpt3sas_base_free_smid(ioc
, smid
);
397 if (ioc
->config_cmds
.status
& MPT3_CMD_RESET
)
399 if (ioc
->shost_recovery
|| ioc
->pci_error_recovery
) {
400 issue_host_reset
= 0;
403 issue_host_reset
= 1;
407 if (ioc
->config_cmds
.status
& MPT3_CMD_REPLY_VALID
) {
408 memcpy(mpi_reply
, ioc
->config_cmds
.reply
,
409 sizeof(Mpi2ConfigReply_t
));
411 /* Reply Frame Sanity Checks to workaround FW issues */
412 if ((mpi_request
->Header
.PageType
& 0xF) !=
413 (mpi_reply
->Header
.PageType
& 0xF)) {
414 if (!(ioc
->logging_level
& MPT_DEBUG_CONFIG
))
415 _config_display_some_debug(ioc
,
416 smid
, "config_request", NULL
);
417 _debug_dump_mf(mpi_request
, ioc
->request_sz
/4);
418 _debug_dump_reply(mpi_reply
, ioc
->reply_sz
/4);
419 panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n",
421 mpi_request
->Header
.PageType
& 0xF,
422 mpi_reply
->Header
.PageType
& 0xF);
425 if (((mpi_request
->Header
.PageType
& 0xF) ==
426 MPI2_CONFIG_PAGETYPE_EXTENDED
) &&
427 mpi_request
->ExtPageType
!= mpi_reply
->ExtPageType
) {
428 if (!(ioc
->logging_level
& MPT_DEBUG_CONFIG
))
429 _config_display_some_debug(ioc
,
430 smid
, "config_request", NULL
);
431 _debug_dump_mf(mpi_request
, ioc
->request_sz
/4);
432 _debug_dump_reply(mpi_reply
, ioc
->reply_sz
/4);
433 panic("%s: %s: Firmware BUG: mpi_reply mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n",
435 mpi_request
->ExtPageType
,
436 mpi_reply
->ExtPageType
);
438 ioc_status
= le16_to_cpu(mpi_reply
->IOCStatus
)
439 & MPI2_IOCSTATUS_MASK
;
443 ioc_info(ioc
, "%s: retry (%d) completed!!\n",
444 __func__
, retry_count
);
446 if ((ioc_status
== MPI2_IOCSTATUS_SUCCESS
) &&
447 config_page
&& mpi_request
->Action
==
448 MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
) {
449 u8
*p
= (u8
*)mem
.page
;
451 /* Config Page Sanity Checks to workaround FW issues */
453 if ((mpi_request
->Header
.PageType
& 0xF) !=
455 if (!(ioc
->logging_level
& MPT_DEBUG_CONFIG
))
456 _config_display_some_debug(ioc
,
457 smid
, "config_request", NULL
);
458 _debug_dump_mf(mpi_request
, ioc
->request_sz
/4);
459 _debug_dump_reply(mpi_reply
, ioc
->reply_sz
/4);
460 _debug_dump_config(p
, min_t(u16
, mem
.sz
,
462 panic("%s: %s: Firmware BUG: config page mismatch: Requested PageType(0x%02x) Reply PageType(0x%02x)\n",
464 mpi_request
->Header
.PageType
& 0xF,
468 if (((mpi_request
->Header
.PageType
& 0xF) ==
469 MPI2_CONFIG_PAGETYPE_EXTENDED
) &&
470 (mpi_request
->ExtPageType
!= p
[6])) {
471 if (!(ioc
->logging_level
& MPT_DEBUG_CONFIG
))
472 _config_display_some_debug(ioc
,
473 smid
, "config_request", NULL
);
474 _debug_dump_mf(mpi_request
, ioc
->request_sz
/4);
475 _debug_dump_reply(mpi_reply
, ioc
->reply_sz
/4);
476 _debug_dump_config(p
, min_t(u16
, mem
.sz
,
478 panic("%s: %s: Firmware BUG: config page mismatch: Requested ExtPageType(0x%02x) Reply ExtPageType(0x%02x)\n",
480 mpi_request
->ExtPageType
, p
[6]);
483 memcpy(config_page
, mem
.page
, min_t(u16
, mem
.sz
,
489 _config_free_config_dma_memory(ioc
, &mem
);
491 ioc
->config_cmds
.status
= MPT3_CMD_NOT_USED
;
492 mutex_unlock(&ioc
->config_cmds
.mutex
);
494 if (issue_host_reset
) {
495 if (ioc
->drv_internal_flags
& MPT_DRV_INTERNAL_FIRST_PE_ISSUED
) {
496 mpt3sas_base_hard_reset_handler(ioc
, FORCE_BIG_HAMMER
);
499 if (mpt3sas_base_check_for_fault_and_issue_reset(ioc
))
508 * mpt3sas_config_get_manufacturing_pg0 - obtain manufacturing page 0
509 * @ioc: per adapter object
510 * @mpi_reply: reply mf payload returned from firmware
511 * @config_page: contents of the config page
514 * Return: 0 for success, non-zero for failure.
517 mpt3sas_config_get_manufacturing_pg0(struct MPT3SAS_ADAPTER
*ioc
,
518 Mpi2ConfigReply_t
*mpi_reply
, Mpi2ManufacturingPage0_t
*config_page
)
520 Mpi2ConfigRequest_t mpi_request
;
523 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
524 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
525 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
526 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_MANUFACTURING
;
527 mpi_request
.Header
.PageNumber
= 0;
528 mpi_request
.Header
.PageVersion
= MPI2_MANUFACTURING0_PAGEVERSION
;
529 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
530 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
531 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
535 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
536 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
537 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
538 sizeof(*config_page
));
544 * mpt3sas_config_get_manufacturing_pg1 - obtain manufacturing page 1
545 * @ioc: per adapter object
546 * @mpi_reply: reply mf payload returned from firmware
547 * @config_page: contents of the config page
550 * Return: 0 for success, non-zero for failure.
553 mpt3sas_config_get_manufacturing_pg1(struct MPT3SAS_ADAPTER
*ioc
,
554 Mpi2ConfigReply_t
*mpi_reply
, Mpi2ManufacturingPage1_t
*config_page
)
556 Mpi2ConfigRequest_t mpi_request
;
559 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
560 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
561 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
562 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_MANUFACTURING
;
563 mpi_request
.Header
.PageNumber
= 1;
564 mpi_request
.Header
.PageVersion
= MPI2_MANUFACTURING1_PAGEVERSION
;
565 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
566 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
567 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
571 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
572 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
573 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
574 sizeof(*config_page
));
580 * mpt3sas_config_get_manufacturing_pg7 - obtain manufacturing page 7
581 * @ioc: per adapter object
582 * @mpi_reply: reply mf payload returned from firmware
583 * @config_page: contents of the config page
584 * @sz: size of buffer passed in config_page
587 * Return: 0 for success, non-zero for failure.
590 mpt3sas_config_get_manufacturing_pg7(struct MPT3SAS_ADAPTER
*ioc
,
591 Mpi2ConfigReply_t
*mpi_reply
, Mpi2ManufacturingPage7_t
*config_page
,
594 Mpi2ConfigRequest_t mpi_request
;
597 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
598 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
599 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
600 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_MANUFACTURING
;
601 mpi_request
.Header
.PageNumber
= 7;
602 mpi_request
.Header
.PageVersion
= MPI2_MANUFACTURING7_PAGEVERSION
;
603 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
604 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
605 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
609 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
610 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
611 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
618 * mpt3sas_config_get_manufacturing_pg10 - obtain manufacturing page 10
619 * @ioc: per adapter object
620 * @mpi_reply: reply mf payload returned from firmware
621 * @config_page: contents of the config page
624 * Return: 0 for success, non-zero for failure.
627 mpt3sas_config_get_manufacturing_pg10(struct MPT3SAS_ADAPTER
*ioc
,
628 Mpi2ConfigReply_t
*mpi_reply
,
629 struct Mpi2ManufacturingPage10_t
*config_page
)
631 Mpi2ConfigRequest_t mpi_request
;
634 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
635 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
636 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
637 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_MANUFACTURING
;
638 mpi_request
.Header
.PageNumber
= 10;
639 mpi_request
.Header
.PageVersion
= MPI2_MANUFACTURING0_PAGEVERSION
;
640 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
641 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
642 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
646 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
647 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
648 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
649 sizeof(*config_page
));
655 * mpt3sas_config_get_manufacturing_pg11 - obtain manufacturing page 11
656 * @ioc: per adapter object
657 * @mpi_reply: reply mf payload returned from firmware
658 * @config_page: contents of the config page
661 * Return: 0 for success, non-zero for failure.
664 mpt3sas_config_get_manufacturing_pg11(struct MPT3SAS_ADAPTER
*ioc
,
665 Mpi2ConfigReply_t
*mpi_reply
,
666 struct Mpi2ManufacturingPage11_t
*config_page
)
668 Mpi2ConfigRequest_t mpi_request
;
671 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
672 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
673 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
674 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_MANUFACTURING
;
675 mpi_request
.Header
.PageNumber
= 11;
676 mpi_request
.Header
.PageVersion
= MPI2_MANUFACTURING0_PAGEVERSION
;
677 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
678 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
679 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
683 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
684 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
685 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
686 sizeof(*config_page
));
692 * mpt3sas_config_set_manufacturing_pg11 - set manufacturing page 11
693 * @ioc: per adapter object
694 * @mpi_reply: reply mf payload returned from firmware
695 * @config_page: contents of the config page
698 * Return: 0 for success, non-zero for failure.
701 mpt3sas_config_set_manufacturing_pg11(struct MPT3SAS_ADAPTER
*ioc
,
702 Mpi2ConfigReply_t
*mpi_reply
,
703 struct Mpi2ManufacturingPage11_t
*config_page
)
705 Mpi2ConfigRequest_t mpi_request
;
708 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
709 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
710 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
711 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_MANUFACTURING
;
712 mpi_request
.Header
.PageNumber
= 11;
713 mpi_request
.Header
.PageVersion
= MPI2_MANUFACTURING0_PAGEVERSION
;
714 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
715 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
716 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
720 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
721 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
722 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
723 sizeof(*config_page
));
729 * mpt3sas_config_get_bios_pg2 - obtain bios page 2
730 * @ioc: per adapter object
731 * @mpi_reply: reply mf payload returned from firmware
732 * @config_page: contents of the config page
735 * Return: 0 for success, non-zero for failure.
738 mpt3sas_config_get_bios_pg2(struct MPT3SAS_ADAPTER
*ioc
,
739 Mpi2ConfigReply_t
*mpi_reply
, Mpi2BiosPage2_t
*config_page
)
741 Mpi2ConfigRequest_t mpi_request
;
744 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
745 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
746 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
747 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_BIOS
;
748 mpi_request
.Header
.PageNumber
= 2;
749 mpi_request
.Header
.PageVersion
= MPI2_BIOSPAGE2_PAGEVERSION
;
750 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
751 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
752 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
756 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
757 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
758 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
759 sizeof(*config_page
));
765 * mpt3sas_config_get_bios_pg3 - obtain bios page 3
766 * @ioc: per adapter object
767 * @mpi_reply: reply mf payload returned from firmware
768 * @config_page: contents of the config page
771 * Return: 0 for success, non-zero for failure.
774 mpt3sas_config_get_bios_pg3(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
775 *mpi_reply
, Mpi2BiosPage3_t
*config_page
)
777 Mpi2ConfigRequest_t mpi_request
;
780 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
781 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
782 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
783 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_BIOS
;
784 mpi_request
.Header
.PageNumber
= 3;
785 mpi_request
.Header
.PageVersion
= MPI2_BIOSPAGE3_PAGEVERSION
;
786 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
787 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
788 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
792 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
793 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
794 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
795 sizeof(*config_page
));
802 * mpt3sas_config_set_bios_pg4 - write out bios page 4
803 * @ioc: per adapter object
804 * @mpi_reply: reply mf payload returned from firmware
805 * @config_page: contents of the config page
806 * @sz_config_pg: sizeof the config page
809 * Return: 0 for success, non-zero for failure.
812 mpt3sas_config_set_bios_pg4(struct MPT3SAS_ADAPTER
*ioc
,
813 Mpi2ConfigReply_t
*mpi_reply
, Mpi2BiosPage4_t
*config_page
,
816 Mpi2ConfigRequest_t mpi_request
;
819 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
821 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
822 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
823 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_BIOS
;
824 mpi_request
.Header
.PageNumber
= 4;
825 mpi_request
.Header
.PageVersion
= MPI2_BIOSPAGE4_PAGEVERSION
;
827 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
829 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
830 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
834 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
835 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
836 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
843 * mpt3sas_config_get_bios_pg4 - read bios page 4
844 * @ioc: per adapter object
845 * @mpi_reply: reply mf payload returned from firmware
846 * @config_page: contents of the config page
847 * @sz_config_pg: sizeof the config page
850 * Return: 0 for success, non-zero for failure.
853 mpt3sas_config_get_bios_pg4(struct MPT3SAS_ADAPTER
*ioc
,
854 Mpi2ConfigReply_t
*mpi_reply
, Mpi2BiosPage4_t
*config_page
,
857 Mpi2ConfigRequest_t mpi_request
;
860 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
861 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
862 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
863 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_BIOS
;
864 mpi_request
.Header
.PageNumber
= 4;
865 mpi_request
.Header
.PageVersion
= MPI2_BIOSPAGE4_PAGEVERSION
;
866 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
867 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
868 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
873 * The sizeof the page is variable. Allow for just the
874 * size to be returned
876 if (config_page
&& sz_config_pg
) {
877 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
879 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
880 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
889 * mpt3sas_config_get_iounit_pg0 - obtain iounit page 0
890 * @ioc: per adapter object
891 * @mpi_reply: reply mf payload returned from firmware
892 * @config_page: contents of the config page
895 * Return: 0 for success, non-zero for failure.
898 mpt3sas_config_get_iounit_pg0(struct MPT3SAS_ADAPTER
*ioc
,
899 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOUnitPage0_t
*config_page
)
901 Mpi2ConfigRequest_t mpi_request
;
904 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
905 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
906 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
907 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IO_UNIT
;
908 mpi_request
.Header
.PageNumber
= 0;
909 mpi_request
.Header
.PageVersion
= MPI2_IOUNITPAGE0_PAGEVERSION
;
910 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
911 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
912 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
916 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
917 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
918 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
919 sizeof(*config_page
));
925 * mpt3sas_config_get_iounit_pg1 - obtain iounit page 1
926 * @ioc: per adapter object
927 * @mpi_reply: reply mf payload returned from firmware
928 * @config_page: contents of the config page
931 * Return: 0 for success, non-zero for failure.
934 mpt3sas_config_get_iounit_pg1(struct MPT3SAS_ADAPTER
*ioc
,
935 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOUnitPage1_t
*config_page
)
937 Mpi2ConfigRequest_t mpi_request
;
940 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
941 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
942 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
943 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IO_UNIT
;
944 mpi_request
.Header
.PageNumber
= 1;
945 mpi_request
.Header
.PageVersion
= MPI2_IOUNITPAGE1_PAGEVERSION
;
946 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
947 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
948 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
952 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
953 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
954 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
955 sizeof(*config_page
));
961 * mpt3sas_config_set_iounit_pg1 - set iounit page 1
962 * @ioc: per adapter object
963 * @mpi_reply: reply mf payload returned from firmware
964 * @config_page: contents of the config page
967 * Return: 0 for success, non-zero for failure.
970 mpt3sas_config_set_iounit_pg1(struct MPT3SAS_ADAPTER
*ioc
,
971 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOUnitPage1_t
*config_page
)
973 Mpi2ConfigRequest_t mpi_request
;
976 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
977 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
978 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
979 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IO_UNIT
;
980 mpi_request
.Header
.PageNumber
= 1;
981 mpi_request
.Header
.PageVersion
= MPI2_IOUNITPAGE1_PAGEVERSION
;
982 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
983 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
984 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
988 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
989 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
990 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
991 sizeof(*config_page
));
997 * mpt3sas_config_get_iounit_pg3 - obtain iounit page 3
998 * @ioc: per adapter object
999 * @mpi_reply: reply mf payload returned from firmware
1000 * @config_page: contents of the config page
1001 * @sz: size of buffer passed in config_page
1004 * Return: 0 for success, non-zero for failure.
1007 mpt3sas_config_get_iounit_pg3(struct MPT3SAS_ADAPTER
*ioc
,
1008 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOUnitPage3_t
*config_page
, u16 sz
)
1010 Mpi2ConfigRequest_t mpi_request
;
1013 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1014 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1015 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1016 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IO_UNIT
;
1017 mpi_request
.Header
.PageNumber
= 3;
1018 mpi_request
.Header
.PageVersion
= MPI2_IOUNITPAGE3_PAGEVERSION
;
1019 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1020 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1021 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1025 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1026 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1027 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
, sz
);
1033 * mpt3sas_config_get_iounit_pg8 - obtain iounit page 8
1034 * @ioc: per adapter object
1035 * @mpi_reply: reply mf payload returned from firmware
1036 * @config_page: contents of the config page
1039 * Return: 0 for success, non-zero for failure.
1042 mpt3sas_config_get_iounit_pg8(struct MPT3SAS_ADAPTER
*ioc
,
1043 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOUnitPage8_t
*config_page
)
1045 Mpi2ConfigRequest_t mpi_request
;
1048 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1049 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1050 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1051 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IO_UNIT
;
1052 mpi_request
.Header
.PageNumber
= 8;
1053 mpi_request
.Header
.PageVersion
= MPI2_IOUNITPAGE8_PAGEVERSION
;
1054 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1055 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1056 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1060 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1061 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1062 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1063 sizeof(*config_page
));
1069 * mpt3sas_config_get_ioc_pg8 - obtain ioc page 8
1070 * @ioc: per adapter object
1071 * @mpi_reply: reply mf payload returned from firmware
1072 * @config_page: contents of the config page
1075 * Return: 0 for success, non-zero for failure.
1078 mpt3sas_config_get_ioc_pg8(struct MPT3SAS_ADAPTER
*ioc
,
1079 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOCPage8_t
*config_page
)
1081 Mpi2ConfigRequest_t mpi_request
;
1084 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1085 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1086 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1087 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IOC
;
1088 mpi_request
.Header
.PageNumber
= 8;
1089 mpi_request
.Header
.PageVersion
= MPI2_IOCPAGE8_PAGEVERSION
;
1090 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1091 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1092 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1096 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1097 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1098 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1099 sizeof(*config_page
));
1104 * mpt3sas_config_get_ioc_pg1 - obtain ioc page 1
1105 * @ioc: per adapter object
1106 * @mpi_reply: reply mf payload returned from firmware
1107 * @config_page: contents of the config page
1110 * Return: 0 for success, non-zero for failure.
1113 mpt3sas_config_get_ioc_pg1(struct MPT3SAS_ADAPTER
*ioc
,
1114 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOCPage1_t
*config_page
)
1116 Mpi2ConfigRequest_t mpi_request
;
1119 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1120 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1121 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1122 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IOC
;
1123 mpi_request
.Header
.PageNumber
= 1;
1124 mpi_request
.Header
.PageVersion
= MPI2_IOCPAGE8_PAGEVERSION
;
1125 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1126 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1127 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1131 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1132 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1133 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1134 sizeof(*config_page
));
1140 * mpt3sas_config_set_ioc_pg1 - modify ioc page 1
1141 * @ioc: per adapter object
1142 * @mpi_reply: reply mf payload returned from firmware
1143 * @config_page: contents of the config page
1146 * Return: 0 for success, non-zero for failure.
1149 mpt3sas_config_set_ioc_pg1(struct MPT3SAS_ADAPTER
*ioc
,
1150 Mpi2ConfigReply_t
*mpi_reply
, Mpi2IOCPage1_t
*config_page
)
1152 Mpi2ConfigRequest_t mpi_request
;
1155 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1156 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1157 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1158 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_IOC
;
1159 mpi_request
.Header
.PageNumber
= 1;
1160 mpi_request
.Header
.PageVersion
= MPI2_IOCPAGE8_PAGEVERSION
;
1161 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1162 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1163 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1167 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
1168 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1169 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1170 sizeof(*config_page
));
1176 * mpt3sas_config_get_sas_device_pg0 - obtain sas device page 0
1177 * @ioc: per adapter object
1178 * @mpi_reply: reply mf payload returned from firmware
1179 * @config_page: contents of the config page
1180 * @form: GET_NEXT_HANDLE or HANDLE
1181 * @handle: device handle
1184 * Return: 0 for success, non-zero for failure.
1187 mpt3sas_config_get_sas_device_pg0(struct MPT3SAS_ADAPTER
*ioc
,
1188 Mpi2ConfigReply_t
*mpi_reply
, Mpi2SasDevicePage0_t
*config_page
,
1189 u32 form
, u32 handle
)
1191 Mpi2ConfigRequest_t mpi_request
;
1194 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1195 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1196 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1197 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1198 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_DEVICE
;
1199 mpi_request
.Header
.PageVersion
= MPI2_SASDEVICE0_PAGEVERSION
;
1200 mpi_request
.Header
.PageNumber
= 0;
1201 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1202 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1203 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1207 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1208 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1209 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1210 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1211 sizeof(*config_page
));
1217 * mpt3sas_config_get_sas_device_pg1 - obtain sas device page 1
1218 * @ioc: per adapter object
1219 * @mpi_reply: reply mf payload returned from firmware
1220 * @config_page: contents of the config page
1221 * @form: GET_NEXT_HANDLE or HANDLE
1222 * @handle: device handle
1225 * Return: 0 for success, non-zero for failure.
1228 mpt3sas_config_get_sas_device_pg1(struct MPT3SAS_ADAPTER
*ioc
,
1229 Mpi2ConfigReply_t
*mpi_reply
, Mpi2SasDevicePage1_t
*config_page
,
1230 u32 form
, u32 handle
)
1232 Mpi2ConfigRequest_t mpi_request
;
1235 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1236 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1237 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1238 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1239 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_DEVICE
;
1240 mpi_request
.Header
.PageVersion
= MPI2_SASDEVICE1_PAGEVERSION
;
1241 mpi_request
.Header
.PageNumber
= 1;
1242 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1243 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1244 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1248 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1249 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1250 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1251 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1252 sizeof(*config_page
));
1258 * mpt3sas_config_get_pcie_device_pg0 - obtain pcie device page 0
1259 * @ioc: per adapter object
1260 * @mpi_reply: reply mf payload returned from firmware
1261 * @config_page: contents of the config page
1262 * @form: GET_NEXT_HANDLE or HANDLE
1263 * @handle: device handle
1266 * Return: 0 for success, non-zero for failure.
1269 mpt3sas_config_get_pcie_device_pg0(struct MPT3SAS_ADAPTER
*ioc
,
1270 Mpi2ConfigReply_t
*mpi_reply
, Mpi26PCIeDevicePage0_t
*config_page
,
1271 u32 form
, u32 handle
)
1273 Mpi2ConfigRequest_t mpi_request
;
1276 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1277 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1278 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1279 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1280 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_PCIE_DEVICE
;
1281 mpi_request
.Header
.PageVersion
= MPI26_PCIEDEVICE0_PAGEVERSION
;
1282 mpi_request
.Header
.PageNumber
= 0;
1283 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1284 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1285 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1289 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1290 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1291 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1292 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1293 sizeof(*config_page
));
1299 * mpt3sas_config_get_pcie_iounit_pg1 - obtain pcie iounit page 1
1300 * @ioc: per adapter object
1301 * @mpi_reply: reply mf payload returned from firmware
1302 * @config_page: contents of the config page
1303 * @sz: size of buffer passed in config_page
1306 * Returns 0 for success, non-zero for failure.
1309 mpt3sas_config_get_pcie_iounit_pg1(struct MPT3SAS_ADAPTER
*ioc
,
1310 Mpi2ConfigReply_t
*mpi_reply
, Mpi26PCIeIOUnitPage1_t
*config_page
,
1313 Mpi2ConfigRequest_t mpi_request
;
1316 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1317 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1318 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1319 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1320 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_PCIE_IO_UNIT
;
1321 mpi_request
.Header
.PageVersion
= MPI26_PCIEIOUNITPAGE1_PAGEVERSION
;
1322 mpi_request
.Header
.PageNumber
= 1;
1323 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1324 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1325 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1328 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1329 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1330 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
, sz
);
1336 * mpt3sas_config_get_pcie_device_pg2 - obtain pcie device page 2
1337 * @ioc: per adapter object
1338 * @mpi_reply: reply mf payload returned from firmware
1339 * @config_page: contents of the config page
1340 * @form: GET_NEXT_HANDLE or HANDLE
1341 * @handle: device handle
1344 * Return: 0 for success, non-zero for failure.
1347 mpt3sas_config_get_pcie_device_pg2(struct MPT3SAS_ADAPTER
*ioc
,
1348 Mpi2ConfigReply_t
*mpi_reply
, Mpi26PCIeDevicePage2_t
*config_page
,
1349 u32 form
, u32 handle
)
1351 Mpi2ConfigRequest_t mpi_request
;
1354 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1355 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1356 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1357 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1358 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_PCIE_DEVICE
;
1359 mpi_request
.Header
.PageVersion
= MPI26_PCIEDEVICE2_PAGEVERSION
;
1360 mpi_request
.Header
.PageNumber
= 2;
1361 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1362 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1363 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1367 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1368 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1369 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1370 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1371 sizeof(*config_page
));
1377 * mpt3sas_config_get_number_hba_phys - obtain number of phys on the host
1378 * @ioc: per adapter object
1379 * @num_phys: pointer returned with the number of phys
1382 * Return: 0 for success, non-zero for failure.
1385 mpt3sas_config_get_number_hba_phys(struct MPT3SAS_ADAPTER
*ioc
, u8
*num_phys
)
1387 Mpi2ConfigRequest_t mpi_request
;
1390 Mpi2ConfigReply_t mpi_reply
;
1391 Mpi2SasIOUnitPage0_t config_page
;
1394 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1395 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1396 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1397 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1398 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT
;
1399 mpi_request
.Header
.PageNumber
= 0;
1400 mpi_request
.Header
.PageVersion
= MPI2_SASIOUNITPAGE0_PAGEVERSION
;
1401 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1402 r
= _config_request(ioc
, &mpi_request
, &mpi_reply
,
1403 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1407 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1408 r
= _config_request(ioc
, &mpi_request
, &mpi_reply
,
1409 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, &config_page
,
1410 sizeof(Mpi2SasIOUnitPage0_t
));
1412 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
1413 MPI2_IOCSTATUS_MASK
;
1414 if (ioc_status
== MPI2_IOCSTATUS_SUCCESS
)
1415 *num_phys
= config_page
.NumPhys
;
1422 * mpt3sas_config_get_sas_iounit_pg0 - obtain sas iounit page 0
1423 * @ioc: per adapter object
1424 * @mpi_reply: reply mf payload returned from firmware
1425 * @config_page: contents of the config page
1426 * @sz: size of buffer passed in config_page
1429 * Calling function should call config_get_number_hba_phys prior to
1430 * this function, so enough memory is allocated for config_page.
1432 * Return: 0 for success, non-zero for failure.
1435 mpt3sas_config_get_sas_iounit_pg0(struct MPT3SAS_ADAPTER
*ioc
,
1436 Mpi2ConfigReply_t
*mpi_reply
, Mpi2SasIOUnitPage0_t
*config_page
,
1439 Mpi2ConfigRequest_t mpi_request
;
1442 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1443 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1444 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1445 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1446 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT
;
1447 mpi_request
.Header
.PageNumber
= 0;
1448 mpi_request
.Header
.PageVersion
= MPI2_SASIOUNITPAGE0_PAGEVERSION
;
1449 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1450 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1451 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1455 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1456 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1457 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
, sz
);
1463 * mpt3sas_config_get_sas_iounit_pg1 - obtain sas iounit page 1
1464 * @ioc: per adapter object
1465 * @mpi_reply: reply mf payload returned from firmware
1466 * @config_page: contents of the config page
1467 * @sz: size of buffer passed in config_page
1470 * Calling function should call config_get_number_hba_phys prior to
1471 * this function, so enough memory is allocated for config_page.
1473 * Return: 0 for success, non-zero for failure.
1476 mpt3sas_config_get_sas_iounit_pg1(struct MPT3SAS_ADAPTER
*ioc
,
1477 Mpi2ConfigReply_t
*mpi_reply
, Mpi2SasIOUnitPage1_t
*config_page
,
1480 Mpi2ConfigRequest_t mpi_request
;
1483 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1484 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1485 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1486 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1487 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT
;
1488 mpi_request
.Header
.PageNumber
= 1;
1489 mpi_request
.Header
.PageVersion
= MPI2_SASIOUNITPAGE1_PAGEVERSION
;
1490 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1491 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1492 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1496 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1497 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1498 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
, sz
);
1504 * mpt3sas_config_set_sas_iounit_pg1 - send sas iounit page 1
1505 * @ioc: per adapter object
1506 * @mpi_reply: reply mf payload returned from firmware
1507 * @config_page: contents of the config page
1508 * @sz: size of buffer passed in config_page
1511 * Calling function should call config_get_number_hba_phys prior to
1512 * this function, so enough memory is allocated for config_page.
1514 * Return: 0 for success, non-zero for failure.
1517 mpt3sas_config_set_sas_iounit_pg1(struct MPT3SAS_ADAPTER
*ioc
,
1518 Mpi2ConfigReply_t
*mpi_reply
, Mpi2SasIOUnitPage1_t
*config_page
,
1521 Mpi2ConfigRequest_t mpi_request
;
1524 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1525 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1526 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1527 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1528 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT
;
1529 mpi_request
.Header
.PageNumber
= 1;
1530 mpi_request
.Header
.PageVersion
= MPI2_SASIOUNITPAGE1_PAGEVERSION
;
1531 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1532 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1533 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1537 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
1538 _config_request(ioc
, &mpi_request
, mpi_reply
,
1539 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
, sz
);
1540 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM
;
1541 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1542 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
, sz
);
1548 * mpt3sas_config_get_expander_pg0 - obtain expander page 0
1549 * @ioc: per adapter object
1550 * @mpi_reply: reply mf payload returned from firmware
1551 * @config_page: contents of the config page
1552 * @form: GET_NEXT_HANDLE or HANDLE
1553 * @handle: expander handle
1556 * Return: 0 for success, non-zero for failure.
1559 mpt3sas_config_get_expander_pg0(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1560 *mpi_reply
, Mpi2ExpanderPage0_t
*config_page
, u32 form
, u32 handle
)
1562 Mpi2ConfigRequest_t mpi_request
;
1565 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1566 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1567 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1568 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1569 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_EXPANDER
;
1570 mpi_request
.Header
.PageNumber
= 0;
1571 mpi_request
.Header
.PageVersion
= MPI2_SASEXPANDER0_PAGEVERSION
;
1572 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1573 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1574 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1578 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1579 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1580 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1581 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1582 sizeof(*config_page
));
1588 * mpt3sas_config_get_expander_pg1 - obtain expander page 1
1589 * @ioc: per adapter object
1590 * @mpi_reply: reply mf payload returned from firmware
1591 * @config_page: contents of the config page
1592 * @phy_number: phy number
1593 * @handle: expander handle
1596 * Return: 0 for success, non-zero for failure.
1599 mpt3sas_config_get_expander_pg1(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1600 *mpi_reply
, Mpi2ExpanderPage1_t
*config_page
, u32 phy_number
,
1603 Mpi2ConfigRequest_t mpi_request
;
1606 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1607 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1608 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1609 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1610 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_EXPANDER
;
1611 mpi_request
.Header
.PageNumber
= 1;
1612 mpi_request
.Header
.PageVersion
= MPI2_SASEXPANDER1_PAGEVERSION
;
1613 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1614 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1615 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1619 mpi_request
.PageAddress
=
1620 cpu_to_le32(MPI2_SAS_EXPAND_PGAD_FORM_HNDL_PHY_NUM
|
1621 (phy_number
<< MPI2_SAS_EXPAND_PGAD_PHYNUM_SHIFT
) | handle
);
1622 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1623 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1624 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1625 sizeof(*config_page
));
1631 * mpt3sas_config_get_enclosure_pg0 - obtain enclosure page 0
1632 * @ioc: per adapter object
1633 * @mpi_reply: reply mf payload returned from firmware
1634 * @config_page: contents of the config page
1635 * @form: GET_NEXT_HANDLE or HANDLE
1636 * @handle: expander handle
1639 * Return: 0 for success, non-zero for failure.
1642 mpt3sas_config_get_enclosure_pg0(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1643 *mpi_reply
, Mpi2SasEnclosurePage0_t
*config_page
, u32 form
, u32 handle
)
1645 Mpi2ConfigRequest_t mpi_request
;
1648 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1649 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1650 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1651 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1652 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_ENCLOSURE
;
1653 mpi_request
.Header
.PageNumber
= 0;
1654 mpi_request
.Header
.PageVersion
= MPI2_SASENCLOSURE0_PAGEVERSION
;
1655 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1656 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1657 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1661 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1662 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1663 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1664 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1665 sizeof(*config_page
));
1671 * mpt3sas_config_get_phy_pg0 - obtain phy page 0
1672 * @ioc: per adapter object
1673 * @mpi_reply: reply mf payload returned from firmware
1674 * @config_page: contents of the config page
1675 * @phy_number: phy number
1678 * Return: 0 for success, non-zero for failure.
1681 mpt3sas_config_get_phy_pg0(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1682 *mpi_reply
, Mpi2SasPhyPage0_t
*config_page
, u32 phy_number
)
1684 Mpi2ConfigRequest_t mpi_request
;
1687 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1688 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1689 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1690 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1691 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_PHY
;
1692 mpi_request
.Header
.PageNumber
= 0;
1693 mpi_request
.Header
.PageVersion
= MPI2_SASPHY0_PAGEVERSION
;
1694 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1695 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1696 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1700 mpi_request
.PageAddress
=
1701 cpu_to_le32(MPI2_SAS_PHY_PGAD_FORM_PHY_NUMBER
| phy_number
);
1702 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1703 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1704 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1705 sizeof(*config_page
));
1711 * mpt3sas_config_get_phy_pg1 - obtain phy page 1
1712 * @ioc: per adapter object
1713 * @mpi_reply: reply mf payload returned from firmware
1714 * @config_page: contents of the config page
1715 * @phy_number: phy number
1718 * Return: 0 for success, non-zero for failure.
1721 mpt3sas_config_get_phy_pg1(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1722 *mpi_reply
, Mpi2SasPhyPage1_t
*config_page
, u32 phy_number
)
1724 Mpi2ConfigRequest_t mpi_request
;
1727 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1728 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1729 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1730 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1731 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_SAS_PHY
;
1732 mpi_request
.Header
.PageNumber
= 1;
1733 mpi_request
.Header
.PageVersion
= MPI2_SASPHY1_PAGEVERSION
;
1734 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1735 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1736 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1740 mpi_request
.PageAddress
=
1741 cpu_to_le32(MPI2_SAS_PHY_PGAD_FORM_PHY_NUMBER
| phy_number
);
1742 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1743 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1744 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1745 sizeof(*config_page
));
1751 * mpt3sas_config_get_raid_volume_pg1 - obtain raid volume page 1
1752 * @ioc: per adapter object
1753 * @mpi_reply: reply mf payload returned from firmware
1754 * @config_page: contents of the config page
1755 * @form: GET_NEXT_HANDLE or HANDLE
1756 * @handle: volume handle
1759 * Return: 0 for success, non-zero for failure.
1762 mpt3sas_config_get_raid_volume_pg1(struct MPT3SAS_ADAPTER
*ioc
,
1763 Mpi2ConfigReply_t
*mpi_reply
, Mpi2RaidVolPage1_t
*config_page
, u32 form
,
1766 Mpi2ConfigRequest_t mpi_request
;
1769 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1770 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1771 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1772 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_RAID_VOLUME
;
1773 mpi_request
.Header
.PageNumber
= 1;
1774 mpi_request
.Header
.PageVersion
= MPI2_RAIDVOLPAGE1_PAGEVERSION
;
1775 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1776 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1777 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1781 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1782 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1783 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1784 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1785 sizeof(*config_page
));
1791 * mpt3sas_config_get_number_pds - obtain number of phys disk assigned to volume
1792 * @ioc: per adapter object
1793 * @handle: volume handle
1794 * @num_pds: returns pds count
1797 * Return: 0 for success, non-zero for failure.
1800 mpt3sas_config_get_number_pds(struct MPT3SAS_ADAPTER
*ioc
, u16 handle
,
1803 Mpi2ConfigRequest_t mpi_request
;
1804 Mpi2RaidVolPage0_t config_page
;
1805 Mpi2ConfigReply_t mpi_reply
;
1809 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1811 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1812 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1813 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_RAID_VOLUME
;
1814 mpi_request
.Header
.PageNumber
= 0;
1815 mpi_request
.Header
.PageVersion
= MPI2_RAIDVOLPAGE0_PAGEVERSION
;
1816 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1817 r
= _config_request(ioc
, &mpi_request
, &mpi_reply
,
1818 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1822 mpi_request
.PageAddress
=
1823 cpu_to_le32(MPI2_RAID_VOLUME_PGAD_FORM_HANDLE
| handle
);
1824 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1825 r
= _config_request(ioc
, &mpi_request
, &mpi_reply
,
1826 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, &config_page
,
1827 sizeof(Mpi2RaidVolPage0_t
));
1829 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
1830 MPI2_IOCSTATUS_MASK
;
1831 if (ioc_status
== MPI2_IOCSTATUS_SUCCESS
)
1832 *num_pds
= config_page
.NumPhysDisks
;
1840 * mpt3sas_config_get_raid_volume_pg0 - obtain raid volume page 0
1841 * @ioc: per adapter object
1842 * @mpi_reply: reply mf payload returned from firmware
1843 * @config_page: contents of the config page
1844 * @form: GET_NEXT_HANDLE or HANDLE
1845 * @handle: volume handle
1846 * @sz: size of buffer passed in config_page
1849 * Return: 0 for success, non-zero for failure.
1852 mpt3sas_config_get_raid_volume_pg0(struct MPT3SAS_ADAPTER
*ioc
,
1853 Mpi2ConfigReply_t
*mpi_reply
, Mpi2RaidVolPage0_t
*config_page
, u32 form
,
1856 Mpi2ConfigRequest_t mpi_request
;
1859 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1860 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1861 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1862 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_RAID_VOLUME
;
1863 mpi_request
.Header
.PageNumber
= 0;
1864 mpi_request
.Header
.PageVersion
= MPI2_RAIDVOLPAGE0_PAGEVERSION
;
1865 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1866 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1867 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1871 mpi_request
.PageAddress
= cpu_to_le32(form
| handle
);
1872 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1873 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1874 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
, sz
);
1880 * mpt3sas_config_get_phys_disk_pg0 - obtain phys disk page 0
1881 * @ioc: per adapter object
1882 * @mpi_reply: reply mf payload returned from firmware
1883 * @config_page: contents of the config page
1884 * @form: GET_NEXT_PHYSDISKNUM, PHYSDISKNUM, DEVHANDLE
1885 * @form_specific: specific to the form
1888 * Return: 0 for success, non-zero for failure.
1891 mpt3sas_config_get_phys_disk_pg0(struct MPT3SAS_ADAPTER
*ioc
, Mpi2ConfigReply_t
1892 *mpi_reply
, Mpi2RaidPhysDiskPage0_t
*config_page
, u32 form
,
1895 Mpi2ConfigRequest_t mpi_request
;
1898 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1899 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1900 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1901 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_RAID_PHYSDISK
;
1902 mpi_request
.Header
.PageNumber
= 0;
1903 mpi_request
.Header
.PageVersion
= MPI2_RAIDPHYSDISKPAGE0_PAGEVERSION
;
1904 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1905 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1906 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1910 mpi_request
.PageAddress
= cpu_to_le32(form
| form_specific
);
1911 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1912 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1913 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1914 sizeof(*config_page
));
1920 * mpt3sas_config_get_driver_trigger_pg0 - obtain driver trigger page 0
1921 * @ioc: per adapter object
1922 * @mpi_reply: reply mf payload returned from firmware
1923 * @config_page: contents of the config page
1926 * Returns 0 for success, non-zero for failure.
1929 mpt3sas_config_get_driver_trigger_pg0(struct MPT3SAS_ADAPTER
*ioc
,
1930 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage0_t
*config_page
)
1932 Mpi2ConfigRequest_t mpi_request
;
1935 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1936 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1937 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1938 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1939 mpi_request
.ExtPageType
=
1940 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
1941 mpi_request
.Header
.PageNumber
= 0;
1942 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE0_PAGEVERSION
;
1943 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1944 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1945 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1949 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
1950 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1951 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1952 sizeof(*config_page
));
1958 * _config_set_driver_trigger_pg0 - write driver trigger page 0
1959 * @ioc: per adapter object
1960 * @mpi_reply: reply mf payload returned from firmware
1961 * @config_page: contents of the config page
1964 * Returns 0 for success, non-zero for failure.
1967 _config_set_driver_trigger_pg0(struct MPT3SAS_ADAPTER
*ioc
,
1968 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage0_t
*config_page
)
1970 Mpi2ConfigRequest_t mpi_request
;
1973 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
1974 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
1975 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
1976 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
1977 mpi_request
.ExtPageType
=
1978 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
1979 mpi_request
.Header
.PageNumber
= 0;
1980 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE0_PAGEVERSION
;
1981 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
1982 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1983 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
1987 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
1988 _config_request(ioc
, &mpi_request
, mpi_reply
,
1989 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1990 sizeof(*config_page
));
1991 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM
;
1992 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
1993 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
1994 sizeof(*config_page
));
2000 * mpt3sas_config_update_driver_trigger_pg0 - update driver trigger page 0
2001 * @ioc: per adapter object
2002 * @trigger_flag: trigger type bit map
2003 * @set: set ot clear trigger values
2006 * Returns 0 for success, non-zero for failure.
2009 mpt3sas_config_update_driver_trigger_pg0(struct MPT3SAS_ADAPTER
*ioc
,
2010 u16 trigger_flag
, bool set
)
2012 Mpi26DriverTriggerPage0_t tg_pg0
;
2013 Mpi2ConfigReply_t mpi_reply
;
2015 u16 flags
, ioc_status
;
2017 rc
= mpt3sas_config_get_driver_trigger_pg0(ioc
, &mpi_reply
, &tg_pg0
);
2020 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2021 MPI2_IOCSTATUS_MASK
;
2022 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2025 "%s: Failed to get trigger pg0, ioc_status(0x%04x)\n",
2026 __func__
, ioc_status
));
2031 flags
= le16_to_cpu(tg_pg0
.TriggerFlags
) | trigger_flag
;
2033 flags
= le16_to_cpu(tg_pg0
.TriggerFlags
) & ~trigger_flag
;
2035 tg_pg0
.TriggerFlags
= cpu_to_le16(flags
);
2037 rc
= _config_set_driver_trigger_pg0(ioc
, &mpi_reply
, &tg_pg0
);
2040 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2041 MPI2_IOCSTATUS_MASK
;
2042 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2045 "%s: Failed to update trigger pg0, ioc_status(0x%04x)\n",
2046 __func__
, ioc_status
));
2054 * mpt3sas_config_get_driver_trigger_pg1 - obtain driver trigger page 1
2055 * @ioc: per adapter object
2056 * @mpi_reply: reply mf payload returned from firmware
2057 * @config_page: contents of the config page
2060 * Returns 0 for success, non-zero for failure.
2063 mpt3sas_config_get_driver_trigger_pg1(struct MPT3SAS_ADAPTER
*ioc
,
2064 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage1_t
*config_page
)
2066 Mpi2ConfigRequest_t mpi_request
;
2069 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2070 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2071 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2072 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2073 mpi_request
.ExtPageType
=
2074 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2075 mpi_request
.Header
.PageNumber
= 1;
2076 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE1_PAGEVERSION
;
2077 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2078 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2079 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2083 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
2084 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2085 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2086 sizeof(*config_page
));
2092 * _config_set_driver_trigger_pg1 - write driver trigger page 1
2093 * @ioc: per adapter object
2094 * @mpi_reply: reply mf payload returned from firmware
2095 * @config_page: contents of the config page
2098 * Returns 0 for success, non-zero for failure.
2101 _config_set_driver_trigger_pg1(struct MPT3SAS_ADAPTER
*ioc
,
2102 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage1_t
*config_page
)
2104 Mpi2ConfigRequest_t mpi_request
;
2107 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2108 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2109 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2110 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2111 mpi_request
.ExtPageType
=
2112 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2113 mpi_request
.Header
.PageNumber
= 1;
2114 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE1_PAGEVERSION
;
2115 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2116 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2117 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2121 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
2122 _config_request(ioc
, &mpi_request
, mpi_reply
,
2123 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2124 sizeof(*config_page
));
2125 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM
;
2126 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2127 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2128 sizeof(*config_page
));
2134 * mpt3sas_config_update_driver_trigger_pg1 - update driver trigger page 1
2135 * @ioc: per adapter object
2136 * @master_tg: Master trigger bit map
2137 * @set: set ot clear trigger values
2140 * Returns 0 for success, non-zero for failure.
2143 mpt3sas_config_update_driver_trigger_pg1(struct MPT3SAS_ADAPTER
*ioc
,
2144 struct SL_WH_MASTER_TRIGGER_T
*master_tg
, bool set
)
2146 Mpi26DriverTriggerPage1_t tg_pg1
;
2147 Mpi2ConfigReply_t mpi_reply
;
2151 rc
= mpt3sas_config_update_driver_trigger_pg0(ioc
,
2152 MPI26_DRIVER_TRIGGER0_FLAG_MASTER_TRIGGER_VALID
, set
);
2156 rc
= mpt3sas_config_get_driver_trigger_pg1(ioc
, &mpi_reply
, &tg_pg1
);
2160 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2161 MPI2_IOCSTATUS_MASK
;
2162 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2165 "%s: Failed to get trigger pg1, ioc_status(0x%04x)\n",
2166 __func__
, ioc_status
));
2172 tg_pg1
.NumMasterTrigger
= cpu_to_le16(1);
2173 tg_pg1
.MasterTriggers
[0].MasterTriggerFlags
= cpu_to_le32(
2174 master_tg
->MasterData
);
2176 tg_pg1
.NumMasterTrigger
= 0;
2177 tg_pg1
.MasterTriggers
[0].MasterTriggerFlags
= 0;
2180 rc
= _config_set_driver_trigger_pg1(ioc
, &mpi_reply
, &tg_pg1
);
2184 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2185 MPI2_IOCSTATUS_MASK
;
2186 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2189 "%s: Failed to get trigger pg1, ioc_status(0x%04x)\n",
2190 __func__
, ioc_status
));
2198 mpt3sas_config_update_driver_trigger_pg0(ioc
,
2199 MPI26_DRIVER_TRIGGER0_FLAG_MASTER_TRIGGER_VALID
, !set
);
2205 * mpt3sas_config_get_driver_trigger_pg2 - obtain driver trigger page 2
2206 * @ioc: per adapter object
2207 * @mpi_reply: reply mf payload returned from firmware
2208 * @config_page: contents of the config page
2211 * Returns 0 for success, non-zero for failure.
2214 mpt3sas_config_get_driver_trigger_pg2(struct MPT3SAS_ADAPTER
*ioc
,
2215 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage2_t
*config_page
)
2217 Mpi2ConfigRequest_t mpi_request
;
2220 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2221 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2222 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2223 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2224 mpi_request
.ExtPageType
=
2225 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2226 mpi_request
.Header
.PageNumber
= 2;
2227 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE2_PAGEVERSION
;
2228 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2229 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2230 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2234 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
2235 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2236 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2237 sizeof(*config_page
));
2243 * _config_set_driver_trigger_pg2 - write driver trigger page 2
2244 * @ioc: per adapter object
2245 * @mpi_reply: reply mf payload returned from firmware
2246 * @config_page: contents of the config page
2249 * Returns 0 for success, non-zero for failure.
2252 _config_set_driver_trigger_pg2(struct MPT3SAS_ADAPTER
*ioc
,
2253 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage2_t
*config_page
)
2255 Mpi2ConfigRequest_t mpi_request
;
2258 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2259 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2260 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2261 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2262 mpi_request
.ExtPageType
=
2263 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2264 mpi_request
.Header
.PageNumber
= 2;
2265 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE2_PAGEVERSION
;
2266 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2267 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2268 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2272 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
2273 _config_request(ioc
, &mpi_request
, mpi_reply
,
2274 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2275 sizeof(*config_page
));
2276 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM
;
2277 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2278 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2279 sizeof(*config_page
));
2285 * mpt3sas_config_update_driver_trigger_pg2 - update driver trigger page 2
2286 * @ioc: per adapter object
2287 * @event_tg: list of Event Triggers
2288 * @set: set ot clear trigger values
2291 * Returns 0 for success, non-zero for failure.
2294 mpt3sas_config_update_driver_trigger_pg2(struct MPT3SAS_ADAPTER
*ioc
,
2295 struct SL_WH_EVENT_TRIGGERS_T
*event_tg
, bool set
)
2297 Mpi26DriverTriggerPage2_t tg_pg2
;
2298 Mpi2ConfigReply_t mpi_reply
;
2302 rc
= mpt3sas_config_update_driver_trigger_pg0(ioc
,
2303 MPI26_DRIVER_TRIGGER0_FLAG_MPI_EVENT_TRIGGER_VALID
, set
);
2307 rc
= mpt3sas_config_get_driver_trigger_pg2(ioc
, &mpi_reply
, &tg_pg2
);
2311 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2312 MPI2_IOCSTATUS_MASK
;
2313 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2316 "%s: Failed to get trigger pg2, ioc_status(0x%04x)\n",
2317 __func__
, ioc_status
));
2323 count
= event_tg
->ValidEntries
;
2324 tg_pg2
.NumMPIEventTrigger
= cpu_to_le16(count
);
2325 for (i
= 0; i
< count
; i
++) {
2326 tg_pg2
.MPIEventTriggers
[i
].MPIEventCode
=
2328 event_tg
->EventTriggerEntry
[i
].EventValue
);
2329 tg_pg2
.MPIEventTriggers
[i
].MPIEventCodeSpecific
=
2331 event_tg
->EventTriggerEntry
[i
].LogEntryQualifier
);
2334 tg_pg2
.NumMPIEventTrigger
= 0;
2335 memset(&tg_pg2
.MPIEventTriggers
[0], 0,
2336 NUM_VALID_ENTRIES
* sizeof(
2337 MPI26_DRIVER_MPI_EVENT_TRIGGER_ENTRY
));
2340 rc
= _config_set_driver_trigger_pg2(ioc
, &mpi_reply
, &tg_pg2
);
2344 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2345 MPI2_IOCSTATUS_MASK
;
2346 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2349 "%s: Failed to get trigger pg2, ioc_status(0x%04x)\n",
2350 __func__
, ioc_status
));
2358 mpt3sas_config_update_driver_trigger_pg0(ioc
,
2359 MPI26_DRIVER_TRIGGER0_FLAG_MPI_EVENT_TRIGGER_VALID
, !set
);
2365 * mpt3sas_config_get_driver_trigger_pg3 - obtain driver trigger page 3
2366 * @ioc: per adapter object
2367 * @mpi_reply: reply mf payload returned from firmware
2368 * @config_page: contents of the config page
2371 * Returns 0 for success, non-zero for failure.
2374 mpt3sas_config_get_driver_trigger_pg3(struct MPT3SAS_ADAPTER
*ioc
,
2375 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage3_t
*config_page
)
2377 Mpi2ConfigRequest_t mpi_request
;
2380 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2381 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2382 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2383 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2384 mpi_request
.ExtPageType
=
2385 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2386 mpi_request
.Header
.PageNumber
= 3;
2387 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE3_PAGEVERSION
;
2388 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2389 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2390 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2394 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
2395 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2396 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2397 sizeof(*config_page
));
2403 * _config_set_driver_trigger_pg3 - write driver trigger page 3
2404 * @ioc: per adapter object
2405 * @mpi_reply: reply mf payload returned from firmware
2406 * @config_page: contents of the config page
2409 * Returns 0 for success, non-zero for failure.
2412 _config_set_driver_trigger_pg3(struct MPT3SAS_ADAPTER
*ioc
,
2413 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage3_t
*config_page
)
2415 Mpi2ConfigRequest_t mpi_request
;
2418 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2419 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2420 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2421 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2422 mpi_request
.ExtPageType
=
2423 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2424 mpi_request
.Header
.PageNumber
= 3;
2425 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE3_PAGEVERSION
;
2426 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2427 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2428 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2432 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
2433 _config_request(ioc
, &mpi_request
, mpi_reply
,
2434 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2435 sizeof(*config_page
));
2436 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM
;
2437 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2438 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2439 sizeof(*config_page
));
2445 * mpt3sas_config_update_driver_trigger_pg3 - update driver trigger page 3
2446 * @ioc: per adapter object
2447 * @scsi_tg: scsi trigger list
2448 * @set: set ot clear trigger values
2451 * Returns 0 for success, non-zero for failure.
2454 mpt3sas_config_update_driver_trigger_pg3(struct MPT3SAS_ADAPTER
*ioc
,
2455 struct SL_WH_SCSI_TRIGGERS_T
*scsi_tg
, bool set
)
2457 Mpi26DriverTriggerPage3_t tg_pg3
;
2458 Mpi2ConfigReply_t mpi_reply
;
2462 rc
= mpt3sas_config_update_driver_trigger_pg0(ioc
,
2463 MPI26_DRIVER_TRIGGER0_FLAG_SCSI_SENSE_TRIGGER_VALID
, set
);
2467 rc
= mpt3sas_config_get_driver_trigger_pg3(ioc
, &mpi_reply
, &tg_pg3
);
2471 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2472 MPI2_IOCSTATUS_MASK
;
2473 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2476 "%s: Failed to get trigger pg3, ioc_status(0x%04x)\n",
2477 __func__
, ioc_status
));
2482 count
= scsi_tg
->ValidEntries
;
2483 tg_pg3
.NumSCSISenseTrigger
= cpu_to_le16(count
);
2484 for (i
= 0; i
< count
; i
++) {
2485 tg_pg3
.SCSISenseTriggers
[i
].ASCQ
=
2486 scsi_tg
->SCSITriggerEntry
[i
].ASCQ
;
2487 tg_pg3
.SCSISenseTriggers
[i
].ASC
=
2488 scsi_tg
->SCSITriggerEntry
[i
].ASC
;
2489 tg_pg3
.SCSISenseTriggers
[i
].SenseKey
=
2490 scsi_tg
->SCSITriggerEntry
[i
].SenseKey
;
2493 tg_pg3
.NumSCSISenseTrigger
= 0;
2494 memset(&tg_pg3
.SCSISenseTriggers
[0], 0,
2495 NUM_VALID_ENTRIES
* sizeof(
2496 MPI26_DRIVER_SCSI_SENSE_TRIGGER_ENTRY
));
2499 rc
= _config_set_driver_trigger_pg3(ioc
, &mpi_reply
, &tg_pg3
);
2503 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2504 MPI2_IOCSTATUS_MASK
;
2505 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2508 "%s: Failed to get trigger pg3, ioc_status(0x%04x)\n",
2509 __func__
, ioc_status
));
2515 mpt3sas_config_update_driver_trigger_pg0(ioc
,
2516 MPI26_DRIVER_TRIGGER0_FLAG_SCSI_SENSE_TRIGGER_VALID
, !set
);
2522 * mpt3sas_config_get_driver_trigger_pg4 - obtain driver trigger page 4
2523 * @ioc: per adapter object
2524 * @mpi_reply: reply mf payload returned from firmware
2525 * @config_page: contents of the config page
2528 * Returns 0 for success, non-zero for failure.
2531 mpt3sas_config_get_driver_trigger_pg4(struct MPT3SAS_ADAPTER
*ioc
,
2532 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage4_t
*config_page
)
2534 Mpi2ConfigRequest_t mpi_request
;
2537 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2538 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2539 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2540 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2541 mpi_request
.ExtPageType
=
2542 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2543 mpi_request
.Header
.PageNumber
= 4;
2544 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE4_PAGEVERSION
;
2545 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2546 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2547 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2551 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
2552 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2553 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2554 sizeof(*config_page
));
2560 * _config_set_driver_trigger_pg4 - write driver trigger page 4
2561 * @ioc: per adapter object
2562 * @mpi_reply: reply mf payload returned from firmware
2563 * @config_page: contents of the config page
2566 * Returns 0 for success, non-zero for failure.
2569 _config_set_driver_trigger_pg4(struct MPT3SAS_ADAPTER
*ioc
,
2570 Mpi2ConfigReply_t
*mpi_reply
, Mpi26DriverTriggerPage4_t
*config_page
)
2572 Mpi2ConfigRequest_t mpi_request
;
2575 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2576 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2577 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2578 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2579 mpi_request
.ExtPageType
=
2580 MPI2_CONFIG_EXTPAGETYPE_DRIVER_PERSISTENT_TRIGGER
;
2581 mpi_request
.Header
.PageNumber
= 4;
2582 mpi_request
.Header
.PageVersion
= MPI26_DRIVER_TRIGGER_PAGE4_PAGEVERSION
;
2583 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2584 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2585 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2589 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_CURRENT
;
2590 _config_request(ioc
, &mpi_request
, mpi_reply
,
2591 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2592 sizeof(*config_page
));
2593 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_WRITE_NVRAM
;
2594 r
= _config_request(ioc
, &mpi_request
, mpi_reply
,
2595 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2596 sizeof(*config_page
));
2602 * mpt3sas_config_update_driver_trigger_pg4 - update driver trigger page 4
2603 * @ioc: per adapter object
2604 * @mpi_tg: mpi trigger list
2605 * @set: set ot clear trigger values
2608 * Returns 0 for success, non-zero for failure.
2611 mpt3sas_config_update_driver_trigger_pg4(struct MPT3SAS_ADAPTER
*ioc
,
2612 struct SL_WH_MPI_TRIGGERS_T
*mpi_tg
, bool set
)
2614 Mpi26DriverTriggerPage4_t tg_pg4
;
2615 Mpi2ConfigReply_t mpi_reply
;
2619 rc
= mpt3sas_config_update_driver_trigger_pg0(ioc
,
2620 MPI26_DRIVER_TRIGGER0_FLAG_LOGINFO_TRIGGER_VALID
, set
);
2624 rc
= mpt3sas_config_get_driver_trigger_pg4(ioc
, &mpi_reply
, &tg_pg4
);
2628 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2629 MPI2_IOCSTATUS_MASK
;
2630 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2633 "%s: Failed to get trigger pg4, ioc_status(0x%04x)\n",
2634 __func__
, ioc_status
));
2640 count
= mpi_tg
->ValidEntries
;
2641 tg_pg4
.NumIOCStatusLogInfoTrigger
= cpu_to_le16(count
);
2642 for (i
= 0; i
< count
; i
++) {
2643 tg_pg4
.IOCStatusLoginfoTriggers
[i
].IOCStatus
=
2644 cpu_to_le16(mpi_tg
->MPITriggerEntry
[i
].IOCStatus
);
2645 tg_pg4
.IOCStatusLoginfoTriggers
[i
].LogInfo
=
2646 cpu_to_le32(mpi_tg
->MPITriggerEntry
[i
].IocLogInfo
);
2649 tg_pg4
.NumIOCStatusLogInfoTrigger
= 0;
2650 memset(&tg_pg4
.IOCStatusLoginfoTriggers
[0], 0,
2651 NUM_VALID_ENTRIES
* sizeof(
2652 MPI26_DRIVER_IOCSTATUS_LOGINFO_TRIGGER_ENTRY
));
2655 rc
= _config_set_driver_trigger_pg4(ioc
, &mpi_reply
, &tg_pg4
);
2659 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2660 MPI2_IOCSTATUS_MASK
;
2661 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
) {
2664 "%s: Failed to get trigger pg4, ioc_status(0x%04x)\n",
2665 __func__
, ioc_status
));
2673 mpt3sas_config_update_driver_trigger_pg0(ioc
,
2674 MPI26_DRIVER_TRIGGER0_FLAG_LOGINFO_TRIGGER_VALID
, !set
);
2680 * mpt3sas_config_get_volume_handle - returns volume handle for give hidden
2682 * @ioc: per adapter object
2683 * @pd_handle: phys disk handle
2684 * @volume_handle: volume handle
2687 * Return: 0 for success, non-zero for failure.
2690 mpt3sas_config_get_volume_handle(struct MPT3SAS_ADAPTER
*ioc
, u16 pd_handle
,
2693 Mpi2RaidConfigurationPage0_t
*config_page
= NULL
;
2694 Mpi2ConfigRequest_t mpi_request
;
2695 Mpi2ConfigReply_t mpi_reply
;
2696 int r
, i
, config_page_sz
;
2700 u16 phys_disk_dev_handle
;
2703 memset(&mpi_request
, 0, sizeof(Mpi2ConfigRequest_t
));
2704 mpi_request
.Function
= MPI2_FUNCTION_CONFIG
;
2705 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_HEADER
;
2706 mpi_request
.Header
.PageType
= MPI2_CONFIG_PAGETYPE_EXTENDED
;
2707 mpi_request
.ExtPageType
= MPI2_CONFIG_EXTPAGETYPE_RAID_CONFIG
;
2708 mpi_request
.Header
.PageVersion
= MPI2_RAIDCONFIG0_PAGEVERSION
;
2709 mpi_request
.Header
.PageNumber
= 0;
2710 ioc
->build_zero_len_sge_mpi(ioc
, &mpi_request
.PageBufferSGE
);
2711 r
= _config_request(ioc
, &mpi_request
, &mpi_reply
,
2712 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, NULL
, 0);
2716 mpi_request
.Action
= MPI2_CONFIG_ACTION_PAGE_READ_CURRENT
;
2717 config_page_sz
= (le16_to_cpu(mpi_reply
.ExtPageLength
) * 4);
2718 config_page
= kmalloc(config_page_sz
, GFP_KERNEL
);
2726 mpi_request
.PageAddress
= cpu_to_le32(config_num
+
2727 MPI2_RAID_PGAD_FORM_GET_NEXT_CONFIGNUM
);
2728 r
= _config_request(ioc
, &mpi_request
, &mpi_reply
,
2729 MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT
, config_page
,
2734 ioc_status
= le16_to_cpu(mpi_reply
.IOCStatus
) &
2735 MPI2_IOCSTATUS_MASK
;
2736 if (ioc_status
!= MPI2_IOCSTATUS_SUCCESS
)
2738 for (i
= 0; i
< config_page
->NumElements
; i
++) {
2739 element_type
= le16_to_cpu(config_page
->
2740 ConfigElement
[i
].ElementFlags
) &
2741 MPI2_RAIDCONFIG0_EFLAGS_MASK_ELEMENT_TYPE
;
2743 MPI2_RAIDCONFIG0_EFLAGS_VOL_PHYS_DISK_ELEMENT
||
2745 MPI2_RAIDCONFIG0_EFLAGS_OCE_ELEMENT
) {
2746 phys_disk_dev_handle
=
2747 le16_to_cpu(config_page
->ConfigElement
[i
].
2749 if (phys_disk_dev_handle
== pd_handle
) {
2751 le16_to_cpu(config_page
->
2752 ConfigElement
[i
].VolDevHandle
);
2756 } else if (element_type
==
2757 MPI2_RAIDCONFIG0_EFLAGS_HOT_SPARE_ELEMENT
) {
2763 config_num
= config_page
->ConfigNum
;
2771 * mpt3sas_config_get_volume_wwid - returns wwid given the volume handle
2772 * @ioc: per adapter object
2773 * @volume_handle: volume handle
2774 * @wwid: volume wwid
2777 * Return: 0 for success, non-zero for failure.
2780 mpt3sas_config_get_volume_wwid(struct MPT3SAS_ADAPTER
*ioc
, u16 volume_handle
,
2783 Mpi2ConfigReply_t mpi_reply
;
2784 Mpi2RaidVolPage1_t raid_vol_pg1
;
2787 if (!(mpt3sas_config_get_raid_volume_pg1(ioc
, &mpi_reply
,
2788 &raid_vol_pg1
, MPI2_RAID_VOLUME_PGAD_FORM_HANDLE
,
2790 *wwid
= le64_to_cpu(raid_vol_pg1
.WWID
);