forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/scsi/mpt3sas/mpt3sas_scsih.c
....@@ -51,7 +51,6 @@
5151 #include <linux/workqueue.h>
5252 #include <linux/delay.h>
5353 #include <linux/pci.h>
54
-#include <linux/pci-aspm.h>
5554 #include <linux/interrupt.h>
5655 #include <linux/aer.h>
5756 #include <linux/raid_class.h>
....@@ -113,22 +112,22 @@
113112
114113
115114 static ushort max_sectors = 0xFFFF;
116
-module_param(max_sectors, ushort, 0);
115
+module_param(max_sectors, ushort, 0444);
117116 MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 32767 default=32767");
118117
119118
120119 static int missing_delay[2] = {-1, -1};
121
-module_param_array(missing_delay, int, NULL, 0);
120
+module_param_array(missing_delay, int, NULL, 0444);
122121 MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay");
123122
124123 /* scsi-mid layer global parmeter is max_report_luns, which is 511 */
125124 #define MPT3SAS_MAX_LUN (16895)
126125 static u64 max_lun = MPT3SAS_MAX_LUN;
127
-module_param(max_lun, ullong, 0);
126
+module_param(max_lun, ullong, 0444);
128127 MODULE_PARM_DESC(max_lun, " max lun, default=16895 ");
129128
130129 static ushort hbas_to_enumerate;
131
-module_param(hbas_to_enumerate, ushort, 0);
130
+module_param(hbas_to_enumerate, ushort, 0444);
132131 MODULE_PARM_DESC(hbas_to_enumerate,
133132 " 0 - enumerates both SAS 2.0 & SAS 3.0 generation HBAs\n \
134133 1 - enumerates only SAS 2.0 generation HBAs\n \
....@@ -142,19 +141,23 @@
142141 * Either bit can be set, or both
143142 */
144143 static int diag_buffer_enable = -1;
145
-module_param(diag_buffer_enable, int, 0);
144
+module_param(diag_buffer_enable, int, 0444);
146145 MODULE_PARM_DESC(diag_buffer_enable,
147146 " post diag buffers (TRACE=1/SNAPSHOT=2/EXTENDED=4/default=0)");
148147 static int disable_discovery = -1;
149
-module_param(disable_discovery, int, 0);
148
+module_param(disable_discovery, int, 0444);
150149 MODULE_PARM_DESC(disable_discovery, " disable discovery ");
151150
152151
153152 /* permit overriding the host protection capabilities mask (EEDP/T10 PI) */
154153 static int prot_mask = -1;
155
-module_param(prot_mask, int, 0);
154
+module_param(prot_mask, int, 0444);
156155 MODULE_PARM_DESC(prot_mask, " host protection capabilities mask, def=7 ");
157156
157
+static bool enable_sdev_max_qd;
158
+module_param(enable_sdev_max_qd, bool, 0444);
159
+MODULE_PARM_DESC(enable_sdev_max_qd,
160
+ "Enable sdev max qd as can_queue, def=disabled(0)");
158161
159162 /* raid transport support */
160163 static struct raid_template *mpt3sas_raid_template;
....@@ -204,7 +207,7 @@
204207 u8 ignore;
205208 u16 event;
206209 struct kref refcount;
207
- char event_data[0] __aligned(4);
210
+ char event_data[] __aligned(4);
208211 };
209212
210213 static void fw_event_work_free(struct kref *r)
....@@ -418,8 +421,8 @@
418421
419422 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
420423 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
421
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
422
- __FILE__, __LINE__, __func__);
424
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
425
+ __FILE__, __LINE__, __func__);
423426 return -ENXIO;
424427 }
425428
....@@ -442,10 +445,8 @@
442445 return -ENXIO;
443446
444447 /* else error case */
445
- pr_err(MPT3SAS_FMT
446
- "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n",
447
- ioc->name, handle, ioc_status,
448
- __FILE__, __LINE__, __func__);
448
+ ioc_err(ioc, "handle(0x%04x), ioc_status(0x%04x), failure at %s:%d/%s()!\n",
449
+ handle, ioc_status, __FILE__, __LINE__, __func__);
449450 return -EIO;
450451 }
451452
....@@ -508,10 +509,9 @@
508509 (ioc->bios_pg2.ReqBootDeviceForm &
509510 MPI2_BIOSPAGE2_FORM_MASK),
510511 &ioc->bios_pg2.RequestedBootDevice)) {
511
- dinitprintk(ioc, pr_info(MPT3SAS_FMT
512
- "%s: req_boot_device(0x%016llx)\n",
513
- ioc->name, __func__,
514
- (unsigned long long)sas_address));
512
+ dinitprintk(ioc,
513
+ ioc_info(ioc, "%s: req_boot_device(0x%016llx)\n",
514
+ __func__, (u64)sas_address));
515515 ioc->req_boot_device.device = device;
516516 ioc->req_boot_device.channel = channel;
517517 }
....@@ -523,10 +523,9 @@
523523 (ioc->bios_pg2.ReqAltBootDeviceForm &
524524 MPI2_BIOSPAGE2_FORM_MASK),
525525 &ioc->bios_pg2.RequestedAltBootDevice)) {
526
- dinitprintk(ioc, pr_info(MPT3SAS_FMT
527
- "%s: req_alt_boot_device(0x%016llx)\n",
528
- ioc->name, __func__,
529
- (unsigned long long)sas_address));
526
+ dinitprintk(ioc,
527
+ ioc_info(ioc, "%s: req_alt_boot_device(0x%016llx)\n",
528
+ __func__, (u64)sas_address));
530529 ioc->req_alt_boot_device.device = device;
531530 ioc->req_alt_boot_device.channel = channel;
532531 }
....@@ -538,10 +537,9 @@
538537 (ioc->bios_pg2.CurrentBootDeviceForm &
539538 MPI2_BIOSPAGE2_FORM_MASK),
540539 &ioc->bios_pg2.CurrentBootDevice)) {
541
- dinitprintk(ioc, pr_info(MPT3SAS_FMT
542
- "%s: current_boot_device(0x%016llx)\n",
543
- ioc->name, __func__,
544
- (unsigned long long)sas_address));
540
+ dinitprintk(ioc,
541
+ ioc_info(ioc, "%s: current_boot_device(0x%016llx)\n",
542
+ __func__, (u64)sas_address));
545543 ioc->current_boot_device.device = device;
546544 ioc->current_boot_device.channel = channel;
547545 }
....@@ -752,19 +750,16 @@
752750 sas_device->chassis_slot);
753751 } else {
754752 if (sas_device->enclosure_handle != 0)
755
- pr_info(MPT3SAS_FMT
756
- "enclosure logical id(0x%016llx), slot(%d) \n",
757
- ioc->name, (unsigned long long)
758
- sas_device->enclosure_logical_id,
759
- sas_device->slot);
753
+ ioc_info(ioc, "enclosure logical id(0x%016llx), slot(%d)\n",
754
+ (u64)sas_device->enclosure_logical_id,
755
+ sas_device->slot);
760756 if (sas_device->connector_name[0] != '\0')
761
- pr_info(MPT3SAS_FMT
762
- "enclosure level(0x%04x), connector name( %s)\n",
763
- ioc->name, sas_device->enclosure_level,
764
- sas_device->connector_name);
757
+ ioc_info(ioc, "enclosure level(0x%04x), connector name( %s)\n",
758
+ sas_device->enclosure_level,
759
+ sas_device->connector_name);
765760 if (sas_device->is_chassis_slot_valid)
766
- pr_info(MPT3SAS_FMT "chassis slot(0x%04x)\n",
767
- ioc->name, sas_device->chassis_slot);
761
+ ioc_info(ioc, "chassis slot(0x%04x)\n",
762
+ sas_device->chassis_slot);
768763 }
769764 }
770765
....@@ -784,10 +779,8 @@
784779
785780 if (!sas_device)
786781 return;
787
- pr_info(MPT3SAS_FMT
788
- "removing handle(0x%04x), sas_addr(0x%016llx)\n",
789
- ioc->name, sas_device->handle,
790
- (unsigned long long) sas_device->sas_address);
782
+ ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n",
783
+ sas_device->handle, (u64)sas_device->sas_address);
791784
792785 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);
793786
....@@ -872,10 +865,10 @@
872865 {
873866 unsigned long flags;
874867
875
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
876
- "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
877
- ioc->name, __func__, sas_device->handle,
878
- (unsigned long long)sas_device->sas_address));
868
+ dewtprintk(ioc,
869
+ ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
870
+ __func__, sas_device->handle,
871
+ (u64)sas_device->sas_address));
879872
880873 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
881874 NULL, NULL));
....@@ -923,10 +916,10 @@
923916 {
924917 unsigned long flags;
925918
926
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
927
- "%s: handle(0x%04x), sas_addr(0x%016llx)\n", ioc->name,
928
- __func__, sas_device->handle,
929
- (unsigned long long)sas_device->sas_address));
919
+ dewtprintk(ioc,
920
+ ioc_info(ioc, "%s: handle(0x%04x), sas_addr(0x%016llx)\n",
921
+ __func__, sas_device->handle,
922
+ (u64)sas_device->sas_address));
930923
931924 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
932925 NULL, NULL));
....@@ -1057,6 +1050,34 @@
10571050 }
10581051
10591052 /**
1053
+ * _scsih_set_nvme_max_shutdown_latency - Update max_shutdown_latency.
1054
+ * @ioc: per adapter object
1055
+ * Context: This function will acquire ioc->pcie_device_lock
1056
+ *
1057
+ * Update ioc->max_shutdown_latency to that NVMe drives RTD3 Entry Latency
1058
+ * which has reported maximum among all available NVMe drives.
1059
+ * Minimum max_shutdown_latency will be six seconds.
1060
+ */
1061
+static void
1062
+_scsih_set_nvme_max_shutdown_latency(struct MPT3SAS_ADAPTER *ioc)
1063
+{
1064
+ struct _pcie_device *pcie_device;
1065
+ unsigned long flags;
1066
+ u16 shutdown_latency = IO_UNIT_CONTROL_SHUTDOWN_TIMEOUT;
1067
+
1068
+ spin_lock_irqsave(&ioc->pcie_device_lock, flags);
1069
+ list_for_each_entry(pcie_device, &ioc->pcie_device_list, list) {
1070
+ if (pcie_device->shutdown_latency) {
1071
+ if (shutdown_latency < pcie_device->shutdown_latency)
1072
+ shutdown_latency =
1073
+ pcie_device->shutdown_latency;
1074
+ }
1075
+ }
1076
+ ioc->max_shutdown_latency = shutdown_latency;
1077
+ spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
1078
+}
1079
+
1080
+/**
10601081 * _scsih_pcie_device_remove - remove pcie_device from list.
10611082 * @ioc: per adapter object
10621083 * @pcie_device: the pcie_device object
....@@ -1070,35 +1091,41 @@
10701091 {
10711092 unsigned long flags;
10721093 int was_on_pcie_device_list = 0;
1094
+ u8 update_latency = 0;
10731095
10741096 if (!pcie_device)
10751097 return;
1076
- pr_info(MPT3SAS_FMT
1077
- "removing handle(0x%04x), wwid(0x%016llx)\n",
1078
- ioc->name, pcie_device->handle,
1079
- (unsigned long long) pcie_device->wwid);
1098
+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
1099
+ pcie_device->handle, (u64)pcie_device->wwid);
10801100 if (pcie_device->enclosure_handle != 0)
1081
- pr_info(MPT3SAS_FMT
1082
- "removing enclosure logical id(0x%016llx), slot(%d)\n",
1083
- ioc->name,
1084
- (unsigned long long)pcie_device->enclosure_logical_id,
1085
- pcie_device->slot);
1101
+ ioc_info(ioc, "removing enclosure logical id(0x%016llx), slot(%d)\n",
1102
+ (u64)pcie_device->enclosure_logical_id,
1103
+ pcie_device->slot);
10861104 if (pcie_device->connector_name[0] != '\0')
1087
- pr_info(MPT3SAS_FMT
1088
- "removing enclosure level(0x%04x), connector name( %s)\n",
1089
- ioc->name, pcie_device->enclosure_level,
1090
- pcie_device->connector_name);
1105
+ ioc_info(ioc, "removing enclosure level(0x%04x), connector name( %s)\n",
1106
+ pcie_device->enclosure_level,
1107
+ pcie_device->connector_name);
10911108
10921109 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
10931110 if (!list_empty(&pcie_device->list)) {
10941111 list_del_init(&pcie_device->list);
10951112 was_on_pcie_device_list = 1;
10961113 }
1114
+ if (pcie_device->shutdown_latency == ioc->max_shutdown_latency)
1115
+ update_latency = 1;
10971116 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
10981117 if (was_on_pcie_device_list) {
10991118 kfree(pcie_device->serial_number);
11001119 pcie_device_put(pcie_device);
11011120 }
1121
+
1122
+ /*
1123
+ * This device's RTD3 Entry Latency matches IOC's
1124
+ * max_shutdown_latency. Recalculate IOC's max_shutdown_latency
1125
+ * from the available drives as current drive is getting removed.
1126
+ */
1127
+ if (update_latency)
1128
+ _scsih_set_nvme_max_shutdown_latency(ioc);
11021129 }
11031130
11041131
....@@ -1113,6 +1140,7 @@
11131140 struct _pcie_device *pcie_device;
11141141 unsigned long flags;
11151142 int was_on_pcie_device_list = 0;
1143
+ u8 update_latency = 0;
11161144
11171145 if (ioc->shost_recovery)
11181146 return;
....@@ -1125,12 +1153,22 @@
11251153 was_on_pcie_device_list = 1;
11261154 pcie_device_put(pcie_device);
11271155 }
1156
+ if (pcie_device->shutdown_latency == ioc->max_shutdown_latency)
1157
+ update_latency = 1;
11281158 }
11291159 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
11301160 if (was_on_pcie_device_list) {
11311161 _scsih_pcie_device_remove_from_sml(ioc, pcie_device);
11321162 pcie_device_put(pcie_device);
11331163 }
1164
+
1165
+ /*
1166
+ * This device's RTD3 Entry Latency matches IOC's
1167
+ * max_shutdown_latency. Recalculate IOC's max_shutdown_latency
1168
+ * from the available drives as current drive is getting removed.
1169
+ */
1170
+ if (update_latency)
1171
+ _scsih_set_nvme_max_shutdown_latency(ioc);
11341172 }
11351173
11361174 /**
....@@ -1146,26 +1184,32 @@
11461184 {
11471185 unsigned long flags;
11481186
1149
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
1150
- "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
1151
- pcie_device->handle, (unsigned long long)pcie_device->wwid));
1187
+ dewtprintk(ioc,
1188
+ ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n",
1189
+ __func__,
1190
+ pcie_device->handle, (u64)pcie_device->wwid));
11521191 if (pcie_device->enclosure_handle != 0)
1153
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
1154
- "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1155
- ioc->name, __func__,
1156
- (unsigned long long)pcie_device->enclosure_logical_id,
1157
- pcie_device->slot));
1192
+ dewtprintk(ioc,
1193
+ ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1194
+ __func__,
1195
+ (u64)pcie_device->enclosure_logical_id,
1196
+ pcie_device->slot));
11581197 if (pcie_device->connector_name[0] != '\0')
1159
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
1160
- "%s: enclosure level(0x%04x), connector name( %s)\n",
1161
- ioc->name, __func__, pcie_device->enclosure_level,
1162
- pcie_device->connector_name));
1198
+ dewtprintk(ioc,
1199
+ ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n",
1200
+ __func__, pcie_device->enclosure_level,
1201
+ pcie_device->connector_name));
11631202
11641203 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
11651204 pcie_device_get(pcie_device);
11661205 list_add_tail(&pcie_device->list, &ioc->pcie_device_list);
11671206 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
11681207
1208
+ if (pcie_device->access_status ==
1209
+ MPI26_PCIEDEV0_ASTATUS_DEVICE_BLOCKED) {
1210
+ clear_bit(pcie_device->handle, ioc->pend_os_device_add);
1211
+ return;
1212
+ }
11691213 if (scsi_add_device(ioc->shost, PCIE_CHANNEL, pcie_device->id, 0)) {
11701214 _scsih_pcie_device_remove(ioc, pcie_device);
11711215 } else if (!pcie_device->starget) {
....@@ -1191,25 +1235,28 @@
11911235 {
11921236 unsigned long flags;
11931237
1194
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
1195
- "%s: handle (0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
1196
- pcie_device->handle, (unsigned long long)pcie_device->wwid));
1238
+ dewtprintk(ioc,
1239
+ ioc_info(ioc, "%s: handle (0x%04x), wwid(0x%016llx)\n",
1240
+ __func__,
1241
+ pcie_device->handle, (u64)pcie_device->wwid));
11971242 if (pcie_device->enclosure_handle != 0)
1198
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
1199
- "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1200
- ioc->name, __func__,
1201
- (unsigned long long)pcie_device->enclosure_logical_id,
1202
- pcie_device->slot));
1243
+ dewtprintk(ioc,
1244
+ ioc_info(ioc, "%s: enclosure logical id(0x%016llx), slot( %d)\n",
1245
+ __func__,
1246
+ (u64)pcie_device->enclosure_logical_id,
1247
+ pcie_device->slot));
12031248 if (pcie_device->connector_name[0] != '\0')
1204
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
1205
- "%s: enclosure level(0x%04x), connector name( %s)\n",
1206
- ioc->name, __func__, pcie_device->enclosure_level,
1207
- pcie_device->connector_name));
1249
+ dewtprintk(ioc,
1250
+ ioc_info(ioc, "%s: enclosure level(0x%04x), connector name( %s)\n",
1251
+ __func__, pcie_device->enclosure_level,
1252
+ pcie_device->connector_name));
12081253
12091254 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
12101255 pcie_device_get(pcie_device);
12111256 list_add_tail(&pcie_device->list, &ioc->pcie_device_init_list);
1212
- _scsih_determine_boot_device(ioc, pcie_device, PCIE_CHANNEL);
1257
+ if (pcie_device->access_status !=
1258
+ MPI26_PCIEDEV0_ASTATUS_DEVICE_BLOCKED)
1259
+ _scsih_determine_boot_device(ioc, pcie_device, PCIE_CHANNEL);
12131260 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
12141261 }
12151262 /**
....@@ -1304,9 +1351,10 @@
13041351 {
13051352 unsigned long flags;
13061353
1307
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
1308
- "%s: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
1309
- raid_device->handle, (unsigned long long)raid_device->wwid));
1354
+ dewtprintk(ioc,
1355
+ ioc_info(ioc, "%s: handle(0x%04x), wwid(0x%016llx)\n",
1356
+ __func__,
1357
+ raid_device->handle, (u64)raid_device->wwid));
13101358
13111359 spin_lock_irqsave(&ioc->raid_device_lock, flags);
13121360 list_add_tail(&raid_device->list, &ioc->raid_device_list);
....@@ -1445,20 +1493,83 @@
14451493 }
14461494
14471495 /**
1448
- * _scsih_is_nvme_device - determines if device is an nvme device
1496
+ * _scsih_is_nvme_pciescsi_device - determines if
1497
+ * device is an pcie nvme/scsi device
14491498 * @device_info: bitfield providing information about the device.
14501499 * Context: none
14511500 *
1452
- * Return: 1 if nvme device.
1501
+ * Returns 1 if device is pcie device type nvme/scsi.
14531502 */
14541503 static int
1455
-_scsih_is_nvme_device(u32 device_info)
1504
+_scsih_is_nvme_pciescsi_device(u32 device_info)
14561505 {
1457
- if ((device_info & MPI26_PCIE_DEVINFO_MASK_DEVICE_TYPE)
1458
- == MPI26_PCIE_DEVINFO_NVME)
1506
+ if (((device_info & MPI26_PCIE_DEVINFO_MASK_DEVICE_TYPE)
1507
+ == MPI26_PCIE_DEVINFO_NVME) ||
1508
+ ((device_info & MPI26_PCIE_DEVINFO_MASK_DEVICE_TYPE)
1509
+ == MPI26_PCIE_DEVINFO_SCSI))
14591510 return 1;
14601511 else
14611512 return 0;
1513
+}
1514
+
1515
+/**
1516
+ * _scsih_scsi_lookup_find_by_target - search for matching channel:id
1517
+ * @ioc: per adapter object
1518
+ * @id: target id
1519
+ * @channel: channel
1520
+ * Context: This function will acquire ioc->scsi_lookup_lock.
1521
+ *
1522
+ * This will search for a matching channel:id in the scsi_lookup array,
1523
+ * returning 1 if found.
1524
+ */
1525
+static u8
1526
+_scsih_scsi_lookup_find_by_target(struct MPT3SAS_ADAPTER *ioc, int id,
1527
+ int channel)
1528
+{
1529
+ int smid;
1530
+ struct scsi_cmnd *scmd;
1531
+
1532
+ for (smid = 1;
1533
+ smid <= ioc->shost->can_queue; smid++) {
1534
+ scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
1535
+ if (!scmd)
1536
+ continue;
1537
+ if (scmd->device->id == id &&
1538
+ scmd->device->channel == channel)
1539
+ return 1;
1540
+ }
1541
+ return 0;
1542
+}
1543
+
1544
+/**
1545
+ * _scsih_scsi_lookup_find_by_lun - search for matching channel:id:lun
1546
+ * @ioc: per adapter object
1547
+ * @id: target id
1548
+ * @lun: lun number
1549
+ * @channel: channel
1550
+ * Context: This function will acquire ioc->scsi_lookup_lock.
1551
+ *
1552
+ * This will search for a matching channel:id:lun in the scsi_lookup array,
1553
+ * returning 1 if found.
1554
+ */
1555
+static u8
1556
+_scsih_scsi_lookup_find_by_lun(struct MPT3SAS_ADAPTER *ioc, int id,
1557
+ unsigned int lun, int channel)
1558
+{
1559
+ int smid;
1560
+ struct scsi_cmnd *scmd;
1561
+
1562
+ for (smid = 1; smid <= ioc->shost->can_queue; smid++) {
1563
+
1564
+ scmd = mpt3sas_scsih_scsi_lookup_get(ioc, smid);
1565
+ if (!scmd)
1566
+ continue;
1567
+ if (scmd->device->id == id &&
1568
+ scmd->device->channel == channel &&
1569
+ scmd->device->lun == lun)
1570
+ return 1;
1571
+ }
1572
+ return 0;
14621573 }
14631574
14641575 /**
....@@ -1521,7 +1632,13 @@
15211632
15221633 max_depth = shost->can_queue;
15231634
1524
- /* limit max device queue for SATA to 32 */
1635
+ /*
1636
+ * limit max device queue for SATA to 32 if enable_sdev_max_qd
1637
+ * is disabled.
1638
+ */
1639
+ if (ioc->enable_sdev_max_qd)
1640
+ goto not_sata;
1641
+
15251642 sas_device_priv_data = sdev->hostdata;
15261643 if (!sas_device_priv_data)
15271644 goto not_sata;
....@@ -1547,7 +1664,31 @@
15471664 max_depth = 1;
15481665 if (qdepth > max_depth)
15491666 qdepth = max_depth;
1550
- return scsi_change_queue_depth(sdev, qdepth);
1667
+ scsi_change_queue_depth(sdev, qdepth);
1668
+ sdev_printk(KERN_INFO, sdev,
1669
+ "qdepth(%d), tagged(%d), scsi_level(%d), cmd_que(%d)\n",
1670
+ sdev->queue_depth, sdev->tagged_supported,
1671
+ sdev->scsi_level, ((sdev->inquiry[7] & 2) >> 1));
1672
+ return sdev->queue_depth;
1673
+}
1674
+
1675
+/**
1676
+ * mpt3sas_scsih_change_queue_depth - setting device queue depth
1677
+ * @sdev: scsi device struct
1678
+ * @qdepth: requested queue depth
1679
+ *
1680
+ * Returns nothing.
1681
+ */
1682
+void
1683
+mpt3sas_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth)
1684
+{
1685
+ struct Scsi_Host *shost = sdev->host;
1686
+ struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
1687
+
1688
+ if (ioc->enable_sdev_max_qd)
1689
+ qdepth = shost->can_queue;
1690
+
1691
+ scsih_change_queue_depth(sdev, qdepth);
15511692 }
15521693
15531694 /**
....@@ -1869,16 +2010,16 @@
18692010
18702011 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
18712012 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
1872
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1873
- ioc->name, __FILE__, __LINE__, __func__);
2013
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
2014
+ __FILE__, __LINE__, __func__);
18742015 return;
18752016 }
18762017
18772018 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
18782019 MPI2_IOCSTATUS_MASK;
18792020 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1880
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1881
- ioc->name, __FILE__, __LINE__, __func__);
2021
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
2022
+ __FILE__, __LINE__, __func__);
18822023 return;
18832024 }
18842025
....@@ -1964,8 +2105,8 @@
19642105 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
19652106 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
19662107 sizeof(Mpi2RaidVolPage0_t))) {
1967
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
1968
- ioc->name, __FILE__, __LINE__, __func__);
2108
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
2109
+ __FILE__, __LINE__, __func__);
19692110 percent_complete = 0;
19702111 goto out;
19712112 }
....@@ -2018,8 +2159,8 @@
20182159 if (mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, &vol_pg0,
20192160 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle,
20202161 sizeof(Mpi2RaidVolPage0_t))) {
2021
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
2022
- ioc->name, __FILE__, __LINE__, __func__);
2162
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
2163
+ __FILE__, __LINE__, __func__);
20232164 goto out;
20242165 }
20252166
....@@ -2115,9 +2256,9 @@
21152256
21162257 if ((mpt3sas_config_get_number_pds(ioc, raid_device->handle,
21172258 &num_pds)) || !num_pds) {
2118
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2119
- "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2120
- __func__));
2259
+ dfailprintk(ioc,
2260
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2261
+ __FILE__, __LINE__, __func__));
21212262 return 1;
21222263 }
21232264
....@@ -2126,17 +2267,17 @@
21262267 sizeof(Mpi2RaidVol0PhysDisk_t));
21272268 vol_pg0 = kzalloc(sz, GFP_KERNEL);
21282269 if (!vol_pg0) {
2129
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2130
- "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2131
- __func__));
2270
+ dfailprintk(ioc,
2271
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2272
+ __FILE__, __LINE__, __func__));
21322273 return 1;
21332274 }
21342275
21352276 if ((mpt3sas_config_get_raid_volume_pg0(ioc, &mpi_reply, vol_pg0,
21362277 MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, raid_device->handle, sz))) {
2137
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2138
- "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2139
- __func__));
2278
+ dfailprintk(ioc,
2279
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2280
+ __FILE__, __LINE__, __func__));
21402281 kfree(vol_pg0);
21412282 return 1;
21422283 }
....@@ -2227,16 +2368,16 @@
22272368 raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle);
22282369 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
22292370 if (!raid_device) {
2230
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2231
- "failure at %s:%d/%s()!\n", ioc->name, __FILE__,
2232
- __LINE__, __func__));
2371
+ dfailprintk(ioc,
2372
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2373
+ __FILE__, __LINE__, __func__));
22332374 return 1;
22342375 }
22352376
22362377 if (_scsih_get_volume_capabilities(ioc, raid_device)) {
2237
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2238
- "failure at %s:%d/%s()!\n", ioc->name, __FILE__,
2239
- __LINE__, __func__));
2378
+ dfailprintk(ioc,
2379
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2380
+ __FILE__, __LINE__, __func__));
22402381 return 1;
22412382 }
22422383
....@@ -2308,7 +2449,7 @@
23082449 MPT3SAS_RAID_MAX_SECTORS);
23092450 }
23102451
2311
- scsih_change_queue_depth(sdev, qdepth);
2452
+ mpt3sas_scsih_change_queue_depth(sdev, qdepth);
23122453
23132454 /* raid transport support */
23142455 if (!ioc->is_warpdrive)
....@@ -2320,16 +2461,16 @@
23202461 if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
23212462 if (mpt3sas_config_get_volume_handle(ioc, handle,
23222463 &volume_handle)) {
2323
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2324
- "failure at %s:%d/%s()!\n", ioc->name,
2325
- __FILE__, __LINE__, __func__));
2464
+ dfailprintk(ioc,
2465
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2466
+ __FILE__, __LINE__, __func__));
23262467 return 1;
23272468 }
23282469 if (volume_handle && mpt3sas_config_get_volume_wwid(ioc,
23292470 volume_handle, &volume_wwid)) {
2330
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2331
- "failure at %s:%d/%s()!\n", ioc->name,
2332
- __FILE__, __LINE__, __func__));
2471
+ dfailprintk(ioc,
2472
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2473
+ __FILE__, __LINE__, __func__));
23332474 return 1;
23342475 }
23352476 }
....@@ -2341,9 +2482,9 @@
23412482 sas_device_priv_data->sas_target->sas_address);
23422483 if (!pcie_device) {
23432484 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
2344
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2345
- "failure at %s:%d/%s()!\n", ioc->name, __FILE__,
2346
- __LINE__, __func__));
2485
+ dfailprintk(ioc,
2486
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2487
+ __FILE__, __LINE__, __func__));
23472488 return 1;
23482489 }
23492490
....@@ -2372,7 +2513,7 @@
23722513
23732514 pcie_device_put(pcie_device);
23742515 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
2375
- scsih_change_queue_depth(sdev, qdepth);
2516
+ mpt3sas_scsih_change_queue_depth(sdev, qdepth);
23762517 /* Enable QUEUE_FLAG_NOMERGES flag, so that IOs won't be
23772518 ** merged and can eliminate holes created during merging
23782519 ** operation.
....@@ -2389,9 +2530,9 @@
23892530 sas_device_priv_data->sas_target->sas_address);
23902531 if (!sas_device) {
23912532 spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
2392
- dfailprintk(ioc, pr_warn(MPT3SAS_FMT
2393
- "failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__,
2394
- __func__));
2533
+ dfailprintk(ioc,
2534
+ ioc_warn(ioc, "failure at %s:%d/%s()!\n",
2535
+ __FILE__, __LINE__, __func__));
23952536 return 1;
23962537 }
23972538
....@@ -2432,7 +2573,7 @@
24322573 _scsih_display_sata_capabilities(ioc, handle, sdev);
24332574
24342575
2435
- scsih_change_queue_depth(sdev, qdepth);
2576
+ mpt3sas_scsih_change_queue_depth(sdev, qdepth);
24362577
24372578 if (ssp_target) {
24382579 sas_read_port_mode_page(sdev);
....@@ -2527,8 +2668,7 @@
25272668 desc = "unknown";
25282669 break;
25292670 }
2530
- pr_warn(MPT3SAS_FMT "response_code(0x%01x): %s\n",
2531
- ioc->name, response_code, desc);
2671
+ ioc_warn(ioc, "response_code(0x%01x): %s\n", response_code, desc);
25322672 }
25332673
25342674 /**
....@@ -2621,9 +2761,101 @@
26212761 }
26222762
26232763 /**
2764
+ * scsih_tm_cmd_map_status - map the target reset & LUN reset TM status
2765
+ * @ioc - per adapter object
2766
+ * @channel - the channel assigned by the OS
2767
+ * @id: the id assigned by the OS
2768
+ * @lun: lun number
2769
+ * @type: MPI2_SCSITASKMGMT_TASKTYPE__XXX (defined in mpi2_init.h)
2770
+ * @smid_task: smid assigned to the task
2771
+ *
2772
+ * Look whether TM has aborted the timed out SCSI command, if
2773
+ * TM has aborted the IO then return SUCCESS else return FAILED.
2774
+ */
2775
+static int
2776
+scsih_tm_cmd_map_status(struct MPT3SAS_ADAPTER *ioc, uint channel,
2777
+ uint id, uint lun, u8 type, u16 smid_task)
2778
+{
2779
+
2780
+ if (smid_task <= ioc->shost->can_queue) {
2781
+ switch (type) {
2782
+ case MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET:
2783
+ if (!(_scsih_scsi_lookup_find_by_target(ioc,
2784
+ id, channel)))
2785
+ return SUCCESS;
2786
+ break;
2787
+ case MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET:
2788
+ case MPI2_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET:
2789
+ if (!(_scsih_scsi_lookup_find_by_lun(ioc, id,
2790
+ lun, channel)))
2791
+ return SUCCESS;
2792
+ break;
2793
+ default:
2794
+ return SUCCESS;
2795
+ }
2796
+ } else if (smid_task == ioc->scsih_cmds.smid) {
2797
+ if ((ioc->scsih_cmds.status & MPT3_CMD_COMPLETE) ||
2798
+ (ioc->scsih_cmds.status & MPT3_CMD_NOT_USED))
2799
+ return SUCCESS;
2800
+ } else if (smid_task == ioc->ctl_cmds.smid) {
2801
+ if ((ioc->ctl_cmds.status & MPT3_CMD_COMPLETE) ||
2802
+ (ioc->ctl_cmds.status & MPT3_CMD_NOT_USED))
2803
+ return SUCCESS;
2804
+ }
2805
+
2806
+ return FAILED;
2807
+}
2808
+
2809
+/**
2810
+ * scsih_tm_post_processing - post processing of target & LUN reset
2811
+ * @ioc - per adapter object
2812
+ * @handle: device handle
2813
+ * @channel - the channel assigned by the OS
2814
+ * @id: the id assigned by the OS
2815
+ * @lun: lun number
2816
+ * @type: MPI2_SCSITASKMGMT_TASKTYPE__XXX (defined in mpi2_init.h)
2817
+ * @smid_task: smid assigned to the task
2818
+ *
2819
+ * Post processing of target & LUN reset. Due to interrupt latency
2820
+ * issue it possible that interrupt for aborted IO might not be
2821
+ * received yet. So before returning failure status, poll the
2822
+ * reply descriptor pools for the reply of timed out SCSI command.
2823
+ * Return FAILED status if reply for timed out is not received
2824
+ * otherwise return SUCCESS.
2825
+ */
2826
+static int
2827
+scsih_tm_post_processing(struct MPT3SAS_ADAPTER *ioc, u16 handle,
2828
+ uint channel, uint id, uint lun, u8 type, u16 smid_task)
2829
+{
2830
+ int rc;
2831
+
2832
+ rc = scsih_tm_cmd_map_status(ioc, channel, id, lun, type, smid_task);
2833
+ if (rc == SUCCESS)
2834
+ return rc;
2835
+
2836
+ ioc_info(ioc,
2837
+ "Poll ReplyDescriptor queues for completion of"
2838
+ " smid(%d), task_type(0x%02x), handle(0x%04x)\n",
2839
+ smid_task, type, handle);
2840
+
2841
+ /*
2842
+ * Due to interrupt latency issues, driver may receive interrupt for
2843
+ * TM first and then for aborted SCSI IO command. So, poll all the
2844
+ * ReplyDescriptor pools before returning the FAILED status to SML.
2845
+ */
2846
+ mpt3sas_base_mask_interrupts(ioc);
2847
+ mpt3sas_base_sync_reply_irqs(ioc, 1);
2848
+ mpt3sas_base_unmask_interrupts(ioc);
2849
+
2850
+ return scsih_tm_cmd_map_status(ioc, channel, id, lun, type, smid_task);
2851
+}
2852
+
2853
+/**
26242854 * mpt3sas_scsih_issue_tm - main routine for sending tm requests
26252855 * @ioc: per adapter struct
26262856 * @handle: device handle
2857
+ * @channel: the channel assigned by the OS
2858
+ * @id: the id assigned by the OS
26272859 * @lun: lun number
26282860 * @type: MPI2_SCSITASKMGMT_TASKTYPE__XXX (defined in mpi2_init.h)
26292861 * @smid_task: smid assigned to the task
....@@ -2640,40 +2872,46 @@
26402872 * Return: SUCCESS or FAILED.
26412873 */
26422874 int
2643
-mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, u64 lun,
2644
- u8 type, u16 smid_task, u16 msix_task, u8 timeout, u8 tr_method)
2875
+mpt3sas_scsih_issue_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle, uint channel,
2876
+ uint id, u64 lun, u8 type, u16 smid_task, u16 msix_task,
2877
+ u8 timeout, u8 tr_method)
26452878 {
26462879 Mpi2SCSITaskManagementRequest_t *mpi_request;
26472880 Mpi2SCSITaskManagementReply_t *mpi_reply;
2881
+ Mpi25SCSIIORequest_t *request;
26482882 u16 smid = 0;
26492883 u32 ioc_state;
26502884 int rc;
2885
+ u8 issue_reset = 0;
26512886
26522887 lockdep_assert_held(&ioc->tm_cmds.mutex);
26532888
26542889 if (ioc->tm_cmds.status != MPT3_CMD_NOT_USED) {
2655
- pr_info(MPT3SAS_FMT "%s: tm_cmd busy!!!\n",
2656
- __func__, ioc->name);
2890
+ ioc_info(ioc, "%s: tm_cmd busy!!!\n", __func__);
26572891 return FAILED;
26582892 }
26592893
26602894 if (ioc->shost_recovery || ioc->remove_host ||
26612895 ioc->pci_error_recovery) {
2662
- pr_info(MPT3SAS_FMT "%s: host reset in progress!\n",
2663
- __func__, ioc->name);
2896
+ ioc_info(ioc, "%s: host reset in progress!\n", __func__);
26642897 return FAILED;
26652898 }
26662899
26672900 ioc_state = mpt3sas_base_get_iocstate(ioc, 0);
26682901 if (ioc_state & MPI2_DOORBELL_USED) {
2669
- dhsprintk(ioc, pr_info(MPT3SAS_FMT
2670
- "unexpected doorbell active!\n", ioc->name));
2902
+ dhsprintk(ioc, ioc_info(ioc, "unexpected doorbell active!\n"));
26712903 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
26722904 return (!rc) ? SUCCESS : FAILED;
26732905 }
26742906
26752907 if ((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_FAULT) {
2676
- mpt3sas_base_fault_info(ioc, ioc_state &
2908
+ mpt3sas_print_fault_code(ioc, ioc_state &
2909
+ MPI2_DOORBELL_DATA_MASK);
2910
+ rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
2911
+ return (!rc) ? SUCCESS : FAILED;
2912
+ } else if ((ioc_state & MPI2_IOC_STATE_MASK) ==
2913
+ MPI2_IOC_STATE_COREDUMP) {
2914
+ mpt3sas_print_coredump_info(ioc, ioc_state &
26772915 MPI2_DOORBELL_DATA_MASK);
26782916 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
26792917 return (!rc) ? SUCCESS : FAILED;
....@@ -2681,14 +2919,13 @@
26812919
26822920 smid = mpt3sas_base_get_smid_hpr(ioc, ioc->tm_cb_idx);
26832921 if (!smid) {
2684
- pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
2685
- ioc->name, __func__);
2922
+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
26862923 return FAILED;
26872924 }
26882925
2689
- dtmprintk(ioc, pr_info(MPT3SAS_FMT
2690
- "sending tm: handle(0x%04x), task_type(0x%02x), smid(%d), timeout(%d), tr_method(0x%x)\n",
2691
- ioc->name, handle, type, smid_task, timeout, tr_method));
2926
+ dtmprintk(ioc,
2927
+ ioc_info(ioc, "sending tm: handle(0x%04x), task_type(0x%02x), smid(%d), timeout(%d), tr_method(0x%x)\n",
2928
+ handle, type, smid_task, timeout, tr_method));
26922929 ioc->tm_cmds.status = MPT3_CMD_PENDING;
26932930 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
26942931 ioc->tm_cmds.smid = smid;
....@@ -2697,17 +2934,20 @@
26972934 mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
26982935 mpi_request->DevHandle = cpu_to_le16(handle);
26992936 mpi_request->TaskType = type;
2700
- mpi_request->MsgFlags = tr_method;
2937
+ if (type == MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK ||
2938
+ type == MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK)
2939
+ mpi_request->MsgFlags = tr_method;
27012940 mpi_request->TaskMID = cpu_to_le16(smid_task);
27022941 int_to_scsilun(lun, (struct scsi_lun *)mpi_request->LUN);
27032942 mpt3sas_scsih_set_tm_flag(ioc, handle);
27042943 init_completion(&ioc->tm_cmds.done);
2705
- mpt3sas_base_put_smid_hi_priority(ioc, smid, msix_task);
2944
+ ioc->put_smid_hi_priority(ioc, smid, msix_task);
27062945 wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ);
27072946 if (!(ioc->tm_cmds.status & MPT3_CMD_COMPLETE)) {
2708
- if (mpt3sas_base_check_cmd_timeout(ioc,
2709
- ioc->tm_cmds.status, mpi_request,
2710
- sizeof(Mpi2SCSITaskManagementRequest_t)/4)) {
2947
+ mpt3sas_check_cmd_timeout(ioc,
2948
+ ioc->tm_cmds.status, mpi_request,
2949
+ sizeof(Mpi2SCSITaskManagementRequest_t)/4, issue_reset);
2950
+ if (issue_reset) {
27112951 rc = mpt3sas_base_hard_reset_handler(ioc,
27122952 FORCE_BIG_HAMMER);
27132953 rc = (!rc) ? SUCCESS : FAILED;
....@@ -2716,16 +2956,16 @@
27162956 }
27172957
27182958 /* sync IRQs in case those were busy during flush. */
2719
- mpt3sas_base_sync_reply_irqs(ioc);
2959
+ mpt3sas_base_sync_reply_irqs(ioc, 0);
27202960
27212961 if (ioc->tm_cmds.status & MPT3_CMD_REPLY_VALID) {
27222962 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);
27232963 mpi_reply = ioc->tm_cmds.reply;
2724
- dtmprintk(ioc, pr_info(MPT3SAS_FMT "complete tm: " \
2725
- "ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n",
2726
- ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
2727
- le32_to_cpu(mpi_reply->IOCLogInfo),
2728
- le32_to_cpu(mpi_reply->TerminationCount)));
2964
+ dtmprintk(ioc,
2965
+ ioc_info(ioc, "complete tm: ioc_status(0x%04x), loginfo(0x%08x), term_count(0x%08x)\n",
2966
+ le16_to_cpu(mpi_reply->IOCStatus),
2967
+ le32_to_cpu(mpi_reply->IOCLogInfo),
2968
+ le32_to_cpu(mpi_reply->TerminationCount)));
27292969 if (ioc->logging_level & MPT_DEBUG_TM) {
27302970 _scsih_response_code(ioc, mpi_reply->ResponseCode);
27312971 if (mpi_reply->IOCStatus)
....@@ -2733,7 +2973,44 @@
27332973 sizeof(Mpi2SCSITaskManagementRequest_t)/4);
27342974 }
27352975 }
2736
- rc = SUCCESS;
2976
+
2977
+ switch (type) {
2978
+ case MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK:
2979
+ rc = SUCCESS;
2980
+ /*
2981
+ * If DevHandle filed in smid_task's entry of request pool
2982
+ * doesn't match with device handle on which this task abort
2983
+ * TM is received then it means that TM has successfully
2984
+ * aborted the timed out command. Since smid_task's entry in
2985
+ * request pool will be memset to zero once the timed out
2986
+ * command is returned to the SML. If the command is not
2987
+ * aborted then smid_task’s entry won’t be cleared and it
2988
+ * will have same DevHandle value on which this task abort TM
2989
+ * is received and driver will return the TM status as FAILED.
2990
+ */
2991
+ request = mpt3sas_base_get_msg_frame(ioc, smid_task);
2992
+ if (le16_to_cpu(request->DevHandle) != handle)
2993
+ break;
2994
+
2995
+ ioc_info(ioc, "Task abort tm failed: handle(0x%04x),"
2996
+ "timeout(%d) tr_method(0x%x) smid(%d) msix_index(%d)\n",
2997
+ handle, timeout, tr_method, smid_task, msix_task);
2998
+ rc = FAILED;
2999
+ break;
3000
+
3001
+ case MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET:
3002
+ case MPI2_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET:
3003
+ case MPI2_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET:
3004
+ rc = scsih_tm_post_processing(ioc, handle, channel, id, lun,
3005
+ type, smid_task);
3006
+ break;
3007
+ case MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK:
3008
+ rc = SUCCESS;
3009
+ break;
3010
+ default:
3011
+ rc = FAILED;
3012
+ break;
3013
+ }
27373014
27383015 out:
27393016 mpt3sas_scsih_clear_tm_flag(ioc, handle);
....@@ -2742,14 +3019,14 @@
27423019 }
27433020
27443021 int mpt3sas_scsih_issue_locked_tm(struct MPT3SAS_ADAPTER *ioc, u16 handle,
2745
- u64 lun, u8 type, u16 smid_task, u16 msix_task,
2746
- u8 timeout, u8 tr_method)
3022
+ uint channel, uint id, u64 lun, u8 type, u16 smid_task,
3023
+ u16 msix_task, u8 timeout, u8 tr_method)
27473024 {
27483025 int ret;
27493026
27503027 mutex_lock(&ioc->tm_cmds.mutex);
2751
- ret = mpt3sas_scsih_issue_tm(ioc, handle, lun, type, smid_task,
2752
- msix_task, timeout, tr_method);
3028
+ ret = mpt3sas_scsih_issue_tm(ioc, handle, channel, id, lun, type,
3029
+ smid_task, msix_task, timeout, tr_method);
27533030 mutex_unlock(&ioc->tm_cmds.mutex);
27543031
27553032 return ret;
....@@ -2854,15 +3131,17 @@
28543131
28553132 u8 timeout = 30;
28563133 struct _pcie_device *pcie_device = NULL;
2857
- sdev_printk(KERN_INFO, scmd->device,
2858
- "attempting task abort! scmd(%p)\n", scmd);
3134
+ sdev_printk(KERN_INFO, scmd->device, "attempting task abort!"
3135
+ "scmd(0x%p), outstanding for %u ms & timeout %u ms\n",
3136
+ scmd, jiffies_to_msecs(jiffies - scmd->jiffies_at_alloc),
3137
+ (scmd->request->timeout / HZ) * 1000);
28593138 _scsih_tm_display_info(ioc, scmd);
28603139
28613140 sas_device_priv_data = scmd->device->hostdata;
28623141 if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
28633142 ioc->remove_host) {
28643143 sdev_printk(KERN_INFO, scmd->device,
2865
- "device been deleted! scmd(%p)\n", scmd);
3144
+ "device been deleted! scmd(0x%p)\n", scmd);
28663145 scmd->result = DID_NO_CONNECT << 16;
28673146 scmd->scsi_done(scmd);
28683147 r = SUCCESS;
....@@ -2871,6 +3150,8 @@
28713150
28723151 /* check for completed command */
28733152 if (st == NULL || st->cb_idx == 0xFF) {
3153
+ sdev_printk(KERN_INFO, scmd->device, "No reference found at "
3154
+ "driver, assuming scmd(0x%p) might have completed\n", scmd);
28743155 scmd->result = DID_RESET << 16;
28753156 r = SUCCESS;
28763157 goto out;
....@@ -2889,16 +3170,18 @@
28893170
28903171 handle = sas_device_priv_data->sas_target->handle;
28913172 pcie_device = mpt3sas_get_pdev_by_handle(ioc, handle);
2892
- if (pcie_device && (!ioc->tm_custom_handling))
3173
+ if (pcie_device && (!ioc->tm_custom_handling) &&
3174
+ (!(mpt3sas_scsih_is_pcie_scsi_device(pcie_device->device_info))))
28933175 timeout = ioc->nvme_abort_timeout;
2894
- r = mpt3sas_scsih_issue_locked_tm(ioc, handle, scmd->device->lun,
3176
+ r = mpt3sas_scsih_issue_locked_tm(ioc, handle, scmd->device->channel,
3177
+ scmd->device->id, scmd->device->lun,
28953178 MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
28963179 st->smid, st->msix_io, timeout, 0);
28973180 /* Command must be cleared after abort */
28983181 if (r == SUCCESS && st->cb_idx != 0xFF)
28993182 r = FAILED;
29003183 out:
2901
- sdev_printk(KERN_INFO, scmd->device, "task abort: %s scmd(%p)\n",
3184
+ sdev_printk(KERN_INFO, scmd->device, "task abort: %s scmd(0x%p)\n",
29023185 ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
29033186 if (pcie_device)
29043187 pcie_device_put(pcie_device);
....@@ -2927,14 +3210,14 @@
29273210 struct MPT3SAS_TARGET *target_priv_data = starget->hostdata;
29283211
29293212 sdev_printk(KERN_INFO, scmd->device,
2930
- "attempting device reset! scmd(%p)\n", scmd);
3213
+ "attempting device reset! scmd(0x%p)\n", scmd);
29313214 _scsih_tm_display_info(ioc, scmd);
29323215
29333216 sas_device_priv_data = scmd->device->hostdata;
29343217 if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
29353218 ioc->remove_host) {
29363219 sdev_printk(KERN_INFO, scmd->device,
2937
- "device been deleted! scmd(%p)\n", scmd);
3220
+ "device been deleted! scmd(0x%p)\n", scmd);
29383221 scmd->result = DID_NO_CONNECT << 16;
29393222 scmd->scsi_done(scmd);
29403223 r = SUCCESS;
....@@ -2960,19 +3243,22 @@
29603243
29613244 pcie_device = mpt3sas_get_pdev_by_handle(ioc, handle);
29623245
2963
- if (pcie_device && (!ioc->tm_custom_handling)) {
3246
+ if (pcie_device && (!ioc->tm_custom_handling) &&
3247
+ (!(mpt3sas_scsih_is_pcie_scsi_device(pcie_device->device_info)))) {
29643248 tr_timeout = pcie_device->reset_timeout;
29653249 tr_method = MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE;
29663250 } else
29673251 tr_method = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
2968
- r = mpt3sas_scsih_issue_locked_tm(ioc, handle, scmd->device->lun,
3252
+
3253
+ r = mpt3sas_scsih_issue_locked_tm(ioc, handle, scmd->device->channel,
3254
+ scmd->device->id, scmd->device->lun,
29693255 MPI2_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET, 0, 0,
29703256 tr_timeout, tr_method);
29713257 /* Check for busy commands after reset */
29723258 if (r == SUCCESS && atomic_read(&scmd->device->device_busy))
29733259 r = FAILED;
29743260 out:
2975
- sdev_printk(KERN_INFO, scmd->device, "device reset: %s scmd(%p)\n",
3261
+ sdev_printk(KERN_INFO, scmd->device, "device reset: %s scmd(0x%p)\n",
29763262 ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
29773263
29783264 if (sas_device)
....@@ -3003,15 +3289,15 @@
30033289 struct scsi_target *starget = scmd->device->sdev_target;
30043290 struct MPT3SAS_TARGET *target_priv_data = starget->hostdata;
30053291
3006
- starget_printk(KERN_INFO, starget, "attempting target reset! scmd(%p)\n",
3007
- scmd);
3292
+ starget_printk(KERN_INFO, starget,
3293
+ "attempting target reset! scmd(0x%p)\n", scmd);
30083294 _scsih_tm_display_info(ioc, scmd);
30093295
30103296 sas_device_priv_data = scmd->device->hostdata;
30113297 if (!sas_device_priv_data || !sas_device_priv_data->sas_target ||
30123298 ioc->remove_host) {
3013
- starget_printk(KERN_INFO, starget, "target been deleted! scmd(%p)\n",
3014
- scmd);
3299
+ starget_printk(KERN_INFO, starget,
3300
+ "target been deleted! scmd(0x%p)\n", scmd);
30153301 scmd->result = DID_NO_CONNECT << 16;
30163302 scmd->scsi_done(scmd);
30173303 r = SUCCESS;
....@@ -3037,19 +3323,21 @@
30373323
30383324 pcie_device = mpt3sas_get_pdev_by_handle(ioc, handle);
30393325
3040
- if (pcie_device && (!ioc->tm_custom_handling)) {
3326
+ if (pcie_device && (!ioc->tm_custom_handling) &&
3327
+ (!(mpt3sas_scsih_is_pcie_scsi_device(pcie_device->device_info)))) {
30413328 tr_timeout = pcie_device->reset_timeout;
30423329 tr_method = MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE;
30433330 } else
30443331 tr_method = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
3045
- r = mpt3sas_scsih_issue_locked_tm(ioc, handle, 0,
3332
+ r = mpt3sas_scsih_issue_locked_tm(ioc, handle, scmd->device->channel,
3333
+ scmd->device->id, 0,
30463334 MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 0, 0,
30473335 tr_timeout, tr_method);
30483336 /* Check for busy commands after reset */
30493337 if (r == SUCCESS && atomic_read(&starget->target_busy))
30503338 r = FAILED;
30513339 out:
3052
- starget_printk(KERN_INFO, starget, "target reset: %s scmd(%p)\n",
3340
+ starget_printk(KERN_INFO, starget, "target reset: %s scmd(0x%p)\n",
30533341 ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
30543342
30553343 if (sas_device)
....@@ -3072,13 +3360,11 @@
30723360 struct MPT3SAS_ADAPTER *ioc = shost_priv(scmd->device->host);
30733361 int r, retval;
30743362
3075
- pr_info(MPT3SAS_FMT "attempting host reset! scmd(%p)\n",
3076
- ioc->name, scmd);
3363
+ ioc_info(ioc, "attempting host reset! scmd(0x%p)\n", scmd);
30773364 scsi_print_command(scmd);
30783365
30793366 if (ioc->is_driver_loading || ioc->remove_host) {
3080
- pr_info(MPT3SAS_FMT "Blocking the host reset\n",
3081
- ioc->name);
3367
+ ioc_info(ioc, "Blocking the host reset\n");
30823368 r = FAILED;
30833369 goto out;
30843370 }
....@@ -3086,8 +3372,8 @@
30863372 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
30873373 r = (retval < 0) ? FAILED : SUCCESS;
30883374 out:
3089
- pr_info(MPT3SAS_FMT "host reset: %s scmd(%p)\n",
3090
- ioc->name, ((r == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
3375
+ ioc_info(ioc, "host reset: %s scmd(0x%p)\n",
3376
+ r == SUCCESS ? "SUCCESS" : "FAILED", scmd);
30913377
30923378 return r;
30933379 }
....@@ -3215,6 +3501,7 @@
32153501 fw_event = list_first_entry(&ioc->fw_event_list,
32163502 struct fw_event_work, list);
32173503 list_del_init(&fw_event->list);
3504
+ fw_event_work_put(fw_event);
32183505 }
32193506 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
32203507
....@@ -3233,11 +3520,35 @@
32333520 {
32343521 struct fw_event_work *fw_event;
32353522
3236
- if (list_empty(&ioc->fw_event_list) ||
3523
+ if ((list_empty(&ioc->fw_event_list) && !ioc->current_event) ||
32373524 !ioc->firmware_event_thread || in_interrupt())
32383525 return;
32393526
3240
- while ((fw_event = dequeue_next_fw_event(ioc))) {
3527
+ ioc->fw_events_cleanup = 1;
3528
+ while ((fw_event = dequeue_next_fw_event(ioc)) ||
3529
+ (fw_event = ioc->current_event)) {
3530
+
3531
+ /*
3532
+ * Don't call cancel_work_sync() for current_event
3533
+ * other than MPT3SAS_REMOVE_UNRESPONDING_DEVICES;
3534
+ * otherwise we may observe deadlock if current
3535
+ * hard reset issued as part of processing the current_event.
3536
+ *
3537
+ * Orginal logic of cleaning the current_event is added
3538
+ * for handling the back to back host reset issued by the user.
3539
+ * i.e. during back to back host reset, driver use to process
3540
+ * the two instances of MPT3SAS_REMOVE_UNRESPONDING_DEVICES
3541
+ * event back to back and this made the drives to unregister
3542
+ * the devices from SML.
3543
+ */
3544
+
3545
+ if (fw_event == ioc->current_event &&
3546
+ ioc->current_event->event !=
3547
+ MPT3SAS_REMOVE_UNRESPONDING_DEVICES) {
3548
+ ioc->current_event = NULL;
3549
+ continue;
3550
+ }
3551
+
32413552 /*
32423553 * Wait on the fw_event to complete. If this returns 1, then
32433554 * the event was never executed, and we need a put for the
....@@ -3249,8 +3560,8 @@
32493560 if (cancel_work_sync(&fw_event->work))
32503561 fw_event_work_put(fw_event);
32513562
3252
- fw_event_work_put(fw_event);
32533563 }
3564
+ ioc->fw_events_cleanup = 0;
32543565 }
32553566
32563567 /**
....@@ -3579,18 +3890,16 @@
35793890 u8 tr_method = 0;
35803891
35813892 if (ioc->pci_error_recovery) {
3582
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3583
- "%s: host in pci error recovery: handle(0x%04x)\n",
3584
- __func__, ioc->name,
3585
- handle));
3893
+ dewtprintk(ioc,
3894
+ ioc_info(ioc, "%s: host in pci error recovery: handle(0x%04x)\n",
3895
+ __func__, handle));
35863896 return;
35873897 }
35883898 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
35893899 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3590
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3591
- "%s: host is not operational: handle(0x%04x)\n",
3592
- __func__, ioc->name,
3593
- handle));
3900
+ dewtprintk(ioc,
3901
+ ioc_info(ioc, "%s: host is not operational: handle(0x%04x)\n",
3902
+ __func__, handle));
35943903 return;
35953904 }
35963905
....@@ -3619,46 +3928,40 @@
36193928 sas_address = pcie_device->wwid;
36203929 }
36213930 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
3622
- if (pcie_device && (!ioc->tm_custom_handling))
3931
+ if (pcie_device && (!ioc->tm_custom_handling) &&
3932
+ (!(mpt3sas_scsih_is_pcie_scsi_device(
3933
+ pcie_device->device_info))))
36233934 tr_method =
36243935 MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE;
36253936 else
36263937 tr_method = MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET;
36273938 }
36283939 if (sas_target_priv_data) {
3629
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3630
- "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n",
3631
- ioc->name, handle,
3632
- (unsigned long long)sas_address));
3940
+ dewtprintk(ioc,
3941
+ ioc_info(ioc, "setting delete flag: handle(0x%04x), sas_addr(0x%016llx)\n",
3942
+ handle, (u64)sas_address));
36333943 if (sas_device) {
36343944 if (sas_device->enclosure_handle != 0)
3635
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3636
- "setting delete flag:enclosure logical "
3637
- "id(0x%016llx), slot(%d)\n", ioc->name,
3638
- (unsigned long long)
3639
- sas_device->enclosure_logical_id,
3640
- sas_device->slot));
3945
+ dewtprintk(ioc,
3946
+ ioc_info(ioc, "setting delete flag:enclosure logical id(0x%016llx), slot(%d)\n",
3947
+ (u64)sas_device->enclosure_logical_id,
3948
+ sas_device->slot));
36413949 if (sas_device->connector_name[0] != '\0')
3642
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3643
- "setting delete flag: enclosure "
3644
- "level(0x%04x), connector name( %s)\n",
3645
- ioc->name, sas_device->enclosure_level,
3646
- sas_device->connector_name));
3950
+ dewtprintk(ioc,
3951
+ ioc_info(ioc, "setting delete flag: enclosure level(0x%04x), connector name( %s)\n",
3952
+ sas_device->enclosure_level,
3953
+ sas_device->connector_name));
36473954 } else if (pcie_device) {
36483955 if (pcie_device->enclosure_handle != 0)
3649
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3650
- "setting delete flag: logical "
3651
- "id(0x%016llx), slot(%d)\n", ioc->name,
3652
- (unsigned long long)
3653
- pcie_device->enclosure_logical_id,
3654
- pcie_device->slot));
3956
+ dewtprintk(ioc,
3957
+ ioc_info(ioc, "setting delete flag: logical id(0x%016llx), slot(%d)\n",
3958
+ (u64)pcie_device->enclosure_logical_id,
3959
+ pcie_device->slot));
36553960 if (pcie_device->connector_name[0] != '\0')
3656
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3657
- "setting delete flag:, enclosure "
3658
- "level(0x%04x), "
3659
- "connector name( %s)\n", ioc->name,
3660
- pcie_device->enclosure_level,
3661
- pcie_device->connector_name));
3961
+ dewtprintk(ioc,
3962
+ ioc_info(ioc, "setting delete flag:, enclosure level(0x%04x), connector name( %s)\n",
3963
+ pcie_device->enclosure_level,
3964
+ pcie_device->connector_name));
36623965 }
36633966 _scsih_ublock_io_device(ioc, sas_address);
36643967 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;
....@@ -3672,16 +3975,15 @@
36723975 INIT_LIST_HEAD(&delayed_tr->list);
36733976 delayed_tr->handle = handle;
36743977 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);
3675
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3676
- "DELAYED:tr:handle(0x%04x), (open)\n",
3677
- ioc->name, handle));
3978
+ dewtprintk(ioc,
3979
+ ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
3980
+ handle));
36783981 goto out;
36793982 }
36803983
3681
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3682
- "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3683
- ioc->name, handle, smid,
3684
- ioc->tm_tr_cb_idx));
3984
+ dewtprintk(ioc,
3985
+ ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3986
+ handle, smid, ioc->tm_tr_cb_idx));
36853987 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
36863988 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));
36873989 mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
....@@ -3689,7 +3991,7 @@
36893991 mpi_request->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
36903992 mpi_request->MsgFlags = tr_method;
36913993 set_bit(handle, ioc->device_remove_in_progress);
3692
- mpt3sas_base_put_smid_hi_priority(ioc, smid, 0);
3994
+ ioc->put_smid_hi_priority(ioc, smid, 0);
36933995 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_DEVICE_REMOVAL);
36943996
36953997 out:
....@@ -3729,39 +4031,39 @@
37294031 struct _sc_list *delayed_sc;
37304032
37314033 if (ioc->pci_error_recovery) {
3732
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3733
- "%s: host in pci error recovery\n", __func__,
3734
- ioc->name));
4034
+ dewtprintk(ioc,
4035
+ ioc_info(ioc, "%s: host in pci error recovery\n",
4036
+ __func__));
37354037 return 1;
37364038 }
37374039 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
37384040 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
3739
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3740
- "%s: host is not operational\n", __func__, ioc->name));
4041
+ dewtprintk(ioc,
4042
+ ioc_info(ioc, "%s: host is not operational\n",
4043
+ __func__));
37414044 return 1;
37424045 }
37434046 if (unlikely(!mpi_reply)) {
3744
- pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3745
- ioc->name, __FILE__, __LINE__, __func__);
4047
+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
4048
+ __FILE__, __LINE__, __func__);
37464049 return 1;
37474050 }
37484051 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);
37494052 handle = le16_to_cpu(mpi_request_tm->DevHandle);
37504053 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
3751
- dewtprintk(ioc, pr_err(MPT3SAS_FMT
3752
- "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3753
- ioc->name, handle,
3754
- le16_to_cpu(mpi_reply->DevHandle), smid));
4054
+ dewtprintk(ioc,
4055
+ ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
4056
+ handle,
4057
+ le16_to_cpu(mpi_reply->DevHandle), smid));
37554058 return 0;
37564059 }
37574060
37584061 mpt3sas_trigger_master(ioc, MASTER_TRIGGER_TASK_MANAGMENT);
3759
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3760
- "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), "
3761
- "loginfo(0x%08x), completed(%d)\n", ioc->name,
3762
- handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3763
- le32_to_cpu(mpi_reply->IOCLogInfo),
3764
- le32_to_cpu(mpi_reply->TerminationCount)));
4062
+ dewtprintk(ioc,
4063
+ ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n",
4064
+ handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
4065
+ le32_to_cpu(mpi_reply->IOCLogInfo),
4066
+ le32_to_cpu(mpi_reply->TerminationCount)));
37654067
37664068 smid_sas_ctrl = mpt3sas_base_get_smid(ioc, ioc->tm_sas_control_cb_idx);
37674069 if (!smid_sas_ctrl) {
....@@ -3771,22 +4073,21 @@
37714073 INIT_LIST_HEAD(&delayed_sc->list);
37724074 delayed_sc->handle = le16_to_cpu(mpi_request_tm->DevHandle);
37734075 list_add_tail(&delayed_sc->list, &ioc->delayed_sc_list);
3774
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3775
- "DELAYED:sc:handle(0x%04x), (open)\n",
3776
- ioc->name, handle));
4076
+ dewtprintk(ioc,
4077
+ ioc_info(ioc, "DELAYED:sc:handle(0x%04x), (open)\n",
4078
+ handle));
37774079 return _scsih_check_for_pending_tm(ioc, smid);
37784080 }
37794081
3780
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3781
- "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3782
- ioc->name, handle, smid_sas_ctrl,
3783
- ioc->tm_sas_control_cb_idx));
4082
+ dewtprintk(ioc,
4083
+ ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
4084
+ handle, smid_sas_ctrl, ioc->tm_sas_control_cb_idx));
37844085 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid_sas_ctrl);
37854086 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));
37864087 mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;
37874088 mpi_request->Operation = MPI2_SAS_OP_REMOVE_DEVICE;
37884089 mpi_request->DevHandle = mpi_request_tm->DevHandle;
3789
- mpt3sas_base_put_smid_default(ioc, smid_sas_ctrl);
4090
+ ioc->put_smid_default(ioc, smid_sas_ctrl);
37904091
37914092 return _scsih_check_for_pending_tm(ioc, smid);
37924093 }
....@@ -3849,20 +4150,19 @@
38494150 mpt3sas_base_get_reply_virt_addr(ioc, reply);
38504151
38514152 if (likely(mpi_reply)) {
3852
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3853
- "sc_complete:handle(0x%04x), (open) "
3854
- "smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
3855
- ioc->name, le16_to_cpu(mpi_reply->DevHandle), smid,
3856
- le16_to_cpu(mpi_reply->IOCStatus),
3857
- le32_to_cpu(mpi_reply->IOCLogInfo)));
4153
+ dewtprintk(ioc,
4154
+ ioc_info(ioc, "sc_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x)\n",
4155
+ le16_to_cpu(mpi_reply->DevHandle), smid,
4156
+ le16_to_cpu(mpi_reply->IOCStatus),
4157
+ le32_to_cpu(mpi_reply->IOCLogInfo)));
38584158 if (le16_to_cpu(mpi_reply->IOCStatus) ==
38594159 MPI2_IOCSTATUS_SUCCESS) {
38604160 clear_bit(le16_to_cpu(mpi_reply->DevHandle),
38614161 ioc->device_remove_in_progress);
38624162 }
38634163 } else {
3864
- pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3865
- ioc->name, __FILE__, __LINE__, __func__);
4164
+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
4165
+ __FILE__, __LINE__, __func__);
38664166 }
38674167 return mpt3sas_check_for_pending_internal_cmds(ioc, smid);
38684168 }
....@@ -3885,9 +4185,9 @@
38854185 struct _tr_list *delayed_tr;
38864186
38874187 if (ioc->pci_error_recovery) {
3888
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3889
- "%s: host reset in progress!\n",
3890
- __func__, ioc->name));
4188
+ dewtprintk(ioc,
4189
+ ioc_info(ioc, "%s: host reset in progress!\n",
4190
+ __func__));
38914191 return;
38924192 }
38934193
....@@ -3899,22 +4199,21 @@
38994199 INIT_LIST_HEAD(&delayed_tr->list);
39004200 delayed_tr->handle = handle;
39014201 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_volume_list);
3902
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3903
- "DELAYED:tr:handle(0x%04x), (open)\n",
3904
- ioc->name, handle));
4202
+ dewtprintk(ioc,
4203
+ ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
4204
+ handle));
39054205 return;
39064206 }
39074207
3908
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3909
- "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
3910
- ioc->name, handle, smid,
3911
- ioc->tm_tr_volume_cb_idx));
4208
+ dewtprintk(ioc,
4209
+ ioc_info(ioc, "tr_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
4210
+ handle, smid, ioc->tm_tr_volume_cb_idx));
39124211 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
39134212 memset(mpi_request, 0, sizeof(Mpi2SCSITaskManagementRequest_t));
39144213 mpi_request->Function = MPI2_FUNCTION_SCSI_TASK_MGMT;
39154214 mpi_request->DevHandle = cpu_to_le16(handle);
39164215 mpi_request->TaskType = MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
3917
- mpt3sas_base_put_smid_hi_priority(ioc, smid, 0);
4216
+ ioc->put_smid_hi_priority(ioc, smid, 0);
39184217 }
39194218
39204219 /**
....@@ -3938,33 +4237,32 @@
39384237 mpt3sas_base_get_reply_virt_addr(ioc, reply);
39394238
39404239 if (ioc->shost_recovery || ioc->pci_error_recovery) {
3941
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3942
- "%s: host reset in progress!\n",
3943
- __func__, ioc->name));
4240
+ dewtprintk(ioc,
4241
+ ioc_info(ioc, "%s: host reset in progress!\n",
4242
+ __func__));
39444243 return 1;
39454244 }
39464245 if (unlikely(!mpi_reply)) {
3947
- pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
3948
- ioc->name, __FILE__, __LINE__, __func__);
4246
+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
4247
+ __FILE__, __LINE__, __func__);
39494248 return 1;
39504249 }
39514250
39524251 mpi_request_tm = mpt3sas_base_get_msg_frame(ioc, smid);
39534252 handle = le16_to_cpu(mpi_request_tm->DevHandle);
39544253 if (handle != le16_to_cpu(mpi_reply->DevHandle)) {
3955
- dewtprintk(ioc, pr_err(MPT3SAS_FMT
3956
- "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
3957
- ioc->name, handle,
3958
- le16_to_cpu(mpi_reply->DevHandle), smid));
4254
+ dewtprintk(ioc,
4255
+ ioc_err(ioc, "spurious interrupt: handle(0x%04x:0x%04x), smid(%d)!!!\n",
4256
+ handle, le16_to_cpu(mpi_reply->DevHandle),
4257
+ smid));
39594258 return 0;
39604259 }
39614260
3962
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3963
- "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), "
3964
- "loginfo(0x%08x), completed(%d)\n", ioc->name,
3965
- handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
3966
- le32_to_cpu(mpi_reply->IOCLogInfo),
3967
- le32_to_cpu(mpi_reply->TerminationCount)));
4261
+ dewtprintk(ioc,
4262
+ ioc_info(ioc, "tr_complete:handle(0x%04x), (open) smid(%d), ioc_status(0x%04x), loginfo(0x%08x), completed(%d)\n",
4263
+ handle, smid, le16_to_cpu(mpi_reply->IOCStatus),
4264
+ le32_to_cpu(mpi_reply->IOCLogInfo),
4265
+ le32_to_cpu(mpi_reply->TerminationCount)));
39684266
39694267 return _scsih_check_for_pending_tm(ioc, smid);
39704268 }
....@@ -3994,10 +4292,9 @@
39944292 ioc->internal_lookup[i].cb_idx = ioc->base_cb_idx;
39954293 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
39964294
3997
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
3998
- "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n",
3999
- ioc->name, le16_to_cpu(event), smid,
4000
- ioc->base_cb_idx));
4295
+ dewtprintk(ioc,
4296
+ ioc_info(ioc, "EVENT ACK: event(0x%04x), smid(%d), cb(%d)\n",
4297
+ le16_to_cpu(event), smid, ioc->base_cb_idx));
40014298 ack_request = mpt3sas_base_get_msg_frame(ioc, smid);
40024299 memset(ack_request, 0, sizeof(Mpi2EventAckRequest_t));
40034300 ack_request->Function = MPI2_FUNCTION_EVENT_ACK;
....@@ -4005,7 +4302,7 @@
40054302 ack_request->EventContext = event_context;
40064303 ack_request->VF_ID = 0; /* TODO */
40074304 ack_request->VP_ID = 0;
4008
- mpt3sas_base_put_smid_default(ioc, smid);
4305
+ ioc->put_smid_default(ioc, smid);
40094306 }
40104307
40114308 /**
....@@ -4027,21 +4324,21 @@
40274324 unsigned long flags;
40284325
40294326 if (ioc->remove_host) {
4030
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4031
- "%s: host has been removed\n",
4032
- __func__, ioc->name));
4327
+ dewtprintk(ioc,
4328
+ ioc_info(ioc, "%s: host has been removed\n",
4329
+ __func__));
40334330 return;
40344331 } else if (ioc->pci_error_recovery) {
4035
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4036
- "%s: host in pci error recovery\n",
4037
- __func__, ioc->name));
4332
+ dewtprintk(ioc,
4333
+ ioc_info(ioc, "%s: host in pci error recovery\n",
4334
+ __func__));
40384335 return;
40394336 }
40404337 ioc_state = mpt3sas_base_get_iocstate(ioc, 1);
40414338 if (ioc_state != MPI2_IOC_STATE_OPERATIONAL) {
4042
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4043
- "%s: host is not operational\n",
4044
- __func__, ioc->name));
4339
+ dewtprintk(ioc,
4340
+ ioc_info(ioc, "%s: host is not operational\n",
4341
+ __func__));
40454342 return;
40464343 }
40474344
....@@ -4053,16 +4350,15 @@
40534350 ioc->internal_lookup[i].cb_idx = ioc->tm_sas_control_cb_idx;
40544351 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
40554352
4056
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4057
- "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
4058
- ioc->name, handle, smid,
4059
- ioc->tm_sas_control_cb_idx));
4353
+ dewtprintk(ioc,
4354
+ ioc_info(ioc, "sc_send:handle(0x%04x), (open), smid(%d), cb(%d)\n",
4355
+ handle, smid, ioc->tm_sas_control_cb_idx));
40604356 mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
40614357 memset(mpi_request, 0, sizeof(Mpi2SasIoUnitControlRequest_t));
40624358 mpi_request->Function = MPI2_FUNCTION_SAS_IO_UNIT_CONTROL;
40634359 mpi_request->Operation = MPI2_SAS_OP_REMOVE_DEVICE;
40644360 mpi_request->DevHandle = cpu_to_le16(handle);
4065
- mpt3sas_base_put_smid_default(ioc, smid);
4361
+ ioc->put_smid_default(ioc, smid);
40664362 }
40674363
40684364 /**
....@@ -4217,8 +4513,8 @@
42174513 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {
42184514 if (le16_to_cpu(local_event_data->ExpanderDevHandle) ==
42194515 expander_handle) {
4220
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4221
- "setting ignoring flag\n", ioc->name));
4516
+ dewtprintk(ioc,
4517
+ ioc_info(ioc, "setting ignoring flag\n"));
42224518 fw_event->ignore = 1;
42234519 }
42244520 }
....@@ -4289,9 +4585,8 @@
42894585 MPI2_EVENT_SAS_TOPO_ES_RESPONDING) {
42904586 if (le16_to_cpu(local_event_data->SwitchDevHandle) ==
42914587 switch_handle) {
4292
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4293
- "setting ignoring flag for switch event\n",
4294
- ioc->name));
4588
+ dewtprintk(ioc,
4589
+ ioc_info(ioc, "setting ignoring flag for switch event\n"));
42954590 fw_event->ignore = 1;
42964591 }
42974592 }
....@@ -4320,10 +4615,9 @@
43204615 sas_target_priv_data =
43214616 raid_device->starget->hostdata;
43224617 sas_target_priv_data->deleted = 1;
4323
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4324
- "setting delete flag: handle(0x%04x), "
4325
- "wwid(0x%016llx)\n", ioc->name, handle,
4326
- (unsigned long long) raid_device->wwid));
4618
+ dewtprintk(ioc,
4619
+ ioc_info(ioc, "setting delete flag: handle(0x%04x), wwid(0x%016llx)\n",
4620
+ handle, (u64)raid_device->wwid));
43274621 }
43284622 spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
43294623 }
....@@ -4425,9 +4719,9 @@
44254719 INIT_LIST_HEAD(&delayed_tr->list);
44264720 delayed_tr->handle = handle;
44274721 list_add_tail(&delayed_tr->list, &ioc->delayed_tr_list);
4428
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
4429
- "DELAYED:tr:handle(0x%04x), (open)\n", ioc->name,
4430
- handle));
4722
+ dewtprintk(ioc,
4723
+ ioc_info(ioc, "DELAYED:tr:handle(0x%04x), (open)\n",
4724
+ handle));
44314725 } else
44324726 _scsih_tm_tr_send(ioc, handle);
44334727 }
....@@ -4469,16 +4763,28 @@
44694763 _scsih_temp_threshold_events(struct MPT3SAS_ADAPTER *ioc,
44704764 Mpi2EventDataTemperature_t *event_data)
44714765 {
4766
+ u32 doorbell;
44724767 if (ioc->temp_sensors_count >= event_data->SensorNum) {
4473
- pr_err(MPT3SAS_FMT "Temperature Threshold flags %s%s%s%s"
4474
- " exceeded for Sensor: %d !!!\n", ioc->name,
4475
- ((le16_to_cpu(event_data->Status) & 0x1) == 1) ? "0 " : " ",
4476
- ((le16_to_cpu(event_data->Status) & 0x2) == 2) ? "1 " : " ",
4477
- ((le16_to_cpu(event_data->Status) & 0x4) == 4) ? "2 " : " ",
4478
- ((le16_to_cpu(event_data->Status) & 0x8) == 8) ? "3 " : " ",
4479
- event_data->SensorNum);
4480
- pr_err(MPT3SAS_FMT "Current Temp In Celsius: %d\n",
4481
- ioc->name, event_data->CurrentTemperature);
4768
+ ioc_err(ioc, "Temperature Threshold flags %s%s%s%s exceeded for Sensor: %d !!!\n",
4769
+ le16_to_cpu(event_data->Status) & 0x1 ? "0 " : " ",
4770
+ le16_to_cpu(event_data->Status) & 0x2 ? "1 " : " ",
4771
+ le16_to_cpu(event_data->Status) & 0x4 ? "2 " : " ",
4772
+ le16_to_cpu(event_data->Status) & 0x8 ? "3 " : " ",
4773
+ event_data->SensorNum);
4774
+ ioc_err(ioc, "Current Temp In Celsius: %d\n",
4775
+ event_data->CurrentTemperature);
4776
+ if (ioc->hba_mpi_version_belonged != MPI2_VERSION) {
4777
+ doorbell = mpt3sas_base_get_iocstate(ioc, 0);
4778
+ if ((doorbell & MPI2_IOC_STATE_MASK) ==
4779
+ MPI2_IOC_STATE_FAULT) {
4780
+ mpt3sas_print_fault_code(ioc,
4781
+ doorbell & MPI2_DOORBELL_DATA_MASK);
4782
+ } else if ((doorbell & MPI2_IOC_STATE_MASK) ==
4783
+ MPI2_IOC_STATE_COREDUMP) {
4784
+ mpt3sas_print_coredump_info(ioc,
4785
+ doorbell & MPI2_DOORBELL_DATA_MASK);
4786
+ }
4787
+ }
44824788 }
44834789 }
44844790
....@@ -4526,8 +4832,7 @@
45264832 scmd->result = DID_RESET << 16;
45274833 scmd->scsi_done(scmd);
45284834 }
4529
- dtmprintk(ioc, pr_info(MPT3SAS_FMT "completing %d cmds\n",
4530
- ioc->name, count));
4835
+ dtmprintk(ioc, ioc_info(ioc, "completing %d cmds\n", count));
45314836 }
45324837
45334838 /**
....@@ -4694,11 +4999,8 @@
46944999 * since we're lockless at this point
46955000 */
46965001 do {
4697
- if (test_bit(0, &sas_device_priv_data->ata_command_pending)) {
4698
- scmd->result = SAM_STAT_BUSY;
4699
- scmd->scsi_done(scmd);
4700
- return 0;
4701
- }
5002
+ if (test_bit(0, &sas_device_priv_data->ata_command_pending))
5003
+ return SCSI_MLQUEUE_DEVICE_BUSY;
47025004 } while (_scsih_set_satl_pending(scmd, true));
47035005
47045006 if (scmd->sc_data_direction == DMA_FROM_DEVICE)
....@@ -4726,8 +5028,7 @@
47265028
47275029 smid = mpt3sas_base_get_smid_scsiio(ioc, ioc->scsi_io_cb_idx, scmd);
47285030 if (!smid) {
4729
- pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
4730
- ioc->name, __func__);
5031
+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
47315032 _scsih_set_satl_pending(scmd, false);
47325033 goto out;
47335034 }
....@@ -4775,12 +5076,12 @@
47755076 if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) {
47765077 mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len |
47775078 MPI25_SCSIIO_IOFLAGS_FAST_PATH);
4778
- mpt3sas_base_put_smid_fast_path(ioc, smid, handle);
5079
+ ioc->put_smid_fast_path(ioc, smid, handle);
47795080 } else
47805081 ioc->put_smid_scsi_io(ioc, smid,
47815082 le16_to_cpu(mpi_request->DevHandle));
47825083 } else
4783
- mpt3sas_base_put_smid_default(ioc, smid);
5084
+ ioc->put_smid_default(ioc, smid);
47845085 return 0;
47855086
47865087 out:
....@@ -4965,37 +5266,28 @@
49655266 scsi_print_command(scmd);
49665267
49675268 if (priv_target->flags & MPT_TARGET_FLAGS_VOLUME) {
4968
- pr_warn(MPT3SAS_FMT "\t%s wwid(0x%016llx)\n", ioc->name,
4969
- device_str, (unsigned long long)priv_target->sas_address);
5269
+ ioc_warn(ioc, "\t%s wwid(0x%016llx)\n",
5270
+ device_str, (u64)priv_target->sas_address);
49705271 } else if (priv_target->flags & MPT_TARGET_FLAGS_PCIE_DEVICE) {
49715272 pcie_device = mpt3sas_get_pdev_from_target(ioc, priv_target);
49725273 if (pcie_device) {
4973
- pr_info(MPT3SAS_FMT "\twwid(0x%016llx), port(%d)\n",
4974
- ioc->name,
4975
- (unsigned long long)pcie_device->wwid,
4976
- pcie_device->port_num);
5274
+ ioc_info(ioc, "\twwid(0x%016llx), port(%d)\n",
5275
+ (u64)pcie_device->wwid, pcie_device->port_num);
49775276 if (pcie_device->enclosure_handle != 0)
4978
- pr_info(MPT3SAS_FMT
4979
- "\tenclosure logical id(0x%016llx), "
4980
- "slot(%d)\n", ioc->name,
4981
- (unsigned long long)
4982
- pcie_device->enclosure_logical_id,
4983
- pcie_device->slot);
5277
+ ioc_info(ioc, "\tenclosure logical id(0x%016llx), slot(%d)\n",
5278
+ (u64)pcie_device->enclosure_logical_id,
5279
+ pcie_device->slot);
49845280 if (pcie_device->connector_name[0])
4985
- pr_info(MPT3SAS_FMT
4986
- "\tenclosure level(0x%04x),"
4987
- "connector name( %s)\n",
4988
- ioc->name, pcie_device->enclosure_level,
4989
- pcie_device->connector_name);
5281
+ ioc_info(ioc, "\tenclosure level(0x%04x), connector name( %s)\n",
5282
+ pcie_device->enclosure_level,
5283
+ pcie_device->connector_name);
49905284 pcie_device_put(pcie_device);
49915285 }
49925286 } else {
49935287 sas_device = mpt3sas_get_sdev_from_target(ioc, priv_target);
49945288 if (sas_device) {
4995
- pr_warn(MPT3SAS_FMT
4996
- "\tsas_address(0x%016llx), phy(%d)\n",
4997
- ioc->name, (unsigned long long)
4998
- sas_device->sas_address, sas_device->phy);
5289
+ ioc_warn(ioc, "\tsas_address(0x%016llx), phy(%d)\n",
5290
+ (u64)sas_device->sas_address, sas_device->phy);
49995291
50005292 _scsih_display_enclosure_chassis_info(ioc, sas_device,
50015293 NULL, NULL);
....@@ -5004,30 +5296,23 @@
50045296 }
50055297 }
50065298
5007
- pr_warn(MPT3SAS_FMT
5008
- "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n",
5009
- ioc->name, le16_to_cpu(mpi_reply->DevHandle),
5010
- desc_ioc_state, ioc_status, smid);
5011
- pr_warn(MPT3SAS_FMT
5012
- "\trequest_len(%d), underflow(%d), resid(%d)\n",
5013
- ioc->name, scsi_bufflen(scmd), scmd->underflow,
5014
- scsi_get_resid(scmd));
5015
- pr_warn(MPT3SAS_FMT
5016
- "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n",
5017
- ioc->name, le16_to_cpu(mpi_reply->TaskTag),
5018
- le32_to_cpu(mpi_reply->TransferCount), scmd->result);
5019
- pr_warn(MPT3SAS_FMT
5020
- "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n",
5021
- ioc->name, desc_scsi_status,
5022
- scsi_status, desc_scsi_state, scsi_state);
5299
+ ioc_warn(ioc, "\thandle(0x%04x), ioc_status(%s)(0x%04x), smid(%d)\n",
5300
+ le16_to_cpu(mpi_reply->DevHandle),
5301
+ desc_ioc_state, ioc_status, smid);
5302
+ ioc_warn(ioc, "\trequest_len(%d), underflow(%d), resid(%d)\n",
5303
+ scsi_bufflen(scmd), scmd->underflow, scsi_get_resid(scmd));
5304
+ ioc_warn(ioc, "\ttag(%d), transfer_count(%d), sc->result(0x%08x)\n",
5305
+ le16_to_cpu(mpi_reply->TaskTag),
5306
+ le32_to_cpu(mpi_reply->TransferCount), scmd->result);
5307
+ ioc_warn(ioc, "\tscsi_status(%s)(0x%02x), scsi_state(%s)(0x%02x)\n",
5308
+ desc_scsi_status, scsi_status, desc_scsi_state, scsi_state);
50235309
50245310 if (scsi_state & MPI2_SCSI_STATE_AUTOSENSE_VALID) {
50255311 struct sense_info data;
50265312 _scsih_normalize_sense(scmd->sense_buffer, &data);
5027
- pr_warn(MPT3SAS_FMT
5028
- "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n",
5029
- ioc->name, data.skey,
5030
- data.asc, data.ascq, le32_to_cpu(mpi_reply->SenseCount));
5313
+ ioc_warn(ioc, "\t[sense_key,asc,ascq]: [0x%02x,0x%02x,0x%02x], count(%d)\n",
5314
+ data.skey, data.asc, data.ascq,
5315
+ le32_to_cpu(mpi_reply->SenseCount));
50315316 }
50325317 if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) {
50335318 response_info = le32_to_cpu(mpi_reply->ResponseInfo);
....@@ -5062,17 +5347,17 @@
50625347 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_DEVHANDLE_ADDRESS;
50635348 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
50645349 &mpi_request)) != 0) {
5065
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
5066
- __FILE__, __LINE__, __func__);
5350
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5351
+ __FILE__, __LINE__, __func__);
50675352 goto out;
50685353 }
50695354 sas_device->pfa_led_on = 1;
50705355
50715356 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
5072
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
5073
- "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5074
- ioc->name, le16_to_cpu(mpi_reply.IOCStatus),
5075
- le32_to_cpu(mpi_reply.IOCLogInfo)));
5357
+ dewtprintk(ioc,
5358
+ ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5359
+ le16_to_cpu(mpi_reply.IOCStatus),
5360
+ le32_to_cpu(mpi_reply.IOCLogInfo)));
50765361 goto out;
50775362 }
50785363 out:
....@@ -5102,16 +5387,16 @@
51025387 mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS;
51035388 if ((mpt3sas_base_scsi_enclosure_processor(ioc, &mpi_reply,
51045389 &mpi_request)) != 0) {
5105
- printk(MPT3SAS_FMT "failure at %s:%d/%s()!\n", ioc->name,
5106
- __FILE__, __LINE__, __func__);
5390
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5391
+ __FILE__, __LINE__, __func__);
51075392 return;
51085393 }
51095394
51105395 if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) {
5111
- dewtprintk(ioc, printk(MPT3SAS_FMT
5112
- "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5113
- ioc->name, le16_to_cpu(mpi_reply.IOCStatus),
5114
- le32_to_cpu(mpi_reply.IOCLogInfo)));
5396
+ dewtprintk(ioc,
5397
+ ioc_info(ioc, "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n",
5398
+ le16_to_cpu(mpi_reply.IOCStatus),
5399
+ le32_to_cpu(mpi_reply.IOCLogInfo)));
51155400 return;
51165401 }
51175402 }
....@@ -5177,10 +5462,10 @@
51775462 /* insert into event log */
51785463 sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
51795464 sizeof(Mpi2EventDataSasDeviceStatusChange_t);
5180
- event_reply = kzalloc(sz, GFP_KERNEL);
5465
+ event_reply = kzalloc(sz, GFP_ATOMIC);
51815466 if (!event_reply) {
5182
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5183
- ioc->name, __FILE__, __LINE__, __func__);
5467
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5468
+ __FILE__, __LINE__, __func__);
51845469 goto out;
51855470 }
51865471
....@@ -5267,6 +5552,7 @@
52675552 ((ioc_status & MPI2_IOCSTATUS_MASK)
52685553 != MPI2_IOCSTATUS_SCSI_TASK_TERMINATED)) {
52695554 st->direct_io = 0;
5555
+ st->scmd = scmd;
52705556 memcpy(mpi_request->CDB.CDB32, scmd->cmnd, scmd->cmd_len);
52715557 mpi_request->DevHandle =
52725558 cpu_to_le16(sas_device_priv_data->sas_target->handle);
....@@ -5405,7 +5691,7 @@
54055691
54065692 case MPI2_IOCSTATUS_SCSI_DATA_OVERRUN:
54075693 scsi_set_resid(scmd, 0);
5408
- /* fall through */
5694
+ fallthrough;
54095695 case MPI2_IOCSTATUS_SCSI_RECOVERED_ERROR:
54105696 case MPI2_IOCSTATUS_SUCCESS:
54115697 scmd->result = (DID_OK << 16) | scsi_status;
....@@ -5470,16 +5756,16 @@
54705756 u16 attached_handle;
54715757 u8 link_rate;
54725758
5473
- dtmprintk(ioc, pr_info(MPT3SAS_FMT
5474
- "updating handles for sas_host(0x%016llx)\n",
5475
- ioc->name, (unsigned long long)ioc->sas_hba.sas_address));
5759
+ dtmprintk(ioc,
5760
+ ioc_info(ioc, "updating handles for sas_host(0x%016llx)\n",
5761
+ (u64)ioc->sas_hba.sas_address));
54765762
54775763 sz = offsetof(Mpi2SasIOUnitPage0_t, PhyData) + (ioc->sas_hba.num_phys
54785764 * sizeof(Mpi2SasIOUnit0PhyData_t));
54795765 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
54805766 if (!sas_iounit_pg0) {
5481
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5482
- ioc->name, __FILE__, __LINE__, __func__);
5767
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5768
+ __FILE__, __LINE__, __func__);
54835769 return;
54845770 }
54855771
....@@ -5529,15 +5815,15 @@
55295815
55305816 mpt3sas_config_get_number_hba_phys(ioc, &num_phys);
55315817 if (!num_phys) {
5532
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5533
- ioc->name, __FILE__, __LINE__, __func__);
5818
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5819
+ __FILE__, __LINE__, __func__);
55345820 return;
55355821 }
55365822 ioc->sas_hba.phy = kcalloc(num_phys,
55375823 sizeof(struct _sas_phy), GFP_KERNEL);
55385824 if (!ioc->sas_hba.phy) {
5539
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5540
- ioc->name, __FILE__, __LINE__, __func__);
5825
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5826
+ __FILE__, __LINE__, __func__);
55415827 goto out;
55425828 }
55435829 ioc->sas_hba.num_phys = num_phys;
....@@ -5547,21 +5833,21 @@
55475833 sizeof(Mpi2SasIOUnit0PhyData_t));
55485834 sas_iounit_pg0 = kzalloc(sz, GFP_KERNEL);
55495835 if (!sas_iounit_pg0) {
5550
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5551
- ioc->name, __FILE__, __LINE__, __func__);
5836
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5837
+ __FILE__, __LINE__, __func__);
55525838 return;
55535839 }
55545840 if ((mpt3sas_config_get_sas_iounit_pg0(ioc, &mpi_reply,
55555841 sas_iounit_pg0, sz))) {
5556
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5557
- ioc->name, __FILE__, __LINE__, __func__);
5842
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5843
+ __FILE__, __LINE__, __func__);
55585844 goto out;
55595845 }
55605846 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
55615847 MPI2_IOCSTATUS_MASK;
55625848 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5563
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5564
- ioc->name, __FILE__, __LINE__, __func__);
5849
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5850
+ __FILE__, __LINE__, __func__);
55655851 goto out;
55665852 }
55675853
....@@ -5570,21 +5856,21 @@
55705856 sizeof(Mpi2SasIOUnit1PhyData_t));
55715857 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
55725858 if (!sas_iounit_pg1) {
5573
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5574
- ioc->name, __FILE__, __LINE__, __func__);
5859
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5860
+ __FILE__, __LINE__, __func__);
55755861 goto out;
55765862 }
55775863 if ((mpt3sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
55785864 sas_iounit_pg1, sz))) {
5579
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5580
- ioc->name, __FILE__, __LINE__, __func__);
5865
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5866
+ __FILE__, __LINE__, __func__);
55815867 goto out;
55825868 }
55835869 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
55845870 MPI2_IOCSTATUS_MASK;
55855871 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5586
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5587
- ioc->name, __FILE__, __LINE__, __func__);
5872
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5873
+ __FILE__, __LINE__, __func__);
55885874 goto out;
55895875 }
55905876
....@@ -5603,15 +5889,15 @@
56035889 for (i = 0; i < ioc->sas_hba.num_phys ; i++) {
56045890 if ((mpt3sas_config_get_phy_pg0(ioc, &mpi_reply, &phy_pg0,
56055891 i))) {
5606
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5607
- ioc->name, __FILE__, __LINE__, __func__);
5892
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5893
+ __FILE__, __LINE__, __func__);
56085894 goto out;
56095895 }
56105896 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
56115897 MPI2_IOCSTATUS_MASK;
56125898 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5613
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5614
- ioc->name, __FILE__, __LINE__, __func__);
5899
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5900
+ __FILE__, __LINE__, __func__);
56155901 goto out;
56165902 }
56175903
....@@ -5625,18 +5911,17 @@
56255911 }
56265912 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
56275913 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, ioc->sas_hba.handle))) {
5628
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5629
- ioc->name, __FILE__, __LINE__, __func__);
5914
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5915
+ __FILE__, __LINE__, __func__);
56305916 goto out;
56315917 }
56325918 ioc->sas_hba.enclosure_handle =
56335919 le16_to_cpu(sas_device_pg0.EnclosureHandle);
56345920 ioc->sas_hba.sas_address = le64_to_cpu(sas_device_pg0.SASAddress);
5635
- pr_info(MPT3SAS_FMT
5636
- "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
5637
- ioc->name, ioc->sas_hba.handle,
5638
- (unsigned long long) ioc->sas_hba.sas_address,
5639
- ioc->sas_hba.num_phys) ;
5921
+ ioc_info(ioc, "host_add: handle(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
5922
+ ioc->sas_hba.handle,
5923
+ (u64)ioc->sas_hba.sas_address,
5924
+ ioc->sas_hba.num_phys);
56405925
56415926 if (ioc->sas_hba.enclosure_handle) {
56425927 if (!(mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply,
....@@ -5685,16 +5970,16 @@
56855970
56865971 if ((mpt3sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0,
56875972 MPI2_SAS_EXPAND_PGAD_FORM_HNDL, handle))) {
5688
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5689
- ioc->name, __FILE__, __LINE__, __func__);
5973
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5974
+ __FILE__, __LINE__, __func__);
56905975 return -1;
56915976 }
56925977
56935978 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
56945979 MPI2_IOCSTATUS_MASK;
56955980 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
5696
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5697
- ioc->name, __FILE__, __LINE__, __func__);
5981
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5982
+ __FILE__, __LINE__, __func__);
56985983 return -1;
56995984 }
57005985
....@@ -5702,8 +5987,8 @@
57025987 parent_handle = le16_to_cpu(expander_pg0.ParentDevHandle);
57035988 if (_scsih_get_sas_address(ioc, parent_handle, &sas_address_parent)
57045989 != 0) {
5705
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5706
- ioc->name, __FILE__, __LINE__, __func__);
5990
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
5991
+ __FILE__, __LINE__, __func__);
57075992 return -1;
57085993 }
57095994 if (sas_address_parent != ioc->sas_hba.sas_address) {
....@@ -5730,8 +6015,8 @@
57306015 sas_expander = kzalloc(sizeof(struct _sas_node),
57316016 GFP_KERNEL);
57326017 if (!sas_expander) {
5733
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5734
- ioc->name, __FILE__, __LINE__, __func__);
6018
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6019
+ __FILE__, __LINE__, __func__);
57356020 return -1;
57366021 }
57376022
....@@ -5740,10 +6025,9 @@
57406025 sas_expander->sas_address_parent = sas_address_parent;
57416026 sas_expander->sas_address = sas_address;
57426027
5743
- pr_info(MPT3SAS_FMT "expander_add: handle(0x%04x)," \
5744
- " parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n", ioc->name,
5745
- handle, parent_handle, (unsigned long long)
5746
- sas_expander->sas_address, sas_expander->num_phys);
6028
+ ioc_info(ioc, "expander_add: handle(0x%04x), parent(0x%04x), sas_addr(0x%016llx), phys(%d)\n",
6029
+ handle, parent_handle,
6030
+ (u64)sas_expander->sas_address, sas_expander->num_phys);
57476031
57486032 if (!sas_expander->num_phys) {
57496033 rc = -1;
....@@ -5752,8 +6036,8 @@
57526036 sas_expander->phy = kcalloc(sas_expander->num_phys,
57536037 sizeof(struct _sas_phy), GFP_KERNEL);
57546038 if (!sas_expander->phy) {
5755
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5756
- ioc->name, __FILE__, __LINE__, __func__);
6039
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6040
+ __FILE__, __LINE__, __func__);
57576041 rc = -1;
57586042 goto out_fail;
57596043 }
....@@ -5762,8 +6046,8 @@
57626046 mpt3sas_port = mpt3sas_transport_port_add(ioc, handle,
57636047 sas_address_parent);
57646048 if (!mpt3sas_port) {
5765
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5766
- ioc->name, __FILE__, __LINE__, __func__);
6049
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6050
+ __FILE__, __LINE__, __func__);
57676051 rc = -1;
57686052 goto out_fail;
57696053 }
....@@ -5772,8 +6056,8 @@
57726056 for (i = 0 ; i < sas_expander->num_phys ; i++) {
57736057 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,
57746058 &expander_pg1, i, handle))) {
5775
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5776
- ioc->name, __FILE__, __LINE__, __func__);
6059
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6060
+ __FILE__, __LINE__, __func__);
57776061 rc = -1;
57786062 goto out_fail;
57796063 }
....@@ -5783,8 +6067,8 @@
57836067 if ((mpt3sas_transport_add_expander_phy(ioc,
57846068 &sas_expander->phy[i], expander_pg1,
57856069 sas_expander->parent_dev))) {
5786
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
5787
- ioc->name, __FILE__, __LINE__, __func__);
6070
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6071
+ __FILE__, __LINE__, __func__);
57886072 rc = -1;
57896073 goto out_fail;
57906074 }
....@@ -5931,9 +6215,8 @@
59316215 if (!rc)
59326216 return 0;
59336217
5934
- pr_err(MPT3SAS_FMT
5935
- "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n",
5936
- ioc->name, desc, (unsigned long long)sas_address, handle);
6218
+ ioc_err(ioc, "discovery errors(%s): sas_address(0x%016llx), handle(0x%04x)\n",
6219
+ desc, (u64)sas_address, handle);
59376220 return rc;
59386221 }
59396222
....@@ -6027,9 +6310,8 @@
60276310 /* check if device is present */
60286311 if (!(le16_to_cpu(sas_device_pg0.Flags) &
60296312 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {
6030
- pr_err(MPT3SAS_FMT
6031
- "device is not present handle(0x%04x), flags!!!\n",
6032
- ioc->name, handle);
6313
+ ioc_err(ioc, "device is not present handle(0x%04x), flags!!!\n",
6314
+ handle);
60336315 goto out_unlock;
60346316 }
60356317
....@@ -6076,16 +6358,16 @@
60766358
60776359 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
60786360 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
6079
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6080
- ioc->name, __FILE__, __LINE__, __func__);
6361
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6362
+ __FILE__, __LINE__, __func__);
60816363 return -1;
60826364 }
60836365
60846366 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
60856367 MPI2_IOCSTATUS_MASK;
60866368 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6087
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6088
- ioc->name, __FILE__, __LINE__, __func__);
6369
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6370
+ __FILE__, __LINE__, __func__);
60896371 return -1;
60906372 }
60916373
....@@ -6099,8 +6381,8 @@
60996381 /* check if device is present */
61006382 if (!(le16_to_cpu(sas_device_pg0.Flags) &
61016383 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) {
6102
- pr_err(MPT3SAS_FMT "device is not present handle(0x04%x)!!!\n",
6103
- ioc->name, handle);
6384
+ ioc_err(ioc, "device is not present handle(0x04%x)!!!\n",
6385
+ handle);
61046386 return -1;
61056387 }
61066388
....@@ -6122,16 +6404,15 @@
61226404 mpt3sas_scsih_enclosure_find_by_handle(ioc,
61236405 le16_to_cpu(sas_device_pg0.EnclosureHandle));
61246406 if (enclosure_dev == NULL)
6125
- pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)"
6126
- "doesn't match with enclosure device!\n",
6127
- ioc->name, sas_device_pg0.EnclosureHandle);
6407
+ ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n",
6408
+ sas_device_pg0.EnclosureHandle);
61286409 }
61296410
61306411 sas_device = kzalloc(sizeof(struct _sas_device),
61316412 GFP_KERNEL);
61326413 if (!sas_device) {
6133
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6134
- ioc->name, __FILE__, __LINE__, __func__);
6414
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6415
+ __FILE__, __LINE__, __func__);
61356416 return 0;
61366417 }
61376418
....@@ -6140,8 +6421,8 @@
61406421 if (_scsih_get_sas_address(ioc,
61416422 le16_to_cpu(sas_device_pg0.ParentDevHandle),
61426423 &sas_device->sas_address_parent) != 0)
6143
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6144
- ioc->name, __FILE__, __LINE__, __func__);
6424
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
6425
+ __FILE__, __LINE__, __func__);
61456426 sas_device->enclosure_handle =
61466427 le16_to_cpu(sas_device_pg0.EnclosureHandle);
61476428 if (sas_device->enclosure_handle != 0)
....@@ -6206,11 +6487,10 @@
62066487 sas_device->pfa_led_on = 0;
62076488 }
62086489
6209
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6210
- "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n",
6211
- ioc->name, __func__,
6212
- sas_device->handle, (unsigned long long)
6213
- sas_device->sas_address));
6490
+ dewtprintk(ioc,
6491
+ ioc_info(ioc, "%s: enter: handle(0x%04x), sas_addr(0x%016llx)\n",
6492
+ __func__,
6493
+ sas_device->handle, (u64)sas_device->sas_address));
62146494
62156495 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
62166496 NULL, NULL));
....@@ -6228,18 +6508,15 @@
62286508 sas_device->sas_address,
62296509 sas_device->sas_address_parent);
62306510
6231
- pr_info(MPT3SAS_FMT
6232
- "removing handle(0x%04x), sas_addr(0x%016llx)\n",
6233
- ioc->name, sas_device->handle,
6234
- (unsigned long long) sas_device->sas_address);
6511
+ ioc_info(ioc, "removing handle(0x%04x), sas_addr(0x%016llx)\n",
6512
+ sas_device->handle, (u64)sas_device->sas_address);
62356513
62366514 _scsih_display_enclosure_chassis_info(ioc, sas_device, NULL, NULL);
62376515
6238
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6239
- "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n",
6240
- ioc->name, __func__,
6241
- sas_device->handle, (unsigned long long)
6242
- sas_device->sas_address));
6516
+ dewtprintk(ioc,
6517
+ ioc_info(ioc, "%s: exit: handle(0x%04x), sas_addr(0x%016llx)\n",
6518
+ __func__,
6519
+ sas_device->handle, (u64)sas_device->sas_address));
62436520 dewtprintk(ioc, _scsih_display_enclosure_chassis_info(ioc, sas_device,
62446521 NULL, NULL));
62456522 }
....@@ -6279,8 +6556,7 @@
62796556 status_str = "unknown status";
62806557 break;
62816558 }
6282
- pr_info(MPT3SAS_FMT "sas topology change: (%s)\n",
6283
- ioc->name, status_str);
6559
+ ioc_info(ioc, "sas topology change: (%s)\n", status_str);
62846560 pr_info("\thandle(0x%04x), enclosure_handle(0x%04x) " \
62856561 "start_phy(%02d), count(%d)\n",
62866562 le16_to_cpu(event_data->ExpanderDevHandle),
....@@ -6357,8 +6633,7 @@
63576633 _scsih_sas_host_refresh(ioc);
63586634
63596635 if (fw_event->ignore) {
6360
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6361
- "ignoring expander event\n", ioc->name));
6636
+ dewtprintk(ioc, ioc_info(ioc, "ignoring expander event\n"));
63626637 return 0;
63636638 }
63646639
....@@ -6387,8 +6662,8 @@
63876662 /* handle siblings events */
63886663 for (i = 0; i < event_data->NumEntries; i++) {
63896664 if (fw_event->ignore) {
6390
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6391
- "ignoring expander event\n", ioc->name));
6665
+ dewtprintk(ioc,
6666
+ ioc_info(ioc, "ignoring expander event\n"));
63926667 return 0;
63936668 }
63946669 if (ioc->remove_host || ioc->pci_error_recovery)
....@@ -6428,7 +6703,7 @@
64286703 if (!test_bit(handle, ioc->pend_os_device_add))
64296704 break;
64306705
6431
- /* fall through */
6706
+ fallthrough;
64326707
64336708 case MPI2_EVENT_SAS_TOPO_RC_TARG_ADDED:
64346709
....@@ -6512,38 +6787,30 @@
65126787 reason_str = "unknown reason";
65136788 break;
65146789 }
6515
- pr_info(MPT3SAS_FMT "device status change: (%s)\n"
6516
- "\thandle(0x%04x), sas address(0x%016llx), tag(%d)",
6517
- ioc->name, reason_str, le16_to_cpu(event_data->DevHandle),
6518
- (unsigned long long)le64_to_cpu(event_data->SASAddress),
6519
- le16_to_cpu(event_data->TaskTag));
6790
+ ioc_info(ioc, "device status change: (%s)\thandle(0x%04x), sas address(0x%016llx), tag(%d)",
6791
+ reason_str, le16_to_cpu(event_data->DevHandle),
6792
+ (u64)le64_to_cpu(event_data->SASAddress),
6793
+ le16_to_cpu(event_data->TaskTag));
65206794 if (event_data->ReasonCode == MPI2_EVENT_SAS_DEV_STAT_RC_SMART_DATA)
6521
- pr_info(MPT3SAS_FMT ", ASC(0x%x), ASCQ(0x%x)\n", ioc->name,
6522
- event_data->ASC, event_data->ASCQ);
6523
- pr_info("\n");
6795
+ pr_cont(", ASC(0x%x), ASCQ(0x%x)\n",
6796
+ event_data->ASC, event_data->ASCQ);
6797
+ pr_cont("\n");
65246798 }
65256799
65266800 /**
65276801 * _scsih_sas_device_status_change_event - handle device status change
65286802 * @ioc: per adapter object
6529
- * @fw_event: The fw_event_work object
6803
+ * @event_data: The fw event
65306804 * Context: user.
65316805 */
65326806 static void
65336807 _scsih_sas_device_status_change_event(struct MPT3SAS_ADAPTER *ioc,
6534
- struct fw_event_work *fw_event)
6808
+ Mpi2EventDataSasDeviceStatusChange_t *event_data)
65356809 {
65366810 struct MPT3SAS_TARGET *target_priv_data;
65376811 struct _sas_device *sas_device;
65386812 u64 sas_address;
65396813 unsigned long flags;
6540
- Mpi2EventDataSasDeviceStatusChange_t *event_data =
6541
- (Mpi2EventDataSasDeviceStatusChange_t *)
6542
- fw_event->event_data;
6543
-
6544
- if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
6545
- _scsih_sas_device_status_change_event_debug(ioc,
6546
- event_data);
65476814
65486815 /* In MPI Revision K (0xC), the internal device reset complete was
65496816 * implemented, so avoid setting tm_busy flag for older firmware.
....@@ -6574,6 +6841,12 @@
65746841 target_priv_data->tm_busy = 1;
65756842 else
65766843 target_priv_data->tm_busy = 0;
6844
+
6845
+ if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
6846
+ ioc_info(ioc,
6847
+ "%s tm_busy flag for handle(0x%04x)\n",
6848
+ (target_priv_data->tm_busy == 1) ? "Enable" : "Disable",
6849
+ target_priv_data->handle);
65776850
65786851 out:
65796852 if (sas_device)
....@@ -6609,6 +6882,11 @@
66096882 break;
66106883 case MPI26_PCIEDEV0_ASTATUS_DEVICE_BLOCKED:
66116884 desc = "PCIe device blocked";
6885
+ ioc_info(ioc,
6886
+ "Device with Access Status (%s): wwid(0x%016llx), "
6887
+ "handle(0x%04x)\n ll only be added to the internal list",
6888
+ desc, (u64)wwid, handle);
6889
+ rc = 0;
66126890 break;
66136891 case MPI26_PCIEDEV0_ASTATUS_MEMORY_SPACE_ACCESS_FAILED:
66146892 desc = "PCIe device mem space access failed";
....@@ -6653,20 +6931,16 @@
66536931 desc = "nvme failure status";
66546932 break;
66556933 default:
6656
- pr_err(MPT3SAS_FMT
6657
- " NVMe discovery error(0x%02x): wwid(0x%016llx),"
6658
- "handle(0x%04x)\n", ioc->name, access_status,
6659
- (unsigned long long)wwid, handle);
6934
+ ioc_err(ioc, "NVMe discovery error(0x%02x): wwid(0x%016llx), handle(0x%04x)\n",
6935
+ access_status, (u64)wwid, handle);
66606936 return rc;
66616937 }
66626938
66636939 if (!rc)
66646940 return rc;
66656941
6666
- pr_info(MPT3SAS_FMT
6667
- "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n",
6668
- ioc->name, desc,
6669
- (unsigned long long)wwid, handle);
6942
+ ioc_info(ioc, "NVMe discovery error(%s): wwid(0x%016llx), handle(0x%04x)\n",
6943
+ desc, (u64)wwid, handle);
66706944 return rc;
66716945 }
66726946
....@@ -6682,22 +6956,22 @@
66826956 {
66836957 struct MPT3SAS_TARGET *sas_target_priv_data;
66846958
6685
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6686
- "%s: enter: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
6687
- pcie_device->handle, (unsigned long long)
6688
- pcie_device->wwid));
6959
+ dewtprintk(ioc,
6960
+ ioc_info(ioc, "%s: enter: handle(0x%04x), wwid(0x%016llx)\n",
6961
+ __func__,
6962
+ pcie_device->handle, (u64)pcie_device->wwid));
66896963 if (pcie_device->enclosure_handle != 0)
6690
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6691
- "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n",
6692
- ioc->name, __func__,
6693
- (unsigned long long)pcie_device->enclosure_logical_id,
6694
- pcie_device->slot));
6964
+ dewtprintk(ioc,
6965
+ ioc_info(ioc, "%s: enter: enclosure logical id(0x%016llx), slot(%d)\n",
6966
+ __func__,
6967
+ (u64)pcie_device->enclosure_logical_id,
6968
+ pcie_device->slot));
66956969 if (pcie_device->connector_name[0] != '\0')
6696
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6697
- "%s: enter: enclosure level(0x%04x), connector name( %s)\n",
6698
- ioc->name, __func__,
6699
- pcie_device->enclosure_level,
6700
- pcie_device->connector_name));
6970
+ dewtprintk(ioc,
6971
+ ioc_info(ioc, "%s: enter: enclosure level(0x%04x), connector name(%s)\n",
6972
+ __func__,
6973
+ pcie_device->enclosure_level,
6974
+ pcie_device->connector_name));
67016975
67026976 if (pcie_device->starget && pcie_device->starget->hostdata) {
67036977 sas_target_priv_data = pcie_device->starget->hostdata;
....@@ -6706,39 +6980,36 @@
67066980 sas_target_priv_data->handle = MPT3SAS_INVALID_DEVICE_HANDLE;
67076981 }
67086982
6709
- pr_info(MPT3SAS_FMT
6710
- "removing handle(0x%04x), wwid (0x%016llx)\n",
6711
- ioc->name, pcie_device->handle,
6712
- (unsigned long long) pcie_device->wwid);
6983
+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
6984
+ pcie_device->handle, (u64)pcie_device->wwid);
67136985 if (pcie_device->enclosure_handle != 0)
6714
- pr_info(MPT3SAS_FMT
6715
- "removing : enclosure logical id(0x%016llx), slot(%d)\n",
6716
- ioc->name,
6717
- (unsigned long long)pcie_device->enclosure_logical_id,
6718
- pcie_device->slot);
6986
+ ioc_info(ioc, "removing : enclosure logical id(0x%016llx), slot(%d)\n",
6987
+ (u64)pcie_device->enclosure_logical_id,
6988
+ pcie_device->slot);
67196989 if (pcie_device->connector_name[0] != '\0')
6720
- pr_info(MPT3SAS_FMT
6721
- "removing: enclosure level(0x%04x), connector name( %s)\n",
6722
- ioc->name, pcie_device->enclosure_level,
6723
- pcie_device->connector_name);
6990
+ ioc_info(ioc, "removing: enclosure level(0x%04x), connector name( %s)\n",
6991
+ pcie_device->enclosure_level,
6992
+ pcie_device->connector_name);
67246993
6725
- if (pcie_device->starget)
6994
+ if (pcie_device->starget && (pcie_device->access_status !=
6995
+ MPI26_PCIEDEV0_ASTATUS_DEVICE_BLOCKED))
67266996 scsi_remove_target(&pcie_device->starget->dev);
6727
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6728
- "%s: exit: handle(0x%04x), wwid(0x%016llx)\n", ioc->name, __func__,
6729
- pcie_device->handle, (unsigned long long)
6730
- pcie_device->wwid));
6997
+ dewtprintk(ioc,
6998
+ ioc_info(ioc, "%s: exit: handle(0x%04x), wwid(0x%016llx)\n",
6999
+ __func__,
7000
+ pcie_device->handle, (u64)pcie_device->wwid));
67317001 if (pcie_device->enclosure_handle != 0)
6732
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6733
- "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n",
6734
- ioc->name, __func__,
6735
- (unsigned long long)pcie_device->enclosure_logical_id,
6736
- pcie_device->slot));
7002
+ dewtprintk(ioc,
7003
+ ioc_info(ioc, "%s: exit: enclosure logical id(0x%016llx), slot(%d)\n",
7004
+ __func__,
7005
+ (u64)pcie_device->enclosure_logical_id,
7006
+ pcie_device->slot));
67377007 if (pcie_device->connector_name[0] != '\0')
6738
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
6739
- "%s: exit: enclosure level(0x%04x), connector name( %s)\n",
6740
- ioc->name, __func__, pcie_device->enclosure_level,
6741
- pcie_device->connector_name));
7008
+ dewtprintk(ioc,
7009
+ ioc_info(ioc, "%s: exit: enclosure level(0x%04x), connector name( %s)\n",
7010
+ __func__,
7011
+ pcie_device->enclosure_level,
7012
+ pcie_device->connector_name));
67427013
67437014 kfree(pcie_device->serial_number);
67447015 }
....@@ -6772,7 +7043,7 @@
67727043
67737044 /* check if this is end device */
67747045 device_info = le32_to_cpu(pcie_device_pg0.DeviceInfo);
6775
- if (!(_scsih_is_nvme_device(device_info)))
7046
+ if (!(_scsih_is_nvme_pciescsi_device(device_info)))
67767047 return;
67777048
67787049 wwid = le64_to_cpu(pcie_device_pg0.WWID);
....@@ -6787,6 +7058,7 @@
67877058 if (unlikely(pcie_device->handle != handle)) {
67887059 starget = pcie_device->starget;
67897060 sas_target_priv_data = starget->hostdata;
7061
+ pcie_device->access_status = pcie_device_pg0.AccessStatus;
67907062 starget_printk(KERN_INFO, starget,
67917063 "handle changed from(0x%04x) to (0x%04x)!!!\n",
67927064 pcie_device->handle, handle);
....@@ -6808,9 +7080,8 @@
68087080 /* check if device is present */
68097081 if (!(le32_to_cpu(pcie_device_pg0.Flags) &
68107082 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {
6811
- pr_info(MPT3SAS_FMT
6812
- "device is not present handle(0x%04x), flags!!!\n",
6813
- ioc->name, handle);
7083
+ ioc_info(ioc, "device is not present handle(0x%04x), flags!!!\n",
7084
+ handle);
68147085 spin_unlock_irqrestore(&ioc->pcie_device_lock, flags);
68157086 pcie_device_put(pcie_device);
68167087 return;
....@@ -6854,16 +7125,15 @@
68547125
68557126 if ((mpt3sas_config_get_pcie_device_pg0(ioc, &mpi_reply,
68567127 &pcie_device_pg0, MPI26_PCIE_DEVICE_PGAD_FORM_HANDLE, handle))) {
6857
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6858
- ioc->name, __FILE__, __LINE__, __func__);
7128
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
7129
+ __FILE__, __LINE__, __func__);
68597130 return 0;
68607131 }
68617132 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
68627133 MPI2_IOCSTATUS_MASK;
68637134 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6864
- pr_err(MPT3SAS_FMT
6865
- "failure at %s:%d/%s()!\n",
6866
- ioc->name, __FILE__, __LINE__, __func__);
7135
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
7136
+ __FILE__, __LINE__, __func__);
68677137 return 0;
68687138 }
68697139
....@@ -6873,9 +7143,8 @@
68737143 /* check if device is present */
68747144 if (!(le32_to_cpu(pcie_device_pg0.Flags) &
68757145 MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT)) {
6876
- pr_err(MPT3SAS_FMT
6877
- "device is not present handle(0x04%x)!!!\n",
6878
- ioc->name, handle);
7146
+ ioc_err(ioc, "device is not present handle(0x04%x)!!!\n",
7147
+ handle);
68797148 return 0;
68807149 }
68817150
....@@ -6884,7 +7153,8 @@
68847153 pcie_device_pg0.AccessStatus))
68857154 return 0;
68867155
6887
- if (!(_scsih_is_nvme_device(le32_to_cpu(pcie_device_pg0.DeviceInfo))))
7156
+ if (!(_scsih_is_nvme_pciescsi_device(le32_to_cpu
7157
+ (pcie_device_pg0.DeviceInfo))))
68887158 return 0;
68897159
68907160 pcie_device = mpt3sas_get_pdev_by_wwid(ioc, wwid);
....@@ -6894,10 +7164,35 @@
68947164 return 0;
68957165 }
68967166
7167
+ /* PCIe Device Page 2 contains read-only information about a
7168
+ * specific NVMe device; therefore, this page is only
7169
+ * valid for NVMe devices and skip for pcie devices of type scsi.
7170
+ */
7171
+ if (!(mpt3sas_scsih_is_pcie_scsi_device(
7172
+ le32_to_cpu(pcie_device_pg0.DeviceInfo)))) {
7173
+ if (mpt3sas_config_get_pcie_device_pg2(ioc, &mpi_reply,
7174
+ &pcie_device_pg2, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
7175
+ handle)) {
7176
+ ioc_err(ioc,
7177
+ "failure at %s:%d/%s()!\n", __FILE__,
7178
+ __LINE__, __func__);
7179
+ return 0;
7180
+ }
7181
+
7182
+ ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
7183
+ MPI2_IOCSTATUS_MASK;
7184
+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7185
+ ioc_err(ioc,
7186
+ "failure at %s:%d/%s()!\n", __FILE__,
7187
+ __LINE__, __func__);
7188
+ return 0;
7189
+ }
7190
+ }
7191
+
68977192 pcie_device = kzalloc(sizeof(struct _pcie_device), GFP_KERNEL);
68987193 if (!pcie_device) {
6899
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6900
- ioc->name, __FILE__, __LINE__, __func__);
7194
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
7195
+ __FILE__, __LINE__, __func__);
69017196 return 0;
69027197 }
69037198
....@@ -6905,6 +7200,7 @@
69057200 pcie_device->id = ioc->pcie_target_id++;
69067201 pcie_device->channel = PCIE_CHANNEL;
69077202 pcie_device->handle = handle;
7203
+ pcie_device->access_status = pcie_device_pg0.AccessStatus;
69087204 pcie_device->device_info = le32_to_cpu(pcie_device_pg0.DeviceInfo);
69097205 pcie_device->wwid = wwid;
69107206 pcie_device->port_num = pcie_device_pg0.PortNum;
....@@ -6936,27 +7232,26 @@
69367232 le64_to_cpu(enclosure_dev->pg0.EnclosureLogicalID);
69377233 }
69387234 /* TODO -- Add device name once FW supports it */
6939
- if (mpt3sas_config_get_pcie_device_pg2(ioc, &mpi_reply,
6940
- &pcie_device_pg2, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle)) {
6941
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6942
- ioc->name, __FILE__, __LINE__, __func__);
6943
- kfree(pcie_device);
6944
- return 0;
6945
- }
6946
-
6947
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK;
6948
- if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
6949
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
6950
- ioc->name, __FILE__, __LINE__, __func__);
6951
- kfree(pcie_device);
6952
- return 0;
6953
- }
6954
- pcie_device->nvme_mdts =
6955
- le32_to_cpu(pcie_device_pg2.MaximumDataTransferSize);
6956
- if (pcie_device_pg2.ControllerResetTO)
6957
- pcie_device->reset_timeout =
6958
- pcie_device_pg2.ControllerResetTO;
6959
- else
7235
+ if (!(mpt3sas_scsih_is_pcie_scsi_device(
7236
+ le32_to_cpu(pcie_device_pg0.DeviceInfo)))) {
7237
+ pcie_device->nvme_mdts =
7238
+ le32_to_cpu(pcie_device_pg2.MaximumDataTransferSize);
7239
+ pcie_device->shutdown_latency =
7240
+ le16_to_cpu(pcie_device_pg2.ShutdownLatency);
7241
+ /*
7242
+ * Set IOC's max_shutdown_latency to drive's RTD3 Entry Latency
7243
+ * if drive's RTD3 Entry Latency is greater then IOC's
7244
+ * max_shutdown_latency.
7245
+ */
7246
+ if (pcie_device->shutdown_latency > ioc->max_shutdown_latency)
7247
+ ioc->max_shutdown_latency =
7248
+ pcie_device->shutdown_latency;
7249
+ if (pcie_device_pg2.ControllerResetTO)
7250
+ pcie_device->reset_timeout =
7251
+ pcie_device_pg2.ControllerResetTO;
7252
+ else
7253
+ pcie_device->reset_timeout = 30;
7254
+ } else
69607255 pcie_device->reset_timeout = 30;
69617256
69627257 if (ioc->wait_for_discovery_to_complete)
....@@ -7004,8 +7299,7 @@
70047299 status_str = "unknown status";
70057300 break;
70067301 }
7007
- pr_info(MPT3SAS_FMT "pcie topology change: (%s)\n",
7008
- ioc->name, status_str);
7302
+ ioc_info(ioc, "pcie topology change: (%s)\n", status_str);
70097303 pr_info("\tswitch_handle(0x%04x), enclosure_handle(0x%04x)"
70107304 "start_port(%02d), count(%d)\n",
70117305 le16_to_cpu(event_data->SwitchDevHandle),
....@@ -7078,16 +7372,15 @@
70787372 return;
70797373
70807374 if (fw_event->ignore) {
7081
- dewtprintk(ioc, pr_info(MPT3SAS_FMT "ignoring switch event\n",
7082
- ioc->name));
7375
+ dewtprintk(ioc, ioc_info(ioc, "ignoring switch event\n"));
70837376 return;
70847377 }
70857378
70867379 /* handle siblings events */
70877380 for (i = 0; i < event_data->NumEntries; i++) {
70887381 if (fw_event->ignore) {
7089
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
7090
- "ignoring switch event\n", ioc->name));
7382
+ dewtprintk(ioc,
7383
+ ioc_info(ioc, "ignoring switch event\n"));
70917384 return;
70927385 }
70937386 if (ioc->remove_host || ioc->pci_error_recovery)
....@@ -7132,13 +7425,13 @@
71327425 if (!test_bit(handle, ioc->pend_os_device_add))
71337426 break;
71347427
7135
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
7136
- "handle(0x%04x) device not found: convert "
7137
- "event to a device add\n", ioc->name, handle));
7428
+ dewtprintk(ioc,
7429
+ ioc_info(ioc, "handle(0x%04x) device not found: convert event to a device add\n",
7430
+ handle));
71387431 event_data->PortEntry[i].PortStatus &= 0xF0;
71397432 event_data->PortEntry[i].PortStatus |=
71407433 MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED;
7141
- /* fall through */
7434
+ fallthrough;
71427435 case MPI26_EVENT_PCIE_TOPO_PS_DEV_ADDED:
71437436 if (ioc->shost_recovery)
71447437 break;
....@@ -7217,15 +7510,15 @@
72177510 break;
72187511 }
72197512
7220
- pr_info(MPT3SAS_FMT "PCIE device status change: (%s)\n"
7221
- "\thandle(0x%04x), WWID(0x%016llx), tag(%d)",
7222
- ioc->name, reason_str, le16_to_cpu(event_data->DevHandle),
7223
- (unsigned long long)le64_to_cpu(event_data->WWID),
7224
- le16_to_cpu(event_data->TaskTag));
7513
+ ioc_info(ioc, "PCIE device status change: (%s)\n"
7514
+ "\thandle(0x%04x), WWID(0x%016llx), tag(%d)",
7515
+ reason_str, le16_to_cpu(event_data->DevHandle),
7516
+ (u64)le64_to_cpu(event_data->WWID),
7517
+ le16_to_cpu(event_data->TaskTag));
72257518 if (event_data->ReasonCode == MPI26_EVENT_PCIDEV_STAT_RC_SMART_DATA)
7226
- pr_info(MPT3SAS_FMT ", ASC(0x%x), ASCQ(0x%x)\n", ioc->name,
7519
+ pr_cont(", ASC(0x%x), ASCQ(0x%x)\n",
72277520 event_data->ASC, event_data->ASCQ);
7228
- pr_info("\n");
7521
+ pr_cont("\n");
72297522 }
72307523
72317524 /**
....@@ -7303,12 +7596,12 @@
73037596 break;
73047597 }
73057598
7306
- pr_info(MPT3SAS_FMT "enclosure status change: (%s)\n"
7307
- "\thandle(0x%04x), enclosure logical id(0x%016llx)"
7308
- " number slots(%d)\n", ioc->name, reason_str,
7309
- le16_to_cpu(event_data->EnclosureHandle),
7310
- (unsigned long long)le64_to_cpu(event_data->EnclosureLogicalID),
7311
- le16_to_cpu(event_data->StartSlot));
7599
+ ioc_info(ioc, "enclosure status change: (%s)\n"
7600
+ "\thandle(0x%04x), enclosure logical id(0x%016llx) number slots(%d)\n",
7601
+ reason_str,
7602
+ le16_to_cpu(event_data->EnclosureHandle),
7603
+ (u64)le64_to_cpu(event_data->EnclosureLogicalID),
7604
+ le16_to_cpu(event_data->StartSlot));
73127605 }
73137606
73147607 /**
....@@ -7346,9 +7639,8 @@
73467639 kzalloc(sizeof(struct _enclosure_node),
73477640 GFP_KERNEL);
73487641 if (!enclosure_dev) {
7349
- pr_info(MPT3SAS_FMT
7350
- "failure at %s:%d/%s()!\n", ioc->name,
7351
- __FILE__, __LINE__, __func__);
7642
+ ioc_info(ioc, "failure at %s:%d/%s()!\n",
7643
+ __FILE__, __LINE__, __func__);
73527644 return;
73537645 }
73547646 rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply,
....@@ -7406,10 +7698,8 @@
74067698 u8 task_abort_retries;
74077699
74087700 mutex_lock(&ioc->tm_cmds.mutex);
7409
- pr_info(MPT3SAS_FMT
7410
- "%s: enter: phy number(%d), width(%d)\n",
7411
- ioc->name, __func__, event_data->PhyNum,
7412
- event_data->PortWidth);
7701
+ ioc_info(ioc, "%s: enter: phy number(%d), width(%d)\n",
7702
+ __func__, event_data->PhyNum, event_data->PortWidth);
74137703
74147704 _scsih_block_io_all_device(ioc);
74157705
....@@ -7419,12 +7709,12 @@
74197709
74207710 /* sanity checks for retrying this loop */
74217711 if (max_retries++ == 5) {
7422
- dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: giving up\n",
7423
- ioc->name, __func__));
7712
+ dewtprintk(ioc, ioc_info(ioc, "%s: giving up\n", __func__));
74247713 goto out;
74257714 } else if (max_retries > 1)
7426
- dewtprintk(ioc, pr_info(MPT3SAS_FMT "%s: %d retry\n",
7427
- ioc->name, __func__, max_retries - 1));
7715
+ dewtprintk(ioc,
7716
+ ioc_info(ioc, "%s: %d retry\n",
7717
+ __func__, max_retries - 1));
74287718
74297719 termination_count = 0;
74307720 query_count = 0;
....@@ -7460,7 +7750,7 @@
74607750 goto out;
74617751
74627752 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
7463
- r = mpt3sas_scsih_issue_tm(ioc, handle, lun,
7753
+ r = mpt3sas_scsih_issue_tm(ioc, handle, 0, 0, lun,
74647754 MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK, st->smid,
74657755 st->msix_io, 30, 0);
74667756 if (r == FAILED) {
....@@ -7491,9 +7781,9 @@
74917781 task_abort_retries = 0;
74927782 tm_retry:
74937783 if (task_abort_retries++ == 60) {
7494
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
7495
- "%s: ABORT_TASK: giving up\n", ioc->name,
7496
- __func__));
7784
+ dewtprintk(ioc,
7785
+ ioc_info(ioc, "%s: ABORT_TASK: giving up\n",
7786
+ __func__));
74977787 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
74987788 goto broadcast_aen_retry;
74997789 }
....@@ -7501,9 +7791,9 @@
75017791 if (ioc->shost_recovery)
75027792 goto out_no_lock;
75037793
7504
- r = mpt3sas_scsih_issue_tm(ioc, handle, sdev->lun,
7505
- MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK, st->smid,
7506
- st->msix_io, 30, 0);
7794
+ r = mpt3sas_scsih_issue_tm(ioc, handle, sdev->channel, sdev->id,
7795
+ sdev->lun, MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
7796
+ st->smid, st->msix_io, 30, 0);
75077797 if (r == FAILED || st->cb_idx != 0xFF) {
75087798 sdev_printk(KERN_WARNING, sdev,
75097799 "mpt3sas_scsih_issue_tm: ABORT_TASK: FAILED : "
....@@ -7522,9 +7812,10 @@
75227812 }
75237813
75247814 if (ioc->broadcast_aen_pending) {
7525
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
7526
- "%s: loop back due to pending AEN\n",
7527
- ioc->name, __func__));
7815
+ dewtprintk(ioc,
7816
+ ioc_info(ioc,
7817
+ "%s: loop back due to pending AEN\n",
7818
+ __func__));
75287819 ioc->broadcast_aen_pending = 0;
75297820 goto broadcast_aen_retry;
75307821 }
....@@ -7533,9 +7824,9 @@
75337824 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
75347825 out_no_lock:
75357826
7536
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
7537
- "%s - exit, query_count = %d termination_count = %d\n",
7538
- ioc->name, __func__, query_count, termination_count));
7827
+ dewtprintk(ioc,
7828
+ ioc_info(ioc, "%s - exit, query_count = %d termination_count = %d\n",
7829
+ __func__, query_count, termination_count));
75397830
75407831 ioc->broadcast_aen_busy = 0;
75417832 if (!ioc->shost_recovery)
....@@ -7557,13 +7848,13 @@
75577848 (Mpi2EventDataSasDiscovery_t *) fw_event->event_data;
75587849
75597850 if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) {
7560
- pr_info(MPT3SAS_FMT "discovery event: (%s)", ioc->name,
7561
- (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED) ?
7562
- "start" : "stop");
7851
+ ioc_info(ioc, "discovery event: (%s)",
7852
+ event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED ?
7853
+ "start" : "stop");
75637854 if (event_data->DiscoveryStatus)
7564
- pr_info("discovery_status(0x%08x)",
7565
- le32_to_cpu(event_data->DiscoveryStatus));
7566
- pr_info("\n");
7855
+ pr_cont("discovery_status(0x%08x)",
7856
+ le32_to_cpu(event_data->DiscoveryStatus));
7857
+ pr_cont("\n");
75677858 }
75687859
75697860 if (event_data->ReasonCode == MPI2_EVENT_SAS_DISC_RC_STARTED &&
....@@ -7593,20 +7884,16 @@
75937884
75947885 switch (event_data->ReasonCode) {
75957886 case MPI25_EVENT_SAS_DISC_ERR_SMP_FAILED:
7596
- pr_warn(MPT3SAS_FMT "SMP command sent to the expander"
7597
- "(handle:0x%04x, sas_address:0x%016llx,"
7598
- "physical_port:0x%02x) has failed",
7599
- ioc->name, le16_to_cpu(event_data->DevHandle),
7600
- (unsigned long long)le64_to_cpu(event_data->SASAddress),
7601
- event_data->PhysicalPort);
7887
+ ioc_warn(ioc, "SMP command sent to the expander (handle:0x%04x, sas_address:0x%016llx, physical_port:0x%02x) has failed\n",
7888
+ le16_to_cpu(event_data->DevHandle),
7889
+ (u64)le64_to_cpu(event_data->SASAddress),
7890
+ event_data->PhysicalPort);
76027891 break;
76037892 case MPI25_EVENT_SAS_DISC_ERR_SMP_TIMEOUT:
7604
- pr_warn(MPT3SAS_FMT "SMP command sent to the expander"
7605
- "(handle:0x%04x, sas_address:0x%016llx,"
7606
- "physical_port:0x%02x) has timed out",
7607
- ioc->name, le16_to_cpu(event_data->DevHandle),
7608
- (unsigned long long)le64_to_cpu(event_data->SASAddress),
7609
- event_data->PhysicalPort);
7893
+ ioc_warn(ioc, "SMP command sent to the expander (handle:0x%04x, sas_address:0x%016llx, physical_port:0x%02x) has timed out\n",
7894
+ le16_to_cpu(event_data->DevHandle),
7895
+ (u64)le64_to_cpu(event_data->SASAddress),
7896
+ event_data->PhysicalPort);
76107897 break;
76117898 default:
76127899 break;
....@@ -7629,11 +7916,10 @@
76297916 if (!(ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK))
76307917 return;
76317918
7632
- pr_info(MPT3SAS_FMT "pcie enumeration event: (%s) Flag 0x%02x",
7633
- ioc->name,
7634
- (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?
7635
- "started" : "completed",
7636
- event_data->Flags);
7919
+ ioc_info(ioc, "pcie enumeration event: (%s) Flag 0x%02x",
7920
+ (event_data->ReasonCode == MPI26_EVENT_PCIE_ENUM_RC_STARTED) ?
7921
+ "started" : "completed",
7922
+ event_data->Flags);
76377923 if (event_data->EnumerationStatus)
76387924 pr_cont("enumeration_status(0x%08x)",
76397925 le32_to_cpu(event_data->EnumerationStatus));
....@@ -7665,8 +7951,7 @@
76657951 mutex_lock(&ioc->scsih_cmds.mutex);
76667952
76677953 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
7668
- pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n",
7669
- ioc->name, __func__);
7954
+ ioc_err(ioc, "%s: scsih_cmd in use\n", __func__);
76707955 rc = -EAGAIN;
76717956 goto out;
76727957 }
....@@ -7674,8 +7959,7 @@
76747959
76757960 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);
76767961 if (!smid) {
7677
- pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
7678
- ioc->name, __func__);
7962
+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
76797963 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
76807964 rc = -EAGAIN;
76817965 goto out;
....@@ -7689,19 +7973,18 @@
76897973 mpi_request->Action = MPI2_RAID_ACTION_PHYSDISK_HIDDEN;
76907974 mpi_request->PhysDiskNum = phys_disk_num;
76917975
7692
- dewtprintk(ioc, pr_info(MPT3SAS_FMT "IR RAID_ACTION: turning fast "\
7693
- "path on for handle(0x%04x), phys_disk_num (0x%02x)\n", ioc->name,
7694
- handle, phys_disk_num));
7976
+ dewtprintk(ioc,
7977
+ ioc_info(ioc, "IR RAID_ACTION: turning fast path on for handle(0x%04x), phys_disk_num (0x%02x)\n",
7978
+ handle, phys_disk_num));
76957979
76967980 init_completion(&ioc->scsih_cmds.done);
7697
- mpt3sas_base_put_smid_default(ioc, smid);
7981
+ ioc->put_smid_default(ioc, smid);
76987982 wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);
76997983
77007984 if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
7701
- issue_reset =
7702
- mpt3sas_base_check_cmd_timeout(ioc,
7703
- ioc->scsih_cmds.status, mpi_request,
7704
- sizeof(Mpi2RaidActionRequest_t)/4);
7985
+ mpt3sas_check_cmd_timeout(ioc,
7986
+ ioc->scsih_cmds.status, mpi_request,
7987
+ sizeof(Mpi2RaidActionRequest_t)/4, issue_reset);
77057988 rc = -EFAULT;
77067989 goto out;
77077990 }
....@@ -7716,15 +7999,13 @@
77167999 log_info = 0;
77178000 ioc_status &= MPI2_IOCSTATUS_MASK;
77188001 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7719
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
7720
- "IR RAID_ACTION: failed: ioc_status(0x%04x), "
7721
- "loginfo(0x%08x)!!!\n", ioc->name, ioc_status,
7722
- log_info));
8002
+ dewtprintk(ioc,
8003
+ ioc_info(ioc, "IR RAID_ACTION: failed: ioc_status(0x%04x), loginfo(0x%08x)!!!\n",
8004
+ ioc_status, log_info));
77238005 rc = -EFAULT;
77248006 } else
7725
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
7726
- "IR RAID_ACTION: completed successfully\n",
7727
- ioc->name));
8007
+ dewtprintk(ioc,
8008
+ ioc_info(ioc, "IR RAID_ACTION: completed successfully\n"));
77288009 }
77298010
77308011 out:
....@@ -7769,9 +8050,8 @@
77698050
77708051 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);
77718052 if (!wwid) {
7772
- pr_err(MPT3SAS_FMT
7773
- "failure at %s:%d/%s()!\n", ioc->name,
7774
- __FILE__, __LINE__, __func__);
8053
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8054
+ __FILE__, __LINE__, __func__);
77758055 return;
77768056 }
77778057
....@@ -7784,9 +8064,8 @@
77848064
77858065 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);
77868066 if (!raid_device) {
7787
- pr_err(MPT3SAS_FMT
7788
- "failure at %s:%d/%s()!\n", ioc->name,
7789
- __FILE__, __LINE__, __func__);
8067
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8068
+ __FILE__, __LINE__, __func__);
77908069 return;
77918070 }
77928071
....@@ -7829,9 +8108,8 @@
78298108 sas_target_priv_data = starget->hostdata;
78308109 sas_target_priv_data->deleted = 1;
78318110 }
7832
- pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n",
7833
- ioc->name, raid_device->handle,
7834
- (unsigned long long) raid_device->wwid);
8111
+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
8112
+ raid_device->handle, (u64)raid_device->wwid);
78358113 list_del(&raid_device->list);
78368114 kfree(raid_device);
78378115 }
....@@ -7973,16 +8251,16 @@
79738251
79748252 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0,
79758253 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) {
7976
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
7977
- ioc->name, __FILE__, __LINE__, __func__);
8254
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8255
+ __FILE__, __LINE__, __func__);
79788256 return;
79798257 }
79808258
79818259 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
79828260 MPI2_IOCSTATUS_MASK;
79838261 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
7984
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
7985
- ioc->name, __FILE__, __LINE__, __func__);
8262
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8263
+ __FILE__, __LINE__, __func__);
79868264 return;
79878265 }
79888266
....@@ -8012,10 +8290,10 @@
80128290
80138291 element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0];
80148292
8015
- pr_info(MPT3SAS_FMT "raid config change: (%s), elements(%d)\n",
8016
- ioc->name, (le32_to_cpu(event_data->Flags) &
8017
- MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ?
8018
- "foreign" : "native", event_data->NumElements);
8293
+ ioc_info(ioc, "raid config change: (%s), elements(%d)\n",
8294
+ le32_to_cpu(event_data->Flags) & MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG ?
8295
+ "foreign" : "native",
8296
+ event_data->NumElements);
80198297 for (i = 0; i < event_data->NumElements; i++, element++) {
80208298 switch (element->ReasonCode) {
80218299 case MPI2_EVENT_IR_CHANGE_RC_ADDED:
....@@ -8171,10 +8449,11 @@
81718449 handle = le16_to_cpu(event_data->VolDevHandle);
81728450 state = le32_to_cpu(event_data->NewValue);
81738451 if (!ioc->hide_ir_msg)
8174
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
8175
- "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8176
- ioc->name, __func__, handle,
8177
- le32_to_cpu(event_data->PreviousValue), state));
8452
+ dewtprintk(ioc,
8453
+ ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8454
+ __func__, handle,
8455
+ le32_to_cpu(event_data->PreviousValue),
8456
+ state));
81788457 switch (state) {
81798458 case MPI2_RAID_VOL_STATE_MISSING:
81808459 case MPI2_RAID_VOL_STATE_FAILED:
....@@ -8194,17 +8473,15 @@
81948473
81958474 mpt3sas_config_get_volume_wwid(ioc, handle, &wwid);
81968475 if (!wwid) {
8197
- pr_err(MPT3SAS_FMT
8198
- "failure at %s:%d/%s()!\n", ioc->name,
8199
- __FILE__, __LINE__, __func__);
8476
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8477
+ __FILE__, __LINE__, __func__);
82008478 break;
82018479 }
82028480
82038481 raid_device = kzalloc(sizeof(struct _raid_device), GFP_KERNEL);
82048482 if (!raid_device) {
8205
- pr_err(MPT3SAS_FMT
8206
- "failure at %s:%d/%s()!\n", ioc->name,
8207
- __FILE__, __LINE__, __func__);
8483
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8484
+ __FILE__, __LINE__, __func__);
82088485 break;
82098486 }
82108487
....@@ -8255,10 +8532,11 @@
82558532 state = le32_to_cpu(event_data->NewValue);
82568533
82578534 if (!ioc->hide_ir_msg)
8258
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
8259
- "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8260
- ioc->name, __func__, handle,
8261
- le32_to_cpu(event_data->PreviousValue), state));
8535
+ dewtprintk(ioc,
8536
+ ioc_info(ioc, "%s: handle(0x%04x), old(0x%08x), new(0x%08x)\n",
8537
+ __func__, handle,
8538
+ le32_to_cpu(event_data->PreviousValue),
8539
+ state));
82628540
82638541 switch (state) {
82648542 case MPI2_RAID_PD_STATE_ONLINE:
....@@ -8279,16 +8557,16 @@
82798557 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply,
82808558 &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE,
82818559 handle))) {
8282
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
8283
- ioc->name, __FILE__, __LINE__, __func__);
8560
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8561
+ __FILE__, __LINE__, __func__);
82848562 return;
82858563 }
82868564
82878565 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
82888566 MPI2_IOCSTATUS_MASK;
82898567 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
8290
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
8291
- ioc->name, __FILE__, __LINE__, __func__);
8568
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
8569
+ __FILE__, __LINE__, __func__);
82928570 return;
82938571 }
82948572
....@@ -8342,11 +8620,10 @@
83428620 if (!reason_str)
83438621 return;
83448622
8345
- pr_info(MPT3SAS_FMT "raid operational status: (%s)" \
8346
- "\thandle(0x%04x), percent complete(%d)\n",
8347
- ioc->name, reason_str,
8348
- le16_to_cpu(event_data->VolDevHandle),
8349
- event_data->PercentComplete);
8623
+ ioc_info(ioc, "raid operational status: (%s)\thandle(0x%04x), percent complete(%d)\n",
8624
+ reason_str,
8625
+ le16_to_cpu(event_data->VolDevHandle),
8626
+ event_data->PercentComplete);
83508627 }
83518628
83528629 /**
....@@ -8427,9 +8704,8 @@
84278704 mpt3sas_scsih_enclosure_find_by_handle(ioc,
84288705 le16_to_cpu(sas_device_pg0->EnclosureHandle));
84298706 if (enclosure_dev == NULL)
8430
- pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)"
8431
- "doesn't match with enclosure device!\n",
8432
- ioc->name, sas_device_pg0->EnclosureHandle);
8707
+ ioc_info(ioc, "Enclosure handle(0x%04x) doesn't match with enclosure device!\n",
8708
+ sas_device_pg0->EnclosureHandle);
84338709 }
84348710 spin_lock_irqsave(&ioc->sas_device_lock, flags);
84358711 list_for_each_entry(sas_device, &ioc->sas_device_list, list) {
....@@ -8523,8 +8799,7 @@
85238799 enclosure_dev =
85248800 kzalloc(sizeof(struct _enclosure_node), GFP_KERNEL);
85258801 if (!enclosure_dev) {
8526
- pr_err(MPT3SAS_FMT
8527
- "failure at %s:%d/%s()!\n", ioc->name,
8802
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
85288803 __FILE__, __LINE__, __func__);
85298804 return;
85308805 }
....@@ -8561,7 +8836,7 @@
85618836 u16 handle;
85628837 u32 device_info;
85638838
8564
- pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name);
8839
+ ioc_info(ioc, "search for end-devices: start\n");
85658840
85668841 if (list_empty(&ioc->sas_device_list))
85678842 goto out;
....@@ -8582,8 +8857,7 @@
85828857 }
85838858
85848859 out:
8585
- pr_info(MPT3SAS_FMT "search for end-devices: complete\n",
8586
- ioc->name);
8860
+ ioc_info(ioc, "search for end-devices: complete\n");
85878861 }
85888862
85898863 /**
....@@ -8608,6 +8882,8 @@
86088882 if ((pcie_device->wwid == le64_to_cpu(pcie_device_pg0->WWID))
86098883 && (pcie_device->slot == le16_to_cpu(
86108884 pcie_device_pg0->Slot))) {
8885
+ pcie_device->access_status =
8886
+ pcie_device_pg0->AccessStatus;
86118887 pcie_device->responding = 1;
86128888 starget = pcie_device->starget;
86138889 if (starget && starget->hostdata) {
....@@ -8676,7 +8952,7 @@
86768952 u16 handle;
86778953 u32 device_info;
86788954
8679
- pr_info(MPT3SAS_FMT "search for end-devices: start\n", ioc->name);
8955
+ ioc_info(ioc, "search for end-devices: start\n");
86808956
86818957 if (list_empty(&ioc->pcie_device_list))
86828958 goto out;
....@@ -8688,21 +8964,19 @@
86888964 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
86898965 MPI2_IOCSTATUS_MASK;
86908966 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
8691
- pr_info(MPT3SAS_FMT "\tbreak from %s: "
8692
- "ioc_status(0x%04x), loginfo(0x%08x)\n", ioc->name,
8693
- __func__, ioc_status,
8694
- le32_to_cpu(mpi_reply.IOCLogInfo));
8967
+ ioc_info(ioc, "\tbreak from %s: ioc_status(0x%04x), loginfo(0x%08x)\n",
8968
+ __func__, ioc_status,
8969
+ le32_to_cpu(mpi_reply.IOCLogInfo));
86958970 break;
86968971 }
86978972 handle = le16_to_cpu(pcie_device_pg0.DevHandle);
86988973 device_info = le32_to_cpu(pcie_device_pg0.DeviceInfo);
8699
- if (!(_scsih_is_nvme_device(device_info)))
8974
+ if (!(_scsih_is_nvme_pciescsi_device(device_info)))
87008975 continue;
87018976 _scsih_mark_responding_pcie_device(ioc, &pcie_device_pg0);
87028977 }
87038978 out:
8704
- pr_info(MPT3SAS_FMT "search for PCIe end-devices: complete\n",
8705
- ioc->name);
8979
+ ioc_info(ioc, "search for PCIe end-devices: complete\n");
87068980 }
87078981
87088982 /**
....@@ -8783,8 +9057,7 @@
87839057 if (!ioc->ir_firmware)
87849058 return;
87859059
8786
- pr_info(MPT3SAS_FMT "search for raid volumes: start\n",
8787
- ioc->name);
9060
+ ioc_info(ioc, "search for raid volumes: start\n");
87889061
87899062 if (list_empty(&ioc->raid_device_list))
87909063 goto out;
....@@ -8827,8 +9100,7 @@
88279100 }
88289101 }
88299102 out:
8830
- pr_info(MPT3SAS_FMT "search for responding raid volumes: complete\n",
8831
- ioc->name);
9103
+ ioc_info(ioc, "search for responding raid volumes: complete\n");
88329104 }
88339105
88349106 /**
....@@ -8900,7 +9172,7 @@
89009172 u64 sas_address;
89019173 u16 handle;
89029174
8903
- pr_info(MPT3SAS_FMT "search for expanders: start\n", ioc->name);
9175
+ ioc_info(ioc, "search for expanders: start\n");
89049176
89059177 if (list_empty(&ioc->sas_expander_list))
89069178 goto out;
....@@ -8923,7 +9195,7 @@
89239195 }
89249196
89259197 out:
8926
- pr_info(MPT3SAS_FMT "search for expanders: complete\n", ioc->name);
9198
+ ioc_info(ioc, "search for expanders: complete\n");
89279199 }
89289200
89299201 /**
....@@ -8941,12 +9213,10 @@
89419213 unsigned long flags;
89429214 LIST_HEAD(head);
89439215
8944
- pr_info(MPT3SAS_FMT "removing unresponding devices: start\n",
8945
- ioc->name);
9216
+ ioc_info(ioc, "removing unresponding devices: start\n");
89469217
89479218 /* removing unresponding end devices */
8948
- pr_info(MPT3SAS_FMT "removing unresponding devices: end-devices\n",
8949
- ioc->name);
9219
+ ioc_info(ioc, "removing unresponding devices: end-devices\n");
89509220 /*
89519221 * Iterate, pulling off devices marked as non-responding. We become the
89529222 * owner for the reference the list had on any object we prune.
....@@ -8970,9 +9240,7 @@
89709240 sas_device_put(sas_device);
89719241 }
89729242
8973
- pr_info(MPT3SAS_FMT
8974
- " Removing unresponding devices: pcie end-devices\n"
8975
- , ioc->name);
9243
+ ioc_info(ioc, "Removing unresponding devices: pcie end-devices\n");
89769244 INIT_LIST_HEAD(&head);
89779245 spin_lock_irqsave(&ioc->pcie_device_lock, flags);
89789246 list_for_each_entry_safe(pcie_device, pcie_device_next,
....@@ -8992,8 +9260,7 @@
89929260
89939261 /* removing unresponding volumes */
89949262 if (ioc->ir_firmware) {
8995
- pr_info(MPT3SAS_FMT "removing unresponding devices: volumes\n",
8996
- ioc->name);
9263
+ ioc_info(ioc, "removing unresponding devices: volumes\n");
89979264 list_for_each_entry_safe(raid_device, raid_device_next,
89989265 &ioc->raid_device_list, list) {
89999266 if (!raid_device->responding)
....@@ -9005,8 +9272,7 @@
90059272 }
90069273
90079274 /* removing unresponding expanders */
9008
- pr_info(MPT3SAS_FMT "removing unresponding devices: expanders\n",
9009
- ioc->name);
9275
+ ioc_info(ioc, "removing unresponding devices: expanders\n");
90109276 spin_lock_irqsave(&ioc->sas_node_lock, flags);
90119277 INIT_LIST_HEAD(&tmp_list);
90129278 list_for_each_entry_safe(sas_expander, sas_expander_next,
....@@ -9022,8 +9288,7 @@
90229288 _scsih_expander_node_remove(ioc, sas_expander);
90239289 }
90249290
9025
- pr_info(MPT3SAS_FMT "removing unresponding devices: complete\n",
9026
- ioc->name);
9291
+ ioc_info(ioc, "removing unresponding devices: complete\n");
90279292
90289293 /* unblock devices */
90299294 _scsih_ublock_io_all_device(ioc);
....@@ -9040,8 +9305,8 @@
90409305 for (i = 0 ; i < sas_expander->num_phys ; i++) {
90419306 if ((mpt3sas_config_get_expander_pg1(ioc, &mpi_reply,
90429307 &expander_pg1, i, handle))) {
9043
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
9044
- ioc->name, __FILE__, __LINE__, __func__);
9308
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
9309
+ __FILE__, __LINE__, __func__);
90459310 return;
90469311 }
90479312
....@@ -9077,11 +9342,11 @@
90779342 u8 retry_count;
90789343 unsigned long flags;
90799344
9080
- pr_info(MPT3SAS_FMT "scan devices: start\n", ioc->name);
9345
+ ioc_info(ioc, "scan devices: start\n");
90819346
90829347 _scsih_sas_host_refresh(ioc);
90839348
9084
- pr_info(MPT3SAS_FMT "\tscan devices: expanders start\n", ioc->name);
9349
+ ioc_info(ioc, "\tscan devices: expanders start\n");
90859350
90869351 /* expanders */
90879352 handle = 0xFFFF;
....@@ -9090,10 +9355,8 @@
90909355 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
90919356 MPI2_IOCSTATUS_MASK;
90929357 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9093
- pr_info(MPT3SAS_FMT "\tbreak from expander scan: " \
9094
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
9095
- ioc->name, ioc_status,
9096
- le32_to_cpu(mpi_reply.IOCLogInfo));
9358
+ ioc_info(ioc, "\tbreak from expander scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9359
+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
90979360 break;
90989361 }
90999362 handle = le16_to_cpu(expander_pg0.DevHandle);
....@@ -9105,25 +9368,22 @@
91059368 _scsih_refresh_expander_links(ioc, expander_device,
91069369 handle);
91079370 else {
9108
- pr_info(MPT3SAS_FMT "\tBEFORE adding expander: " \
9109
- "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9110
- handle, (unsigned long long)
9111
- le64_to_cpu(expander_pg0.SASAddress));
9371
+ ioc_info(ioc, "\tBEFORE adding expander: handle (0x%04x), sas_addr(0x%016llx)\n",
9372
+ handle,
9373
+ (u64)le64_to_cpu(expander_pg0.SASAddress));
91129374 _scsih_expander_add(ioc, handle);
9113
- pr_info(MPT3SAS_FMT "\tAFTER adding expander: " \
9114
- "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9115
- handle, (unsigned long long)
9116
- le64_to_cpu(expander_pg0.SASAddress));
9375
+ ioc_info(ioc, "\tAFTER adding expander: handle (0x%04x), sas_addr(0x%016llx)\n",
9376
+ handle,
9377
+ (u64)le64_to_cpu(expander_pg0.SASAddress));
91179378 }
91189379 }
91199380
9120
- pr_info(MPT3SAS_FMT "\tscan devices: expanders complete\n",
9121
- ioc->name);
9381
+ ioc_info(ioc, "\tscan devices: expanders complete\n");
91229382
91239383 if (!ioc->ir_firmware)
91249384 goto skip_to_sas;
91259385
9126
- pr_info(MPT3SAS_FMT "\tscan devices: phys disk start\n", ioc->name);
9386
+ ioc_info(ioc, "\tscan devices: phys disk start\n");
91279387
91289388 /* phys disk */
91299389 phys_disk_num = 0xFF;
....@@ -9133,10 +9393,8 @@
91339393 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
91349394 MPI2_IOCSTATUS_MASK;
91359395 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9136
- pr_info(MPT3SAS_FMT "\tbreak from phys disk scan: "\
9137
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
9138
- ioc->name, ioc_status,
9139
- le32_to_cpu(mpi_reply.IOCLogInfo));
9396
+ ioc_info(ioc, "\tbreak from phys disk scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9397
+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
91409398 break;
91419399 }
91429400 phys_disk_num = pd_pg0.PhysDiskNum;
....@@ -9153,19 +9411,16 @@
91539411 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
91549412 MPI2_IOCSTATUS_MASK;
91559413 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9156
- pr_info(MPT3SAS_FMT "\tbreak from phys disk scan " \
9157
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
9158
- ioc->name, ioc_status,
9159
- le32_to_cpu(mpi_reply.IOCLogInfo));
9414
+ ioc_info(ioc, "\tbreak from phys disk scan ioc_status(0x%04x), loginfo(0x%08x)\n",
9415
+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
91609416 break;
91619417 }
91629418 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
91639419 if (!_scsih_get_sas_address(ioc, parent_handle,
91649420 &sas_address)) {
9165
- pr_info(MPT3SAS_FMT "\tBEFORE adding phys disk: " \
9166
- " handle (0x%04x), sas_addr(0x%016llx)\n",
9167
- ioc->name, handle, (unsigned long long)
9168
- le64_to_cpu(sas_device_pg0.SASAddress));
9421
+ ioc_info(ioc, "\tBEFORE adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n",
9422
+ handle,
9423
+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
91699424 mpt3sas_transport_update_links(ioc, sas_address,
91709425 handle, sas_device_pg0.PhyNum,
91719426 MPI2_SAS_NEG_LINK_RATE_1_5);
....@@ -9179,17 +9434,15 @@
91799434 1)) {
91809435 ssleep(1);
91819436 }
9182
- pr_info(MPT3SAS_FMT "\tAFTER adding phys disk: " \
9183
- " handle (0x%04x), sas_addr(0x%016llx)\n",
9184
- ioc->name, handle, (unsigned long long)
9185
- le64_to_cpu(sas_device_pg0.SASAddress));
9437
+ ioc_info(ioc, "\tAFTER adding phys disk: handle (0x%04x), sas_addr(0x%016llx)\n",
9438
+ handle,
9439
+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
91869440 }
91879441 }
91889442
9189
- pr_info(MPT3SAS_FMT "\tscan devices: phys disk complete\n",
9190
- ioc->name);
9443
+ ioc_info(ioc, "\tscan devices: phys disk complete\n");
91919444
9192
- pr_info(MPT3SAS_FMT "\tscan devices: volumes start\n", ioc->name);
9445
+ ioc_info(ioc, "\tscan devices: volumes start\n");
91939446
91949447 /* volumes */
91959448 handle = 0xFFFF;
....@@ -9198,10 +9451,8 @@
91989451 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
91999452 MPI2_IOCSTATUS_MASK;
92009453 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9201
- pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \
9202
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
9203
- ioc->name, ioc_status,
9204
- le32_to_cpu(mpi_reply.IOCLogInfo));
9454
+ ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9455
+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
92059456 break;
92069457 }
92079458 handle = le16_to_cpu(volume_pg1.DevHandle);
....@@ -9218,10 +9469,8 @@
92189469 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
92199470 MPI2_IOCSTATUS_MASK;
92209471 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9221
- pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \
9222
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
9223
- ioc->name, ioc_status,
9224
- le32_to_cpu(mpi_reply.IOCLogInfo));
9472
+ ioc_info(ioc, "\tbreak from volume scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9473
+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
92259474 break;
92269475 }
92279476 if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL ||
....@@ -9230,23 +9479,19 @@
92309479 memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t));
92319480 element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED;
92329481 element.VolDevHandle = volume_pg1.DevHandle;
9233
- pr_info(MPT3SAS_FMT
9234
- "\tBEFORE adding volume: handle (0x%04x)\n",
9235
- ioc->name, volume_pg1.DevHandle);
9482
+ ioc_info(ioc, "\tBEFORE adding volume: handle (0x%04x)\n",
9483
+ volume_pg1.DevHandle);
92369484 _scsih_sas_volume_add(ioc, &element);
9237
- pr_info(MPT3SAS_FMT
9238
- "\tAFTER adding volume: handle (0x%04x)\n",
9239
- ioc->name, volume_pg1.DevHandle);
9485
+ ioc_info(ioc, "\tAFTER adding volume: handle (0x%04x)\n",
9486
+ volume_pg1.DevHandle);
92409487 }
92419488 }
92429489
9243
- pr_info(MPT3SAS_FMT "\tscan devices: volumes complete\n",
9244
- ioc->name);
9490
+ ioc_info(ioc, "\tscan devices: volumes complete\n");
92459491
92469492 skip_to_sas:
92479493
9248
- pr_info(MPT3SAS_FMT "\tscan devices: end devices start\n",
9249
- ioc->name);
9494
+ ioc_info(ioc, "\tscan devices: end devices start\n");
92509495
92519496 /* sas devices */
92529497 handle = 0xFFFF;
....@@ -9256,10 +9501,8 @@
92569501 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
92579502 MPI2_IOCSTATUS_MASK;
92589503 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9259
- pr_info(MPT3SAS_FMT "\tbreak from end device scan:"\
9260
- " ioc_status(0x%04x), loginfo(0x%08x)\n",
9261
- ioc->name, ioc_status,
9262
- le32_to_cpu(mpi_reply.IOCLogInfo));
9504
+ ioc_info(ioc, "\tbreak from end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9505
+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
92639506 break;
92649507 }
92659508 handle = le16_to_cpu(sas_device_pg0.DevHandle);
....@@ -9274,10 +9517,9 @@
92749517 }
92759518 parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle);
92769519 if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) {
9277
- pr_info(MPT3SAS_FMT "\tBEFORE adding end device: " \
9278
- "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9279
- handle, (unsigned long long)
9280
- le64_to_cpu(sas_device_pg0.SASAddress));
9520
+ ioc_info(ioc, "\tBEFORE adding end device: handle (0x%04x), sas_addr(0x%016llx)\n",
9521
+ handle,
9522
+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
92819523 mpt3sas_transport_update_links(ioc, sas_address, handle,
92829524 sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5);
92839525 retry_count = 0;
....@@ -9289,16 +9531,13 @@
92899531 0)) {
92909532 ssleep(1);
92919533 }
9292
- pr_info(MPT3SAS_FMT "\tAFTER adding end device: " \
9293
- "handle (0x%04x), sas_addr(0x%016llx)\n", ioc->name,
9294
- handle, (unsigned long long)
9295
- le64_to_cpu(sas_device_pg0.SASAddress));
9534
+ ioc_info(ioc, "\tAFTER adding end device: handle (0x%04x), sas_addr(0x%016llx)\n",
9535
+ handle,
9536
+ (u64)le64_to_cpu(sas_device_pg0.SASAddress));
92969537 }
92979538 }
9298
- pr_info(MPT3SAS_FMT "\tscan devices: end devices complete\n",
9299
- ioc->name);
9300
- pr_info(MPT3SAS_FMT "\tscan devices: pcie end devices start\n",
9301
- ioc->name);
9539
+ ioc_info(ioc, "\tscan devices: end devices complete\n");
9540
+ ioc_info(ioc, "\tscan devices: pcie end devices start\n");
93029541
93039542 /* pcie devices */
93049543 handle = 0xFFFF;
....@@ -9308,14 +9547,12 @@
93089547 ioc_status = le16_to_cpu(mpi_reply.IOCStatus)
93099548 & MPI2_IOCSTATUS_MASK;
93109549 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
9311
- pr_info(MPT3SAS_FMT "\tbreak from pcie end device"
9312
- " scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9313
- ioc->name, ioc_status,
9314
- le32_to_cpu(mpi_reply.IOCLogInfo));
9550
+ ioc_info(ioc, "\tbreak from pcie end device scan: ioc_status(0x%04x), loginfo(0x%08x)\n",
9551
+ ioc_status, le32_to_cpu(mpi_reply.IOCLogInfo));
93159552 break;
93169553 }
93179554 handle = le16_to_cpu(pcie_device_pg0.DevHandle);
9318
- if (!(_scsih_is_nvme_device(
9555
+ if (!(_scsih_is_nvme_pciescsi_device(
93199556 le32_to_cpu(pcie_device_pg0.DeviceInfo))))
93209557 continue;
93219558 pcie_device = mpt3sas_get_pdev_by_wwid(ioc,
....@@ -9328,14 +9565,11 @@
93289565 parent_handle = le16_to_cpu(pcie_device_pg0.ParentDevHandle);
93299566 _scsih_pcie_add_device(ioc, handle);
93309567
9331
- pr_info(MPT3SAS_FMT "\tAFTER adding pcie end device: "
9332
- "handle (0x%04x), wwid(0x%016llx)\n", ioc->name,
9333
- handle,
9334
- (unsigned long long) le64_to_cpu(pcie_device_pg0.WWID));
9568
+ ioc_info(ioc, "\tAFTER adding pcie end device: handle (0x%04x), wwid(0x%016llx)\n",
9569
+ handle, (u64)le64_to_cpu(pcie_device_pg0.WWID));
93359570 }
9336
- pr_info(MPT3SAS_FMT "\tpcie devices: pcie end devices complete\n",
9337
- ioc->name);
9338
- pr_info(MPT3SAS_FMT "scan devices: complete\n", ioc->name);
9571
+ ioc_info(ioc, "\tpcie devices: pcie end devices complete\n");
9572
+ ioc_info(ioc, "scan devices: complete\n");
93399573 }
93409574
93419575 /**
....@@ -9346,21 +9580,21 @@
93469580 */
93479581 void mpt3sas_scsih_pre_reset_handler(struct MPT3SAS_ADAPTER *ioc)
93489582 {
9349
- dtmprintk(ioc, pr_info(MPT3SAS_FMT
9350
- "%s: MPT3_IOC_PRE_RESET\n", ioc->name, __func__));
9583
+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_PRE_RESET\n", __func__));
93519584 }
93529585
93539586 /**
9354
- * mpt3sas_scsih_after_reset_handler - reset callback handler (for scsih)
9587
+ * mpt3sas_scsih_clear_outstanding_scsi_tm_commands - clears outstanding
9588
+ * scsi & tm cmds.
93559589 * @ioc: per adapter object
93569590 *
93579591 * The handler for doing any required cleanup or initialization.
93589592 */
93599593 void
9360
-mpt3sas_scsih_after_reset_handler(struct MPT3SAS_ADAPTER *ioc)
9594
+mpt3sas_scsih_clear_outstanding_scsi_tm_commands(struct MPT3SAS_ADAPTER *ioc)
93619595 {
9362
- dtmprintk(ioc, pr_info(MPT3SAS_FMT
9363
- "%s: MPT3_IOC_AFTER_RESET\n", ioc->name, __func__));
9596
+ dtmprintk(ioc,
9597
+ ioc_info(ioc, "%s: clear outstanding scsi & tm cmds\n", __func__));
93649598 if (ioc->scsih_cmds.status & MPT3_CMD_PENDING) {
93659599 ioc->scsih_cmds.status |= MPT3_CMD_RESET;
93669600 mpt3sas_base_free_smid(ioc, ioc->scsih_cmds.smid);
....@@ -9388,8 +9622,7 @@
93889622 void
93899623 mpt3sas_scsih_reset_done_handler(struct MPT3SAS_ADAPTER *ioc)
93909624 {
9391
- dtmprintk(ioc, pr_info(MPT3SAS_FMT
9392
- "%s: MPT3_IOC_DONE_RESET\n", ioc->name, __func__));
9625
+ dtmprintk(ioc, ioc_info(ioc, "%s: MPT3_IOC_DONE_RESET\n", __func__));
93939626 if ((!ioc->is_driver_loading) && !(disable_discovery > 0 &&
93949627 !ioc->sas_hba.num_phys)) {
93959628 _scsih_prep_device_scan(ioc);
....@@ -9411,11 +9644,13 @@
94119644 static void
94129645 _mpt3sas_fw_work(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event)
94139646 {
9647
+ ioc->current_event = fw_event;
94149648 _scsih_fw_event_del_from_list(ioc, fw_event);
94159649
94169650 /* the queue is being flushed so ignore this event */
94179651 if (ioc->remove_host || ioc->pci_error_recovery) {
94189652 fw_event_work_put(fw_event);
9653
+ ioc->current_event = NULL;
94199654 return;
94209655 }
94219656
....@@ -9429,24 +9664,24 @@
94299664 while (scsi_host_in_recovery(ioc->shost) ||
94309665 ioc->shost_recovery) {
94319666 /*
9432
- * If we're unloading, bail. Otherwise, this can become
9433
- * an infinite loop.
9667
+ * If we're unloading or cancelling the work, bail.
9668
+ * Otherwise, this can become an infinite loop.
94349669 */
9435
- if (ioc->remove_host)
9670
+ if (ioc->remove_host || ioc->fw_events_cleanup)
94369671 goto out;
94379672 ssleep(1);
94389673 }
94399674 _scsih_remove_unresponding_devices(ioc);
94409675 _scsih_scan_for_devices_after_reset(ioc);
9676
+ _scsih_set_nvme_max_shutdown_latency(ioc);
94419677 break;
94429678 case MPT3SAS_PORT_ENABLE_COMPLETE:
94439679 ioc->start_scan = 0;
94449680 if (missing_delay[0] != -1 && missing_delay[1] != -1)
94459681 mpt3sas_base_update_missing_delay(ioc, missing_delay[0],
94469682 missing_delay[1]);
9447
- dewtprintk(ioc, pr_info(MPT3SAS_FMT
9448
- "port enable: complete from worker thread\n",
9449
- ioc->name));
9683
+ dewtprintk(ioc,
9684
+ ioc_info(ioc, "port enable: complete from worker thread\n"));
94509685 break;
94519686 case MPT3SAS_TURN_ON_PFA_LED:
94529687 _scsih_turn_on_pfa_led(ioc, fw_event->device_handle);
....@@ -9455,7 +9690,10 @@
94559690 _scsih_sas_topology_change_event(ioc, fw_event);
94569691 break;
94579692 case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE:
9458
- _scsih_sas_device_status_change_event(ioc, fw_event);
9693
+ if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK)
9694
+ _scsih_sas_device_status_change_event_debug(ioc,
9695
+ (Mpi2EventDataSasDeviceStatusChange_t *)
9696
+ fw_event->event_data);
94599697 break;
94609698 case MPI2_EVENT_SAS_DISCOVERY:
94619699 _scsih_sas_discovery_event(ioc, fw_event);
....@@ -9490,11 +9728,13 @@
94909728 break;
94919729 case MPI2_EVENT_PCIE_TOPOLOGY_CHANGE_LIST:
94929730 _scsih_pcie_topology_change_event(ioc, fw_event);
9731
+ ioc->current_event = NULL;
94939732 return;
94949733 break;
94959734 }
94969735 out:
94979736 fw_event_work_put(fw_event);
9737
+ ioc->current_event = NULL;
94989738 }
94999739
95009740 /**
....@@ -9544,8 +9784,8 @@
95449784 mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
95459785
95469786 if (unlikely(!mpi_reply)) {
9547
- pr_err(MPT3SAS_FMT "mpi_reply not valid at %s:%d/%s()!\n",
9548
- ioc->name, __FILE__, __LINE__, __func__);
9787
+ ioc_err(ioc, "mpi_reply not valid at %s:%d/%s()!\n",
9788
+ __FILE__, __LINE__, __func__);
95499789 return 1;
95509790 }
95519791
....@@ -9612,36 +9852,26 @@
96129852
96139853 switch (le32_to_cpu(*log_code)) {
96149854 case MPT2_WARPDRIVE_LC_SSDT:
9615
- pr_warn(MPT3SAS_FMT "WarpDrive Warning: "
9616
- "IO Throttling has occurred in the WarpDrive "
9617
- "subsystem. Check WarpDrive documentation for "
9618
- "additional details.\n", ioc->name);
9855
+ ioc_warn(ioc, "WarpDrive Warning: IO Throttling has occurred in the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n");
96199856 break;
96209857 case MPT2_WARPDRIVE_LC_SSDLW:
9621
- pr_warn(MPT3SAS_FMT "WarpDrive Warning: "
9622
- "Program/Erase Cycles for the WarpDrive subsystem "
9623
- "in degraded range. Check WarpDrive documentation "
9624
- "for additional details.\n", ioc->name);
9858
+ ioc_warn(ioc, "WarpDrive Warning: Program/Erase Cycles for the WarpDrive subsystem in degraded range. Check WarpDrive documentation for additional details.\n");
96259859 break;
96269860 case MPT2_WARPDRIVE_LC_SSDLF:
9627
- pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: "
9628
- "There are no Program/Erase Cycles for the "
9629
- "WarpDrive subsystem. The storage device will be "
9630
- "in read-only mode. Check WarpDrive documentation "
9631
- "for additional details.\n", ioc->name);
9861
+ ioc_err(ioc, "WarpDrive Fatal Error: There are no Program/Erase Cycles for the WarpDrive subsystem. The storage device will be in read-only mode. Check WarpDrive documentation for additional details.\n");
96329862 break;
96339863 case MPT2_WARPDRIVE_LC_BRMF:
9634
- pr_err(MPT3SAS_FMT "WarpDrive Fatal Error: "
9635
- "The Backup Rail Monitor has failed on the "
9636
- "WarpDrive subsystem. Check WarpDrive "
9637
- "documentation for additional details.\n",
9638
- ioc->name);
9864
+ ioc_err(ioc, "WarpDrive Fatal Error: The Backup Rail Monitor has failed on the WarpDrive subsystem. Check WarpDrive documentation for additional details.\n");
96399865 break;
96409866 }
96419867
96429868 break;
96439869 }
96449870 case MPI2_EVENT_SAS_DEVICE_STATUS_CHANGE:
9871
+ _scsih_sas_device_status_change_event(ioc,
9872
+ (Mpi2EventDataSasDeviceStatusChange_t *)
9873
+ mpi_reply->EventData);
9874
+ break;
96459875 case MPI2_EVENT_IR_OPERATION_STATUS:
96469876 case MPI2_EVENT_SAS_DISCOVERY:
96479877 case MPI2_EVENT_SAS_DEVICE_DISCOVERY_ERROR:
....@@ -9661,9 +9891,8 @@
96619891 (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;
96629892 switch (ActiveCableEventData->ReasonCode) {
96639893 case MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER:
9664
- pr_notice(MPT3SAS_FMT
9665
- "Currently an active cable with ReceptacleID %d\n",
9666
- ioc->name, ActiveCableEventData->ReceptacleID);
9894
+ ioc_notice(ioc, "Currently an active cable with ReceptacleID %d\n",
9895
+ ActiveCableEventData->ReceptacleID);
96679896 pr_notice("cannot be powered and devices connected\n");
96689897 pr_notice("to this active cable will not be seen\n");
96699898 pr_notice("This active cable requires %d mW of power\n",
....@@ -9671,9 +9900,8 @@
96719900 break;
96729901
96739902 case MPI26_EVENT_ACTIVE_CABLE_DEGRADED:
9674
- pr_notice(MPT3SAS_FMT
9675
- "Currently a cable with ReceptacleID %d\n",
9676
- ioc->name, ActiveCableEventData->ReceptacleID);
9903
+ ioc_notice(ioc, "Currently a cable with ReceptacleID %d\n",
9904
+ ActiveCableEventData->ReceptacleID);
96779905 pr_notice(
96789906 "is not running at optimal speed(12 Gb/s rate)\n");
96799907 break;
....@@ -9688,8 +9916,8 @@
96889916 sz = le16_to_cpu(mpi_reply->EventDataLength) * 4;
96899917 fw_event = alloc_fw_event_work(sz);
96909918 if (!fw_event) {
9691
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
9692
- ioc->name, __FILE__, __LINE__, __func__);
9919
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
9920
+ __FILE__, __LINE__, __func__);
96939921 return 1;
96949922 }
96959923
....@@ -9738,11 +9966,9 @@
97389966 mpt3sas_transport_port_remove(ioc, sas_expander->sas_address,
97399967 sas_expander->sas_address_parent);
97409968
9741
- pr_info(MPT3SAS_FMT
9742
- "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n",
9743
- ioc->name,
9744
- sas_expander->handle, (unsigned long long)
9745
- sas_expander->sas_address);
9969
+ ioc_info(ioc, "expander_remove: handle(0x%04x), sas_addr(0x%016llx)\n",
9970
+ sas_expander->handle, (unsigned long long)
9971
+ sas_expander->sas_address);
97469972
97479973 spin_lock_irqsave(&ioc->sas_node_lock, flags);
97489974 list_del(&sas_expander->list);
....@@ -9751,6 +9977,75 @@
97519977 kfree(sas_expander->phy);
97529978 kfree(sas_expander);
97539979 }
9980
+
9981
+/**
9982
+ * _scsih_nvme_shutdown - NVMe shutdown notification
9983
+ * @ioc: per adapter object
9984
+ *
9985
+ * Sending IoUnitControl request with shutdown operation code to alert IOC that
9986
+ * the host system is shutting down so that IOC can issue NVMe shutdown to
9987
+ * NVMe drives attached to it.
9988
+ */
9989
+static void
9990
+_scsih_nvme_shutdown(struct MPT3SAS_ADAPTER *ioc)
9991
+{
9992
+ Mpi26IoUnitControlRequest_t *mpi_request;
9993
+ Mpi26IoUnitControlReply_t *mpi_reply;
9994
+ u16 smid;
9995
+
9996
+ /* are there any NVMe devices ? */
9997
+ if (list_empty(&ioc->pcie_device_list))
9998
+ return;
9999
+
10000
+ mutex_lock(&ioc->scsih_cmds.mutex);
10001
+
10002
+ if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
10003
+ ioc_err(ioc, "%s: scsih_cmd in use\n", __func__);
10004
+ goto out;
10005
+ }
10006
+
10007
+ ioc->scsih_cmds.status = MPT3_CMD_PENDING;
10008
+
10009
+ smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);
10010
+ if (!smid) {
10011
+ ioc_err(ioc,
10012
+ "%s: failed obtaining a smid\n", __func__);
10013
+ ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
10014
+ goto out;
10015
+ }
10016
+
10017
+ mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
10018
+ ioc->scsih_cmds.smid = smid;
10019
+ memset(mpi_request, 0, sizeof(Mpi26IoUnitControlRequest_t));
10020
+ mpi_request->Function = MPI2_FUNCTION_IO_UNIT_CONTROL;
10021
+ mpi_request->Operation = MPI26_CTRL_OP_SHUTDOWN;
10022
+
10023
+ init_completion(&ioc->scsih_cmds.done);
10024
+ ioc->put_smid_default(ioc, smid);
10025
+ /* Wait for max_shutdown_latency seconds */
10026
+ ioc_info(ioc,
10027
+ "Io Unit Control shutdown (sending), Shutdown latency %d sec\n",
10028
+ ioc->max_shutdown_latency);
10029
+ wait_for_completion_timeout(&ioc->scsih_cmds.done,
10030
+ ioc->max_shutdown_latency*HZ);
10031
+
10032
+ if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
10033
+ ioc_err(ioc, "%s: timeout\n", __func__);
10034
+ goto out;
10035
+ }
10036
+
10037
+ if (ioc->scsih_cmds.status & MPT3_CMD_REPLY_VALID) {
10038
+ mpi_reply = ioc->scsih_cmds.reply;
10039
+ ioc_info(ioc, "Io Unit Control shutdown (complete):"
10040
+ "ioc_status(0x%04x), loginfo(0x%08x)\n",
10041
+ le16_to_cpu(mpi_reply->IOCStatus),
10042
+ le32_to_cpu(mpi_reply->IOCLogInfo));
10043
+ }
10044
+ out:
10045
+ ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
10046
+ mutex_unlock(&ioc->scsih_cmds.mutex);
10047
+}
10048
+
975410049
975510050 /**
975610051 * _scsih_ir_shutdown - IR shutdown notification
....@@ -9777,16 +10072,14 @@
977710072 mutex_lock(&ioc->scsih_cmds.mutex);
977810073
977910074 if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) {
9780
- pr_err(MPT3SAS_FMT "%s: scsih_cmd in use\n",
9781
- ioc->name, __func__);
10075
+ ioc_err(ioc, "%s: scsih_cmd in use\n", __func__);
978210076 goto out;
978310077 }
978410078 ioc->scsih_cmds.status = MPT3_CMD_PENDING;
978510079
978610080 smid = mpt3sas_base_get_smid(ioc, ioc->scsih_cb_idx);
978710081 if (!smid) {
9788
- pr_err(MPT3SAS_FMT "%s: failed obtaining a smid\n",
9789
- ioc->name, __func__);
10082
+ ioc_err(ioc, "%s: failed obtaining a smid\n", __func__);
979010083 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
979110084 goto out;
979210085 }
....@@ -9799,29 +10092,55 @@
979910092 mpi_request->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
980010093
980110094 if (!ioc->hide_ir_msg)
9802
- pr_info(MPT3SAS_FMT "IR shutdown (sending)\n", ioc->name);
10095
+ ioc_info(ioc, "IR shutdown (sending)\n");
980310096 init_completion(&ioc->scsih_cmds.done);
9804
- mpt3sas_base_put_smid_default(ioc, smid);
10097
+ ioc->put_smid_default(ioc, smid);
980510098 wait_for_completion_timeout(&ioc->scsih_cmds.done, 10*HZ);
980610099
980710100 if (!(ioc->scsih_cmds.status & MPT3_CMD_COMPLETE)) {
9808
- pr_err(MPT3SAS_FMT "%s: timeout\n",
9809
- ioc->name, __func__);
10101
+ ioc_err(ioc, "%s: timeout\n", __func__);
981010102 goto out;
981110103 }
981210104
981310105 if (ioc->scsih_cmds.status & MPT3_CMD_REPLY_VALID) {
981410106 mpi_reply = ioc->scsih_cmds.reply;
981510107 if (!ioc->hide_ir_msg)
9816
- pr_info(MPT3SAS_FMT "IR shutdown "
9817
- "(complete): ioc_status(0x%04x), loginfo(0x%08x)\n",
9818
- ioc->name, le16_to_cpu(mpi_reply->IOCStatus),
9819
- le32_to_cpu(mpi_reply->IOCLogInfo));
10108
+ ioc_info(ioc, "IR shutdown (complete): ioc_status(0x%04x), loginfo(0x%08x)\n",
10109
+ le16_to_cpu(mpi_reply->IOCStatus),
10110
+ le32_to_cpu(mpi_reply->IOCLogInfo));
982010111 }
982110112
982210113 out:
982310114 ioc->scsih_cmds.status = MPT3_CMD_NOT_USED;
982410115 mutex_unlock(&ioc->scsih_cmds.mutex);
10116
+}
10117
+
10118
+/**
10119
+ * _scsih_get_shost_and_ioc - get shost and ioc
10120
+ * and verify whether they are NULL or not
10121
+ * @pdev: PCI device struct
10122
+ * @shost: address of scsi host pointer
10123
+ * @ioc: address of HBA adapter pointer
10124
+ *
10125
+ * Return zero if *shost and *ioc are not NULL otherwise return error number.
10126
+ */
10127
+static int
10128
+_scsih_get_shost_and_ioc(struct pci_dev *pdev,
10129
+ struct Scsi_Host **shost, struct MPT3SAS_ADAPTER **ioc)
10130
+{
10131
+ *shost = pci_get_drvdata(pdev);
10132
+ if (*shost == NULL) {
10133
+ dev_err(&pdev->dev, "pdev's driver data is null\n");
10134
+ return -ENXIO;
10135
+ }
10136
+
10137
+ *ioc = shost_priv(*shost);
10138
+ if (*ioc == NULL) {
10139
+ dev_err(&pdev->dev, "shost's private data is null\n");
10140
+ return -ENXIO;
10141
+ }
10142
+
10143
+ return 0;
982510144 }
982610145
982710146 /**
....@@ -9832,14 +10151,18 @@
983210151 */
983310152 static void scsih_remove(struct pci_dev *pdev)
983410153 {
9835
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
9836
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
10154
+ struct Scsi_Host *shost;
10155
+ struct MPT3SAS_ADAPTER *ioc;
983710156 struct _sas_port *mpt3sas_port, *next_port;
983810157 struct _raid_device *raid_device, *next;
983910158 struct MPT3SAS_TARGET *sas_target_priv_data;
984010159 struct _pcie_device *pcie_device, *pcienext;
984110160 struct workqueue_struct *wq;
984210161 unsigned long flags;
10162
+ Mpi2ConfigReply_t mpi_reply;
10163
+
10164
+ if (_scsih_get_shost_and_ioc(pdev, &shost, &ioc))
10165
+ return;
984310166
984410167 ioc->remove_host = 1;
984510168
....@@ -9854,9 +10177,16 @@
985410177 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
985510178 if (wq)
985610179 destroy_workqueue(wq);
9857
-
10180
+ /*
10181
+ * Copy back the unmodified ioc page1. so that on next driver load,
10182
+ * current modified changes on ioc page1 won't take effect.
10183
+ */
10184
+ if (ioc->is_aero_ioc)
10185
+ mpt3sas_config_set_ioc_pg1(ioc, &mpi_reply,
10186
+ &ioc->ioc_pg1_copy);
985810187 /* release all the volumes */
985910188 _scsih_ir_shutdown(ioc);
10189
+ mpt3sas_destroy_debugfs(ioc);
986010190 sas_remove_host(shost);
986110191 list_for_each_entry_safe(raid_device, next, &ioc->raid_device_list,
986210192 list) {
....@@ -9866,9 +10196,8 @@
986610196 sas_target_priv_data->deleted = 1;
986710197 scsi_remove_target(&raid_device->starget->dev);
986810198 }
9869
- pr_info(MPT3SAS_FMT "removing handle(0x%04x), wwid(0x%016llx)\n",
9870
- ioc->name, raid_device->handle,
9871
- (unsigned long long) raid_device->wwid);
10199
+ ioc_info(ioc, "removing handle(0x%04x), wwid(0x%016llx)\n",
10200
+ raid_device->handle, (u64)raid_device->wwid);
987210201 _scsih_raid_device_remove(ioc, raid_device);
987310202 }
987410203 list_for_each_entry_safe(pcie_device, pcienext, &ioc->pcie_device_list,
....@@ -9914,10 +10243,14 @@
991410243 static void
991510244 scsih_shutdown(struct pci_dev *pdev)
991610245 {
9917
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
9918
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
10246
+ struct Scsi_Host *shost;
10247
+ struct MPT3SAS_ADAPTER *ioc;
991910248 struct workqueue_struct *wq;
992010249 unsigned long flags;
10250
+ Mpi2ConfigReply_t mpi_reply;
10251
+
10252
+ if (_scsih_get_shost_and_ioc(pdev, &shost, &ioc))
10253
+ return;
992110254
992210255 ioc->remove_host = 1;
992310256
....@@ -9932,8 +10265,16 @@
993210265 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
993310266 if (wq)
993410267 destroy_workqueue(wq);
10268
+ /*
10269
+ * Copy back the unmodified ioc page1 so that on next driver load,
10270
+ * current modified changes on ioc page1 won't take effect.
10271
+ */
10272
+ if (ioc->is_aero_ioc)
10273
+ mpt3sas_config_set_ioc_pg1(ioc, &mpi_reply,
10274
+ &ioc->ioc_pg1_copy);
993510275
993610276 _scsih_ir_shutdown(ioc);
10277
+ _scsih_nvme_shutdown(ioc);
993710278 mpt3sas_base_detach(ioc);
993810279 }
993910280
....@@ -10194,6 +10535,12 @@
1019410535 pcie_device_put(pcie_device);
1019510536 continue;
1019610537 }
10538
+ if (pcie_device->access_status ==
10539
+ MPI26_PCIEDEV0_ASTATUS_DEVICE_BLOCKED) {
10540
+ pcie_device_make_active(ioc, pcie_device);
10541
+ pcie_device_put(pcie_device);
10542
+ continue;
10543
+ }
1019710544 rc = scsi_add_device(ioc->shost, PCIE_CHANNEL,
1019810545 pcie_device->id, 0);
1019910546 if (rc) {
....@@ -10270,6 +10617,8 @@
1027010617 int rc;
1027110618 if (diag_buffer_enable != -1 && diag_buffer_enable != 0)
1027210619 mpt3sas_enable_diag_buffer(ioc, diag_buffer_enable);
10620
+ else if (ioc->manu_pg11.HostTraceBufferMaxSizeKB != 0)
10621
+ mpt3sas_enable_diag_buffer(ioc, 1);
1027310622
1027410623 if (disable_discovery > 0)
1027510624 return;
....@@ -10278,7 +10627,7 @@
1027810627 rc = mpt3sas_port_enable(ioc);
1027910628
1028010629 if (rc != 0)
10281
- pr_info(MPT3SAS_FMT "port enable: FAILED\n", ioc->name);
10630
+ ioc_info(ioc, "port enable: FAILED\n");
1028210631 }
1028310632
1028410633 /**
....@@ -10303,9 +10652,7 @@
1030310652
1030410653 if (time >= (300 * HZ)) {
1030510654 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
10306
- pr_info(MPT3SAS_FMT
10307
- "port enable: FAILED with timeout (timeout=300s)\n",
10308
- ioc->name);
10655
+ ioc_info(ioc, "port enable: FAILED with timeout (timeout=300s)\n");
1030910656 ioc->is_driver_loading = 0;
1031010657 return 1;
1031110658 }
....@@ -10314,16 +10661,15 @@
1031410661 return 0;
1031510662
1031610663 if (ioc->start_scan_failed) {
10317
- pr_info(MPT3SAS_FMT
10318
- "port enable: FAILED with (ioc_status=0x%08x)\n",
10319
- ioc->name, ioc->start_scan_failed);
10664
+ ioc_info(ioc, "port enable: FAILED with (ioc_status=0x%08x)\n",
10665
+ ioc->start_scan_failed);
1032010666 ioc->is_driver_loading = 0;
1032110667 ioc->wait_for_discovery_to_complete = 0;
1032210668 ioc->remove_host = 1;
1032310669 return 1;
1032410670 }
1032510671
10326
- pr_info(MPT3SAS_FMT "port enable: SUCCESS\n", ioc->name);
10672
+ ioc_info(ioc, "port enable: SUCCESS\n");
1032710673 ioc->port_enable_cmds.status = MPT3_CMD_NOT_USED;
1032810674
1032910675 if (ioc->wait_for_discovery_to_complete) {
....@@ -10359,7 +10705,6 @@
1035910705 .sg_tablesize = MPT2SAS_SG_DEPTH,
1036010706 .max_sectors = 32767,
1036110707 .cmd_per_lun = 7,
10362
- .use_clustering = ENABLE_CLUSTERING,
1036310708 .shost_attrs = mpt3sas_host_attrs,
1036410709 .sdev_attrs = mpt3sas_dev_attrs,
1036510710 .track_queue_depth = 1,
....@@ -10397,8 +10742,8 @@
1039710742 .this_id = -1,
1039810743 .sg_tablesize = MPT3SAS_SG_DEPTH,
1039910744 .max_sectors = 32767,
10745
+ .max_segment_size = 0xffffffff,
1040010746 .cmd_per_lun = 7,
10401
- .use_clustering = ENABLE_CLUSTERING,
1040210747 .shost_attrs = mpt3sas_host_attrs,
1040310748 .sdev_attrs = mpt3sas_dev_attrs,
1040410749 .track_queue_depth = 1,
....@@ -10444,7 +10789,8 @@
1044410789 case MPI2_MFGPAGE_DEVID_SAS2308_1:
1044510790 case MPI2_MFGPAGE_DEVID_SAS2308_2:
1044610791 case MPI2_MFGPAGE_DEVID_SAS2308_3:
10447
- case MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP:
10792
+ case MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP:
10793
+ case MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP_1:
1044810794 return MPI2_VERSION;
1044910795 case MPI25_MFGPAGE_DEVID_SAS3004:
1045010796 case MPI25_MFGPAGE_DEVID_SAS3008:
....@@ -10470,6 +10816,15 @@
1047010816 case MPI26_MFGPAGE_DEVID_SAS3516_1:
1047110817 case MPI26_MFGPAGE_DEVID_SAS3416:
1047210818 case MPI26_MFGPAGE_DEVID_SAS3616:
10819
+ case MPI26_ATLAS_PCIe_SWITCH_DEVID:
10820
+ case MPI26_MFGPAGE_DEVID_CFG_SEC_3916:
10821
+ case MPI26_MFGPAGE_DEVID_HARD_SEC_3916:
10822
+ case MPI26_MFGPAGE_DEVID_CFG_SEC_3816:
10823
+ case MPI26_MFGPAGE_DEVID_HARD_SEC_3816:
10824
+ case MPI26_MFGPAGE_DEVID_INVALID0_3916:
10825
+ case MPI26_MFGPAGE_DEVID_INVALID1_3916:
10826
+ case MPI26_MFGPAGE_DEVID_INVALID0_3816:
10827
+ case MPI26_MFGPAGE_DEVID_INVALID1_3816:
1047310828 return MPI26_VERSION;
1047410829 }
1047510830 return 0;
....@@ -10527,7 +10882,8 @@
1052710882 ioc->is_warpdrive = 1;
1052810883 ioc->hide_ir_msg = 1;
1052910884 break;
10530
- case MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP:
10885
+ case MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP:
10886
+ case MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP_1:
1053110887 ioc->is_mcpu_endpoint = 1;
1053210888 break;
1053310889 default:
....@@ -10555,10 +10911,34 @@
1055510911 case MPI26_MFGPAGE_DEVID_SAS3516_1:
1055610912 case MPI26_MFGPAGE_DEVID_SAS3416:
1055710913 case MPI26_MFGPAGE_DEVID_SAS3616:
10914
+ case MPI26_ATLAS_PCIe_SWITCH_DEVID:
1055810915 ioc->is_gen35_ioc = 1;
1055910916 break;
10917
+ case MPI26_MFGPAGE_DEVID_INVALID0_3816:
10918
+ case MPI26_MFGPAGE_DEVID_INVALID0_3916:
10919
+ dev_err(&pdev->dev,
10920
+ "HBA with DeviceId 0x%04x, sub VendorId 0x%04x, sub DeviceId 0x%04x is Invalid",
10921
+ pdev->device, pdev->subsystem_vendor,
10922
+ pdev->subsystem_device);
10923
+ return 1;
10924
+ case MPI26_MFGPAGE_DEVID_INVALID1_3816:
10925
+ case MPI26_MFGPAGE_DEVID_INVALID1_3916:
10926
+ dev_err(&pdev->dev,
10927
+ "HBA with DeviceId 0x%04x, sub VendorId 0x%04x, sub DeviceId 0x%04x is Tampered",
10928
+ pdev->device, pdev->subsystem_vendor,
10929
+ pdev->subsystem_device);
10930
+ return 1;
10931
+ case MPI26_MFGPAGE_DEVID_CFG_SEC_3816:
10932
+ case MPI26_MFGPAGE_DEVID_CFG_SEC_3916:
10933
+ dev_info(&pdev->dev,
10934
+ "HBA is in Configurable Secure mode\n");
10935
+ fallthrough;
10936
+ case MPI26_MFGPAGE_DEVID_HARD_SEC_3816:
10937
+ case MPI26_MFGPAGE_DEVID_HARD_SEC_3916:
10938
+ ioc->is_aero_ioc = ioc->is_gen35_ioc = 1;
10939
+ break;
1056010940 default:
10561
- ioc->is_gen35_ioc = 0;
10941
+ ioc->is_gen35_ioc = ioc->is_aero_ioc = 0;
1056210942 }
1056310943 if ((ioc->hba_mpi_version_belonged == MPI25_VERSION &&
1056410944 pdev->revision >= SAS3_PCI_DEVICE_C0_REVISION) ||
....@@ -10595,6 +10975,15 @@
1059510975 ioc->tm_sas_control_cb_idx = tm_sas_control_cb_idx;
1059610976 ioc->logging_level = logging_level;
1059710977 ioc->schedule_dead_ioc_flush_running_cmds = &_scsih_flush_running_cmds;
10978
+ /* Host waits for minimum of six seconds */
10979
+ ioc->max_shutdown_latency = IO_UNIT_CONTROL_SHUTDOWN_TIMEOUT;
10980
+ /*
10981
+ * Enable MEMORY MOVE support flag.
10982
+ */
10983
+ ioc->drv_support_bitmap |= MPT_DRV_SUPPORT_BITMAP_MEMMOVE;
10984
+
10985
+ ioc->enable_sdev_max_qd = enable_sdev_max_qd;
10986
+
1059810987 /* misc semaphores and spin locks */
1059910988 mutex_init(&ioc->reset_in_progress_mutex);
1060010989 /* initializing pci_access_mutex lock */
....@@ -10634,34 +11023,28 @@
1063411023 if (ioc->is_mcpu_endpoint) {
1063511024 /* mCPU MPI support 64K max IO */
1063611025 shost->max_sectors = 128;
10637
- pr_info(MPT3SAS_FMT
10638
- "The max_sectors value is set to %d\n",
10639
- ioc->name, shost->max_sectors);
11026
+ ioc_info(ioc, "The max_sectors value is set to %d\n",
11027
+ shost->max_sectors);
1064011028 } else {
1064111029 if (max_sectors != 0xFFFF) {
1064211030 if (max_sectors < 64) {
1064311031 shost->max_sectors = 64;
10644
- pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
10645
- "for max_sectors, range is 64 to 32767. " \
10646
- "Assigning value of 64.\n", \
10647
- ioc->name, max_sectors);
11032
+ ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767. Assigning value of 64.\n",
11033
+ max_sectors);
1064811034 } else if (max_sectors > 32767) {
1064911035 shost->max_sectors = 32767;
10650
- pr_warn(MPT3SAS_FMT "Invalid value %d passed " \
10651
- "for max_sectors, range is 64 to 32767." \
10652
- "Assigning default value of 32767.\n", \
10653
- ioc->name, max_sectors);
11036
+ ioc_warn(ioc, "Invalid value %d passed for max_sectors, range is 64 to 32767.Assigning default value of 32767.\n",
11037
+ max_sectors);
1065411038 } else {
1065511039 shost->max_sectors = max_sectors & 0xFFFE;
10656
- pr_info(MPT3SAS_FMT
10657
- "The max_sectors value is set to %d\n",
10658
- ioc->name, shost->max_sectors);
11040
+ ioc_info(ioc, "The max_sectors value is set to %d\n",
11041
+ shost->max_sectors);
1065911042 }
1066011043 }
1066111044 }
1066211045 /* register EEDP capabilities with SCSI layer */
10663
- if (prot_mask > 0)
10664
- scsi_host_set_prot(shost, prot_mask);
11046
+ if (prot_mask >= 0)
11047
+ scsi_host_set_prot(shost, (prot_mask & 0x07));
1066511048 else
1066611049 scsi_host_set_prot(shost, SHOST_DIF_TYPE1_PROTECTION
1066711050 | SHOST_DIF_TYPE2_PROTECTION
....@@ -10675,16 +11058,16 @@
1067511058 ioc->firmware_event_thread = alloc_ordered_workqueue(
1067611059 ioc->firmware_event_name, 0);
1067711060 if (!ioc->firmware_event_thread) {
10678
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
10679
- ioc->name, __FILE__, __LINE__, __func__);
11061
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
11062
+ __FILE__, __LINE__, __func__);
1068011063 rv = -ENODEV;
1068111064 goto out_thread_fail;
1068211065 }
1068311066
1068411067 ioc->is_driver_loading = 1;
1068511068 if ((mpt3sas_base_attach(ioc))) {
10686
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
10687
- ioc->name, __FILE__, __LINE__, __func__);
11069
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
11070
+ __FILE__, __LINE__, __func__);
1068811071 rv = -ENODEV;
1068911072 goto out_attach_fail;
1069011073 }
....@@ -10705,12 +11088,13 @@
1070511088
1070611089 rv = scsi_add_host(shost, &pdev->dev);
1070711090 if (rv) {
10708
- pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
10709
- ioc->name, __FILE__, __LINE__, __func__);
11091
+ ioc_err(ioc, "failure at %s:%d/%s()!\n",
11092
+ __FILE__, __LINE__, __func__);
1071011093 goto out_add_shost_fail;
1071111094 }
1071211095
1071311096 scsi_scan_host(shost);
11097
+ mpt3sas_setup_debugfs(ioc);
1071411098 return 0;
1071511099 out_add_shost_fail:
1071611100 mpt3sas_base_detach(ioc);
....@@ -10735,17 +11119,22 @@
1073511119 static int
1073611120 scsih_suspend(struct pci_dev *pdev, pm_message_t state)
1073711121 {
10738
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
10739
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
11122
+ struct Scsi_Host *shost;
11123
+ struct MPT3SAS_ADAPTER *ioc;
1074011124 pci_power_t device_state;
11125
+ int rc;
11126
+
11127
+ rc = _scsih_get_shost_and_ioc(pdev, &shost, &ioc);
11128
+ if (rc)
11129
+ return rc;
1074111130
1074211131 mpt3sas_base_stop_watchdog(ioc);
1074311132 flush_scheduled_work();
1074411133 scsi_block_requests(shost);
11134
+ _scsih_nvme_shutdown(ioc);
1074511135 device_state = pci_choose_state(pdev, state);
10746
- pr_info(MPT3SAS_FMT
10747
- "pdev=0x%p, slot=%s, entering operating state [D%d]\n",
10748
- ioc->name, pdev, pci_name(pdev), device_state);
11136
+ ioc_info(ioc, "pdev=0x%p, slot=%s, entering operating state [D%d]\n",
11137
+ pdev, pci_name(pdev), device_state);
1074911138
1075011139 pci_save_state(pdev);
1075111140 mpt3sas_base_free_resources(ioc);
....@@ -10762,14 +11151,17 @@
1076211151 static int
1076311152 scsih_resume(struct pci_dev *pdev)
1076411153 {
10765
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
10766
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
11154
+ struct Scsi_Host *shost;
11155
+ struct MPT3SAS_ADAPTER *ioc;
1076711156 pci_power_t device_state = pdev->current_state;
1076811157 int r;
1076911158
10770
- pr_info(MPT3SAS_FMT
10771
- "pdev=0x%p, slot=%s, previous operating state [D%d]\n",
10772
- ioc->name, pdev, pci_name(pdev), device_state);
11159
+ r = _scsih_get_shost_and_ioc(pdev, &shost, &ioc);
11160
+ if (r)
11161
+ return r;
11162
+
11163
+ ioc_info(ioc, "pdev=0x%p, slot=%s, previous operating state [D%d]\n",
11164
+ pdev, pci_name(pdev), device_state);
1077311165
1077411166 pci_set_power_state(pdev, PCI_D0);
1077511167 pci_enable_wake(pdev, PCI_D0, 0);
....@@ -10778,7 +11170,7 @@
1077811170 r = mpt3sas_base_map_resources(ioc);
1077911171 if (r)
1078011172 return r;
10781
-
11173
+ ioc_info(ioc, "Issuing Hard Reset as part of OS Resume\n");
1078211174 mpt3sas_base_hard_reset_handler(ioc, SOFT_RESET);
1078311175 scsi_unblock_requests(shost);
1078411176 mpt3sas_base_start_watchdog(ioc);
....@@ -10798,11 +11190,13 @@
1079811190 static pci_ers_result_t
1079911191 scsih_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
1080011192 {
10801
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
10802
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
11193
+ struct Scsi_Host *shost;
11194
+ struct MPT3SAS_ADAPTER *ioc;
1080311195
10804
- pr_info(MPT3SAS_FMT "PCI error: detected callback, state(%d)!!\n",
10805
- ioc->name, state);
11196
+ if (_scsih_get_shost_and_ioc(pdev, &shost, &ioc))
11197
+ return PCI_ERS_RESULT_DISCONNECT;
11198
+
11199
+ ioc_info(ioc, "PCI error: detected callback, state(%d)!!\n", state);
1080611200
1080711201 switch (state) {
1080811202 case pci_channel_io_normal:
....@@ -10835,12 +11229,14 @@
1083511229 static pci_ers_result_t
1083611230 scsih_pci_slot_reset(struct pci_dev *pdev)
1083711231 {
10838
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
10839
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
11232
+ struct Scsi_Host *shost;
11233
+ struct MPT3SAS_ADAPTER *ioc;
1084011234 int rc;
1084111235
10842
- pr_info(MPT3SAS_FMT "PCI error: slot reset callback!!\n",
10843
- ioc->name);
11236
+ if (_scsih_get_shost_and_ioc(pdev, &shost, &ioc))
11237
+ return PCI_ERS_RESULT_DISCONNECT;
11238
+
11239
+ ioc_info(ioc, "PCI error: slot reset callback!!\n");
1084411240
1084511241 ioc->pci_error_recovery = 0;
1084611242 ioc->pdev = pdev;
....@@ -10849,10 +11245,11 @@
1084911245 if (rc)
1085011246 return PCI_ERS_RESULT_DISCONNECT;
1085111247
11248
+ ioc_info(ioc, "Issuing Hard Reset as part of PCI Slot Reset\n");
1085211249 rc = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1085311250
10854
- pr_warn(MPT3SAS_FMT "hard reset: %s\n", ioc->name,
10855
- (rc == 0) ? "success" : "failed");
11251
+ ioc_warn(ioc, "hard reset: %s\n",
11252
+ (rc == 0) ? "success" : "failed");
1085611253
1085711254 if (!rc)
1085811255 return PCI_ERS_RESULT_RECOVERED;
....@@ -10871,12 +11268,14 @@
1087111268 static void
1087211269 scsih_pci_resume(struct pci_dev *pdev)
1087311270 {
10874
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
10875
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
11271
+ struct Scsi_Host *shost;
11272
+ struct MPT3SAS_ADAPTER *ioc;
1087611273
10877
- pr_info(MPT3SAS_FMT "PCI error: resume callback!!\n", ioc->name);
11274
+ if (_scsih_get_shost_and_ioc(pdev, &shost, &ioc))
11275
+ return;
1087811276
10879
- pci_cleanup_aer_uncorrect_error_status(pdev);
11277
+ ioc_info(ioc, "PCI error: resume callback!!\n");
11278
+
1088011279 mpt3sas_base_start_watchdog(ioc);
1088111280 scsi_unblock_requests(ioc->shost);
1088211281 }
....@@ -10888,11 +11287,13 @@
1088811287 static pci_ers_result_t
1088911288 scsih_pci_mmio_enabled(struct pci_dev *pdev)
1089011289 {
10891
- struct Scsi_Host *shost = pci_get_drvdata(pdev);
10892
- struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
11290
+ struct Scsi_Host *shost;
11291
+ struct MPT3SAS_ADAPTER *ioc;
1089311292
10894
- pr_info(MPT3SAS_FMT "PCI error: mmio enabled callback!!\n",
10895
- ioc->name);
11293
+ if (_scsih_get_shost_and_ioc(pdev, &shost, &ioc))
11294
+ return PCI_ERS_RESULT_DISCONNECT;
11295
+
11296
+ ioc_info(ioc, "PCI error: mmio enabled callback!!\n");
1089611297
1089711298 /* TODO - dump whatever for debugging purposes */
1089811299
....@@ -10970,7 +11371,9 @@
1097011371 PCI_ANY_ID, PCI_ANY_ID },
1097111372 { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_3,
1097211373 PCI_ANY_ID, PCI_ANY_ID },
10973
- { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_MPI_EP,
11374
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP,
11375
+ PCI_ANY_ID, PCI_ANY_ID },
11376
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SWITCH_MPI_EP_1,
1097411377 PCI_ANY_ID, PCI_ANY_ID },
1097511378 /* SSS6200 */
1097611379 { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SSS6200,
....@@ -11027,6 +11430,43 @@
1102711430 /* Mercator ~ 3616*/
1102811431 { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_SAS3616,
1102911432 PCI_ANY_ID, PCI_ANY_ID },
11433
+
11434
+ /* Aero SI 0x00E1 Configurable Secure
11435
+ * 0x00E2 Hard Secure
11436
+ */
11437
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_CFG_SEC_3916,
11438
+ PCI_ANY_ID, PCI_ANY_ID },
11439
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_HARD_SEC_3916,
11440
+ PCI_ANY_ID, PCI_ANY_ID },
11441
+
11442
+ /*
11443
+ * Aero SI –> 0x00E0 Invalid, 0x00E3 Tampered
11444
+ */
11445
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_INVALID0_3916,
11446
+ PCI_ANY_ID, PCI_ANY_ID },
11447
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_INVALID1_3916,
11448
+ PCI_ANY_ID, PCI_ANY_ID },
11449
+
11450
+ /* Atlas PCIe Switch Management Port */
11451
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_ATLAS_PCIe_SWITCH_DEVID,
11452
+ PCI_ANY_ID, PCI_ANY_ID },
11453
+
11454
+ /* Sea SI 0x00E5 Configurable Secure
11455
+ * 0x00E6 Hard Secure
11456
+ */
11457
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_CFG_SEC_3816,
11458
+ PCI_ANY_ID, PCI_ANY_ID },
11459
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_HARD_SEC_3816,
11460
+ PCI_ANY_ID, PCI_ANY_ID },
11461
+
11462
+ /*
11463
+ * Sea SI –> 0x00E4 Invalid, 0x00E7 Tampered
11464
+ */
11465
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_INVALID0_3816,
11466
+ PCI_ANY_ID, PCI_ANY_ID },
11467
+ { MPI2_MFGPAGE_VENDORID_LSI, MPI26_MFGPAGE_DEVID_INVALID1_3816,
11468
+ PCI_ANY_ID, PCI_ANY_ID },
11469
+
1103011470 {0} /* Terminating entry */
1103111471 };
1103211472 MODULE_DEVICE_TABLE(pci, mpt3sas_pci_table);
....@@ -11098,6 +11538,7 @@
1109811538 tm_sas_control_cb_idx = mpt3sas_base_register_callback_handler(
1109911539 _scsih_sas_control_complete);
1110011540
11541
+ mpt3sas_init_debugfs();
1110111542 return 0;
1110211543 }
1110311544
....@@ -11129,6 +11570,7 @@
1112911570 if (hbas_to_enumerate != 2)
1113011571 raid_class_release(mpt2sas_raid_template);
1113111572 sas_release_transport(mpt3sas_transport_template);
11573
+ mpt3sas_exit_debugfs();
1113211574 }
1113311575
1113411576 /**