diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2009-09-25 02:14:41 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-10-02 10:47:52 -0400 |
commit | 7b936b02293b2891d899233d3f4bb45295e8c1f9 (patch) | |
tree | 462d97406247680f3e0d49f720bde991a0a97538 /drivers/scsi/mpt2sas/mpt2sas_base.c | |
parent | 7725ccfda59715ecf8f99e3b520a0b84cc2ea79e (diff) |
[SCSI] mpt2sas: Update driver to MPI2 REV K headers.
Drivers header are updated to the MPI2 REV K headers.
Renamed VF_ID to msix_index in all call back handlers.
VF_ID is removed from all request descriptor.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_base.c')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.c | 100 |
1 files changed, 46 insertions, 54 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index d95d2f274cb3..10de370c171e 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -543,13 +543,13 @@ mpt2sas_base_fault_info(struct MPT2SAS_ADAPTER *ioc , u16 fault_code) | |||
543 | * _base_display_reply_info - | 543 | * _base_display_reply_info - |
544 | * @ioc: pointer to scsi command object | 544 | * @ioc: pointer to scsi command object |
545 | * @smid: system request message index | 545 | * @smid: system request message index |
546 | * @VF_ID: virtual function id | 546 | * @msix_index: MSIX table index supplied by the OS |
547 | * @reply: reply message frame(lower 32bit addr) | 547 | * @reply: reply message frame(lower 32bit addr) |
548 | * | 548 | * |
549 | * Return nothing. | 549 | * Return nothing. |
550 | */ | 550 | */ |
551 | static void | 551 | static void |
552 | _base_display_reply_info(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, | 552 | _base_display_reply_info(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
553 | u32 reply) | 553 | u32 reply) |
554 | { | 554 | { |
555 | MPI2DefaultReply_t *mpi_reply; | 555 | MPI2DefaultReply_t *mpi_reply; |
@@ -572,13 +572,14 @@ _base_display_reply_info(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, | |||
572 | * mpt2sas_base_done - base internal command completion routine | 572 | * mpt2sas_base_done - base internal command completion routine |
573 | * @ioc: pointer to scsi command object | 573 | * @ioc: pointer to scsi command object |
574 | * @smid: system request message index | 574 | * @smid: system request message index |
575 | * @VF_ID: virtual function id | 575 | * @msix_index: MSIX table index supplied by the OS |
576 | * @reply: reply message frame(lower 32bit addr) | 576 | * @reply: reply message frame(lower 32bit addr) |
577 | * | 577 | * |
578 | * Return nothing. | 578 | * Return nothing. |
579 | */ | 579 | */ |
580 | void | 580 | void |
581 | mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply) | 581 | mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
582 | u32 reply) | ||
582 | { | 583 | { |
583 | MPI2DefaultReply_t *mpi_reply; | 584 | MPI2DefaultReply_t *mpi_reply; |
584 | 585 | ||
@@ -601,13 +602,13 @@ mpt2sas_base_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 VF_ID, u32 reply) | |||
601 | /** | 602 | /** |
602 | * _base_async_event - main callback handler for firmware asyn events | 603 | * _base_async_event - main callback handler for firmware asyn events |
603 | * @ioc: pointer to scsi command object | 604 | * @ioc: pointer to scsi command object |
604 | * @VF_ID: virtual function id | 605 | * @msix_index: MSIX table index supplied by the OS |
605 | * @reply: reply message frame(lower 32bit addr) | 606 | * @reply: reply message frame(lower 32bit addr) |
606 | * | 607 | * |
607 | * Return nothing. | 608 | * Return nothing. |
608 | */ | 609 | */ |
609 | static void | 610 | static void |
610 | _base_async_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, u32 reply) | 611 | _base_async_event(struct MPT2SAS_ADAPTER *ioc, u8 msix_index, u32 reply) |
611 | { | 612 | { |
612 | Mpi2EventNotificationReply_t *mpi_reply; | 613 | Mpi2EventNotificationReply_t *mpi_reply; |
613 | Mpi2EventAckRequest_t *ack_request; | 614 | Mpi2EventAckRequest_t *ack_request; |
@@ -635,16 +636,17 @@ _base_async_event(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, u32 reply) | |||
635 | ack_request->Function = MPI2_FUNCTION_EVENT_ACK; | 636 | ack_request->Function = MPI2_FUNCTION_EVENT_ACK; |
636 | ack_request->Event = mpi_reply->Event; | 637 | ack_request->Event = mpi_reply->Event; |
637 | ack_request->EventContext = mpi_reply->EventContext; | 638 | ack_request->EventContext = mpi_reply->EventContext; |
638 | ack_request->VF_ID = VF_ID; | 639 | ack_request->VF_ID = 0; /* TODO */ |
639 | mpt2sas_base_put_smid_default(ioc, smid, VF_ID); | 640 | ack_request->VP_ID = 0; |
641 | mpt2sas_base_put_smid_default(ioc, smid); | ||
640 | 642 | ||
641 | out: | 643 | out: |
642 | 644 | ||
643 | /* scsih callback handler */ | 645 | /* scsih callback handler */ |
644 | mpt2sas_scsih_event_callback(ioc, VF_ID, reply); | 646 | mpt2sas_scsih_event_callback(ioc, msix_index, reply); |
645 | 647 | ||
646 | /* ctl callback handler */ | 648 | /* ctl callback handler */ |
647 | mpt2sas_ctl_event_callback(ioc, VF_ID, reply); | 649 | mpt2sas_ctl_event_callback(ioc, msix_index, reply); |
648 | } | 650 | } |
649 | 651 | ||
650 | /** | 652 | /** |
@@ -712,7 +714,7 @@ _base_interrupt(int irq, void *bus_id) | |||
712 | u16 smid; | 714 | u16 smid; |
713 | u8 cb_idx; | 715 | u8 cb_idx; |
714 | u32 reply; | 716 | u32 reply; |
715 | u8 VF_ID; | 717 | u8 msix_index; |
716 | struct MPT2SAS_ADAPTER *ioc = bus_id; | 718 | struct MPT2SAS_ADAPTER *ioc = bus_id; |
717 | Mpi2ReplyDescriptorsUnion_t *rpf; | 719 | Mpi2ReplyDescriptorsUnion_t *rpf; |
718 | 720 | ||
@@ -733,7 +735,7 @@ _base_interrupt(int irq, void *bus_id) | |||
733 | reply = 0; | 735 | reply = 0; |
734 | cb_idx = 0xFF; | 736 | cb_idx = 0xFF; |
735 | smid = le16_to_cpu(rpf->Default.DescriptorTypeDependent1); | 737 | smid = le16_to_cpu(rpf->Default.DescriptorTypeDependent1); |
736 | VF_ID = rpf->Default.VF_ID; | 738 | msix_index = rpf->Default.MSIxIndex; |
737 | if (request_desript_type == | 739 | if (request_desript_type == |
738 | MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY) { | 740 | MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY) { |
739 | reply = le32_to_cpu | 741 | reply = le32_to_cpu |
@@ -747,14 +749,14 @@ _base_interrupt(int irq, void *bus_id) | |||
747 | if (smid) | 749 | if (smid) |
748 | cb_idx = ioc->scsi_lookup[smid - 1].cb_idx; | 750 | cb_idx = ioc->scsi_lookup[smid - 1].cb_idx; |
749 | if (smid && cb_idx != 0xFF) { | 751 | if (smid && cb_idx != 0xFF) { |
750 | mpt_callbacks[cb_idx](ioc, smid, VF_ID, reply); | 752 | mpt_callbacks[cb_idx](ioc, smid, msix_index, reply); |
751 | if (reply) | 753 | if (reply) |
752 | _base_display_reply_info(ioc, smid, VF_ID, | 754 | _base_display_reply_info(ioc, smid, msix_index, |
753 | reply); | 755 | reply); |
754 | mpt2sas_base_free_smid(ioc, smid); | 756 | mpt2sas_base_free_smid(ioc, smid); |
755 | } | 757 | } |
756 | if (!smid) | 758 | if (!smid) |
757 | _base_async_event(ioc, VF_ID, reply); | 759 | _base_async_event(ioc, msix_index, reply); |
758 | 760 | ||
759 | /* reply free queue handling */ | 761 | /* reply free queue handling */ |
760 | if (reply) { | 762 | if (reply) { |
@@ -1352,21 +1354,19 @@ static inline void _base_writeq(__u64 b, volatile void __iomem *addr, | |||
1352 | * mpt2sas_base_put_smid_scsi_io - send SCSI_IO request to firmware | 1354 | * mpt2sas_base_put_smid_scsi_io - send SCSI_IO request to firmware |
1353 | * @ioc: per adapter object | 1355 | * @ioc: per adapter object |
1354 | * @smid: system request message index | 1356 | * @smid: system request message index |
1355 | * @vf_id: virtual function id | ||
1356 | * @handle: device handle | 1357 | * @handle: device handle |
1357 | * | 1358 | * |
1358 | * Return nothing. | 1359 | * Return nothing. |
1359 | */ | 1360 | */ |
1360 | void | 1361 | void |
1361 | mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 vf_id, | 1362 | mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid, u16 handle) |
1362 | u16 handle) | ||
1363 | { | 1363 | { |
1364 | Mpi2RequestDescriptorUnion_t descriptor; | 1364 | Mpi2RequestDescriptorUnion_t descriptor; |
1365 | u64 *request = (u64 *)&descriptor; | 1365 | u64 *request = (u64 *)&descriptor; |
1366 | 1366 | ||
1367 | 1367 | ||
1368 | descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO; | 1368 | descriptor.SCSIIO.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_SCSI_IO; |
1369 | descriptor.SCSIIO.VF_ID = vf_id; | 1369 | descriptor.SCSIIO.MSIxIndex = 0; /* TODO */ |
1370 | descriptor.SCSIIO.SMID = cpu_to_le16(smid); | 1370 | descriptor.SCSIIO.SMID = cpu_to_le16(smid); |
1371 | descriptor.SCSIIO.DevHandle = cpu_to_le16(handle); | 1371 | descriptor.SCSIIO.DevHandle = cpu_to_le16(handle); |
1372 | descriptor.SCSIIO.LMID = 0; | 1372 | descriptor.SCSIIO.LMID = 0; |
@@ -1379,20 +1379,18 @@ mpt2sas_base_put_smid_scsi_io(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 vf_id, | |||
1379 | * mpt2sas_base_put_smid_hi_priority - send Task Managment request to firmware | 1379 | * mpt2sas_base_put_smid_hi_priority - send Task Managment request to firmware |
1380 | * @ioc: per adapter object | 1380 | * @ioc: per adapter object |
1381 | * @smid: system request message index | 1381 | * @smid: system request message index |
1382 | * @vf_id: virtual function id | ||
1383 | * | 1382 | * |
1384 | * Return nothing. | 1383 | * Return nothing. |
1385 | */ | 1384 | */ |
1386 | void | 1385 | void |
1387 | mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid, | 1386 | mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid) |
1388 | u8 vf_id) | ||
1389 | { | 1387 | { |
1390 | Mpi2RequestDescriptorUnion_t descriptor; | 1388 | Mpi2RequestDescriptorUnion_t descriptor; |
1391 | u64 *request = (u64 *)&descriptor; | 1389 | u64 *request = (u64 *)&descriptor; |
1392 | 1390 | ||
1393 | descriptor.HighPriority.RequestFlags = | 1391 | descriptor.HighPriority.RequestFlags = |
1394 | MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; | 1392 | MPI2_REQ_DESCRIPT_FLAGS_HIGH_PRIORITY; |
1395 | descriptor.HighPriority.VF_ID = vf_id; | 1393 | descriptor.HighPriority.MSIxIndex = 0; /* TODO */ |
1396 | descriptor.HighPriority.SMID = cpu_to_le16(smid); | 1394 | descriptor.HighPriority.SMID = cpu_to_le16(smid); |
1397 | descriptor.HighPriority.LMID = 0; | 1395 | descriptor.HighPriority.LMID = 0; |
1398 | descriptor.HighPriority.Reserved1 = 0; | 1396 | descriptor.HighPriority.Reserved1 = 0; |
@@ -1404,18 +1402,17 @@ mpt2sas_base_put_smid_hi_priority(struct MPT2SAS_ADAPTER *ioc, u16 smid, | |||
1404 | * mpt2sas_base_put_smid_default - Default, primarily used for config pages | 1402 | * mpt2sas_base_put_smid_default - Default, primarily used for config pages |
1405 | * @ioc: per adapter object | 1403 | * @ioc: per adapter object |
1406 | * @smid: system request message index | 1404 | * @smid: system request message index |
1407 | * @vf_id: virtual function id | ||
1408 | * | 1405 | * |
1409 | * Return nothing. | 1406 | * Return nothing. |
1410 | */ | 1407 | */ |
1411 | void | 1408 | void |
1412 | mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 vf_id) | 1409 | mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid) |
1413 | { | 1410 | { |
1414 | Mpi2RequestDescriptorUnion_t descriptor; | 1411 | Mpi2RequestDescriptorUnion_t descriptor; |
1415 | u64 *request = (u64 *)&descriptor; | 1412 | u64 *request = (u64 *)&descriptor; |
1416 | 1413 | ||
1417 | descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; | 1414 | descriptor.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; |
1418 | descriptor.Default.VF_ID = vf_id; | 1415 | descriptor.Default.MSIxIndex = 0; /* TODO */ |
1419 | descriptor.Default.SMID = cpu_to_le16(smid); | 1416 | descriptor.Default.SMID = cpu_to_le16(smid); |
1420 | descriptor.Default.LMID = 0; | 1417 | descriptor.Default.LMID = 0; |
1421 | descriptor.Default.DescriptorTypeDependent = 0; | 1418 | descriptor.Default.DescriptorTypeDependent = 0; |
@@ -1427,21 +1424,20 @@ mpt2sas_base_put_smid_default(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 vf_id) | |||
1427 | * mpt2sas_base_put_smid_target_assist - send Target Assist/Status to firmware | 1424 | * mpt2sas_base_put_smid_target_assist - send Target Assist/Status to firmware |
1428 | * @ioc: per adapter object | 1425 | * @ioc: per adapter object |
1429 | * @smid: system request message index | 1426 | * @smid: system request message index |
1430 | * @vf_id: virtual function id | ||
1431 | * @io_index: value used to track the IO | 1427 | * @io_index: value used to track the IO |
1432 | * | 1428 | * |
1433 | * Return nothing. | 1429 | * Return nothing. |
1434 | */ | 1430 | */ |
1435 | void | 1431 | void |
1436 | mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid, | 1432 | mpt2sas_base_put_smid_target_assist(struct MPT2SAS_ADAPTER *ioc, u16 smid, |
1437 | u8 vf_id, u16 io_index) | 1433 | u16 io_index) |
1438 | { | 1434 | { |
1439 | Mpi2RequestDescriptorUnion_t descriptor; | 1435 | Mpi2RequestDescriptorUnion_t descriptor; |
1440 | u64 *request = (u64 *)&descriptor; | 1436 | u64 *request = (u64 *)&descriptor; |
1441 | 1437 | ||
1442 | descriptor.SCSITarget.RequestFlags = | 1438 | descriptor.SCSITarget.RequestFlags = |
1443 | MPI2_REQ_DESCRIPT_FLAGS_SCSI_TARGET; | 1439 | MPI2_REQ_DESCRIPT_FLAGS_SCSI_TARGET; |
1444 | descriptor.SCSITarget.VF_ID = vf_id; | 1440 | descriptor.SCSITarget.MSIxIndex = 0; /* TODO */ |
1445 | descriptor.SCSITarget.SMID = cpu_to_le16(smid); | 1441 | descriptor.SCSITarget.SMID = cpu_to_le16(smid); |
1446 | descriptor.SCSITarget.LMID = 0; | 1442 | descriptor.SCSITarget.LMID = 0; |
1447 | descriptor.SCSITarget.IoIndex = cpu_to_le16(io_index); | 1443 | descriptor.SCSITarget.IoIndex = cpu_to_le16(io_index); |
@@ -2454,7 +2450,7 @@ mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc, | |||
2454 | if (mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || | 2450 | if (mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || |
2455 | mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET) | 2451 | mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET) |
2456 | ioc->ioc_link_reset_in_progress = 1; | 2452 | ioc->ioc_link_reset_in_progress = 1; |
2457 | mpt2sas_base_put_smid_default(ioc, smid, mpi_request->VF_ID); | 2453 | mpt2sas_base_put_smid_default(ioc, smid); |
2458 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 2454 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
2459 | msecs_to_jiffies(10000)); | 2455 | msecs_to_jiffies(10000)); |
2460 | if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || | 2456 | if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || |
@@ -2555,7 +2551,7 @@ mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc, | |||
2555 | request = mpt2sas_base_get_msg_frame(ioc, smid); | 2551 | request = mpt2sas_base_get_msg_frame(ioc, smid); |
2556 | ioc->base_cmds.smid = smid; | 2552 | ioc->base_cmds.smid = smid; |
2557 | memcpy(request, mpi_request, sizeof(Mpi2SepReply_t)); | 2553 | memcpy(request, mpi_request, sizeof(Mpi2SepReply_t)); |
2558 | mpt2sas_base_put_smid_default(ioc, smid, mpi_request->VF_ID); | 2554 | mpt2sas_base_put_smid_default(ioc, smid); |
2559 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 2555 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
2560 | msecs_to_jiffies(10000)); | 2556 | msecs_to_jiffies(10000)); |
2561 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 2557 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
@@ -2701,13 +2697,12 @@ _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
2701 | /** | 2697 | /** |
2702 | * _base_send_ioc_init - send ioc_init to firmware | 2698 | * _base_send_ioc_init - send ioc_init to firmware |
2703 | * @ioc: per adapter object | 2699 | * @ioc: per adapter object |
2704 | * @VF_ID: virtual function id | ||
2705 | * @sleep_flag: CAN_SLEEP or NO_SLEEP | 2700 | * @sleep_flag: CAN_SLEEP or NO_SLEEP |
2706 | * | 2701 | * |
2707 | * Returns 0 for success, non-zero for failure. | 2702 | * Returns 0 for success, non-zero for failure. |
2708 | */ | 2703 | */ |
2709 | static int | 2704 | static int |
2710 | _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, int sleep_flag) | 2705 | _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) |
2711 | { | 2706 | { |
2712 | Mpi2IOCInitRequest_t mpi_request; | 2707 | Mpi2IOCInitRequest_t mpi_request; |
2713 | Mpi2IOCInitReply_t mpi_reply; | 2708 | Mpi2IOCInitReply_t mpi_reply; |
@@ -2719,7 +2714,8 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, int sleep_flag) | |||
2719 | memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t)); | 2714 | memset(&mpi_request, 0, sizeof(Mpi2IOCInitRequest_t)); |
2720 | mpi_request.Function = MPI2_FUNCTION_IOC_INIT; | 2715 | mpi_request.Function = MPI2_FUNCTION_IOC_INIT; |
2721 | mpi_request.WhoInit = MPI2_WHOINIT_HOST_DRIVER; | 2716 | mpi_request.WhoInit = MPI2_WHOINIT_HOST_DRIVER; |
2722 | mpi_request.VF_ID = VF_ID; | 2717 | mpi_request.VF_ID = 0; /* TODO */ |
2718 | mpi_request.VP_ID = 0; | ||
2723 | mpi_request.MsgVersion = cpu_to_le16(MPI2_VERSION); | 2719 | mpi_request.MsgVersion = cpu_to_le16(MPI2_VERSION); |
2724 | mpi_request.HeaderVersion = cpu_to_le16(MPI2_HEADER_VERSION); | 2720 | mpi_request.HeaderVersion = cpu_to_le16(MPI2_HEADER_VERSION); |
2725 | 2721 | ||
@@ -2795,13 +2791,12 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, int sleep_flag) | |||
2795 | /** | 2791 | /** |
2796 | * _base_send_port_enable - send port_enable(discovery stuff) to firmware | 2792 | * _base_send_port_enable - send port_enable(discovery stuff) to firmware |
2797 | * @ioc: per adapter object | 2793 | * @ioc: per adapter object |
2798 | * @VF_ID: virtual function id | ||
2799 | * @sleep_flag: CAN_SLEEP or NO_SLEEP | 2794 | * @sleep_flag: CAN_SLEEP or NO_SLEEP |
2800 | * | 2795 | * |
2801 | * Returns 0 for success, non-zero for failure. | 2796 | * Returns 0 for success, non-zero for failure. |
2802 | */ | 2797 | */ |
2803 | static int | 2798 | static int |
2804 | _base_send_port_enable(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, int sleep_flag) | 2799 | _base_send_port_enable(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) |
2805 | { | 2800 | { |
2806 | Mpi2PortEnableRequest_t *mpi_request; | 2801 | Mpi2PortEnableRequest_t *mpi_request; |
2807 | u32 ioc_state; | 2802 | u32 ioc_state; |
@@ -2829,9 +2824,10 @@ _base_send_port_enable(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, int sleep_flag) | |||
2829 | ioc->base_cmds.smid = smid; | 2824 | ioc->base_cmds.smid = smid; |
2830 | memset(mpi_request, 0, sizeof(Mpi2PortEnableRequest_t)); | 2825 | memset(mpi_request, 0, sizeof(Mpi2PortEnableRequest_t)); |
2831 | mpi_request->Function = MPI2_FUNCTION_PORT_ENABLE; | 2826 | mpi_request->Function = MPI2_FUNCTION_PORT_ENABLE; |
2832 | mpi_request->VF_ID = VF_ID; | 2827 | mpi_request->VF_ID = 0; /* TODO */ |
2828 | mpi_request->VP_ID = 0; | ||
2833 | 2829 | ||
2834 | mpt2sas_base_put_smid_default(ioc, smid, VF_ID); | 2830 | mpt2sas_base_put_smid_default(ioc, smid); |
2835 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 2831 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
2836 | 300*HZ); | 2832 | 300*HZ); |
2837 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 2833 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
@@ -2892,13 +2888,12 @@ _base_unmask_events(struct MPT2SAS_ADAPTER *ioc, u16 event) | |||
2892 | /** | 2888 | /** |
2893 | * _base_event_notification - send event notification | 2889 | * _base_event_notification - send event notification |
2894 | * @ioc: per adapter object | 2890 | * @ioc: per adapter object |
2895 | * @VF_ID: virtual function id | ||
2896 | * @sleep_flag: CAN_SLEEP or NO_SLEEP | 2891 | * @sleep_flag: CAN_SLEEP or NO_SLEEP |
2897 | * | 2892 | * |
2898 | * Returns 0 for success, non-zero for failure. | 2893 | * Returns 0 for success, non-zero for failure. |
2899 | */ | 2894 | */ |
2900 | static int | 2895 | static int |
2901 | _base_event_notification(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, int sleep_flag) | 2896 | _base_event_notification(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) |
2902 | { | 2897 | { |
2903 | Mpi2EventNotificationRequest_t *mpi_request; | 2898 | Mpi2EventNotificationRequest_t *mpi_request; |
2904 | unsigned long timeleft; | 2899 | unsigned long timeleft; |
@@ -2926,11 +2921,12 @@ _base_event_notification(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, int sleep_flag) | |||
2926 | ioc->base_cmds.smid = smid; | 2921 | ioc->base_cmds.smid = smid; |
2927 | memset(mpi_request, 0, sizeof(Mpi2EventNotificationRequest_t)); | 2922 | memset(mpi_request, 0, sizeof(Mpi2EventNotificationRequest_t)); |
2928 | mpi_request->Function = MPI2_FUNCTION_EVENT_NOTIFICATION; | 2923 | mpi_request->Function = MPI2_FUNCTION_EVENT_NOTIFICATION; |
2929 | mpi_request->VF_ID = VF_ID; | 2924 | mpi_request->VF_ID = 0; /* TODO */ |
2925 | mpi_request->VP_ID = 0; | ||
2930 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) | 2926 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) |
2931 | mpi_request->EventMasks[i] = | 2927 | mpi_request->EventMasks[i] = |
2932 | le32_to_cpu(ioc->event_masks[i]); | 2928 | le32_to_cpu(ioc->event_masks[i]); |
2933 | mpt2sas_base_put_smid_default(ioc, smid, VF_ID); | 2929 | mpt2sas_base_put_smid_default(ioc, smid); |
2934 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); | 2930 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); |
2935 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 2931 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
2936 | printk(MPT2SAS_ERR_FMT "%s: timeout\n", | 2932 | printk(MPT2SAS_ERR_FMT "%s: timeout\n", |
@@ -2981,7 +2977,7 @@ mpt2sas_base_validate_event_type(struct MPT2SAS_ADAPTER *ioc, u32 *event_type) | |||
2981 | return; | 2977 | return; |
2982 | 2978 | ||
2983 | mutex_lock(&ioc->base_cmds.mutex); | 2979 | mutex_lock(&ioc->base_cmds.mutex); |
2984 | _base_event_notification(ioc, 0, CAN_SLEEP); | 2980 | _base_event_notification(ioc, CAN_SLEEP); |
2985 | mutex_unlock(&ioc->base_cmds.mutex); | 2981 | mutex_unlock(&ioc->base_cmds.mutex); |
2986 | } | 2982 | } |
2987 | 2983 | ||
@@ -3160,14 +3156,12 @@ _base_make_ioc_ready(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
3160 | /** | 3156 | /** |
3161 | * _base_make_ioc_operational - put controller in OPERATIONAL state | 3157 | * _base_make_ioc_operational - put controller in OPERATIONAL state |
3162 | * @ioc: per adapter object | 3158 | * @ioc: per adapter object |
3163 | * @VF_ID: virtual function id | ||
3164 | * @sleep_flag: CAN_SLEEP or NO_SLEEP | 3159 | * @sleep_flag: CAN_SLEEP or NO_SLEEP |
3165 | * | 3160 | * |
3166 | * Returns 0 for success, non-zero for failure. | 3161 | * Returns 0 for success, non-zero for failure. |
3167 | */ | 3162 | */ |
3168 | static int | 3163 | static int |
3169 | _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | 3164 | _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) |
3170 | int sleep_flag) | ||
3171 | { | 3165 | { |
3172 | int r, i; | 3166 | int r, i; |
3173 | unsigned long flags; | 3167 | unsigned long flags; |
@@ -3196,7 +3190,7 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
3196 | for (i = 0; i < ioc->reply_post_queue_depth; i++) | 3190 | for (i = 0; i < ioc->reply_post_queue_depth; i++) |
3197 | ioc->reply_post_free[i].Words = ULLONG_MAX; | 3191 | ioc->reply_post_free[i].Words = ULLONG_MAX; |
3198 | 3192 | ||
3199 | r = _base_send_ioc_init(ioc, VF_ID, sleep_flag); | 3193 | r = _base_send_ioc_init(ioc, sleep_flag); |
3200 | if (r) | 3194 | if (r) |
3201 | return r; | 3195 | return r; |
3202 | 3196 | ||
@@ -3207,14 +3201,14 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, u8 VF_ID, | |||
3207 | writel(0, &ioc->chip->ReplyPostHostIndex); | 3201 | writel(0, &ioc->chip->ReplyPostHostIndex); |
3208 | 3202 | ||
3209 | _base_unmask_interrupts(ioc); | 3203 | _base_unmask_interrupts(ioc); |
3210 | r = _base_event_notification(ioc, VF_ID, sleep_flag); | 3204 | r = _base_event_notification(ioc, sleep_flag); |
3211 | if (r) | 3205 | if (r) |
3212 | return r; | 3206 | return r; |
3213 | 3207 | ||
3214 | if (sleep_flag == CAN_SLEEP) | 3208 | if (sleep_flag == CAN_SLEEP) |
3215 | _base_static_config_pages(ioc); | 3209 | _base_static_config_pages(ioc); |
3216 | 3210 | ||
3217 | r = _base_send_port_enable(ioc, VF_ID, sleep_flag); | 3211 | r = _base_send_port_enable(ioc, sleep_flag); |
3218 | if (r) | 3212 | if (r) |
3219 | return r; | 3213 | return r; |
3220 | 3214 | ||
@@ -3338,7 +3332,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
3338 | if (r) | 3332 | if (r) |
3339 | goto out_free_resources; | 3333 | goto out_free_resources; |
3340 | } | 3334 | } |
3341 | r = _base_make_ioc_operational(ioc, 0, CAN_SLEEP); | 3335 | r = _base_make_ioc_operational(ioc, CAN_SLEEP); |
3342 | if (r) | 3336 | if (r) |
3343 | goto out_free_resources; | 3337 | goto out_free_resources; |
3344 | 3338 | ||
@@ -3490,7 +3484,7 @@ int | |||
3490 | mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | 3484 | mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, |
3491 | enum reset_type type) | 3485 | enum reset_type type) |
3492 | { | 3486 | { |
3493 | int r, i; | 3487 | int r; |
3494 | unsigned long flags; | 3488 | unsigned long flags; |
3495 | 3489 | ||
3496 | dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: enter\n", ioc->name, | 3490 | dtmprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s: enter\n", ioc->name, |
@@ -3513,9 +3507,7 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
3513 | if (r) | 3507 | if (r) |
3514 | goto out; | 3508 | goto out; |
3515 | _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); | 3509 | _base_reset_handler(ioc, MPT2_IOC_AFTER_RESET); |
3516 | for (i = 0 ; i < ioc->facts.NumberOfPorts; i++) | 3510 | r = _base_make_ioc_operational(ioc, sleep_flag); |
3517 | r = _base_make_ioc_operational(ioc, ioc->pfacts[i].VF_ID, | ||
3518 | sleep_flag); | ||
3519 | if (!r) | 3511 | if (!r) |
3520 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); | 3512 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); |
3521 | out: | 3513 | out: |