Message ID | 1521540956-42347-1-git-send-email-chaitra.basappa@broadcom.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Hi Chaitra, I love your patch! Perhaps something to improve: [auto build test WARNING on v4.16-rc4] [also build test WARNING on next-20180320] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Chaitra-P-B/mpt3sas-Cache-enclosure-pages-during-enclosure-add/20180320-220411 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) >> drivers/scsi/mpt3sas/mpt3sas_scsih.c:6100:63: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got restriunsigned short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:6100:63: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:6100:63: got restricted __le16 [addressable] [usertype] EnclosureHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:6907:13: sparse: cast to restricted __le16 drivers/scsi/mpt3sas/mpt3sas_scsih.c:6907:13: sparse: cast from restricted __le32 drivers/scsi/mpt3sas/mpt3sas_scsih.c:160:22: sparse: symbol 'mpt3sas_raid_template' was not declared. Should it be static? drivers/scsi/mpt3sas/mpt3sas_scsih.c:161:22: sparse: symbol 'mpt2sas_raid_template' was not declared. Should it be static? >> drivers/scsi/mpt3sas/mpt3sas_scsih.c:1373:24: sparse: symbol 'mpt3sas_scsih_enclosure_find_by_handle' was not declared. Should it be static? drivers/scsi/mpt3sas/mpt3sas_scsih.c:3749:36: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:3749:36: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:3749:36: got restricted __le16 [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:3942:9: sparse: cast to restricted __le16 drivers/scsi/mpt3sas/mpt3sas_scsih.c:3949:28: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] Event @@ got unsignedrestricted __le16 [usertype] Event @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:3949:28: expected restricted __le16 [usertype] Event drivers/scsi/mpt3sas/mpt3sas_scsih.c:3949:28: got unsigned short [unsigned] [usertype] event drivers/scsi/mpt3sas/mpt3sas_scsih.c:3950:35: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] EventContext @@ got unsignrestricted __le32 [usertype] EventContext @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:3950:35: expected restricted __le32 [usertype] EventContext drivers/scsi/mpt3sas/mpt3sas_scsih.c:3950:35: got unsigned int [unsigned] [usertype] event_context drivers/scsi/mpt3sas/mpt3sas_scsih.c:4001:9: sparse: cast to restricted __le16 drivers/scsi/mpt3sas/mpt3sas_scsih.c:4009:32: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] DevHandle @@ got unsignedrestricted __le16 [usertype] DevHandle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:4009:32: expected restricted __le16 [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:4009:32: got unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:4531:61: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] PrimaryReferenceTag @@ got restricted __le32 [usertype] PrimaryReferenceTag @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:4531:61: expected restricted __le32 [usertype] PrimaryReferenceTag drivers/scsi/mpt3sas/mpt3sas_scsih.c:4531:61: got restricted __be32 [usertype] <noident> >> drivers/scsi/mpt3sas/mpt3sas_scsih.c:7324:37: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] EnclosureHandle @@ got unsignedrestricted __le16 [usertype] EnclosureHandle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:7324:37: expected restricted __le16 [usertype] EnclosureHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:7324:37: got unsigned short [unsigned] [usertype] <noident> >> drivers/scsi/mpt3sas/mpt3sas_scsih.c:7329:59: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:7329:59: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:7329:59: got restricted __le16 [usertype] EnclosureHandle >> drivers/scsi/mpt3sas/mpt3sas_scsih.c:7345:43: sparse: incorrect type in argument 5 (different base types) @@ expected unsigned int [unsigned] [usertype] handle @@ got ed int [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:7345:43: expected unsigned int [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:7345:43: got restricted __le16 [usertype] EnclosureHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8408:55: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8408:55: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8408:55: got restricted __le16 [usertype] EnclosureHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8416:63: sparse: restricted __le64 degrades to integer drivers/scsi/mpt3sas/mpt3sas_scsih.c:8417:60: sparse: restricted __le16 degrades to integer drivers/scsi/mpt3sas/mpt3sas_scsih.c:8441:43: sparse: restricted __le16 degrades to integer drivers/scsi/mpt3sas/mpt3sas_scsih.c:8466:65: sparse: restricted __le16 degrades to integer drivers/scsi/mpt3sas/mpt3sas_scsih.c:8470:44: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8470:44: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8470:44: got restricted __le16 [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8472:62: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8472:62: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8472:62: got restricted __le16 [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8558:51: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [addressable] [usertype] DevHandle @@ got cted __le16 [addressable] [usertype] DevHandle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8558:51: expected restricted __le16 [addressable] [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8558:51: got unsigned short [unsigned] [usertype] <noident> drivers/scsi/mpt3sas/mpt3sas_scsih.c:8563:43: sparse: incorrect type in assignment (different base types) @@ expected restricted __le64 [addressable] [usertype] SASAddress @@ got stricted __le64 [addressable] [usertype] SASAddress @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8563:43: expected restricted __le64 [addressable] [usertype] SASAddress drivers/scsi/mpt3sas/mpt3sas_scsih.c:8563:43: got unsigned long long [unsigned] [usertype] <noident> drivers/scsi/mpt3sas/mpt3sas_scsih.c:8565:37: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [addressable] [usertype] Slot @@ got cted __le16 [addressable] [usertype] Slot @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8565:37: expected restricted __le16 [addressable] [usertype] Slot drivers/scsi/mpt3sas/mpt3sas_scsih.c:8565:37: got unsigned short [unsigned] [usertype] <noident> drivers/scsi/mpt3sas/mpt3sas_scsih.c:8566:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [addressable] [usertype] Flags @@ got cted __le16 [addressable] [usertype] Flags @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8566:38: expected restricted __le16 [addressable] [usertype] Flags drivers/scsi/mpt3sas/mpt3sas_scsih.c:8566:38: got unsigned short [unsigned] [usertype] <noident> drivers/scsi/mpt3sas/mpt3sas_scsih.c:8596:58: sparse: restricted __le64 degrades to integer drivers/scsi/mpt3sas/mpt3sas_scsih.c:8597:58: sparse: restricted __le16 degrades to integer drivers/scsi/mpt3sas/mpt3sas_scsih.c:8632:67: sparse: restricted __le16 degrades to integer drivers/scsi/mpt3sas/mpt3sas_scsih.c:8636:45: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8636:45: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8636:45: got restricted __le16 [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8638:62: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [unsigned] [usertype] handle @@ got short [unsigned] [usertype] handle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8638:62: expected unsigned short [unsigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8638:62: got restricted __le16 [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8688:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le64 [addressable] [usertype] WWID @@ got stricted __le64 [addressable] [usertype] WWID @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8688:38: expected restricted __le64 [addressable] [usertype] WWID drivers/scsi/mpt3sas/mpt3sas_scsih.c:8688:38: got unsigned long long [unsigned] [usertype] <noident> drivers/scsi/mpt3sas/mpt3sas_scsih.c:8689:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [addressable] [usertype] Slot @@ got cted __le16 [addressable] [usertype] Slot @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8689:38: expected restricted __le16 [addressable] [usertype] Slot drivers/scsi/mpt3sas/mpt3sas_scsih.c:8689:38: got unsigned short [unsigned] [usertype] <noident> drivers/scsi/mpt3sas/mpt3sas_scsih.c:8690:39: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [addressable] [usertype] Flags @@ got ed __le32 [addressable] [usertype] Flags @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8690:39: expected restricted __le32 [addressable] [usertype] Flags drivers/scsi/mpt3sas/mpt3sas_scsih.c:8690:39: got unsigned int [unsigned] [usertype] <noident> drivers/scsi/mpt3sas/mpt3sas_scsih.c:8691:43: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [addressable] [usertype] DevHandle @@ got unsigrestricted __le16 [addressable] [usertype] DevHandle @@ drivers/scsi/mpt3sas/mpt3sas_scsih.c:8691:43: expected restricted __le16 [addressable] [usertype] DevHandle drivers/scsi/mpt3sas/mpt3sas_scsih.c:8691:43: got unsigned short [unsigned] [assigned] [usertype] handle drivers/scsi/mpt3sas/mpt3sas_scsih.c:9610:25: sparse: cast to restricted __le32 Please review and possibly fold the followup patch. vim +6100 drivers/scsi/mpt3sas/mpt3sas_scsih.c f92363d12 Sreekanth Reddy 2012-11-30 6030 f92363d12 Sreekanth Reddy 2012-11-30 6031 /** f92363d12 Sreekanth Reddy 2012-11-30 6032 * _scsih_add_device - creating sas device object f92363d12 Sreekanth Reddy 2012-11-30 6033 * @ioc: per adapter object f92363d12 Sreekanth Reddy 2012-11-30 6034 * @handle: sas device handle f92363d12 Sreekanth Reddy 2012-11-30 6035 * @phy_num: phy number end device attached to f92363d12 Sreekanth Reddy 2012-11-30 6036 * @is_pd: is this hidden raid component f92363d12 Sreekanth Reddy 2012-11-30 6037 * f92363d12 Sreekanth Reddy 2012-11-30 6038 * Creating end device object, stored in ioc->sas_device_list. f92363d12 Sreekanth Reddy 2012-11-30 6039 * f92363d12 Sreekanth Reddy 2012-11-30 6040 * Returns 0 for success, non-zero for failure. f92363d12 Sreekanth Reddy 2012-11-30 6041 */ f92363d12 Sreekanth Reddy 2012-11-30 6042 static int f92363d12 Sreekanth Reddy 2012-11-30 6043 _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, f92363d12 Sreekanth Reddy 2012-11-30 6044 u8 is_pd) f92363d12 Sreekanth Reddy 2012-11-30 6045 { f92363d12 Sreekanth Reddy 2012-11-30 6046 Mpi2ConfigReply_t mpi_reply; f92363d12 Sreekanth Reddy 2012-11-30 6047 Mpi2SasDevicePage0_t sas_device_pg0; f92363d12 Sreekanth Reddy 2012-11-30 6048 struct _sas_device *sas_device; 793a6223b Chaitra P B 2018-03-20 6049 struct _enclosure_node *enclosure_dev = NULL; f92363d12 Sreekanth Reddy 2012-11-30 6050 u32 ioc_status; f92363d12 Sreekanth Reddy 2012-11-30 6051 u64 sas_address; f92363d12 Sreekanth Reddy 2012-11-30 6052 u32 device_info; f92363d12 Sreekanth Reddy 2012-11-30 6053 f92363d12 Sreekanth Reddy 2012-11-30 6054 if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, f92363d12 Sreekanth Reddy 2012-11-30 6055 MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { f92363d12 Sreekanth Reddy 2012-11-30 6056 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", f92363d12 Sreekanth Reddy 2012-11-30 6057 ioc->name, __FILE__, __LINE__, __func__); f92363d12 Sreekanth Reddy 2012-11-30 6058 return -1; f92363d12 Sreekanth Reddy 2012-11-30 6059 } f92363d12 Sreekanth Reddy 2012-11-30 6060 f92363d12 Sreekanth Reddy 2012-11-30 6061 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & f92363d12 Sreekanth Reddy 2012-11-30 6062 MPI2_IOCSTATUS_MASK; f92363d12 Sreekanth Reddy 2012-11-30 6063 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { f92363d12 Sreekanth Reddy 2012-11-30 6064 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", f92363d12 Sreekanth Reddy 2012-11-30 6065 ioc->name, __FILE__, __LINE__, __func__); f92363d12 Sreekanth Reddy 2012-11-30 6066 return -1; f92363d12 Sreekanth Reddy 2012-11-30 6067 } f92363d12 Sreekanth Reddy 2012-11-30 6068 f92363d12 Sreekanth Reddy 2012-11-30 6069 /* check if this is end device */ f92363d12 Sreekanth Reddy 2012-11-30 6070 device_info = le32_to_cpu(sas_device_pg0.DeviceInfo); f92363d12 Sreekanth Reddy 2012-11-30 6071 if (!(_scsih_is_end_device(device_info))) f92363d12 Sreekanth Reddy 2012-11-30 6072 return -1; c696f7b83 Suganath Prabu Subramani 2016-10-26 6073 set_bit(handle, ioc->pend_os_device_add); f92363d12 Sreekanth Reddy 2012-11-30 6074 sas_address = le64_to_cpu(sas_device_pg0.SASAddress); f92363d12 Sreekanth Reddy 2012-11-30 6075 f92363d12 Sreekanth Reddy 2012-11-30 6076 /* check if device is present */ f92363d12 Sreekanth Reddy 2012-11-30 6077 if (!(le16_to_cpu(sas_device_pg0.Flags) & f92363d12 Sreekanth Reddy 2012-11-30 6078 MPI2_SAS_DEVICE0_FLAGS_DEVICE_PRESENT)) { f92363d12 Sreekanth Reddy 2012-11-30 6079 pr_err(MPT3SAS_FMT "device is not present handle(0x04%x)!!!\n", f92363d12 Sreekanth Reddy 2012-11-30 6080 ioc->name, handle); f92363d12 Sreekanth Reddy 2012-11-30 6081 return -1; f92363d12 Sreekanth Reddy 2012-11-30 6082 } f92363d12 Sreekanth Reddy 2012-11-30 6083 f92363d12 Sreekanth Reddy 2012-11-30 6084 /* check if there were any issues with discovery */ f92363d12 Sreekanth Reddy 2012-11-30 6085 if (_scsih_check_access_status(ioc, sas_address, handle, f92363d12 Sreekanth Reddy 2012-11-30 6086 sas_device_pg0.AccessStatus)) f92363d12 Sreekanth Reddy 2012-11-30 6087 return -1; f92363d12 Sreekanth Reddy 2012-11-30 6088 d1cb5e495 Sreekanth Reddy 2015-11-11 6089 sas_device = mpt3sas_get_sdev_by_addr(ioc, f92363d12 Sreekanth Reddy 2012-11-30 6090 sas_address); d1cb5e495 Sreekanth Reddy 2015-11-11 6091 if (sas_device) { c696f7b83 Suganath Prabu Subramani 2016-10-26 6092 clear_bit(handle, ioc->pend_os_device_add); d1cb5e495 Sreekanth Reddy 2015-11-11 6093 sas_device_put(sas_device); f92363d12 Sreekanth Reddy 2012-11-30 6094 return -1; d1cb5e495 Sreekanth Reddy 2015-11-11 6095 } f92363d12 Sreekanth Reddy 2012-11-30 6096 758889564 Sreekanth Reddy 2017-10-10 6097 if (sas_device_pg0.EnclosureHandle) { 793a6223b Chaitra P B 2018-03-20 6098 enclosure_dev = 793a6223b Chaitra P B 2018-03-20 6099 mpt3sas_scsih_enclosure_find_by_handle(ioc, 758889564 Sreekanth Reddy 2017-10-10 @6100 sas_device_pg0.EnclosureHandle); 793a6223b Chaitra P B 2018-03-20 6101 if (enclosure_dev == NULL) 793a6223b Chaitra P B 2018-03-20 6102 pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)" 793a6223b Chaitra P B 2018-03-20 6103 "doesn't match with enclosure device!\n", 758889564 Sreekanth Reddy 2017-10-10 6104 ioc->name, sas_device_pg0.EnclosureHandle); 758889564 Sreekanth Reddy 2017-10-10 6105 } 758889564 Sreekanth Reddy 2017-10-10 6106 f92363d12 Sreekanth Reddy 2012-11-30 6107 sas_device = kzalloc(sizeof(struct _sas_device), f92363d12 Sreekanth Reddy 2012-11-30 6108 GFP_KERNEL); f92363d12 Sreekanth Reddy 2012-11-30 6109 if (!sas_device) { f92363d12 Sreekanth Reddy 2012-11-30 6110 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", f92363d12 Sreekanth Reddy 2012-11-30 6111 ioc->name, __FILE__, __LINE__, __func__); f92363d12 Sreekanth Reddy 2012-11-30 6112 return 0; f92363d12 Sreekanth Reddy 2012-11-30 6113 } f92363d12 Sreekanth Reddy 2012-11-30 6114 d1cb5e495 Sreekanth Reddy 2015-11-11 6115 kref_init(&sas_device->refcount); f92363d12 Sreekanth Reddy 2012-11-30 6116 sas_device->handle = handle; f92363d12 Sreekanth Reddy 2012-11-30 6117 if (_scsih_get_sas_address(ioc, f92363d12 Sreekanth Reddy 2012-11-30 6118 le16_to_cpu(sas_device_pg0.ParentDevHandle), f92363d12 Sreekanth Reddy 2012-11-30 6119 &sas_device->sas_address_parent) != 0) f92363d12 Sreekanth Reddy 2012-11-30 6120 pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n", f92363d12 Sreekanth Reddy 2012-11-30 6121 ioc->name, __FILE__, __LINE__, __func__); f92363d12 Sreekanth Reddy 2012-11-30 6122 sas_device->enclosure_handle = f92363d12 Sreekanth Reddy 2012-11-30 6123 le16_to_cpu(sas_device_pg0.EnclosureHandle); e6d45e3e7 Sreekanth Reddy 2015-06-30 6124 if (sas_device->enclosure_handle != 0) f92363d12 Sreekanth Reddy 2012-11-30 6125 sas_device->slot = f92363d12 Sreekanth Reddy 2012-11-30 6126 le16_to_cpu(sas_device_pg0.Slot); f92363d12 Sreekanth Reddy 2012-11-30 6127 sas_device->device_info = device_info; f92363d12 Sreekanth Reddy 2012-11-30 6128 sas_device->sas_address = sas_address; f92363d12 Sreekanth Reddy 2012-11-30 6129 sas_device->phy = sas_device_pg0.PhyNum; f92363d12 Sreekanth Reddy 2012-11-30 6130 sas_device->fast_path = (le16_to_cpu(sas_device_pg0.Flags) & f92363d12 Sreekanth Reddy 2012-11-30 6131 MPI25_SAS_DEVICE0_FLAGS_FAST_PATH_CAPABLE) ? 1 : 0; f92363d12 Sreekanth Reddy 2012-11-30 6132 aa53bb895 Suganath Prabu Subramani 2016-10-26 6133 if (le16_to_cpu(sas_device_pg0.Flags) aa53bb895 Suganath Prabu Subramani 2016-10-26 6134 & MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) { e6d45e3e7 Sreekanth Reddy 2015-06-30 6135 sas_device->enclosure_level = aa53bb895 Suganath Prabu Subramani 2016-10-26 6136 sas_device_pg0.EnclosureLevel; 310c8e40d Calvin Owens 2016-07-27 6137 memcpy(sas_device->connector_name, 310c8e40d Calvin Owens 2016-07-27 6138 sas_device_pg0.ConnectorName, 4); 310c8e40d Calvin Owens 2016-07-27 6139 sas_device->connector_name[4] = '\0'; e6d45e3e7 Sreekanth Reddy 2015-06-30 6140 } else { e6d45e3e7 Sreekanth Reddy 2015-06-30 6141 sas_device->enclosure_level = 0; e6d45e3e7 Sreekanth Reddy 2015-06-30 6142 sas_device->connector_name[0] = '\0'; e6d45e3e7 Sreekanth Reddy 2015-06-30 6143 } 758889564 Sreekanth Reddy 2017-10-10 6144 /* get enclosure_logical_id & chassis_slot*/ 758889564 Sreekanth Reddy 2017-10-10 6145 sas_device->is_chassis_slot_valid = 0; 793a6223b Chaitra P B 2018-03-20 6146 if (enclosure_dev) { f92363d12 Sreekanth Reddy 2012-11-30 6147 sas_device->enclosure_logical_id = 793a6223b Chaitra P B 2018-03-20 6148 le64_to_cpu(enclosure_dev->pg0.EnclosureLogicalID); 793a6223b Chaitra P B 2018-03-20 6149 if (le16_to_cpu(enclosure_dev->pg0.Flags) & 758889564 Sreekanth Reddy 2017-10-10 6150 MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID) { 758889564 Sreekanth Reddy 2017-10-10 6151 sas_device->is_chassis_slot_valid = 1; 758889564 Sreekanth Reddy 2017-10-10 6152 sas_device->chassis_slot = 793a6223b Chaitra P B 2018-03-20 6153 enclosure_dev->pg0.ChassisSlot; 758889564 Sreekanth Reddy 2017-10-10 6154 } 758889564 Sreekanth Reddy 2017-10-10 6155 } 758889564 Sreekanth Reddy 2017-10-10 6156 f92363d12 Sreekanth Reddy 2012-11-30 6157 /* get device name */ f92363d12 Sreekanth Reddy 2012-11-30 6158 sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName); f92363d12 Sreekanth Reddy 2012-11-30 6159 f92363d12 Sreekanth Reddy 2012-11-30 6160 if (ioc->wait_for_discovery_to_complete) f92363d12 Sreekanth Reddy 2012-11-30 6161 _scsih_sas_device_init_add(ioc, sas_device); f92363d12 Sreekanth Reddy 2012-11-30 6162 else f92363d12 Sreekanth Reddy 2012-11-30 6163 _scsih_sas_device_add(ioc, sas_device); f92363d12 Sreekanth Reddy 2012-11-30 6164 d1cb5e495 Sreekanth Reddy 2015-11-11 6165 sas_device_put(sas_device); f92363d12 Sreekanth Reddy 2012-11-30 6166 return 0; f92363d12 Sreekanth Reddy 2012-11-30 6167 } f92363d12 Sreekanth Reddy 2012-11-30 6168 :::::: The code at line 6100 was first introduced by commit :::::: 7588895646b5a943d3310271885c5935123a455c scsi: mpt3sas: Display chassis slot information of the drive :::::: TO: Sreekanth Reddy <sreekanth.reddy@broadcom.com> :::::: CC: Martin K. Petersen <martin.petersen@oracle.com> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index 0a0e7aa..fa438e7 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -4082,6 +4082,27 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc) } /** + * mpt3sas_free_enclosure_list - release memory + * @ioc: per adapter object + * + * Free memory allocated during encloure add. + * + * Return nothing. + */ +void +mpt3sas_free_enclosure_list(struct MPT3SAS_ADAPTER *ioc) +{ + struct _enclosure_node *enclosure_dev, *enclosure_dev_next; + + /* Free enclosure list */ + list_for_each_entry_safe(enclosure_dev, + enclosure_dev_next, &ioc->enclosure_list, list) { + list_del(&enclosure_dev->list); + kfree(enclosure_dev); + } +} + +/** * _base_release_memory_pools - release memory * @ioc: per adapter object * @@ -6555,6 +6576,7 @@ mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc) mpt3sas_base_stop_watchdog(ioc); mpt3sas_base_free_resources(ioc); _base_release_memory_pools(ioc); + mpt3sas_free_enclosure_list(ioc); pci_set_drvdata(ioc->pdev, NULL); kfree(ioc->cpu_msix_table); if (ioc->is_warpdrive) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 4de0251..35252c6 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h @@ -741,6 +741,17 @@ struct _sas_node { struct list_head sas_port_list; }; + +/** + * struct _enclosure_node - enclosure information + * @list: list of enclosures + * @pg0: enclosure pg0; + */ +struct _enclosure_node { + struct list_head list; + Mpi2SasEnclosurePage0_t pg0; +}; + /** * enum reset_type - reset state * @FORCE_BIG_HAMMER: issue diagnostic reset @@ -1009,6 +1020,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc); * @iounit_pg8: static iounit page 8 * @sas_hba: sas host object * @sas_expander_list: expander object list + * @enclosure_list: enclosure object list * @sas_node_lock: * @sas_device_list: sas device object list * @sas_device_init_list: sas device object list (used only at init time) @@ -1214,6 +1226,7 @@ struct MPT3SAS_ADAPTER { /* sas hba, expander, and device list */ struct _sas_node sas_hba; struct list_head sas_expander_list; + struct list_head enclosure_list; spinlock_t sas_node_lock; struct list_head sas_device_list; struct list_head sas_device_init_list; @@ -1384,6 +1397,7 @@ int mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc); void mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc); int mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc); void mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc); +void mpt3sas_free_enclosure_list(struct MPT3SAS_ADAPTER *ioc); int mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, enum reset_type type); diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index 50efccd..2c03873 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -1362,6 +1362,30 @@ mpt3sas_scsih_expander_find_by_handle(struct MPT3SAS_ADAPTER *ioc, u16 handle) } /** + * mpt3sas_scsih_enclosure_find_by_handle - exclosure device search + * @ioc: per adapter object + * @handle: enclosure handle (assigned by firmware) + * Context: Calling function should acquire ioc->sas_device_lock + * + * This searches for enclosure device based on handle, then returns the + * enclosure object. + */ +struct _enclosure_node * +mpt3sas_scsih_enclosure_find_by_handle(struct MPT3SAS_ADAPTER *ioc, u16 handle) +{ + struct _enclosure_node *enclosure_dev, *r; + + r = NULL; + list_for_each_entry(enclosure_dev, &ioc->enclosure_list, list) { + if (le16_to_cpu(enclosure_dev->pg0.EnclosureHandle) != handle) + continue; + r = enclosure_dev; + goto out; + } +out: + return r; +} +/** * mpt3sas_scsih_expander_find_by_sas_address - expander device search * @ioc: per adapter object * @sas_address: sas address @@ -5615,10 +5639,10 @@ static int _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) { struct _sas_node *sas_expander; + struct _enclosure_node *enclosure_dev; Mpi2ConfigReply_t mpi_reply; Mpi2ExpanderPage0_t expander_pg0; Mpi2ExpanderPage1_t expander_pg1; - Mpi2SasEnclosurePage0_t enclosure_pg0; u32 ioc_status; u16 parent_handle; u64 sas_address, sas_address_parent = 0; @@ -5740,11 +5764,12 @@ _scsih_expander_add(struct MPT3SAS_ADAPTER *ioc, u16 handle) } if (sas_expander->enclosure_handle) { - if (!(mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, - &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, - sas_expander->enclosure_handle))) + enclosure_dev = + mpt3sas_scsih_enclosure_find_by_handle(ioc, + sas_expander->enclosure_handle); + if (enclosure_dev) sas_expander->enclosure_logical_id = - le64_to_cpu(enclosure_pg0.EnclosureLogicalID); + le64_to_cpu(enclosure_dev->pg0.EnclosureLogicalID); } _scsih_expander_node_add(ioc, sas_expander); @@ -5888,52 +5913,6 @@ _scsih_check_access_status(struct MPT3SAS_ADAPTER *ioc, u64 sas_address, } /** - * _scsih_get_enclosure_logicalid_chassis_slot - get device's - * EnclosureLogicalID and ChassisSlot information. - * @ioc: per adapter object - * @sas_device_pg0: SAS device page0 - * @sas_device: per sas device object - * - * Returns nothing. - */ -static void -_scsih_get_enclosure_logicalid_chassis_slot(struct MPT3SAS_ADAPTER *ioc, - Mpi2SasDevicePage0_t *sas_device_pg0, struct _sas_device *sas_device) -{ - Mpi2ConfigReply_t mpi_reply; - Mpi2SasEnclosurePage0_t enclosure_pg0; - - if (!sas_device_pg0 || !sas_device) - return; - - sas_device->enclosure_handle = - le16_to_cpu(sas_device_pg0->EnclosureHandle); - sas_device->is_chassis_slot_valid = 0; - - if (!le16_to_cpu(sas_device_pg0->EnclosureHandle)) - return; - - if (mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, - &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, - le16_to_cpu(sas_device_pg0->EnclosureHandle))) { - pr_err(MPT3SAS_FMT - "Enclosure Pg0 read failed for handle(0x%04x)\n", - ioc->name, le16_to_cpu(sas_device_pg0->EnclosureHandle)); - return; - } - - sas_device->enclosure_logical_id = - le64_to_cpu(enclosure_pg0.EnclosureLogicalID); - - if (le16_to_cpu(enclosure_pg0.Flags) & - MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID) { - sas_device->is_chassis_slot_valid = 1; - sas_device->chassis_slot = enclosure_pg0.ChassisSlot; - } -} - - -/** * _scsih_check_device - checking device responsiveness * @ioc: per adapter object * @parent_sas_address: sas address of parent expander or sas host @@ -5950,6 +5929,7 @@ _scsih_check_device(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t mpi_reply; Mpi2SasDevicePage0_t sas_device_pg0; struct _sas_device *sas_device; + struct _enclosure_node *enclosure_dev = NULL; u32 ioc_status; unsigned long flags; u64 sas_address; @@ -6004,8 +5984,21 @@ _scsih_check_device(struct MPT3SAS_ADAPTER *ioc, sas_device->connector_name[0] = '\0'; } - _scsih_get_enclosure_logicalid_chassis_slot(ioc, - &sas_device_pg0, sas_device); + sas_device->enclosure_handle = + le16_to_cpu(sas_device_pg0.EnclosureHandle); + sas_device->is_chassis_slot_valid = 0; + enclosure_dev = mpt3sas_scsih_enclosure_find_by_handle(ioc, + sas_device->enclosure_handle); + if (enclosure_dev) { + sas_device->enclosure_logical_id = + le64_to_cpu(enclosure_dev->pg0.EnclosureLogicalID); + if (le16_to_cpu(enclosure_dev->pg0.Flags) & + MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID) { + sas_device->is_chassis_slot_valid = 1; + sas_device->chassis_slot = + enclosure_dev->pg0.ChassisSlot; + } + } } /* check if device is present */ @@ -6052,12 +6045,11 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, { Mpi2ConfigReply_t mpi_reply; Mpi2SasDevicePage0_t sas_device_pg0; - Mpi2SasEnclosurePage0_t enclosure_pg0; struct _sas_device *sas_device; + struct _enclosure_node *enclosure_dev = NULL; u32 ioc_status; u64 sas_address; u32 device_info; - int encl_pg0_rc = -1; if ((mpt3sas_config_get_sas_device_pg0(ioc, &mpi_reply, &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle))) { @@ -6103,13 +6095,13 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, } if (sas_device_pg0.EnclosureHandle) { - encl_pg0_rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, - &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, - sas_device_pg0.EnclosureHandle); - if (encl_pg0_rc) - pr_info(MPT3SAS_FMT - "Enclosure Pg0 read failed for handle(0x%04x)\n", - ioc->name, sas_device_pg0.EnclosureHandle); + enclosure_dev = + mpt3sas_scsih_enclosure_find_by_handle(ioc, + sas_device_pg0.EnclosureHandle); + if (enclosure_dev == NULL) + pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)" + "doesn't match with enclosure device!\n", + ioc->name, sas_device_pg0.EnclosureHandle); } sas_device = kzalloc(sizeof(struct _sas_device), @@ -6149,18 +6141,16 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, sas_device->enclosure_level = 0; sas_device->connector_name[0] = '\0'; } - - /* get enclosure_logical_id & chassis_slot */ + /* get enclosure_logical_id & chassis_slot*/ sas_device->is_chassis_slot_valid = 0; - if (encl_pg0_rc == 0) { + if (enclosure_dev) { sas_device->enclosure_logical_id = - le64_to_cpu(enclosure_pg0.EnclosureLogicalID); - - if (le16_to_cpu(enclosure_pg0.Flags) & + le64_to_cpu(enclosure_dev->pg0.EnclosureLogicalID); + if (le16_to_cpu(enclosure_dev->pg0.Flags) & MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID) { sas_device->is_chassis_slot_valid = 1; sas_device->chassis_slot = - enclosure_pg0.ChassisSlot; + enclosure_dev->pg0.ChassisSlot; } } @@ -6842,8 +6832,8 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) Mpi26PCIeDevicePage0_t pcie_device_pg0; Mpi26PCIeDevicePage2_t pcie_device_pg2; Mpi2ConfigReply_t mpi_reply; - Mpi2SasEnclosurePage0_t enclosure_pg0; struct _pcie_device *pcie_device; + struct _enclosure_node *enclosure_dev; u32 pcie_device_type; u32 ioc_status; u64 wwid; @@ -6925,13 +6915,14 @@ _scsih_pcie_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle) } /* get enclosure_logical_id */ - if (pcie_device->enclosure_handle && - !(mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, - &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, - pcie_device->enclosure_handle))) - pcie_device->enclosure_logical_id = - le64_to_cpu(enclosure_pg0.EnclosureLogicalID); - + if (pcie_device->enclosure_handle) { + enclosure_dev = + mpt3sas_scsih_enclosure_find_by_handle(ioc, + pcie_device->enclosure_handle); + if (enclosure_dev) + pcie_device->enclosure_logical_id = + le64_to_cpu(enclosure_dev->pg0.EnclosureLogicalID); + } /* TODO -- Add device name once FW supports it */ if (mpt3sas_config_get_pcie_device_pg2(ioc, &mpi_reply, &pcie_device_pg2, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, handle)) { @@ -7317,10 +7308,61 @@ static void _scsih_sas_enclosure_dev_status_change_event(struct MPT3SAS_ADAPTER *ioc, struct fw_event_work *fw_event) { + Mpi2ConfigReply_t mpi_reply; + struct _enclosure_node *enclosure_dev = NULL; + Mpi2EventDataSasEnclDevStatusChange_t *event_data = + (Mpi2EventDataSasEnclDevStatusChange_t *)fw_event->event_data; + int rc; + if (ioc->logging_level & MPT_DEBUG_EVENT_WORK_TASK) _scsih_sas_enclosure_dev_status_change_event_debug(ioc, (Mpi2EventDataSasEnclDevStatusChange_t *) fw_event->event_data); + if (ioc->shost_recovery) + return; + + event_data->EnclosureHandle = le16_to_cpu(event_data->EnclosureHandle); + + if (event_data->EnclosureHandle) + enclosure_dev = + mpt3sas_scsih_enclosure_find_by_handle(ioc, + event_data->EnclosureHandle); + switch (event_data->ReasonCode) { + case MPI2_EVENT_SAS_ENCL_RC_ADDED: + if (!enclosure_dev) { + enclosure_dev = + kzalloc(sizeof(struct _enclosure_node), + GFP_KERNEL); + if (!enclosure_dev) { + pr_info(MPT3SAS_FMT + "failure at %s:%d/%s()!\n", ioc->name, + __FILE__, __LINE__, __func__); + return; + } + rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, + &enclosure_dev->pg0, + MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, + event_data->EnclosureHandle); + + if (rc || (le16_to_cpu(mpi_reply.IOCStatus) & + MPI2_IOCSTATUS_MASK)) { + kfree(enclosure_dev); + return; + } + + list_add_tail(&enclosure_dev->list, + &ioc->enclosure_list); + } + break; + case MPI2_EVENT_SAS_ENCL_RC_NOT_RESPONDING: + if (enclosure_dev) { + list_del(&enclosure_dev->list); + kfree(enclosure_dev); + } + break; + default: + break; + } } /** @@ -8357,8 +8399,18 @@ Mpi2SasDevicePage0_t *sas_device_pg0) struct MPT3SAS_TARGET *sas_target_priv_data = NULL; struct scsi_target *starget; struct _sas_device *sas_device = NULL; + struct _enclosure_node *enclosure_dev = NULL; unsigned long flags; + if (sas_device_pg0->EnclosureHandle) { + enclosure_dev = + mpt3sas_scsih_enclosure_find_by_handle(ioc, + sas_device_pg0->EnclosureHandle); + if (enclosure_dev == NULL) + pr_info(MPT3SAS_FMT "Enclosure handle(0x%04x)" + "doesn't match with enclosure device!\n", + ioc->name, sas_device_pg0->EnclosureHandle); + } spin_lock_irqsave(&ioc->sas_device_lock, flags); list_for_each_entry(sas_device, &ioc->sas_device_list, list) { if ((sas_device->sas_address == sas_device_pg0->SASAddress) && @@ -8397,8 +8449,19 @@ Mpi2SasDevicePage0_t *sas_device_pg0) sas_device->connector_name[0] = '\0'; } - _scsih_get_enclosure_logicalid_chassis_slot(ioc, - sas_device_pg0, sas_device); + sas_device->enclosure_handle = + le16_to_cpu(sas_device_pg0->EnclosureHandle); + sas_device->is_chassis_slot_valid = 0; + if (enclosure_dev) { + sas_device->enclosure_logical_id = le64_to_cpu( + enclosure_dev->pg0.EnclosureLogicalID); + if (le16_to_cpu(enclosure_dev->pg0.Flags) & + MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID) { + sas_device->is_chassis_slot_valid = 1; + sas_device->chassis_slot = + enclosure_dev->pg0.ChassisSlot; + } + } if (sas_device->handle == sas_device_pg0->DevHandle) goto out; @@ -8416,6 +8479,52 @@ Mpi2SasDevicePage0_t *sas_device_pg0) } /** + * _scsih_create_enclosure_list_after_reset - Free Existing list, + * And create enclosure list by scanning all Enclosure Page(0)s + * @ioc: per adapter object + * + * Return nothing. + */ +static void +_scsih_create_enclosure_list_after_reset(struct MPT3SAS_ADAPTER *ioc) +{ + struct _enclosure_node *enclosure_dev; + Mpi2ConfigReply_t mpi_reply; + u16 enclosure_handle; + int rc; + + /* Free existing enclosure list */ + mpt3sas_free_enclosure_list(ioc); + + /* Re constructing enclosure list after reset*/ + enclosure_handle = 0xFFFF; + do { + enclosure_dev = + kzalloc(sizeof(struct _enclosure_node), GFP_KERNEL); + if (!enclosure_dev) { + pr_err(MPT3SAS_FMT + "failure at %s:%d/%s()!\n", ioc->name, + __FILE__, __LINE__, __func__); + return; + } + rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, + &enclosure_dev->pg0, + MPI2_SAS_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE, + enclosure_handle); + + if (rc || (le16_to_cpu(mpi_reply.IOCStatus) & + MPI2_IOCSTATUS_MASK)) { + kfree(enclosure_dev); + return; + } + list_add_tail(&enclosure_dev->list, + &ioc->enclosure_list); + enclosure_handle = + le16_to_cpu(enclosure_dev->pg0.EnclosureHandle); + } while (1); +} + +/** * _scsih_search_responding_sas_devices - * @ioc: per adapter object * @@ -8733,22 +8842,16 @@ _scsih_mark_responding_expander(struct MPT3SAS_ADAPTER *ioc, { struct _sas_node *sas_expander = NULL; unsigned long flags; - int i, encl_pg0_rc = -1; - Mpi2ConfigReply_t mpi_reply; - Mpi2SasEnclosurePage0_t enclosure_pg0; + int i; + struct _enclosure_node *enclosure_dev = NULL; u16 handle = le16_to_cpu(expander_pg0->DevHandle); + u16 enclosure_handle = le16_to_cpu(expander_pg0->EnclosureHandle); u64 sas_address = le64_to_cpu(expander_pg0->SASAddress); - if (le16_to_cpu(expander_pg0->EnclosureHandle)) { - encl_pg0_rc = mpt3sas_config_get_enclosure_pg0(ioc, &mpi_reply, - &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE, - le16_to_cpu(expander_pg0->EnclosureHandle)); - if (encl_pg0_rc) - pr_info(MPT3SAS_FMT - "Enclosure Pg0 read failed for handle(0x%04x)\n", - ioc->name, - le16_to_cpu(expander_pg0->EnclosureHandle)); - } + if (enclosure_handle) + enclosure_dev = + mpt3sas_scsih_enclosure_find_by_handle(ioc, + enclosure_handle); spin_lock_irqsave(&ioc->sas_node_lock, flags); list_for_each_entry(sas_expander, &ioc->sas_expander_list, list) { @@ -8756,12 +8859,12 @@ _scsih_mark_responding_expander(struct MPT3SAS_ADAPTER *ioc, continue; sas_expander->responding = 1; - if (!encl_pg0_rc) + if (enclosure_dev) { sas_expander->enclosure_logical_id = - le64_to_cpu(enclosure_pg0.EnclosureLogicalID); - - sas_expander->enclosure_handle = - le16_to_cpu(expander_pg0->EnclosureHandle); + le64_to_cpu(enclosure_dev->pg0.EnclosureLogicalID); + sas_expander->enclosure_handle = + le16_to_cpu(expander_pg0->EnclosureHandle); + } if (sas_expander->handle == handle) goto out; @@ -9283,6 +9386,7 @@ mpt3sas_scsih_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase) if ((!ioc->is_driver_loading) && !(disable_discovery > 0 && !ioc->sas_hba.num_phys)) { _scsih_prep_device_scan(ioc); + _scsih_create_enclosure_list_after_reset(ioc); _scsih_search_responding_sas_devices(ioc); _scsih_search_responding_pcie_devices(ioc); _scsih_search_responding_raid_devices(ioc); @@ -10502,6 +10606,7 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) INIT_LIST_HEAD(&ioc->sas_device_list); INIT_LIST_HEAD(&ioc->sas_device_init_list); INIT_LIST_HEAD(&ioc->sas_expander_list); + INIT_LIST_HEAD(&ioc->enclosure_list); INIT_LIST_HEAD(&ioc->pcie_device_list); INIT_LIST_HEAD(&ioc->pcie_device_init_list); INIT_LIST_HEAD(&ioc->fw_event_list);