| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Linux MegaRAID driver for SAS based RAID controllers |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2003-2013 LSI Corporation |
|---|
| 5 | | - * Copyright (c) 2013-2014 Avago Technologies |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or |
|---|
| 8 | | - * modify it under the terms of the GNU General Public License |
|---|
| 9 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 10 | | - * of the License, or (at your option) any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 6 | + * Copyright (c) 2013-2016 Avago Technologies |
|---|
| 7 | + * Copyright (c) 2016-2018 Broadcom Inc. |
|---|
| 19 | 8 | * |
|---|
| 20 | 9 | * FILE: megaraid_sas.h |
|---|
| 21 | 10 | * |
|---|
| 22 | | - * Authors: Avago Technologies |
|---|
| 23 | | - * Kashyap Desai <kashyap.desai@avagotech.com> |
|---|
| 24 | | - * Sumit Saxena <sumit.saxena@avagotech.com> |
|---|
| 11 | + * Authors: Broadcom Inc. |
|---|
| 12 | + * Kashyap Desai <kashyap.desai@broadcom.com> |
|---|
| 13 | + * Sumit Saxena <sumit.saxena@broadcom.com> |
|---|
| 25 | 14 | * |
|---|
| 26 | | - * Send feedback to: megaraidlinux.pdl@avagotech.com |
|---|
| 27 | | - * |
|---|
| 28 | | - * Mail to: Avago Technologies, 350 West Trimble Road, Building 90, |
|---|
| 29 | | - * San Jose, California 95131 |
|---|
| 15 | + * Send feedback to: megaraidlinux.pdl@broadcom.com |
|---|
| 30 | 16 | */ |
|---|
| 31 | 17 | |
|---|
| 32 | 18 | #ifndef LSI_MEGARAID_SAS_H |
|---|
| .. | .. |
|---|
| 35 | 21 | /* |
|---|
| 36 | 22 | * MegaRAID SAS Driver meta data |
|---|
| 37 | 23 | */ |
|---|
| 38 | | -#define MEGASAS_VERSION "07.706.03.00-rc1" |
|---|
| 39 | | -#define MEGASAS_RELDATE "May 21, 2018" |
|---|
| 24 | +#define MEGASAS_VERSION "07.714.04.00-rc1" |
|---|
| 25 | +#define MEGASAS_RELDATE "Apr 14, 2020" |
|---|
| 26 | + |
|---|
| 27 | +#define MEGASAS_MSIX_NAME_LEN 32 |
|---|
| 40 | 28 | |
|---|
| 41 | 29 | /* |
|---|
| 42 | 30 | * Device IDs |
|---|
| .. | .. |
|---|
| 62 | 50 | #define PCI_DEVICE_ID_LSI_TOMCAT 0x0017 |
|---|
| 63 | 51 | #define PCI_DEVICE_ID_LSI_VENTURA_4PORT 0x001B |
|---|
| 64 | 52 | #define PCI_DEVICE_ID_LSI_CRUSADER_4PORT 0x001C |
|---|
| 53 | +#define PCI_DEVICE_ID_LSI_AERO_10E1 0x10e1 |
|---|
| 54 | +#define PCI_DEVICE_ID_LSI_AERO_10E2 0x10e2 |
|---|
| 55 | +#define PCI_DEVICE_ID_LSI_AERO_10E5 0x10e5 |
|---|
| 56 | +#define PCI_DEVICE_ID_LSI_AERO_10E6 0x10e6 |
|---|
| 57 | +#define PCI_DEVICE_ID_LSI_AERO_10E0 0x10e0 |
|---|
| 58 | +#define PCI_DEVICE_ID_LSI_AERO_10E3 0x10e3 |
|---|
| 59 | +#define PCI_DEVICE_ID_LSI_AERO_10E4 0x10e4 |
|---|
| 60 | +#define PCI_DEVICE_ID_LSI_AERO_10E7 0x10e7 |
|---|
| 65 | 61 | |
|---|
| 66 | 62 | /* |
|---|
| 67 | 63 | * Intel HBA SSDIDs |
|---|
| .. | .. |
|---|
| 133 | 129 | #define MFI_RESET_ADAPTER 0x00000002 |
|---|
| 134 | 130 | #define MEGAMFI_FRAME_SIZE 64 |
|---|
| 135 | 131 | |
|---|
| 132 | +#define MFI_STATE_FAULT_CODE 0x0FFF0000 |
|---|
| 133 | +#define MFI_STATE_FAULT_SUBCODE 0x0000FF00 |
|---|
| 136 | 134 | /* |
|---|
| 137 | 135 | * During FW init, clear pending cmds & reset state using inbound_msg_0 |
|---|
| 138 | 136 | * |
|---|
| .. | .. |
|---|
| 142 | 140 | * CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver |
|---|
| 143 | 141 | * HOTPLUG : Resume from Hotplug |
|---|
| 144 | 142 | * MFI_STOP_ADP : Send signal to FW to stop processing |
|---|
| 143 | + * MFI_ADP_TRIGGER_SNAP_DUMP: Inform firmware to initiate snap dump |
|---|
| 145 | 144 | */ |
|---|
| 146 | 145 | #define WRITE_SEQUENCE_OFFSET (0x0000000FC) /* I20 */ |
|---|
| 147 | 146 | #define HOST_DIAGNOSTIC_OFFSET (0x000000F8) /* I20 */ |
|---|
| .. | .. |
|---|
| 158 | 157 | #define MFI_RESET_FLAGS MFI_INIT_READY| \ |
|---|
| 159 | 158 | MFI_INIT_MFIMODE| \ |
|---|
| 160 | 159 | MFI_INIT_ABORT |
|---|
| 160 | +#define MFI_ADP_TRIGGER_SNAP_DUMP 0x00000100 |
|---|
| 161 | 161 | #define MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE (0x01) |
|---|
| 162 | 162 | |
|---|
| 163 | 163 | /* |
|---|
| .. | .. |
|---|
| 198 | 198 | MFI_CMD_SMP = 0x7, |
|---|
| 199 | 199 | MFI_CMD_STP = 0x8, |
|---|
| 200 | 200 | MFI_CMD_NVME = 0x9, |
|---|
| 201 | + MFI_CMD_TOOLBOX = 0xa, |
|---|
| 201 | 202 | MFI_CMD_OP_COUNT, |
|---|
| 202 | 203 | MFI_CMD_INVALID = 0xff |
|---|
| 203 | 204 | }; |
|---|
| .. | .. |
|---|
| 510 | 511 | */ |
|---|
| 511 | 512 | struct MR_PD_PROGRESS { |
|---|
| 512 | 513 | struct { |
|---|
| 513 | | -#ifndef MFI_BIG_ENDIAN |
|---|
| 514 | +#ifndef __BIG_ENDIAN_BITFIELD |
|---|
| 514 | 515 | u32 rbld:1; |
|---|
| 515 | 516 | u32 patrol:1; |
|---|
| 516 | 517 | u32 clear:1; |
|---|
| .. | .. |
|---|
| 536 | 537 | }; |
|---|
| 537 | 538 | |
|---|
| 538 | 539 | struct { |
|---|
| 539 | | -#ifndef MFI_BIG_ENDIAN |
|---|
| 540 | +#ifndef __BIG_ENDIAN_BITFIELD |
|---|
| 540 | 541 | u32 rbld:1; |
|---|
| 541 | 542 | u32 patrol:1; |
|---|
| 542 | 543 | u32 clear:1; |
|---|
| .. | .. |
|---|
| 786 | 787 | u8 targetId[MAX_LOGICAL_DRIVES_EXT]; |
|---|
| 787 | 788 | }; |
|---|
| 788 | 789 | |
|---|
| 790 | +struct MR_HOST_DEVICE_LIST_ENTRY { |
|---|
| 791 | + struct { |
|---|
| 792 | + union { |
|---|
| 793 | + struct { |
|---|
| 794 | +#if defined(__BIG_ENDIAN_BITFIELD) |
|---|
| 795 | + u8 reserved:7; |
|---|
| 796 | + u8 is_sys_pd:1; |
|---|
| 797 | +#else |
|---|
| 798 | + u8 is_sys_pd:1; |
|---|
| 799 | + u8 reserved:7; |
|---|
| 800 | +#endif |
|---|
| 801 | + } bits; |
|---|
| 802 | + u8 byte; |
|---|
| 803 | + } u; |
|---|
| 804 | + } flags; |
|---|
| 805 | + u8 scsi_type; |
|---|
| 806 | + __le16 target_id; |
|---|
| 807 | + u8 reserved[4]; |
|---|
| 808 | + __le64 sas_addr[2]; |
|---|
| 809 | +} __packed; |
|---|
| 810 | + |
|---|
| 811 | +struct MR_HOST_DEVICE_LIST { |
|---|
| 812 | + __le32 size; |
|---|
| 813 | + __le32 count; |
|---|
| 814 | + __le32 reserved[2]; |
|---|
| 815 | + struct MR_HOST_DEVICE_LIST_ENTRY host_device_list[1]; |
|---|
| 816 | +} __packed; |
|---|
| 817 | + |
|---|
| 818 | +#define HOST_DEVICE_LIST_SZ (sizeof(struct MR_HOST_DEVICE_LIST) + \ |
|---|
| 819 | + (sizeof(struct MR_HOST_DEVICE_LIST_ENTRY) * \ |
|---|
| 820 | + (MEGASAS_MAX_PD + MAX_LOGICAL_DRIVES_EXT - 1))) |
|---|
| 821 | + |
|---|
| 789 | 822 | |
|---|
| 790 | 823 | /* |
|---|
| 791 | 824 | * SAS controller properties |
|---|
| .. | .. |
|---|
| 860 | 893 | u32 reserved:18; |
|---|
| 861 | 894 | #endif |
|---|
| 862 | 895 | } OnOffProperties; |
|---|
| 863 | | - u8 autoSnapVDSpace; |
|---|
| 864 | | - u8 viewSpace; |
|---|
| 896 | + |
|---|
| 897 | + union { |
|---|
| 898 | + u8 autoSnapVDSpace; |
|---|
| 899 | + u8 viewSpace; |
|---|
| 900 | + struct { |
|---|
| 901 | +#if defined(__BIG_ENDIAN_BITFIELD) |
|---|
| 902 | + u16 reserved3:9; |
|---|
| 903 | + u16 enable_fw_dev_list:1; |
|---|
| 904 | + u16 reserved2:1; |
|---|
| 905 | + u16 enable_snap_dump:1; |
|---|
| 906 | + u16 reserved1:4; |
|---|
| 907 | +#else |
|---|
| 908 | + u16 reserved1:4; |
|---|
| 909 | + u16 enable_snap_dump:1; |
|---|
| 910 | + u16 reserved2:1; |
|---|
| 911 | + u16 enable_fw_dev_list:1; |
|---|
| 912 | + u16 reserved3:9; |
|---|
| 913 | +#endif |
|---|
| 914 | + } on_off_properties2; |
|---|
| 915 | + }; |
|---|
| 865 | 916 | __le16 spinDownTime; |
|---|
| 866 | 917 | u8 reserved[24]; |
|---|
| 867 | 918 | } __packed; |
|---|
| .. | .. |
|---|
| 1407 | 1458 | |
|---|
| 1408 | 1459 | u8 reserved6[64]; |
|---|
| 1409 | 1460 | |
|---|
| 1410 | | - u32 rsvdForAdptOp[64]; |
|---|
| 1461 | + struct { |
|---|
| 1462 | + #if defined(__BIG_ENDIAN_BITFIELD) |
|---|
| 1463 | + u32 reserved:19; |
|---|
| 1464 | + u32 support_pci_lane_margining: 1; |
|---|
| 1465 | + u32 support_psoc_update:1; |
|---|
| 1466 | + u32 support_force_personality_change:1; |
|---|
| 1467 | + u32 support_fde_type_mix:1; |
|---|
| 1468 | + u32 support_snap_dump:1; |
|---|
| 1469 | + u32 support_nvme_tm:1; |
|---|
| 1470 | + u32 support_oce_only:1; |
|---|
| 1471 | + u32 support_ext_mfg_vpd:1; |
|---|
| 1472 | + u32 support_pcie:1; |
|---|
| 1473 | + u32 support_cvhealth_info:1; |
|---|
| 1474 | + u32 support_profile_change:2; |
|---|
| 1475 | + u32 mr_config_ext2_supported:1; |
|---|
| 1476 | + #else |
|---|
| 1477 | + u32 mr_config_ext2_supported:1; |
|---|
| 1478 | + u32 support_profile_change:2; |
|---|
| 1479 | + u32 support_cvhealth_info:1; |
|---|
| 1480 | + u32 support_pcie:1; |
|---|
| 1481 | + u32 support_ext_mfg_vpd:1; |
|---|
| 1482 | + u32 support_oce_only:1; |
|---|
| 1483 | + u32 support_nvme_tm:1; |
|---|
| 1484 | + u32 support_snap_dump:1; |
|---|
| 1485 | + u32 support_fde_type_mix:1; |
|---|
| 1486 | + u32 support_force_personality_change:1; |
|---|
| 1487 | + u32 support_psoc_update:1; |
|---|
| 1488 | + u32 support_pci_lane_margining: 1; |
|---|
| 1489 | + u32 reserved:19; |
|---|
| 1490 | + #endif |
|---|
| 1491 | + } adapter_operations5; |
|---|
| 1492 | + |
|---|
| 1493 | + u32 rsvdForAdptOp[63]; |
|---|
| 1411 | 1494 | |
|---|
| 1412 | 1495 | u8 reserved7[3]; |
|---|
| 1413 | 1496 | |
|---|
| .. | .. |
|---|
| 1441 | 1524 | #define MEGASAS_FW_BUSY 1 |
|---|
| 1442 | 1525 | |
|---|
| 1443 | 1526 | /* Driver's internal Logging levels*/ |
|---|
| 1444 | | -#define OCR_LOGS (1 << 0) |
|---|
| 1527 | +#define OCR_DEBUG (1 << 0) |
|---|
| 1528 | +#define TM_DEBUG (1 << 1) |
|---|
| 1529 | +#define LD_PD_DEBUG (1 << 2) |
|---|
| 1445 | 1530 | |
|---|
| 1446 | 1531 | #define SCAN_PD_CHANNEL 0x1 |
|---|
| 1447 | 1532 | #define SCAN_VD_CHANNEL 0x2 |
|---|
| .. | .. |
|---|
| 1485 | 1570 | #define MEGASAS_IOCTL_CMD 0 |
|---|
| 1486 | 1571 | #define MEGASAS_DEFAULT_CMD_TIMEOUT 90 |
|---|
| 1487 | 1572 | #define MEGASAS_THROTTLE_QUEUE_DEPTH 16 |
|---|
| 1488 | | -#define MEGASAS_BLOCKED_CMD_TIMEOUT 60 |
|---|
| 1489 | 1573 | #define MEGASAS_DEFAULT_TM_TIMEOUT 50 |
|---|
| 1490 | 1574 | /* |
|---|
| 1491 | 1575 | * FW reports the maximum of number of commands that it can accept (maximum |
|---|
| .. | .. |
|---|
| 1518 | 1602 | #define MFI_IO_TIMEOUT_SECS 180 |
|---|
| 1519 | 1603 | #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ) |
|---|
| 1520 | 1604 | #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30) |
|---|
| 1605 | +#define MEGASAS_SRIOV_MAX_RESET_TRIES_VF 1 |
|---|
| 1521 | 1606 | #define MEGASAS_ROUTINE_WAIT_TIME_VF 300 |
|---|
| 1522 | 1607 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 |
|---|
| 1523 | 1608 | #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 |
|---|
| .. | .. |
|---|
| 1542 | 1627 | |
|---|
| 1543 | 1628 | #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 |
|---|
| 1544 | 1629 | |
|---|
| 1630 | +#define MR_ATOMIC_DESCRIPTOR_SUPPORT_OFFSET (1 << 24) |
|---|
| 1631 | + |
|---|
| 1545 | 1632 | #define MR_CAN_HANDLE_64_BIT_DMA_OFFSET (1 << 25) |
|---|
| 1633 | +#define MR_INTR_COALESCING_SUPPORT_OFFSET (1 << 26) |
|---|
| 1634 | + |
|---|
| 1635 | +#define MEGASAS_WATCHDOG_THREAD_INTERVAL 1000 |
|---|
| 1636 | +#define MEGASAS_WAIT_FOR_NEXT_DMA_MSECS 20 |
|---|
| 1637 | +#define MEGASAS_WATCHDOG_WAIT_COUNT 50 |
|---|
| 1546 | 1638 | |
|---|
| 1547 | 1639 | enum MR_ADAPTER_TYPE { |
|---|
| 1548 | 1640 | MFI_SERIES = 1, |
|---|
| 1549 | 1641 | THUNDERBOLT_SERIES = 2, |
|---|
| 1550 | 1642 | INVADER_SERIES = 3, |
|---|
| 1551 | 1643 | VENTURA_SERIES = 4, |
|---|
| 1644 | + AERO_SERIES = 5, |
|---|
| 1552 | 1645 | }; |
|---|
| 1553 | 1646 | |
|---|
| 1554 | 1647 | /* |
|---|
| .. | .. |
|---|
| 1588 | 1681 | |
|---|
| 1589 | 1682 | u32 reserved_3[3]; /*00A4h*/ |
|---|
| 1590 | 1683 | |
|---|
| 1591 | | - u32 outbound_scratch_pad ; /*00B0h*/ |
|---|
| 1592 | | - u32 outbound_scratch_pad_2; /*00B4h*/ |
|---|
| 1593 | | - u32 outbound_scratch_pad_3; /*00B8h*/ |
|---|
| 1594 | | - u32 outbound_scratch_pad_4; /*00BCh*/ |
|---|
| 1595 | | - |
|---|
| 1684 | + u32 outbound_scratch_pad_0; /*00B0h*/ |
|---|
| 1685 | + u32 outbound_scratch_pad_1; /*00B4h*/ |
|---|
| 1686 | + u32 outbound_scratch_pad_2; /*00B8h*/ |
|---|
| 1687 | + u32 outbound_scratch_pad_3; /*00BCh*/ |
|---|
| 1596 | 1688 | |
|---|
| 1597 | 1689 | u32 inbound_low_queue_port ; /*00C0h*/ |
|---|
| 1598 | 1690 | |
|---|
| .. | .. |
|---|
| 1664 | 1756 | typedef union _MFI_CAPABILITIES { |
|---|
| 1665 | 1757 | struct { |
|---|
| 1666 | 1758 | #if defined(__BIG_ENDIAN_BITFIELD) |
|---|
| 1667 | | - u32 reserved:17; |
|---|
| 1759 | + u32 reserved:16; |
|---|
| 1760 | + u32 support_fw_exposed_dev_list:1; |
|---|
| 1668 | 1761 | u32 support_nvme_passthru:1; |
|---|
| 1669 | 1762 | u32 support_64bit_mode:1; |
|---|
| 1670 | 1763 | u32 support_pd_map_target_id:1; |
|---|
| .. | .. |
|---|
| 1696 | 1789 | u32 support_pd_map_target_id:1; |
|---|
| 1697 | 1790 | u32 support_64bit_mode:1; |
|---|
| 1698 | 1791 | u32 support_nvme_passthru:1; |
|---|
| 1699 | | - u32 reserved:17; |
|---|
| 1792 | + u32 support_fw_exposed_dev_list:1; |
|---|
| 1793 | + u32 reserved:16; |
|---|
| 1700 | 1794 | #endif |
|---|
| 1701 | 1795 | } mfi_capabilities; |
|---|
| 1702 | 1796 | __le32 reg; |
|---|
| .. | .. |
|---|
| 1715 | 1809 | __le32 pad_0; /*0Ch */ |
|---|
| 1716 | 1810 | |
|---|
| 1717 | 1811 | __le16 flags; /*10h */ |
|---|
| 1718 | | - __le16 reserved_3; /*12h */ |
|---|
| 1812 | + __le16 replyqueue_mask; /*12h */ |
|---|
| 1719 | 1813 | __le32 data_xfer_len; /*14h */ |
|---|
| 1720 | 1814 | |
|---|
| 1721 | 1815 | __le32 queue_info_new_phys_addr_lo; /*18h */ |
|---|
| .. | .. |
|---|
| 2111 | 2205 | }; |
|---|
| 2112 | 2206 | |
|---|
| 2113 | 2207 | struct megasas_irq_context { |
|---|
| 2208 | + char name[MEGASAS_MSIX_NAME_LEN]; |
|---|
| 2114 | 2209 | struct megasas_instance *instance; |
|---|
| 2115 | 2210 | u32 MSIxIndex; |
|---|
| 2211 | + u32 os_irq; |
|---|
| 2212 | + struct irq_poll irqpoll; |
|---|
| 2213 | + bool irq_poll_scheduled; |
|---|
| 2214 | + bool irq_line_enable; |
|---|
| 2116 | 2215 | }; |
|---|
| 2117 | 2216 | |
|---|
| 2118 | 2217 | struct MR_DRV_SYSTEM_INFO { |
|---|
| .. | .. |
|---|
| 2134 | 2233 | |
|---|
| 2135 | 2234 | /* JBOD Queue depth definitions */ |
|---|
| 2136 | 2235 | #define MEGASAS_SATA_QD 32 |
|---|
| 2137 | | -#define MEGASAS_SAS_QD 64 |
|---|
| 2236 | +#define MEGASAS_SAS_QD 256 |
|---|
| 2138 | 2237 | #define MEGASAS_DEFAULT_PD_QD 64 |
|---|
| 2139 | | -#define MEGASAS_NVME_QD 32 |
|---|
| 2238 | +#define MEGASAS_NVME_QD 64 |
|---|
| 2140 | 2239 | |
|---|
| 2141 | 2240 | #define MR_DEFAULT_NVME_PAGE_SIZE 4096 |
|---|
| 2142 | 2241 | #define MR_DEFAULT_NVME_PAGE_SHIFT 12 |
|---|
| 2143 | 2242 | #define MR_DEFAULT_NVME_MDTS_KB 128 |
|---|
| 2144 | 2243 | #define MR_NVME_PAGE_SIZE_MASK 0x000000FF |
|---|
| 2244 | + |
|---|
| 2245 | +/*Aero performance parameters*/ |
|---|
| 2246 | +#define MR_HIGH_IOPS_QUEUE_COUNT 8 |
|---|
| 2247 | +#define MR_DEVICE_HIGH_IOPS_DEPTH 8 |
|---|
| 2248 | +#define MR_HIGH_IOPS_BATCH_COUNT 16 |
|---|
| 2249 | + |
|---|
| 2250 | +enum MR_PERF_MODE { |
|---|
| 2251 | + MR_BALANCED_PERF_MODE = 0, |
|---|
| 2252 | + MR_IOPS_PERF_MODE = 1, |
|---|
| 2253 | + MR_LATENCY_PERF_MODE = 2, |
|---|
| 2254 | +}; |
|---|
| 2255 | + |
|---|
| 2256 | +#define MEGASAS_PERF_MODE_2STR(mode) \ |
|---|
| 2257 | + ((mode) == MR_BALANCED_PERF_MODE ? "Balanced" : \ |
|---|
| 2258 | + (mode) == MR_IOPS_PERF_MODE ? "IOPS" : \ |
|---|
| 2259 | + (mode) == MR_LATENCY_PERF_MODE ? "Latency" : \ |
|---|
| 2260 | + "Unknown") |
|---|
| 2261 | + |
|---|
| 2262 | +enum MEGASAS_LD_TARGET_ID_STATUS { |
|---|
| 2263 | + LD_TARGET_ID_INITIAL, |
|---|
| 2264 | + LD_TARGET_ID_ACTIVE, |
|---|
| 2265 | + LD_TARGET_ID_DELETED, |
|---|
| 2266 | +}; |
|---|
| 2267 | + |
|---|
| 2268 | +#define MEGASAS_TARGET_ID(sdev) \ |
|---|
| 2269 | + (((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id) |
|---|
| 2145 | 2270 | |
|---|
| 2146 | 2271 | struct megasas_instance { |
|---|
| 2147 | 2272 | |
|---|
| .. | .. |
|---|
| 2181 | 2306 | struct MR_LD_TARGETID_LIST *ld_targetid_list_buf; |
|---|
| 2182 | 2307 | dma_addr_t ld_targetid_list_buf_h; |
|---|
| 2183 | 2308 | |
|---|
| 2309 | + struct MR_HOST_DEVICE_LIST *host_device_list_buf; |
|---|
| 2310 | + dma_addr_t host_device_list_buf_h; |
|---|
| 2311 | + |
|---|
| 2312 | + struct MR_SNAPDUMP_PROPERTIES *snapdump_prop; |
|---|
| 2313 | + dma_addr_t snapdump_prop_h; |
|---|
| 2314 | + |
|---|
| 2184 | 2315 | void *crash_buf[MAX_CRASH_DUMP_SIZE]; |
|---|
| 2185 | 2316 | unsigned int fw_crash_buffer_size; |
|---|
| 2186 | 2317 | unsigned int fw_crash_state; |
|---|
| .. | .. |
|---|
| 2193 | 2324 | u32 secure_jbod_support; |
|---|
| 2194 | 2325 | u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */ |
|---|
| 2195 | 2326 | bool use_seqnum_jbod_fp; /* Added for PD sequence */ |
|---|
| 2327 | + bool smp_affinity_enable; |
|---|
| 2196 | 2328 | spinlock_t crashdump_lock; |
|---|
| 2197 | 2329 | |
|---|
| 2198 | 2330 | struct megasas_register_set __iomem *reg_set; |
|---|
| .. | .. |
|---|
| 2200 | 2332 | struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; |
|---|
| 2201 | 2333 | struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD]; |
|---|
| 2202 | 2334 | u8 ld_ids[MEGASAS_MAX_LD_IDS]; |
|---|
| 2335 | + u8 ld_tgtid_status[MEGASAS_MAX_LD_IDS]; |
|---|
| 2336 | + u8 ld_ids_prev[MEGASAS_MAX_LD_IDS]; |
|---|
| 2337 | + u8 ld_ids_from_raidmap[MEGASAS_MAX_LD_IDS]; |
|---|
| 2203 | 2338 | s8 init_id; |
|---|
| 2204 | 2339 | |
|---|
| 2205 | 2340 | u16 max_num_sge; |
|---|
| .. | .. |
|---|
| 2210 | 2345 | u16 ldio_threshold; |
|---|
| 2211 | 2346 | u16 cur_can_queue; |
|---|
| 2212 | 2347 | u32 max_sectors_per_req; |
|---|
| 2348 | + bool msix_load_balance; |
|---|
| 2213 | 2349 | struct megasas_aen_event *ev; |
|---|
| 2214 | 2350 | |
|---|
| 2215 | 2351 | struct megasas_cmd **cmd_list; |
|---|
| .. | .. |
|---|
| 2237 | 2373 | struct pci_dev *pdev; |
|---|
| 2238 | 2374 | u32 unique_id; |
|---|
| 2239 | 2375 | u32 fw_support_ieee; |
|---|
| 2376 | + u32 threshold_reply_count; |
|---|
| 2240 | 2377 | |
|---|
| 2241 | 2378 | atomic_t fw_outstanding; |
|---|
| 2242 | 2379 | atomic_t ldio_outstanding; |
|---|
| 2243 | 2380 | atomic_t fw_reset_no_pci_access; |
|---|
| 2244 | | - atomic_t ieee_sgl; |
|---|
| 2245 | | - atomic_t prp_sgl; |
|---|
| 2246 | | - atomic_t sge_holes_type1; |
|---|
| 2247 | | - atomic_t sge_holes_type2; |
|---|
| 2248 | | - atomic_t sge_holes_type3; |
|---|
| 2381 | + atomic64_t total_io_count; |
|---|
| 2382 | + atomic64_t high_iops_outstanding; |
|---|
| 2249 | 2383 | |
|---|
| 2250 | 2384 | struct megasas_instance_template *instancet; |
|---|
| 2251 | 2385 | struct tasklet_struct isr_tasklet; |
|---|
| 2252 | 2386 | struct work_struct work_init; |
|---|
| 2253 | | - struct work_struct crash_init; |
|---|
| 2387 | + struct delayed_work fw_fault_work; |
|---|
| 2388 | + struct workqueue_struct *fw_fault_work_q; |
|---|
| 2389 | + char fault_handler_work_q_name[48]; |
|---|
| 2254 | 2390 | |
|---|
| 2255 | 2391 | u8 flag; |
|---|
| 2256 | 2392 | u8 unload; |
|---|
| .. | .. |
|---|
| 2308 | 2444 | u8 adapter_type; |
|---|
| 2309 | 2445 | bool consistent_mask_64bit; |
|---|
| 2310 | 2446 | bool support_nvme_passthru; |
|---|
| 2447 | + bool enable_sdev_max_qd; |
|---|
| 2311 | 2448 | u8 task_abort_tmo; |
|---|
| 2312 | 2449 | u8 max_reset_tmo; |
|---|
| 2450 | + u8 snapdump_wait_time; |
|---|
| 2451 | +#ifdef CONFIG_DEBUG_FS |
|---|
| 2452 | + struct dentry *debugfs_root; |
|---|
| 2453 | + struct dentry *raidmap_dump; |
|---|
| 2454 | +#endif |
|---|
| 2455 | + u8 enable_fw_dev_list; |
|---|
| 2456 | + bool atomic_desc_support; |
|---|
| 2457 | + bool support_seqnum_jbod_fp; |
|---|
| 2458 | + bool support_pci_lane_margining; |
|---|
| 2459 | + u8 low_latency_index_start; |
|---|
| 2460 | + int perf_mode; |
|---|
| 2313 | 2461 | }; |
|---|
| 2462 | + |
|---|
| 2314 | 2463 | struct MR_LD_VF_MAP { |
|---|
| 2315 | 2464 | u32 size; |
|---|
| 2316 | 2465 | union MR_LD_REF ref; |
|---|
| .. | .. |
|---|
| 2386 | 2535 | void (*enable_intr)(struct megasas_instance *); |
|---|
| 2387 | 2536 | void (*disable_intr)(struct megasas_instance *); |
|---|
| 2388 | 2537 | |
|---|
| 2389 | | - int (*clear_intr)(struct megasas_register_set __iomem *); |
|---|
| 2538 | + int (*clear_intr)(struct megasas_instance *); |
|---|
| 2390 | 2539 | |
|---|
| 2391 | | - u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); |
|---|
| 2540 | + u32 (*read_fw_status_reg)(struct megasas_instance *); |
|---|
| 2392 | 2541 | int (*adp_reset)(struct megasas_instance *, \ |
|---|
| 2393 | 2542 | struct megasas_register_set __iomem *); |
|---|
| 2394 | 2543 | int (*check_reset)(struct megasas_instance *, \ |
|---|
| .. | .. |
|---|
| 2404 | 2553 | |
|---|
| 2405 | 2554 | #define MEGASAS_IS_LOGICAL(sdev) \ |
|---|
| 2406 | 2555 | ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) |
|---|
| 2556 | + |
|---|
| 2557 | +#define MEGASAS_IS_LUN_VALID(sdev) \ |
|---|
| 2558 | + (((sdev)->lun == 0) ? 1 : 0) |
|---|
| 2407 | 2559 | |
|---|
| 2408 | 2560 | #define MEGASAS_DEV_INDEX(scp) \ |
|---|
| 2409 | 2561 | (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ |
|---|
| .. | .. |
|---|
| 2503 | 2655 | }; |
|---|
| 2504 | 2656 | |
|---|
| 2505 | 2657 | enum DCMD_RETURN_STATUS { |
|---|
| 2506 | | - DCMD_SUCCESS = 0, |
|---|
| 2507 | | - DCMD_TIMEOUT = 1, |
|---|
| 2508 | | - DCMD_FAILED = 2, |
|---|
| 2509 | | - DCMD_NOT_FIRED = 3, |
|---|
| 2658 | + DCMD_SUCCESS = 0x00, |
|---|
| 2659 | + DCMD_TIMEOUT = 0x01, |
|---|
| 2660 | + DCMD_FAILED = 0x02, |
|---|
| 2661 | + DCMD_BUSY = 0x03, |
|---|
| 2662 | + DCMD_INIT = 0xff, |
|---|
| 2510 | 2663 | }; |
|---|
| 2511 | 2664 | |
|---|
| 2512 | 2665 | u8 |
|---|
| .. | .. |
|---|
| 2535 | 2688 | bool is_target_prop); |
|---|
| 2536 | 2689 | int megasas_get_target_prop(struct megasas_instance *instance, |
|---|
| 2537 | 2690 | struct scsi_device *sdev); |
|---|
| 2691 | +void megasas_get_snapdump_properties(struct megasas_instance *instance); |
|---|
| 2538 | 2692 | |
|---|
| 2539 | 2693 | int megasas_set_crash_dump_params(struct megasas_instance *instance, |
|---|
| 2540 | 2694 | u8 crash_buf_state); |
|---|
| 2541 | 2695 | void megasas_free_host_crash_buffer(struct megasas_instance *instance); |
|---|
| 2542 | | -void megasas_fusion_crash_dump_wq(struct work_struct *work); |
|---|
| 2543 | 2696 | |
|---|
| 2544 | 2697 | void megasas_return_cmd_fusion(struct megasas_instance *instance, |
|---|
| 2545 | 2698 | struct megasas_cmd_fusion *cmd); |
|---|
| .. | .. |
|---|
| 2560 | 2713 | u32 mega_mod64(u64 dividend, u32 divisor); |
|---|
| 2561 | 2714 | int megasas_alloc_fusion_context(struct megasas_instance *instance); |
|---|
| 2562 | 2715 | void megasas_free_fusion_context(struct megasas_instance *instance); |
|---|
| 2716 | +int megasas_fusion_start_watchdog(struct megasas_instance *instance); |
|---|
| 2717 | +void megasas_fusion_stop_watchdog(struct megasas_instance *instance); |
|---|
| 2718 | + |
|---|
| 2563 | 2719 | void megasas_set_dma_settings(struct megasas_instance *instance, |
|---|
| 2564 | 2720 | struct megasas_dcmd_frame *dcmd, |
|---|
| 2565 | 2721 | dma_addr_t dma_addr, u32 dma_len); |
|---|
| 2722 | +int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, |
|---|
| 2723 | + bool do_adp_reset, |
|---|
| 2724 | + int ocr_context); |
|---|
| 2725 | +int megasas_irqpoll(struct irq_poll *irqpoll, int budget); |
|---|
| 2726 | +void megasas_dump_fusion_io(struct scsi_cmnd *scmd); |
|---|
| 2727 | +u32 megasas_readl(struct megasas_instance *instance, |
|---|
| 2728 | + const volatile void __iomem *addr); |
|---|
| 2729 | +struct megasas_cmd *megasas_get_cmd(struct megasas_instance *instance); |
|---|
| 2730 | +void megasas_return_cmd(struct megasas_instance *instance, |
|---|
| 2731 | + struct megasas_cmd *cmd); |
|---|
| 2732 | +int megasas_issue_polled(struct megasas_instance *instance, |
|---|
| 2733 | + struct megasas_cmd *cmd); |
|---|
| 2734 | +void megaraid_sas_kill_hba(struct megasas_instance *instance); |
|---|
| 2735 | +void megasas_check_and_restore_queue_depth(struct megasas_instance *instance); |
|---|
| 2736 | +void megasas_start_timer(struct megasas_instance *instance); |
|---|
| 2737 | +int megasas_sriov_start_heartbeat(struct megasas_instance *instance, |
|---|
| 2738 | + int initial); |
|---|
| 2739 | +int megasas_alloc_cmds(struct megasas_instance *instance); |
|---|
| 2740 | +void megasas_free_cmds(struct megasas_instance *instance); |
|---|
| 2741 | + |
|---|
| 2742 | +void megasas_init_debugfs(void); |
|---|
| 2743 | +void megasas_exit_debugfs(void); |
|---|
| 2744 | +void megasas_setup_debugfs(struct megasas_instance *instance); |
|---|
| 2745 | +void megasas_destroy_debugfs(struct megasas_instance *instance); |
|---|
| 2746 | + |
|---|
| 2566 | 2747 | #endif /*LSI_MEGARAID_SAS_H */ |
|---|