| .. | .. |
|---|
| 55 | 55 | #include "mpi/mpi2_tool.h" |
|---|
| 56 | 56 | #include "mpi/mpi2_sas.h" |
|---|
| 57 | 57 | #include "mpi/mpi2_pci.h" |
|---|
| 58 | +#include "mpi/mpi2_image.h" |
|---|
| 58 | 59 | |
|---|
| 59 | 60 | #include <scsi/scsi.h> |
|---|
| 60 | 61 | #include <scsi/scsi_cmnd.h> |
|---|
| .. | .. |
|---|
| 66 | 67 | #include <scsi/scsi_eh.h> |
|---|
| 67 | 68 | #include <linux/pci.h> |
|---|
| 68 | 69 | #include <linux/poll.h> |
|---|
| 70 | +#include <linux/irq_poll.h> |
|---|
| 69 | 71 | |
|---|
| 70 | 72 | #include "mpt3sas_debug.h" |
|---|
| 71 | 73 | #include "mpt3sas_trigger_diag.h" |
|---|
| .. | .. |
|---|
| 74 | 76 | #define MPT3SAS_DRIVER_NAME "mpt3sas" |
|---|
| 75 | 77 | #define MPT3SAS_AUTHOR "Avago Technologies <MPT-FusionLinux.pdl@avagotech.com>" |
|---|
| 76 | 78 | #define MPT3SAS_DESCRIPTION "LSI MPT Fusion SAS 3.0 Device Driver" |
|---|
| 77 | | -#define MPT3SAS_DRIVER_VERSION "26.100.00.00" |
|---|
| 78 | | -#define MPT3SAS_MAJOR_VERSION 26 |
|---|
| 79 | +#define MPT3SAS_DRIVER_VERSION "35.100.00.00" |
|---|
| 80 | +#define MPT3SAS_MAJOR_VERSION 35 |
|---|
| 79 | 81 | #define MPT3SAS_MINOR_VERSION 100 |
|---|
| 80 | 82 | #define MPT3SAS_BUILD_VERSION 0 |
|---|
| 81 | 83 | #define MPT3SAS_RELEASE_VERSION 00 |
|---|
| .. | .. |
|---|
| 87 | 89 | #define MPT2SAS_MINOR_VERSION 102 |
|---|
| 88 | 90 | #define MPT2SAS_BUILD_VERSION 0 |
|---|
| 89 | 91 | #define MPT2SAS_RELEASE_VERSION 00 |
|---|
| 92 | + |
|---|
| 93 | +/* CoreDump: Default timeout */ |
|---|
| 94 | +#define MPT3SAS_DEFAULT_COREDUMP_TIMEOUT_SECONDS (15) /*15 seconds*/ |
|---|
| 95 | +#define MPT3SAS_COREDUMP_LOOP_DONE (0xFF) |
|---|
| 90 | 96 | |
|---|
| 91 | 97 | /* |
|---|
| 92 | 98 | * Set MPT3SAS_SG_DEPTH value based on user input. |
|---|
| .. | .. |
|---|
| 138 | 144 | #define MAX_CHAIN_ELEMT_SZ 16 |
|---|
| 139 | 145 | #define DEFAULT_NUM_FWCHAIN_ELEMTS 8 |
|---|
| 140 | 146 | |
|---|
| 147 | +#define IO_UNIT_CONTROL_SHUTDOWN_TIMEOUT 6 |
|---|
| 141 | 148 | #define FW_IMG_HDR_READ_TIMEOUT 15 |
|---|
| 149 | + |
|---|
| 150 | +#define IOC_OPERATIONAL_WAIT_COUNT 10 |
|---|
| 151 | + |
|---|
| 142 | 152 | /* |
|---|
| 143 | 153 | * NVMe defines |
|---|
| 144 | 154 | */ |
|---|
| .. | .. |
|---|
| 158 | 168 | /* |
|---|
| 159 | 169 | * logging format |
|---|
| 160 | 170 | */ |
|---|
| 161 | | -#define MPT3SAS_FMT "%s: " |
|---|
| 171 | +#define ioc_err(ioc, fmt, ...) \ |
|---|
| 172 | + pr_err("%s: " fmt, (ioc)->name, ##__VA_ARGS__) |
|---|
| 173 | +#define ioc_notice(ioc, fmt, ...) \ |
|---|
| 174 | + pr_notice("%s: " fmt, (ioc)->name, ##__VA_ARGS__) |
|---|
| 175 | +#define ioc_warn(ioc, fmt, ...) \ |
|---|
| 176 | + pr_warn("%s: " fmt, (ioc)->name, ##__VA_ARGS__) |
|---|
| 177 | +#define ioc_info(ioc, fmt, ...) \ |
|---|
| 178 | + pr_info("%s: " fmt, (ioc)->name, ##__VA_ARGS__) |
|---|
| 162 | 179 | |
|---|
| 163 | 180 | /* |
|---|
| 164 | 181 | * WarpDrive Specific Log codes |
|---|
| .. | .. |
|---|
| 181 | 198 | |
|---|
| 182 | 199 | #define SAS2_PCI_DEVICE_B0_REVISION (0x01) |
|---|
| 183 | 200 | #define SAS3_PCI_DEVICE_C0_REVISION (0x02) |
|---|
| 201 | + |
|---|
| 202 | +/* Atlas PCIe Switch Management Port */ |
|---|
| 203 | +#define MPI26_ATLAS_PCIe_SWITCH_DEVID (0x00B2) |
|---|
| 184 | 204 | |
|---|
| 185 | 205 | /* |
|---|
| 186 | 206 | * Intel HBA branding |
|---|
| .. | .. |
|---|
| 288 | 308 | #define MPT3_DIAG_BUFFER_IS_REGISTERED (0x01) |
|---|
| 289 | 309 | #define MPT3_DIAG_BUFFER_IS_RELEASED (0x02) |
|---|
| 290 | 310 | #define MPT3_DIAG_BUFFER_IS_DIAG_RESET (0x04) |
|---|
| 311 | +#define MPT3_DIAG_BUFFER_IS_DRIVER_ALLOCATED (0x08) |
|---|
| 312 | +#define MPT3_DIAG_BUFFER_IS_APP_OWNED (0x10) |
|---|
| 291 | 313 | |
|---|
| 292 | 314 | /* |
|---|
| 293 | 315 | * HP HBA branding |
|---|
| .. | .. |
|---|
| 340 | 362 | |
|---|
| 341 | 363 | #define VIRTUAL_IO_FAILED_RETRY (0x32010081) |
|---|
| 342 | 364 | |
|---|
| 365 | +/* High IOPs definitions */ |
|---|
| 366 | +#define MPT3SAS_DEVICE_HIGH_IOPS_DEPTH 8 |
|---|
| 367 | +#define MPT3SAS_HIGH_IOPS_REPLY_QUEUES 8 |
|---|
| 368 | +#define MPT3SAS_HIGH_IOPS_BATCH_COUNT 16 |
|---|
| 369 | +#define MPT3SAS_GEN35_MAX_MSIX_QUEUES 128 |
|---|
| 370 | +#define RDPQ_MAX_INDEX_IN_ONE_CHUNK 16 |
|---|
| 371 | + |
|---|
| 343 | 372 | /* OEM Specific Flags will come from OEM specific header files */ |
|---|
| 344 | 373 | struct Mpi2ManufacturingPage10_t { |
|---|
| 345 | 374 | MPI2_CONFIG_PAGE_HEADER Header; /* 00h */ |
|---|
| .. | .. |
|---|
| 370 | 399 | u8 Reserved6; /* 2Fh */ |
|---|
| 371 | 400 | __le32 Reserved7[7]; /* 30h - 4Bh */ |
|---|
| 372 | 401 | u8 NVMeAbortTO; /* 4Ch */ |
|---|
| 373 | | - u8 Reserved8; /* 4Dh */ |
|---|
| 374 | | - u16 Reserved9; /* 4Eh */ |
|---|
| 375 | | - __le32 Reserved10[4]; /* 50h - 60h */ |
|---|
| 402 | + u8 NumPerDevEvents; /* 4Dh */ |
|---|
| 403 | + u8 HostTraceBufferDecrementSizeKB; /* 4Eh */ |
|---|
| 404 | + u8 HostTraceBufferFlags; /* 4Fh */ |
|---|
| 405 | + u16 HostTraceBufferMaxSizeKB; /* 50h */ |
|---|
| 406 | + u16 HostTraceBufferMinSizeKB; /* 52h */ |
|---|
| 407 | + u8 CoreDumpTOSec; /* 54h */ |
|---|
| 408 | + u8 Reserved8; /* 55h */ |
|---|
| 409 | + u16 Reserved9; /* 56h */ |
|---|
| 410 | + __le32 Reserved10; /* 58h */ |
|---|
| 376 | 411 | }; |
|---|
| 377 | 412 | |
|---|
| 378 | 413 | /** |
|---|
| .. | .. |
|---|
| 562 | 597 | * @enclosure_level: The level of device's enclosure from the controller |
|---|
| 563 | 598 | * @connector_name: ASCII value of the Connector's name |
|---|
| 564 | 599 | * @serial_number: pointer of serial number string allocated runtime |
|---|
| 600 | + * @access_status: Device's Access Status |
|---|
| 601 | + * @shutdown_latency: NVMe device's RTD3 Entry Latency |
|---|
| 565 | 602 | * @refcount: reference count for deletion |
|---|
| 566 | 603 | */ |
|---|
| 567 | 604 | struct _pcie_device { |
|---|
| .. | .. |
|---|
| 583 | 620 | u8 connector_name[4]; |
|---|
| 584 | 621 | u8 *serial_number; |
|---|
| 585 | 622 | u8 reset_timeout; |
|---|
| 623 | + u8 access_status; |
|---|
| 624 | + u16 shutdown_latency; |
|---|
| 586 | 625 | struct kref refcount; |
|---|
| 587 | 626 | }; |
|---|
| 588 | 627 | /** |
|---|
| .. | .. |
|---|
| 809 | 848 | */ |
|---|
| 810 | 849 | struct scsiio_tracker { |
|---|
| 811 | 850 | u16 smid; |
|---|
| 851 | + struct scsi_cmnd *scmd; |
|---|
| 812 | 852 | u8 cb_idx; |
|---|
| 813 | 853 | u8 direct_io; |
|---|
| 814 | 854 | struct pcie_sg_list pcie_sg_list; |
|---|
| .. | .. |
|---|
| 868 | 908 | * @reply_post_free: reply post base virt address |
|---|
| 869 | 909 | * @name: the name registered to request_irq() |
|---|
| 870 | 910 | * @busy: isr is actively processing replies on another cpu |
|---|
| 911 | + * @os_irq: irq number |
|---|
| 912 | + * @irqpoll: irq_poll object |
|---|
| 913 | + * @irq_poll_scheduled: Tells whether irq poll is scheduled or not |
|---|
| 871 | 914 | * @list: this list |
|---|
| 872 | 915 | */ |
|---|
| 873 | 916 | struct adapter_reply_queue { |
|---|
| .. | .. |
|---|
| 877 | 920 | Mpi2ReplyDescriptorsUnion_t *reply_post_free; |
|---|
| 878 | 921 | char name[MPT_NAME_LENGTH]; |
|---|
| 879 | 922 | atomic_t busy; |
|---|
| 923 | + u32 os_irq; |
|---|
| 924 | + struct irq_poll irqpoll; |
|---|
| 925 | + bool irq_poll_scheduled; |
|---|
| 926 | + bool irq_line_enable; |
|---|
| 880 | 927 | struct list_head list; |
|---|
| 881 | 928 | }; |
|---|
| 882 | 929 | |
|---|
| .. | .. |
|---|
| 901 | 948 | typedef void (*PUT_SMID_IO_FP_HIP) (struct MPT3SAS_ADAPTER *ioc, u16 smid, |
|---|
| 902 | 949 | u16 funcdep); |
|---|
| 903 | 950 | typedef void (*PUT_SMID_DEFAULT) (struct MPT3SAS_ADAPTER *ioc, u16 smid); |
|---|
| 951 | +typedef u32 (*BASE_READ_REG) (const volatile void __iomem *addr); |
|---|
| 952 | +/* |
|---|
| 953 | + * To get high iops reply queue's msix index when high iops mode is enabled |
|---|
| 954 | + * else get the msix index of general reply queues. |
|---|
| 955 | + */ |
|---|
| 956 | +typedef u8 (*GET_MSIX_INDEX) (struct MPT3SAS_ADAPTER *ioc, |
|---|
| 957 | + struct scsi_cmnd *scmd); |
|---|
| 904 | 958 | |
|---|
| 905 | 959 | /* IOC Facts and Port Facts converted from little endian to cpu */ |
|---|
| 906 | 960 | union mpi3_version_union { |
|---|
| .. | .. |
|---|
| 973 | 1027 | * @ir_firmware: IR firmware present |
|---|
| 974 | 1028 | * @bars: bitmask of BAR's that must be configured |
|---|
| 975 | 1029 | * @mask_interrupts: ignore interrupt |
|---|
| 976 | | - * @dma_mask: used to set the consistent dma mask |
|---|
| 977 | 1030 | * @pci_access_mutex: Mutex to synchronize ioctl, sysfs show path and |
|---|
| 978 | 1031 | * pci resource handling |
|---|
| 979 | 1032 | * @fault_reset_work_q_name: fw fault work queue |
|---|
| .. | .. |
|---|
| 983 | 1036 | * @firmware_event_thread: "" |
|---|
| 984 | 1037 | * @fw_event_lock: |
|---|
| 985 | 1038 | * @fw_event_list: list of fw events |
|---|
| 1039 | + * @current_evet: current processing firmware event |
|---|
| 1040 | + * @fw_event_cleanup: set to one while cleaning up the fw events |
|---|
| 986 | 1041 | * @aen_event_read_flag: event log was read |
|---|
| 987 | 1042 | * @broadcast_aen_busy: broadcast aen waiting to be serviced |
|---|
| 988 | 1043 | * @shost_recovery: host reset in progress |
|---|
| .. | .. |
|---|
| 1001 | 1056 | * @msix_vector_count: number msix vectors |
|---|
| 1002 | 1057 | * @cpu_msix_table: table for mapping cpus to msix index |
|---|
| 1003 | 1058 | * @cpu_msix_table_sz: table size |
|---|
| 1059 | + * @total_io_cnt: Gives total IO count, used to load balance the interrupts |
|---|
| 1060 | + * @ioc_coredump_loop: will have non-zero value when FW is in CoreDump state |
|---|
| 1061 | + * @high_iops_outstanding: used to load balance the interrupts |
|---|
| 1062 | + * within high iops reply queues |
|---|
| 1063 | + * @msix_load_balance: Enables load balancing of interrupts across |
|---|
| 1064 | + * the multiple MSIXs |
|---|
| 1004 | 1065 | * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands |
|---|
| 1066 | + * @thresh_hold: Max number of reply descriptors processed |
|---|
| 1067 | + * before updating Host Index |
|---|
| 1068 | + * @drv_support_bitmap: driver's supported feature bit map |
|---|
| 1069 | + * @use_32bit_dma: Flag to use 32 bit consistent dma mask |
|---|
| 1005 | 1070 | * @scsi_io_cb_idx: shost generated commands |
|---|
| 1006 | 1071 | * @tm_cb_idx: task management commands |
|---|
| 1007 | 1072 | * @scsih_cb_idx: scsih internal commands |
|---|
| .. | .. |
|---|
| 1022 | 1087 | * @event_context: unique id for each logged event |
|---|
| 1023 | 1088 | * @event_log: event log pointer |
|---|
| 1024 | 1089 | * @event_masks: events that are masked |
|---|
| 1090 | + * @max_shutdown_latency: timeout value for NVMe shutdown operation, |
|---|
| 1091 | + * which is equal that NVMe drive's RTD3 Entry Latency |
|---|
| 1092 | + * which has reported maximum RTD3 Entry Latency value |
|---|
| 1093 | + * among attached NVMe drives. |
|---|
| 1025 | 1094 | * @facts: static facts data |
|---|
| 1095 | + * @prev_fw_facts: previous fw facts data |
|---|
| 1026 | 1096 | * @pfacts: static port facts data |
|---|
| 1027 | 1097 | * @manu_pg0: static manufacturing page 0 |
|---|
| 1028 | 1098 | * @manu_pg10: static manufacturing page 10 |
|---|
| .. | .. |
|---|
| 1119 | 1189 | * path functions resulting in Null pointer reference followed by kernel |
|---|
| 1120 | 1190 | * crash. To avoid the above race condition we use mutex syncrhonization |
|---|
| 1121 | 1191 | * which ensures the syncrhonization between cli/sysfs_show path. |
|---|
| 1192 | + * @atomic_desc_capable: Atomic Request Descriptor support. |
|---|
| 1193 | + * @GET_MSIX_INDEX: Get the msix index of high iops queues. |
|---|
| 1122 | 1194 | */ |
|---|
| 1123 | 1195 | struct MPT3SAS_ADAPTER { |
|---|
| 1124 | 1196 | struct list_head list; |
|---|
| .. | .. |
|---|
| 1136 | 1208 | u8 ir_firmware; |
|---|
| 1137 | 1209 | int bars; |
|---|
| 1138 | 1210 | u8 mask_interrupts; |
|---|
| 1139 | | - int dma_mask; |
|---|
| 1140 | 1211 | |
|---|
| 1141 | 1212 | /* fw fault handler */ |
|---|
| 1142 | 1213 | char fault_reset_work_q_name[20]; |
|---|
| .. | .. |
|---|
| 1148 | 1219 | struct workqueue_struct *firmware_event_thread; |
|---|
| 1149 | 1220 | spinlock_t fw_event_lock; |
|---|
| 1150 | 1221 | struct list_head fw_event_list; |
|---|
| 1222 | + struct fw_event_work *current_event; |
|---|
| 1223 | + u8 fw_events_cleanup; |
|---|
| 1151 | 1224 | |
|---|
| 1152 | 1225 | /* misc flags */ |
|---|
| 1153 | 1226 | int aen_event_read_flag; |
|---|
| .. | .. |
|---|
| 1177 | 1250 | u32 ioc_reset_count; |
|---|
| 1178 | 1251 | MPT3SAS_FLUSH_RUNNING_CMDS schedule_dead_ioc_flush_running_cmds; |
|---|
| 1179 | 1252 | u32 non_operational_loop; |
|---|
| 1253 | + u8 ioc_coredump_loop; |
|---|
| 1254 | + atomic64_t total_io_cnt; |
|---|
| 1255 | + atomic64_t high_iops_outstanding; |
|---|
| 1256 | + bool msix_load_balance; |
|---|
| 1257 | + u16 thresh_hold; |
|---|
| 1258 | + u8 high_iops_queues; |
|---|
| 1259 | + u32 drv_support_bitmap; |
|---|
| 1260 | + u32 dma_mask; |
|---|
| 1261 | + bool enable_sdev_max_qd; |
|---|
| 1262 | + bool use_32bit_dma; |
|---|
| 1180 | 1263 | |
|---|
| 1181 | 1264 | /* internal commands, callback index */ |
|---|
| 1182 | 1265 | u8 scsi_io_cb_idx; |
|---|
| .. | .. |
|---|
| 1222 | 1305 | |
|---|
| 1223 | 1306 | u8 tm_custom_handling; |
|---|
| 1224 | 1307 | u8 nvme_abort_timeout; |
|---|
| 1225 | | - |
|---|
| 1308 | + u16 max_shutdown_latency; |
|---|
| 1226 | 1309 | |
|---|
| 1227 | 1310 | /* static config pages */ |
|---|
| 1228 | 1311 | struct mpt3sas_facts facts; |
|---|
| 1312 | + struct mpt3sas_facts prev_fw_facts; |
|---|
| 1229 | 1313 | struct mpt3sas_port_facts *pfacts; |
|---|
| 1230 | 1314 | Mpi2ManufacturingPage0_t manu_pg0; |
|---|
| 1231 | 1315 | struct Mpi2ManufacturingPage10_t manu_pg10; |
|---|
| .. | .. |
|---|
| 1236 | 1320 | Mpi2IOUnitPage0_t iounit_pg0; |
|---|
| 1237 | 1321 | Mpi2IOUnitPage1_t iounit_pg1; |
|---|
| 1238 | 1322 | Mpi2IOUnitPage8_t iounit_pg8; |
|---|
| 1323 | + Mpi2IOCPage1_t ioc_pg1_copy; |
|---|
| 1239 | 1324 | |
|---|
| 1240 | 1325 | struct _boot_device req_boot_device; |
|---|
| 1241 | 1326 | struct _boot_device req_alt_boot_device; |
|---|
| .. | .. |
|---|
| 1354 | 1439 | |
|---|
| 1355 | 1440 | u8 combined_reply_queue; |
|---|
| 1356 | 1441 | u8 combined_reply_index_count; |
|---|
| 1442 | + u8 smp_affinity_enable; |
|---|
| 1357 | 1443 | /* reply post register index */ |
|---|
| 1358 | 1444 | resource_size_t **replyPostRegisterIndex; |
|---|
| 1359 | 1445 | |
|---|
| .. | .. |
|---|
| 1381 | 1467 | u8 hide_drives; |
|---|
| 1382 | 1468 | spinlock_t diag_trigger_lock; |
|---|
| 1383 | 1469 | u8 diag_trigger_active; |
|---|
| 1470 | + u8 atomic_desc_capable; |
|---|
| 1471 | + BASE_READ_REG base_readl; |
|---|
| 1384 | 1472 | struct SL_WH_MASTER_TRIGGER_T diag_trigger_master; |
|---|
| 1385 | 1473 | struct SL_WH_EVENT_TRIGGERS_T diag_trigger_event; |
|---|
| 1386 | 1474 | struct SL_WH_SCSI_TRIGGERS_T diag_trigger_scsi; |
|---|
| .. | .. |
|---|
| 1388 | 1476 | void *device_remove_in_progress; |
|---|
| 1389 | 1477 | u16 device_remove_in_progress_sz; |
|---|
| 1390 | 1478 | u8 is_gen35_ioc; |
|---|
| 1479 | + u8 is_aero_ioc; |
|---|
| 1480 | + struct dentry *debugfs_root; |
|---|
| 1481 | + struct dentry *ioc_dump; |
|---|
| 1391 | 1482 | PUT_SMID_IO_FP_HIP put_smid_scsi_io; |
|---|
| 1392 | | - |
|---|
| 1483 | + PUT_SMID_IO_FP_HIP put_smid_fast_path; |
|---|
| 1484 | + PUT_SMID_IO_FP_HIP put_smid_hi_priority; |
|---|
| 1485 | + PUT_SMID_DEFAULT put_smid_default; |
|---|
| 1486 | + GET_MSIX_INDEX get_msix_index_for_smlio; |
|---|
| 1393 | 1487 | }; |
|---|
| 1488 | + |
|---|
| 1489 | +struct mpt3sas_debugfs_buffer { |
|---|
| 1490 | + void *buf; |
|---|
| 1491 | + u32 len; |
|---|
| 1492 | +}; |
|---|
| 1493 | + |
|---|
| 1494 | +#define MPT_DRV_SUPPORT_BITMAP_MEMMOVE 0x00000001 |
|---|
| 1394 | 1495 | |
|---|
| 1395 | 1496 | typedef u8 (*MPT_CALLBACK)(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
|---|
| 1396 | 1497 | u32 reply); |
|---|
| .. | .. |
|---|
| 1428 | 1529 | u16 smid); |
|---|
| 1429 | 1530 | void *mpt3sas_base_get_pcie_sgl(struct MPT3SAS_ADAPTER *ioc, u16 smid); |
|---|
| 1430 | 1531 | dma_addr_t mpt3sas_base_get_pcie_sgl_dma(struct MPT3SAS_ADAPTER *ioc, u16 smid); |
|---|
| 1431 | | -void mpt3sas_base_sync_reply_irqs(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1532 | +void mpt3sas_base_sync_reply_irqs(struct MPT3SAS_ADAPTER *ioc, u8 poll); |
|---|
| 1533 | +void mpt3sas_base_mask_interrupts(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1534 | +void mpt3sas_base_unmask_interrupts(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1432 | 1535 | |
|---|
| 1433 | 1536 | void mpt3sas_base_put_smid_fast_path(struct MPT3SAS_ADAPTER *ioc, u16 smid, |
|---|
| 1434 | 1537 | u16 handle); |
|---|
| .. | .. |
|---|
| 1459 | 1562 | u32 mpt3sas_base_get_iocstate(struct MPT3SAS_ADAPTER *ioc, int cooked); |
|---|
| 1460 | 1563 | |
|---|
| 1461 | 1564 | void mpt3sas_base_fault_info(struct MPT3SAS_ADAPTER *ioc , u16 fault_code); |
|---|
| 1565 | +#define mpt3sas_print_fault_code(ioc, fault_code) \ |
|---|
| 1566 | +do { pr_err("%s fault info from func: %s\n", ioc->name, __func__); \ |
|---|
| 1567 | + mpt3sas_base_fault_info(ioc, fault_code); } while (0) |
|---|
| 1568 | + |
|---|
| 1569 | +void mpt3sas_base_coredump_info(struct MPT3SAS_ADAPTER *ioc, u16 fault_code); |
|---|
| 1570 | +#define mpt3sas_print_coredump_info(ioc, fault_code) \ |
|---|
| 1571 | +do { pr_err("%s fault info from func: %s\n", ioc->name, __func__); \ |
|---|
| 1572 | + mpt3sas_base_coredump_info(ioc, fault_code); } while (0) |
|---|
| 1573 | + |
|---|
| 1574 | +int mpt3sas_base_wait_for_coredump_completion(struct MPT3SAS_ADAPTER *ioc, |
|---|
| 1575 | + const char *caller); |
|---|
| 1462 | 1576 | int mpt3sas_base_sas_iounit_control(struct MPT3SAS_ADAPTER *ioc, |
|---|
| 1463 | 1577 | Mpi2SasIoUnitControlReply_t *mpi_reply, |
|---|
| 1464 | 1578 | Mpi2SasIoUnitControlRequest_t *mpi_request); |
|---|
| .. | .. |
|---|
| 1480 | 1594 | |
|---|
| 1481 | 1595 | u8 mpt3sas_base_check_cmd_timeout(struct MPT3SAS_ADAPTER *ioc, |
|---|
| 1482 | 1596 | u8 status, void *mpi_request, int sz); |
|---|
| 1597 | +#define mpt3sas_check_cmd_timeout(ioc, status, mpi_request, sz, issue_reset) \ |
|---|
| 1598 | +do { ioc_err(ioc, "In func: %s\n", __func__); \ |
|---|
| 1599 | + issue_reset = mpt3sas_base_check_cmd_timeout(ioc, \ |
|---|
| 1600 | + status, mpi_request, sz); } while (0) |
|---|
| 1601 | + |
|---|
| 1602 | +int mpt3sas_wait_for_ioc(struct MPT3SAS_ADAPTER *ioc, int wait_count); |
|---|
| 1483 | 1603 | |
|---|
| 1484 | 1604 | /* scsih shared API */ |
|---|
| 1485 | 1605 | struct scsi_cmnd *mpt3sas_scsih_scsi_lookup_get(struct MPT3SAS_ADAPTER *ioc, |
|---|
| .. | .. |
|---|
| 1487 | 1607 | u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, |
|---|
| 1488 | 1608 | u32 reply); |
|---|
| 1489 | 1609 | void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1490 | | -void mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1610 | +void mpt3sas_scsih_clear_outstanding_scsi_tm_commands( |
|---|
| 1611 | + struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1491 | 1612 | void mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1492 | 1613 | |
|---|
| 1493 | | -int mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun, |
|---|
| 1494 | | - u8 type, u16 smid_task, u16 msix_task, u8 timeout, u8 tr_method); |
|---|
| 1614 | +int mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, |
|---|
| 1615 | + uint channel, uint id, u64 lun, u8 type, u16 smid_task, |
|---|
| 1616 | + u16 msix_task, u8 timeout, u8 tr_method); |
|---|
| 1495 | 1617 | int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, |
|---|
| 1496 | | - u64 lun, u8 type, u16 smid_task, u16 msix_task, |
|---|
| 1497 | | - u8 timeout, u8 tr_method); |
|---|
| 1618 | + uint channel, uint id, u64 lun, u8 type, u16 smid_task, |
|---|
| 1619 | + u16 msix_task, u8 timeout, u8 tr_method); |
|---|
| 1498 | 1620 | |
|---|
| 1499 | 1621 | void mpt3sas_scsih_set_tm_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle); |
|---|
| 1500 | 1622 | void mpt3sas_scsih_clear_tm_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle); |
|---|
| .. | .. |
|---|
| 1520 | 1642 | void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1521 | 1643 | struct _raid_device * |
|---|
| 1522 | 1644 | mpt3sas_raid_device_find_by_handle(struct MPT3SAS_ADAPTER *ioc, u16 handle); |
|---|
| 1645 | +void mpt3sas_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth); |
|---|
| 1523 | 1646 | |
|---|
| 1524 | 1647 | /* config shared API */ |
|---|
| 1525 | 1648 | u8 mpt3sas_config_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
|---|
| .. | .. |
|---|
| 1577 | 1700 | int mpt3sas_config_set_sas_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, |
|---|
| 1578 | 1701 | Mpi2ConfigReply_t *mpi_reply, Mpi2SasIOUnitPage1_t *config_page, |
|---|
| 1579 | 1702 | u16 sz); |
|---|
| 1703 | +int mpt3sas_config_get_ioc_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
|---|
| 1704 | + *mpi_reply, Mpi2IOCPage1_t *config_page); |
|---|
| 1705 | +int mpt3sas_config_set_ioc_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
|---|
| 1706 | + *mpi_reply, Mpi2IOCPage1_t *config_page); |
|---|
| 1580 | 1707 | int mpt3sas_config_get_ioc_pg8(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
|---|
| 1581 | 1708 | *mpi_reply, Mpi2IOCPage8_t *config_page); |
|---|
| 1582 | 1709 | int mpt3sas_config_get_expander_pg0(struct MPT3SAS_ADAPTER *ioc, |
|---|
| .. | .. |
|---|
| 1616 | 1743 | u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
|---|
| 1617 | 1744 | u32 reply); |
|---|
| 1618 | 1745 | void mpt3sas_ctl_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1619 | | -void mpt3sas_ctl_after_reset_handler(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1746 | +void mpt3sas_ctl_clear_outstanding_ioctls(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1620 | 1747 | void mpt3sas_ctl_reset_done_handler(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1621 | 1748 | u8 mpt3sas_ctl_event_callback(struct MPT3SAS_ADAPTER *ioc, |
|---|
| 1622 | 1749 | u8 msix_index, u32 reply); |
|---|
| .. | .. |
|---|
| 1651 | 1778 | void mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc, |
|---|
| 1652 | 1779 | struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data); |
|---|
| 1653 | 1780 | void mpt3sas_trigger_master(struct MPT3SAS_ADAPTER *ioc, |
|---|
| 1654 | | - u32 tigger_bitmask); |
|---|
| 1781 | + u32 trigger_bitmask); |
|---|
| 1655 | 1782 | void mpt3sas_trigger_event(struct MPT3SAS_ADAPTER *ioc, u16 event, |
|---|
| 1656 | 1783 | u16 log_entry_qualifier); |
|---|
| 1657 | 1784 | void mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, |
|---|
| .. | .. |
|---|
| 1670 | 1797 | /* NCQ Prio Handling Check */ |
|---|
| 1671 | 1798 | bool scsih_ncq_prio_supp(struct scsi_device *sdev); |
|---|
| 1672 | 1799 | |
|---|
| 1800 | +void mpt3sas_setup_debugfs(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1801 | +void mpt3sas_destroy_debugfs(struct MPT3SAS_ADAPTER *ioc); |
|---|
| 1802 | +void mpt3sas_init_debugfs(void); |
|---|
| 1803 | +void mpt3sas_exit_debugfs(void); |
|---|
| 1804 | + |
|---|
| 1805 | +/** |
|---|
| 1806 | + * _scsih_is_pcie_scsi_device - determines if device is an pcie scsi device |
|---|
| 1807 | + * @device_info: bitfield providing information about the device. |
|---|
| 1808 | + * Context: none |
|---|
| 1809 | + * |
|---|
| 1810 | + * Returns 1 if scsi device. |
|---|
| 1811 | + */ |
|---|
| 1812 | +static inline int |
|---|
| 1813 | +mpt3sas_scsih_is_pcie_scsi_device(u32 device_info) |
|---|
| 1814 | +{ |
|---|
| 1815 | + if ((device_info & |
|---|
| 1816 | + MPI26_PCIE_DEVINFO_MASK_DEVICE_TYPE) == MPI26_PCIE_DEVINFO_SCSI) |
|---|
| 1817 | + return 1; |
|---|
| 1818 | + else |
|---|
| 1819 | + return 0; |
|---|
| 1820 | +} |
|---|
| 1673 | 1821 | #endif /* MPT3SAS_BASE_H_INCLUDED */ |
|---|