diff options
author | Jiri Kosina <jkosina@suse.cz> | 2014-11-20 08:42:02 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-11-20 08:42:02 -0500 |
commit | a02001086bbfb4da35d1228bebc2f1b442db455f (patch) | |
tree | 62ab47936cef06fd08657ca5b6cd1df98c19be57 /drivers/scsi/mpt2sas | |
parent | eff264efeeb0898408e8c9df72d8a32621035bed (diff) | |
parent | fc14f9c1272f62c3e8d01300f52467c0d9af50f9 (diff) |
Merge Linus' tree to be be to apply submitted patches to newer code than
current trivial.git base
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r-- | drivers/scsi/mpt2sas/Kconfig | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2.h | 12 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h | 29 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2_init.h | 8 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2_ioc.h | 74 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2_raid.h | 8 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2_sas.h | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2_tool.h | 44 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpi/mpi2_type.h | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.c | 328 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.h | 28 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_config.c | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_ctl.c | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_ctl.h | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_debug.h | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_scsih.c | 197 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 2 |
17 files changed, 551 insertions, 193 deletions
diff --git a/drivers/scsi/mpt2sas/Kconfig b/drivers/scsi/mpt2sas/Kconfig index 39f08dd20556..657b45ca04c5 100644 --- a/drivers/scsi/mpt2sas/Kconfig +++ b/drivers/scsi/mpt2sas/Kconfig | |||
@@ -2,7 +2,7 @@ | |||
2 | # Kernel configuration file for the MPT2SAS | 2 | # Kernel configuration file for the MPT2SAS |
3 | # | 3 | # |
4 | # This code is based on drivers/scsi/mpt2sas/Kconfig | 4 | # This code is based on drivers/scsi/mpt2sas/Kconfig |
5 | # Copyright (C) 2007-2012 LSI Corporation | 5 | # Copyright (C) 2007-2014 LSI Corporation |
6 | # (mailto:DL-MPTFusionLinux@lsi.com) | 6 | # (mailto:DL-MPTFusionLinux@lsi.com) |
7 | 7 | ||
8 | # This program is free software; you can redistribute it and/or | 8 | # This program is free software; you can redistribute it and/or |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2.h b/drivers/scsi/mpt2sas/mpi/mpi2.h index 7b14a015c903..088eefa67da8 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2.h | 5 | * Name: mpi2.h |
@@ -8,7 +8,7 @@ | |||
8 | * scatter/gather formats. | 8 | * scatter/gather formats. |
9 | * Creation Date: June 21, 2006 | 9 | * Creation Date: June 21, 2006 |
10 | * | 10 | * |
11 | * mpi2.h Version: 02.00.28 | 11 | * mpi2.h Version: 02.00.32 |
12 | * | 12 | * |
13 | * Version History | 13 | * Version History |
14 | * --------------- | 14 | * --------------- |
@@ -78,6 +78,11 @@ | |||
78 | * 07-10-12 02.00.26 Bumped MPI2_HEADER_VERSION_UNIT. | 78 | * 07-10-12 02.00.26 Bumped MPI2_HEADER_VERSION_UNIT. |
79 | * 07-26-12 02.00.27 Bumped MPI2_HEADER_VERSION_UNIT. | 79 | * 07-26-12 02.00.27 Bumped MPI2_HEADER_VERSION_UNIT. |
80 | * 11-27-12 02.00.28 Bumped MPI2_HEADER_VERSION_UNIT. | 80 | * 11-27-12 02.00.28 Bumped MPI2_HEADER_VERSION_UNIT. |
81 | * 12-20-12 02.00.29 Bumped MPI2_HEADER_VERSION_UNIT. | ||
82 | * Added MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET. | ||
83 | * 04-09-13 02.00.30 Bumped MPI2_HEADER_VERSION_UNIT. | ||
84 | * 04-17-13 02.00.31 Bumped MPI2_HEADER_VERSION_UNIT. | ||
85 | * 08-19-13 02.00.32 Bumped MPI2_HEADER_VERSION_UNIT. | ||
81 | * -------------------------------------------------------------------------- | 86 | * -------------------------------------------------------------------------- |
82 | */ | 87 | */ |
83 | 88 | ||
@@ -103,7 +108,7 @@ | |||
103 | #define MPI2_VERSION_02_00 (0x0200) | 108 | #define MPI2_VERSION_02_00 (0x0200) |
104 | 109 | ||
105 | /* versioning for this MPI header set */ | 110 | /* versioning for this MPI header set */ |
106 | #define MPI2_HEADER_VERSION_UNIT (0x1C) | 111 | #define MPI2_HEADER_VERSION_UNIT (0x20) |
107 | #define MPI2_HEADER_VERSION_DEV (0x00) | 112 | #define MPI2_HEADER_VERSION_DEV (0x00) |
108 | #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) | 113 | #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) |
109 | #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) | 114 | #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) |
@@ -263,6 +268,7 @@ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS | |||
263 | #define MPI2_REPLY_POST_HOST_INDEX_MASK (0x00FFFFFF) | 268 | #define MPI2_REPLY_POST_HOST_INDEX_MASK (0x00FFFFFF) |
264 | #define MPI2_RPHI_MSIX_INDEX_MASK (0xFF000000) | 269 | #define MPI2_RPHI_MSIX_INDEX_MASK (0xFF000000) |
265 | #define MPI2_RPHI_MSIX_INDEX_SHIFT (24) | 270 | #define MPI2_RPHI_MSIX_INDEX_SHIFT (24) |
271 | #define MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET (0x0000030C) /* MPI v2.5 only */ | ||
266 | 272 | ||
267 | /* | 273 | /* |
268 | * Defines for the HCBSize and address | 274 | * Defines for the HCBSize and address |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h index 88cb7f828bbd..510ef0dc8d7b 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_cnfg.h | 5 | * Name: mpi2_cnfg.h |
6 | * Title: MPI Configuration messages and pages | 6 | * Title: MPI Configuration messages and pages |
7 | * Creation Date: November 10, 2006 | 7 | * Creation Date: November 10, 2006 |
8 | * | 8 | * |
9 | * mpi2_cnfg.h Version: 02.00.23 | 9 | * mpi2_cnfg.h Version: 02.00.26 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -150,7 +150,13 @@ | |||
150 | * Added UEFIVersion field to BIOS Page 1 and defined new | 150 | * Added UEFIVersion field to BIOS Page 1 and defined new |
151 | * BiosOptions bits. | 151 | * BiosOptions bits. |
152 | * 11-27-12 02.00.23 Added MPI2_MANPAGE7_FLAG_EVENTREPLAY_SLOT_ORDER. | 152 | * 11-27-12 02.00.23 Added MPI2_MANPAGE7_FLAG_EVENTREPLAY_SLOT_ORDER. |
153 | * Added MPI2_BIOSPAGE1_OPTIONS_MASK_OEM_ID. | 153 | * Added MPI2_BIOSPAGE1_OPTIONS_MASK_OEM_ID. |
154 | * 12-20-12 02.00.24 Marked MPI2_SASIOUNIT1_CONTROL_CLEAR_AFFILIATION as | ||
155 | * obsolete for MPI v2.5 and later. | ||
156 | * Added some defines for 12G SAS speeds. | ||
157 | * 04-09-13 02.00.25 Added MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK. | ||
158 | * Fixed MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS to | ||
159 | * match the specification. | ||
154 | * -------------------------------------------------------------------------- | 160 | * -------------------------------------------------------------------------- |
155 | */ | 161 | */ |
156 | 162 | ||
@@ -773,6 +779,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_1 | |||
773 | #define MPI2_IOUNITPAGE1_PAGEVERSION (0x04) | 779 | #define MPI2_IOUNITPAGE1_PAGEVERSION (0x04) |
774 | 780 | ||
775 | /* IO Unit Page 1 Flags defines */ | 781 | /* IO Unit Page 1 Flags defines */ |
782 | #define MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK (0x00004000) | ||
776 | #define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY (0x00000800) | 783 | #define MPI2_IOUNITPAGE1_ENABLE_HOST_BASED_DISCOVERY (0x00000800) |
777 | #define MPI2_IOUNITPAGE1_MASK_SATA_WRITE_CACHE (0x00000600) | 784 | #define MPI2_IOUNITPAGE1_MASK_SATA_WRITE_CACHE (0x00000600) |
778 | #define MPI2_IOUNITPAGE1_SATA_WRITE_CACHE_SHIFT (9) | 785 | #define MPI2_IOUNITPAGE1_SATA_WRITE_CACHE_SHIFT (9) |
@@ -844,7 +851,7 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_5 { | |||
844 | #define MPI2_IOUNITPAGE5_PAGEVERSION (0x00) | 851 | #define MPI2_IOUNITPAGE5_PAGEVERSION (0x00) |
845 | 852 | ||
846 | /* defines for IO Unit Page 5 DmaEngineCapabilities field */ | 853 | /* defines for IO Unit Page 5 DmaEngineCapabilities field */ |
847 | #define MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS (0xFF00) | 854 | #define MPI2_IOUNITPAGE5_DMA_CAP_MASK_MAX_REQUESTS (0xFFFF0000) |
848 | #define MPI2_IOUNITPAGE5_DMA_CAP_SHIFT_MAX_REQUESTS (16) | 855 | #define MPI2_IOUNITPAGE5_DMA_CAP_SHIFT_MAX_REQUESTS (16) |
849 | 856 | ||
850 | #define MPI2_IOUNITPAGE5_DMA_CAP_EEDP (0x0008) | 857 | #define MPI2_IOUNITPAGE5_DMA_CAP_EEDP (0x0008) |
@@ -885,13 +892,17 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_7 { | |||
885 | U16 IOCTemperature; /* 0x10 */ | 892 | U16 IOCTemperature; /* 0x10 */ |
886 | U8 IOCTemperatureUnits; /* 0x12 */ | 893 | U8 IOCTemperatureUnits; /* 0x12 */ |
887 | U8 IOCSpeed; /* 0x13 */ | 894 | U8 IOCSpeed; /* 0x13 */ |
888 | U16 BoardTemperature; /* 0x14 */ | 895 | U16 BoardTemperature; /* 0x14 */ |
889 | U8 BoardTemperatureUnits; /* 0x16 */ | 896 | U8 BoardTemperatureUnits; /* 0x16 */ |
890 | U8 Reserved3; /* 0x17 */ | 897 | U8 Reserved3; /* 0x17 */ |
898 | U32 Reserved4; /* 0x18 */ | ||
899 | U32 Reserved5; /* 0x1C */ | ||
900 | U32 Reserved6; /* 0x20 */ | ||
901 | U32 Reserved7; /* 0x24 */ | ||
891 | } MPI2_CONFIG_PAGE_IO_UNIT_7, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_IO_UNIT_7, | 902 | } MPI2_CONFIG_PAGE_IO_UNIT_7, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_IO_UNIT_7, |
892 | Mpi2IOUnitPage7_t, MPI2_POINTER pMpi2IOUnitPage7_t; | 903 | Mpi2IOUnitPage7_t, MPI2_POINTER pMpi2IOUnitPage7_t; |
893 | 904 | ||
894 | #define MPI2_IOUNITPAGE7_PAGEVERSION (0x02) | 905 | #define MPI2_IOUNITPAGE7_PAGEVERSION (0x04) |
895 | 906 | ||
896 | /* defines for IO Unit Page 7 PCIeWidth field */ | 907 | /* defines for IO Unit Page 7 PCIeWidth field */ |
897 | #define MPI2_IOUNITPAGE7_PCIE_WIDTH_X1 (0x01) | 908 | #define MPI2_IOUNITPAGE7_PCIE_WIDTH_X1 (0x01) |
@@ -1801,6 +1812,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDISK_1 | |||
1801 | #define MPI2_SAS_PRATE_MAX_RATE_1_5 (0x80) | 1812 | #define MPI2_SAS_PRATE_MAX_RATE_1_5 (0x80) |
1802 | #define MPI2_SAS_PRATE_MAX_RATE_3_0 (0x90) | 1813 | #define MPI2_SAS_PRATE_MAX_RATE_3_0 (0x90) |
1803 | #define MPI2_SAS_PRATE_MAX_RATE_6_0 (0xA0) | 1814 | #define MPI2_SAS_PRATE_MAX_RATE_6_0 (0xA0) |
1815 | #define MPI25_SAS_PRATE_MAX_RATE_12_0 (0xB0) | ||
1804 | #define MPI2_SAS_PRATE_MIN_RATE_MASK (0x0F) | 1816 | #define MPI2_SAS_PRATE_MIN_RATE_MASK (0x0F) |
1805 | #define MPI2_SAS_PRATE_MIN_RATE_NOT_PROGRAMMABLE (0x00) | 1817 | #define MPI2_SAS_PRATE_MIN_RATE_NOT_PROGRAMMABLE (0x00) |
1806 | #define MPI2_SAS_PRATE_MIN_RATE_1_5 (0x08) | 1818 | #define MPI2_SAS_PRATE_MIN_RATE_1_5 (0x08) |
@@ -1813,6 +1825,7 @@ typedef struct _MPI2_CONFIG_PAGE_RD_PDISK_1 | |||
1813 | #define MPI2_SAS_HWRATE_MAX_RATE_1_5 (0x80) | 1825 | #define MPI2_SAS_HWRATE_MAX_RATE_1_5 (0x80) |
1814 | #define MPI2_SAS_HWRATE_MAX_RATE_3_0 (0x90) | 1826 | #define MPI2_SAS_HWRATE_MAX_RATE_3_0 (0x90) |
1815 | #define MPI2_SAS_HWRATE_MAX_RATE_6_0 (0xA0) | 1827 | #define MPI2_SAS_HWRATE_MAX_RATE_6_0 (0xA0) |
1828 | #define MPI25_SAS_HWRATE_MAX_RATE_12_0 (0xB0) | ||
1816 | #define MPI2_SAS_HWRATE_MIN_RATE_MASK (0x0F) | 1829 | #define MPI2_SAS_HWRATE_MIN_RATE_MASK (0x0F) |
1817 | #define MPI2_SAS_HWRATE_MIN_RATE_1_5 (0x08) | 1830 | #define MPI2_SAS_HWRATE_MIN_RATE_1_5 (0x08) |
1818 | #define MPI2_SAS_HWRATE_MIN_RATE_3_0 (0x09) | 1831 | #define MPI2_SAS_HWRATE_MIN_RATE_3_0 (0x09) |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_init.h b/drivers/scsi/mpt2sas/mpi/mpi2_init.h index 9d284dae6553..eea1a16b13ec 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_init.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_init.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_init.h | 5 | * Name: mpi2_init.h |
6 | * Title: MPI SCSI initiator mode messages and structures | 6 | * Title: MPI SCSI initiator mode messages and structures |
7 | * Creation Date: June 23, 2006 | 7 | * Creation Date: June 23, 2006 |
8 | * | 8 | * |
9 | * mpi2_init.h Version: 02.00.14 | 9 | * mpi2_init.h Version: 02.00.15 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -37,6 +37,8 @@ | |||
37 | * 02-06-12 02.00.13 Added alternate defines for Task Priority / Command | 37 | * 02-06-12 02.00.13 Added alternate defines for Task Priority / Command |
38 | * Priority to match SAM-4. | 38 | * Priority to match SAM-4. |
39 | * 07-10-12 02.00.14 Added MPI2_SCSIIO_CONTROL_SHIFT_DATADIRECTION. | 39 | * 07-10-12 02.00.14 Added MPI2_SCSIIO_CONTROL_SHIFT_DATADIRECTION. |
40 | * 04-09-13 02.00.15 Added SCSIStatusQualifier field to MPI2_SCSI_IO_REPLY, | ||
41 | * replacing the Reserved4 field. | ||
40 | * -------------------------------------------------------------------------- | 42 | * -------------------------------------------------------------------------- |
41 | */ | 43 | */ |
42 | 44 | ||
@@ -234,7 +236,7 @@ typedef struct _MPI2_SCSI_IO_REPLY | |||
234 | U32 SenseCount; /* 0x18 */ | 236 | U32 SenseCount; /* 0x18 */ |
235 | U32 ResponseInfo; /* 0x1C */ | 237 | U32 ResponseInfo; /* 0x1C */ |
236 | U16 TaskTag; /* 0x20 */ | 238 | U16 TaskTag; /* 0x20 */ |
237 | U16 Reserved4; /* 0x22 */ | 239 | U16 SCSIStatusQualifier; /* 0x22 */ |
238 | U32 BidirectionalTransferCount; /* 0x24 */ | 240 | U32 BidirectionalTransferCount; /* 0x24 */ |
239 | U32 Reserved5; /* 0x28 */ | 241 | U32 Reserved5; /* 0x28 */ |
240 | U32 Reserved6; /* 0x2C */ | 242 | U32 Reserved6; /* 0x2C */ |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h b/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h index d159c5f24aab..2c3b0f28576b 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_ioc.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_ioc.h | 5 | * Name: mpi2_ioc.h |
6 | * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages | 6 | * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages |
7 | * Creation Date: October 11, 2006 | 7 | * Creation Date: October 11, 2006 |
8 | * | 8 | * |
9 | * mpi2_ioc.h Version: 02.00.22 | 9 | * mpi2_ioc.h Version: 02.00.23 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -121,6 +121,11 @@ | |||
121 | * 07-26-12 02.00.22 Added MPI2_IOCFACTS_EXCEPT_PARTIAL_MEMORY_FAILURE. | 121 | * 07-26-12 02.00.22 Added MPI2_IOCFACTS_EXCEPT_PARTIAL_MEMORY_FAILURE. |
122 | * Added ElapsedSeconds field to | 122 | * Added ElapsedSeconds field to |
123 | * MPI2_EVENT_DATA_IR_OPERATION_STATUS. | 123 | * MPI2_EVENT_DATA_IR_OPERATION_STATUS. |
124 | * 08-19-13 02.00.23 For IOCInit, added MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE | ||
125 | * and MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY. | ||
126 | * Added MPI2_IOCFACTS_CAPABILITY_RDPQ_ARRAY_CAPABLE. | ||
127 | * Added MPI2_FW_DOWNLOAD_ITYPE_PUBLIC_KEY. | ||
128 | * Added Encrypted Hash Extended Image. | ||
124 | * -------------------------------------------------------------------------- | 129 | * -------------------------------------------------------------------------- |
125 | */ | 130 | */ |
126 | 131 | ||
@@ -177,6 +182,9 @@ typedef struct _MPI2_IOC_INIT_REQUEST | |||
177 | #define MPI2_WHOINIT_HOST_DRIVER (0x04) | 182 | #define MPI2_WHOINIT_HOST_DRIVER (0x04) |
178 | #define MPI2_WHOINIT_MANUFACTURER (0x05) | 183 | #define MPI2_WHOINIT_MANUFACTURER (0x05) |
179 | 184 | ||
185 | /* MsgFlags */ | ||
186 | #define MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE (0x01) | ||
187 | |||
180 | /* MsgVersion */ | 188 | /* MsgVersion */ |
181 | #define MPI2_IOCINIT_MSGVERSION_MAJOR_MASK (0xFF00) | 189 | #define MPI2_IOCINIT_MSGVERSION_MAJOR_MASK (0xFF00) |
182 | #define MPI2_IOCINIT_MSGVERSION_MAJOR_SHIFT (8) | 190 | #define MPI2_IOCINIT_MSGVERSION_MAJOR_SHIFT (8) |
@@ -189,9 +197,17 @@ typedef struct _MPI2_IOC_INIT_REQUEST | |||
189 | #define MPI2_IOCINIT_HDRVERSION_DEV_MASK (0x00FF) | 197 | #define MPI2_IOCINIT_HDRVERSION_DEV_MASK (0x00FF) |
190 | #define MPI2_IOCINIT_HDRVERSION_DEV_SHIFT (0) | 198 | #define MPI2_IOCINIT_HDRVERSION_DEV_SHIFT (0) |
191 | 199 | ||
192 | /* minimum depth for the Reply Descriptor Post Queue */ | 200 | /* minimum depth for a Reply Descriptor Post Queue */ |
193 | #define MPI2_RDPQ_DEPTH_MIN (16) | 201 | #define MPI2_RDPQ_DEPTH_MIN (16) |
194 | 202 | ||
203 | /* Reply Descriptor Post Queue Array Entry */ | ||
204 | typedef struct _MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY { | ||
205 | U64 RDPQBaseAddress; /* 0x00 */ | ||
206 | U32 Reserved1; /* 0x08 */ | ||
207 | U32 Reserved2; /* 0x0C */ | ||
208 | } MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY, | ||
209 | MPI2_POINTER PTR_MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY, | ||
210 | Mpi2IOCInitRDPQArrayEntry, MPI2_POINTER pMpi2IOCInitRDPQArrayEntry; | ||
195 | 211 | ||
196 | /* IOCInit Reply message */ | 212 | /* IOCInit Reply message */ |
197 | typedef struct _MPI2_IOC_INIT_REPLY | 213 | typedef struct _MPI2_IOC_INIT_REPLY |
@@ -307,6 +323,7 @@ typedef struct _MPI2_IOC_FACTS_REPLY | |||
307 | /* ProductID field uses MPI2_FW_HEADER_PID_ */ | 323 | /* ProductID field uses MPI2_FW_HEADER_PID_ */ |
308 | 324 | ||
309 | /* IOCCapabilities */ | 325 | /* IOCCapabilities */ |
326 | #define MPI2_IOCFACTS_CAPABILITY_RDPQ_ARRAY_CAPABLE (0x00040000) | ||
310 | #define MPI2_IOCFACTS_CAPABILITY_HOST_BASED_DISCOVERY (0x00010000) | 327 | #define MPI2_IOCFACTS_CAPABILITY_HOST_BASED_DISCOVERY (0x00010000) |
311 | #define MPI2_IOCFACTS_CAPABILITY_MSI_X_INDEX (0x00008000) | 328 | #define MPI2_IOCFACTS_CAPABILITY_MSI_X_INDEX (0x00008000) |
312 | #define MPI2_IOCFACTS_CAPABILITY_RAID_ACCELERATOR (0x00004000) | 329 | #define MPI2_IOCFACTS_CAPABILITY_RAID_ACCELERATOR (0x00004000) |
@@ -1153,6 +1170,7 @@ typedef struct _MPI2_FW_DOWNLOAD_REQUEST | |||
1153 | #define MPI2_FW_DOWNLOAD_ITYPE_MEGARAID (0x09) | 1170 | #define MPI2_FW_DOWNLOAD_ITYPE_MEGARAID (0x09) |
1154 | #define MPI2_FW_DOWNLOAD_ITYPE_COMPLETE (0x0A) | 1171 | #define MPI2_FW_DOWNLOAD_ITYPE_COMPLETE (0x0A) |
1155 | #define MPI2_FW_DOWNLOAD_ITYPE_COMMON_BOOT_BLOCK (0x0B) | 1172 | #define MPI2_FW_DOWNLOAD_ITYPE_COMMON_BOOT_BLOCK (0x0B) |
1173 | #define MPI2_FW_DOWNLOAD_ITYPE_PUBLIC_KEY (0x0C) | ||
1156 | #define MPI2_FW_DOWNLOAD_ITYPE_MIN_PRODUCT_SPECIFIC (0xF0) | 1174 | #define MPI2_FW_DOWNLOAD_ITYPE_MIN_PRODUCT_SPECIFIC (0xF0) |
1157 | 1175 | ||
1158 | /* FWDownload TransactionContext Element */ | 1176 | /* FWDownload TransactionContext Element */ |
@@ -1379,14 +1397,15 @@ typedef struct _MPI2_EXT_IMAGE_HEADER | |||
1379 | #define MPI2_EXT_IMAGE_HEADER_SIZE (0x40) | 1397 | #define MPI2_EXT_IMAGE_HEADER_SIZE (0x40) |
1380 | 1398 | ||
1381 | /* defines for the ImageType field */ | 1399 | /* defines for the ImageType field */ |
1382 | #define MPI2_EXT_IMAGE_TYPE_UNSPECIFIED (0x00) | 1400 | #define MPI2_EXT_IMAGE_TYPE_UNSPECIFIED (0x00) |
1383 | #define MPI2_EXT_IMAGE_TYPE_FW (0x01) | 1401 | #define MPI2_EXT_IMAGE_TYPE_FW (0x01) |
1384 | #define MPI2_EXT_IMAGE_TYPE_NVDATA (0x03) | 1402 | #define MPI2_EXT_IMAGE_TYPE_NVDATA (0x03) |
1385 | #define MPI2_EXT_IMAGE_TYPE_BOOTLOADER (0x04) | 1403 | #define MPI2_EXT_IMAGE_TYPE_BOOTLOADER (0x04) |
1386 | #define MPI2_EXT_IMAGE_TYPE_INITIALIZATION (0x05) | 1404 | #define MPI2_EXT_IMAGE_TYPE_INITIALIZATION (0x05) |
1387 | #define MPI2_EXT_IMAGE_TYPE_FLASH_LAYOUT (0x06) | 1405 | #define MPI2_EXT_IMAGE_TYPE_FLASH_LAYOUT (0x06) |
1388 | #define MPI2_EXT_IMAGE_TYPE_SUPPORTED_DEVICES (0x07) | 1406 | #define MPI2_EXT_IMAGE_TYPE_SUPPORTED_DEVICES (0x07) |
1389 | #define MPI2_EXT_IMAGE_TYPE_MEGARAID (0x08) | 1407 | #define MPI2_EXT_IMAGE_TYPE_MEGARAID (0x08) |
1408 | #define MPI2_EXT_IMAGE_TYPE_ENCRYPTED_HASH (0x09) | ||
1390 | #define MPI2_EXT_IMAGE_TYPE_MIN_PRODUCT_SPECIFIC (0x80) | 1409 | #define MPI2_EXT_IMAGE_TYPE_MIN_PRODUCT_SPECIFIC (0x80) |
1391 | #define MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC (0xFF) | 1410 | #define MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC (0xFF) |
1392 | #define MPI2_EXT_IMAGE_TYPE_MAX \ | 1411 | #define MPI2_EXT_IMAGE_TYPE_MAX \ |
@@ -1555,6 +1574,39 @@ typedef struct _MPI2_INIT_IMAGE_FOOTER | |||
1555 | #define MPI2_INIT_IMAGE_RESETVECTOR_OFFSET (0x14) | 1574 | #define MPI2_INIT_IMAGE_RESETVECTOR_OFFSET (0x14) |
1556 | 1575 | ||
1557 | 1576 | ||
1577 | /* Encrypted Hash Extended Image Data */ | ||
1578 | |||
1579 | typedef struct _MPI25_ENCRYPTED_HASH_ENTRY { | ||
1580 | U8 HashImageType; /* 0x00 */ | ||
1581 | U8 HashAlgorithm; /* 0x01 */ | ||
1582 | U8 EncryptionAlgorithm; /* 0x02 */ | ||
1583 | U8 Reserved1; /* 0x03 */ | ||
1584 | U32 Reserved2; /* 0x04 */ | ||
1585 | U32 EncryptedHash[1]; /* 0x08 */ | ||
1586 | } MPI25_ENCRYPTED_HASH_ENTRY, MPI2_POINTER PTR_MPI25_ENCRYPTED_HASH_ENTRY, | ||
1587 | Mpi25EncryptedHashEntry_t, MPI2_POINTER pMpi25EncryptedHashEntry_t; | ||
1588 | |||
1589 | /* values for HashImageType */ | ||
1590 | #define MPI25_HASH_IMAGE_TYPE_UNUSED (0x00) | ||
1591 | #define MPI25_HASH_IMAGE_TYPE_FIRMWARE (0x01) | ||
1592 | |||
1593 | /* values for HashAlgorithm */ | ||
1594 | #define MPI25_HASH_ALGORITHM_UNUSED (0x00) | ||
1595 | #define MPI25_HASH_ALGORITHM_SHA256 (0x01) | ||
1596 | |||
1597 | /* values for EncryptionAlgorithm */ | ||
1598 | #define MPI25_ENCRYPTION_ALG_UNUSED (0x00) | ||
1599 | #define MPI25_ENCRYPTION_ALG_RSA256 (0x01) | ||
1600 | |||
1601 | typedef struct _MPI25_ENCRYPTED_HASH_DATA { | ||
1602 | U8 ImageVersion; /* 0x00 */ | ||
1603 | U8 NumHash; /* 0x01 */ | ||
1604 | U16 Reserved1; /* 0x02 */ | ||
1605 | U32 Reserved2; /* 0x04 */ | ||
1606 | MPI25_ENCRYPTED_HASH_ENTRY EncryptedHashEntry[1]; /* 0x08 */ | ||
1607 | } MPI25_ENCRYPTED_HASH_DATA, MPI2_POINTER PTR_MPI25_ENCRYPTED_HASH_DATA, | ||
1608 | Mpi25EncryptedHashData_t, MPI2_POINTER pMpi25EncryptedHashData_t; | ||
1609 | |||
1558 | /**************************************************************************** | 1610 | /**************************************************************************** |
1559 | * PowerManagementControl message | 1611 | * PowerManagementControl message |
1560 | ****************************************************************************/ | 1612 | ****************************************************************************/ |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_raid.h b/drivers/scsi/mpt2sas/mpi/mpi2_raid.h index 0d202a2c6db7..7efa58ff0d34 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_raid.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_raid.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_raid.h | 5 | * Name: mpi2_raid.h |
6 | * Title: MPI Integrated RAID messages and structures | 6 | * Title: MPI Integrated RAID messages and structures |
7 | * Creation Date: April 26, 2007 | 7 | * Creation Date: April 26, 2007 |
8 | * | 8 | * |
9 | * mpi2_raid.h Version: 02.00.09 | 9 | * mpi2_raid.h Version: 02.00.10 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -29,6 +29,7 @@ | |||
29 | * 02-06-12 02.00.08 Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN. | 29 | * 02-06-12 02.00.08 Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN. |
30 | * 07-26-12 02.00.09 Added ElapsedSeconds field to MPI2_RAID_VOL_INDICATOR. | 30 | * 07-26-12 02.00.09 Added ElapsedSeconds field to MPI2_RAID_VOL_INDICATOR. |
31 | * Added MPI2_RAID_VOL_FLAGS_ELAPSED_SECONDS_VALID define. | 31 | * Added MPI2_RAID_VOL_FLAGS_ELAPSED_SECONDS_VALID define. |
32 | * 04-17-13 02.00.10 Added MPI25_RAID_ACTION_ADATA_ALLOW_PI. | ||
32 | * -------------------------------------------------------------------------- | 33 | * -------------------------------------------------------------------------- |
33 | */ | 34 | */ |
34 | 35 | ||
@@ -45,6 +46,9 @@ | |||
45 | * RAID Action messages | 46 | * RAID Action messages |
46 | ****************************************************************************/ | 47 | ****************************************************************************/ |
47 | 48 | ||
49 | /* ActionDataWord defines for use with MPI2_RAID_ACTION_CREATE_VOLUME action */ | ||
50 | #define MPI25_RAID_ACTION_ADATA_ALLOW_PI (0x80000000) | ||
51 | |||
48 | /* ActionDataWord defines for use with MPI2_RAID_ACTION_DELETE_VOLUME action */ | 52 | /* ActionDataWord defines for use with MPI2_RAID_ACTION_DELETE_VOLUME action */ |
49 | #define MPI2_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000) | 53 | #define MPI2_RAID_ACTION_ADATA_KEEP_LBA0 (0x00000000) |
50 | #define MPI2_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000001) | 54 | #define MPI2_RAID_ACTION_ADATA_ZERO_LBA0 (0x00000001) |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_sas.h b/drivers/scsi/mpt2sas/mpi/mpi2_sas.h index 50b39ccd526a..45b6fa10b803 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_sas.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_sas.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_sas.h | 5 | * Name: mpi2_sas.h |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_tool.h b/drivers/scsi/mpt2sas/mpi/mpi2_tool.h index 11b2ac4e7c6e..9be03ed46180 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_tool.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_tool.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_tool.h | 5 | * Name: mpi2_tool.h |
6 | * Title: MPI diagnostic tool structures and definitions | 6 | * Title: MPI diagnostic tool structures and definitions |
7 | * Creation Date: March 26, 2007 | 7 | * Creation Date: March 26, 2007 |
8 | * | 8 | * |
9 | * mpi2_tool.h Version: 02.00.10 | 9 | * mpi2_tool.h Version: 02.00.11 |
10 | * | 10 | * |
11 | * Version History | 11 | * Version History |
12 | * --------------- | 12 | * --------------- |
@@ -29,6 +29,7 @@ | |||
29 | * MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST. | 29 | * MPI2_TOOLBOX_ISTWI_READ_WRITE_REQUEST. |
30 | * 07-26-12 02.00.10 Modified MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST so that | 30 | * 07-26-12 02.00.10 Modified MPI2_TOOLBOX_DIAGNOSTIC_CLI_REQUEST so that |
31 | * it uses MPI Chain SGE as well as MPI Simple SGE. | 31 | * it uses MPI Chain SGE as well as MPI Simple SGE. |
32 | * 08-19-13 02.00.11 Added MPI2_TOOLBOX_TEXT_DISPLAY_TOOL and related info. | ||
32 | * -------------------------------------------------------------------------- | 33 | * -------------------------------------------------------------------------- |
33 | */ | 34 | */ |
34 | 35 | ||
@@ -48,6 +49,7 @@ | |||
48 | #define MPI2_TOOLBOX_ISTWI_READ_WRITE_TOOL (0x03) | 49 | #define MPI2_TOOLBOX_ISTWI_READ_WRITE_TOOL (0x03) |
49 | #define MPI2_TOOLBOX_BEACON_TOOL (0x05) | 50 | #define MPI2_TOOLBOX_BEACON_TOOL (0x05) |
50 | #define MPI2_TOOLBOX_DIAGNOSTIC_CLI_TOOL (0x06) | 51 | #define MPI2_TOOLBOX_DIAGNOSTIC_CLI_TOOL (0x06) |
52 | #define MPI2_TOOLBOX_TEXT_DISPLAY_TOOL (0x07) | ||
51 | 53 | ||
52 | 54 | ||
53 | /**************************************************************************** | 55 | /**************************************************************************** |
@@ -321,6 +323,44 @@ typedef struct _MPI2_TOOLBOX_DIAGNOSTIC_CLI_REPLY { | |||
321 | MPI2_POINTER pMpi2ToolboxDiagnosticCliReply_t; | 323 | MPI2_POINTER pMpi2ToolboxDiagnosticCliReply_t; |
322 | 324 | ||
323 | 325 | ||
326 | /**************************************************************************** | ||
327 | * Toolbox Console Text Display Tool | ||
328 | ****************************************************************************/ | ||
329 | |||
330 | /* Toolbox Console Text Display Tool request message */ | ||
331 | typedef struct _MPI2_TOOLBOX_TEXT_DISPLAY_REQUEST { | ||
332 | U8 Tool; /* 0x00 */ | ||
333 | U8 Reserved1; /* 0x01 */ | ||
334 | U8 ChainOffset; /* 0x02 */ | ||
335 | U8 Function; /* 0x03 */ | ||
336 | U16 Reserved2; /* 0x04 */ | ||
337 | U8 Reserved3; /* 0x06 */ | ||
338 | U8 MsgFlags; /* 0x07 */ | ||
339 | U8 VP_ID; /* 0x08 */ | ||
340 | U8 VF_ID; /* 0x09 */ | ||
341 | U16 Reserved4; /* 0x0A */ | ||
342 | U8 Console; /* 0x0C */ | ||
343 | U8 Flags; /* 0x0D */ | ||
344 | U16 Reserved6; /* 0x0E */ | ||
345 | U8 TextToDisplay[4]; /* 0x10 */ | ||
346 | } MPI2_TOOLBOX_TEXT_DISPLAY_REQUEST, | ||
347 | MPI2_POINTER PTR_MPI2_TOOLBOX_TEXT_DISPLAY_REQUEST, | ||
348 | Mpi2ToolboxTextDisplayRequest_t, | ||
349 | MPI2_POINTER pMpi2ToolboxTextDisplayRequest_t; | ||
350 | |||
351 | /* defines for the Console field */ | ||
352 | #define MPI2_TOOLBOX_CONSOLE_TYPE_MASK (0xF0) | ||
353 | #define MPI2_TOOLBOX_CONSOLE_TYPE_DEFAULT (0x00) | ||
354 | #define MPI2_TOOLBOX_CONSOLE_TYPE_UART (0x10) | ||
355 | #define MPI2_TOOLBOX_CONSOLE_TYPE_ETHERNET (0x20) | ||
356 | |||
357 | #define MPI2_TOOLBOX_CONSOLE_NUMBER_MASK (0x0F) | ||
358 | |||
359 | /* defines for the Flags field */ | ||
360 | #define MPI2_TOOLBOX_CONSOLE_FLAG_TIMESTAMP (0x01) | ||
361 | |||
362 | |||
363 | |||
324 | /***************************************************************************** | 364 | /***************************************************************************** |
325 | * | 365 | * |
326 | * Diagnostic Buffer Messages | 366 | * Diagnostic Buffer Messages |
diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_type.h b/drivers/scsi/mpt2sas/mpi/mpi2_type.h index 0b128b68a5ea..6b0dcdd02f68 100644 --- a/drivers/scsi/mpt2sas/mpi/mpi2_type.h +++ b/drivers/scsi/mpt2sas/mpi/mpi2_type.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2013 LSI Corporation. | 2 | * Copyright (c) 2000-2014 LSI Corporation. |
3 | * | 3 | * |
4 | * | 4 | * |
5 | * Name: mpi2_type.h | 5 | * Name: mpi2_type.h |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 2f262be890c5..58e45216d1ec 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * for access to MPT (Message Passing Technology) firmware. | 3 | * for access to MPT (Message Passing Technology) firmware. |
4 | * | 4 | * |
5 | * This code is based on drivers/scsi/mpt2sas/mpt2_base.c | 5 | * This code is based on drivers/scsi/mpt2sas/mpt2_base.c |
6 | * Copyright (C) 2007-2013 LSI Corporation | 6 | * Copyright (C) 2007-2014 LSI Corporation |
7 | * (mailto:DL-MPTFusionLinux@lsi.com) | 7 | * (mailto:DL-MPTFusionLinux@lsi.com) |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
@@ -80,6 +80,10 @@ static int msix_disable = -1; | |||
80 | module_param(msix_disable, int, 0); | 80 | module_param(msix_disable, int, 0); |
81 | MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); | 81 | MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); |
82 | 82 | ||
83 | static int max_msix_vectors = -1; | ||
84 | module_param(max_msix_vectors, int, 0); | ||
85 | MODULE_PARM_DESC(max_msix_vectors, " max msix vectors "); | ||
86 | |||
83 | static int mpt2sas_fwfault_debug; | 87 | static int mpt2sas_fwfault_debug; |
84 | MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault " | 88 | MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault " |
85 | "and halt firmware - (default=0)"); | 89 | "and halt firmware - (default=0)"); |
@@ -88,6 +92,12 @@ static int disable_discovery = -1; | |||
88 | module_param(disable_discovery, int, 0); | 92 | module_param(disable_discovery, int, 0); |
89 | MODULE_PARM_DESC(disable_discovery, " disable discovery "); | 93 | MODULE_PARM_DESC(disable_discovery, " disable discovery "); |
90 | 94 | ||
95 | static int | ||
96 | _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag); | ||
97 | |||
98 | static int | ||
99 | _base_diag_reset(struct MPT2SAS_ADAPTER *ioc, int sleep_flag); | ||
100 | |||
91 | /** | 101 | /** |
92 | * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. | 102 | * _scsih_set_fwfault_debug - global setting of ioc->fwfault_debug. |
93 | * | 103 | * |
@@ -1175,17 +1185,22 @@ static int | |||
1175 | _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev) | 1185 | _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev) |
1176 | { | 1186 | { |
1177 | struct sysinfo s; | 1187 | struct sysinfo s; |
1178 | char *desc = NULL; | 1188 | u64 consistent_dma_mask; |
1189 | |||
1190 | if (ioc->dma_mask) | ||
1191 | consistent_dma_mask = DMA_BIT_MASK(64); | ||
1192 | else | ||
1193 | consistent_dma_mask = DMA_BIT_MASK(32); | ||
1179 | 1194 | ||
1180 | if (sizeof(dma_addr_t) > 4) { | 1195 | if (sizeof(dma_addr_t) > 4) { |
1181 | const uint64_t required_mask = | 1196 | const uint64_t required_mask = |
1182 | dma_get_required_mask(&pdev->dev); | 1197 | dma_get_required_mask(&pdev->dev); |
1183 | if ((required_mask > DMA_BIT_MASK(32)) && !pci_set_dma_mask(pdev, | 1198 | if ((required_mask > DMA_BIT_MASK(32)) && |
1184 | DMA_BIT_MASK(64)) && !pci_set_consistent_dma_mask(pdev, | 1199 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && |
1185 | DMA_BIT_MASK(64))) { | 1200 | !pci_set_consistent_dma_mask(pdev, consistent_dma_mask)) { |
1186 | ioc->base_add_sg_single = &_base_add_sg_single_64; | 1201 | ioc->base_add_sg_single = &_base_add_sg_single_64; |
1187 | ioc->sge_size = sizeof(Mpi2SGESimple64_t); | 1202 | ioc->sge_size = sizeof(Mpi2SGESimple64_t); |
1188 | desc = "64"; | 1203 | ioc->dma_mask = 64; |
1189 | goto out; | 1204 | goto out; |
1190 | } | 1205 | } |
1191 | } | 1206 | } |
@@ -1194,18 +1209,29 @@ _base_config_dma_addressing(struct MPT2SAS_ADAPTER *ioc, struct pci_dev *pdev) | |||
1194 | && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { | 1209 | && !pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) { |
1195 | ioc->base_add_sg_single = &_base_add_sg_single_32; | 1210 | ioc->base_add_sg_single = &_base_add_sg_single_32; |
1196 | ioc->sge_size = sizeof(Mpi2SGESimple32_t); | 1211 | ioc->sge_size = sizeof(Mpi2SGESimple32_t); |
1197 | desc = "32"; | 1212 | ioc->dma_mask = 32; |
1198 | } else | 1213 | } else |
1199 | return -ENODEV; | 1214 | return -ENODEV; |
1200 | 1215 | ||
1201 | out: | 1216 | out: |
1202 | si_meminfo(&s); | 1217 | si_meminfo(&s); |
1203 | printk(MPT2SAS_INFO_FMT "%s BIT PCI BUS DMA ADDRESSING SUPPORTED, " | 1218 | printk(MPT2SAS_INFO_FMT |
1204 | "total mem (%ld kB)\n", ioc->name, desc, convert_to_kb(s.totalram)); | 1219 | "%d BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (%ld kB)\n", |
1220 | ioc->name, ioc->dma_mask, convert_to_kb(s.totalram)); | ||
1205 | 1221 | ||
1206 | return 0; | 1222 | return 0; |
1207 | } | 1223 | } |
1208 | 1224 | ||
1225 | static int | ||
1226 | _base_change_consistent_dma_mask(struct MPT2SAS_ADAPTER *ioc, | ||
1227 | struct pci_dev *pdev) | ||
1228 | { | ||
1229 | if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64))) { | ||
1230 | if (pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32))) | ||
1231 | return -ENODEV; | ||
1232 | } | ||
1233 | return 0; | ||
1234 | } | ||
1209 | /** | 1235 | /** |
1210 | * _base_check_enable_msix - checks MSIX capabable. | 1236 | * _base_check_enable_msix - checks MSIX capabable. |
1211 | * @ioc: per adapter object | 1237 | * @ioc: per adapter object |
@@ -1402,6 +1428,20 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) | |||
1402 | ioc->reply_queue_count = min_t(int, ioc->cpu_count, | 1428 | ioc->reply_queue_count = min_t(int, ioc->cpu_count, |
1403 | ioc->msix_vector_count); | 1429 | ioc->msix_vector_count); |
1404 | 1430 | ||
1431 | if (!ioc->rdpq_array_enable && max_msix_vectors == -1) | ||
1432 | max_msix_vectors = 8; | ||
1433 | |||
1434 | if (max_msix_vectors > 0) { | ||
1435 | ioc->reply_queue_count = min_t(int, max_msix_vectors, | ||
1436 | ioc->reply_queue_count); | ||
1437 | ioc->msix_vector_count = ioc->reply_queue_count; | ||
1438 | } else if (max_msix_vectors == 0) | ||
1439 | goto try_ioapic; | ||
1440 | |||
1441 | printk(MPT2SAS_INFO_FMT | ||
1442 | "MSI-X vectors supported: %d, no of cores: %d, max_msix_vectors: %d\n", | ||
1443 | ioc->name, ioc->msix_vector_count, ioc->cpu_count, max_msix_vectors); | ||
1444 | |||
1405 | entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry), | 1445 | entries = kcalloc(ioc->reply_queue_count, sizeof(struct msix_entry), |
1406 | GFP_KERNEL); | 1446 | GFP_KERNEL); |
1407 | if (!entries) { | 1447 | if (!entries) { |
@@ -1414,10 +1454,10 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) | |||
1414 | for (i = 0, a = entries; i < ioc->reply_queue_count; i++, a++) | 1454 | for (i = 0, a = entries; i < ioc->reply_queue_count; i++, a++) |
1415 | a->entry = i; | 1455 | a->entry = i; |
1416 | 1456 | ||
1417 | r = pci_enable_msix(ioc->pdev, entries, ioc->reply_queue_count); | 1457 | r = pci_enable_msix_exact(ioc->pdev, entries, ioc->reply_queue_count); |
1418 | if (r) { | 1458 | if (r) { |
1419 | dfailprintk(ioc, printk(MPT2SAS_INFO_FMT "pci_enable_msix " | 1459 | dfailprintk(ioc, printk(MPT2SAS_INFO_FMT |
1420 | "failed (r=%d) !!!\n", ioc->name, r)); | 1460 | "pci_enable_msix_exact failed (r=%d) !!!\n", ioc->name, r)); |
1421 | kfree(entries); | 1461 | kfree(entries); |
1422 | goto try_ioapic; | 1462 | goto try_ioapic; |
1423 | } | 1463 | } |
@@ -1439,6 +1479,7 @@ _base_enable_msix(struct MPT2SAS_ADAPTER *ioc) | |||
1439 | /* failback to io_apic interrupt routing */ | 1479 | /* failback to io_apic interrupt routing */ |
1440 | try_ioapic: | 1480 | try_ioapic: |
1441 | 1481 | ||
1482 | ioc->reply_queue_count = 1; | ||
1442 | r = _base_request_irq(ioc, 0, ioc->pdev->irq); | 1483 | r = _base_request_irq(ioc, 0, ioc->pdev->irq); |
1443 | 1484 | ||
1444 | return r; | 1485 | return r; |
@@ -1520,6 +1561,16 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc) | |||
1520 | } | 1561 | } |
1521 | 1562 | ||
1522 | _base_mask_interrupts(ioc); | 1563 | _base_mask_interrupts(ioc); |
1564 | |||
1565 | r = _base_get_ioc_facts(ioc, CAN_SLEEP); | ||
1566 | if (r) | ||
1567 | goto out_fail; | ||
1568 | |||
1569 | if (!ioc->rdpq_array_enable_assigned) { | ||
1570 | ioc->rdpq_array_enable = ioc->rdpq_array_capable; | ||
1571 | ioc->rdpq_array_enable_assigned = 1; | ||
1572 | } | ||
1573 | |||
1523 | r = _base_enable_msix(ioc); | 1574 | r = _base_enable_msix(ioc); |
1524 | if (r) | 1575 | if (r) |
1525 | goto out_fail; | 1576 | goto out_fail; |
@@ -2317,7 +2368,8 @@ _base_static_config_pages(struct MPT2SAS_ADAPTER *ioc) | |||
2317 | static void | 2368 | static void |
2318 | _base_release_memory_pools(struct MPT2SAS_ADAPTER *ioc) | 2369 | _base_release_memory_pools(struct MPT2SAS_ADAPTER *ioc) |
2319 | { | 2370 | { |
2320 | int i; | 2371 | int i = 0; |
2372 | struct reply_post_struct *rps; | ||
2321 | 2373 | ||
2322 | dexitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, | 2374 | dexitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, |
2323 | __func__)); | 2375 | __func__)); |
@@ -2358,15 +2410,25 @@ _base_release_memory_pools(struct MPT2SAS_ADAPTER *ioc) | |||
2358 | ioc->reply_free = NULL; | 2410 | ioc->reply_free = NULL; |
2359 | } | 2411 | } |
2360 | 2412 | ||
2361 | if (ioc->reply_post_free) { | 2413 | if (ioc->reply_post) { |
2362 | pci_pool_free(ioc->reply_post_free_dma_pool, | 2414 | do { |
2363 | ioc->reply_post_free, ioc->reply_post_free_dma); | 2415 | rps = &ioc->reply_post[i]; |
2416 | if (rps->reply_post_free) { | ||
2417 | pci_pool_free( | ||
2418 | ioc->reply_post_free_dma_pool, | ||
2419 | rps->reply_post_free, | ||
2420 | rps->reply_post_free_dma); | ||
2421 | dexitprintk(ioc, printk(MPT2SAS_INFO_FMT | ||
2422 | "reply_post_free_pool(0x%p): free\n", | ||
2423 | ioc->name, rps->reply_post_free)); | ||
2424 | rps->reply_post_free = NULL; | ||
2425 | } | ||
2426 | } while (ioc->rdpq_array_enable && | ||
2427 | (++i < ioc->reply_queue_count)); | ||
2428 | |||
2364 | if (ioc->reply_post_free_dma_pool) | 2429 | if (ioc->reply_post_free_dma_pool) |
2365 | pci_pool_destroy(ioc->reply_post_free_dma_pool); | 2430 | pci_pool_destroy(ioc->reply_post_free_dma_pool); |
2366 | dexitprintk(ioc, printk(MPT2SAS_INFO_FMT | 2431 | kfree(ioc->reply_post); |
2367 | "reply_post_free_pool(0x%p): free\n", ioc->name, | ||
2368 | ioc->reply_post_free)); | ||
2369 | ioc->reply_post_free = NULL; | ||
2370 | } | 2432 | } |
2371 | 2433 | ||
2372 | if (ioc->config_page) { | 2434 | if (ioc->config_page) { |
@@ -2509,6 +2571,65 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
2509 | ioc->max_sges_in_chain_message, ioc->shost->sg_tablesize, | 2571 | ioc->max_sges_in_chain_message, ioc->shost->sg_tablesize, |
2510 | ioc->chains_needed_per_io)); | 2572 | ioc->chains_needed_per_io)); |
2511 | 2573 | ||
2574 | /* reply post queue, 16 byte align */ | ||
2575 | reply_post_free_sz = ioc->reply_post_queue_depth * | ||
2576 | sizeof(Mpi2DefaultReplyDescriptor_t); | ||
2577 | |||
2578 | sz = reply_post_free_sz; | ||
2579 | if (_base_is_controller_msix_enabled(ioc) && !ioc->rdpq_array_enable) | ||
2580 | sz *= ioc->reply_queue_count; | ||
2581 | |||
2582 | ioc->reply_post = kcalloc((ioc->rdpq_array_enable) ? | ||
2583 | (ioc->reply_queue_count):1, | ||
2584 | sizeof(struct reply_post_struct), GFP_KERNEL); | ||
2585 | |||
2586 | if (!ioc->reply_post) { | ||
2587 | printk(MPT2SAS_ERR_FMT "reply_post_free pool: kcalloc failed\n", | ||
2588 | ioc->name); | ||
2589 | goto out; | ||
2590 | } | ||
2591 | ioc->reply_post_free_dma_pool = pci_pool_create("reply_post_free pool", | ||
2592 | ioc->pdev, sz, 16, 0); | ||
2593 | if (!ioc->reply_post_free_dma_pool) { | ||
2594 | printk(MPT2SAS_ERR_FMT | ||
2595 | "reply_post_free pool: pci_pool_create failed\n", | ||
2596 | ioc->name); | ||
2597 | goto out; | ||
2598 | } | ||
2599 | i = 0; | ||
2600 | do { | ||
2601 | ioc->reply_post[i].reply_post_free = | ||
2602 | pci_pool_alloc(ioc->reply_post_free_dma_pool, | ||
2603 | GFP_KERNEL, | ||
2604 | &ioc->reply_post[i].reply_post_free_dma); | ||
2605 | if (!ioc->reply_post[i].reply_post_free) { | ||
2606 | printk(MPT2SAS_ERR_FMT | ||
2607 | "reply_post_free pool: pci_pool_alloc failed\n", | ||
2608 | ioc->name); | ||
2609 | goto out; | ||
2610 | } | ||
2611 | memset(ioc->reply_post[i].reply_post_free, 0, sz); | ||
2612 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT | ||
2613 | "reply post free pool (0x%p): depth(%d)," | ||
2614 | "element_size(%d), pool_size(%d kB)\n", ioc->name, | ||
2615 | ioc->reply_post[i].reply_post_free, | ||
2616 | ioc->reply_post_queue_depth, 8, sz/1024)); | ||
2617 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT | ||
2618 | "reply_post_free_dma = (0x%llx)\n", ioc->name, | ||
2619 | (unsigned long long) | ||
2620 | ioc->reply_post[i].reply_post_free_dma)); | ||
2621 | total_sz += sz; | ||
2622 | } while (ioc->rdpq_array_enable && (++i < ioc->reply_queue_count)); | ||
2623 | |||
2624 | if (ioc->dma_mask == 64) { | ||
2625 | if (_base_change_consistent_dma_mask(ioc, ioc->pdev) != 0) { | ||
2626 | printk(MPT2SAS_WARN_FMT | ||
2627 | "no suitable consistent DMA mask for %s\n", | ||
2628 | ioc->name, pci_name(ioc->pdev)); | ||
2629 | goto out; | ||
2630 | } | ||
2631 | } | ||
2632 | |||
2512 | ioc->scsiio_depth = ioc->hba_queue_depth - | 2633 | ioc->scsiio_depth = ioc->hba_queue_depth - |
2513 | ioc->hi_priority_depth - ioc->internal_depth; | 2634 | ioc->hi_priority_depth - ioc->internal_depth; |
2514 | 2635 | ||
@@ -2720,37 +2841,6 @@ chain_done: | |||
2720 | "(0x%llx)\n", ioc->name, (unsigned long long)ioc->reply_free_dma)); | 2841 | "(0x%llx)\n", ioc->name, (unsigned long long)ioc->reply_free_dma)); |
2721 | total_sz += sz; | 2842 | total_sz += sz; |
2722 | 2843 | ||
2723 | /* reply post queue, 16 byte align */ | ||
2724 | reply_post_free_sz = ioc->reply_post_queue_depth * | ||
2725 | sizeof(Mpi2DefaultReplyDescriptor_t); | ||
2726 | if (_base_is_controller_msix_enabled(ioc)) | ||
2727 | sz = reply_post_free_sz * ioc->reply_queue_count; | ||
2728 | else | ||
2729 | sz = reply_post_free_sz; | ||
2730 | ioc->reply_post_free_dma_pool = pci_pool_create("reply_post_free pool", | ||
2731 | ioc->pdev, sz, 16, 0); | ||
2732 | if (!ioc->reply_post_free_dma_pool) { | ||
2733 | printk(MPT2SAS_ERR_FMT "reply_post_free pool: pci_pool_create " | ||
2734 | "failed\n", ioc->name); | ||
2735 | goto out; | ||
2736 | } | ||
2737 | ioc->reply_post_free = pci_pool_alloc(ioc->reply_post_free_dma_pool , | ||
2738 | GFP_KERNEL, &ioc->reply_post_free_dma); | ||
2739 | if (!ioc->reply_post_free) { | ||
2740 | printk(MPT2SAS_ERR_FMT "reply_post_free pool: pci_pool_alloc " | ||
2741 | "failed\n", ioc->name); | ||
2742 | goto out; | ||
2743 | } | ||
2744 | memset(ioc->reply_post_free, 0, sz); | ||
2745 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "reply post free pool" | ||
2746 | "(0x%p): depth(%d), element_size(%d), pool_size(%d kB)\n", | ||
2747 | ioc->name, ioc->reply_post_free, ioc->reply_post_queue_depth, 8, | ||
2748 | sz/1024)); | ||
2749 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "reply_post_free_dma = " | ||
2750 | "(0x%llx)\n", ioc->name, (unsigned long long) | ||
2751 | ioc->reply_post_free_dma)); | ||
2752 | total_sz += sz; | ||
2753 | |||
2754 | ioc->config_page_sz = 512; | 2844 | ioc->config_page_sz = 512; |
2755 | ioc->config_page = pci_alloc_consistent(ioc->pdev, | 2845 | ioc->config_page = pci_alloc_consistent(ioc->pdev, |
2756 | ioc->config_page_sz, &ioc->config_page_dma); | 2846 | ioc->config_page_sz, &ioc->config_page_dma); |
@@ -3374,6 +3464,64 @@ _base_get_port_facts(struct MPT2SAS_ADAPTER *ioc, int port, int sleep_flag) | |||
3374 | } | 3464 | } |
3375 | 3465 | ||
3376 | /** | 3466 | /** |
3467 | * _base_wait_for_iocstate - Wait until the card is in READY or OPERATIONAL | ||
3468 | * @ioc: per adapter object | ||
3469 | * @timeout: | ||
3470 | * @sleep_flag: CAN_SLEEP or NO_SLEEP | ||
3471 | * | ||
3472 | * Returns 0 for success, non-zero for failure. | ||
3473 | */ | ||
3474 | static int | ||
3475 | _base_wait_for_iocstate(struct MPT2SAS_ADAPTER *ioc, int timeout, | ||
3476 | int sleep_flag) | ||
3477 | { | ||
3478 | u32 ioc_state, doorbell; | ||
3479 | int rc; | ||
3480 | |||
3481 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, | ||
3482 | __func__)); | ||
3483 | |||
3484 | if (ioc->pci_error_recovery) | ||
3485 | return 0; | ||
3486 | |||
3487 | doorbell = mpt2sas_base_get_iocstate(ioc, 0); | ||
3488 | ioc_state = doorbell & MPI2_IOC_STATE_MASK; | ||
3489 | dhsprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: ioc_state(0x%08x)\n", | ||
3490 | ioc->name, __func__, ioc_state)); | ||
3491 | |||
3492 | switch (ioc_state) { | ||
3493 | case MPI2_IOC_STATE_READY: | ||
3494 | case MPI2_IOC_STATE_OPERATIONAL: | ||
3495 | return 0; | ||
3496 | } | ||
3497 | |||
3498 | if (doorbell & MPI2_DOORBELL_USED) { | ||
3499 | dhsprintk(ioc, printk(MPT2SAS_INFO_FMT | ||
3500 | "unexpected doorbell activ!e\n", ioc->name)); | ||
3501 | goto issue_diag_reset; | ||
3502 | } | ||
3503 | |||
3504 | if (ioc_state == MPI2_IOC_STATE_FAULT) { | ||
3505 | mpt2sas_base_fault_info(ioc, doorbell & | ||
3506 | MPI2_DOORBELL_DATA_MASK); | ||
3507 | goto issue_diag_reset; | ||
3508 | } | ||
3509 | |||
3510 | ioc_state = _base_wait_on_iocstate(ioc, MPI2_IOC_STATE_READY, | ||
3511 | timeout, sleep_flag); | ||
3512 | if (ioc_state) { | ||
3513 | printk(MPT2SAS_ERR_FMT | ||
3514 | "%s: failed going to ready state (ioc_state=0x%x)\n", | ||
3515 | ioc->name, __func__, ioc_state); | ||
3516 | return -EFAULT; | ||
3517 | } | ||
3518 | |||
3519 | issue_diag_reset: | ||
3520 | rc = _base_diag_reset(ioc, sleep_flag); | ||
3521 | return rc; | ||
3522 | } | ||
3523 | |||
3524 | /** | ||
3377 | * _base_get_ioc_facts - obtain ioc facts reply and save in ioc | 3525 | * _base_get_ioc_facts - obtain ioc facts reply and save in ioc |
3378 | * @ioc: per adapter object | 3526 | * @ioc: per adapter object |
3379 | * @sleep_flag: CAN_SLEEP or NO_SLEEP | 3527 | * @sleep_flag: CAN_SLEEP or NO_SLEEP |
@@ -3391,6 +3539,13 @@ _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3391 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, | 3539 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, |
3392 | __func__)); | 3540 | __func__)); |
3393 | 3541 | ||
3542 | r = _base_wait_for_iocstate(ioc, 10, sleep_flag); | ||
3543 | if (r) { | ||
3544 | printk(MPT2SAS_ERR_FMT "%s: failed getting to correct state\n", | ||
3545 | ioc->name, __func__); | ||
3546 | return r; | ||
3547 | } | ||
3548 | |||
3394 | mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t); | 3549 | mpi_reply_sz = sizeof(Mpi2IOCFactsReply_t); |
3395 | mpi_request_sz = sizeof(Mpi2IOCFactsRequest_t); | 3550 | mpi_request_sz = sizeof(Mpi2IOCFactsRequest_t); |
3396 | memset(&mpi_request, 0, mpi_request_sz); | 3551 | memset(&mpi_request, 0, mpi_request_sz); |
@@ -3422,6 +3577,9 @@ _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3422 | facts->IOCCapabilities = le32_to_cpu(mpi_reply.IOCCapabilities); | 3577 | facts->IOCCapabilities = le32_to_cpu(mpi_reply.IOCCapabilities); |
3423 | if ((facts->IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID)) | 3578 | if ((facts->IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_INTEGRATED_RAID)) |
3424 | ioc->ir_firmware = 1; | 3579 | ioc->ir_firmware = 1; |
3580 | if ((facts->IOCCapabilities & | ||
3581 | MPI2_IOCFACTS_CAPABILITY_RDPQ_ARRAY_CAPABLE)) | ||
3582 | ioc->rdpq_array_capable = 1; | ||
3425 | facts->FWVersion.Word = le32_to_cpu(mpi_reply.FWVersion.Word); | 3583 | facts->FWVersion.Word = le32_to_cpu(mpi_reply.FWVersion.Word); |
3426 | facts->IOCRequestFrameSize = | 3584 | facts->IOCRequestFrameSize = |
3427 | le16_to_cpu(mpi_reply.IOCRequestFrameSize); | 3585 | le16_to_cpu(mpi_reply.IOCRequestFrameSize); |
@@ -3457,9 +3615,12 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3457 | { | 3615 | { |
3458 | Mpi2IOCInitRequest_t mpi_request; | 3616 | Mpi2IOCInitRequest_t mpi_request; |
3459 | Mpi2IOCInitReply_t mpi_reply; | 3617 | Mpi2IOCInitReply_t mpi_reply; |
3460 | int r; | 3618 | int i, r = 0; |
3461 | struct timeval current_time; | 3619 | struct timeval current_time; |
3462 | u16 ioc_status; | 3620 | u16 ioc_status; |
3621 | u32 reply_post_free_array_sz = 0; | ||
3622 | Mpi2IOCInitRDPQArrayEntry *reply_post_free_array = NULL; | ||
3623 | dma_addr_t reply_post_free_array_dma; | ||
3463 | 3624 | ||
3464 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, | 3625 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, |
3465 | __func__)); | 3626 | __func__)); |
@@ -3488,9 +3649,31 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3488 | cpu_to_le64((u64)ioc->request_dma); | 3649 | cpu_to_le64((u64)ioc->request_dma); |
3489 | mpi_request.ReplyFreeQueueAddress = | 3650 | mpi_request.ReplyFreeQueueAddress = |
3490 | cpu_to_le64((u64)ioc->reply_free_dma); | 3651 | cpu_to_le64((u64)ioc->reply_free_dma); |
3491 | mpi_request.ReplyDescriptorPostQueueAddress = | ||
3492 | cpu_to_le64((u64)ioc->reply_post_free_dma); | ||
3493 | 3652 | ||
3653 | if (ioc->rdpq_array_enable) { | ||
3654 | reply_post_free_array_sz = ioc->reply_queue_count * | ||
3655 | sizeof(Mpi2IOCInitRDPQArrayEntry); | ||
3656 | reply_post_free_array = pci_alloc_consistent(ioc->pdev, | ||
3657 | reply_post_free_array_sz, &reply_post_free_array_dma); | ||
3658 | if (!reply_post_free_array) { | ||
3659 | printk(MPT2SAS_ERR_FMT | ||
3660 | "reply_post_free_array: pci_alloc_consistent failed\n", | ||
3661 | ioc->name); | ||
3662 | r = -ENOMEM; | ||
3663 | goto out; | ||
3664 | } | ||
3665 | memset(reply_post_free_array, 0, reply_post_free_array_sz); | ||
3666 | for (i = 0; i < ioc->reply_queue_count; i++) | ||
3667 | reply_post_free_array[i].RDPQBaseAddress = | ||
3668 | cpu_to_le64( | ||
3669 | (u64)ioc->reply_post[i].reply_post_free_dma); | ||
3670 | mpi_request.MsgFlags = MPI2_IOCINIT_MSGFLAG_RDPQ_ARRAY_MODE; | ||
3671 | mpi_request.ReplyDescriptorPostQueueAddress = | ||
3672 | cpu_to_le64((u64)reply_post_free_array_dma); | ||
3673 | } else { | ||
3674 | mpi_request.ReplyDescriptorPostQueueAddress = | ||
3675 | cpu_to_le64((u64)ioc->reply_post[0].reply_post_free_dma); | ||
3676 | } | ||
3494 | 3677 | ||
3495 | /* This time stamp specifies number of milliseconds | 3678 | /* This time stamp specifies number of milliseconds |
3496 | * since epoch ~ midnight January 1, 1970. | 3679 | * since epoch ~ midnight January 1, 1970. |
@@ -3518,7 +3701,7 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3518 | if (r != 0) { | 3701 | if (r != 0) { |
3519 | printk(MPT2SAS_ERR_FMT "%s: handshake failed (r=%d)\n", | 3702 | printk(MPT2SAS_ERR_FMT "%s: handshake failed (r=%d)\n", |
3520 | ioc->name, __func__, r); | 3703 | ioc->name, __func__, r); |
3521 | return r; | 3704 | goto out; |
3522 | } | 3705 | } |
3523 | 3706 | ||
3524 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; | 3707 | ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & MPI2_IOCSTATUS_MASK; |
@@ -3528,7 +3711,12 @@ _base_send_ioc_init(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3528 | r = -EIO; | 3711 | r = -EIO; |
3529 | } | 3712 | } |
3530 | 3713 | ||
3531 | return 0; | 3714 | out: |
3715 | if (reply_post_free_array) | ||
3716 | pci_free_consistent(ioc->pdev, reply_post_free_array_sz, | ||
3717 | reply_post_free_array, | ||
3718 | reply_post_free_array_dma); | ||
3719 | return r; | ||
3532 | } | 3720 | } |
3533 | 3721 | ||
3534 | /** | 3722 | /** |
@@ -4061,7 +4249,7 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
4061 | u8 hide_flag; | 4249 | u8 hide_flag; |
4062 | struct adapter_reply_queue *reply_q; | 4250 | struct adapter_reply_queue *reply_q; |
4063 | long reply_post_free; | 4251 | long reply_post_free; |
4064 | u32 reply_post_free_sz; | 4252 | u32 reply_post_free_sz, index = 0; |
4065 | 4253 | ||
4066 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, | 4254 | dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name, |
4067 | __func__)); | 4255 | __func__)); |
@@ -4132,19 +4320,27 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
4132 | _base_assign_reply_queues(ioc); | 4320 | _base_assign_reply_queues(ioc); |
4133 | 4321 | ||
4134 | /* initialize Reply Post Free Queue */ | 4322 | /* initialize Reply Post Free Queue */ |
4135 | reply_post_free = (long)ioc->reply_post_free; | ||
4136 | reply_post_free_sz = ioc->reply_post_queue_depth * | 4323 | reply_post_free_sz = ioc->reply_post_queue_depth * |
4137 | sizeof(Mpi2DefaultReplyDescriptor_t); | 4324 | sizeof(Mpi2DefaultReplyDescriptor_t); |
4325 | reply_post_free = (long)ioc->reply_post[index].reply_post_free; | ||
4138 | list_for_each_entry(reply_q, &ioc->reply_queue_list, list) { | 4326 | list_for_each_entry(reply_q, &ioc->reply_queue_list, list) { |
4139 | reply_q->reply_post_host_index = 0; | 4327 | reply_q->reply_post_host_index = 0; |
4140 | reply_q->reply_post_free = (Mpi2ReplyDescriptorsUnion_t *) | 4328 | reply_q->reply_post_free = (Mpi2ReplyDescriptorsUnion_t *) |
4141 | reply_post_free; | 4329 | reply_post_free; |
4142 | for (i = 0; i < ioc->reply_post_queue_depth; i++) | 4330 | for (i = 0; i < ioc->reply_post_queue_depth; i++) |
4143 | reply_q->reply_post_free[i].Words = | 4331 | reply_q->reply_post_free[i].Words = |
4144 | cpu_to_le64(ULLONG_MAX); | 4332 | cpu_to_le64(ULLONG_MAX); |
4145 | if (!_base_is_controller_msix_enabled(ioc)) | 4333 | if (!_base_is_controller_msix_enabled(ioc)) |
4146 | goto skip_init_reply_post_free_queue; | 4334 | goto skip_init_reply_post_free_queue; |
4147 | reply_post_free += reply_post_free_sz; | 4335 | /* |
4336 | * If RDPQ is enabled, switch to the next allocation. | ||
4337 | * Otherwise advance within the contiguous region. | ||
4338 | */ | ||
4339 | if (ioc->rdpq_array_enable) | ||
4340 | reply_post_free = (long) | ||
4341 | ioc->reply_post[++index].reply_post_free; | ||
4342 | else | ||
4343 | reply_post_free += reply_post_free_sz; | ||
4148 | } | 4344 | } |
4149 | skip_init_reply_post_free_queue: | 4345 | skip_init_reply_post_free_queue: |
4150 | 4346 | ||
@@ -4272,6 +4468,8 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc) | |||
4272 | } | 4468 | } |
4273 | } | 4469 | } |
4274 | 4470 | ||
4471 | ioc->rdpq_array_enable_assigned = 0; | ||
4472 | ioc->dma_mask = 0; | ||
4275 | r = mpt2sas_base_map_resources(ioc); | 4473 | r = mpt2sas_base_map_resources(ioc); |
4276 | if (r) | 4474 | if (r) |
4277 | goto out_free_resources; | 4475 | goto out_free_resources; |
@@ -4633,6 +4831,16 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag, | |||
4633 | r = -EFAULT; | 4831 | r = -EFAULT; |
4634 | goto out; | 4832 | goto out; |
4635 | } | 4833 | } |
4834 | |||
4835 | r = _base_get_ioc_facts(ioc, CAN_SLEEP); | ||
4836 | if (r) | ||
4837 | goto out; | ||
4838 | |||
4839 | if (ioc->rdpq_array_enable && !ioc->rdpq_array_capable) | ||
4840 | panic("%s: Issue occurred with flashing controller firmware." | ||
4841 | "Please reboot the system and ensure that the correct" | ||
4842 | " firmware version is running\n", ioc->name); | ||
4843 | |||
4636 | r = _base_make_ioc_operational(ioc, sleep_flag); | 4844 | r = _base_make_ioc_operational(ioc, sleep_flag); |
4637 | if (!r) | 4845 | if (!r) |
4638 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); | 4846 | _base_reset_handler(ioc, MPT2_IOC_DONE_RESET); |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h index 0ac5815a7f91..239f169b0673 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.h +++ b/drivers/scsi/mpt2sas/mpt2sas_base.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * for access to MPT (Message Passing Technology) firmware. | 3 | * for access to MPT (Message Passing Technology) firmware. |
4 | * | 4 | * |
5 | * This code is based on drivers/scsi/mpt2sas/mpt2_base.h | 5 | * This code is based on drivers/scsi/mpt2sas/mpt2_base.h |
6 | * Copyright (C) 2007-2013 LSI Corporation | 6 | * Copyright (C) 2007-2014 LSI Corporation |
7 | * (mailto:DL-MPTFusionLinux@lsi.com) | 7 | * (mailto:DL-MPTFusionLinux@lsi.com) |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
@@ -69,8 +69,8 @@ | |||
69 | #define MPT2SAS_DRIVER_NAME "mpt2sas" | 69 | #define MPT2SAS_DRIVER_NAME "mpt2sas" |
70 | #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" | 70 | #define MPT2SAS_AUTHOR "LSI Corporation <DL-MPTFusionLinux@lsi.com>" |
71 | #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" | 71 | #define MPT2SAS_DESCRIPTION "LSI MPT Fusion SAS 2.0 Device Driver" |
72 | #define MPT2SAS_DRIVER_VERSION "16.100.00.00" | 72 | #define MPT2SAS_DRIVER_VERSION "18.100.00.00" |
73 | #define MPT2SAS_MAJOR_VERSION 16 | 73 | #define MPT2SAS_MAJOR_VERSION 18 |
74 | #define MPT2SAS_MINOR_VERSION 100 | 74 | #define MPT2SAS_MINOR_VERSION 100 |
75 | #define MPT2SAS_BUILD_VERSION 00 | 75 | #define MPT2SAS_BUILD_VERSION 00 |
76 | #define MPT2SAS_RELEASE_VERSION 00 | 76 | #define MPT2SAS_RELEASE_VERSION 00 |
@@ -355,6 +355,7 @@ struct _internal_cmd { | |||
355 | * @slot: number number | 355 | * @slot: number number |
356 | * @phy: phy identifier provided in sas device page 0 | 356 | * @phy: phy identifier provided in sas device page 0 |
357 | * @responding: used in _scsih_sas_device_mark_responding | 357 | * @responding: used in _scsih_sas_device_mark_responding |
358 | * @pfa_led_on: flag for PFA LED status | ||
358 | */ | 359 | */ |
359 | struct _sas_device { | 360 | struct _sas_device { |
360 | struct list_head list; | 361 | struct list_head list; |
@@ -373,6 +374,7 @@ struct _sas_device { | |||
373 | u16 slot; | 374 | u16 slot; |
374 | u8 phy; | 375 | u8 phy; |
375 | u8 responding; | 376 | u8 responding; |
377 | u8 pfa_led_on; | ||
376 | }; | 378 | }; |
377 | 379 | ||
378 | /** | 380 | /** |
@@ -634,6 +636,11 @@ struct mpt2sas_port_facts { | |||
634 | u16 MaxPostedCmdBuffers; | 636 | u16 MaxPostedCmdBuffers; |
635 | }; | 637 | }; |
636 | 638 | ||
639 | struct reply_post_struct { | ||
640 | Mpi2ReplyDescriptorsUnion_t *reply_post_free; | ||
641 | dma_addr_t reply_post_free_dma; | ||
642 | }; | ||
643 | |||
637 | /** | 644 | /** |
638 | * enum mutex_type - task management mutex type | 645 | * enum mutex_type - task management mutex type |
639 | * @TM_MUTEX_OFF: mutex is not required becuase calling function is acquiring it | 646 | * @TM_MUTEX_OFF: mutex is not required becuase calling function is acquiring it |
@@ -661,6 +668,7 @@ typedef void (*MPT2SAS_FLUSH_RUNNING_CMDS)(struct MPT2SAS_ADAPTER *ioc); | |||
661 | * @ir_firmware: IR firmware present | 668 | * @ir_firmware: IR firmware present |
662 | * @bars: bitmask of BAR's that must be configured | 669 | * @bars: bitmask of BAR's that must be configured |
663 | * @mask_interrupts: ignore interrupt | 670 | * @mask_interrupts: ignore interrupt |
671 | * @dma_mask: used to set the consistent dma mask | ||
664 | * @fault_reset_work_q_name: fw fault work queue | 672 | * @fault_reset_work_q_name: fw fault work queue |
665 | * @fault_reset_work_q: "" | 673 | * @fault_reset_work_q: "" |
666 | * @fault_reset_work: "" | 674 | * @fault_reset_work: "" |
@@ -777,8 +785,11 @@ typedef void (*MPT2SAS_FLUSH_RUNNING_CMDS)(struct MPT2SAS_ADAPTER *ioc); | |||
777 | * @reply_free_dma_pool: | 785 | * @reply_free_dma_pool: |
778 | * @reply_free_host_index: tail index in pool to insert free replys | 786 | * @reply_free_host_index: tail index in pool to insert free replys |
779 | * @reply_post_queue_depth: reply post queue depth | 787 | * @reply_post_queue_depth: reply post queue depth |
780 | * @reply_post_free: pool for reply post (64bit descriptor) | 788 | * @reply_post_struct: struct for reply_post_free physical & virt address |
781 | * @reply_post_free_dma: | 789 | * @rdpq_array_capable: FW supports multiple reply queue addresses in ioc_init |
790 | * @rdpq_array_enable: rdpq_array support is enabled in the driver | ||
791 | * @rdpq_array_enable_assigned: this ensures that rdpq_array_enable flag | ||
792 | * is assigned only ones | ||
782 | * @reply_queue_count: number of reply queue's | 793 | * @reply_queue_count: number of reply queue's |
783 | * @reply_queue_list: link list contaning the reply queue info | 794 | * @reply_queue_list: link list contaning the reply queue info |
784 | * @reply_post_host_index: head index in the pool where FW completes IO | 795 | * @reply_post_host_index: head index in the pool where FW completes IO |
@@ -800,6 +811,7 @@ struct MPT2SAS_ADAPTER { | |||
800 | u8 ir_firmware; | 811 | u8 ir_firmware; |
801 | int bars; | 812 | int bars; |
802 | u8 mask_interrupts; | 813 | u8 mask_interrupts; |
814 | int dma_mask; | ||
803 | 815 | ||
804 | /* fw fault handler */ | 816 | /* fw fault handler */ |
805 | char fault_reset_work_q_name[20]; | 817 | char fault_reset_work_q_name[20]; |
@@ -970,8 +982,10 @@ struct MPT2SAS_ADAPTER { | |||
970 | 982 | ||
971 | /* reply post queue */ | 983 | /* reply post queue */ |
972 | u16 reply_post_queue_depth; | 984 | u16 reply_post_queue_depth; |
973 | Mpi2ReplyDescriptorsUnion_t *reply_post_free; | 985 | struct reply_post_struct *reply_post; |
974 | dma_addr_t reply_post_free_dma; | 986 | u8 rdpq_array_capable; |
987 | u8 rdpq_array_enable; | ||
988 | u8 rdpq_array_enable_assigned; | ||
975 | struct dma_pool *reply_post_free_dma_pool; | 989 | struct dma_pool *reply_post_free_dma_pool; |
976 | u8 reply_queue_count; | 990 | u8 reply_queue_count; |
977 | struct list_head reply_queue_list; | 991 | struct list_head reply_queue_list; |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_config.c b/drivers/scsi/mpt2sas/mpt2sas_config.c index 0c47425c73f2..c72a2fff5dbb 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_config.c +++ b/drivers/scsi/mpt2sas/mpt2sas_config.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * This module provides common API for accessing firmware configuration pages | 2 | * This module provides common API for accessing firmware configuration pages |
3 | * | 3 | * |
4 | * This code is based on drivers/scsi/mpt2sas/mpt2_base.c | 4 | * This code is based on drivers/scsi/mpt2sas/mpt2_base.c |
5 | * Copyright (C) 2007-2013 LSI Corporation | 5 | * Copyright (C) 2007-2014 LSI Corporation |
6 | * (mailto:DL-MPTFusionLinux@lsi.com) | 6 | * (mailto:DL-MPTFusionLinux@lsi.com) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index 62df8f9d4271..ca4e563c01dd 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * controllers | 3 | * controllers |
4 | * | 4 | * |
5 | * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.c | 5 | * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.c |
6 | * Copyright (C) 2007-2013 LSI Corporation | 6 | * Copyright (C) 2007-2014 LSI Corporation |
7 | * (mailto:DL-MPTFusionLinux@lsi.com) | 7 | * (mailto:DL-MPTFusionLinux@lsi.com) |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.h b/drivers/scsi/mpt2sas/mpt2sas_ctl.h index 60d76f435a68..7f842c88abd2 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.h +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * controllers | 3 | * controllers |
4 | * | 4 | * |
5 | * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.h | 5 | * This code is based on drivers/scsi/mpt2sas/mpt2_ctl.h |
6 | * Copyright (C) 2007-2013 LSI Corporation | 6 | * Copyright (C) 2007-2014 LSI Corporation |
7 | * (mailto:DL-MPTFusionLinux@lsi.com) | 7 | * (mailto:DL-MPTFusionLinux@lsi.com) |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or | 9 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_debug.h b/drivers/scsi/mpt2sas/mpt2sas_debug.h index a9021cbd6628..cc57ef31d0fe 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_debug.h +++ b/drivers/scsi/mpt2sas/mpt2sas_debug.h | |||
@@ -2,7 +2,7 @@ | |||
2 | * Logging Support for MPT (Message Passing Technology) based controllers | 2 | * Logging Support for MPT (Message Passing Technology) based controllers |
3 | * | 3 | * |
4 | * This code is based on drivers/scsi/mpt2sas/mpt2_debug.c | 4 | * This code is based on drivers/scsi/mpt2sas/mpt2_debug.c |
5 | * Copyright (C) 2007-2013 LSI Corporation | 5 | * Copyright (C) 2007-2014 LSI Corporation |
6 | * (mailto:DL-MPTFusionLinux@lsi.com) | 6 | * (mailto:DL-MPTFusionLinux@lsi.com) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c index dd461015813f..c80ed0482649 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c +++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * Scsi Host Layer for MPT (Message Passing Technology) based controllers | 2 | * Scsi Host Layer for MPT (Message Passing Technology) based controllers |
3 | * | 3 | * |
4 | * This code is based on drivers/scsi/mpt2sas/mpt2_scsih.c | 4 | * This code is based on drivers/scsi/mpt2sas/mpt2_scsih.c |
5 | * Copyright (C) 2007-2013 LSI Corporation | 5 | * Copyright (C) 2007-2014 LSI Corporation |
6 | * (mailto:DL-MPTFusionLinux@lsi.com) | 6 | * (mailto:DL-MPTFusionLinux@lsi.com) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
@@ -55,6 +55,8 @@ | |||
55 | #include <linux/raid_class.h> | 55 | #include <linux/raid_class.h> |
56 | #include <linux/slab.h> | 56 | #include <linux/slab.h> |
57 | 57 | ||
58 | #include <asm/unaligned.h> | ||
59 | |||
58 | #include "mpt2sas_base.h" | 60 | #include "mpt2sas_base.h" |
59 | 61 | ||
60 | MODULE_AUTHOR(MPT2SAS_AUTHOR); | 62 | MODULE_AUTHOR(MPT2SAS_AUTHOR); |
@@ -145,7 +147,7 @@ struct sense_info { | |||
145 | }; | 147 | }; |
146 | 148 | ||
147 | 149 | ||
148 | #define MPT2SAS_TURN_ON_FAULT_LED (0xFFFC) | 150 | #define MPT2SAS_TURN_ON_PFA_LED (0xFFFC) |
149 | #define MPT2SAS_PORT_ENABLE_COMPLETE (0xFFFD) | 151 | #define MPT2SAS_PORT_ENABLE_COMPLETE (0xFFFD) |
150 | #define MPT2SAS_REMOVE_UNRESPONDING_DEVICES (0xFFFF) | 152 | #define MPT2SAS_REMOVE_UNRESPONDING_DEVICES (0xFFFF) |
151 | /** | 153 | /** |
@@ -3858,85 +3860,46 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | |||
3858 | struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, | 3860 | struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, |
3859 | u16 smid) | 3861 | u16 smid) |
3860 | { | 3862 | { |
3861 | u32 v_lba, p_lba, stripe_off, stripe_unit, column, io_size; | 3863 | sector_t v_lba, p_lba, stripe_off, column, io_size; |
3862 | u32 stripe_sz, stripe_exp; | 3864 | u32 stripe_sz, stripe_exp; |
3863 | u8 num_pds, *cdb_ptr, i; | 3865 | u8 num_pds, cmd = scmd->cmnd[0]; |
3864 | u8 cdb0 = scmd->cmnd[0]; | ||
3865 | u64 v_llba; | ||
3866 | 3866 | ||
3867 | /* | 3867 | if (cmd != READ_10 && cmd != WRITE_10 && |
3868 | * Try Direct I/O to RAID memeber disks | 3868 | cmd != READ_16 && cmd != WRITE_16) |
3869 | */ | 3869 | return; |
3870 | if (cdb0 == READ_16 || cdb0 == READ_10 || | 3870 | |
3871 | cdb0 == WRITE_16 || cdb0 == WRITE_10) { | 3871 | if (cmd == READ_10 || cmd == WRITE_10) |
3872 | cdb_ptr = mpi_request->CDB.CDB32; | 3872 | v_lba = get_unaligned_be32(&mpi_request->CDB.CDB32[2]); |
3873 | 3873 | else | |
3874 | if ((cdb0 < READ_16) || !(cdb_ptr[2] | cdb_ptr[3] | cdb_ptr[4] | 3874 | v_lba = get_unaligned_be64(&mpi_request->CDB.CDB32[2]); |
3875 | | cdb_ptr[5])) { | 3875 | |
3876 | io_size = scsi_bufflen(scmd) >> | 3876 | io_size = scsi_bufflen(scmd) >> raid_device->block_exponent; |
3877 | raid_device->block_exponent; | 3877 | |
3878 | i = (cdb0 < READ_16) ? 2 : 6; | 3878 | if (v_lba + io_size - 1 > raid_device->max_lba) |
3879 | /* get virtual lba */ | 3879 | return; |
3880 | v_lba = be32_to_cpu(*(__be32 *)(&cdb_ptr[i])); | 3880 | |
3881 | 3881 | stripe_sz = raid_device->stripe_sz; | |
3882 | if (((u64)v_lba + (u64)io_size - 1) <= | 3882 | stripe_exp = raid_device->stripe_exponent; |
3883 | (u32)raid_device->max_lba) { | 3883 | stripe_off = v_lba & (stripe_sz - 1); |
3884 | stripe_sz = raid_device->stripe_sz; | 3884 | |
3885 | stripe_exp = raid_device->stripe_exponent; | 3885 | /* Return unless IO falls within a stripe */ |
3886 | stripe_off = v_lba & (stripe_sz - 1); | 3886 | if (stripe_off + io_size > stripe_sz) |
3887 | 3887 | return; | |
3888 | /* Check whether IO falls within a stripe */ | 3888 | |
3889 | if ((stripe_off + io_size) <= stripe_sz) { | 3889 | num_pds = raid_device->num_pds; |
3890 | num_pds = raid_device->num_pds; | 3890 | p_lba = v_lba >> stripe_exp; |
3891 | p_lba = v_lba >> stripe_exp; | 3891 | column = sector_div(p_lba, num_pds); |
3892 | stripe_unit = p_lba / num_pds; | 3892 | p_lba = (p_lba << stripe_exp) + stripe_off; |
3893 | column = p_lba % num_pds; | 3893 | |
3894 | p_lba = (stripe_unit << stripe_exp) + | 3894 | mpi_request->DevHandle = cpu_to_le16(raid_device->pd_handle[column]); |
3895 | stripe_off; | 3895 | |
3896 | mpi_request->DevHandle = | 3896 | if (cmd == READ_10 || cmd == WRITE_10) |
3897 | cpu_to_le16(raid_device-> | 3897 | put_unaligned_be32(lower_32_bits(p_lba), |
3898 | pd_handle[column]); | 3898 | &mpi_request->CDB.CDB32[2]); |
3899 | (*(__be32 *)(&cdb_ptr[i])) = | 3899 | else |
3900 | cpu_to_be32(p_lba); | 3900 | put_unaligned_be64(p_lba, &mpi_request->CDB.CDB32[2]); |
3901 | /* | 3901 | |
3902 | * WD: To indicate this I/O is directI/O | 3902 | _scsih_scsi_direct_io_set(ioc, smid, 1); |
3903 | */ | ||
3904 | _scsih_scsi_direct_io_set(ioc, smid, 1); | ||
3905 | } | ||
3906 | } | ||
3907 | } else { | ||
3908 | io_size = scsi_bufflen(scmd) >> | ||
3909 | raid_device->block_exponent; | ||
3910 | /* get virtual lba */ | ||
3911 | v_llba = be64_to_cpu(*(__be64 *)(&cdb_ptr[2])); | ||
3912 | |||
3913 | if ((v_llba + (u64)io_size - 1) <= | ||
3914 | raid_device->max_lba) { | ||
3915 | stripe_sz = raid_device->stripe_sz; | ||
3916 | stripe_exp = raid_device->stripe_exponent; | ||
3917 | stripe_off = (u32) (v_llba & (stripe_sz - 1)); | ||
3918 | |||
3919 | /* Check whether IO falls within a stripe */ | ||
3920 | if ((stripe_off + io_size) <= stripe_sz) { | ||
3921 | num_pds = raid_device->num_pds; | ||
3922 | p_lba = (u32)(v_llba >> stripe_exp); | ||
3923 | stripe_unit = p_lba / num_pds; | ||
3924 | column = p_lba % num_pds; | ||
3925 | p_lba = (stripe_unit << stripe_exp) + | ||
3926 | stripe_off; | ||
3927 | mpi_request->DevHandle = | ||
3928 | cpu_to_le16(raid_device-> | ||
3929 | pd_handle[column]); | ||
3930 | (*(__be64 *)(&cdb_ptr[2])) = | ||
3931 | cpu_to_be64((u64)p_lba); | ||
3932 | /* | ||
3933 | * WD: To indicate this I/O is directI/O | ||
3934 | */ | ||
3935 | _scsih_scsi_direct_io_set(ioc, smid, 1); | ||
3936 | } | ||
3937 | } | ||
3938 | } | ||
3939 | } | ||
3940 | } | 3903 | } |
3941 | 3904 | ||
3942 | /** | 3905 | /** |
@@ -4308,7 +4271,7 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | |||
4308 | #endif | 4271 | #endif |
4309 | 4272 | ||
4310 | /** | 4273 | /** |
4311 | * _scsih_turn_on_fault_led - illuminate Fault LED | 4274 | * _scsih_turn_on_pfa_led - illuminate PFA LED |
4312 | * @ioc: per adapter object | 4275 | * @ioc: per adapter object |
4313 | * @handle: device handle | 4276 | * @handle: device handle |
4314 | * Context: process | 4277 | * Context: process |
@@ -4316,10 +4279,15 @@ _scsih_scsi_ioc_info(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | |||
4316 | * Return nothing. | 4279 | * Return nothing. |
4317 | */ | 4280 | */ |
4318 | static void | 4281 | static void |
4319 | _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) | 4282 | _scsih_turn_on_pfa_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) |
4320 | { | 4283 | { |
4321 | Mpi2SepReply_t mpi_reply; | 4284 | Mpi2SepReply_t mpi_reply; |
4322 | Mpi2SepRequest_t mpi_request; | 4285 | Mpi2SepRequest_t mpi_request; |
4286 | struct _sas_device *sas_device; | ||
4287 | |||
4288 | sas_device = _scsih_sas_device_find_by_handle(ioc, handle); | ||
4289 | if (!sas_device) | ||
4290 | return; | ||
4323 | 4291 | ||
4324 | memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); | 4292 | memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); |
4325 | mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; | 4293 | mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; |
@@ -4334,6 +4302,47 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
4334 | __FILE__, __LINE__, __func__); | 4302 | __FILE__, __LINE__, __func__); |
4335 | return; | 4303 | return; |
4336 | } | 4304 | } |
4305 | sas_device->pfa_led_on = 1; | ||
4306 | |||
4307 | |||
4308 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { | ||
4309 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT | ||
4310 | "enclosure_processor: ioc_status (0x%04x), loginfo(0x%08x)\n", | ||
4311 | ioc->name, le16_to_cpu(mpi_reply.IOCStatus), | ||
4312 | le32_to_cpu(mpi_reply.IOCLogInfo))); | ||
4313 | return; | ||
4314 | } | ||
4315 | } | ||
4316 | |||
4317 | /** | ||
4318 | * _scsih_turn_off_pfa_led - turn off PFA LED | ||
4319 | * @ioc: per adapter object | ||
4320 | * @sas_device: sas device whose PFA LED has to turned off | ||
4321 | * Context: process | ||
4322 | * | ||
4323 | * Return nothing. | ||
4324 | */ | ||
4325 | static void | ||
4326 | _scsih_turn_off_pfa_led(struct MPT2SAS_ADAPTER *ioc, | ||
4327 | struct _sas_device *sas_device) | ||
4328 | { | ||
4329 | Mpi2SepReply_t mpi_reply; | ||
4330 | Mpi2SepRequest_t mpi_request; | ||
4331 | |||
4332 | memset(&mpi_request, 0, sizeof(Mpi2SepRequest_t)); | ||
4333 | mpi_request.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; | ||
4334 | mpi_request.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS; | ||
4335 | mpi_request.SlotStatus = 0; | ||
4336 | mpi_request.Slot = cpu_to_le16(sas_device->slot); | ||
4337 | mpi_request.DevHandle = 0; | ||
4338 | mpi_request.EnclosureHandle = cpu_to_le16(sas_device->enclosure_handle); | ||
4339 | mpi_request.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; | ||
4340 | if ((mpt2sas_base_scsi_enclosure_processor(ioc, &mpi_reply, | ||
4341 | &mpi_request)) != 0) { | ||
4342 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", ioc->name, | ||
4343 | __FILE__, __LINE__, __func__); | ||
4344 | return; | ||
4345 | } | ||
4337 | 4346 | ||
4338 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { | 4347 | if (mpi_reply.IOCStatus || mpi_reply.IOCLogInfo) { |
4339 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "enclosure_processor: " | 4348 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "enclosure_processor: " |
@@ -4345,7 +4354,7 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
4345 | } | 4354 | } |
4346 | 4355 | ||
4347 | /** | 4356 | /** |
4348 | * _scsih_send_event_to_turn_on_fault_led - fire delayed event | 4357 | * _scsih_send_event_to_turn_on_pfa_led - fire delayed event |
4349 | * @ioc: per adapter object | 4358 | * @ioc: per adapter object |
4350 | * @handle: device handle | 4359 | * @handle: device handle |
4351 | * Context: interrupt. | 4360 | * Context: interrupt. |
@@ -4353,14 +4362,14 @@ _scsih_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
4353 | * Return nothing. | 4362 | * Return nothing. |
4354 | */ | 4363 | */ |
4355 | static void | 4364 | static void |
4356 | _scsih_send_event_to_turn_on_fault_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) | 4365 | _scsih_send_event_to_turn_on_pfa_led(struct MPT2SAS_ADAPTER *ioc, u16 handle) |
4357 | { | 4366 | { |
4358 | struct fw_event_work *fw_event; | 4367 | struct fw_event_work *fw_event; |
4359 | 4368 | ||
4360 | fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC); | 4369 | fw_event = kzalloc(sizeof(struct fw_event_work), GFP_ATOMIC); |
4361 | if (!fw_event) | 4370 | if (!fw_event) |
4362 | return; | 4371 | return; |
4363 | fw_event->event = MPT2SAS_TURN_ON_FAULT_LED; | 4372 | fw_event->event = MPT2SAS_TURN_ON_PFA_LED; |
4364 | fw_event->device_handle = handle; | 4373 | fw_event->device_handle = handle; |
4365 | fw_event->ioc = ioc; | 4374 | fw_event->ioc = ioc; |
4366 | _scsih_fw_event_add(ioc, fw_event); | 4375 | _scsih_fw_event_add(ioc, fw_event); |
@@ -4404,7 +4413,7 @@ _scsih_smart_predicted_fault(struct MPT2SAS_ADAPTER *ioc, u16 handle) | |||
4404 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); | 4413 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
4405 | 4414 | ||
4406 | if (ioc->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM) | 4415 | if (ioc->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM) |
4407 | _scsih_send_event_to_turn_on_fault_led(ioc, handle); | 4416 | _scsih_send_event_to_turn_on_pfa_led(ioc, handle); |
4408 | 4417 | ||
4409 | /* insert into event log */ | 4418 | /* insert into event log */ |
4410 | sz = offsetof(Mpi2EventNotificationReply_t, EventData) + | 4419 | sz = offsetof(Mpi2EventNotificationReply_t, EventData) + |
@@ -5325,6 +5334,12 @@ _scsih_remove_device(struct MPT2SAS_ADAPTER *ioc, | |||
5325 | { | 5334 | { |
5326 | struct MPT2SAS_TARGET *sas_target_priv_data; | 5335 | struct MPT2SAS_TARGET *sas_target_priv_data; |
5327 | 5336 | ||
5337 | if ((ioc->pdev->subsystem_vendor == PCI_VENDOR_ID_IBM) && | ||
5338 | (sas_device->pfa_led_on)) { | ||
5339 | _scsih_turn_off_pfa_led(ioc, sas_device); | ||
5340 | sas_device->pfa_led_on = 0; | ||
5341 | } | ||
5342 | |||
5328 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter: " | 5343 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter: " |
5329 | "handle(0x%04x), sas_addr(0x%016llx)\n", ioc->name, __func__, | 5344 | "handle(0x%04x), sas_addr(0x%016llx)\n", ioc->name, __func__, |
5330 | sas_device->handle, (unsigned long long) | 5345 | sas_device->handle, (unsigned long long) |
@@ -7441,8 +7456,8 @@ _firmware_event_work(struct work_struct *work) | |||
7441 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete " | 7456 | dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete " |
7442 | "from worker thread\n", ioc->name)); | 7457 | "from worker thread\n", ioc->name)); |
7443 | break; | 7458 | break; |
7444 | case MPT2SAS_TURN_ON_FAULT_LED: | 7459 | case MPT2SAS_TURN_ON_PFA_LED: |
7445 | _scsih_turn_on_fault_led(ioc, fw_event->device_handle); | 7460 | _scsih_turn_on_pfa_led(ioc, fw_event->device_handle); |
7446 | break; | 7461 | break; |
7447 | case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST: | 7462 | case MPI2_EVENT_SAS_TOPOLOGY_CHANGE_LIST: |
7448 | _scsih_sas_topology_change_event(ioc, fw_event); | 7463 | _scsih_sas_topology_change_event(ioc, fw_event); |
@@ -8132,6 +8147,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
8132 | { | 8147 | { |
8133 | struct MPT2SAS_ADAPTER *ioc; | 8148 | struct MPT2SAS_ADAPTER *ioc; |
8134 | struct Scsi_Host *shost; | 8149 | struct Scsi_Host *shost; |
8150 | int rv; | ||
8135 | 8151 | ||
8136 | shost = scsi_host_alloc(&scsih_driver_template, | 8152 | shost = scsi_host_alloc(&scsih_driver_template, |
8137 | sizeof(struct MPT2SAS_ADAPTER)); | 8153 | sizeof(struct MPT2SAS_ADAPTER)); |
@@ -8227,6 +8243,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
8227 | if (!ioc->firmware_event_thread) { | 8243 | if (!ioc->firmware_event_thread) { |
8228 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | 8244 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", |
8229 | ioc->name, __FILE__, __LINE__, __func__); | 8245 | ioc->name, __FILE__, __LINE__, __func__); |
8246 | rv = -ENODEV; | ||
8230 | goto out_thread_fail; | 8247 | goto out_thread_fail; |
8231 | } | 8248 | } |
8232 | 8249 | ||
@@ -8234,6 +8251,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
8234 | if ((mpt2sas_base_attach(ioc))) { | 8251 | if ((mpt2sas_base_attach(ioc))) { |
8235 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | 8252 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", |
8236 | ioc->name, __FILE__, __LINE__, __func__); | 8253 | ioc->name, __FILE__, __LINE__, __func__); |
8254 | rv = -ENODEV; | ||
8237 | goto out_attach_fail; | 8255 | goto out_attach_fail; |
8238 | } | 8256 | } |
8239 | 8257 | ||
@@ -8251,7 +8269,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
8251 | } else | 8269 | } else |
8252 | ioc->hide_drives = 0; | 8270 | ioc->hide_drives = 0; |
8253 | 8271 | ||
8254 | if ((scsi_add_host(shost, &pdev->dev))) { | 8272 | rv = scsi_add_host(shost, &pdev->dev); |
8273 | if (rv) { | ||
8255 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", | 8274 | printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n", |
8256 | ioc->name, __FILE__, __LINE__, __func__); | 8275 | ioc->name, __FILE__, __LINE__, __func__); |
8257 | goto out_add_shost_fail; | 8276 | goto out_add_shost_fail; |
@@ -8268,7 +8287,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
8268 | out_thread_fail: | 8287 | out_thread_fail: |
8269 | list_del(&ioc->list); | 8288 | list_del(&ioc->list); |
8270 | scsi_host_put(shost); | 8289 | scsi_host_put(shost); |
8271 | return -ENODEV; | 8290 | return rv; |
8272 | } | 8291 | } |
8273 | 8292 | ||
8274 | #ifdef CONFIG_PM | 8293 | #ifdef CONFIG_PM |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 410f4a3e8888..0d1d06488a28 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * SAS Transport Layer for MPT (Message Passing Technology) based controllers | 2 | * SAS Transport Layer for MPT (Message Passing Technology) based controllers |
3 | * | 3 | * |
4 | * This code is based on drivers/scsi/mpt2sas/mpt2_transport.c | 4 | * This code is based on drivers/scsi/mpt2sas/mpt2_transport.c |
5 | * Copyright (C) 2007-2013 LSI Corporation | 5 | * Copyright (C) 2007-2014 LSI Corporation |
6 | * (mailto:DL-MPTFusionLinux@lsi.com) | 6 | * (mailto:DL-MPTFusionLinux@lsi.com) |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |