Lines Matching +full:t +full:- +full:phy

2  * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver
4 * Copyright (c) 2008-2009 USI Co., Ltd.
18 * 3. Neither the names of the above-listed copyright holders nor the names
48 * read_main_config_table - read the configure table and save it.
53 void __iomem *address = pm8001_ha->main_cfg_tbl_addr; in read_main_config_table()
54 pm8001_ha->main_cfg_tbl.pm8001_tbl.signature = in read_main_config_table()
56 pm8001_ha->main_cfg_tbl.pm8001_tbl.interface_rev = in read_main_config_table()
58 pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev = in read_main_config_table()
60 pm8001_ha->main_cfg_tbl.pm8001_tbl.max_out_io = in read_main_config_table()
62 pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl = in read_main_config_table()
64 pm8001_ha->main_cfg_tbl.pm8001_tbl.ctrl_cap_flag = in read_main_config_table()
66 pm8001_ha->main_cfg_tbl.pm8001_tbl.gst_offset = in read_main_config_table()
68 pm8001_ha->main_cfg_tbl.pm8001_tbl.inbound_queue_offset = in read_main_config_table()
70 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_queue_offset = in read_main_config_table()
72 pm8001_ha->main_cfg_tbl.pm8001_tbl.hda_mode_flag = in read_main_config_table()
76 pm8001_ha->main_cfg_tbl.pm8001_tbl.anolog_setup_table_offset = in read_main_config_table()
80 pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_dump_offset0 = in read_main_config_table()
82 pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_dump_length0 = in read_main_config_table()
84 pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_dump_offset1 = in read_main_config_table()
86 pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_dump_length1 = in read_main_config_table()
91 * read_general_status_table - read the general status table and save it.
96 void __iomem *address = pm8001_ha->general_stat_tbl_addr; in read_general_status_table()
97 pm8001_ha->gs_tbl.pm8001_tbl.gst_len_mpistate = in read_general_status_table()
99 pm8001_ha->gs_tbl.pm8001_tbl.iq_freeze_state0 = in read_general_status_table()
101 pm8001_ha->gs_tbl.pm8001_tbl.iq_freeze_state1 = in read_general_status_table()
103 pm8001_ha->gs_tbl.pm8001_tbl.msgu_tcnt = in read_general_status_table()
105 pm8001_ha->gs_tbl.pm8001_tbl.iop_tcnt = in read_general_status_table()
107 pm8001_ha->gs_tbl.pm8001_tbl.rsvd = in read_general_status_table()
109 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[0] = in read_general_status_table()
111 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[1] = in read_general_status_table()
113 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[2] = in read_general_status_table()
115 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[3] = in read_general_status_table()
117 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[4] = in read_general_status_table()
119 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[5] = in read_general_status_table()
121 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[6] = in read_general_status_table()
123 pm8001_ha->gs_tbl.pm8001_tbl.phy_state[7] = in read_general_status_table()
125 pm8001_ha->gs_tbl.pm8001_tbl.gpio_input_val = in read_general_status_table()
127 pm8001_ha->gs_tbl.pm8001_tbl.rsvd1[0] = in read_general_status_table()
129 pm8001_ha->gs_tbl.pm8001_tbl.rsvd1[1] = in read_general_status_table()
131 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[0] = in read_general_status_table()
133 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[1] = in read_general_status_table()
135 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[2] = in read_general_status_table()
137 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[3] = in read_general_status_table()
139 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[4] = in read_general_status_table()
141 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[5] = in read_general_status_table()
143 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[6] = in read_general_status_table()
145 pm8001_ha->gs_tbl.pm8001_tbl.recover_err_info[7] = in read_general_status_table()
150 * read_inbnd_queue_table - read the inbound queue table and save it.
156 void __iomem *address = pm8001_ha->inbnd_q_tbl_addr; in read_inbnd_queue_table()
159 pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = in read_inbnd_queue_table()
161 pm8001_ha->inbnd_q_tbl[i].pi_offset = in read_inbnd_queue_table()
167 * read_outbnd_queue_table - read the outbound queue table and save it.
173 void __iomem *address = pm8001_ha->outbnd_q_tbl_addr; in read_outbnd_queue_table()
176 pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = in read_outbnd_queue_table()
178 pm8001_ha->outbnd_q_tbl[i].ci_offset = in read_outbnd_queue_table()
184 * init_default_table_values - init the default table.
191 void __iomem *addressib = pm8001_ha->inbnd_q_tbl_addr; in init_default_table_values()
192 void __iomem *addressob = pm8001_ha->outbnd_q_tbl_addr; in init_default_table_values()
193 u32 ib_offset = pm8001_ha->ib_offset; in init_default_table_values()
194 u32 ob_offset = pm8001_ha->ob_offset; in init_default_table_values()
195 u32 ci_offset = pm8001_ha->ci_offset; in init_default_table_values()
196 u32 pi_offset = pm8001_ha->pi_offset; in init_default_table_values()
198 pm8001_ha->main_cfg_tbl.pm8001_tbl.inbound_q_nppd_hppd = 0; in init_default_table_values()
199 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_hw_event_pid0_3 = 0; in init_default_table_values()
200 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_hw_event_pid4_7 = 0; in init_default_table_values()
201 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_ncq_event_pid0_3 = 0; in init_default_table_values()
202 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_ncq_event_pid4_7 = 0; in init_default_table_values()
203 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_tgt_ITNexus_event_pid0_3 = in init_default_table_values()
205 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_tgt_ITNexus_event_pid4_7 = in init_default_table_values()
207 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_tgt_ssp_event_pid0_3 = 0; in init_default_table_values()
208 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_tgt_ssp_event_pid4_7 = 0; in init_default_table_values()
209 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_tgt_smp_event_pid0_3 = 0; in init_default_table_values()
210 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_tgt_smp_event_pid4_7 = 0; in init_default_table_values()
212 pm8001_ha->main_cfg_tbl.pm8001_tbl.upper_event_log_addr = in init_default_table_values()
213 pm8001_ha->memoryMap.region[AAP1].phys_addr_hi; in init_default_table_values()
214 pm8001_ha->main_cfg_tbl.pm8001_tbl.lower_event_log_addr = in init_default_table_values()
215 pm8001_ha->memoryMap.region[AAP1].phys_addr_lo; in init_default_table_values()
216 pm8001_ha->main_cfg_tbl.pm8001_tbl.event_log_size = in init_default_table_values()
218 pm8001_ha->main_cfg_tbl.pm8001_tbl.event_log_option = 0x01; in init_default_table_values()
219 pm8001_ha->main_cfg_tbl.pm8001_tbl.upper_iop_event_log_addr = in init_default_table_values()
220 pm8001_ha->memoryMap.region[IOP].phys_addr_hi; in init_default_table_values()
221 pm8001_ha->main_cfg_tbl.pm8001_tbl.lower_iop_event_log_addr = in init_default_table_values()
222 pm8001_ha->memoryMap.region[IOP].phys_addr_lo; in init_default_table_values()
223 pm8001_ha->main_cfg_tbl.pm8001_tbl.iop_event_log_size = in init_default_table_values()
225 pm8001_ha->main_cfg_tbl.pm8001_tbl.iop_event_log_option = 0x01; in init_default_table_values()
226 pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_interrupt = 0x01; in init_default_table_values()
227 for (i = 0; i < pm8001_ha->max_q_num; i++) { in init_default_table_values()
228 pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt = in init_default_table_values()
229 PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x00<<30); in init_default_table_values()
230 pm8001_ha->inbnd_q_tbl[i].upper_base_addr = in init_default_table_values()
231 pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_hi; in init_default_table_values()
232 pm8001_ha->inbnd_q_tbl[i].lower_base_addr = in init_default_table_values()
233 pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_lo; in init_default_table_values()
234 pm8001_ha->inbnd_q_tbl[i].base_virt = in init_default_table_values()
235 (u8 *)pm8001_ha->memoryMap.region[ib_offset + i].virt_ptr; in init_default_table_values()
236 pm8001_ha->inbnd_q_tbl[i].total_length = in init_default_table_values()
237 pm8001_ha->memoryMap.region[ib_offset + i].total_len; in init_default_table_values()
238 pm8001_ha->inbnd_q_tbl[i].ci_upper_base_addr = in init_default_table_values()
239 pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_hi; in init_default_table_values()
240 pm8001_ha->inbnd_q_tbl[i].ci_lower_base_addr = in init_default_table_values()
241 pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_lo; in init_default_table_values()
242 pm8001_ha->inbnd_q_tbl[i].ci_virt = in init_default_table_values()
243 pm8001_ha->memoryMap.region[ci_offset + i].virt_ptr; in init_default_table_values()
244 pm8001_write_32(pm8001_ha->inbnd_q_tbl[i].ci_virt, 0, 0); in init_default_table_values()
246 pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = in init_default_table_values()
249 pm8001_ha->inbnd_q_tbl[i].pi_offset = in init_default_table_values()
251 pm8001_ha->inbnd_q_tbl[i].producer_idx = 0; in init_default_table_values()
252 pm8001_ha->inbnd_q_tbl[i].consumer_index = 0; in init_default_table_values()
254 for (i = 0; i < pm8001_ha->max_q_num; i++) { in init_default_table_values()
255 pm8001_ha->outbnd_q_tbl[i].element_size_cnt = in init_default_table_values()
256 PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x01<<30); in init_default_table_values()
257 pm8001_ha->outbnd_q_tbl[i].upper_base_addr = in init_default_table_values()
258 pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_hi; in init_default_table_values()
259 pm8001_ha->outbnd_q_tbl[i].lower_base_addr = in init_default_table_values()
260 pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_lo; in init_default_table_values()
261 pm8001_ha->outbnd_q_tbl[i].base_virt = in init_default_table_values()
262 (u8 *)pm8001_ha->memoryMap.region[ob_offset + i].virt_ptr; in init_default_table_values()
263 pm8001_ha->outbnd_q_tbl[i].total_length = in init_default_table_values()
264 pm8001_ha->memoryMap.region[ob_offset + i].total_len; in init_default_table_values()
265 pm8001_ha->outbnd_q_tbl[i].pi_upper_base_addr = in init_default_table_values()
266 pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_hi; in init_default_table_values()
267 pm8001_ha->outbnd_q_tbl[i].pi_lower_base_addr = in init_default_table_values()
268 pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_lo; in init_default_table_values()
269 pm8001_ha->outbnd_q_tbl[i].interrup_vec_cnt_delay = in init_default_table_values()
271 pm8001_ha->outbnd_q_tbl[i].pi_virt = in init_default_table_values()
272 pm8001_ha->memoryMap.region[pi_offset + i].virt_ptr; in init_default_table_values()
273 pm8001_write_32(pm8001_ha->outbnd_q_tbl[i].pi_virt, 0, 0); in init_default_table_values()
275 pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = in init_default_table_values()
278 pm8001_ha->outbnd_q_tbl[i].ci_offset = in init_default_table_values()
280 pm8001_ha->outbnd_q_tbl[i].consumer_idx = 0; in init_default_table_values()
281 pm8001_ha->outbnd_q_tbl[i].producer_index = 0; in init_default_table_values()
286 * update_main_config_table - update the main default table to the HBA.
291 void __iomem *address = pm8001_ha->main_cfg_tbl_addr; in update_main_config_table()
293 pm8001_ha->main_cfg_tbl.pm8001_tbl.inbound_q_nppd_hppd); in update_main_config_table()
295 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_hw_event_pid0_3); in update_main_config_table()
297 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_hw_event_pid4_7); in update_main_config_table()
299 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_ncq_event_pid0_3); in update_main_config_table()
301 pm8001_ha->main_cfg_tbl.pm8001_tbl.outbound_ncq_event_pid4_7); in update_main_config_table()
303 pm8001_ha->main_cfg_tbl.pm8001_tbl. in update_main_config_table()
306 pm8001_ha->main_cfg_tbl.pm8001_tbl. in update_main_config_table()
309 pm8001_ha->main_cfg_tbl.pm8001_tbl. in update_main_config_table()
312 pm8001_ha->main_cfg_tbl.pm8001_tbl. in update_main_config_table()
315 pm8001_ha->main_cfg_tbl.pm8001_tbl. in update_main_config_table()
318 pm8001_ha->main_cfg_tbl.pm8001_tbl. in update_main_config_table()
321 pm8001_ha->main_cfg_tbl.pm8001_tbl.upper_event_log_addr); in update_main_config_table()
323 pm8001_ha->main_cfg_tbl.pm8001_tbl.lower_event_log_addr); in update_main_config_table()
325 pm8001_ha->main_cfg_tbl.pm8001_tbl.event_log_size); in update_main_config_table()
327 pm8001_ha->main_cfg_tbl.pm8001_tbl.event_log_option); in update_main_config_table()
329 pm8001_ha->main_cfg_tbl.pm8001_tbl.upper_iop_event_log_addr); in update_main_config_table()
331 pm8001_ha->main_cfg_tbl.pm8001_tbl.lower_iop_event_log_addr); in update_main_config_table()
333 pm8001_ha->main_cfg_tbl.pm8001_tbl.iop_event_log_size); in update_main_config_table()
335 pm8001_ha->main_cfg_tbl.pm8001_tbl.iop_event_log_option); in update_main_config_table()
337 pm8001_ha->main_cfg_tbl.pm8001_tbl.fatal_err_interrupt); in update_main_config_table()
341 * update_inbnd_queue_table - update the inbound queue table to the HBA.
348 void __iomem *address = pm8001_ha->inbnd_q_tbl_addr; in update_inbnd_queue_table()
351 pm8001_ha->inbnd_q_tbl[number].element_pri_size_cnt); in update_inbnd_queue_table()
353 pm8001_ha->inbnd_q_tbl[number].upper_base_addr); in update_inbnd_queue_table()
355 pm8001_ha->inbnd_q_tbl[number].lower_base_addr); in update_inbnd_queue_table()
357 pm8001_ha->inbnd_q_tbl[number].ci_upper_base_addr); in update_inbnd_queue_table()
359 pm8001_ha->inbnd_q_tbl[number].ci_lower_base_addr); in update_inbnd_queue_table()
363 * update_outbnd_queue_table - update the outbound queue table to the HBA.
370 void __iomem *address = pm8001_ha->outbnd_q_tbl_addr; in update_outbnd_queue_table()
373 pm8001_ha->outbnd_q_tbl[number].element_size_cnt); in update_outbnd_queue_table()
375 pm8001_ha->outbnd_q_tbl[number].upper_base_addr); in update_outbnd_queue_table()
377 pm8001_ha->outbnd_q_tbl[number].lower_base_addr); in update_outbnd_queue_table()
379 pm8001_ha->outbnd_q_tbl[number].pi_upper_base_addr); in update_outbnd_queue_table()
381 pm8001_ha->outbnd_q_tbl[number].pi_lower_base_addr); in update_outbnd_queue_table()
383 pm8001_ha->outbnd_q_tbl[number].interrup_vec_cnt_delay); in update_outbnd_queue_table()
387 * pm8001_bar4_shift - function is called to shift BAR base address
409 return -1; in pm8001_bar4_shift()
435 * Using shifted destination address 0x4_0000:0x1074 + 0x4000*(N-4) (N=4:7) in mpi_set_phys_g3_with_ssc()
437 spin_lock_irqsave(&pm8001_ha->lock, flags); in mpi_set_phys_g3_with_ssc()
438 if (-1 == pm8001_bar4_shift(pm8001_ha, in mpi_set_phys_g3_with_ssc()
440 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in mpi_set_phys_g3_with_ssc()
448 /* shift membase 3 for SAS2_SETTINGS_LOCAL_PHY 4 - 7 */ in mpi_set_phys_g3_with_ssc()
449 if (-1 == pm8001_bar4_shift(pm8001_ha, in mpi_set_phys_g3_with_ssc()
451 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in mpi_set_phys_g3_with_ssc()
455 offset = SAS2_SETTINGS_LOCAL_PHY_4_7_OFFSET + 0x4000 * (i-4); in mpi_set_phys_g3_with_ssc()
461 Address: (via MEMBASE-III): in mpi_set_phys_g3_with_ssc()
468 Upon power-up this register will read as 0x8990c016, in mpi_set_phys_g3_with_ssc()
471 This will ensure only down-spreading SSC is enabled on the SPC. in mpi_set_phys_g3_with_ssc()
478 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in mpi_set_phys_g3_with_ssc()
502 spin_lock_irqsave(&pm8001_ha->lock, flags); in mpi_set_open_retry_interval_reg()
503 /* shift bar and set the OPEN_REJECT(RETRY) interval time of PHY 0 -3.*/ in mpi_set_open_retry_interval_reg()
504 if (-1 == pm8001_bar4_shift(pm8001_ha, in mpi_set_open_retry_interval_reg()
506 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in mpi_set_open_retry_interval_reg()
514 if (-1 == pm8001_bar4_shift(pm8001_ha, in mpi_set_open_retry_interval_reg()
516 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in mpi_set_open_retry_interval_reg()
520 offset = OPEN_RETRY_INTERVAL_PHY_4_7_OFFSET + 0x4000 * (i-4); in mpi_set_open_retry_interval_reg()
525 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in mpi_set_open_retry_interval_reg()
530 * mpi_init_check - check firmware initialization status.
547 } while ((value != 0) && (--max_wait_count)); in mpi_init_check()
550 return -1; in mpi_init_check()
551 /* check the MPI-State for initialization */ in mpi_init_check()
553 pm8001_mr32(pm8001_ha->general_stat_tbl_addr, in mpi_init_check()
556 return -1; in mpi_init_check()
560 return -1; in mpi_init_check()
565 * check_fw_ready - The LLDD check if the FW is ready, if not, return error.
579 return -1; in check_fw_ready()
586 return -1; in check_fw_ready()
589 /* bit 4-31 of scratch pad1 should be zeros if it is not in check_fw_ready()
594 return -1; in check_fw_ready()
597 /* bit 2, 4-31 of scratch pad2 should be zeros if it is not in check_fw_ready()
601 return -1; in check_fw_ready()
613 if ((--max_wait_count) == 0) in check_fw_ready()
614 return -1; in check_fw_ready()
633 pm8001_ha->main_cfg_tbl_addr = base_addr = in init_pci_device_addresses()
634 pm8001_ha->io_mem[pcibar].memvirtaddr + offset; in init_pci_device_addresses()
635 pm8001_ha->general_stat_tbl_addr = in init_pci_device_addresses()
637 pm8001_ha->inbnd_q_tbl_addr = in init_pci_device_addresses()
639 pm8001_ha->outbnd_q_tbl_addr = in init_pci_device_addresses()
644 * pm8001_chip_init - the main init function that initialize whole PM8001 chip.
651 pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid); in pm8001_chip_init()
655 if (-1 == pm8001_bar4_shift(pm8001_ha, GSM_SM_BASE)) { in pm8001_chip_init()
659 return -1; in pm8001_chip_init()
663 if (-1 == check_fw_ready(pm8001_ha)) { in pm8001_chip_init()
665 return -EBUSY; in pm8001_chip_init()
677 for (i = 0; i < pm8001_ha->max_q_num; i++) in pm8001_chip_init()
679 for (i = 0; i < pm8001_ha->max_q_num; i++) in pm8001_chip_init()
684 /* 7->130ms, 34->500ms, 119->1.5s */ in pm8001_chip_init()
691 return -EBUSY; in pm8001_chip_init()
692 /*This register is a 16-bit timer with a resolution of 1us. This is the in pm8001_chip_init()
712 pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid); in mpi_uninit_check()
714 if (-1 == pm8001_bar4_shift(pm8001_ha, GSM_SM_BASE)) { in mpi_uninit_check()
718 return -1; in mpi_uninit_check()
732 } while ((value != 0) && (--max_wait_count)); in mpi_uninit_check()
737 return -1; in mpi_uninit_check()
740 /* check the MPI-State for termination in progress */ in mpi_uninit_check()
746 pm8001_mr32(pm8001_ha->general_stat_tbl_addr, in mpi_uninit_check()
751 } while (--max_wait_count); in mpi_uninit_check()
755 return -1; in mpi_uninit_check()
761 * soft_reset_ready_check - Function to check FW is ready for soft reset.
769 return -1; in soft_reset_ready_check()
779 spin_lock_irqsave(&pm8001_ha->lock, flags); in soft_reset_ready_check()
780 if (-1 == pm8001_bar4_shift(pm8001_ha, RB6_ACCESS_REG)) { in soft_reset_ready_check()
781 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in soft_reset_ready_check()
785 return -1; in soft_reset_ready_check()
805 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in soft_reset_ready_check()
806 return -1; in soft_reset_ready_check()
808 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in soft_reset_ready_check()
814 * pm8001_chip_soft_rst - soft reset the PM8001 chip, so that the clear all
830 return -1; in pm8001_chip_soft_rst()
836 spin_lock_irqsave(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
837 if (-1 == pm8001_bar4_shift(pm8001_ha, MBIC_AAP1_ADDR_BASE)) { in pm8001_chip_soft_rst()
838 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
841 return -1; in pm8001_chip_soft_rst()
844 pm8001_dbg(pm8001_ha, INIT, "MBIC - NMI Enable VPE0 (IOP)= 0x%x\n", in pm8001_chip_soft_rst()
848 if (-1 == pm8001_bar4_shift(pm8001_ha, MBIC_IOP_ADDR_BASE)) { in pm8001_chip_soft_rst()
849 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
852 return -1; in pm8001_chip_soft_rst()
855 pm8001_dbg(pm8001_ha, INIT, "MBIC - NMI Enable VPE0 (AAP1)= 0x%x\n", in pm8001_chip_soft_rst()
860 pm8001_dbg(pm8001_ha, INIT, "PCIE -Event Interrupt Enable = 0x%x\n", in pm8001_chip_soft_rst()
865 pm8001_dbg(pm8001_ha, INIT, "PCIE - Event Interrupt = 0x%x\n", in pm8001_chip_soft_rst()
870 pm8001_dbg(pm8001_ha, INIT, "PCIE -Error Interrupt Enable = 0x%x\n", in pm8001_chip_soft_rst()
875 pm8001_dbg(pm8001_ha, INIT, "PCIE - Error Interrupt = 0x%x\n", regVal); in pm8001_chip_soft_rst()
889 if (-1 == pm8001_bar4_shift(pm8001_ha, GSM_ADDR_BASE)) { in pm8001_chip_soft_rst()
890 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
893 return -1; in pm8001_chip_soft_rst()
896 "GSM 0x0(0x00007b88)-GSM Configuration and Reset = 0x%x\n", in pm8001_chip_soft_rst()
913 "GSM 0x0 (0x00007b88 ==> 0x00004088) - GSM Configuration and Reset is set to = 0x%x\n", in pm8001_chip_soft_rst()
917 /* disable GSM - Read Address Parity Check */ in pm8001_chip_soft_rst()
920 "GSM 0x700038 - Read Address Parity Check Enable = 0x%x\n", in pm8001_chip_soft_rst()
924 "GSM 0x700038 - Read Address Parity Check Enable is set to = 0x%x\n", in pm8001_chip_soft_rst()
927 /* disable GSM - Write Address Parity Check */ in pm8001_chip_soft_rst()
930 "GSM 0x700040 - Write Address Parity Check Enable = 0x%x\n", in pm8001_chip_soft_rst()
934 "GSM 0x700040 - Write Address Parity Check Enable is set to = 0x%x\n", in pm8001_chip_soft_rst()
937 /* disable GSM - Write Data Parity Check */ in pm8001_chip_soft_rst()
939 pm8001_dbg(pm8001_ha, INIT, "GSM 0x300048 - Write Data Parity Check Enable = 0x%x\n", in pm8001_chip_soft_rst()
943 "GSM 0x300048 - Write Data Parity Check Enable is set to = 0x%x\n", in pm8001_chip_soft_rst()
948 /* step 5-b: set GPIO-0 output control to tristate anyway */ in pm8001_chip_soft_rst()
949 if (-1 == pm8001_bar4_shift(pm8001_ha, GPIO_ADDR_BASE)) { in pm8001_chip_soft_rst()
950 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
953 return -1; in pm8001_chip_soft_rst()
958 /* set GPIO-0 output control to tri-state */ in pm8001_chip_soft_rst()
964 if (-1 == pm8001_bar4_shift(pm8001_ha, SPC_TOP_LEVEL_ADDR_BASE)) { in pm8001_chip_soft_rst()
965 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
968 return -1; in pm8001_chip_soft_rst()
999 if (-1 == pm8001_bar4_shift(pm8001_ha, GSM_ADDR_BASE)) { in pm8001_chip_soft_rst()
1000 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
1003 return -1; in pm8001_chip_soft_rst()
1006 "GSM 0x0 (0x00007b88)-GSM Configuration and Reset = 0x%x\n", in pm8001_chip_soft_rst()
1019 …pm8001_dbg(pm8001_ha, INIT, "GSM (0x00004088 ==> 0x00007b88) - GSM Configuration and Reset is set … in pm8001_chip_soft_rst()
1022 /* step 12: Restore GSM - Read Address Parity Check */ in pm8001_chip_soft_rst()
1026 "GSM 0x700038 - Read Address Parity Check Enable = 0x%x\n", in pm8001_chip_soft_rst()
1029 pm8001_dbg(pm8001_ha, INIT, "GSM 0x700038 - Read Address Parity Check Enable is set to = 0x%x\n", in pm8001_chip_soft_rst()
1031 /* Restore GSM - Write Address Parity Check */ in pm8001_chip_soft_rst()
1035 "GSM 0x700040 - Write Address Parity Check Enable is set to = 0x%x\n", in pm8001_chip_soft_rst()
1037 /* Restore GSM - Write Data Parity Check */ in pm8001_chip_soft_rst()
1041 "GSM 0x700048 - Write Data Parity Check Enable is set to = 0x%x\n", in pm8001_chip_soft_rst()
1046 if (-1 == pm8001_bar4_shift(pm8001_ha, SPC_TOP_LEVEL_ADDR_BASE)) { in pm8001_chip_soft_rst()
1047 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
1050 return -1; in pm8001_chip_soft_rst()
1056 /* step 14: delay 10 usec - Normal Mode */ in pm8001_chip_soft_rst()
1067 } while ((regVal != toggleVal) && (--max_wait_count)); in pm8001_chip_soft_rst()
1086 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
1087 return -1; in pm8001_chip_soft_rst()
1090 /* step 16 (Normal) - Clear ODMR and ODCR */ in pm8001_chip_soft_rst()
1095 ready - 1 sec timeout */ in pm8001_chip_soft_rst()
1097 if (check_fw_ready(pm8001_ha) == -1) { in pm8001_chip_soft_rst()
1116 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
1117 return -1; in pm8001_chip_soft_rst()
1121 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_chip_soft_rst()
1153 } while ((--i) != 0); in pm8001_hw_chip_rst()
1159 * pm8001_chip_iounmap - which mapped when initialized.
1168 ** bar 0 and 1 - logical BAR0 in pm8001_chip_iounmap()
1169 ** bar 2 and 3 - logical BAR1 in pm8001_chip_iounmap()
1170 ** bar4 - logical BAR2 in pm8001_chip_iounmap()
1171 ** bar5 - logical BAR3 in pm8001_chip_iounmap()
1176 if (pm8001_ha->io_mem[logical].memvirtaddr) { in pm8001_chip_iounmap()
1177 iounmap(pm8001_ha->io_mem[logical].memvirtaddr); in pm8001_chip_iounmap()
1185 * pm8001_chip_intx_interrupt_enable - enable PM8001 chip interrupt
1196 * pm8001_chip_intx_interrupt_disable - disable PM8001 chip interrupt
1208 * pm8001_chip_msix_interrupt_enable - enable PM8001 chip interrupt
1227 * pm8001_chip_msix_interrupt_disable - disable PM8001 chip interrupt
1243 * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
1258 * pm8001_chip_interrupt_disable - disable PM8001 chip interrupt
1273 * pm8001_mpi_msg_free_get - get the free message buffer for transfer
1289 return -1; in pm8001_mpi_msg_free_get()
1293 consumer_index = pm8001_read_32(circularQ->ci_virt); in pm8001_mpi_msg_free_get()
1294 circularQ->consumer_index = cpu_to_le32(consumer_index); in pm8001_mpi_msg_free_get()
1295 if (((circularQ->producer_idx + bcCount) % PM8001_MPI_QUEUE) == in pm8001_mpi_msg_free_get()
1296 le32_to_cpu(circularQ->consumer_index)) { in pm8001_mpi_msg_free_get()
1298 return -1; in pm8001_mpi_msg_free_get()
1301 offset = circularQ->producer_idx * messageSize; in pm8001_mpi_msg_free_get()
1303 circularQ->producer_idx = (circularQ->producer_idx + bcCount) in pm8001_mpi_msg_free_get()
1307 msgHeader = (struct mpi_msg_hdr *)(circularQ->base_virt + offset); in pm8001_mpi_msg_free_get()
1313 * pm8001_mpi_build_cmd- build the message queue for transfer, update the PI to
1329 struct inbound_queue_table *circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; in pm8001_mpi_build_cmd()
1333 trace_pm80xx_mpi_build_cmd(pm8001_ha->id, opCode, htag, q_index, in pm8001_mpi_build_cmd()
1334 circularQ->producer_idx, le32_to_cpu(circularQ->consumer_index)); in pm8001_mpi_build_cmd()
1336 if (WARN_ON(q_index >= pm8001_ha->max_q_num)) in pm8001_mpi_build_cmd()
1337 return -EINVAL; in pm8001_mpi_build_cmd()
1339 spin_lock_irqsave(&circularQ->iq_lock, flags); in pm8001_mpi_build_cmd()
1340 rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size, in pm8001_mpi_build_cmd()
1344 rv = -ENOMEM; in pm8001_mpi_build_cmd()
1348 if (nb > (pm8001_ha->iomb_size - sizeof(struct mpi_msg_hdr))) in pm8001_mpi_build_cmd()
1349 nb = pm8001_ha->iomb_size - sizeof(struct mpi_msg_hdr); in pm8001_mpi_build_cmd()
1351 if (nb + sizeof(struct mpi_msg_hdr) < pm8001_ha->iomb_size) in pm8001_mpi_build_cmd()
1352 memset(pMessage + nb, 0, pm8001_ha->iomb_size - in pm8001_mpi_build_cmd()
1360 pm8001_write_32((pMessage - 4), 0, cpu_to_le32(Header)); in pm8001_mpi_build_cmd()
1362 pm8001_cw32(pm8001_ha, circularQ->pi_pci_bar, in pm8001_mpi_build_cmd()
1363 circularQ->pi_offset, circularQ->producer_idx); in pm8001_mpi_build_cmd()
1366 responseQueue, opCode, circularQ->producer_idx, in pm8001_mpi_build_cmd()
1367 circularQ->consumer_index); in pm8001_mpi_build_cmd()
1369 spin_unlock_irqrestore(&circularQ->iq_lock, flags); in pm8001_mpi_build_cmd()
1380 msgHeader = (struct mpi_msg_hdr *)(pMsg - sizeof(struct mpi_msg_hdr)); in pm8001_mpi_msg_free_set()
1381 pOutBoundMsgHeader = (struct mpi_msg_hdr *)(circularQ->base_virt + in pm8001_mpi_msg_free_set()
1382 circularQ->consumer_idx * pm8001_ha->iomb_size); in pm8001_mpi_msg_free_set()
1386 circularQ->consumer_idx, msgHeader); in pm8001_mpi_msg_free_set()
1389 producer_index = pm8001_read_32(circularQ->pi_virt); in pm8001_mpi_msg_free_set()
1390 circularQ->producer_index = cpu_to_le32(producer_index); in pm8001_mpi_msg_free_set()
1393 circularQ->consumer_idx, in pm8001_mpi_msg_free_set()
1394 circularQ->producer_index, msgHeader); in pm8001_mpi_msg_free_set()
1398 circularQ->consumer_idx = (circularQ->consumer_idx + bc) in pm8001_mpi_msg_free_set()
1401 pm8001_cw32(pm8001_ha, circularQ->ci_pci_bar, circularQ->ci_offset, in pm8001_mpi_msg_free_set()
1402 circularQ->consumer_idx); in pm8001_mpi_msg_free_set()
1404 producer_index = pm8001_read_32(circularQ->pi_virt); in pm8001_mpi_msg_free_set()
1405 circularQ->producer_index = cpu_to_le32(producer_index); in pm8001_mpi_msg_free_set()
1407 circularQ->consumer_idx, circularQ->producer_index); in pm8001_mpi_msg_free_set()
1412 * pm8001_mpi_msg_consume- get the MPI message from outbound queue
1427 /* If there are not-yet-delivered messages ... */ in pm8001_mpi_msg_consume()
1428 if (le32_to_cpu(circularQ->producer_index) in pm8001_mpi_msg_consume()
1429 != circularQ->consumer_idx) { in pm8001_mpi_msg_consume()
1432 (circularQ->base_virt + in pm8001_mpi_msg_consume()
1433 circularQ->consumer_idx * pm8001_ha->iomb_size); in pm8001_mpi_msg_consume()
1439 msgHeader_tmp, circularQ->consumer_idx, in pm8001_mpi_msg_consume()
1440 circularQ->producer_index); in pm8001_mpi_msg_consume()
1451 circularQ->consumer_idx, in pm8001_mpi_msg_consume()
1452 circularQ->producer_index, in pm8001_mpi_msg_consume()
1456 circularQ->consumer_idx = in pm8001_mpi_msg_consume()
1457 (circularQ->consumer_idx + in pm8001_mpi_msg_consume()
1465 circularQ->ci_pci_bar, in pm8001_mpi_msg_consume()
1466 circularQ->ci_offset, in pm8001_mpi_msg_consume()
1467 circularQ->consumer_idx); in pm8001_mpi_msg_consume()
1470 circularQ->consumer_idx = in pm8001_mpi_msg_consume()
1471 (circularQ->consumer_idx + in pm8001_mpi_msg_consume()
1477 pm8001_cw32(pm8001_ha, circularQ->ci_pci_bar, in pm8001_mpi_msg_consume()
1478 circularQ->ci_offset, in pm8001_mpi_msg_consume()
1479 circularQ->consumer_idx); in pm8001_mpi_msg_consume()
1484 void *pi_virt = circularQ->pi_virt; in pm8001_mpi_msg_consume()
1486 * kexec-ing and driver doing a doorbell access in pm8001_mpi_msg_consume()
1487 * with the pre-kexec oq interrupt setup in pm8001_mpi_msg_consume()
1493 circularQ->producer_index = cpu_to_le32(producer_index); in pm8001_mpi_msg_consume()
1495 } while (le32_to_cpu(circularQ->producer_index) != in pm8001_mpi_msg_consume()
1496 circularQ->consumer_idx); in pm8001_mpi_msg_consume()
1497 /* while we don't have any more not-yet-delivered message */ in pm8001_mpi_msg_consume()
1514 if (pw->handler != IO_FATAL_ERROR) { in pm8001_work_fn()
1515 pm8001_dev = pw->data; /* Most stash device structure */ in pm8001_work_fn()
1517 || ((pw->handler != IO_XFER_ERROR_BREAK) in pm8001_work_fn()
1518 && (pm8001_dev->dev_type == SAS_PHY_UNUSED))) { in pm8001_work_fn()
1524 switch (pw->handler) { in pm8001_work_fn()
1527 struct sas_task *t = (struct sas_task *)pm8001_dev; in pm8001_work_fn() local
1529 struct pm8001_hba_info *pm8001_ha = pw->pm8001_ha; in pm8001_work_fn()
1534 if (pm8001_query_task(t) == TMF_RESP_FUNC_SUCC) in pm8001_work_fn()
1536 spin_lock_irqsave(&pm8001_ha->lock, flags); in pm8001_work_fn()
1538 spin_lock_irqsave(&t->task_state_lock, flags1); in pm8001_work_fn()
1539 if (unlikely((t->task_state_flags & SAS_TASK_STATE_DONE))) { in pm8001_work_fn()
1540 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1541 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1544 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1548 ccb = &pm8001_ha->ccb_info[i]; in pm8001_work_fn()
1549 if ((ccb->ccb_tag != PM8001_INVALID_TAG) && in pm8001_work_fn()
1550 (ccb->task == t)) in pm8001_work_fn()
1554 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1557 ts = &t->task_status; in pm8001_work_fn()
1558 ts->resp = SAS_TASK_COMPLETE; in pm8001_work_fn()
1560 ts->stat = SAS_QUEUE_FULL; in pm8001_work_fn()
1561 pm8001_dev = ccb->device; in pm8001_work_fn()
1563 atomic_dec(&pm8001_dev->running_req); in pm8001_work_fn()
1564 spin_lock_irqsave(&t->task_state_lock, flags1); in pm8001_work_fn()
1565 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in pm8001_work_fn()
1566 t->task_state_flags |= SAS_TASK_STATE_DONE; in pm8001_work_fn()
1567 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in pm8001_work_fn()
1568 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1570 t, pw->handler, ts->resp, ts->stat); in pm8001_work_fn()
1572 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1574 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1577 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1578 t->task_done(t); in pm8001_work_fn()
1583 struct sas_task *t = (struct sas_task *)pm8001_dev; in pm8001_work_fn() local
1585 struct pm8001_hba_info *pm8001_ha = pw->pm8001_ha; in pm8001_work_fn()
1591 ret = pm8001_query_task(t); in pm8001_work_fn()
1600 spin_lock_irqsave(&pm8001_ha->lock, flags); in pm8001_work_fn()
1602 spin_lock_irqsave(&t->task_state_lock, flags1); in pm8001_work_fn()
1604 if (unlikely((t->task_state_flags & SAS_TASK_STATE_DONE))) { in pm8001_work_fn()
1605 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1606 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1608 (void)pm8001_abort_task(t); in pm8001_work_fn()
1612 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1616 ccb = &pm8001_ha->ccb_info[i]; in pm8001_work_fn()
1617 if ((ccb->ccb_tag != PM8001_INVALID_TAG) && in pm8001_work_fn()
1618 (ccb->task == t)) in pm8001_work_fn()
1622 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1624 (void)pm8001_abort_task(t); in pm8001_work_fn()
1628 pm8001_dev = ccb->device; in pm8001_work_fn()
1629 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1633 ccb->open_retry = 1; /* Snub completion */ in pm8001_work_fn()
1634 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1635 ret = pm8001_abort_task(t); in pm8001_work_fn()
1636 ccb->open_retry = 0; in pm8001_work_fn()
1643 pm8001_dbg(pm8001_ha, IO, "...Reset phy\n"); in pm8001_work_fn()
1650 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1655 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1657 pm8001_dbg(pm8001_ha, IO, "...Reset phy\n"); in pm8001_work_fn()
1662 t = NULL; in pm8001_work_fn()
1663 pm8001_open_reject_retry(pm8001_ha, t, pm8001_dev); in pm8001_work_fn()
1667 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1671 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1675 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1679 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1684 struct pm8001_hba_info *pm8001_ha = pw->pm8001_ha; in pm8001_work_fn()
1692 ccb = &pm8001_ha->ccb_info[i]; in pm8001_work_fn()
1693 task = ccb->task; in pm8001_work_fn()
1694 ts = &task->task_status; in pm8001_work_fn()
1697 dev = task->dev; in pm8001_work_fn()
1705 ts->resp = SAS_TASK_COMPLETE; in pm8001_work_fn()
1706 task->task_done(task); in pm8001_work_fn()
1707 } else if (ccb->ccb_tag != PM8001_INVALID_TAG) { in pm8001_work_fn()
1708 /* complete the internal commands/non-sas task */ in pm8001_work_fn()
1709 pm8001_dev = ccb->device; in pm8001_work_fn()
1710 if (pm8001_dev->dcompletion) { in pm8001_work_fn()
1711 complete(pm8001_dev->dcompletion); in pm8001_work_fn()
1712 pm8001_dev->dcompletion = NULL; in pm8001_work_fn()
1714 complete(pm8001_ha->nvmd_completion); in pm8001_work_fn()
1720 pm8001_dev = &pm8001_ha->devices[i]; in pm8001_work_fn()
1721 device_id = pm8001_dev->device_id; in pm8001_work_fn()
1723 PM8001_CHIP_DISP->dereg_dev_req(pm8001_ha, device_id); in pm8001_work_fn()
1731 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1747 pw->pm8001_ha = pm8001_ha; in pm8001_handle_event()
1748 pw->data = data; in pm8001_handle_event()
1749 pw->handler = handler; in pm8001_handle_event()
1750 INIT_WORK(&pw->work, pm8001_work_fn); in pm8001_handle_event()
1751 queue_work(pm8001_wq, &pw->work); in pm8001_handle_event()
1753 ret = -ENOMEM; in pm8001_handle_event()
1759 * mpi_ssp_completion- process the event that FW response to the SSP request.
1772 struct sas_task *t; in mpi_ssp_completion() local
1783 status = le32_to_cpu(psspPayload->status); in mpi_ssp_completion()
1784 tag = le32_to_cpu(psspPayload->tag); in mpi_ssp_completion()
1785 ccb = &pm8001_ha->ccb_info[tag]; in mpi_ssp_completion()
1786 if ((status == IO_ABORTED) && ccb->open_retry) { in mpi_ssp_completion()
1788 ccb->open_retry = 0; in mpi_ssp_completion()
1791 pm8001_dev = ccb->device; in mpi_ssp_completion()
1792 param = le32_to_cpu(psspPayload->param); in mpi_ssp_completion()
1794 t = ccb->task; in mpi_ssp_completion()
1798 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_ssp_completion()
1800 ts = &t->task_status; in mpi_ssp_completion()
1805 SAS_ADDR(t->dev->sas_addr)); in mpi_ssp_completion()
1810 status, tag, t); in mpi_ssp_completion()
1817 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1818 ts->stat = SAS_SAM_STAT_GOOD; in mpi_ssp_completion()
1820 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1821 ts->stat = SAS_PROTO_RESPONSE; in mpi_ssp_completion()
1822 ts->residual = param; in mpi_ssp_completion()
1823 iu = &psspPayload->ssp_resp_iu; in mpi_ssp_completion()
1824 sas_ssp_task_response(pm8001_ha->dev, t, iu); in mpi_ssp_completion()
1827 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1831 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1832 ts->stat = SAS_ABORTED_TASK; in mpi_ssp_completion()
1838 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1839 ts->stat = SAS_DATA_UNDERRUN; in mpi_ssp_completion()
1840 ts->residual = param; in mpi_ssp_completion()
1842 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1846 ts->resp = SAS_TASK_UNDELIVERED; in mpi_ssp_completion()
1847 ts->stat = SAS_PHY_DOWN; in mpi_ssp_completion()
1851 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1852 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1854 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1858 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1859 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1860 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1865 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1866 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1867 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_ssp_completion()
1872 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1873 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1874 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_completion()
1878 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1879 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1880 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1884 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1885 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1886 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_completion()
1887 if (!t->uldd_task) in mpi_ssp_completion()
1895 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1896 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1897 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_ssp_completion()
1901 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1902 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1903 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_ssp_completion()
1908 ts->resp = SAS_TASK_UNDELIVERED; in mpi_ssp_completion()
1909 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1910 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_ssp_completion()
1914 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1915 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1916 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1920 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1921 ts->stat = SAS_NAK_R_ERR; in mpi_ssp_completion()
1925 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1926 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1930 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1931 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1932 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1936 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1937 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1941 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1942 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1946 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1947 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1948 if (!t->uldd_task) in mpi_ssp_completion()
1955 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1956 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1960 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1961 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1965 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1966 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1971 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1972 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1973 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1978 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1979 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1983 psspPayload->ssp_resp_iu.status); in mpi_ssp_completion()
1984 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_ssp_completion()
1985 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_ssp_completion()
1986 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_ssp_completion()
1987 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_ssp_completion()
1988 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_completion()
1990 t, status, ts->resp, ts->stat); in mpi_ssp_completion()
1993 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_completion()
1996 t->task_done(t); in mpi_ssp_completion()
2003 struct sas_task *t; in mpi_ssp_event() local
2010 u32 event = le32_to_cpu(psspPayload->event); in mpi_ssp_event()
2011 u32 tag = le32_to_cpu(psspPayload->tag); in mpi_ssp_event()
2012 u32 port_id = le32_to_cpu(psspPayload->port_id); in mpi_ssp_event()
2013 u32 dev_id = le32_to_cpu(psspPayload->device_id); in mpi_ssp_event()
2015 ccb = &pm8001_ha->ccb_info[tag]; in mpi_ssp_event()
2016 t = ccb->task; in mpi_ssp_event()
2017 pm8001_dev = ccb->device; in mpi_ssp_event()
2020 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_ssp_event()
2022 ts = &t->task_status; in mpi_ssp_event()
2028 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2029 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2030 ts->residual = 0; in mpi_ssp_event()
2032 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_event()
2036 pm8001_handle_event(pm8001_ha, t, IO_XFER_ERROR_BREAK); in mpi_ssp_event()
2040 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2041 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2042 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2046 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2047 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2048 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_ssp_event()
2053 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2054 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2055 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_event()
2059 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2060 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2061 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2065 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2066 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2067 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_event()
2068 if (!t->uldd_task) in mpi_ssp_event()
2076 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2077 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2078 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_ssp_event()
2082 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2083 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2084 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_ssp_event()
2089 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2090 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2091 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_ssp_event()
2095 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2096 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2097 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2101 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2102 ts->stat = SAS_NAK_R_ERR; in mpi_ssp_event()
2106 pm8001_handle_event(pm8001_ha, t, IO_XFER_OPEN_RETRY_TIMEOUT); in mpi_ssp_event()
2110 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2111 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2115 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2116 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2121 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2122 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2127 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2128 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2132 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2133 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2138 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2139 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2147 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2148 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2151 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_ssp_event()
2152 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_ssp_event()
2153 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_ssp_event()
2154 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_ssp_event()
2155 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_event()
2157 t, event, ts->resp, ts->stat); in mpi_ssp_event()
2160 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_event()
2163 t->task_done(t); in mpi_ssp_event()
2171 struct sas_task *t; in mpi_sata_completion() local
2189 status = le32_to_cpu(psataPayload->status); in mpi_sata_completion()
2190 param = le32_to_cpu(psataPayload->param); in mpi_sata_completion()
2191 tag = le32_to_cpu(psataPayload->tag); in mpi_sata_completion()
2193 ccb = &pm8001_ha->ccb_info[tag]; in mpi_sata_completion()
2194 t = ccb->task; in mpi_sata_completion()
2195 pm8001_dev = ccb->device; in mpi_sata_completion()
2197 if (t) { in mpi_sata_completion()
2198 if (t->dev && (t->dev->lldd_dev)) in mpi_sata_completion()
2199 pm8001_dev = t->dev->lldd_dev; in mpi_sata_completion()
2202 ccb->ccb_tag); in mpi_sata_completion()
2207 if (pm8001_dev && unlikely(!t || !t->lldd_task || !t->dev)) { in mpi_sata_completion()
2212 ts = &t->task_status; in mpi_sata_completion()
2217 status, tag, t); in mpi_sata_completion()
2222 if (!((t->dev->parent) && in mpi_sata_completion()
2223 (dev_is_expander(t->dev->parent->dev_type)))) { in mpi_sata_completion()
2225 sata_addr_low[i] = pm8001_ha->sas_addr[j]; in mpi_sata_completion()
2227 sata_addr_hi[i] = pm8001_ha->sas_addr[j]; in mpi_sata_completion()
2247 pm8001_dev->attached_phy + in mpi_sata_completion()
2256 SAS_ADDR(t->dev->sas_addr)); in mpi_sata_completion()
2263 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2264 ts->stat = SAS_SAM_STAT_GOOD; in mpi_sata_completion()
2267 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2268 ts->stat = SAS_PROTO_RESPONSE; in mpi_sata_completion()
2269 ts->residual = param; in mpi_sata_completion()
2273 sata_resp = &psataPayload->sata_resp[0]; in mpi_sata_completion()
2274 resp = (struct ata_task_resp *)ts->buf; in mpi_sata_completion()
2275 if (t->ata_task.dma_xfer == 0 && in mpi_sata_completion()
2276 t->data_dir == DMA_FROM_DEVICE) { in mpi_sata_completion()
2280 } else if (t->ata_task.use_ncq && in mpi_sata_completion()
2281 t->data_dir != DMA_NONE) { in mpi_sata_completion()
2291 resp->frame_len = len; in mpi_sata_completion()
2292 memcpy(&resp->ending_fis[0], sata_resp, len); in mpi_sata_completion()
2293 ts->buf_valid_size = sizeof(*resp); in mpi_sata_completion()
2299 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2303 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2304 ts->stat = SAS_ABORTED_TASK; in mpi_sata_completion()
2306 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2312 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2313 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_completion()
2314 ts->residual = param; in mpi_sata_completion()
2316 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2320 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2321 ts->stat = SAS_PHY_DOWN; in mpi_sata_completion()
2323 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2327 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2328 ts->stat = SAS_INTERRUPTED; in mpi_sata_completion()
2330 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2334 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2335 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2336 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_completion()
2338 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2342 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2343 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2344 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_sata_completion()
2346 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2351 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2352 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2353 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_sata_completion()
2355 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2359 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2360 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2361 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_sata_completion()
2363 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2367 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2368 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2369 if (!t->uldd_task) { in mpi_sata_completion()
2373 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2374 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2382 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2383 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2384 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_sata_completion()
2385 if (!t->uldd_task) { in mpi_sata_completion()
2389 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2390 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2397 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2398 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2399 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_sata_completion()
2401 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2405 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2406 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2407 if (!t->uldd_task) { in mpi_sata_completion()
2411 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2412 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2420 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2421 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2422 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_sata_completion()
2424 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2428 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2429 ts->stat = SAS_NAK_R_ERR; in mpi_sata_completion()
2431 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2435 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2436 ts->stat = SAS_NAK_R_ERR; in mpi_sata_completion()
2438 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2442 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2443 ts->stat = SAS_ABORTED_TASK; in mpi_sata_completion()
2445 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2449 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2450 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2452 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2456 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2457 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_completion()
2459 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2463 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2464 ts->stat = SAS_OPEN_TO; in mpi_sata_completion()
2466 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2470 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2471 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2473 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2477 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2478 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2479 if (!t->uldd_task) { in mpi_sata_completion()
2482 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2483 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2490 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2491 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2493 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2497 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2498 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2499 if (!t->uldd_task) { in mpi_sata_completion()
2502 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2503 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2511 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2512 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2513 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_completion()
2515 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2520 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2521 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2523 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2526 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_sata_completion()
2527 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_sata_completion()
2528 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_sata_completion()
2529 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_sata_completion()
2530 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_sata_completion()
2533 t, status, ts->resp, ts->stat); in mpi_sata_completion()
2536 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_sata_completion()
2544 struct sas_task *t; in mpi_sata_event() local
2550 u32 event = le32_to_cpu(psataPayload->event); in mpi_sata_event()
2551 u32 tag = le32_to_cpu(psataPayload->tag); in mpi_sata_event()
2552 u32 port_id = le32_to_cpu(psataPayload->port_id); in mpi_sata_event()
2553 u32 dev_id = le32_to_cpu(psataPayload->device_id); in mpi_sata_event()
2569 ccb = &pm8001_ha->ccb_info[tag]; in mpi_sata_event()
2570 t = ccb->task; in mpi_sata_event()
2571 pm8001_dev = ccb->device; in mpi_sata_event()
2575 if (unlikely(!t)) { in mpi_sata_event()
2577 ccb->ccb_tag); in mpi_sata_event()
2582 if (unlikely(!t->lldd_task || !t->dev)) in mpi_sata_event()
2585 ts = &t->task_status; in mpi_sata_event()
2592 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2593 ts->stat = SAS_DATA_OVERRUN; in mpi_sata_event()
2594 ts->residual = 0; in mpi_sata_event()
2598 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2599 ts->stat = SAS_INTERRUPTED; in mpi_sata_event()
2603 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2604 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2605 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_event()
2609 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2610 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2611 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_sata_event()
2616 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2617 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2618 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_sata_event()
2622 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2623 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2624 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_sata_event()
2628 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_event()
2629 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_event()
2630 if (!t->uldd_task) { in mpi_sata_event()
2634 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2635 ts->stat = SAS_QUEUE_FULL; in mpi_sata_event()
2642 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_event()
2643 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2644 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_sata_event()
2648 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2649 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2650 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_sata_event()
2655 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2656 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2657 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_sata_event()
2661 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2662 ts->stat = SAS_NAK_R_ERR; in mpi_sata_event()
2666 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2667 ts->stat = SAS_NAK_R_ERR; in mpi_sata_event()
2671 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2672 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_event()
2676 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2677 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2681 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2682 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2686 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2687 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2692 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2693 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2697 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2698 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2703 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2704 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2711 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2712 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2717 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2718 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2727 struct sas_task *t; in mpi_smp_completion() local
2737 status = le32_to_cpu(psmpPayload->status); in mpi_smp_completion()
2738 tag = le32_to_cpu(psmpPayload->tag); in mpi_smp_completion()
2740 ccb = &pm8001_ha->ccb_info[tag]; in mpi_smp_completion()
2741 t = ccb->task; in mpi_smp_completion()
2742 ts = &t->task_status; in mpi_smp_completion()
2743 pm8001_dev = ccb->device; in mpi_smp_completion()
2748 status, tag, t); in mpi_smp_completion()
2750 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_smp_completion()
2756 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2757 ts->stat = SAS_SAM_STAT_GOOD; in mpi_smp_completion()
2759 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2763 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2764 ts->stat = SAS_ABORTED_TASK; in mpi_smp_completion()
2766 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2770 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2771 ts->stat = SAS_DATA_OVERRUN; in mpi_smp_completion()
2772 ts->residual = 0; in mpi_smp_completion()
2774 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2778 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2779 ts->stat = SAS_PHY_DOWN; in mpi_smp_completion()
2783 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2784 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2788 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2789 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2793 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2794 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2799 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2800 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2801 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2806 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2807 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2808 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2812 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2813 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2814 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_smp_completion()
2818 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2819 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2820 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2828 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2829 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2830 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_smp_completion()
2834 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2835 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2836 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_smp_completion()
2841 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2842 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2843 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_smp_completion()
2847 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2848 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
2852 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2853 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2854 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
2858 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2859 ts->stat = SAS_QUEUE_FULL; in mpi_smp_completion()
2863 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2864 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2865 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
2869 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2870 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
2874 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2875 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2876 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
2881 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2882 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2883 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
2887 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2888 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
2892 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_smp_completion()
2893 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_smp_completion()
2894 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_smp_completion()
2895 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_smp_completion()
2896 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_smp_completion()
2898 t, status, ts->resp, ts->stat); in mpi_smp_completion()
2901 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_smp_completion()
2911 u32 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_set_dev_state_resp()
2912 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_set_dev_state_resp()
2913 struct pm8001_device *pm8001_dev = ccb->device; in pm8001_mpi_set_dev_state_resp()
2914 u32 status = le32_to_cpu(pPayload->status); in pm8001_mpi_set_dev_state_resp()
2915 u32 device_id = le32_to_cpu(pPayload->device_id); in pm8001_mpi_set_dev_state_resp()
2916 u8 pds = le32_to_cpu(pPayload->pds_nds) & PDS_BITS; in pm8001_mpi_set_dev_state_resp()
2917 u8 nds = le32_to_cpu(pPayload->pds_nds) & NDS_BITS; in pm8001_mpi_set_dev_state_resp()
2922 complete(pm8001_dev->setds_completion); in pm8001_mpi_set_dev_state_resp()
2930 u32 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_set_nvmd_resp()
2931 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_set_nvmd_resp()
2932 u32 dlen_status = le32_to_cpu(pPayload->dlen_status); in pm8001_mpi_set_nvmd_resp()
2934 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_set_nvmd_resp()
2949 u32 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_get_nvmd_resp()
2950 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_get_nvmd_resp()
2951 u32 dlen_status = le32_to_cpu(pPayload->dlen_status); in pm8001_mpi_get_nvmd_resp()
2953 le32_to_cpu(pPayload->ir_tda_bn_dps_das_nvm); in pm8001_mpi_get_nvmd_resp()
2954 void *virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr; in pm8001_mpi_get_nvmd_resp()
2955 fw_control_context = ccb->fw_control_context; in pm8001_mpi_get_nvmd_resp()
2961 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_get_nvmd_resp()
2969 /* indirect mode - IR bit set */ in pm8001_mpi_get_nvmd_resp()
2973 memcpy(pm8001_ha->sas_addr, in pm8001_mpi_get_nvmd_resp()
2999 memcpy(fw_control_context->usrAddr, in pm8001_mpi_get_nvmd_resp()
3000 pm8001_ha->memoryMap.region[NVMD].virt_ptr, in pm8001_mpi_get_nvmd_resp()
3001 fw_control_context->len); in pm8001_mpi_get_nvmd_resp()
3002 kfree(ccb->fw_control_context); in pm8001_mpi_get_nvmd_resp()
3005 * fw_control_context->usrAddr in pm8001_mpi_get_nvmd_resp()
3007 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_get_nvmd_resp()
3017 u32 status = le32_to_cpu(pPayload->status); in pm8001_mpi_local_phy_ctl()
3018 u32 phy_id = le32_to_cpu(pPayload->phyop_phyid) & ID_BITS; in pm8001_mpi_local_phy_ctl()
3019 u32 phy_op = le32_to_cpu(pPayload->phyop_phyid) & OP_BITS; in pm8001_mpi_local_phy_ctl()
3020 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_local_phy_ctl()
3023 "%x phy execute %x phy op failed!\n", in pm8001_mpi_local_phy_ctl()
3027 "%x phy execute %x phy op success!\n", in pm8001_mpi_local_phy_ctl()
3029 pm8001_ha->phy[phy_id].reset_success = true; in pm8001_mpi_local_phy_ctl()
3031 if (pm8001_ha->phy[phy_id].enable_completion) { in pm8001_mpi_local_phy_ctl()
3032 complete(pm8001_ha->phy[phy_id].enable_completion); in pm8001_mpi_local_phy_ctl()
3033 pm8001_ha->phy[phy_id].enable_completion = NULL; in pm8001_mpi_local_phy_ctl()
3040 * pm8001_bytes_dmaed - one of the interface function communication with libsas
3042 * @i: which phy that received the event.
3052 struct pm8001_phy *phy = &pm8001_ha->phy[i]; in pm8001_bytes_dmaed() local
3053 struct asd_sas_phy *sas_phy = &phy->sas_phy; in pm8001_bytes_dmaed()
3054 if (!phy->phy_attached) in pm8001_bytes_dmaed()
3057 if (phy->phy_type & PORT_TYPE_SAS) { in pm8001_bytes_dmaed()
3059 id = (struct sas_identify_frame *)phy->frame_rcvd; in pm8001_bytes_dmaed()
3060 id->dev_type = phy->identify.device_type; in pm8001_bytes_dmaed()
3061 id->initiator_bits = SAS_PROTOCOL_ALL; in pm8001_bytes_dmaed()
3062 id->target_bits = phy->identify.target_port_protocols; in pm8001_bytes_dmaed()
3063 } else if (phy->phy_type & PORT_TYPE_SATA) { in pm8001_bytes_dmaed()
3066 pm8001_dbg(pm8001_ha, MSG, "phy %d byte dmaded.\n", i); in pm8001_bytes_dmaed()
3068 sas_phy->frame_rcvd_size = phy->frame_rcvd_size; in pm8001_bytes_dmaed()
3073 void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate) in pm8001_get_lrate_mode() argument
3075 struct sas_phy *sas_phy = phy->sas_phy.phy; in pm8001_get_lrate_mode()
3079 phy->sas_phy.linkrate = SAS_LINK_RATE_12_0_GBPS; in pm8001_get_lrate_mode()
3082 phy->sas_phy.linkrate = SAS_LINK_RATE_6_0_GBPS; in pm8001_get_lrate_mode()
3085 phy->sas_phy.linkrate = SAS_LINK_RATE_3_0_GBPS; in pm8001_get_lrate_mode()
3088 phy->sas_phy.linkrate = SAS_LINK_RATE_1_5_GBPS; in pm8001_get_lrate_mode()
3091 sas_phy->negotiated_linkrate = phy->sas_phy.linkrate; in pm8001_get_lrate_mode()
3092 sas_phy->maximum_linkrate_hw = phy->maximum_linkrate; in pm8001_get_lrate_mode()
3093 sas_phy->minimum_linkrate_hw = SAS_LINK_RATE_1_5_GBPS; in pm8001_get_lrate_mode()
3094 sas_phy->maximum_linkrate = phy->maximum_linkrate; in pm8001_get_lrate_mode()
3095 sas_phy->minimum_linkrate = phy->minimum_linkrate; in pm8001_get_lrate_mode()
3099 * pm8001_get_attached_sas_addr - extract/generate attached SAS address
3100 * @phy: pointer to asd_phy
3110 void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, in pm8001_get_attached_sas_addr() argument
3113 if (phy->sas_phy.frame_rcvd[0] == 0x34 in pm8001_get_attached_sas_addr()
3114 && phy->sas_phy.oob_mode == SATA_OOB_MODE) { in pm8001_get_attached_sas_addr()
3115 struct pm8001_hba_info *pm8001_ha = phy->sas_phy.ha->lldd_ha; in pm8001_get_attached_sas_addr()
3116 /* FIS device-to-host */ in pm8001_get_attached_sas_addr()
3117 u64 addr = be64_to_cpu(*(__be64 *)pm8001_ha->sas_addr); in pm8001_get_attached_sas_addr()
3118 addr += phy->sas_phy.id; in pm8001_get_attached_sas_addr()
3122 (void *) phy->sas_phy.frame_rcvd; in pm8001_get_attached_sas_addr()
3123 memcpy(sas_addr, idframe->sas_addr, SAS_ADDR_SIZE); in pm8001_get_attached_sas_addr()
3128 * pm8001_hw_event_ack_req- For PM8001,some events need to acknowage to FW.
3133 * @phyId: phy id.
3157 * hw_event_sas_phy_up -FW tells me a SAS phy up event.
3167 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in hw_event_sas_phy_up()
3173 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); in hw_event_sas_phy_up()
3175 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_sas_phy_up()
3176 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_sas_phy_up() local
3178 u8 deviceType = pPayload->sas_identify.dev_type; in hw_event_sas_phy_up()
3179 phy->port = port; in hw_event_sas_phy_up()
3180 port->port_id = port_id; in hw_event_sas_phy_up()
3181 port->port_state = portstate; in hw_event_sas_phy_up()
3182 phy->phy_state = PHY_STATE_LINK_UP_SPC; in hw_event_sas_phy_up()
3184 "HW_EVENT_SAS_PHY_UP port id = %d, phy id = %d\n", in hw_event_sas_phy_up()
3195 port->port_attached = 1; in hw_event_sas_phy_up()
3196 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3200 port->port_attached = 1; in hw_event_sas_phy_up()
3201 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3205 port->port_attached = 1; in hw_event_sas_phy_up()
3206 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3213 phy->phy_type |= PORT_TYPE_SAS; in hw_event_sas_phy_up()
3214 phy->identify.device_type = deviceType; in hw_event_sas_phy_up()
3215 phy->phy_attached = 1; in hw_event_sas_phy_up()
3216 if (phy->identify.device_type == SAS_END_DEVICE) in hw_event_sas_phy_up()
3217 phy->identify.target_port_protocols = SAS_PROTOCOL_SSP; in hw_event_sas_phy_up()
3218 else if (phy->identify.device_type != SAS_PHY_UNUSED) in hw_event_sas_phy_up()
3219 phy->identify.target_port_protocols = SAS_PROTOCOL_SMP; in hw_event_sas_phy_up()
3220 phy->sas_phy.oob_mode = SAS_OOB_MODE; in hw_event_sas_phy_up()
3221 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC); in hw_event_sas_phy_up()
3222 spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sas_phy_up()
3223 memcpy(phy->frame_rcvd, &pPayload->sas_identify, in hw_event_sas_phy_up()
3224 sizeof(struct sas_identify_frame)-4); in hw_event_sas_phy_up()
3225 phy->frame_rcvd_size = sizeof(struct sas_identify_frame) - 4; in hw_event_sas_phy_up()
3226 pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); in hw_event_sas_phy_up()
3227 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sas_phy_up()
3228 if (pm8001_ha->flags == PM8001F_RUN_TIME) in hw_event_sas_phy_up()
3234 * hw_event_sata_phy_up -FW tells me a SATA phy up event.
3244 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in hw_event_sata_phy_up()
3250 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); in hw_event_sata_phy_up()
3252 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_sata_phy_up()
3253 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_sata_phy_up() local
3255 pm8001_dbg(pm8001_ha, DEVIO, "HW_EVENT_SATA_PHY_UP port id = %d, phy id = %d\n", in hw_event_sata_phy_up()
3257 phy->port = port; in hw_event_sata_phy_up()
3258 port->port_id = port_id; in hw_event_sata_phy_up()
3259 port->port_state = portstate; in hw_event_sata_phy_up()
3260 phy->phy_state = PHY_STATE_LINK_UP_SPC; in hw_event_sata_phy_up()
3261 port->port_attached = 1; in hw_event_sata_phy_up()
3262 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sata_phy_up()
3263 phy->phy_type |= PORT_TYPE_SATA; in hw_event_sata_phy_up()
3264 phy->phy_attached = 1; in hw_event_sata_phy_up()
3265 phy->sas_phy.oob_mode = SATA_OOB_MODE; in hw_event_sata_phy_up()
3266 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC); in hw_event_sata_phy_up()
3267 spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sata_phy_up()
3268 memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4), in hw_event_sata_phy_up()
3270 phy->frame_rcvd_size = sizeof(struct dev_to_host_fis); in hw_event_sata_phy_up()
3271 phy->identify.target_port_protocols = SAS_PROTOCOL_SATA; in hw_event_sata_phy_up()
3272 phy->identify.device_type = SAS_SATA_DEV; in hw_event_sata_phy_up()
3273 pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); in hw_event_sata_phy_up()
3274 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sata_phy_up()
3279 * hw_event_phy_down -we should notify the libsas the phy is down.
3289 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in hw_event_phy_down()
3293 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); in hw_event_phy_down()
3295 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_phy_down()
3296 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_phy_down() local
3297 port->port_state = portstate; in hw_event_phy_down()
3298 phy->phy_type = 0; in hw_event_phy_down()
3299 phy->identify.device_type = 0; in hw_event_phy_down()
3300 phy->phy_attached = 0; in hw_event_phy_down()
3301 memset(&phy->dev_sas_addr, 0, SAS_ADDR_SIZE); in hw_event_phy_down()
3309 " Last phy Down and port invalid\n"); in hw_event_phy_down()
3310 port->port_attached = 0; in hw_event_phy_down()
3320 " phy Down and PORT_NOT_ESTABLISHED\n"); in hw_event_phy_down()
3321 port->port_attached = 0; in hw_event_phy_down()
3324 pm8001_dbg(pm8001_ha, MSG, " phy Down and PORT_LOSTCOMM\n"); in hw_event_phy_down()
3326 " Last phy Down and port invalid\n"); in hw_event_phy_down()
3327 port->port_attached = 0; in hw_event_phy_down()
3332 port->port_attached = 0; in hw_event_phy_down()
3333 pm8001_dbg(pm8001_ha, DEVIO, " phy Down and(default) = %x\n", in hw_event_phy_down()
3341 * pm8001_mpi_reg_resp -process register device ID response.
3347 * has assigned, from now, inter-communication with FW is no longer using the
3360 htag = le32_to_cpu(registerRespPayload->tag); in pm8001_mpi_reg_resp()
3361 ccb = &pm8001_ha->ccb_info[htag]; in pm8001_mpi_reg_resp()
3362 pm8001_dev = ccb->device; in pm8001_mpi_reg_resp()
3363 status = le32_to_cpu(registerRespPayload->status); in pm8001_mpi_reg_resp()
3364 device_id = le32_to_cpu(registerRespPayload->device_id); in pm8001_mpi_reg_resp()
3367 status, pm8001_dev->attached_phy, device_id); in pm8001_mpi_reg_resp()
3371 pm8001_dev->device_id = device_id; in pm8001_mpi_reg_resp()
3404 complete(pm8001_dev->dcompletion); in pm8001_mpi_reg_resp()
3416 status = le32_to_cpu(registerRespPayload->status); in pm8001_mpi_dereg_resp()
3417 device_id = le32_to_cpu(registerRespPayload->device_id); in pm8001_mpi_dereg_resp()
3426 * pm8001_mpi_fw_flash_update_resp - Response from FW for flash update command.
3436 u32 tag = le32_to_cpu(ppayload->tag); in pm8001_mpi_fw_flash_update_resp()
3437 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_fw_flash_update_resp()
3439 status = le32_to_cpu(ppayload->status); in pm8001_mpi_fw_flash_update_resp()
3475 kfree(ccb->fw_control_context); in pm8001_mpi_fw_flash_update_resp()
3477 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_fw_flash_update_resp()
3487 status = le32_to_cpu(pPayload->status); in pm8001_mpi_general_event()
3492 pPayload->inb_IOMB_payload[i]); in pm8001_mpi_general_event()
3498 struct sas_task *t; in pm8001_mpi_task_abort_resp() local
3509 status = le32_to_cpu(pPayload->status); in pm8001_mpi_task_abort_resp()
3510 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_task_abort_resp()
3512 scp = le32_to_cpu(pPayload->scp); in pm8001_mpi_task_abort_resp()
3513 ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_task_abort_resp()
3514 t = ccb->task; in pm8001_mpi_task_abort_resp()
3515 pm8001_dev = ccb->device; /* retrieve device */ in pm8001_mpi_task_abort_resp()
3517 if (!t) { in pm8001_mpi_task_abort_resp()
3519 return -1; in pm8001_mpi_task_abort_resp()
3522 if (t->task_proto == SAS_PROTOCOL_INTERNAL_ABORT) in pm8001_mpi_task_abort_resp()
3523 atomic_dec(&pm8001_dev->running_req); in pm8001_mpi_task_abort_resp()
3525 ts = &t->task_status; in pm8001_mpi_task_abort_resp()
3532 ts->resp = SAS_TASK_COMPLETE; in pm8001_mpi_task_abort_resp()
3533 ts->stat = SAS_SAM_STAT_GOOD; in pm8001_mpi_task_abort_resp()
3537 ts->resp = TMF_RESP_FUNC_FAILED; in pm8001_mpi_task_abort_resp()
3540 spin_lock_irqsave(&t->task_state_lock, flags); in pm8001_mpi_task_abort_resp()
3541 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in pm8001_mpi_task_abort_resp()
3542 t->task_state_flags |= SAS_TASK_STATE_DONE; in pm8001_mpi_task_abort_resp()
3543 spin_unlock_irqrestore(&t->task_state_lock, flags); in pm8001_mpi_task_abort_resp()
3547 t->task_done(t); in pm8001_mpi_task_abort_resp()
3553 * mpi_hw_event -The hw event has come.
3563 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in mpi_hw_event()
3571 struct sas_ha_struct *sas_ha = pm8001_ha->sas; in mpi_hw_event()
3572 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in mpi_hw_event() local
3573 struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; in mpi_hw_event()
3582 phy->phy_state = 1; in mpi_hw_event()
3584 if (pm8001_ha->flags == PM8001F_RUN_TIME && in mpi_hw_event()
3585 phy->enable_completion != NULL) { in mpi_hw_event()
3586 complete(phy->enable_completion); in mpi_hw_event()
3587 phy->enable_completion = NULL; in mpi_hw_event()
3602 phy->phy_state = 0; in mpi_hw_event()
3606 sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD, in mpi_hw_event()
3611 sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL, in mpi_hw_event()
3613 phy->phy_attached = 0; in mpi_hw_event()
3614 phy->phy_state = 0; in mpi_hw_event()
3620 phy->phy_attached = 0; in mpi_hw_event()
3630 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3631 sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE; in mpi_hw_event()
3632 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3638 sas_phy_disconnected(&phy->sas_phy); in mpi_hw_event()
3639 phy->phy_attached = 0; in mpi_hw_event()
3640 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC); in mpi_hw_event()
3644 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3645 sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP; in mpi_hw_event()
3646 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3656 phy->phy_attached = 0; in mpi_hw_event()
3667 phy->phy_attached = 0; in mpi_hw_event()
3678 phy->phy_attached = 0; in mpi_hw_event()
3689 phy->phy_attached = 0; in mpi_hw_event()
3698 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3699 sas_phy->sas_prim = HW_EVENT_BROADCAST_SES; in mpi_hw_event()
3700 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3717 phy->phy_attached = 0; in mpi_hw_event()
3728 phy->phy_attached = 0; in mpi_hw_event()
3735 phy->phy_attached = 0; in mpi_hw_event()
3743 phy->phy_attached = 0; in mpi_hw_event()
3765 * process_one_iomb - process one outbound Queue memory block
3912 spin_lock_irqsave(&pm8001_ha->lock, flags); in process_oq()
3913 circularQ = &pm8001_ha->outbnd_q_tbl[vec]; in process_oq()
3918 process_one_iomb(pm8001_ha, (void *)(pMsg1 - 4)); in process_oq()
3925 circularQ->producer_index = in process_oq()
3926 cpu_to_le32(pm8001_read_32(circularQ->pi_virt)); in process_oq()
3927 if (le32_to_cpu(circularQ->producer_index) == in process_oq()
3928 circularQ->consumer_idx) in process_oq()
3933 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in process_oq()
3952 buf_prd->addr = cpu_to_le64(sg_dma_address(sg)); in pm8001_chip_make_sg()
3953 buf_prd->im_len.len = cpu_to_le32(sg_dma_len(sg)); in pm8001_chip_make_sg()
3954 buf_prd->im_len.e = 0; in pm8001_chip_make_sg()
3961 psmp_cmd->tag = hTag; in build_smp_cmd()
3962 psmp_cmd->device_id = cpu_to_le32(deviceID); in build_smp_cmd()
3963 psmp_cmd->len_ip_ir = cpu_to_le32(1|(1 << 1)); in build_smp_cmd()
3967 * pm8001_chip_smp_req - send a SMP task to FW
3975 struct sas_task *task = ccb->task; in pm8001_chip_smp_req()
3976 struct domain_device *dev = task->dev; in pm8001_chip_smp_req()
3977 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm8001_chip_smp_req()
3985 * DMA-map SMP request, response buffers in pm8001_chip_smp_req()
3987 sg_req = &task->smp_task.smp_req; in pm8001_chip_smp_req()
3988 elem = dma_map_sg(pm8001_ha->dev, sg_req, 1, DMA_TO_DEVICE); in pm8001_chip_smp_req()
3990 return -ENOMEM; in pm8001_chip_smp_req()
3993 sg_resp = &task->smp_task.smp_resp; in pm8001_chip_smp_req()
3994 elem = dma_map_sg(pm8001_ha->dev, sg_resp, 1, DMA_FROM_DEVICE); in pm8001_chip_smp_req()
3996 rc = -ENOMEM; in pm8001_chip_smp_req()
4002 rc = -EINVAL; in pm8001_chip_smp_req()
4007 smp_cmd.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_smp_req()
4009 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req)); in pm8001_chip_smp_req()
4011 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_req)-4); in pm8001_chip_smp_req()
4013 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_resp)); in pm8001_chip_smp_req()
4015 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4); in pm8001_chip_smp_req()
4016 build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, &smp_cmd); in pm8001_chip_smp_req()
4025 dma_unmap_sg(pm8001_ha->dev, &ccb->task->smp_task.smp_resp, 1, in pm8001_chip_smp_req()
4028 dma_unmap_sg(pm8001_ha->dev, &ccb->task->smp_task.smp_req, 1, in pm8001_chip_smp_req()
4034 * pm8001_chip_ssp_io_req - send a SSP task to FW
4041 struct sas_task *task = ccb->task; in pm8001_chip_ssp_io_req()
4042 struct domain_device *dev = task->dev; in pm8001_chip_ssp_io_req()
4043 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm8001_chip_ssp_io_req()
4045 u32 tag = ccb->ccb_tag; in pm8001_chip_ssp_io_req()
4049 memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); in pm8001_chip_ssp_io_req()
4051 cpu_to_le32(data_dir_flags[task->data_dir] << 8 | 0x0);/*0 for in pm8001_chip_ssp_io_req()
4053 ssp_cmd.data_len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_ssp_io_req()
4054 ssp_cmd.device_id = cpu_to_le32(pm8001_dev->device_id); in pm8001_chip_ssp_io_req()
4056 ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); in pm8001_chip_ssp_io_req()
4057 memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, in pm8001_chip_ssp_io_req()
4058 task->ssp_task.cmd->cmd_len); in pm8001_chip_ssp_io_req()
4061 if (task->num_scatter > 1) { in pm8001_chip_ssp_io_req()
4062 pm8001_chip_make_sg(task->scatter, ccb->n_elem, ccb->buf_prd); in pm8001_chip_ssp_io_req()
4063 phys_addr = ccb->ccb_dma_handle; in pm8001_chip_ssp_io_req()
4067 } else if (task->num_scatter == 1) { in pm8001_chip_ssp_io_req()
4068 u64 dma_addr = sg_dma_address(task->scatter); in pm8001_chip_ssp_io_req()
4071 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_ssp_io_req()
4073 } else if (task->num_scatter == 0) { in pm8001_chip_ssp_io_req()
4076 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_ssp_io_req()
4087 struct sas_task *task = ccb->task; in pm8001_chip_sata_req()
4088 struct domain_device *dev = task->dev; in pm8001_chip_sata_req()
4089 struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; in pm8001_chip_sata_req()
4090 u32 tag = ccb->ccb_tag; in pm8001_chip_sata_req()
4100 if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { in pm8001_chip_sata_req()
4103 } else if (likely(!task->ata_task.device_control_reg_update)) { in pm8001_chip_sata_req()
4104 if (task->ata_task.use_ncq && in pm8001_chip_sata_req()
4105 dev->sata_dev.class != ATA_DEV_ATAPI) { in pm8001_chip_sata_req()
4108 } else if (task->ata_task.dma_xfer) { in pm8001_chip_sata_req()
4116 if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) { in pm8001_chip_sata_req()
4117 task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); in pm8001_chip_sata_req()
4120 dir = data_dir_flags[task->data_dir] << 8; in pm8001_chip_sata_req()
4122 sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); in pm8001_chip_sata_req()
4123 sata_cmd.data_len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_sata_req()
4124 if (task->ata_task.return_fis_on_success) in pm8001_chip_sata_req()
4129 sata_cmd.sata_fis = task->ata_task.fis; in pm8001_chip_sata_req()
4130 if (likely(!task->ata_task.device_control_reg_update)) in pm8001_chip_sata_req()
4134 if (task->num_scatter > 1) { in pm8001_chip_sata_req()
4135 pm8001_chip_make_sg(task->scatter, ccb->n_elem, ccb->buf_prd); in pm8001_chip_sata_req()
4136 phys_addr = ccb->ccb_dma_handle; in pm8001_chip_sata_req()
4140 } else if (task->num_scatter == 1) { in pm8001_chip_sata_req()
4141 u64 dma_addr = sg_dma_address(task->scatter); in pm8001_chip_sata_req()
4144 sata_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_sata_req()
4146 } else if (task->num_scatter == 0) { in pm8001_chip_sata_req()
4149 sata_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_sata_req()
4158 * pm8001_chip_phy_start_req - start phy via PHY_START COMMAND
4160 * @phy_id: the phy id which we wanted to start up.
4172 ** [0:7] PHY Identifier in pm8001_chip_phy_start_req()
4183 &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE); in pm8001_chip_phy_start_req()
4191 * pm8001_chip_phy_stop_req - start phy via PHY_STOP COMMAND
4193 * @phy_id: the phy id which we wanted to start up.
4225 struct domain_device *dev = pm8001_dev->sas_device; in pm8001_chip_reg_dev_req()
4226 struct domain_device *parent_dev = dev->parent; in pm8001_chip_reg_dev_req()
4227 struct pm8001_port *port = dev->port->lldd_port; in pm8001_chip_reg_dev_req()
4232 return -SAS_QUEUE_FULL; in pm8001_chip_reg_dev_req()
4234 payload.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_reg_dev_req()
4238 if (pm8001_dev->dev_type == SAS_SATA_DEV) in pm8001_chip_reg_dev_req()
4240 else if (pm8001_dev->dev_type == SAS_END_DEVICE || in pm8001_chip_reg_dev_req()
4241 dev_is_expander(pm8001_dev->dev_type)) in pm8001_chip_reg_dev_req()
4244 if (parent_dev && dev_is_expander(parent_dev->dev_type)) in pm8001_chip_reg_dev_req()
4245 phy_id = parent_dev->ex_dev.ex_phy->phy_id; in pm8001_chip_reg_dev_req()
4247 phy_id = pm8001_dev->attached_phy; in pm8001_chip_reg_dev_req()
4249 linkrate = (pm8001_dev->sas_device->linkrate < dev->port->linkrate) ? in pm8001_chip_reg_dev_req()
4250 pm8001_dev->sas_device->linkrate : dev->port->linkrate; in pm8001_chip_reg_dev_req()
4252 cpu_to_le32(((port->port_id) & 0x0F) | in pm8001_chip_reg_dev_req()
4259 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr, in pm8001_chip_reg_dev_req()
4290 * pm8001_chip_phy_ctl_req - support the local phy operation
4292 * @phyId: the phy id which we wanted to operate
4293 * @phy_op: the phy operation to request
4325 * pm8001_chip_isr - PM8001 isr handler.
4356 return -EIO; in send_task_abort()
4366 * pm8001_chip_abort_task - SAS abort task when error or exception happened.
4371 struct sas_task *task = ccb->task; in pm8001_chip_abort_task()
4372 struct sas_internal_abort_task *abort = &task->abort_task; in pm8001_chip_abort_task()
4373 struct pm8001_device *pm8001_dev = ccb->device; in pm8001_chip_abort_task()
4378 ccb->ccb_tag, abort->tag); in pm8001_chip_abort_task()
4379 if (pm8001_dev->dev_type == SAS_END_DEVICE) in pm8001_chip_abort_task()
4381 else if (pm8001_dev->dev_type == SAS_SATA_DEV) in pm8001_chip_abort_task()
4385 device_id = pm8001_dev->device_id; in pm8001_chip_abort_task()
4386 rc = send_task_abort(pm8001_ha, opc, device_id, abort->type, in pm8001_chip_abort_task()
4387 abort->tag, ccb->ccb_tag); in pm8001_chip_abort_task()
4394 * pm8001_chip_ssp_tm_req - built the task management command.
4402 struct sas_task *task = ccb->task; in pm8001_chip_ssp_tm_req()
4403 struct domain_device *dev = task->dev; in pm8001_chip_ssp_tm_req()
4404 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm8001_chip_ssp_tm_req()
4409 sspTMCmd.device_id = cpu_to_le32(pm8001_dev->device_id); in pm8001_chip_ssp_tm_req()
4410 sspTMCmd.relate_tag = cpu_to_le32((u32)tmf->tag_of_task_to_be_managed); in pm8001_chip_ssp_tm_req()
4411 sspTMCmd.tmf = cpu_to_le32(tmf->tmf); in pm8001_chip_ssp_tm_req()
4412 memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); in pm8001_chip_ssp_tm_req()
4413 sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_ssp_tm_req()
4414 if (pm8001_ha->chip_id != chip_8001) in pm8001_chip_ssp_tm_req()
4432 nvmd_type = ioctl_payload->minor_function; in pm8001_chip_get_nvmd_req()
4435 return -ENOMEM; in pm8001_chip_get_nvmd_req()
4436 fw_control_context->usrAddr = (u8 *)ioctl_payload->func_specific; in pm8001_chip_get_nvmd_req()
4437 fw_control_context->len = ioctl_payload->rd_length; in pm8001_chip_get_nvmd_req()
4443 return -SAS_QUEUE_FULL; in pm8001_chip_get_nvmd_req()
4445 ccb->fw_control_context = fw_control_context; in pm8001_chip_get_nvmd_req()
4447 nvmd_req.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_get_nvmd_req()
4457 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4459 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4461 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4466 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4468 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4470 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4475 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4477 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4479 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4484 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4486 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4488 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4493 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4494 nvmd_req.vpd_offset = cpu_to_le32(ioctl_payload->offset); in pm8001_chip_get_nvmd_req()
4496 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4498 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4525 nvmd_type = ioctl_payload->minor_function; in pm8001_chip_set_nvmd_req()
4528 return -ENOMEM; in pm8001_chip_set_nvmd_req()
4530 memcpy(pm8001_ha->memoryMap.region[NVMD].virt_ptr, in pm8001_chip_set_nvmd_req()
4531 &ioctl_payload->func_specific, in pm8001_chip_set_nvmd_req()
4532 ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4538 return -SAS_QUEUE_FULL; in pm8001_chip_set_nvmd_req()
4540 ccb->fw_control_context = fw_control_context; in pm8001_chip_set_nvmd_req()
4542 nvmd_req.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_set_nvmd_req()
4551 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4553 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4555 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4560 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4563 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4565 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4569 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4572 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4574 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4578 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4581 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4583 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4599 * pm8001_chip_fw_flash_update_build - support the firmware update operation
4615 payload.cur_image_len = cpu_to_le32(info->cur_image_len); in pm8001_chip_fw_flash_update_build()
4616 payload.cur_image_offset = cpu_to_le32(info->cur_image_offset); in pm8001_chip_fw_flash_update_build()
4617 payload.total_image_len = cpu_to_le32(info->total_image_len); in pm8001_chip_fw_flash_update_build()
4618 payload.len = info->sgl.im_len.len ; in pm8001_chip_fw_flash_update_build()
4620 cpu_to_le32(lower_32_bits(le64_to_cpu(info->sgl.addr))); in pm8001_chip_fw_flash_update_build()
4622 cpu_to_le32(upper_32_bits(le64_to_cpu(info->sgl.addr))); in pm8001_chip_fw_flash_update_build()
4637 void *buffer = pm8001_ha->memoryMap.region[FW_FLASH].virt_ptr; in pm8001_chip_fw_flash_update_req()
4638 dma_addr_t phys_addr = pm8001_ha->memoryMap.region[FW_FLASH].phys_addr; in pm8001_chip_fw_flash_update_req()
4643 return -ENOMEM; in pm8001_chip_fw_flash_update_req()
4644 fw_control = (struct fw_control_info *)&ioctl_payload->func_specific; in pm8001_chip_fw_flash_update_req()
4647 fw_control->len); in pm8001_chip_fw_flash_update_req()
4648 memcpy(buffer, fw_control->buffer, fw_control->len); in pm8001_chip_fw_flash_update_req()
4650 flash_update_info.sgl.im_len.len = cpu_to_le32(fw_control->len); in pm8001_chip_fw_flash_update_req()
4652 flash_update_info.cur_image_offset = fw_control->offset; in pm8001_chip_fw_flash_update_req()
4653 flash_update_info.cur_image_len = fw_control->len; in pm8001_chip_fw_flash_update_req()
4654 flash_update_info.total_image_len = fw_control->size; in pm8001_chip_fw_flash_update_req()
4655 fw_control_context->fw_control = fw_control; in pm8001_chip_fw_flash_update_req()
4656 fw_control_context->virtAddr = buffer; in pm8001_chip_fw_flash_update_req()
4657 fw_control_context->phys_addr = phys_addr; in pm8001_chip_fw_flash_update_req()
4658 fw_control_context->len = fw_control->len; in pm8001_chip_fw_flash_update_req()
4663 return -SAS_QUEUE_FULL; in pm8001_chip_fw_flash_update_req()
4665 ccb->fw_control_context = fw_control_context; in pm8001_chip_fw_flash_update_req()
4668 ccb->ccb_tag); in pm8001_chip_fw_flash_update_req()
4686 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_get_gsm_dump()
4689 gsm_dump_offset = pm8001_ha->fatal_forensic_shift_offset; in pm8001_get_gsm_dump()
4694 return -EINVAL; in pm8001_get_gsm_dump()
4696 if (pm8001_ha->chip_id == chip_8001) in pm8001_get_gsm_dump()
4710 if (pm8001_ha->chip_id == chip_8001) in pm8001_get_gsm_dump()
4718 if (pm8001_ha->chip_id == chip_8001) { in pm8001_get_gsm_dump()
4720 if (-1 == pm8001_bar4_shift(pm8001_ha, in pm8001_get_gsm_dump()
4722 return -EIO; in pm8001_get_gsm_dump()
4725 if (-1 == pm80xx_bar4_shift(pm8001_ha, in pm8001_get_gsm_dump()
4727 return -EIO; in pm8001_get_gsm_dump()
4746 if (-1 == pm8001_bar4_shift(pm8001_ha, 0)) in pm8001_get_gsm_dump()
4747 return -EIO; in pm8001_get_gsm_dump()
4748 pm8001_ha->fatal_forensic_shift_offset += 1024; in pm8001_get_gsm_dump()
4750 if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000) in pm8001_get_gsm_dump()
4751 pm8001_ha->fatal_forensic_shift_offset = 0; in pm8001_get_gsm_dump()
4752 return direct_data - buf; in pm8001_get_gsm_dump()
4768 return -SAS_QUEUE_FULL; in pm8001_chip_set_dev_state_req()
4770 payload.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_set_dev_state_req()
4771 payload.device_id = cpu_to_le32(pm8001_dev->device_id); in pm8001_chip_set_dev_state_req()
4794 return -SAS_QUEUE_FULL; in pm8001_chip_sas_re_initialization()
4796 payload.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_sas_re_initialization()