.. | .. |
---|
| 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 | |
---|
.. | .. |
---|
1434 | 1517 | #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \ |
---|
1435 | 1518 | MEGASAS_MAX_DEV_PER_CHANNEL) |
---|
1436 | 1519 | |
---|
| 1520 | +#define MEGASAS_MAX_SUPPORTED_LD_IDS 240 |
---|
| 1521 | + |
---|
1437 | 1522 | #define MEGASAS_MAX_SECTORS (2*1024) |
---|
1438 | 1523 | #define MEGASAS_MAX_SECTORS_IEEE (2*128) |
---|
1439 | 1524 | #define MEGASAS_DBG_LVL 1 |
---|
.. | .. |
---|
1441 | 1526 | #define MEGASAS_FW_BUSY 1 |
---|
1442 | 1527 | |
---|
1443 | 1528 | /* Driver's internal Logging levels*/ |
---|
1444 | | -#define OCR_LOGS (1 << 0) |
---|
| 1529 | +#define OCR_DEBUG (1 << 0) |
---|
| 1530 | +#define TM_DEBUG (1 << 1) |
---|
| 1531 | +#define LD_PD_DEBUG (1 << 2) |
---|
1445 | 1532 | |
---|
1446 | 1533 | #define SCAN_PD_CHANNEL 0x1 |
---|
1447 | 1534 | #define SCAN_VD_CHANNEL 0x2 |
---|
.. | .. |
---|
1485 | 1572 | #define MEGASAS_IOCTL_CMD 0 |
---|
1486 | 1573 | #define MEGASAS_DEFAULT_CMD_TIMEOUT 90 |
---|
1487 | 1574 | #define MEGASAS_THROTTLE_QUEUE_DEPTH 16 |
---|
1488 | | -#define MEGASAS_BLOCKED_CMD_TIMEOUT 60 |
---|
1489 | 1575 | #define MEGASAS_DEFAULT_TM_TIMEOUT 50 |
---|
1490 | 1576 | /* |
---|
1491 | 1577 | * FW reports the maximum of number of commands that it can accept (maximum |
---|
.. | .. |
---|
1518 | 1604 | #define MFI_IO_TIMEOUT_SECS 180 |
---|
1519 | 1605 | #define MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF (5 * HZ) |
---|
1520 | 1606 | #define MEGASAS_OCR_SETTLE_TIME_VF (1000 * 30) |
---|
| 1607 | +#define MEGASAS_SRIOV_MAX_RESET_TRIES_VF 1 |
---|
1521 | 1608 | #define MEGASAS_ROUTINE_WAIT_TIME_VF 300 |
---|
1522 | 1609 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 |
---|
1523 | 1610 | #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 |
---|
.. | .. |
---|
1542 | 1629 | |
---|
1543 | 1630 | #define MR_CAN_HANDLE_SYNC_CACHE_OFFSET 0X01000000 |
---|
1544 | 1631 | |
---|
| 1632 | +#define MR_ATOMIC_DESCRIPTOR_SUPPORT_OFFSET (1 << 24) |
---|
| 1633 | + |
---|
1545 | 1634 | #define MR_CAN_HANDLE_64_BIT_DMA_OFFSET (1 << 25) |
---|
| 1635 | +#define MR_INTR_COALESCING_SUPPORT_OFFSET (1 << 26) |
---|
| 1636 | + |
---|
| 1637 | +#define MEGASAS_WATCHDOG_THREAD_INTERVAL 1000 |
---|
| 1638 | +#define MEGASAS_WAIT_FOR_NEXT_DMA_MSECS 20 |
---|
| 1639 | +#define MEGASAS_WATCHDOG_WAIT_COUNT 50 |
---|
1546 | 1640 | |
---|
1547 | 1641 | enum MR_ADAPTER_TYPE { |
---|
1548 | 1642 | MFI_SERIES = 1, |
---|
1549 | 1643 | THUNDERBOLT_SERIES = 2, |
---|
1550 | 1644 | INVADER_SERIES = 3, |
---|
1551 | 1645 | VENTURA_SERIES = 4, |
---|
| 1646 | + AERO_SERIES = 5, |
---|
1552 | 1647 | }; |
---|
1553 | 1648 | |
---|
1554 | 1649 | /* |
---|
.. | .. |
---|
1588 | 1683 | |
---|
1589 | 1684 | u32 reserved_3[3]; /*00A4h*/ |
---|
1590 | 1685 | |
---|
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 | | - |
---|
| 1686 | + u32 outbound_scratch_pad_0; /*00B0h*/ |
---|
| 1687 | + u32 outbound_scratch_pad_1; /*00B4h*/ |
---|
| 1688 | + u32 outbound_scratch_pad_2; /*00B8h*/ |
---|
| 1689 | + u32 outbound_scratch_pad_3; /*00BCh*/ |
---|
1596 | 1690 | |
---|
1597 | 1691 | u32 inbound_low_queue_port ; /*00C0h*/ |
---|
1598 | 1692 | |
---|
.. | .. |
---|
1664 | 1758 | typedef union _MFI_CAPABILITIES { |
---|
1665 | 1759 | struct { |
---|
1666 | 1760 | #if defined(__BIG_ENDIAN_BITFIELD) |
---|
1667 | | - u32 reserved:17; |
---|
| 1761 | + u32 reserved:16; |
---|
| 1762 | + u32 support_fw_exposed_dev_list:1; |
---|
1668 | 1763 | u32 support_nvme_passthru:1; |
---|
1669 | 1764 | u32 support_64bit_mode:1; |
---|
1670 | 1765 | u32 support_pd_map_target_id:1; |
---|
.. | .. |
---|
1696 | 1791 | u32 support_pd_map_target_id:1; |
---|
1697 | 1792 | u32 support_64bit_mode:1; |
---|
1698 | 1793 | u32 support_nvme_passthru:1; |
---|
1699 | | - u32 reserved:17; |
---|
| 1794 | + u32 support_fw_exposed_dev_list:1; |
---|
| 1795 | + u32 reserved:16; |
---|
1700 | 1796 | #endif |
---|
1701 | 1797 | } mfi_capabilities; |
---|
1702 | 1798 | __le32 reg; |
---|
.. | .. |
---|
1715 | 1811 | __le32 pad_0; /*0Ch */ |
---|
1716 | 1812 | |
---|
1717 | 1813 | __le16 flags; /*10h */ |
---|
1718 | | - __le16 reserved_3; /*12h */ |
---|
| 1814 | + __le16 replyqueue_mask; /*12h */ |
---|
1719 | 1815 | __le32 data_xfer_len; /*14h */ |
---|
1720 | 1816 | |
---|
1721 | 1817 | __le32 queue_info_new_phys_addr_lo; /*18h */ |
---|
.. | .. |
---|
2111 | 2207 | }; |
---|
2112 | 2208 | |
---|
2113 | 2209 | struct megasas_irq_context { |
---|
| 2210 | + char name[MEGASAS_MSIX_NAME_LEN]; |
---|
2114 | 2211 | struct megasas_instance *instance; |
---|
2115 | 2212 | u32 MSIxIndex; |
---|
| 2213 | + u32 os_irq; |
---|
| 2214 | + struct irq_poll irqpoll; |
---|
| 2215 | + bool irq_poll_scheduled; |
---|
| 2216 | + bool irq_line_enable; |
---|
2116 | 2217 | }; |
---|
2117 | 2218 | |
---|
2118 | 2219 | struct MR_DRV_SYSTEM_INFO { |
---|
.. | .. |
---|
2134 | 2235 | |
---|
2135 | 2236 | /* JBOD Queue depth definitions */ |
---|
2136 | 2237 | #define MEGASAS_SATA_QD 32 |
---|
2137 | | -#define MEGASAS_SAS_QD 64 |
---|
| 2238 | +#define MEGASAS_SAS_QD 256 |
---|
2138 | 2239 | #define MEGASAS_DEFAULT_PD_QD 64 |
---|
2139 | | -#define MEGASAS_NVME_QD 32 |
---|
| 2240 | +#define MEGASAS_NVME_QD 64 |
---|
2140 | 2241 | |
---|
2141 | 2242 | #define MR_DEFAULT_NVME_PAGE_SIZE 4096 |
---|
2142 | 2243 | #define MR_DEFAULT_NVME_PAGE_SHIFT 12 |
---|
2143 | 2244 | #define MR_DEFAULT_NVME_MDTS_KB 128 |
---|
2144 | 2245 | #define MR_NVME_PAGE_SIZE_MASK 0x000000FF |
---|
| 2246 | + |
---|
| 2247 | +/*Aero performance parameters*/ |
---|
| 2248 | +#define MR_HIGH_IOPS_QUEUE_COUNT 8 |
---|
| 2249 | +#define MR_DEVICE_HIGH_IOPS_DEPTH 8 |
---|
| 2250 | +#define MR_HIGH_IOPS_BATCH_COUNT 16 |
---|
| 2251 | + |
---|
| 2252 | +enum MR_PERF_MODE { |
---|
| 2253 | + MR_BALANCED_PERF_MODE = 0, |
---|
| 2254 | + MR_IOPS_PERF_MODE = 1, |
---|
| 2255 | + MR_LATENCY_PERF_MODE = 2, |
---|
| 2256 | +}; |
---|
| 2257 | + |
---|
| 2258 | +#define MEGASAS_PERF_MODE_2STR(mode) \ |
---|
| 2259 | + ((mode) == MR_BALANCED_PERF_MODE ? "Balanced" : \ |
---|
| 2260 | + (mode) == MR_IOPS_PERF_MODE ? "IOPS" : \ |
---|
| 2261 | + (mode) == MR_LATENCY_PERF_MODE ? "Latency" : \ |
---|
| 2262 | + "Unknown") |
---|
| 2263 | + |
---|
| 2264 | +enum MEGASAS_LD_TARGET_ID_STATUS { |
---|
| 2265 | + LD_TARGET_ID_INITIAL, |
---|
| 2266 | + LD_TARGET_ID_ACTIVE, |
---|
| 2267 | + LD_TARGET_ID_DELETED, |
---|
| 2268 | +}; |
---|
| 2269 | + |
---|
| 2270 | +#define MEGASAS_TARGET_ID(sdev) \ |
---|
| 2271 | + (((sdev->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id) |
---|
2145 | 2272 | |
---|
2146 | 2273 | struct megasas_instance { |
---|
2147 | 2274 | |
---|
.. | .. |
---|
2181 | 2308 | struct MR_LD_TARGETID_LIST *ld_targetid_list_buf; |
---|
2182 | 2309 | dma_addr_t ld_targetid_list_buf_h; |
---|
2183 | 2310 | |
---|
| 2311 | + struct MR_HOST_DEVICE_LIST *host_device_list_buf; |
---|
| 2312 | + dma_addr_t host_device_list_buf_h; |
---|
| 2313 | + |
---|
| 2314 | + struct MR_SNAPDUMP_PROPERTIES *snapdump_prop; |
---|
| 2315 | + dma_addr_t snapdump_prop_h; |
---|
| 2316 | + |
---|
2184 | 2317 | void *crash_buf[MAX_CRASH_DUMP_SIZE]; |
---|
2185 | 2318 | unsigned int fw_crash_buffer_size; |
---|
2186 | 2319 | unsigned int fw_crash_state; |
---|
.. | .. |
---|
2193 | 2326 | u32 secure_jbod_support; |
---|
2194 | 2327 | u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */ |
---|
2195 | 2328 | bool use_seqnum_jbod_fp; /* Added for PD sequence */ |
---|
2196 | | - spinlock_t crashdump_lock; |
---|
| 2329 | + bool smp_affinity_enable; |
---|
| 2330 | + struct mutex crashdump_lock; |
---|
2197 | 2331 | |
---|
2198 | 2332 | struct megasas_register_set __iomem *reg_set; |
---|
2199 | 2333 | u32 __iomem *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY]; |
---|
2200 | 2334 | struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; |
---|
2201 | 2335 | struct megasas_pd_list local_pd_list[MEGASAS_MAX_PD]; |
---|
2202 | 2336 | u8 ld_ids[MEGASAS_MAX_LD_IDS]; |
---|
| 2337 | + u8 ld_tgtid_status[MEGASAS_MAX_LD_IDS]; |
---|
| 2338 | + u8 ld_ids_prev[MEGASAS_MAX_LD_IDS]; |
---|
| 2339 | + u8 ld_ids_from_raidmap[MEGASAS_MAX_LD_IDS]; |
---|
2203 | 2340 | s8 init_id; |
---|
2204 | 2341 | |
---|
2205 | 2342 | u16 max_num_sge; |
---|
.. | .. |
---|
2210 | 2347 | u16 ldio_threshold; |
---|
2211 | 2348 | u16 cur_can_queue; |
---|
2212 | 2349 | u32 max_sectors_per_req; |
---|
| 2350 | + bool msix_load_balance; |
---|
2213 | 2351 | struct megasas_aen_event *ev; |
---|
2214 | 2352 | |
---|
2215 | 2353 | struct megasas_cmd **cmd_list; |
---|
.. | .. |
---|
2237 | 2375 | struct pci_dev *pdev; |
---|
2238 | 2376 | u32 unique_id; |
---|
2239 | 2377 | u32 fw_support_ieee; |
---|
| 2378 | + u32 threshold_reply_count; |
---|
2240 | 2379 | |
---|
2241 | 2380 | atomic_t fw_outstanding; |
---|
2242 | 2381 | atomic_t ldio_outstanding; |
---|
2243 | 2382 | 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; |
---|
| 2383 | + atomic64_t total_io_count; |
---|
| 2384 | + atomic64_t high_iops_outstanding; |
---|
2249 | 2385 | |
---|
2250 | 2386 | struct megasas_instance_template *instancet; |
---|
2251 | 2387 | struct tasklet_struct isr_tasklet; |
---|
2252 | 2388 | struct work_struct work_init; |
---|
2253 | | - struct work_struct crash_init; |
---|
| 2389 | + struct delayed_work fw_fault_work; |
---|
| 2390 | + struct workqueue_struct *fw_fault_work_q; |
---|
| 2391 | + char fault_handler_work_q_name[48]; |
---|
2254 | 2392 | |
---|
2255 | 2393 | u8 flag; |
---|
2256 | 2394 | u8 unload; |
---|
.. | .. |
---|
2308 | 2446 | u8 adapter_type; |
---|
2309 | 2447 | bool consistent_mask_64bit; |
---|
2310 | 2448 | bool support_nvme_passthru; |
---|
| 2449 | + bool enable_sdev_max_qd; |
---|
2311 | 2450 | u8 task_abort_tmo; |
---|
2312 | 2451 | u8 max_reset_tmo; |
---|
| 2452 | + u8 snapdump_wait_time; |
---|
| 2453 | +#ifdef CONFIG_DEBUG_FS |
---|
| 2454 | + struct dentry *debugfs_root; |
---|
| 2455 | + struct dentry *raidmap_dump; |
---|
| 2456 | +#endif |
---|
| 2457 | + u8 enable_fw_dev_list; |
---|
| 2458 | + bool atomic_desc_support; |
---|
| 2459 | + bool support_seqnum_jbod_fp; |
---|
| 2460 | + bool support_pci_lane_margining; |
---|
| 2461 | + u8 low_latency_index_start; |
---|
| 2462 | + int perf_mode; |
---|
2313 | 2463 | }; |
---|
| 2464 | + |
---|
2314 | 2465 | struct MR_LD_VF_MAP { |
---|
2315 | 2466 | u32 size; |
---|
2316 | 2467 | union MR_LD_REF ref; |
---|
.. | .. |
---|
2386 | 2537 | void (*enable_intr)(struct megasas_instance *); |
---|
2387 | 2538 | void (*disable_intr)(struct megasas_instance *); |
---|
2388 | 2539 | |
---|
2389 | | - int (*clear_intr)(struct megasas_register_set __iomem *); |
---|
| 2540 | + int (*clear_intr)(struct megasas_instance *); |
---|
2390 | 2541 | |
---|
2391 | | - u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); |
---|
| 2542 | + u32 (*read_fw_status_reg)(struct megasas_instance *); |
---|
2392 | 2543 | int (*adp_reset)(struct megasas_instance *, \ |
---|
2393 | 2544 | struct megasas_register_set __iomem *); |
---|
2394 | 2545 | int (*check_reset)(struct megasas_instance *, \ |
---|
.. | .. |
---|
2404 | 2555 | |
---|
2405 | 2556 | #define MEGASAS_IS_LOGICAL(sdev) \ |
---|
2406 | 2557 | ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) |
---|
| 2558 | + |
---|
| 2559 | +#define MEGASAS_IS_LUN_VALID(sdev) \ |
---|
| 2560 | + (((sdev)->lun == 0) ? 1 : 0) |
---|
2407 | 2561 | |
---|
2408 | 2562 | #define MEGASAS_DEV_INDEX(scp) \ |
---|
2409 | 2563 | (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ |
---|
.. | .. |
---|
2503 | 2657 | }; |
---|
2504 | 2658 | |
---|
2505 | 2659 | enum DCMD_RETURN_STATUS { |
---|
2506 | | - DCMD_SUCCESS = 0, |
---|
2507 | | - DCMD_TIMEOUT = 1, |
---|
2508 | | - DCMD_FAILED = 2, |
---|
2509 | | - DCMD_NOT_FIRED = 3, |
---|
| 2660 | + DCMD_SUCCESS = 0x00, |
---|
| 2661 | + DCMD_TIMEOUT = 0x01, |
---|
| 2662 | + DCMD_FAILED = 0x02, |
---|
| 2663 | + DCMD_BUSY = 0x03, |
---|
| 2664 | + DCMD_INIT = 0xff, |
---|
2510 | 2665 | }; |
---|
2511 | 2666 | |
---|
2512 | 2667 | u8 |
---|
.. | .. |
---|
2535 | 2690 | bool is_target_prop); |
---|
2536 | 2691 | int megasas_get_target_prop(struct megasas_instance *instance, |
---|
2537 | 2692 | struct scsi_device *sdev); |
---|
| 2693 | +void megasas_get_snapdump_properties(struct megasas_instance *instance); |
---|
2538 | 2694 | |
---|
2539 | 2695 | int megasas_set_crash_dump_params(struct megasas_instance *instance, |
---|
2540 | 2696 | u8 crash_buf_state); |
---|
2541 | 2697 | void megasas_free_host_crash_buffer(struct megasas_instance *instance); |
---|
2542 | | -void megasas_fusion_crash_dump_wq(struct work_struct *work); |
---|
2543 | 2698 | |
---|
2544 | 2699 | void megasas_return_cmd_fusion(struct megasas_instance *instance, |
---|
2545 | 2700 | struct megasas_cmd_fusion *cmd); |
---|
.. | .. |
---|
2560 | 2715 | u32 mega_mod64(u64 dividend, u32 divisor); |
---|
2561 | 2716 | int megasas_alloc_fusion_context(struct megasas_instance *instance); |
---|
2562 | 2717 | void megasas_free_fusion_context(struct megasas_instance *instance); |
---|
| 2718 | +int megasas_fusion_start_watchdog(struct megasas_instance *instance); |
---|
| 2719 | +void megasas_fusion_stop_watchdog(struct megasas_instance *instance); |
---|
| 2720 | + |
---|
2563 | 2721 | void megasas_set_dma_settings(struct megasas_instance *instance, |
---|
2564 | 2722 | struct megasas_dcmd_frame *dcmd, |
---|
2565 | 2723 | dma_addr_t dma_addr, u32 dma_len); |
---|
| 2724 | +int megasas_adp_reset_wait_for_ready(struct megasas_instance *instance, |
---|
| 2725 | + bool do_adp_reset, |
---|
| 2726 | + int ocr_context); |
---|
| 2727 | +int megasas_irqpoll(struct irq_poll *irqpoll, int budget); |
---|
| 2728 | +void megasas_dump_fusion_io(struct scsi_cmnd *scmd); |
---|
| 2729 | +u32 megasas_readl(struct megasas_instance *instance, |
---|
| 2730 | + const volatile void __iomem *addr); |
---|
| 2731 | +struct megasas_cmd *megasas_get_cmd(struct megasas_instance *instance); |
---|
| 2732 | +void megasas_return_cmd(struct megasas_instance *instance, |
---|
| 2733 | + struct megasas_cmd *cmd); |
---|
| 2734 | +int megasas_issue_polled(struct megasas_instance *instance, |
---|
| 2735 | + struct megasas_cmd *cmd); |
---|
| 2736 | +void megaraid_sas_kill_hba(struct megasas_instance *instance); |
---|
| 2737 | +void megasas_check_and_restore_queue_depth(struct megasas_instance *instance); |
---|
| 2738 | +void megasas_start_timer(struct megasas_instance *instance); |
---|
| 2739 | +int megasas_sriov_start_heartbeat(struct megasas_instance *instance, |
---|
| 2740 | + int initial); |
---|
| 2741 | +int megasas_alloc_cmds(struct megasas_instance *instance); |
---|
| 2742 | +void megasas_free_cmds(struct megasas_instance *instance); |
---|
| 2743 | + |
---|
| 2744 | +void megasas_init_debugfs(void); |
---|
| 2745 | +void megasas_exit_debugfs(void); |
---|
| 2746 | +void megasas_setup_debugfs(struct megasas_instance *instance); |
---|
| 2747 | +void megasas_destroy_debugfs(struct megasas_instance *instance); |
---|
| 2748 | + |
---|
2566 | 2749 | #endif /*LSI_MEGARAID_SAS_H */ |
---|