Lines Matching refs:ioc

112 static inline void mptsas_set_rphy(MPT_ADAPTER *ioc,
115 (MPT_ADAPTER *ioc, u64 sas_address);
116 static int mptsas_sas_device_pg0(MPT_ADAPTER *ioc,
118 static int mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc,
120 static int mptsas_add_end_device(MPT_ADAPTER *ioc,
122 static void mptsas_del_end_device(MPT_ADAPTER *ioc,
126 (MPT_ADAPTER *ioc, u64 sas_address);
127 static void mptsas_expander_delete(MPT_ADAPTER *ioc,
130 static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);
131 static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);
134 static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id);
135 void mptsas_schedule_target_reset(void *ioc);
137 static void mptsas_print_phy_data(MPT_ADAPTER *ioc, in mptsas_print_phy_data() argument
140 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_data()
141 "---- IO UNIT PAGE 0 ------------\n", ioc->name)); in mptsas_print_phy_data()
142 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Handle=0x%X\n", in mptsas_print_phy_data()
143 ioc->name, le16_to_cpu(phy_data->AttachedDeviceHandle))); in mptsas_print_phy_data()
144 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Controller Handle=0x%X\n", in mptsas_print_phy_data()
145 ioc->name, le16_to_cpu(phy_data->ControllerDevHandle))); in mptsas_print_phy_data()
146 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Port=0x%X\n", in mptsas_print_phy_data()
147 ioc->name, phy_data->Port)); in mptsas_print_phy_data()
148 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Port Flags=0x%X\n", in mptsas_print_phy_data()
149 ioc->name, phy_data->PortFlags)); in mptsas_print_phy_data()
150 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PHY Flags=0x%X\n", in mptsas_print_phy_data()
151 ioc->name, phy_data->PhyFlags)); in mptsas_print_phy_data()
152 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Negotiated Link Rate=0x%X\n", in mptsas_print_phy_data()
153 ioc->name, phy_data->NegotiatedLinkRate)); in mptsas_print_phy_data()
154 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_data()
155 "Controller PHY Device Info=0x%X\n", ioc->name, in mptsas_print_phy_data()
157 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DiscoveryStatus=0x%X\n\n", in mptsas_print_phy_data()
158 ioc->name, le32_to_cpu(phy_data->DiscoveryStatus))); in mptsas_print_phy_data()
161 static void mptsas_print_phy_pg0(MPT_ADAPTER *ioc, SasPhyPage0_t *pg0) in mptsas_print_phy_pg0() argument
167 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_pg0()
168 "---- SAS PHY PAGE 0 ------------\n", ioc->name)); in mptsas_print_phy_pg0()
169 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_pg0()
170 "Attached Device Handle=0x%X\n", ioc->name, in mptsas_print_phy_pg0()
172 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SAS Address=0x%llX\n", in mptsas_print_phy_pg0()
173 ioc->name, (unsigned long long)le64_to_cpu(sas_address))); in mptsas_print_phy_pg0()
174 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_pg0()
175 "Attached PHY Identifier=0x%X\n", ioc->name, in mptsas_print_phy_pg0()
177 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Attached Device Info=0x%X\n", in mptsas_print_phy_pg0()
178 ioc->name, le32_to_cpu(pg0->AttachedDeviceInfo))); in mptsas_print_phy_pg0()
179 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Programmed Link Rate=0x%X\n", in mptsas_print_phy_pg0()
180 ioc->name, pg0->ProgrammedLinkRate)); in mptsas_print_phy_pg0()
181 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Change Count=0x%X\n", in mptsas_print_phy_pg0()
182 ioc->name, pg0->ChangeCount)); in mptsas_print_phy_pg0()
183 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PHY Info=0x%X\n\n", in mptsas_print_phy_pg0()
184 ioc->name, le32_to_cpu(pg0->PhyInfo))); in mptsas_print_phy_pg0()
187 static void mptsas_print_phy_pg1(MPT_ADAPTER *ioc, SasPhyPage1_t *pg1) in mptsas_print_phy_pg1() argument
189 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_pg1()
190 "---- SAS PHY PAGE 1 ------------\n", ioc->name)); in mptsas_print_phy_pg1()
191 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Invalid Dword Count=0x%x\n", in mptsas_print_phy_pg1()
192 ioc->name, pg1->InvalidDwordCount)); in mptsas_print_phy_pg1()
193 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_pg1()
194 "Running Disparity Error Count=0x%x\n", ioc->name, in mptsas_print_phy_pg1()
196 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_pg1()
197 "Loss Dword Synch Count=0x%x\n", ioc->name, in mptsas_print_phy_pg1()
199 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_phy_pg1()
200 "PHY Reset Problem Count=0x%x\n\n", ioc->name, in mptsas_print_phy_pg1()
204 static void mptsas_print_device_pg0(MPT_ADAPTER *ioc, SasDevicePage0_t *pg0) in mptsas_print_device_pg0() argument
210 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_device_pg0()
211 "---- SAS DEVICE PAGE 0 ---------\n", ioc->name)); in mptsas_print_device_pg0()
212 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Handle=0x%X\n", in mptsas_print_device_pg0()
213 ioc->name, le16_to_cpu(pg0->DevHandle))); in mptsas_print_device_pg0()
214 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Parent Handle=0x%X\n", in mptsas_print_device_pg0()
215 ioc->name, le16_to_cpu(pg0->ParentDevHandle))); in mptsas_print_device_pg0()
216 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Enclosure Handle=0x%X\n", in mptsas_print_device_pg0()
217 ioc->name, le16_to_cpu(pg0->EnclosureHandle))); in mptsas_print_device_pg0()
218 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Slot=0x%X\n", in mptsas_print_device_pg0()
219 ioc->name, le16_to_cpu(pg0->Slot))); in mptsas_print_device_pg0()
220 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SAS Address=0x%llX\n", in mptsas_print_device_pg0()
221 ioc->name, (unsigned long long)le64_to_cpu(sas_address))); in mptsas_print_device_pg0()
222 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Target ID=0x%X\n", in mptsas_print_device_pg0()
223 ioc->name, pg0->TargetID)); in mptsas_print_device_pg0()
224 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Bus=0x%X\n", in mptsas_print_device_pg0()
225 ioc->name, pg0->Bus)); in mptsas_print_device_pg0()
226 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Parent Phy Num=0x%X\n", in mptsas_print_device_pg0()
227 ioc->name, pg0->PhyNum)); in mptsas_print_device_pg0()
228 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Access Status=0x%X\n", in mptsas_print_device_pg0()
229 ioc->name, le16_to_cpu(pg0->AccessStatus))); in mptsas_print_device_pg0()
230 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Device Info=0x%X\n", in mptsas_print_device_pg0()
231 ioc->name, le32_to_cpu(pg0->DeviceInfo))); in mptsas_print_device_pg0()
232 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Flags=0x%X\n", in mptsas_print_device_pg0()
233 ioc->name, le16_to_cpu(pg0->Flags))); in mptsas_print_device_pg0()
234 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Physical Port=0x%X\n\n", in mptsas_print_device_pg0()
235 ioc->name, pg0->PhysicalPort)); in mptsas_print_device_pg0()
238 static void mptsas_print_expander_pg1(MPT_ADAPTER *ioc, SasExpanderPage1_t *pg1) in mptsas_print_expander_pg1() argument
240 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_expander_pg1()
241 "---- SAS EXPANDER PAGE 1 ------------\n", ioc->name)); in mptsas_print_expander_pg1()
242 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Physical Port=0x%X\n", in mptsas_print_expander_pg1()
243 ioc->name, pg1->PhysicalPort)); in mptsas_print_expander_pg1()
244 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PHY Identifier=0x%X\n", in mptsas_print_expander_pg1()
245 ioc->name, pg1->PhyIdentifier)); in mptsas_print_expander_pg1()
246 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Negotiated Link Rate=0x%X\n", in mptsas_print_expander_pg1()
247 ioc->name, pg1->NegotiatedLinkRate)); in mptsas_print_expander_pg1()
248 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Programmed Link Rate=0x%X\n", in mptsas_print_expander_pg1()
249 ioc->name, pg1->ProgrammedLinkRate)); in mptsas_print_expander_pg1()
250 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Hardware Link Rate=0x%X\n", in mptsas_print_expander_pg1()
251 ioc->name, pg1->HwLinkRate)); in mptsas_print_expander_pg1()
252 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Owner Device Handle=0x%X\n", in mptsas_print_expander_pg1()
253 ioc->name, le16_to_cpu(pg1->OwnerDevHandle))); in mptsas_print_expander_pg1()
254 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_print_expander_pg1()
255 "Attached Device Handle=0x%X\n\n", ioc->name, in mptsas_print_expander_pg1()
261 mptsas_fw_event_off(MPT_ADAPTER *ioc) in mptsas_fw_event_off() argument
265 spin_lock_irqsave(&ioc->fw_event_lock, flags); in mptsas_fw_event_off()
266 ioc->fw_events_off = 1; in mptsas_fw_event_off()
267 ioc->sas_discovery_quiesce_io = 0; in mptsas_fw_event_off()
268 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); in mptsas_fw_event_off()
274 mptsas_fw_event_on(MPT_ADAPTER *ioc) in mptsas_fw_event_on() argument
278 spin_lock_irqsave(&ioc->fw_event_lock, flags); in mptsas_fw_event_on()
279 ioc->fw_events_off = 0; in mptsas_fw_event_on()
280 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); in mptsas_fw_event_on()
285 mptsas_add_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event, in mptsas_add_fw_event() argument
290 spin_lock_irqsave(&ioc->fw_event_lock, flags); in mptsas_add_fw_event()
291 list_add_tail(&fw_event->list, &ioc->fw_event_list); in mptsas_add_fw_event()
294 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: add (fw_event=0x%p)" in mptsas_add_fw_event()
295 "on cpuid %d\n", ioc->name, __func__, in mptsas_add_fw_event()
297 queue_delayed_work_on(smp_processor_id(), ioc->fw_event_q, in mptsas_add_fw_event()
299 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); in mptsas_add_fw_event()
304 mptsas_requeue_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event, in mptsas_requeue_fw_event() argument
308 spin_lock_irqsave(&ioc->fw_event_lock, flags); in mptsas_requeue_fw_event()
309 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: reschedule task " in mptsas_requeue_fw_event()
310 "(fw_event=0x%p)on cpuid %d\n", ioc->name, __func__, in mptsas_requeue_fw_event()
313 queue_delayed_work_on(smp_processor_id(), ioc->fw_event_q, in mptsas_requeue_fw_event()
315 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); in mptsas_requeue_fw_event()
318 static void __mptsas_free_fw_event(MPT_ADAPTER *ioc, in __mptsas_free_fw_event() argument
321 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: kfree (fw_event=0x%p)\n", in __mptsas_free_fw_event()
322 ioc->name, __func__, fw_event)); in __mptsas_free_fw_event()
329 mptsas_free_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event) in mptsas_free_fw_event() argument
333 spin_lock_irqsave(&ioc->fw_event_lock, flags); in mptsas_free_fw_event()
336 __mptsas_free_fw_event(ioc, fw_event); in mptsas_free_fw_event()
337 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); in mptsas_free_fw_event()
343 mptsas_cleanup_fw_event_q(MPT_ADAPTER *ioc) in mptsas_cleanup_fw_event_q() argument
347 MPT_SCSI_HOST *hd = shost_priv(ioc->sh); in mptsas_cleanup_fw_event_q()
354 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_cleanup_fw_event_q()
356 ioc->name, __func__, in mptsas_cleanup_fw_event_q()
363 if (list_empty(&ioc->fw_event_list) || !ioc->fw_event_q) in mptsas_cleanup_fw_event_q()
366 spin_lock_irqsave(&ioc->fw_event_lock, flags); in mptsas_cleanup_fw_event_q()
368 while (!list_empty(&ioc->fw_event_list)) { in mptsas_cleanup_fw_event_q()
371 fw_event = list_first_entry(&ioc->fw_event_list, in mptsas_cleanup_fw_event_q()
374 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); in mptsas_cleanup_fw_event_q()
378 spin_lock_irqsave(&ioc->fw_event_lock, flags); in mptsas_cleanup_fw_event_q()
383 __mptsas_free_fw_event(ioc, fw_event); in mptsas_cleanup_fw_event_q()
385 spin_unlock_irqrestore(&ioc->fw_event_lock, flags); in mptsas_cleanup_fw_event_q()
392 return ((MPT_SCSI_HOST *)shost->hostdata)->ioc; in phy_to_ioc()
398 return ((MPT_SCSI_HOST *)shost->hostdata)->ioc; in rphy_to_ioc()
407 mptsas_find_portinfo_by_handle(MPT_ADAPTER *ioc, u16 handle) in mptsas_find_portinfo_by_handle() argument
412 list_for_each_entry(port_info, &ioc->sas_topology, list) in mptsas_find_portinfo_by_handle()
433 mptsas_find_portinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address) in mptsas_find_portinfo_by_sas_address() argument
438 if (sas_address >= ioc->hba_port_sas_addr && in mptsas_find_portinfo_by_sas_address()
439 sas_address < (ioc->hba_port_sas_addr + in mptsas_find_portinfo_by_sas_address()
440 ioc->hba_port_num_phy)) in mptsas_find_portinfo_by_sas_address()
441 return ioc->hba_port_info; in mptsas_find_portinfo_by_sas_address()
443 mutex_lock(&ioc->sas_topology_mutex); in mptsas_find_portinfo_by_sas_address()
444 list_for_each_entry(port_info, &ioc->sas_topology, list) in mptsas_find_portinfo_by_sas_address()
452 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_find_portinfo_by_sas_address()
478 mptsas_port_delete(MPT_ADAPTER *ioc, struct mptsas_portinfo_details * port_details) in mptsas_port_delete() argument
490 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: [%p]: num_phys=%02d " in mptsas_port_delete()
491 "bitmask=0x%016llX\n", ioc->name, __func__, port_details, in mptsas_port_delete()
499 mptsas_set_rphy(ioc, phy_info, NULL); in mptsas_port_delete()
515 mptsas_set_rphy(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy) in mptsas_set_rphy() argument
519 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "sas_rphy_add: rphy=%p\n", in mptsas_set_rphy()
520 ioc->name, rphy)); in mptsas_set_rphy()
524 dsaswideprintk(ioc, dev_printk(KERN_DEBUG, in mptsas_set_rphy()
525 &rphy->dev, MYIOC_s_FMT "add:", ioc->name)); in mptsas_set_rphy()
526 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "rphy=%p release=%p\n", in mptsas_set_rphy()
527 ioc->name, rphy, rphy->dev.release)); in mptsas_set_rphy()
541 mptsas_set_port(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_port *port) in mptsas_set_port() argument
547 dsaswideprintk(ioc, dev_printk(KERN_DEBUG, in mptsas_set_port()
548 &port->dev, MYIOC_s_FMT "add:", ioc->name)); in mptsas_set_port()
549 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "port=%p release=%p\n", in mptsas_set_port()
550 ioc->name, port, port->dev.release)); in mptsas_set_port()
583 mptsas_add_device_component(MPT_ADAPTER *ioc, u8 channel, u8 id, in mptsas_add_device_component() argument
594 mutex_lock(&ioc->sas_device_info_mutex); in mptsas_add_device_component()
595 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list, in mptsas_add_device_component()
621 list_add_tail(&sas_info->list, &ioc->sas_device_info_list); in mptsas_add_device_component()
626 shost_for_each_device(sdev, ioc->sh) { in mptsas_add_device_component()
636 mutex_unlock(&ioc->sas_device_info_mutex); in mptsas_add_device_component()
648 mptsas_add_device_component_by_fw(MPT_ADAPTER *ioc, u8 channel, u8 id) in mptsas_add_device_component_by_fw() argument
654 rc = mptsas_sas_device_pg0(ioc, &sas_device, in mptsas_add_device_component_by_fw()
662 mptsas_sas_enclosure_pg0(ioc, &enclosure_info, in mptsas_add_device_component_by_fw()
667 mptsas_add_device_component(ioc, sas_device.channel, in mptsas_add_device_component_by_fw()
679 mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc, in mptsas_add_device_component_starget_ir() argument
699 if (mpt_config(ioc, &cfg) != 0) in mptsas_add_device_component_starget_ir()
705 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, in mptsas_add_device_component_starget_ir()
714 if (mpt_config(ioc, &cfg) != 0) in mptsas_add_device_component_starget_ir()
725 if (mpt_raid_phys_disk_pg0(ioc, in mptsas_add_device_component_starget_ir()
729 mptsas_add_device_component_by_fw(ioc, phys_disk.PhysDiskBus, in mptsas_add_device_component_starget_ir()
732 mutex_lock(&ioc->sas_device_info_mutex); in mptsas_add_device_component_starget_ir()
733 list_for_each_entry(sas_info, &ioc->sas_device_info_list, in mptsas_add_device_component_starget_ir()
742 mutex_unlock(&ioc->sas_device_info_mutex); in mptsas_add_device_component_starget_ir()
749 mutex_lock(&ioc->sas_device_info_mutex); in mptsas_add_device_component_starget_ir()
750 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list, in mptsas_add_device_component_starget_ir()
766 list_add_tail(&sas_info->list, &ioc->sas_device_info_list); in mptsas_add_device_component_starget_ir()
768 mutex_unlock(&ioc->sas_device_info_mutex); in mptsas_add_device_component_starget_ir()
772 dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, in mptsas_add_device_component_starget_ir()
783 mptsas_add_device_component_starget(MPT_ADAPTER *ioc, in mptsas_add_device_component_starget() argument
791 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, in mptsas_add_device_component_starget()
797 mptsas_sas_enclosure_pg0(ioc, &enclosure_info, in mptsas_add_device_component_starget()
802 mptsas_add_device_component(ioc, phy_info->attached.channel, in mptsas_add_device_component_starget()
816 mptsas_del_device_component_by_os(MPT_ADAPTER *ioc, u8 channel, u8 id) in mptsas_del_device_component_by_os() argument
823 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list, in mptsas_del_device_component_by_os()
836 mptsas_del_device_components(MPT_ADAPTER *ioc) in mptsas_del_device_components() argument
840 mutex_lock(&ioc->sas_device_info_mutex); in mptsas_del_device_components()
841 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list, in mptsas_del_device_components()
846 mutex_unlock(&ioc->sas_device_info_mutex); in mptsas_del_device_components()
857 mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info) in mptsas_setup_wide_ports() argument
864 mutex_lock(&ioc->sas_topology_mutex); in mptsas_setup_wide_ports()
879 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_setup_wide_ports()
881 ioc->name, __func__, port_details, i)); in mptsas_setup_wide_ports()
886 devtprintk(ioc, dev_printk(KERN_DEBUG, in mptsas_setup_wide_ports()
888 "delete phy %d, phy-obj (0x%p)\n", ioc->name, in mptsas_setup_wide_ports()
901 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "phy_id=%d sas_address=0x%018llX\n", in mptsas_setup_wide_ports()
902 ioc->name, i, (unsigned long long)sas_address)); in mptsas_setup_wide_ports()
920 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tForming port\n\t\t" in mptsas_setup_wide_ports()
922 ioc->name, i, (unsigned long long)sas_address)); in mptsas_setup_wide_ports()
937 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_setup_wide_ports()
939 ioc->name, j, (unsigned long long) in mptsas_setup_wide_ports()
971 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_setup_wide_ports()
973 "bitmask=0x%016llX\n", ioc->name, __func__, in mptsas_setup_wide_ports()
976 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tport = %p rphy=%p\n", in mptsas_setup_wide_ports()
977 ioc->name, port_details->port, port_details->rphy)); in mptsas_setup_wide_ports()
979 dsaswideprintk(ioc, printk("\n")); in mptsas_setup_wide_ports()
980 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_setup_wide_ports()
993 mptsas_find_vtarget(MPT_ADAPTER *ioc, u8 channel, u8 id) in mptsas_find_vtarget() argument
999 shost_for_each_device(sdev, ioc->sh) { in mptsas_find_vtarget()
1016 mptsas_queue_device_delete(MPT_ADAPTER *ioc, in mptsas_queue_device_delete() argument
1026 ioc->name, __func__, __LINE__); in mptsas_queue_device_delete()
1032 fw_event->ioc = ioc; in mptsas_queue_device_delete()
1033 mptsas_add_fw_event(ioc, fw_event, msecs_to_jiffies(1)); in mptsas_queue_device_delete()
1037 mptsas_queue_rescan(MPT_ADAPTER *ioc) in mptsas_queue_rescan() argument
1044 ioc->name, __func__, __LINE__); in mptsas_queue_rescan()
1048 fw_event->ioc = ioc; in mptsas_queue_rescan()
1049 mptsas_add_fw_event(ioc, fw_event, msecs_to_jiffies(1)); in mptsas_queue_rescan()
1066 mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id) in mptsas_target_reset() argument
1070 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) in mptsas_target_reset()
1074 mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc); in mptsas_target_reset()
1076 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT in mptsas_target_reset()
1077 "%s, no msg frames @%d!!\n", ioc->name, in mptsas_target_reset()
1082 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt request (mf=%p)\n", in mptsas_target_reset()
1083 ioc->name, mf)); in mptsas_target_reset()
1095 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf); in mptsas_target_reset()
1097 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_target_reset()
1099 ioc->name, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, channel, id)); in mptsas_target_reset()
1101 mpt_put_msg_frame_hi_pri(mptsasDeviceResetCtx, ioc, mf); in mptsas_target_reset()
1107 mpt_clear_taskmgmt_in_progress_flag(ioc); in mptsas_target_reset()
1136 mptsas_target_reset_queue(MPT_ADAPTER *ioc, in mptsas_target_reset_queue() argument
1139 MPT_SCSI_HOST *hd = shost_priv(ioc->sh); in mptsas_target_reset_queue()
1147 vtarget = mptsas_find_vtarget(ioc, channel, id); in mptsas_target_reset_queue()
1156 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT in mptsas_target_reset_queue()
1158 ioc->name, __func__, __LINE__)); in mptsas_target_reset_queue()
1168 if (mptsas_target_reset(ioc, channel, id)) { in mptsas_target_reset_queue()
1185 MPT_ADAPTER *ioc = (MPT_ADAPTER *)(iocp); in mptsas_schedule_target_reset() local
1186 MPT_SCSI_HOST *hd = shost_priv(ioc->sh); in mptsas_schedule_target_reset()
1204 if (mptsas_target_reset(ioc, channel, id)) in mptsas_schedule_target_reset()
1221 mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) in mptsas_taskmgmt_complete() argument
1223 MPT_SCSI_HOST *hd = shost_priv(ioc->sh); in mptsas_taskmgmt_complete()
1229 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed: " in mptsas_taskmgmt_complete()
1230 "(mf = %p, mr = %p)\n", ioc->name, mf, mr)); in mptsas_taskmgmt_complete()
1236 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_taskmgmt_complete()
1240 "term_cmnds = %d\n", ioc->name, in mptsas_taskmgmt_complete()
1249 mptscsih_taskmgmt_response_code(ioc, in mptsas_taskmgmt_complete()
1255 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD; in mptsas_taskmgmt_complete()
1256 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_RF_VALID; in mptsas_taskmgmt_complete()
1257 memcpy(ioc->taskmgmt_cmds.reply, mr, in mptsas_taskmgmt_complete()
1259 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_PENDING) { in mptsas_taskmgmt_complete()
1260 ioc->taskmgmt_cmds.status &= ~MPT_MGMT_STATUS_PENDING; in mptsas_taskmgmt_complete()
1261 complete(&ioc->taskmgmt_cmds.done); in mptsas_taskmgmt_complete()
1267 mpt_clear_taskmgmt_in_progress_flag(ioc); in mptsas_taskmgmt_complete()
1275 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_taskmgmt_complete()
1277 ioc->name, jiffies_to_msecs(jiffies - in mptsas_taskmgmt_complete()
1288 if (mptsas_target_reset(ioc, channel, id)) in mptsas_taskmgmt_complete()
1297 if (!ioc->fw_events_off) in mptsas_taskmgmt_complete()
1298 mptsas_queue_device_delete(ioc, in mptsas_taskmgmt_complete()
1302 ioc->schedule_target_reset(ioc); in mptsas_taskmgmt_complete()
1315 mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) in mptsas_ioc_reset() argument
1320 rc = mptscsih_ioc_reset(ioc, reset_phase); in mptsas_ioc_reset()
1321 if ((ioc->bus_type != SAS) || (!rc)) in mptsas_ioc_reset()
1324 hd = shost_priv(ioc->sh); in mptsas_ioc_reset()
1325 if (!hd->ioc) in mptsas_ioc_reset()
1330 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_ioc_reset()
1331 "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__)); in mptsas_ioc_reset()
1332 mptsas_fw_event_off(ioc); in mptsas_ioc_reset()
1335 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_ioc_reset()
1336 "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__)); in mptsas_ioc_reset()
1339 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_ioc_reset()
1340 "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__)); in mptsas_ioc_reset()
1341 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_PENDING) { in mptsas_ioc_reset()
1342 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_DID_IOCRESET; in mptsas_ioc_reset()
1343 complete(&ioc->sas_mgmt.done); in mptsas_ioc_reset()
1345 mptsas_cleanup_fw_event_q(ioc); in mptsas_ioc_reset()
1346 mptsas_queue_rescan(ioc); in mptsas_ioc_reset()
1371 mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure, in mptsas_sas_enclosure_pg0() argument
1394 error = mpt_config(ioc, &cfg); in mptsas_sas_enclosure_pg0()
1402 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_sas_enclosure_pg0()
1412 error = mpt_config(ioc, &cfg); in mptsas_sas_enclosure_pg0()
1429 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_sas_enclosure_pg0()
1444 mptsas_add_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info) in mptsas_add_end_device() argument
1453 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_add_end_device()
1454 "%s: exit at line=%d\n", ioc->name, in mptsas_add_end_device()
1462 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_add_end_device()
1463 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_add_end_device()
1470 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_add_end_device()
1471 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_add_end_device()
1487 " phy %d, sas_addr 0x%llx\n", ioc->name, ds, in mptsas_add_end_device()
1495 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_add_end_device()
1496 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_add_end_device()
1503 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_add_end_device()
1504 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_add_end_device()
1509 mptsas_set_rphy(ioc, phy_info, rphy); in mptsas_add_end_device()
1520 mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info) in mptsas_del_end_device() argument
1538 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_del_end_device()
1539 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_del_end_device()
1545 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_del_end_device()
1546 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_del_end_device()
1569 "sas_addr 0x%llx\n", ioc->name, ds, phy_info->attached.channel, in mptsas_del_end_device()
1575 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_del_end_device()
1576 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_del_end_device()
1590 ioc->name, phy_info_parent->phy_id, in mptsas_del_end_device()
1596 "delete port %d, sas_addr (0x%llx)\n", ioc->name, in mptsas_del_end_device()
1599 mptsas_set_port(ioc, phy_info, NULL); in mptsas_del_end_device()
1600 mptsas_port_delete(ioc, phy_info->port_details); in mptsas_del_end_device()
1604 mptsas_refreshing_device_handles(MPT_ADAPTER *ioc, in mptsas_refreshing_device_handles() argument
1611 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, in mptsas_refreshing_device_handles()
1618 mutex_lock(&ioc->sas_topology_mutex); in mptsas_refreshing_device_handles()
1633 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_refreshing_device_handles()
1649 MPT_ADAPTER *ioc = fw_event->ioc; in mptsas_firmware_event_work() local
1653 if (ioc->in_rescan) { in mptsas_firmware_event_work()
1654 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_firmware_event_work()
1656 ioc->name, __func__)); in mptsas_firmware_event_work()
1659 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: rescan after " in mptsas_firmware_event_work()
1660 "reset\n", ioc->name, __func__)); in mptsas_firmware_event_work()
1661 ioc->in_rescan = 1; in mptsas_firmware_event_work()
1662 mptsas_not_responding_devices(ioc); in mptsas_firmware_event_work()
1663 mptsas_scan_sas_topology(ioc); in mptsas_firmware_event_work()
1664 ioc->in_rescan = 0; in mptsas_firmware_event_work()
1665 mptsas_free_fw_event(ioc, fw_event); in mptsas_firmware_event_work()
1666 mptsas_fw_event_on(ioc); in mptsas_firmware_event_work()
1671 if (ioc->fw_events_off) { in mptsas_firmware_event_work()
1672 mptsas_free_fw_event(ioc, fw_event); in mptsas_firmware_event_work()
1676 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: fw_event=(0x%p), " in mptsas_firmware_event_work()
1677 "event = (0x%02x)\n", ioc->name, __func__, fw_event, in mptsas_firmware_event_work()
1691 mptbase_sas_persist_operation(ioc, in mptsas_firmware_event_work()
1693 mptsas_free_fw_event(ioc, fw_event); in mptsas_firmware_event_work()
1717 MPT_ADAPTER *ioc = hd->ioc; in mptsas_slave_configure() local
1730 mptsas_add_device_component_starget_ir(ioc, scsi_target(sdev)); in mptsas_slave_configure()
1736 mptsas_add_device_component_starget(ioc, scsi_target(sdev)); in mptsas_slave_configure()
1752 MPT_ADAPTER *ioc = hd->ioc; in mptsas_target_alloc() local
1759 vtarget->ioc_id = ioc->id; in mptsas_target_alloc()
1768 if (!ioc->raid_data.pIocPg2) { in mptsas_target_alloc()
1772 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { in mptsas_target_alloc()
1773 if (id == ioc->raid_data.pIocPg2-> in mptsas_target_alloc()
1775 channel = ioc->raid_data.pIocPg2-> in mptsas_target_alloc()
1784 mutex_lock(&ioc->sas_topology_mutex); in mptsas_target_alloc()
1785 list_for_each_entry(p, &ioc->sas_topology, list) { in mptsas_target_alloc()
1797 if (mptscsih_is_phys_disk(ioc, channel, id)) { in mptsas_target_alloc()
1798 id = mptscsih_raid_id_to_num(ioc, in mptsas_target_alloc()
1804 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_target_alloc()
1808 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_target_alloc()
1828 MPT_ADAPTER *ioc = hd->ioc; in mptsas_target_destroy() local
1836 mptsas_del_device_component_by_os(ioc, starget->channel, in mptsas_target_destroy()
1844 list_for_each_entry(p, &ioc->sas_topology, list) { in mptsas_target_destroy()
1852 "sas_addr 0x%llx\n", ioc->name, in mptsas_target_destroy()
1879 MPT_ADAPTER *ioc = hd->ioc; in mptsas_slave_alloc() local
1884 ioc->name, sizeof(VirtDevice)); in mptsas_slave_alloc()
1894 mutex_lock(&ioc->sas_topology_mutex); in mptsas_slave_alloc()
1895 list_for_each_entry(p, &ioc->sas_topology, list) { in mptsas_slave_alloc()
1904 if (mptscsih_is_phys_disk(ioc, in mptsas_slave_alloc()
1908 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_slave_alloc()
1912 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_slave_alloc()
1927 MPT_ADAPTER *ioc; in mptsas_qcmd() local
1937 ioc = hd->ioc; in mptsas_qcmd()
1939 if (ioc->sas_discovery_quiesce_io) in mptsas_qcmd()
1942 if (ioc->debug_level & MPT_DEBUG_SCSI) in mptsas_qcmd()
1958 MPT_ADAPTER *ioc; in mptsas_eh_timed_out() local
1969 ioc = hd->ioc; in mptsas_eh_timed_out()
1970 if (ioc->bus_type != SAS) { in mptsas_eh_timed_out()
1979 if (ioc->ioc_reset_in_progress) { in mptsas_eh_timed_out()
1980 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT ": %s: ioc is in reset," in mptsas_eh_timed_out()
1982 ioc->name, __func__, sc)); in mptsas_eh_timed_out()
1988 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT ": %s: target removed " in mptsas_eh_timed_out()
1990 ioc->name, __func__, sc)); in mptsas_eh_timed_out()
2029 MPT_ADAPTER *ioc = phy_to_ioc(phy); in mptsas_get_linkerrors() local
2055 error = mpt_config(ioc, &cfg); in mptsas_get_linkerrors()
2061 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_get_linkerrors()
2069 error = mpt_config(ioc, &cfg); in mptsas_get_linkerrors()
2073 mptsas_print_phy_pg1(ioc, buffer); in mptsas_get_linkerrors()
2084 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_get_linkerrors()
2089 static int mptsas_mgmt_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, in mptsas_mgmt_done() argument
2092 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_COMMAND_GOOD; in mptsas_mgmt_done()
2094 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_RF_VALID; in mptsas_mgmt_done()
2095 memcpy(ioc->sas_mgmt.reply, reply, in mptsas_mgmt_done()
2096 min(ioc->reply_sz, 4 * reply->u.reply.MsgLength)); in mptsas_mgmt_done()
2099 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_PENDING) { in mptsas_mgmt_done()
2100 ioc->sas_mgmt.status &= ~MPT_MGMT_STATUS_PENDING; in mptsas_mgmt_done()
2101 complete(&ioc->sas_mgmt.done); in mptsas_mgmt_done()
2109 MPT_ADAPTER *ioc = phy_to_ioc(phy); in mptsas_phy_reset() local
2125 if (mutex_lock_interruptible(&ioc->sas_mgmt.mutex)) in mptsas_phy_reset()
2128 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc); in mptsas_phy_reset()
2143 INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status) in mptsas_phy_reset()
2144 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf); in mptsas_phy_reset()
2146 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, in mptsas_phy_reset()
2148 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { in mptsas_phy_reset()
2150 mpt_free_msg_frame(ioc, mf); in mptsas_phy_reset()
2151 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET) in mptsas_phy_reset()
2154 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP); in mptsas_phy_reset()
2159 if ((ioc->sas_mgmt.status & in mptsas_phy_reset()
2166 reply = (SasIoUnitControlReply_t *)ioc->sas_mgmt.reply; in mptsas_phy_reset()
2169 ioc->name, __func__, reply->IOCStatus, reply->IOCLogInfo); in mptsas_phy_reset()
2177 CLEAR_MGMT_STATUS(ioc->sas_mgmt.status) in mptsas_phy_reset()
2178 mutex_unlock(&ioc->sas_mgmt.mutex); in mptsas_phy_reset()
2186 MPT_ADAPTER *ioc = rphy_to_ioc(rphy); in mptsas_get_enclosure_identifier() local
2192 mutex_lock(&ioc->sas_topology_mutex); in mptsas_get_enclosure_identifier()
2193 list_for_each_entry(p, &ioc->sas_topology, list) { in mptsas_get_enclosure_identifier()
2203 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_get_enclosure_identifier()
2207 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_get_enclosure_identifier()
2209 error = mptsas_sas_enclosure_pg0(ioc, &enclosure_info, in mptsas_get_enclosure_identifier()
2220 MPT_ADAPTER *ioc = rphy_to_ioc(rphy); in mptsas_get_bay_identifier() local
2224 mutex_lock(&ioc->sas_topology_mutex); in mptsas_get_bay_identifier()
2225 list_for_each_entry(p, &ioc->sas_topology, list) { in mptsas_get_bay_identifier()
2236 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_get_bay_identifier()
2243 MPT_ADAPTER *ioc = ((MPT_SCSI_HOST *) shost->hostdata)->ioc; in mptsas_smp_handler() local
2257 ioc->name, __func__, job->request_payload.payload_len, in mptsas_smp_handler()
2262 ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex); in mptsas_smp_handler()
2266 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc); in mptsas_smp_handler()
2284 mutex_lock(&ioc->sas_topology_mutex); in mptsas_smp_handler()
2285 port_info = ioc->hba_port_info; in mptsas_smp_handler()
2289 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_smp_handler()
2303 if (!dma_map_sg(&ioc->pcidev->dev, job->request_payload.sg_list, in mptsas_smp_handler()
2308 ioc->add_sge(psge, flagsLength, in mptsas_smp_handler()
2310 psge += ioc->SGE_size; in mptsas_smp_handler()
2320 if (!dma_map_sg(&ioc->pcidev->dev, job->reply_payload.sg_list, in mptsas_smp_handler()
2324 ioc->add_sge(psge, flagsLength, in mptsas_smp_handler()
2327 INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status) in mptsas_smp_handler()
2328 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf); in mptsas_smp_handler()
2330 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ); in mptsas_smp_handler()
2331 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { in mptsas_smp_handler()
2333 mpt_free_msg_frame(ioc, mf); in mptsas_smp_handler()
2335 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET) in mptsas_smp_handler()
2338 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP); in mptsas_smp_handler()
2343 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) { in mptsas_smp_handler()
2346 smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply; in mptsas_smp_handler()
2353 ioc->name, __func__); in mptsas_smp_handler()
2358 dma_unmap_sg(&ioc->pcidev->dev, job->reply_payload.sg_list, 1, in mptsas_smp_handler()
2361 dma_unmap_sg(&ioc->pcidev->dev, job->request_payload.sg_list, 1, in mptsas_smp_handler()
2365 mpt_free_msg_frame(ioc, mf); in mptsas_smp_handler()
2367 CLEAR_MGMT_STATUS(ioc->sas_mgmt.status) in mptsas_smp_handler()
2368 mutex_unlock(&ioc->sas_mgmt.mutex); in mptsas_smp_handler()
2384 mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info) in mptsas_sas_io_unit_pg0() argument
2407 error = mpt_config(ioc, &cfg); in mptsas_sas_io_unit_pg0()
2415 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_sas_io_unit_pg0()
2425 error = mpt_config(ioc, &cfg); in mptsas_sas_io_unit_pg0()
2437 ioc->nvdata_version_persistent = in mptsas_sas_io_unit_pg0()
2439 ioc->nvdata_version_default = in mptsas_sas_io_unit_pg0()
2443 mptsas_print_phy_data(ioc, &buffer->PhyData[i]); in mptsas_sas_io_unit_pg0()
2455 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_sas_io_unit_pg0()
2462 mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc) in mptsas_sas_io_unit_pg1() argument
2482 error = mpt_config(ioc, &cfg); in mptsas_sas_io_unit_pg1()
2490 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_sas_io_unit_pg1()
2500 error = mpt_config(ioc, &cfg); in mptsas_sas_io_unit_pg1()
2504 ioc->io_missing_delay = in mptsas_sas_io_unit_pg1()
2507 ioc->device_missing_delay = (device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_UNIT_16) ? in mptsas_sas_io_unit_pg1()
2512 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_sas_io_unit_pg1()
2519 mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, in mptsas_sas_phy_pg0() argument
2545 error = mpt_config(ioc, &cfg); in mptsas_sas_phy_pg0()
2554 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_sas_phy_pg0()
2564 error = mpt_config(ioc, &cfg); in mptsas_sas_phy_pg0()
2568 mptsas_print_phy_pg0(ioc, buffer); in mptsas_sas_phy_pg0()
2576 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_sas_phy_pg0()
2583 mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info, in mptsas_sas_device_pg0() argument
2609 error = mpt_config(ioc, &cfg); in mptsas_sas_device_pg0()
2617 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_sas_device_pg0()
2627 error = mpt_config(ioc, &cfg); in mptsas_sas_device_pg0()
2637 mptsas_print_device_pg0(ioc, buffer); in mptsas_sas_device_pg0()
2657 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_sas_device_pg0()
2664 mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info, in mptsas_sas_expander_pg0() argument
2691 error = mpt_config(ioc, &cfg); in mptsas_sas_expander_pg0()
2700 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_sas_expander_pg0()
2710 error = mpt_config(ioc, &cfg); in mptsas_sas_expander_pg0()
2740 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_sas_expander_pg0()
2747 mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, in mptsas_sas_expander_pg1() argument
2771 error = mpt_config(ioc, &cfg); in mptsas_sas_expander_pg1()
2780 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, in mptsas_sas_expander_pg1()
2790 error = mpt_config(ioc, &cfg); in mptsas_sas_expander_pg1()
2801 mptsas_print_expander_pg1(ioc, buffer); in mptsas_sas_expander_pg1()
2813 dma_free_coherent(&ioc->pcidev->dev, hdr.ExtPageLength * 4, buffer, in mptsas_sas_expander_pg1()
2858 mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc, in mptsas_exp_repmanufacture_info() argument
2875 spin_lock_irqsave(&ioc->taskmgmt_lock, flags); in mptsas_exp_repmanufacture_info()
2876 if (ioc->ioc_reset_in_progress) { in mptsas_exp_repmanufacture_info()
2877 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); in mptsas_exp_repmanufacture_info()
2879 __func__, ioc->name); in mptsas_exp_repmanufacture_info()
2882 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); in mptsas_exp_repmanufacture_info()
2884 ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex); in mptsas_exp_repmanufacture_info()
2888 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc); in mptsas_exp_repmanufacture_info()
2899 data_out = dma_alloc_coherent(&ioc->pcidev->dev, sz, &data_out_dma, in mptsas_exp_repmanufacture_info()
2929 ioc->add_sge(psge, flagsLength, data_out_dma); in mptsas_exp_repmanufacture_info()
2930 psge += ioc->SGE_size; in mptsas_exp_repmanufacture_info()
2938 ioc->add_sge(psge, flagsLength, data_out_dma + in mptsas_exp_repmanufacture_info()
2941 INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status) in mptsas_exp_repmanufacture_info()
2942 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf); in mptsas_exp_repmanufacture_info()
2944 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ); in mptsas_exp_repmanufacture_info()
2945 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { in mptsas_exp_repmanufacture_info()
2947 mpt_free_msg_frame(ioc, mf); in mptsas_exp_repmanufacture_info()
2949 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET) in mptsas_exp_repmanufacture_info()
2952 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP); in mptsas_exp_repmanufacture_info()
2958 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) { in mptsas_exp_repmanufacture_info()
2961 smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply; in mptsas_exp_repmanufacture_info()
2986 ioc->name, __func__); in mptsas_exp_repmanufacture_info()
2991 dma_free_coherent(&ioc->pcidev->dev, sz, data_out, in mptsas_exp_repmanufacture_info()
2995 mpt_free_msg_frame(ioc, mf); in mptsas_exp_repmanufacture_info()
2997 CLEAR_MGMT_STATUS(ioc->sas_mgmt.status) in mptsas_exp_repmanufacture_info()
2998 mutex_unlock(&ioc->sas_mgmt.mutex); in mptsas_exp_repmanufacture_info()
3065 MPT_ADAPTER *ioc; in mptsas_probe_one_phy() local
3186 ioc = phy_to_ioc(phy_info->phy); in mptsas_probe_one_phy()
3198 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_probe_one_phy()
3199 "%s: exit at line=%d\n", ioc->name, in mptsas_probe_one_phy()
3203 mptsas_set_port(ioc, phy_info, port); in mptsas_probe_one_phy()
3204 devtprintk(ioc, dev_printk(KERN_DEBUG, &port->dev, in mptsas_probe_one_phy()
3206 ioc->name, port->port_identifier, in mptsas_probe_one_phy()
3210 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_probe_one_phy()
3212 ioc->name, phy_info->phy_id)); in mptsas_probe_one_phy()
3215 devtprintk(ioc, dev_printk(KERN_DEBUG, &phy_info->phy->dev, in mptsas_probe_one_phy()
3216 MYIOC_s_FMT "add phy %d, phy-obj (0x%p)\n", ioc->name, in mptsas_probe_one_phy()
3241 port_info = ioc->hba_port_info; in mptsas_probe_one_phy()
3272 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_probe_one_phy()
3273 "%s: exit at line=%d\n", ioc->name, in mptsas_probe_one_phy()
3281 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_probe_one_phy()
3282 "%s: exit at line=%d\n", ioc->name, in mptsas_probe_one_phy()
3287 mptsas_set_rphy(ioc, phy_info, rphy); in mptsas_probe_one_phy()
3290 mptsas_exp_repmanufacture_info(ioc, in mptsas_probe_one_phy()
3297 vtarget = mptsas_find_vtarget(ioc, in mptsas_probe_one_phy()
3310 mptsas_probe_hba_phys(MPT_ADAPTER *ioc) in mptsas_probe_hba_phys() argument
3319 error = mptsas_sas_io_unit_pg0(ioc, hba); in mptsas_probe_hba_phys()
3323 mptsas_sas_io_unit_pg1(ioc); in mptsas_probe_hba_phys()
3324 mutex_lock(&ioc->sas_topology_mutex); in mptsas_probe_hba_phys()
3325 port_info = ioc->hba_port_info; in mptsas_probe_hba_phys()
3327 ioc->hba_port_info = port_info = hba; in mptsas_probe_hba_phys()
3328 ioc->hba_port_num_phy = port_info->num_phys; in mptsas_probe_hba_phys()
3329 list_add_tail(&port_info->list, &ioc->sas_topology); in mptsas_probe_hba_phys()
3343 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_probe_hba_phys()
3345 ioc->num_ports = port_info->num_phys; in mptsas_probe_hba_phys()
3348 mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i], in mptsas_probe_hba_phys()
3353 mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify, in mptsas_probe_hba_phys()
3357 if (!ioc->hba_port_sas_addr) in mptsas_probe_hba_phys()
3358 ioc->hba_port_sas_addr = in mptsas_probe_hba_phys()
3363 mptsas_sas_device_pg0(ioc, in mptsas_probe_hba_phys()
3370 mptsas_setup_wide_ports(ioc, port_info); in mptsas_probe_hba_phys()
3372 for (i = 0; i < port_info->num_phys; i++, ioc->sas_index++) in mptsas_probe_hba_phys()
3373 mptsas_probe_one_phy(&ioc->sh->shost_gendev, in mptsas_probe_hba_phys()
3374 &port_info->phy_info[i], ioc->sas_index, 1); in mptsas_probe_hba_phys()
3385 mptsas_expander_refresh(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info) in mptsas_expander_refresh() argument
3397 mptsas_sas_expander_pg1(ioc, &port_info->phy_info[i], in mptsas_expander_refresh()
3401 mptsas_sas_device_pg0(ioc, in mptsas_expander_refresh()
3410 mptsas_sas_device_pg0(ioc, in mptsas_expander_refresh()
3420 mutex_lock(&ioc->sas_topology_mutex); in mptsas_expander_refresh()
3421 parent = mptsas_find_portinfo_by_handle(ioc, in mptsas_expander_refresh()
3424 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_expander_refresh()
3434 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_expander_refresh()
3436 mptsas_setup_wide_ports(ioc, port_info); in mptsas_expander_refresh()
3437 for (i = 0; i < port_info->num_phys; i++, ioc->sas_index++) in mptsas_expander_refresh()
3439 ioc->sas_index, 0); in mptsas_expander_refresh()
3443 mptsas_expander_event_add(MPT_ADAPTER *ioc, in mptsas_expander_event_add() argument
3468 mutex_lock(&ioc->sas_topology_mutex); in mptsas_expander_event_add()
3469 list_add_tail(&port_info->list, &ioc->sas_topology); in mptsas_expander_event_add()
3470 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_expander_event_add()
3473 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys, in mptsas_expander_event_add()
3476 mptsas_expander_refresh(ioc, port_info); in mptsas_expander_event_add()
3486 mptsas_delete_expander_siblings(MPT_ADAPTER *ioc, struct mptsas_portinfo in mptsas_delete_expander_siblings() argument
3500 mptsas_del_end_device(ioc, phy_info); in mptsas_delete_expander_siblings()
3512 port_info = mptsas_find_portinfo_by_sas_address(ioc, in mptsas_delete_expander_siblings()
3522 mptsas_expander_delete(ioc, port_info, 1); in mptsas_delete_expander_siblings()
3536 static void mptsas_expander_delete(MPT_ADAPTER *ioc, in mptsas_expander_delete() argument
3552 mptsas_sas_expander_pg0(ioc, &buffer, in mptsas_expander_delete()
3570 parent = mptsas_find_portinfo_by_handle(ioc, in mptsas_expander_delete()
3572 mptsas_delete_expander_siblings(ioc, parent, port_info); in mptsas_expander_delete()
3593 MYIOC_s_FMT "delete phy %d, phy-obj (0x%p)\n", ioc->name, in mptsas_expander_delete()
3600 ioc->name, port->port_identifier, in mptsas_expander_delete()
3603 mptsas_port_delete(ioc, port_details); in mptsas_expander_delete()
3608 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys, in mptsas_expander_delete()
3631 MPT_ADAPTER *ioc; in mptsas_send_expander_event() local
3637 ioc = fw_event->ioc; in mptsas_send_expander_event()
3642 port_info = mptsas_find_portinfo_by_sas_address(ioc, sas_address); in mptsas_send_expander_event()
3655 mptsas_expander_refresh(ioc, port_info); in mptsas_send_expander_event()
3657 mptsas_expander_event_add(ioc, expander_data); in mptsas_send_expander_event()
3660 mptsas_expander_delete(ioc, port_info, 0); in mptsas_send_expander_event()
3662 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_expander_event()
3673 mptsas_expander_add(MPT_ADAPTER *ioc, u16 handle) in mptsas_expander_add() argument
3678 if ((mptsas_sas_expander_pg0(ioc, &buffer, in mptsas_expander_add()
3685 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_expander_add()
3686 "%s: exit at line=%d\n", ioc->name, in mptsas_expander_add()
3694 mutex_lock(&ioc->sas_topology_mutex); in mptsas_expander_add()
3695 list_add_tail(&port_info->list, &ioc->sas_topology); in mptsas_expander_add()
3696 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_expander_add()
3698 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys, in mptsas_expander_add()
3700 mptsas_expander_refresh(ioc, port_info); in mptsas_expander_add()
3707 MPT_ADAPTER *ioc; in mptsas_send_link_status_event() local
3715 ioc = fw_event->ioc; in mptsas_send_link_status_event()
3723 port_info = mptsas_find_portinfo_by_sas_address(ioc, sas_address); in mptsas_send_link_status_event()
3735 if (ioc->old_sas_discovery_protocal) { in mptsas_send_link_status_event()
3736 port_info = mptsas_expander_add(ioc, in mptsas_send_link_status_event()
3744 if (port_info == ioc->hba_port_info) in mptsas_send_link_status_event()
3745 mptsas_probe_hba_phys(ioc); in mptsas_send_link_status_event()
3747 mptsas_expander_refresh(ioc, port_info); in mptsas_send_link_status_event()
3759 if (ioc->device_missing_delay && in mptsas_send_link_status_event()
3766 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_send_link_status_event()
3768 ioc->name, phy_info->attached.id, in mptsas_send_link_status_event()
3771 shost_for_each_device(sdev, ioc->sh) { in mptsas_send_link_status_event()
3783 devtprintk(ioc, in mptsas_send_link_status_event()
3786 "%d\n", ioc->name, in mptsas_send_link_status_event()
3794 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_link_status_event()
3798 mptsas_not_responding_devices(MPT_ADAPTER *ioc) in mptsas_not_responding_devices() argument
3810 mpt_findImVolumes(ioc); in mptsas_not_responding_devices()
3812 spin_lock_irqsave(&ioc->taskmgmt_lock, flags); in mptsas_not_responding_devices()
3813 if (ioc->ioc_reset_in_progress) { in mptsas_not_responding_devices()
3814 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_not_responding_devices()
3815 "%s: exiting due to a parallel reset \n", ioc->name, in mptsas_not_responding_devices()
3817 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); in mptsas_not_responding_devices()
3820 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags); in mptsas_not_responding_devices()
3823 mutex_lock(&ioc->sas_device_info_mutex); in mptsas_not_responding_devices()
3825 list_for_each_entry(sas_info, &ioc->sas_device_info_list, list) { in mptsas_not_responding_devices()
3832 retval = mptsas_sas_device_pg0(ioc, &sas_device, in mptsas_not_responding_devices()
3841 spin_lock_irqsave(&ioc->taskmgmt_lock, flags); in mptsas_not_responding_devices()
3842 if (ioc->ioc_reset_in_progress) { in mptsas_not_responding_devices()
3843 dfailprintk(ioc, in mptsas_not_responding_devices()
3846 ioc->name, __func__)); in mptsas_not_responding_devices()
3848 (&ioc->taskmgmt_lock, flags); in mptsas_not_responding_devices()
3849 mutex_unlock(&ioc-> in mptsas_not_responding_devices()
3853 spin_unlock_irqrestore(&ioc->taskmgmt_lock, in mptsas_not_responding_devices()
3862 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_not_responding_devices()
3865 ioc->name, __func__, in mptsas_not_responding_devices()
3871 vtarget = mptsas_find_vtarget(ioc, in mptsas_not_responding_devices()
3877 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, in mptsas_not_responding_devices()
3880 mptsas_del_end_device(ioc, phy_info); in mptsas_not_responding_devices()
3883 mptsas_volume_delete(ioc, sas_info->fw.id); in mptsas_not_responding_devices()
3885 mutex_unlock(&ioc->sas_device_info_mutex); in mptsas_not_responding_devices()
3888 mutex_lock(&ioc->sas_topology_mutex); in mptsas_not_responding_devices()
3890 list_for_each_entry(port_info, &ioc->sas_topology, list) { in mptsas_not_responding_devices()
3897 while (!mptsas_sas_expander_pg0(ioc, &buffer, in mptsas_not_responding_devices()
3911 mptsas_expander_delete(ioc, port_info, 0); in mptsas_not_responding_devices()
3915 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_not_responding_devices()
3924 mptsas_probe_expanders(MPT_ADAPTER *ioc) in mptsas_probe_expanders() argument
3931 while (!mptsas_sas_expander_pg0(ioc, &buffer, in mptsas_probe_expanders()
3936 port_info = mptsas_find_portinfo_by_sas_address(ioc, in mptsas_probe_expanders()
3946 mptsas_expander_refresh(ioc, port_info); in mptsas_probe_expanders()
3953 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_probe_expanders()
3954 "%s: exit at line=%d\n", ioc->name, in mptsas_probe_expanders()
3962 mutex_lock(&ioc->sas_topology_mutex); in mptsas_probe_expanders()
3963 list_add_tail(&port_info->list, &ioc->sas_topology); in mptsas_probe_expanders()
3964 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_probe_expanders()
3966 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys, in mptsas_probe_expanders()
3968 mptsas_expander_refresh(ioc, port_info); in mptsas_probe_expanders()
3973 mptsas_probe_devices(MPT_ADAPTER *ioc) in mptsas_probe_devices() argument
3980 while (!(mptsas_sas_device_pg0(ioc, &sas_device, in mptsas_probe_devices()
3998 phy_info = mptsas_refreshing_device_handles(ioc, &sas_device); in mptsas_probe_devices()
4005 mptsas_add_end_device(ioc, phy_info); in mptsas_probe_devices()
4016 mptsas_scan_sas_topology(MPT_ADAPTER *ioc) in mptsas_scan_sas_topology() argument
4021 mptsas_probe_hba_phys(ioc); in mptsas_scan_sas_topology()
4022 mptsas_probe_expanders(ioc); in mptsas_scan_sas_topology()
4023 mptsas_probe_devices(ioc); in mptsas_scan_sas_topology()
4028 if (!ioc->ir_firmware || !ioc->raid_data.pIocPg2 || in mptsas_scan_sas_topology()
4029 !ioc->raid_data.pIocPg2->NumActiveVolumes) in mptsas_scan_sas_topology()
4031 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { in mptsas_scan_sas_topology()
4032 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL, in mptsas_scan_sas_topology()
4033 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0); in mptsas_scan_sas_topology()
4039 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL, in mptsas_scan_sas_topology()
4040 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID); in mptsas_scan_sas_topology()
4041 scsi_add_device(ioc->sh, MPTSAS_RAID_CHANNEL, in mptsas_scan_sas_topology()
4042 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0); in mptsas_scan_sas_topology()
4050 MPT_ADAPTER *ioc; in mptsas_handle_queue_full_event() local
4061 ioc = fw_event->ioc; in mptsas_handle_queue_full_event()
4068 mutex_lock(&ioc->sas_device_info_mutex); in mptsas_handle_queue_full_event()
4069 if (mptscsih_is_phys_disk(ioc, fw_channel, fw_id)) { in mptsas_handle_queue_full_event()
4070 list_for_each_entry(sas_info, &ioc->sas_device_info_list, in mptsas_handle_queue_full_event()
4084 list_for_each_entry(sas_info, &ioc->sas_device_info_list, in mptsas_handle_queue_full_event()
4101 mutex_unlock(&ioc->sas_device_info_mutex); in mptsas_handle_queue_full_event()
4104 shost_for_each_device(sdev, ioc->sh) { in mptsas_handle_queue_full_event()
4131 mptsas_free_fw_event(ioc, fw_event); in mptsas_handle_queue_full_event()
4136 mptsas_find_phyinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address) in mptsas_find_phyinfo_by_sas_address() argument
4142 mutex_lock(&ioc->sas_topology_mutex); in mptsas_find_phyinfo_by_sas_address()
4143 list_for_each_entry(port_info, &ioc->sas_topology, list) { in mptsas_find_phyinfo_by_sas_address()
4155 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_find_phyinfo_by_sas_address()
4169 mptsas_find_phyinfo_by_phys_disk_num(MPT_ADAPTER *ioc, u8 phys_disk_num, in mptsas_find_phyinfo_by_phys_disk_num() argument
4180 if (!ioc->raid_data.pIocPg3) in mptsas_find_phyinfo_by_phys_disk_num()
4183 num_paths = mpt_raid_phys_disk_get_num_paths(ioc, phys_disk_num); in mptsas_find_phyinfo_by_phys_disk_num()
4190 mpt_raid_phys_disk_pg1(ioc, phys_disk_num, phys_disk); in mptsas_find_phyinfo_by_phys_disk_num()
4199 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, in mptsas_find_phyinfo_by_phys_disk_num()
4214 mutex_lock(&ioc->sas_topology_mutex); in mptsas_find_phyinfo_by_phys_disk_num()
4215 list_for_each_entry(port_info, &ioc->sas_topology, list) { in mptsas_find_phyinfo_by_phys_disk_num()
4230 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_find_phyinfo_by_phys_disk_num()
4251 mptsas_adding_inactive_raid_components(MPT_ADAPTER *ioc, u8 channel, u8 id) in mptsas_adding_inactive_raid_components() argument
4270 if (mpt_config(ioc, &cfg) != 0) in mptsas_adding_inactive_raid_components()
4276 buffer = dma_alloc_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, in mptsas_adding_inactive_raid_components()
4285 if (mpt_config(ioc, &cfg) != 0) in mptsas_adding_inactive_raid_components()
4297 if (mpt_raid_phys_disk_pg0(ioc, in mptsas_adding_inactive_raid_components()
4301 if (mptsas_sas_device_pg0(ioc, &sas_device, in mptsas_adding_inactive_raid_components()
4316 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, in mptsas_adding_inactive_raid_components()
4318 mptsas_add_end_device(ioc, phy_info); in mptsas_adding_inactive_raid_components()
4323 dma_free_coherent(&ioc->pcidev->dev, hdr.PageLength * 4, in mptsas_adding_inactive_raid_components()
4330 mptsas_hotplug_work(MPT_ADAPTER *ioc, struct fw_event_work *fw_event, in mptsas_hotplug_work() argument
4344 if (!ioc->raid_data.pIocPg2) in mptsas_hotplug_work()
4347 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) { in mptsas_hotplug_work()
4348 if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == in mptsas_hotplug_work()
4352 "volume_id\n", ioc->name); in mptsas_hotplug_work()
4353 mptsas_free_fw_event(ioc, fw_event); in mptsas_hotplug_work()
4357 mpt_findImVolumes(ioc); in mptsas_hotplug_work()
4362 mptsas_sas_device_pg0(ioc, &sas_device, in mptsas_hotplug_work()
4378 phy_info = mptsas_refreshing_device_handles(ioc, &sas_device); in mptsas_hotplug_work()
4381 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_hotplug_work()
4383 "parent handle of device %x\n", ioc->name, in mptsas_hotplug_work()
4385 port_info = mptsas_find_portinfo_by_handle(ioc, in mptsas_hotplug_work()
4388 if (port_info == ioc->hba_port_info) in mptsas_hotplug_work()
4389 mptsas_probe_hba_phys(ioc); in mptsas_hotplug_work()
4391 mptsas_expander_refresh(ioc, port_info); in mptsas_hotplug_work()
4393 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4395 ioc->name, __func__, __LINE__)); in mptsas_hotplug_work()
4399 (ioc, &sas_device); in mptsas_hotplug_work()
4403 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4405 ioc->name, __func__, __LINE__)); in mptsas_hotplug_work()
4412 mptsas_add_end_device(ioc, phy_info); in mptsas_hotplug_work()
4416 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, in mptsas_hotplug_work()
4418 mptsas_del_end_device(ioc, phy_info); in mptsas_hotplug_work()
4423 mpt_findImVolumes(ioc); in mptsas_hotplug_work()
4426 ioc, hot_plug_info->phys_disk_num, in mptsas_hotplug_work()
4429 mptsas_del_end_device(ioc, phy_info); in mptsas_hotplug_work()
4434 if (mptsas_sas_device_pg0(ioc, &sas_device, in mptsas_hotplug_work()
4438 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4439 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4452 ioc, sas_device.sas_address); in mptsas_hotplug_work()
4455 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4456 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4463 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4464 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4471 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4472 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4477 mpt_findImVolumes(ioc); in mptsas_hotplug_work()
4481 ioc->name, hot_plug_info->channel, hot_plug_info->id, in mptsas_hotplug_work()
4493 if (mptsas_sas_device_pg0(ioc, &sas_device, in mptsas_hotplug_work()
4497 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4499 ioc->name, __func__, in mptsas_hotplug_work()
4511 phy_info = mptsas_find_phyinfo_by_sas_address(ioc, in mptsas_hotplug_work()
4514 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4515 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4522 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4523 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4530 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4531 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4537 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_hotplug_work()
4538 "%s: fw_id=%d exit at line=%d\n", ioc->name, in mptsas_hotplug_work()
4543 mpt_findImVolumes(ioc); in mptsas_hotplug_work()
4547 ioc->name, hot_plug_info->channel, hot_plug_info->id, in mptsas_hotplug_work()
4555 mptsas_add_device_component_by_fw(ioc, in mptsas_hotplug_work()
4561 mpt_findImVolumes(ioc); in mptsas_hotplug_work()
4563 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL, in mptsas_hotplug_work()
4565 scsi_add_device(ioc->sh, MPTSAS_RAID_CHANNEL, in mptsas_hotplug_work()
4571 mpt_findImVolumes(ioc); in mptsas_hotplug_work()
4573 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL, in mptsas_hotplug_work()
4581 mpt_findImVolumes(ioc); in mptsas_hotplug_work()
4582 mptsas_adding_inactive_raid_components(ioc, in mptsas_hotplug_work()
4590 mptsas_free_fw_event(ioc, fw_event); in mptsas_hotplug_work()
4596 MPT_ADAPTER *ioc; in mptsas_send_sas_event() local
4602 ioc = fw_event->ioc; in mptsas_send_sas_event()
4611 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_sas_event()
4617 mptbase_sas_persist_operation(ioc, in mptsas_send_sas_event()
4619 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_sas_event()
4640 mptsas_hotplug_work(ioc, fw_event, &hot_plug_info); in mptsas_send_sas_event()
4644 mptbase_sas_persist_operation(ioc, in mptsas_send_sas_event()
4646 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_sas_event()
4654 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_sas_event()
4662 MPT_ADAPTER *ioc; in mptsas_send_raid_event() local
4671 ioc = fw_event->ioc; in mptsas_send_raid_event()
4685 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL, in mptsas_send_raid_event()
4692 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Entering %s: " in mptsas_send_raid_event()
4693 "ReasonCode=%02x\n", ioc->name, __func__, in mptsas_send_raid_event()
4707 mpt_raid_phys_disk_pg0(ioc, in mptsas_send_raid_event()
4770 mptsas_hotplug_work(ioc, fw_event, &hot_plug_info); in mptsas_send_raid_event()
4772 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_raid_event()
4790 mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun, in mptsas_issue_tm() argument
4799 mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc); in mptsas_issue_tm()
4802 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt request: no " in mptsas_issue_tm()
4803 "msg frames!!\n", ioc->name)); in mptsas_issue_tm()
4807 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt request: mr = %p, " in mptsas_issue_tm()
4809 "fw_id = %d, lun = %lld,\n\t task_context = 0x%x\n", ioc->name, mf, in mptsas_issue_tm()
4826 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status) in mptsas_issue_tm()
4827 CLEAR_MGMT_STATUS(ioc->internal_cmds.status) in mptsas_issue_tm()
4829 mpt_put_msg_frame_hi_pri(mptsasDeviceResetCtx, ioc, mf); in mptsas_issue_tm()
4832 timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done, in mptsas_issue_tm()
4834 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) { in mptsas_issue_tm()
4836 dtmprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_issue_tm()
4837 "TaskMgmt request: TIMED OUT!(mr=%p)\n", ioc->name, mf)); in mptsas_issue_tm()
4838 mpt_free_msg_frame(ioc, mf); in mptsas_issue_tm()
4839 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET) in mptsas_issue_tm()
4845 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_RF_VALID)) { in mptsas_issue_tm()
4847 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_issue_tm()
4848 "TaskMgmt request: failed with no reply\n", ioc->name)); in mptsas_issue_tm()
4853 CLEAR_MGMT_STATUS(ioc->taskmgmt_cmds.status) in mptsas_issue_tm()
4866 MPT_ADAPTER *ioc = fw_event->ioc; in mptsas_broadcast_primitive_work() local
4879 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_broadcast_primitive_work()
4880 "%s - enter\n", ioc->name, __func__)); in mptsas_broadcast_primitive_work()
4882 mutex_lock(&ioc->taskmgmt_cmds.mutex); in mptsas_broadcast_primitive_work()
4883 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) { in mptsas_broadcast_primitive_work()
4884 mutex_unlock(&ioc->taskmgmt_cmds.mutex); in mptsas_broadcast_primitive_work()
4885 mptsas_requeue_fw_event(ioc, fw_event, 1000); in mptsas_broadcast_primitive_work()
4892 mpt_findImVolumes(ioc); in mptsas_broadcast_primitive_work()
4893 pScsiTmReply = (SCSITaskMgmtReply_t *) ioc->taskmgmt_cmds.reply; in mptsas_broadcast_primitive_work()
4895 for (ii = 0; ii < ioc->req_depth; ii++) { in mptsas_broadcast_primitive_work()
4896 if (ioc->fw_events_off) in mptsas_broadcast_primitive_work()
4898 sc = mptscsih_get_scsi_lookup(ioc, ii); in mptsas_broadcast_primitive_work()
4901 mf = MPT_INDEX_2_MFPTR(ioc, ii); in mptsas_broadcast_primitive_work()
4915 if (mptsas_issue_tm(ioc, MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK, in mptsas_broadcast_primitive_work()
4927 if (mptsas_issue_tm(ioc, in mptsas_broadcast_primitive_work()
4936 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_broadcast_primitive_work()
4938 ioc->name, __func__, query_count, termination_count)); in mptsas_broadcast_primitive_work()
4940 ioc->broadcast_aen_busy = 0; in mptsas_broadcast_primitive_work()
4941 mpt_clear_taskmgmt_in_progress_flag(ioc); in mptsas_broadcast_primitive_work()
4942 mutex_unlock(&ioc->taskmgmt_cmds.mutex); in mptsas_broadcast_primitive_work()
4947 ioc->name, __func__, mpt_GetIocState(ioc, 0)); in mptsas_broadcast_primitive_work()
4948 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP); in mptsas_broadcast_primitive_work()
4950 mptsas_free_fw_event(ioc, fw_event); in mptsas_broadcast_primitive_work()
4964 MPT_ADAPTER *ioc; in mptsas_send_ir2_event() local
4970 ioc = fw_event->ioc; in mptsas_send_ir2_event()
4974 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Entering %s: " in mptsas_send_ir2_event()
4975 "ReasonCode=%02x\n", ioc->name, __func__, reasonCode)); in mptsas_send_ir2_event()
4990 mpt_raid_phys_disk_pg0(ioc, in mptsas_send_ir2_event()
4996 mptsas_free_fw_event(ioc, fw_event); in mptsas_send_ir2_event()
4999 mptsas_hotplug_work(ioc, fw_event, &hot_plug_info); in mptsas_send_ir2_event()
5003 mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply) in mptsas_event_process() argument
5010 if (ioc->bus_type != SAS) in mptsas_event_process()
5014 if (ioc->fw_events_off) in mptsas_event_process()
5026 if (ioc->broadcast_aen_busy) in mptsas_event_process()
5028 ioc->broadcast_aen_busy = 1; in mptsas_event_process()
5040 mptsas_target_reset_queue(ioc, sas_event_data); in mptsas_event_process()
5045 ioc->device_missing_delay && in mptsas_event_process()
5053 vtarget = mptsas_find_vtarget(ioc, channel, id); in mptsas_event_process()
5055 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_event_process()
5058 "fw_id %d fw_channel %d\n", ioc->name, in mptsas_event_process()
5062 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_event_process()
5064 ioc->name)); in mptsas_event_process()
5066 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_event_process()
5068 ioc->name)); in mptsas_event_process()
5083 if (ioc->old_sas_discovery_protocal) in mptsas_event_process()
5088 ioc->device_missing_delay) in mptsas_event_process()
5089 delay = HZ * ioc->device_missing_delay; in mptsas_event_process()
5099 ioc->sas_discovery_quiesce_io = discovery_status ? 1 : 0; in mptsas_event_process()
5100 if (ioc->old_sas_discovery_protocal && !discovery_status) in mptsas_event_process()
5101 mptsas_queue_rescan(ioc); in mptsas_event_process()
5118 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", ioc->name, in mptsas_event_process()
5124 fw_event->ioc = ioc; in mptsas_event_process()
5125 mptsas_add_fw_event(ioc, fw_event, delay); in mptsas_event_process()
5131 static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id) in mptsas_volume_delete() argument
5136 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL, id, 0); in mptsas_volume_delete()
5139 if (!ioc->raid_data.pIocPg2) in mptsas_volume_delete()
5141 if (!ioc->raid_data.pIocPg2->NumActiveVolumes) in mptsas_volume_delete()
5143 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) in mptsas_volume_delete()
5144 if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id) in mptsas_volume_delete()
5148 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL, id); in mptsas_volume_delete()
5159 MPT_ADAPTER *ioc; in mptsas_probe() local
5172 ioc = pci_get_drvdata(pdev); in mptsas_probe()
5173 mptsas_fw_event_off(ioc); in mptsas_probe()
5174 ioc->DoneCtx = mptsasDoneCtx; in mptsas_probe()
5175 ioc->TaskCtx = mptsasTaskCtx; in mptsas_probe()
5176 ioc->InternalCtx = mptsasInternalCtx; in mptsas_probe()
5177 ioc->schedule_target_reset = &mptsas_schedule_target_reset; in mptsas_probe()
5178 ioc->schedule_dead_ioc_flush_running_cmds = in mptsas_probe()
5182 if (ioc->last_state != MPI_IOC_STATE_OPERATIONAL) { in mptsas_probe()
5185 ioc->name); in mptsas_probe()
5190 if (!ioc->active) { in mptsas_probe()
5192 ioc->name); in mptsas_probe()
5200 for (ii = 0; ii < ioc->facts.NumberOfPorts; ii++) { in mptsas_probe()
5201 if (ioc->pfacts[ii].ProtocolFlags & in mptsas_probe()
5209 "is NOT enabled!\n", ioc->name, ioc); in mptsas_probe()
5217 ioc->name); in mptsas_probe()
5222 spin_lock_irqsave(&ioc->FreeQlock, flags); in mptsas_probe()
5226 ioc->sh = sh; in mptsas_probe()
5234 sh->can_queue = min_t(int, ioc->req_depth - 10, sh->can_queue); in mptsas_probe()
5241 sh->unique_id = ioc->id; in mptsas_probe()
5243 INIT_LIST_HEAD(&ioc->sas_topology); in mptsas_probe()
5244 mutex_init(&ioc->sas_topology_mutex); in mptsas_probe()
5245 mutex_init(&ioc->sas_discovery_mutex); in mptsas_probe()
5246 mutex_init(&ioc->sas_mgmt.mutex); in mptsas_probe()
5247 init_completion(&ioc->sas_mgmt.done); in mptsas_probe()
5258 scale = ioc->req_sz/ioc->SGE_size; in mptsas_probe()
5259 if (ioc->sg_addr_size == sizeof(u64)) { in mptsas_probe()
5261 (ioc->facts.MaxChainDepth-1) + scale + in mptsas_probe()
5262 (ioc->req_sz - 60) / ioc->SGE_size; in mptsas_probe()
5265 (ioc->facts.MaxChainDepth-1) + scale + in mptsas_probe()
5266 (ioc->req_sz - 64) / ioc->SGE_size; in mptsas_probe()
5271 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_probe()
5273 ioc->name, numSGE, sh->sg_tablesize)); in mptsas_probe()
5282 "Range from 64 to 8192\n", ioc->name, in mptsas_probe()
5286 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT in mptsas_probe()
5288 ioc->name, mpt_loadtime_max_sectors, sh->max_sectors)); in mptsas_probe()
5293 hd->ioc = ioc; in mptsas_probe()
5298 ioc->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC); in mptsas_probe()
5299 if (!ioc->ScsiLookup) { in mptsas_probe()
5301 spin_unlock_irqrestore(&ioc->FreeQlock, flags); in mptsas_probe()
5304 spin_lock_init(&ioc->scsi_lookup_lock); in mptsas_probe()
5306 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n", in mptsas_probe()
5307 ioc->name, ioc->ScsiLookup)); in mptsas_probe()
5309 ioc->sas_data.ptClear = mpt_pt_clear; in mptsas_probe()
5313 INIT_LIST_HEAD(&ioc->sas_device_info_list); in mptsas_probe()
5314 mutex_init(&ioc->sas_device_info_mutex); in mptsas_probe()
5316 spin_unlock_irqrestore(&ioc->FreeQlock, flags); in mptsas_probe()
5318 if (ioc->sas_data.ptClear==1) { in mptsas_probe()
5320 ioc, MPI_SAS_OP_CLEAR_ALL_PERSISTENT); in mptsas_probe()
5323 error = scsi_add_host(sh, &ioc->pcidev->dev); in mptsas_probe()
5325 dprintk(ioc, printk(MYIOC_s_ERR_FMT in mptsas_probe()
5326 "scsi_add_host failed\n", ioc->name)); in mptsas_probe()
5331 if ((ioc->facts.HeaderVersion >> 8) < 0xE) in mptsas_probe()
5332 ioc->old_sas_discovery_protocal = 1; in mptsas_probe()
5333 mptsas_scan_sas_topology(ioc); in mptsas_probe()
5334 mptsas_fw_event_on(ioc); in mptsas_probe()
5346 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); in mptsas_shutdown() local
5348 mptsas_fw_event_off(ioc); in mptsas_shutdown()
5349 mptsas_cleanup_fw_event_q(ioc); in mptsas_shutdown()
5354 MPT_ADAPTER *ioc = pci_get_drvdata(pdev); in mptsas_remove() local
5358 if (!ioc->sh) { in mptsas_remove()
5359 printk(MYIOC_s_INFO_FMT "IOC is in Target mode\n", ioc->name); in mptsas_remove()
5366 mptsas_del_device_components(ioc); in mptsas_remove()
5368 ioc->sas_discovery_ignore_events = 1; in mptsas_remove()
5369 sas_remove_host(ioc->sh); in mptsas_remove()
5371 mutex_lock(&ioc->sas_topology_mutex); in mptsas_remove()
5372 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) { in mptsas_remove()
5375 mptsas_port_delete(ioc, p->phy_info[i].port_details); in mptsas_remove()
5380 mutex_unlock(&ioc->sas_topology_mutex); in mptsas_remove()
5381 ioc->hba_port_info = NULL; in mptsas_remove()