• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/message/fusion/

Lines Matching defs:ioc

107 static inline void mptsas_set_rphy(MPT_ADAPTER *ioc,
110 (MPT_ADAPTER *ioc, u64 sas_address);
111 static int mptsas_sas_device_pg0(MPT_ADAPTER *ioc,
113 static int mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc,
115 static int mptsas_add_end_device(MPT_ADAPTER *ioc,
117 static void mptsas_del_end_device(MPT_ADAPTER *ioc,
121 (MPT_ADAPTER *ioc, u64 sas_address);
122 static void mptsas_expander_delete(MPT_ADAPTER *ioc,
125 static void mptsas_not_responding_devices(MPT_ADAPTER *ioc);
126 static void mptsas_scan_sas_topology(MPT_ADAPTER *ioc);
129 static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id);
130 void mptsas_schedule_target_reset(void *ioc);
132 static void mptsas_print_phy_data(MPT_ADAPTER *ioc,
135 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
136 "---- IO UNIT PAGE 0 ------------\n", ioc->name));
137 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Handle=0x%X\n",
138 ioc->name, le16_to_cpu(phy_data->AttachedDeviceHandle)));
139 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Controller Handle=0x%X\n",
140 ioc->name, le16_to_cpu(phy_data->ControllerDevHandle)));
141 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Port=0x%X\n",
142 ioc->name, phy_data->Port));
143 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Port Flags=0x%X\n",
144 ioc->name, phy_data->PortFlags));
145 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PHY Flags=0x%X\n",
146 ioc->name, phy_data->PhyFlags));
147 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Negotiated Link Rate=0x%X\n",
148 ioc->name, phy_data->NegotiatedLinkRate));
149 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
150 "Controller PHY Device Info=0x%X\n", ioc->name,
152 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DiscoveryStatus=0x%X\n\n",
153 ioc->name, le32_to_cpu(phy_data->DiscoveryStatus)));
156 static void mptsas_print_phy_pg0(MPT_ADAPTER *ioc, SasPhyPage0_t *pg0)
162 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
163 "---- SAS PHY PAGE 0 ------------\n", ioc->name));
164 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
165 "Attached Device Handle=0x%X\n", ioc->name,
167 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SAS Address=0x%llX\n",
168 ioc->name, (unsigned long long)le64_to_cpu(sas_address)));
169 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
170 "Attached PHY Identifier=0x%X\n", ioc->name,
172 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Attached Device Info=0x%X\n",
173 ioc->name, le32_to_cpu(pg0->AttachedDeviceInfo)));
174 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Programmed Link Rate=0x%X\n",
175 ioc->name, pg0->ProgrammedLinkRate));
176 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Change Count=0x%X\n",
177 ioc->name, pg0->ChangeCount));
178 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PHY Info=0x%X\n\n",
179 ioc->name, le32_to_cpu(pg0->PhyInfo)));
182 static void mptsas_print_phy_pg1(MPT_ADAPTER *ioc, SasPhyPage1_t *pg1)
184 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
185 "---- SAS PHY PAGE 1 ------------\n", ioc->name));
186 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Invalid Dword Count=0x%x\n",
187 ioc->name, pg1->InvalidDwordCount));
188 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
189 "Running Disparity Error Count=0x%x\n", ioc->name,
191 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
192 "Loss Dword Synch Count=0x%x\n", ioc->name,
194 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
195 "PHY Reset Problem Count=0x%x\n\n", ioc->name,
199 static void mptsas_print_device_pg0(MPT_ADAPTER *ioc, SasDevicePage0_t *pg0)
205 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
206 "---- SAS DEVICE PAGE 0 ---------\n", ioc->name));
207 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Handle=0x%X\n",
208 ioc->name, le16_to_cpu(pg0->DevHandle)));
209 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Parent Handle=0x%X\n",
210 ioc->name, le16_to_cpu(pg0->ParentDevHandle)));
211 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Enclosure Handle=0x%X\n",
212 ioc->name, le16_to_cpu(pg0->EnclosureHandle)));
213 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Slot=0x%X\n",
214 ioc->name, le16_to_cpu(pg0->Slot)));
215 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SAS Address=0x%llX\n",
216 ioc->name, (unsigned long long)le64_to_cpu(sas_address)));
217 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Target ID=0x%X\n",
218 ioc->name, pg0->TargetID));
219 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Bus=0x%X\n",
220 ioc->name, pg0->Bus));
221 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Parent Phy Num=0x%X\n",
222 ioc->name, pg0->PhyNum));
223 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Access Status=0x%X\n",
224 ioc->name, le16_to_cpu(pg0->AccessStatus)));
225 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Device Info=0x%X\n",
226 ioc->name, le32_to_cpu(pg0->DeviceInfo)));
227 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Flags=0x%X\n",
228 ioc->name, le16_to_cpu(pg0->Flags)));
229 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Physical Port=0x%X\n\n",
230 ioc->name, pg0->PhysicalPort));
233 static void mptsas_print_expander_pg1(MPT_ADAPTER *ioc, SasExpanderPage1_t *pg1)
235 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
236 "---- SAS EXPANDER PAGE 1 ------------\n", ioc->name));
237 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Physical Port=0x%X\n",
238 ioc->name, pg1->PhysicalPort));
239 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PHY Identifier=0x%X\n",
240 ioc->name, pg1->PhyIdentifier));
241 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Negotiated Link Rate=0x%X\n",
242 ioc->name, pg1->NegotiatedLinkRate));
243 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Programmed Link Rate=0x%X\n",
244 ioc->name, pg1->ProgrammedLinkRate));
245 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Hardware Link Rate=0x%X\n",
246 ioc->name, pg1->HwLinkRate));
247 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Owner Device Handle=0x%X\n",
248 ioc->name, le16_to_cpu(pg1->OwnerDevHandle)));
249 dsasprintk(ioc, printk(MYIOC_s_DEBUG_FMT
250 "Attached Device Handle=0x%X\n\n", ioc->name,
256 mptsas_fw_event_off(MPT_ADAPTER *ioc)
260 spin_lock_irqsave(&ioc->fw_event_lock, flags);
261 ioc->fw_events_off = 1;
262 ioc->sas_discovery_quiesce_io = 0;
263 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
269 mptsas_fw_event_on(MPT_ADAPTER *ioc)
273 spin_lock_irqsave(&ioc->fw_event_lock, flags);
274 ioc->fw_events_off = 0;
275 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
280 mptsas_add_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
285 spin_lock_irqsave(&ioc->fw_event_lock, flags);
286 list_add_tail(&fw_event->list, &ioc->fw_event_list);
288 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: add (fw_event=0x%p)\n",
289 ioc->name, __func__, fw_event));
290 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
292 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
297 mptsas_requeue_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
301 spin_lock_irqsave(&ioc->fw_event_lock, flags);
302 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: reschedule task "
303 "(fw_event=0x%p)\n", ioc->name, __func__, fw_event));
305 queue_delayed_work(ioc->fw_event_q, &fw_event->work,
307 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
312 mptsas_free_fw_event(MPT_ADAPTER *ioc, struct fw_event_work *fw_event)
316 spin_lock_irqsave(&ioc->fw_event_lock, flags);
317 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: kfree (fw_event=0x%p)\n",
318 ioc->name, __func__, fw_event));
321 spin_unlock_irqrestore(&ioc->fw_event_lock, flags);
327 mptsas_cleanup_fw_event_q(MPT_ADAPTER *ioc)
331 MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
337 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
339 ioc->name, __func__,
346 if (list_empty(&ioc->fw_event_list) ||
347 !ioc->fw_event_q || in_interrupt())
350 list_for_each_entry_safe(fw_event, next, &ioc->fw_event_list, list) {
352 mptsas_free_fw_event(ioc, fw_event);
360 return ((MPT_SCSI_HOST *)shost->hostdata)->ioc;
366 return ((MPT_SCSI_HOST *)shost->hostdata)->ioc;
375 mptsas_find_portinfo_by_handle(MPT_ADAPTER *ioc, u16 handle)
380 list_for_each_entry(port_info, &ioc->sas_topology, list)
392 * @ioc: Pointer to MPT_ADAPTER structure
399 mptsas_find_portinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
404 if (sas_address >= ioc->hba_port_sas_addr &&
405 sas_address < (ioc->hba_port_sas_addr +
406 ioc->hba_port_num_phy))
407 return ioc->hba_port_info;
409 mutex_lock(&ioc->sas_topology_mutex);
410 list_for_each_entry(port_info, &ioc->sas_topology, list)
418 mutex_unlock(&ioc->sas_topology_mutex);
444 mptsas_port_delete(MPT_ADAPTER *ioc, struct mptsas_portinfo_details * port_details)
456 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: [%p]: num_phys=%02d "
457 "bitmask=0x%016llX\n", ioc->name, __func__, port_details,
465 mptsas_set_rphy(ioc, phy_info, NULL);
481 mptsas_set_rphy(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy)
485 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "sas_rphy_add: rphy=%p\n",
486 ioc->name, rphy));
490 dsaswideprintk(ioc, dev_printk(KERN_DEBUG,
491 &rphy->dev, MYIOC_s_FMT "add:", ioc->name));
492 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "rphy=%p release=%p\n",
493 ioc->name, rphy, rphy->dev.release));
507 mptsas_set_port(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_port *port)
513 dsaswideprintk(ioc, dev_printk(KERN_DEBUG,
514 &port->dev, MYIOC_s_FMT "add:", ioc->name));
515 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "port=%p release=%p\n",
516 ioc->name, port, port->dev.release));
539 * @ioc: Pointer to MPT_ADAPTER structure
547 mptsas_add_device_component(MPT_ADAPTER *ioc, u8 channel, u8 id,
558 mutex_lock(&ioc->sas_device_info_mutex);
559 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
585 list_add_tail(&sas_info->list, &ioc->sas_device_info_list);
590 shost_for_each_device(sdev, ioc->sh) {
600 mutex_unlock(&ioc->sas_device_info_mutex);
606 * @ioc: Pointer to MPT_ADAPTER structure
612 mptsas_add_device_component_by_fw(MPT_ADAPTER *ioc, u8 channel, u8 id)
618 rc = mptsas_sas_device_pg0(ioc, &sas_device,
626 mptsas_sas_enclosure_pg0(ioc, &enclosure_info,
631 mptsas_add_device_component(ioc, sas_device.channel,
638 * @ioc: Pointer to MPT_ADAPTER structure
644 mptsas_add_device_component_starget_ir(MPT_ADAPTER *ioc,
664 if (mpt_config(ioc, &cfg) != 0)
670 buffer = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4,
679 if (mpt_config(ioc, &cfg) != 0)
690 if (mpt_raid_phys_disk_pg0(ioc,
694 mptsas_add_device_component_by_fw(ioc, phys_disk.PhysDiskBus,
697 mutex_lock(&ioc->sas_device_info_mutex);
698 list_for_each_entry(sas_info, &ioc->sas_device_info_list,
707 mutex_unlock(&ioc->sas_device_info_mutex);
714 mutex_lock(&ioc->sas_device_info_mutex);
715 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
731 list_add_tail(&sas_info->list, &ioc->sas_device_info_list);
733 mutex_unlock(&ioc->sas_device_info_mutex);
737 pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer,
743 * @ioc: Pointer to MPT_ADAPTER structure
748 mptsas_add_device_component_starget(MPT_ADAPTER *ioc,
758 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
764 mptsas_sas_enclosure_pg0(ioc, &enclosure_info,
769 mptsas_add_device_component(ioc, phy_info->attached.channel,
777 * @ioc: Pointer to MPT_ADAPTER structure
783 mptsas_del_device_component_by_os(MPT_ADAPTER *ioc, u8 channel, u8 id)
790 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
799 * @ioc: Pointer to MPT_ADAPTER structure
803 mptsas_del_device_components(MPT_ADAPTER *ioc)
807 mutex_lock(&ioc->sas_device_info_mutex);
808 list_for_each_entry_safe(sas_info, next, &ioc->sas_device_info_list,
813 mutex_unlock(&ioc->sas_device_info_mutex);
824 mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
831 mutex_lock(&ioc->sas_topology_mutex);
846 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
848 ioc->name, __func__, port_details, i));
853 devtprintk(ioc, dev_printk(KERN_DEBUG,
855 "delete phy %d, phy-obj (0x%p)\n", ioc->name,
868 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "phy_id=%d sas_address=0x%018llX\n",
869 ioc->name, i, (unsigned long long)sas_address));
887 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tForming port\n\t\t"
889 ioc->name, i, (unsigned long long)sas_address));
904 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
906 ioc->name, j, (unsigned long long)
938 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
940 "bitmask=0x%016llX\n", ioc->name, __func__,
943 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\t\tport = %p rphy=%p\n",
944 ioc->name, port_details->port, port_details->rphy));
946 dsaswideprintk(ioc, printk("\n"));
947 mutex_unlock(&ioc->sas_topology_mutex);
953 * @ioc
959 mptsas_find_vtarget(MPT_ADAPTER *ioc, u8 channel, u8 id)
965 shost_for_each_device(sdev, ioc->sh) {
982 mptsas_queue_device_delete(MPT_ADAPTER *ioc,
993 ioc->name, __func__, __LINE__);
999 fw_event->ioc = ioc;
1000 mptsas_add_fw_event(ioc, fw_event, msecs_to_jiffies(1));
1004 mptsas_queue_rescan(MPT_ADAPTER *ioc)
1013 ioc->name, __func__, __LINE__);
1017 fw_event->ioc = ioc;
1018 mptsas_add_fw_event(ioc, fw_event, msecs_to_jiffies(1));
1027 * @ioc
1036 mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
1040 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0)
1044 mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc);
1046 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
1047 "%s, no msg frames @%d!!\n", ioc->name,
1052 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt request (mf=%p)\n",
1053 ioc->name, mf));
1065 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
1067 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1069 ioc->name, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, channel, id));
1071 mpt_put_msg_frame_hi_pri(mptsasDeviceResetCtx, ioc, mf);
1077 mpt_clear_taskmgmt_in_progress_flag(ioc);
1101 * @ioc
1106 mptsas_target_reset_queue(MPT_ADAPTER *ioc,
1109 MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
1117 vtarget = mptsas_find_vtarget(ioc, channel, id);
1126 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
1128 ioc->name, __func__, __LINE__));
1138 if (mptsas_target_reset(ioc, channel, id)) {
1155 MPT_ADAPTER *ioc = (MPT_ADAPTER *)(iocp);
1156 MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
1175 if (mptsas_target_reset(ioc, channel, id))
1183 * @ioc: Pointer to MPT_ADAPTER structure
1190 mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
1192 MPT_SCSI_HOST *hd = shost_priv(ioc->sh);
1198 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed: "
1199 "(mf = %p, mr = %p)\n", ioc->name, mf, mr));
1203 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1207 "term_cmnds = %d\n", ioc->name,
1216 mptscsih_taskmgmt_response_code(ioc,
1223 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
1224 ioc->taskmgmt_cmds.status |= MPT_MGMT_STATUS_RF_VALID;
1225 memcpy(ioc->taskmgmt_cmds.reply, mr,
1227 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_PENDING) {
1228 ioc->taskmgmt_cmds.status &= ~MPT_MGMT_STATUS_PENDING;
1229 complete(&ioc->taskmgmt_cmds.done);
1235 mpt_clear_taskmgmt_in_progress_flag(ioc);
1243 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1245 ioc->name, jiffies_to_msecs(jiffies -
1256 if (mptsas_target_reset(ioc, channel, id))
1265 if (!ioc->fw_events_off)
1266 mptsas_queue_device_delete(ioc,
1270 ioc->schedule_target_reset(ioc);
1278 * @ioc
1283 mptsas_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
1288 rc = mptscsih_ioc_reset(ioc, reset_phase);
1289 if ((ioc->bus_type != SAS) || (!rc))
1292 hd = shost_priv(ioc->sh);
1293 if (!hd->ioc)
1298 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1299 "%s: MPT_IOC_SETUP_RESET\n", ioc->name, __func__));
1300 mptsas_fw_event_off(ioc);
1303 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1304 "%s: MPT_IOC_PRE_RESET\n", ioc->name, __func__));
1307 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1308 "%s: MPT_IOC_POST_RESET\n", ioc->name, __func__));
1309 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_PENDING) {
1310 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_DID_IOCRESET;
1311 complete(&ioc->sas_mgmt.done);
1313 mptsas_cleanup_fw_event_q(ioc);
1314 mptsas_queue_rescan(ioc);
1339 mptsas_sas_enclosure_pg0(MPT_ADAPTER *ioc, struct mptsas_enclosure *enclosure,
1362 error = mpt_config(ioc, &cfg);
1370 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
1380 error = mpt_config(ioc, &cfg);
1397 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
1405 * @ioc: Pointer to MPT_ADAPTER structure
1412 mptsas_add_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info)
1421 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1422 "%s: exit at line=%d\n", ioc->name,
1430 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1431 "%s: fw_id=%d exit at line=%d\n", ioc->name,
1438 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1439 "%s: fw_id=%d exit at line=%d\n", ioc->name,
1455 " phy %d, sas_addr 0x%llx\n", ioc->name, ds,
1463 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1464 "%s: fw_id=%d exit at line=%d\n", ioc->name,
1471 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1472 "%s: fw_id=%d exit at line=%d\n", ioc->name,
1477 mptsas_set_rphy(ioc, phy_info, rphy);
1483 * @ioc: Pointer to MPT_ADAPTER structure
1488 mptsas_del_end_device(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info)
1506 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1507 "%s: fw_id=%d exit at line=%d\n", ioc->name,
1513 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1514 "%s: fw_id=%d exit at line=%d\n", ioc->name,
1537 "sas_addr 0x%llx\n", ioc->name, ds, phy_info->attached.channel,
1543 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1544 "%s: fw_id=%d exit at line=%d\n", ioc->name,
1558 ioc->name, phy_info_parent->phy_id,
1564 "delete port %d, sas_addr (0x%llx)\n", ioc->name,
1567 mptsas_set_port(ioc, phy_info, NULL);
1568 mptsas_port_delete(ioc, phy_info->port_details);
1572 mptsas_refreshing_device_handles(MPT_ADAPTER *ioc,
1579 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
1586 mutex_lock(&ioc->sas_topology_mutex);
1601 mutex_unlock(&ioc->sas_topology_mutex);
1617 MPT_ADAPTER *ioc = fw_event->ioc;
1621 if (ioc->in_rescan) {
1622 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1624 ioc->name, __func__));
1627 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: rescan after "
1628 "reset\n", ioc->name, __func__));
1629 ioc->in_rescan = 1;
1630 mptsas_not_responding_devices(ioc);
1631 mptsas_scan_sas_topology(ioc);
1632 ioc->in_rescan = 0;
1633 mptsas_free_fw_event(ioc, fw_event);
1634 mptsas_fw_event_on(ioc);
1639 if (ioc->fw_events_off) {
1640 mptsas_free_fw_event(ioc, fw_event);
1644 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s: fw_event=(0x%p), "
1645 "event = (0x%02x)\n", ioc->name, __func__, fw_event,
1659 mptbase_sas_persist_operation(ioc,
1661 mptsas_free_fw_event(ioc, fw_event);
1685 MPT_ADAPTER *ioc = hd->ioc;
1698 mptsas_add_device_component_starget_ir(ioc, scsi_target(sdev));
1704 mptsas_add_device_component_starget(ioc, scsi_target(sdev));
1720 MPT_ADAPTER *ioc = hd->ioc;
1727 vtarget->ioc_id = ioc->id;
1736 if (!ioc->raid_data.pIocPg2) {
1740 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
1741 if (id == ioc->raid_data.pIocPg2->
1743 channel = ioc->raid_data.pIocPg2->
1752 mutex_lock(&ioc->sas_topology_mutex);
1753 list_for_each_entry(p, &ioc->sas_topology, list) {
1765 if (mptscsih_is_phys_disk(ioc, channel, id)) {
1766 id = mptscsih_raid_id_to_num(ioc,
1772 mutex_unlock(&ioc->sas_topology_mutex);
1776 mutex_unlock(&ioc->sas_topology_mutex);
1796 MPT_ADAPTER *ioc = hd->ioc;
1804 mptsas_del_device_component_by_os(ioc, starget->channel,
1812 list_for_each_entry(p, &ioc->sas_topology, list) {
1820 "sas_addr 0x%llx\n", ioc->name,
1847 MPT_ADAPTER *ioc = hd->ioc;
1852 ioc->name, sizeof(VirtDevice));
1862 mutex_lock(&ioc->sas_topology_mutex);
1863 list_for_each_entry(p, &ioc->sas_topology, list) {
1872 if (mptscsih_is_phys_disk(ioc,
1876 mutex_unlock(&ioc->sas_topology_mutex);
1880 mutex_unlock(&ioc->sas_topology_mutex);
1895 MPT_ADAPTER *ioc;
1905 ioc = hd->ioc;
1907 if (ioc->sas_discovery_quiesce_io)
1910 if (ioc->debug_level & MPT_DEBUG_SCSI)
1926 MPT_ADAPTER *ioc;
1937 ioc = hd->ioc;
1938 if (ioc->bus_type != SAS) {
1947 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT ": %s: target removed "
1949 ioc->name, __func__, sc));
1988 MPT_ADAPTER *ioc = phy_to_ioc(phy);
2013 error = mpt_config(ioc, &cfg);
2019 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2027 error = mpt_config(ioc, &cfg);
2031 mptsas_print_phy_pg1(ioc, buffer);
2042 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2047 static int mptsas_mgmt_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
2050 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
2052 ioc->sas_mgmt.status |= MPT_MGMT_STATUS_RF_VALID;
2053 memcpy(ioc->sas_mgmt.reply, reply,
2054 min(ioc->reply_sz, 4 * reply->u.reply.MsgLength));
2057 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_PENDING) {
2058 ioc->sas_mgmt.status &= ~MPT_MGMT_STATUS_PENDING;
2059 complete(&ioc->sas_mgmt.done);
2067 MPT_ADAPTER *ioc = phy_to_ioc(phy);
2082 if (mutex_lock_interruptible(&ioc->sas_mgmt.mutex))
2085 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
2100 INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status)
2101 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
2103 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done,
2105 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
2107 mpt_free_msg_frame(ioc, mf);
2108 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
2111 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
2116 if ((ioc->sas_mgmt.status &
2123 reply = (SasIoUnitControlReply_t *)ioc->sas_mgmt.reply;
2126 ioc->name, __func__, reply->IOCStatus, reply->IOCLogInfo);
2134 CLEAR_MGMT_STATUS(ioc->sas_mgmt.status)
2135 mutex_unlock(&ioc->sas_mgmt.mutex);
2143 MPT_ADAPTER *ioc = rphy_to_ioc(rphy);
2149 mutex_lock(&ioc->sas_topology_mutex);
2150 list_for_each_entry(p, &ioc->sas_topology, list) {
2160 mutex_unlock(&ioc->sas_topology_mutex);
2164 mutex_unlock(&ioc->sas_topology_mutex);
2166 error = mptsas_sas_enclosure_pg0(ioc, &enclosure_info,
2177 MPT_ADAPTER *ioc = rphy_to_ioc(rphy);
2181 mutex_lock(&ioc->sas_topology_mutex);
2182 list_for_each_entry(p, &ioc->sas_topology, list) {
2193 mutex_unlock(&ioc->sas_topology_mutex);
2200 MPT_ADAPTER *ioc = ((MPT_SCSI_HOST *) shost->hostdata)->ioc;
2214 ioc->name, __func__);
2221 ioc->name, __func__, req->bio->bi_vcnt, blk_rq_bytes(req),
2226 ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex);
2230 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
2247 mutex_lock(&ioc->sas_topology_mutex);
2248 port_info = ioc->hba_port_info;
2252 mutex_unlock(&ioc->sas_topology_mutex);
2267 dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio),
2271 ioc->add_sge(psge, flagsLength, dma_addr_out);
2272 psge += ioc->SGE_size;
2282 dma_addr_in = pci_map_single(ioc->pcidev, bio_data(rsp->bio),
2286 ioc->add_sge(psge, flagsLength, dma_addr_in);
2288 INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status)
2289 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
2291 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
2292 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
2294 mpt_free_msg_frame(ioc, mf);
2296 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
2299 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
2304 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) {
2307 smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
2315 ioc->name, __func__);
2320 pci_unmap_single(ioc->pcidev, dma_addr_out, blk_rq_bytes(req),
2323 pci_unmap_single(ioc->pcidev, dma_addr_in, blk_rq_bytes(rsp),
2327 mpt_free_msg_frame(ioc, mf);
2329 CLEAR_MGMT_STATUS(ioc->sas_mgmt.status)
2330 mutex_unlock(&ioc->sas_mgmt.mutex);
2346 mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
2369 error = mpt_config(ioc, &cfg);
2377 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2387 error = mpt_config(ioc, &cfg);
2399 ioc->nvdata_version_persistent =
2401 ioc->nvdata_version_default =
2405 mptsas_print_phy_data(ioc, &buffer->PhyData[i]);
2417 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2424 mptsas_sas_io_unit_pg1(MPT_ADAPTER *ioc)
2444 error = mpt_config(ioc, &cfg);
2452 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2462 error = mpt_config(ioc, &cfg);
2466 ioc->io_missing_delay =
2469 ioc->device_missing_delay = (device_missing_delay & MPI_SAS_IOUNIT1_REPORT_MISSING_UNIT_16) ?
2474 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2481 mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
2507 error = mpt_config(ioc, &cfg);
2516 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2526 error = mpt_config(ioc, &cfg);
2530 mptsas_print_phy_pg0(ioc, buffer);
2538 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2545 mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
2571 error = mpt_config(ioc, &cfg);
2579 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2589 error = mpt_config(ioc, &cfg);
2599 mptsas_print_device_pg0(ioc, buffer);
2619 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2626 mptsas_sas_expander_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info,
2653 error = mpt_config(ioc, &cfg);
2662 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2672 error = mpt_config(ioc, &cfg);
2702 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2709 mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
2733 error = mpt_config(ioc, &cfg);
2742 buffer = pci_alloc_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2752 error = mpt_config(ioc, &cfg);
2763 mptsas_print_expander_pg1(ioc, buffer);
2775 pci_free_consistent(ioc->pcidev, hdr.ExtPageLength * 4,
2810 * @ioc: per adapter object
2819 mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc,
2836 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
2837 if (ioc->ioc_reset_in_progress) {
2838 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
2840 __func__, ioc->name);
2843 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
2845 ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex);
2849 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
2860 data_out = pci_alloc_consistent(ioc->pcidev, sz, &data_out_dma);
2889 ioc->add_sge(psge, flagsLength, data_out_dma);
2890 psge += ioc->SGE_size;
2898 ioc->add_sge(psge, flagsLength, data_out_dma +
2901 INITIALIZE_MGMT_STATUS(ioc->sas_mgmt.status)
2902 mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
2904 timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
2905 if (!(ioc->sas_mgmt.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
2907 mpt_free_msg_frame(ioc, mf);
2909 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_DID_IOCRESET)
2912 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
2918 if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) {
2921 smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
2946 ioc->name, __func__);
2951 pci_free_consistent(ioc->pcidev, sz, data_out, data_out_dma);
2954 mpt_free_msg_frame(ioc, mf);
2956 CLEAR_MGMT_STATUS(ioc->sas_mgmt.status)
2957 mutex_unlock(&ioc->sas_mgmt.mutex);
3024 MPT_ADAPTER *ioc;
3142 ioc = phy_to_ioc(phy_info->phy);
3154 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
3155 "%s: exit at line=%d\n", ioc->name,
3159 mptsas_set_port(ioc, phy_info, port);
3160 devtprintk(ioc, dev_printk(KERN_DEBUG, &port->dev,
3162 ioc->name, port->port_identifier,
3166 dsaswideprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3168 ioc->name, phy_info->phy_id));
3171 devtprintk(ioc, dev_printk(KERN_DEBUG, &phy_info->phy->dev,
3172 MYIOC_s_FMT "add phy %d, phy-obj (0x%p)\n", ioc->name,
3197 port_info = ioc->hba_port_info;
3228 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
3229 "%s: exit at line=%d\n", ioc->name,
3237 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
3238 "%s: exit at line=%d\n", ioc->name,
3243 mptsas_set_rphy(ioc, phy_info, rphy);
3246 mptsas_exp_repmanufacture_info(ioc,
3253 vtarget = mptsas_find_vtarget(ioc,
3266 mptsas_probe_hba_phys(MPT_ADAPTER *ioc)
3275 error = mptsas_sas_io_unit_pg0(ioc, hba);
3279 mptsas_sas_io_unit_pg1(ioc);
3280 mutex_lock(&ioc->sas_topology_mutex);
3281 port_info = ioc->hba_port_info;
3283 ioc->hba_port_info = port_info = hba;
3284 ioc->hba_port_num_phy = port_info->num_phys;
3285 list_add_tail(&port_info->list, &ioc->sas_topology);
3299 mutex_unlock(&ioc->sas_topology_mutex);
3301 ioc->num_ports = port_info->num_phys;
3304 mptsas_sas_phy_pg0(ioc, &port_info->phy_info[i],
3309 mptsas_sas_device_pg0(ioc, &port_info->phy_info[i].identify,
3313 if (!ioc->hba_port_sas_addr)
3314 ioc->hba_port_sas_addr =
3319 mptsas_sas_device_pg0(ioc,
3326 mptsas_setup_wide_ports(ioc, port_info);
3328 for (i = 0; i < port_info->num_phys; i++, ioc->sas_index++)
3329 mptsas_probe_one_phy(&ioc->sh->shost_gendev,
3330 &port_info->phy_info[i], ioc->sas_index, 1);
3341 mptsas_expander_refresh(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
3353 mptsas_sas_expander_pg1(ioc, &port_info->phy_info[i],
3357 mptsas_sas_device_pg0(ioc,
3366 mptsas_sas_device_pg0(ioc,
3376 mutex_lock(&ioc->sas_topology_mutex);
3377 parent = mptsas_find_portinfo_by_handle(ioc,
3380 mutex_unlock(&ioc->sas_topology_mutex);
3390 mutex_unlock(&ioc->sas_topology_mutex);
3392 mptsas_setup_wide_ports(ioc, port_info);
3393 for (i = 0; i < port_info->num_phys; i++, ioc->sas_index++)
3395 ioc->sas_index, 0);
3399 mptsas_expander_event_add(MPT_ADAPTER *ioc,
3426 mutex_lock(&ioc->sas_topology_mutex);
3427 list_add_tail(&port_info->list, &ioc->sas_topology);
3428 mutex_unlock(&ioc->sas_topology_mutex);
3431 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys,
3434 mptsas_expander_refresh(ioc, port_info);
3439 * @ioc: Pointer to MPT_ADAPTER structure
3444 mptsas_delete_expander_siblings(MPT_ADAPTER *ioc, struct mptsas_portinfo
3458 mptsas_del_end_device(ioc, phy_info);
3470 port_info = mptsas_find_portinfo_by_sas_address(ioc,
3480 mptsas_expander_delete(ioc, port_info, 1);
3488 * @ioc: Pointer to MPT_ADAPTER structure
3494 static void mptsas_expander_delete(MPT_ADAPTER *ioc,
3510 mptsas_sas_expander_pg0(ioc, &buffer,
3528 parent = mptsas_find_portinfo_by_handle(ioc,
3530 mptsas_delete_expander_siblings(ioc, parent, port_info);
3551 MYIOC_s_FMT "delete phy %d, phy-obj (0x%p)\n", ioc->name,
3558 ioc->name, port->port_identifier,
3561 mptsas_port_delete(ioc, port_details);
3566 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys,
3580 * @ioc: Pointer to MPT_ADAPTER structure
3590 MPT_ADAPTER *ioc;
3596 ioc = fw_event->ioc;
3601 port_info = mptsas_find_portinfo_by_sas_address(ioc, sas_address);
3614 mptsas_expander_refresh(ioc, port_info);
3616 mptsas_expander_event_add(ioc, expander_data);
3619 mptsas_expander_delete(ioc, port_info, 0);
3621 mptsas_free_fw_event(ioc, fw_event);
3627 * @ioc: Pointer to MPT_ADAPTER structure
3632 mptsas_expander_add(MPT_ADAPTER *ioc, u16 handle)
3637 if ((mptsas_sas_expander_pg0(ioc, &buffer,
3644 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
3645 "%s: exit at line=%d\n", ioc->name,
3653 mutex_lock(&ioc->sas_topology_mutex);
3654 list_add_tail(&port_info->list, &ioc->sas_topology);
3655 mutex_unlock(&ioc->sas_topology_mutex);
3657 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys,
3659 mptsas_expander_refresh(ioc, port_info);
3666 MPT_ADAPTER *ioc;
3674 ioc = fw_event->ioc;
3682 port_info = mptsas_find_portinfo_by_sas_address(ioc, sas_address);
3693 if (ioc->old_sas_discovery_protocal) {
3694 port_info = mptsas_expander_add(ioc,
3702 if (port_info == ioc->hba_port_info)
3703 mptsas_probe_hba_phys(ioc);
3705 mptsas_expander_refresh(ioc, port_info);
3717 if (ioc->device_missing_delay &&
3724 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3726 ioc->name, phy_info->attached.id,
3729 shost_for_each_device(sdev, ioc->sh) {
3741 devtprintk(ioc,
3744 "%d\n", ioc->name,
3752 mptsas_free_fw_event(ioc, fw_event);
3756 mptsas_not_responding_devices(MPT_ADAPTER *ioc)
3768 mpt_findImVolumes(ioc);
3770 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
3771 if (ioc->ioc_reset_in_progress) {
3772 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3773 "%s: exiting due to a parallel reset \n", ioc->name,
3775 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
3778 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
3781 mutex_lock(&ioc->sas_device_info_mutex);
3783 list_for_each_entry(sas_info, &ioc->sas_device_info_list, list) {
3790 retval = mptsas_sas_device_pg0(ioc, &sas_device,
3799 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
3800 if (ioc->ioc_reset_in_progress) {
3801 dfailprintk(ioc,
3804 ioc->name, __func__));
3806 (&ioc->taskmgmt_lock, flags);
3807 mutex_unlock(&ioc->
3811 spin_unlock_irqrestore(&ioc->taskmgmt_lock,
3820 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3823 ioc->name, __func__,
3829 vtarget = mptsas_find_vtarget(ioc,
3835 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
3839 mptsas_del_end_device(ioc, phy_info);
3843 mptsas_volume_delete(ioc, sas_info->fw.id);
3845 mutex_unlock(&ioc->sas_device_info_mutex);
3848 mutex_lock(&ioc->sas_topology_mutex);
3850 list_for_each_entry(port_info, &ioc->sas_topology, list) {
3858 while (!mptsas_sas_expander_pg0(ioc, &buffer,
3872 mptsas_expander_delete(ioc, port_info, 0);
3876 mutex_unlock(&ioc->sas_topology_mutex);
3881 * @ioc: Pointer to MPT_ADAPTER structure
3885 mptsas_probe_expanders(MPT_ADAPTER *ioc)
3892 while (!mptsas_sas_expander_pg0(ioc, &buffer,
3897 port_info = mptsas_find_portinfo_by_sas_address(ioc,
3907 mptsas_expander_refresh(ioc, port_info);
3914 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
3915 "%s: exit at line=%d\n", ioc->name,
3923 mutex_lock(&ioc->sas_topology_mutex);
3924 list_add_tail(&port_info->list, &ioc->sas_topology);
3925 mutex_unlock(&ioc->sas_topology_mutex);
3927 "sas_addr (0x%llx)\n", ioc->name, port_info->num_phys,
3929 mptsas_expander_refresh(ioc, port_info);
3934 mptsas_probe_devices(MPT_ADAPTER *ioc)
3941 while (!(mptsas_sas_device_pg0(ioc, &sas_device,
3959 phy_info = mptsas_refreshing_device_handles(ioc, &sas_device);
3966 mptsas_add_end_device(ioc, phy_info);
3972 * @ioc: Pointer to MPT_ADAPTER structure
3977 mptsas_scan_sas_topology(MPT_ADAPTER *ioc)
3982 mptsas_probe_hba_phys(ioc);
3983 mptsas_probe_expanders(ioc);
3984 mptsas_probe_devices(ioc);
3989 if (!ioc->ir_firmware || !ioc->raid_data.pIocPg2 ||
3990 !ioc->raid_data.pIocPg2->NumActiveVolumes)
3992 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
3993 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
3994 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0);
4000 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL,
4001 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID);
4002 scsi_add_device(ioc->sh, MPTSAS_RAID_CHANNEL,
4003 ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID, 0);
4011 MPT_ADAPTER *ioc;
4022 ioc = fw_event->ioc;
4029 mutex_lock(&ioc->sas_device_info_mutex);
4030 if (mptscsih_is_phys_disk(ioc, fw_channel, fw_id)) {
4031 list_for_each_entry(sas_info, &ioc->sas_device_info_list,
4045 list_for_each_entry(sas_info, &ioc->sas_device_info_list,
4062 mutex_unlock(&ioc->sas_device_info_mutex);
4065 shost_for_each_device(sdev, ioc->sh) {
4092 mptsas_free_fw_event(ioc, fw_event);
4097 mptsas_find_phyinfo_by_sas_address(MPT_ADAPTER *ioc, u64 sas_address)
4103 mutex_lock(&ioc->sas_topology_mutex);
4104 list_for_each_entry(port_info, &ioc->sas_topology, list) {
4116 mutex_unlock(&ioc->sas_topology_mutex);
4122 * @ioc: Pointer to MPT_ADAPTER structure
4129 mptsas_find_phyinfo_by_phys_disk_num(MPT_ADAPTER *ioc, u8 phys_disk_num,
4140 if (!ioc->raid_data.pIocPg3)
4143 num_paths = mpt_raid_phys_disk_get_num_paths(ioc, phys_disk_num);
4150 mpt_raid_phys_disk_pg1(ioc, phys_disk_num, phys_disk);
4159 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
4174 mutex_lock(&ioc->sas_topology_mutex);
4175 list_for_each_entry(port_info, &ioc->sas_topology, list) {
4190 mutex_unlock(&ioc->sas_topology_mutex);
4211 mptsas_adding_inactive_raid_components(MPT_ADAPTER *ioc, u8 channel, u8 id)
4230 if (mpt_config(ioc, &cfg) != 0)
4236 buffer = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4,
4245 if (mpt_config(ioc, &cfg) != 0)
4257 if (mpt_raid_phys_disk_pg0(ioc,
4261 if (mptsas_sas_device_pg0(ioc, &sas_device,
4276 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
4278 mptsas_add_end_device(ioc, phy_info);
4283 pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, buffer,
4290 mptsas_hotplug_work(MPT_ADAPTER *ioc, struct fw_event_work *fw_event,
4304 if (!ioc->raid_data.pIocPg2)
4307 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++) {
4308 if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID ==
4312 "volume_id\n", ioc->name);
4313 mptsas_free_fw_event(ioc, fw_event);
4317 mpt_findImVolumes(ioc);
4321 mptsas_sas_device_pg0(ioc, &sas_device,
4337 phy_info = mptsas_refreshing_device_handles(ioc, &sas_device);
4341 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4343 "parent handle of device %x\n", ioc->name,
4345 port_info = mptsas_find_portinfo_by_handle(ioc,
4348 if (port_info == ioc->hba_port_info)
4349 mptsas_probe_hba_phys(ioc);
4351 mptsas_expander_refresh(ioc, port_info);
4353 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4355 ioc->name, __func__, __LINE__));
4359 (ioc, &sas_device);
4363 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4365 ioc->name, __func__, __LINE__));
4372 mptsas_add_end_device(ioc, phy_info);
4376 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
4378 mptsas_del_end_device(ioc, phy_info);
4383 mpt_findImVolumes(ioc);
4386 ioc, hot_plug_info->phys_disk_num,
4389 mptsas_del_end_device(ioc, phy_info);
4394 if (mptsas_sas_device_pg0(ioc, &sas_device,
4398 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4399 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4412 ioc, sas_device.sas_address);
4415 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4416 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4423 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4424 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4431 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4432 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4437 mpt_findImVolumes(ioc);
4441 ioc->name, hot_plug_info->channel, hot_plug_info->id,
4453 if (mptsas_sas_device_pg0(ioc, &sas_device,
4457 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4459 ioc->name, __func__,
4471 phy_info = mptsas_find_phyinfo_by_sas_address(ioc,
4474 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4475 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4482 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4483 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4490 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4491 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4497 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
4498 "%s: fw_id=%d exit at line=%d\n", ioc->name,
4503 mpt_findImVolumes(ioc);
4507 ioc->name, hot_plug_info->channel, hot_plug_info->id,
4515 mptsas_add_device_component_by_fw(ioc,
4521 mpt_findImVolumes(ioc);
4523 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL,
4525 scsi_add_device(ioc->sh, MPTSAS_RAID_CHANNEL,
4531 mpt_findImVolumes(ioc);
4533 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL,
4541 mpt_findImVolumes(ioc);
4542 mptsas_adding_inactive_raid_components(ioc,
4550 mptsas_free_fw_event(ioc, fw_event);
4556 MPT_ADAPTER *ioc;
4562 ioc = fw_event->ioc;
4571 mptsas_free_fw_event(ioc, fw_event);
4577 mptbase_sas_persist_operation(ioc,
4579 mptsas_free_fw_event(ioc, fw_event);
4600 mptsas_hotplug_work(ioc, fw_event, &hot_plug_info);
4604 mptbase_sas_persist_operation(ioc,
4606 mptsas_free_fw_event(ioc, fw_event);
4614 mptsas_free_fw_event(ioc, fw_event);
4622 MPT_ADAPTER *ioc;
4631 ioc = fw_event->ioc;
4645 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
4652 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Entering %s: "
4653 "ReasonCode=%02x\n", ioc->name, __func__,
4667 mpt_raid_phys_disk_pg0(ioc,
4730 mptsas_hotplug_work(ioc, fw_event, &hot_plug_info);
4732 mptsas_free_fw_event(ioc, fw_event);
4737 * @ioc: Pointer to MPT_ADAPTER structure
4749 mptsas_issue_tm(MPT_ADAPTER *ioc, u8 type, u8 channel, u8 id, u64 lun,
4758 mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc);
4761 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "TaskMgmt request: no "
4762 "msg frames!!\n", ioc->name));
4766 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt request: mr = %p, "
4768 "fw_id = %d, lun = %lld,\n\t task_context = 0x%x\n", ioc->name, mf,
4785 INITIALIZE_MGMT_STATUS(ioc->taskmgmt_cmds.status)
4786 CLEAR_MGMT_STATUS(ioc->internal_cmds.status)
4788 mpt_put_msg_frame_hi_pri(mptsasDeviceResetCtx, ioc, mf);
4791 timeleft = wait_for_completion_timeout(&ioc->taskmgmt_cmds.done,
4793 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_COMMAND_GOOD)) {
4795 dtmprintk(ioc, printk(MYIOC_s_ERR_FMT
4796 "TaskMgmt request: TIMED OUT!(mr=%p)\n", ioc->name, mf));
4797 mpt_free_msg_frame(ioc, mf);
4798 if (ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_DID_IOCRESET)
4804 if (!(ioc->taskmgmt_cmds.status & MPT_MGMT_STATUS_RF_VALID)) {
4806 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4807 "TaskMgmt request: failed with no reply\n", ioc->name));
4812 CLEAR_MGMT_STATUS(ioc->taskmgmt_cmds.status)
4825 MPT_ADAPTER *ioc = fw_event->ioc;
4838 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4839 "%s - enter\n", ioc->name, __func__));
4841 mutex_lock(&ioc->taskmgmt_cmds.mutex);
4842 if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0) {
4843 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
4844 mptsas_requeue_fw_event(ioc, fw_event, 1000);
4851 mpt_findImVolumes(ioc);
4852 pScsiTmReply = (SCSITaskMgmtReply_t *) ioc->taskmgmt_cmds.reply;
4854 for (ii = 0; ii < ioc->req_depth; ii++) {
4855 if (ioc->fw_events_off)
4857 sc = mptscsih_get_scsi_lookup(ioc, ii);
4860 mf = MPT_INDEX_2_MFPTR(ioc, ii);
4874 if (mptsas_issue_tm(ioc, MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK,
4886 if (mptsas_issue_tm(ioc,
4895 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4897 ioc->name, __func__, query_count, termination_count));
4899 ioc->broadcast_aen_busy = 0;
4900 mpt_clear_taskmgmt_in_progress_flag(ioc);
4901 mutex_unlock(&ioc->taskmgmt_cmds.mutex);
4906 ioc->name, __func__, mpt_GetIocState(ioc, 0));
4907 mpt_Soft_Hard_ResetHandler(ioc, CAN_SLEEP);
4909 mptsas_free_fw_event(ioc, fw_event);
4916 * @ioc: Pointer to MPT_ADAPTER structure
4923 MPT_ADAPTER *ioc;
4929 ioc = fw_event->ioc;
4933 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Entering %s: "
4934 "ReasonCode=%02x\n", ioc->name, __func__, reasonCode));
4949 mpt_raid_phys_disk_pg0(ioc,
4955 mptsas_free_fw_event(ioc, fw_event);
4958 mptsas_hotplug_work(ioc, fw_event, &hot_plug_info);
4962 mptsas_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *reply)
4969 if (ioc->bus_type != SAS)
4973 if (ioc->fw_events_off)
4985 if (ioc->broadcast_aen_busy)
4987 ioc->broadcast_aen_busy = 1;
4999 mptsas_target_reset_queue(ioc, sas_event_data);
5004 ioc->device_missing_delay &&
5013 vtarget = mptsas_find_vtarget(ioc, channel, id);
5015 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5018 "fw_id %d fw_channel %d\n", ioc->name,
5021 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5023 ioc->name));
5025 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5027 ioc->name));
5042 if (ioc->old_sas_discovery_protocal)
5047 ioc->device_missing_delay)
5048 delay = HZ * ioc->device_missing_delay;
5058 ioc->sas_discovery_quiesce_io = discovery_status ? 1 : 0;
5059 if (ioc->old_sas_discovery_protocal && !discovery_status)
5060 mptsas_queue_rescan(ioc);
5078 printk(MYIOC_s_WARN_FMT "%s: failed at (line=%d)\n", ioc->name,
5084 fw_event->ioc = ioc;
5085 mptsas_add_fw_event(ioc, fw_event, delay);
5089 /* Delete a volume when no longer listed in ioc pg2
5091 static void mptsas_volume_delete(MPT_ADAPTER *ioc, u8 id)
5096 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL, id, 0);
5099 if (!ioc->raid_data.pIocPg2)
5101 if (!ioc->raid_data.pIocPg2->NumActiveVolumes)
5103 for (i = 0; i < ioc->raid_data.pIocPg2->NumActiveVolumes; i++)
5104 if (ioc->raid_data.pIocPg2->RaidVolume[i].VolumeID == id)
5108 "id %d\n", ioc->name, MPTSAS_RAID_CHANNEL, id);
5119 MPT_ADAPTER *ioc;
5132 ioc = pci_get_drvdata(pdev);
5133 mptsas_fw_event_off(ioc);
5134 ioc->DoneCtx = mptsasDoneCtx;
5135 ioc->TaskCtx = mptsasTaskCtx;
5136 ioc->InternalCtx = mptsasInternalCtx;
5137 ioc->schedule_target_reset = &mptsas_schedule_target_reset;
5140 if (ioc->last_state != MPI_IOC_STATE_OPERATIONAL) {
5143 ioc->name);
5148 if (!ioc->active) {
5150 ioc->name);
5158 for (ii = 0; ii < ioc->facts.NumberOfPorts; ii++) {
5159 if (ioc->pfacts[ii].ProtocolFlags &
5166 "Skipping ioc=%p because SCSI Initiator mode "
5167 "is NOT enabled!\n", ioc->name, ioc);
5175 ioc->name);
5180 spin_lock_irqsave(&ioc->FreeQlock, flags);
5184 ioc->sh = sh;
5192 sh->can_queue = min_t(int, ioc->req_depth - 10, sh->can_queue);
5199 sh->unique_id = ioc->id;
5201 INIT_LIST_HEAD(&ioc->sas_topology);
5202 mutex_init(&ioc->sas_topology_mutex);
5203 mutex_init(&ioc->sas_discovery_mutex);
5204 mutex_init(&ioc->sas_mgmt.mutex);
5205 init_completion(&ioc->sas_mgmt.done);
5216 scale = ioc->req_sz/ioc->SGE_size;
5217 if (ioc->sg_addr_size == sizeof(u64)) {
5219 (ioc->facts.MaxChainDepth-1) + scale +
5220 (ioc->req_sz - 60) / ioc->SGE_size;
5223 (ioc->facts.MaxChainDepth-1) + scale +
5224 (ioc->req_sz - 64) / ioc->SGE_size;
5229 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5231 ioc->name, numSGE, sh->sg_tablesize));
5236 hd->ioc = ioc;
5241 ioc->ScsiLookup = kcalloc(ioc->req_depth, sizeof(void *), GFP_ATOMIC);
5242 if (!ioc->ScsiLookup) {
5244 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
5247 spin_lock_init(&ioc->scsi_lookup_lock);
5249 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
5250 ioc->name, ioc->ScsiLookup));
5252 ioc->sas_data.ptClear = mpt_pt_clear;
5256 INIT_LIST_HEAD(&ioc->sas_device_info_list);
5257 mutex_init(&ioc->sas_device_info_mutex);
5259 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
5261 if (ioc->sas_data.ptClear==1) {
5263 ioc, MPI_SAS_OP_CLEAR_ALL_PERSISTENT);
5266 error = scsi_add_host(sh, &ioc->pcidev->dev);
5268 dprintk(ioc, printk(MYIOC_s_ERR_FMT
5269 "scsi_add_host failed\n", ioc->name));
5274 if ((ioc->facts.HeaderVersion >> 8) < 0xE)
5275 ioc->old_sas_discovery_protocal = 1;
5276 mptsas_scan_sas_topology(ioc);
5277 mptsas_fw_event_on(ioc);
5289 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
5291 mptsas_fw_event_off(ioc);
5292 mptsas_cleanup_fw_event_q(ioc);
5297 MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
5301 if (!ioc->sh) {
5302 printk(MYIOC_s_INFO_FMT "IOC is in Target mode\n", ioc->name);
5309 mptsas_del_device_components(ioc);
5311 ioc->sas_discovery_ignore_events = 1;
5312 sas_remove_host(ioc->sh);
5314 mutex_lock(&ioc->sas_topology_mutex);
5315 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) {
5318 mptsas_port_delete(ioc, p->phy_info[i].port_details);
5323 mutex_unlock(&ioc->sas_topology_mutex);
5324 ioc->hba_port_info = NULL;