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()
1184 * pm8001_chip_interrupt_enable - enable PM8001 chip interrupt
1191 if (pm8001_ha->use_msix) { in pm8001_chip_interrupt_enable()
1202 * pm8001_chip_interrupt_disable - disable PM8001 chip interrupt
1209 if (pm8001_ha->use_msix) in pm8001_chip_interrupt_disable()
1217 * pm8001_mpi_msg_free_get - get the free message buffer for transfer
1233 return -1; in pm8001_mpi_msg_free_get()
1237 consumer_index = pm8001_read_32(circularQ->ci_virt); in pm8001_mpi_msg_free_get()
1238 circularQ->consumer_index = cpu_to_le32(consumer_index); in pm8001_mpi_msg_free_get()
1239 if (((circularQ->producer_idx + bcCount) % PM8001_MPI_QUEUE) == in pm8001_mpi_msg_free_get()
1240 le32_to_cpu(circularQ->consumer_index)) { in pm8001_mpi_msg_free_get()
1242 return -1; in pm8001_mpi_msg_free_get()
1245 offset = circularQ->producer_idx * messageSize; in pm8001_mpi_msg_free_get()
1247 circularQ->producer_idx = (circularQ->producer_idx + bcCount) in pm8001_mpi_msg_free_get()
1251 msgHeader = (struct mpi_msg_hdr *)(circularQ->base_virt + offset); in pm8001_mpi_msg_free_get()
1257 * pm8001_mpi_build_cmd- build the message queue for transfer, update the PI to
1273 struct inbound_queue_table *circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; in pm8001_mpi_build_cmd()
1277 trace_pm80xx_mpi_build_cmd(pm8001_ha->id, opCode, htag, q_index, in pm8001_mpi_build_cmd()
1278 circularQ->producer_idx, le32_to_cpu(circularQ->consumer_index)); in pm8001_mpi_build_cmd()
1280 if (WARN_ON(q_index >= pm8001_ha->max_q_num)) in pm8001_mpi_build_cmd()
1281 return -EINVAL; in pm8001_mpi_build_cmd()
1283 spin_lock_irqsave(&circularQ->iq_lock, flags); in pm8001_mpi_build_cmd()
1284 rv = pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size, in pm8001_mpi_build_cmd()
1288 rv = -ENOMEM; in pm8001_mpi_build_cmd()
1292 if (nb > (pm8001_ha->iomb_size - sizeof(struct mpi_msg_hdr))) in pm8001_mpi_build_cmd()
1293 nb = pm8001_ha->iomb_size - sizeof(struct mpi_msg_hdr); in pm8001_mpi_build_cmd()
1295 if (nb + sizeof(struct mpi_msg_hdr) < pm8001_ha->iomb_size) in pm8001_mpi_build_cmd()
1296 memset(pMessage + nb, 0, pm8001_ha->iomb_size - in pm8001_mpi_build_cmd()
1304 pm8001_write_32((pMessage - 4), 0, cpu_to_le32(Header)); in pm8001_mpi_build_cmd()
1306 pm8001_cw32(pm8001_ha, circularQ->pi_pci_bar, in pm8001_mpi_build_cmd()
1307 circularQ->pi_offset, circularQ->producer_idx); in pm8001_mpi_build_cmd()
1310 responseQueue, opCode, circularQ->producer_idx, in pm8001_mpi_build_cmd()
1311 circularQ->consumer_index); in pm8001_mpi_build_cmd()
1313 spin_unlock_irqrestore(&circularQ->iq_lock, flags); in pm8001_mpi_build_cmd()
1324 msgHeader = (struct mpi_msg_hdr *)(pMsg - sizeof(struct mpi_msg_hdr)); in pm8001_mpi_msg_free_set()
1325 pOutBoundMsgHeader = (struct mpi_msg_hdr *)(circularQ->base_virt + in pm8001_mpi_msg_free_set()
1326 circularQ->consumer_idx * pm8001_ha->iomb_size); in pm8001_mpi_msg_free_set()
1330 circularQ->consumer_idx, msgHeader); in pm8001_mpi_msg_free_set()
1333 producer_index = pm8001_read_32(circularQ->pi_virt); in pm8001_mpi_msg_free_set()
1334 circularQ->producer_index = cpu_to_le32(producer_index); in pm8001_mpi_msg_free_set()
1337 circularQ->consumer_idx, in pm8001_mpi_msg_free_set()
1338 circularQ->producer_index, msgHeader); in pm8001_mpi_msg_free_set()
1342 circularQ->consumer_idx = (circularQ->consumer_idx + bc) in pm8001_mpi_msg_free_set()
1345 pm8001_cw32(pm8001_ha, circularQ->ci_pci_bar, circularQ->ci_offset, in pm8001_mpi_msg_free_set()
1346 circularQ->consumer_idx); in pm8001_mpi_msg_free_set()
1348 producer_index = pm8001_read_32(circularQ->pi_virt); in pm8001_mpi_msg_free_set()
1349 circularQ->producer_index = cpu_to_le32(producer_index); in pm8001_mpi_msg_free_set()
1351 circularQ->consumer_idx, circularQ->producer_index); in pm8001_mpi_msg_free_set()
1356 * pm8001_mpi_msg_consume- get the MPI message from outbound queue
1371 /* If there are not-yet-delivered messages ... */ in pm8001_mpi_msg_consume()
1372 if (le32_to_cpu(circularQ->producer_index) in pm8001_mpi_msg_consume()
1373 != circularQ->consumer_idx) { in pm8001_mpi_msg_consume()
1376 (circularQ->base_virt + in pm8001_mpi_msg_consume()
1377 circularQ->consumer_idx * pm8001_ha->iomb_size); in pm8001_mpi_msg_consume()
1383 msgHeader_tmp, circularQ->consumer_idx, in pm8001_mpi_msg_consume()
1384 circularQ->producer_index); in pm8001_mpi_msg_consume()
1395 circularQ->consumer_idx, in pm8001_mpi_msg_consume()
1396 circularQ->producer_index, in pm8001_mpi_msg_consume()
1400 circularQ->consumer_idx = in pm8001_mpi_msg_consume()
1401 (circularQ->consumer_idx + in pm8001_mpi_msg_consume()
1409 circularQ->ci_pci_bar, in pm8001_mpi_msg_consume()
1410 circularQ->ci_offset, in pm8001_mpi_msg_consume()
1411 circularQ->consumer_idx); in pm8001_mpi_msg_consume()
1414 circularQ->consumer_idx = in pm8001_mpi_msg_consume()
1415 (circularQ->consumer_idx + in pm8001_mpi_msg_consume()
1421 pm8001_cw32(pm8001_ha, circularQ->ci_pci_bar, in pm8001_mpi_msg_consume()
1422 circularQ->ci_offset, in pm8001_mpi_msg_consume()
1423 circularQ->consumer_idx); in pm8001_mpi_msg_consume()
1428 void *pi_virt = circularQ->pi_virt; in pm8001_mpi_msg_consume()
1430 * kexec-ing and driver doing a doorbell access in pm8001_mpi_msg_consume()
1431 * with the pre-kexec oq interrupt setup in pm8001_mpi_msg_consume()
1437 circularQ->producer_index = cpu_to_le32(producer_index); in pm8001_mpi_msg_consume()
1439 } while (le32_to_cpu(circularQ->producer_index) != in pm8001_mpi_msg_consume()
1440 circularQ->consumer_idx); in pm8001_mpi_msg_consume()
1441 /* while we don't have any more not-yet-delivered message */ in pm8001_mpi_msg_consume()
1458 if (pw->handler != IO_FATAL_ERROR) { in pm8001_work_fn()
1459 pm8001_dev = pw->data; /* Most stash device structure */ in pm8001_work_fn()
1461 || ((pw->handler != IO_XFER_ERROR_BREAK) in pm8001_work_fn()
1462 && (pm8001_dev->dev_type == SAS_PHY_UNUSED))) { in pm8001_work_fn()
1468 switch (pw->handler) { in pm8001_work_fn()
1471 struct sas_task *t = (struct sas_task *)pm8001_dev; in pm8001_work_fn() local
1473 struct pm8001_hba_info *pm8001_ha = pw->pm8001_ha; in pm8001_work_fn()
1478 if (pm8001_query_task(t) == TMF_RESP_FUNC_SUCC) in pm8001_work_fn()
1480 spin_lock_irqsave(&pm8001_ha->lock, flags); in pm8001_work_fn()
1482 spin_lock_irqsave(&t->task_state_lock, flags1); in pm8001_work_fn()
1483 if (unlikely((t->task_state_flags & SAS_TASK_STATE_DONE))) { in pm8001_work_fn()
1484 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1485 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1488 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1492 ccb = &pm8001_ha->ccb_info[i]; in pm8001_work_fn()
1493 if ((ccb->ccb_tag != PM8001_INVALID_TAG) && in pm8001_work_fn()
1494 (ccb->task == t)) in pm8001_work_fn()
1498 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1501 ts = &t->task_status; in pm8001_work_fn()
1502 ts->resp = SAS_TASK_COMPLETE; in pm8001_work_fn()
1504 ts->stat = SAS_QUEUE_FULL; in pm8001_work_fn()
1505 pm8001_dev = ccb->device; in pm8001_work_fn()
1507 atomic_dec(&pm8001_dev->running_req); in pm8001_work_fn()
1508 spin_lock_irqsave(&t->task_state_lock, flags1); in pm8001_work_fn()
1509 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in pm8001_work_fn()
1510 t->task_state_flags |= SAS_TASK_STATE_DONE; in pm8001_work_fn()
1511 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in pm8001_work_fn()
1512 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1514 t, pw->handler, ts->resp, ts->stat); in pm8001_work_fn()
1516 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1518 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1521 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1522 t->task_done(t); 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()
1535 ret = pm8001_query_task(t); in pm8001_work_fn()
1544 spin_lock_irqsave(&pm8001_ha->lock, flags); in pm8001_work_fn()
1546 spin_lock_irqsave(&t->task_state_lock, flags1); in pm8001_work_fn()
1548 if (unlikely((t->task_state_flags & SAS_TASK_STATE_DONE))) { in pm8001_work_fn()
1549 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1550 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1552 (void)pm8001_abort_task(t); in pm8001_work_fn()
1556 spin_unlock_irqrestore(&t->task_state_lock, flags1); in pm8001_work_fn()
1560 ccb = &pm8001_ha->ccb_info[i]; in pm8001_work_fn()
1561 if ((ccb->ccb_tag != PM8001_INVALID_TAG) && in pm8001_work_fn()
1562 (ccb->task == t)) in pm8001_work_fn()
1566 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1568 (void)pm8001_abort_task(t); in pm8001_work_fn()
1572 pm8001_dev = ccb->device; in pm8001_work_fn()
1573 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1577 ccb->open_retry = 1; /* Snub completion */ in pm8001_work_fn()
1578 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1579 ret = pm8001_abort_task(t); in pm8001_work_fn()
1580 ccb->open_retry = 0; in pm8001_work_fn()
1587 pm8001_dbg(pm8001_ha, IO, "...Reset phy\n"); in pm8001_work_fn()
1594 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1599 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in pm8001_work_fn()
1601 pm8001_dbg(pm8001_ha, IO, "...Reset phy\n"); in pm8001_work_fn()
1606 t = NULL; in pm8001_work_fn()
1607 pm8001_open_reject_retry(pm8001_ha, t, pm8001_dev); in pm8001_work_fn()
1611 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1615 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1619 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1623 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1628 struct pm8001_hba_info *pm8001_ha = pw->pm8001_ha; in pm8001_work_fn()
1636 ccb = &pm8001_ha->ccb_info[i]; in pm8001_work_fn()
1637 task = ccb->task; in pm8001_work_fn()
1638 ts = &task->task_status; in pm8001_work_fn()
1641 dev = task->dev; in pm8001_work_fn()
1649 ts->resp = SAS_TASK_COMPLETE; in pm8001_work_fn()
1650 task->task_done(task); in pm8001_work_fn()
1651 } else if (ccb->ccb_tag != PM8001_INVALID_TAG) { in pm8001_work_fn()
1652 /* complete the internal commands/non-sas task */ in pm8001_work_fn()
1653 pm8001_dev = ccb->device; in pm8001_work_fn()
1654 if (pm8001_dev->dcompletion) { in pm8001_work_fn()
1655 complete(pm8001_dev->dcompletion); in pm8001_work_fn()
1656 pm8001_dev->dcompletion = NULL; in pm8001_work_fn()
1658 complete(pm8001_ha->nvmd_completion); in pm8001_work_fn()
1664 pm8001_dev = &pm8001_ha->devices[i]; in pm8001_work_fn()
1665 device_id = pm8001_dev->device_id; in pm8001_work_fn()
1667 PM8001_CHIP_DISP->dereg_dev_req(pm8001_ha, device_id); in pm8001_work_fn()
1675 dev = pm8001_dev->sas_device; in pm8001_work_fn()
1691 pw->pm8001_ha = pm8001_ha; in pm8001_handle_event()
1692 pw->data = data; in pm8001_handle_event()
1693 pw->handler = handler; in pm8001_handle_event()
1694 INIT_WORK(&pw->work, pm8001_work_fn); in pm8001_handle_event()
1695 queue_work(pm8001_wq, &pw->work); in pm8001_handle_event()
1697 ret = -ENOMEM; in pm8001_handle_event()
1703 * mpi_ssp_completion- process the event that FW response to the SSP request.
1716 struct sas_task *t; in mpi_ssp_completion() local
1727 status = le32_to_cpu(psspPayload->status); in mpi_ssp_completion()
1728 tag = le32_to_cpu(psspPayload->tag); in mpi_ssp_completion()
1729 ccb = &pm8001_ha->ccb_info[tag]; in mpi_ssp_completion()
1730 if ((status == IO_ABORTED) && ccb->open_retry) { in mpi_ssp_completion()
1732 ccb->open_retry = 0; in mpi_ssp_completion()
1735 pm8001_dev = ccb->device; in mpi_ssp_completion()
1736 param = le32_to_cpu(psspPayload->param); in mpi_ssp_completion()
1738 t = ccb->task; in mpi_ssp_completion()
1742 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_ssp_completion()
1744 ts = &t->task_status; in mpi_ssp_completion()
1749 SAS_ADDR(t->dev->sas_addr)); in mpi_ssp_completion()
1754 status, tag, t); in mpi_ssp_completion()
1761 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1762 ts->stat = SAS_SAM_STAT_GOOD; in mpi_ssp_completion()
1764 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1765 ts->stat = SAS_PROTO_RESPONSE; in mpi_ssp_completion()
1766 ts->residual = param; in mpi_ssp_completion()
1767 iu = &psspPayload->ssp_resp_iu; in mpi_ssp_completion()
1768 sas_ssp_task_response(pm8001_ha->dev, t, iu); in mpi_ssp_completion()
1771 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1775 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1776 ts->stat = SAS_ABORTED_TASK; in mpi_ssp_completion()
1782 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1783 ts->stat = SAS_DATA_UNDERRUN; in mpi_ssp_completion()
1784 ts->residual = param; in mpi_ssp_completion()
1786 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1790 ts->resp = SAS_TASK_UNDELIVERED; in mpi_ssp_completion()
1791 ts->stat = SAS_PHY_DOWN; in mpi_ssp_completion()
1795 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1796 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1798 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1802 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1803 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1804 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1809 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1810 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1811 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_ssp_completion()
1816 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1817 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1818 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_completion()
1822 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1823 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1824 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1828 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1829 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1830 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_completion()
1831 if (!t->uldd_task) in mpi_ssp_completion()
1839 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1840 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1841 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_ssp_completion()
1845 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1846 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1847 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_ssp_completion()
1852 ts->resp = SAS_TASK_UNDELIVERED; in mpi_ssp_completion()
1853 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1854 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; 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()
1864 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1865 ts->stat = SAS_NAK_R_ERR; in mpi_ssp_completion()
1869 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1870 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1874 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1875 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1876 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1880 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1881 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1885 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1886 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1890 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1891 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1892 if (!t->uldd_task) in mpi_ssp_completion()
1899 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1900 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1904 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1905 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1909 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1910 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1915 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1916 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1917 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1922 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1923 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1927 psspPayload->ssp_resp_iu.status); in mpi_ssp_completion()
1928 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_ssp_completion()
1929 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_ssp_completion()
1930 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_ssp_completion()
1931 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_ssp_completion()
1932 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_completion()
1934 t, status, ts->resp, ts->stat); in mpi_ssp_completion()
1937 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_completion()
1940 t->task_done(t); in mpi_ssp_completion()
1947 struct sas_task *t; in mpi_ssp_event() local
1954 u32 event = le32_to_cpu(psspPayload->event); in mpi_ssp_event()
1955 u32 tag = le32_to_cpu(psspPayload->tag); in mpi_ssp_event()
1956 u32 port_id = le32_to_cpu(psspPayload->port_id); in mpi_ssp_event()
1957 u32 dev_id = le32_to_cpu(psspPayload->device_id); in mpi_ssp_event()
1959 ccb = &pm8001_ha->ccb_info[tag]; in mpi_ssp_event()
1960 t = ccb->task; in mpi_ssp_event()
1961 pm8001_dev = ccb->device; in mpi_ssp_event()
1964 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_ssp_event()
1966 ts = &t->task_status; in mpi_ssp_event()
1972 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
1973 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
1974 ts->residual = 0; in mpi_ssp_event()
1976 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_event()
1980 pm8001_handle_event(pm8001_ha, t, IO_XFER_ERROR_BREAK); in mpi_ssp_event()
1984 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
1985 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
1986 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
1990 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
1991 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
1992 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_ssp_event()
1997 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
1998 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
1999 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_event()
2003 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2004 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2005 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2009 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2010 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2011 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_event()
2012 if (!t->uldd_task) in mpi_ssp_event()
2020 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2021 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2022 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_ssp_event()
2026 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2027 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2028 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_ssp_event()
2033 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2034 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2035 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_ssp_event()
2039 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2040 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2041 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2045 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2046 ts->stat = SAS_NAK_R_ERR; in mpi_ssp_event()
2050 pm8001_handle_event(pm8001_ha, t, IO_XFER_OPEN_RETRY_TIMEOUT); in mpi_ssp_event()
2054 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2055 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2059 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2060 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2065 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2066 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2071 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2072 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2076 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2077 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2082 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2083 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2091 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2092 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2095 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_ssp_event()
2096 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_ssp_event()
2097 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_ssp_event()
2098 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_ssp_event()
2099 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_event()
2101 t, event, ts->resp, ts->stat); in mpi_ssp_event()
2104 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_event()
2107 t->task_done(t); in mpi_ssp_event()
2115 struct sas_task *t; in mpi_sata_completion() local
2133 status = le32_to_cpu(psataPayload->status); in mpi_sata_completion()
2134 param = le32_to_cpu(psataPayload->param); in mpi_sata_completion()
2135 tag = le32_to_cpu(psataPayload->tag); in mpi_sata_completion()
2137 ccb = &pm8001_ha->ccb_info[tag]; in mpi_sata_completion()
2138 t = ccb->task; in mpi_sata_completion()
2139 pm8001_dev = ccb->device; in mpi_sata_completion()
2141 if (t) { in mpi_sata_completion()
2142 if (t->dev && (t->dev->lldd_dev)) in mpi_sata_completion()
2143 pm8001_dev = t->dev->lldd_dev; in mpi_sata_completion()
2146 ccb->ccb_tag); in mpi_sata_completion()
2151 if (pm8001_dev && unlikely(!t || !t->lldd_task || !t->dev)) { in mpi_sata_completion()
2156 ts = &t->task_status; in mpi_sata_completion()
2161 status, tag, t); in mpi_sata_completion()
2166 if (!((t->dev->parent) && in mpi_sata_completion()
2167 (dev_is_expander(t->dev->parent->dev_type)))) { in mpi_sata_completion()
2169 sata_addr_low[i] = pm8001_ha->sas_addr[j]; in mpi_sata_completion()
2171 sata_addr_hi[i] = pm8001_ha->sas_addr[j]; in mpi_sata_completion()
2191 pm8001_dev->attached_phy + in mpi_sata_completion()
2200 SAS_ADDR(t->dev->sas_addr)); in mpi_sata_completion()
2207 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2208 ts->stat = SAS_SAM_STAT_GOOD; in mpi_sata_completion()
2211 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2212 ts->stat = SAS_PROTO_RESPONSE; in mpi_sata_completion()
2213 ts->residual = param; in mpi_sata_completion()
2217 sata_resp = &psataPayload->sata_resp[0]; in mpi_sata_completion()
2218 resp = (struct ata_task_resp *)ts->buf; in mpi_sata_completion()
2219 if (t->ata_task.dma_xfer == 0 && in mpi_sata_completion()
2220 t->data_dir == DMA_FROM_DEVICE) { in mpi_sata_completion()
2224 } else if (t->ata_task.use_ncq && in mpi_sata_completion()
2225 t->data_dir != DMA_NONE) { in mpi_sata_completion()
2235 resp->frame_len = len; in mpi_sata_completion()
2236 memcpy(&resp->ending_fis[0], sata_resp, len); in mpi_sata_completion()
2237 ts->buf_valid_size = sizeof(*resp); in mpi_sata_completion()
2243 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2247 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2248 ts->stat = SAS_ABORTED_TASK; in mpi_sata_completion()
2250 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2256 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2257 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_completion()
2258 ts->residual = param; in mpi_sata_completion()
2260 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2264 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2265 ts->stat = SAS_PHY_DOWN; in mpi_sata_completion()
2267 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2271 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2272 ts->stat = SAS_INTERRUPTED; in mpi_sata_completion()
2274 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2278 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2279 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2280 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_completion()
2282 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2286 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2287 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2288 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_sata_completion()
2290 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2295 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2296 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2297 ts->open_rej_reason = SAS_OREJ_UNKNOWN; 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_OPEN_REJECT; in mpi_sata_completion()
2305 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_sata_completion()
2307 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2311 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2312 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2313 if (!t->uldd_task) { in mpi_sata_completion()
2317 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2318 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2326 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2327 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2328 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_sata_completion()
2329 if (!t->uldd_task) { in mpi_sata_completion()
2333 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2334 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2341 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2342 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2343 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_sata_completion()
2345 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2349 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2350 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2351 if (!t->uldd_task) { in mpi_sata_completion()
2355 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2356 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2364 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2365 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2366 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_sata_completion()
2368 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2372 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2373 ts->stat = SAS_NAK_R_ERR; in mpi_sata_completion()
2375 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2379 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2380 ts->stat = SAS_NAK_R_ERR; in mpi_sata_completion()
2382 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2386 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2387 ts->stat = SAS_ABORTED_TASK; in mpi_sata_completion()
2389 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2393 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2394 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2396 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2400 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2401 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_completion()
2403 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2407 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2408 ts->stat = SAS_OPEN_TO; in mpi_sata_completion()
2410 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2414 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2415 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2417 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2421 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2422 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2423 if (!t->uldd_task) { in mpi_sata_completion()
2426 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2427 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2434 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2435 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2437 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2441 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2442 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2443 if (!t->uldd_task) { in mpi_sata_completion()
2446 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2447 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2455 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2456 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2457 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_completion()
2459 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2464 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2465 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2467 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2470 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_sata_completion()
2471 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_sata_completion()
2472 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_sata_completion()
2473 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_sata_completion()
2474 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_sata_completion()
2477 t, status, ts->resp, ts->stat); in mpi_sata_completion()
2480 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_sata_completion()
2488 struct sas_task *t; in mpi_sata_event() local
2494 u32 event = le32_to_cpu(psataPayload->event); in mpi_sata_event()
2495 u32 tag = le32_to_cpu(psataPayload->tag); in mpi_sata_event()
2496 u32 port_id = le32_to_cpu(psataPayload->port_id); in mpi_sata_event()
2497 u32 dev_id = le32_to_cpu(psataPayload->device_id); in mpi_sata_event()
2513 ccb = &pm8001_ha->ccb_info[tag]; in mpi_sata_event()
2514 t = ccb->task; in mpi_sata_event()
2515 pm8001_dev = ccb->device; in mpi_sata_event()
2519 if (unlikely(!t)) { in mpi_sata_event()
2521 ccb->ccb_tag); in mpi_sata_event()
2526 if (unlikely(!t->lldd_task || !t->dev)) in mpi_sata_event()
2529 ts = &t->task_status; in mpi_sata_event()
2536 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2537 ts->stat = SAS_DATA_OVERRUN; in mpi_sata_event()
2538 ts->residual = 0; in mpi_sata_event()
2542 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2543 ts->stat = SAS_INTERRUPTED; in mpi_sata_event()
2547 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2548 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2549 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_event()
2553 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2554 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2555 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_sata_event()
2560 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2561 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2562 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_sata_event()
2566 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2567 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2568 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_sata_event()
2572 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_event()
2573 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_event()
2574 if (!t->uldd_task) { in mpi_sata_event()
2578 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2579 ts->stat = SAS_QUEUE_FULL; in mpi_sata_event()
2586 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_event()
2587 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2588 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_sata_event()
2592 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2593 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2594 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_sata_event()
2599 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2600 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2601 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_sata_event()
2605 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2606 ts->stat = SAS_NAK_R_ERR; in mpi_sata_event()
2610 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2611 ts->stat = SAS_NAK_R_ERR; in mpi_sata_event()
2615 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2616 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_event()
2620 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2621 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2625 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2626 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2630 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2631 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2636 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2637 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2641 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2642 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2647 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2648 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2655 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2656 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2661 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2662 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2671 struct sas_task *t; in mpi_smp_completion() local
2681 status = le32_to_cpu(psmpPayload->status); in mpi_smp_completion()
2682 tag = le32_to_cpu(psmpPayload->tag); in mpi_smp_completion()
2684 ccb = &pm8001_ha->ccb_info[tag]; in mpi_smp_completion()
2685 t = ccb->task; in mpi_smp_completion()
2686 ts = &t->task_status; in mpi_smp_completion()
2687 pm8001_dev = ccb->device; in mpi_smp_completion()
2692 status, tag, t); in mpi_smp_completion()
2694 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_smp_completion()
2700 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2701 ts->stat = SAS_SAM_STAT_GOOD; in mpi_smp_completion()
2703 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2707 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2708 ts->stat = SAS_ABORTED_TASK; in mpi_smp_completion()
2710 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2714 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2715 ts->stat = SAS_DATA_OVERRUN; in mpi_smp_completion()
2716 ts->residual = 0; in mpi_smp_completion()
2718 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2722 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2723 ts->stat = SAS_PHY_DOWN; in mpi_smp_completion()
2727 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2728 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2732 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2733 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2737 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2738 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2743 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2744 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2745 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2750 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2751 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2752 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2756 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2757 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2758 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_smp_completion()
2762 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2763 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2764 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2772 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2773 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2774 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_smp_completion()
2778 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2779 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2780 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_smp_completion()
2785 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2786 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2787 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_smp_completion()
2791 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2792 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
2796 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2797 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2798 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
2802 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2803 ts->stat = SAS_QUEUE_FULL; in mpi_smp_completion()
2807 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2808 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2809 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
2813 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2814 ts->stat = SAS_DEV_NO_RESPONSE; 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_RSVD_RETRY; in mpi_smp_completion()
2825 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2826 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2827 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
2831 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2832 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
2836 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_smp_completion()
2837 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_smp_completion()
2838 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_smp_completion()
2839 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_smp_completion()
2840 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_smp_completion()
2842 t, status, ts->resp, ts->stat); in mpi_smp_completion()
2845 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_smp_completion()
2855 u32 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_set_dev_state_resp()
2856 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_set_dev_state_resp()
2857 struct pm8001_device *pm8001_dev = ccb->device; in pm8001_mpi_set_dev_state_resp()
2858 u32 status = le32_to_cpu(pPayload->status); in pm8001_mpi_set_dev_state_resp()
2859 u32 device_id = le32_to_cpu(pPayload->device_id); in pm8001_mpi_set_dev_state_resp()
2860 u8 pds = le32_to_cpu(pPayload->pds_nds) & PDS_BITS; in pm8001_mpi_set_dev_state_resp()
2861 u8 nds = le32_to_cpu(pPayload->pds_nds) & NDS_BITS; in pm8001_mpi_set_dev_state_resp()
2866 complete(pm8001_dev->setds_completion); in pm8001_mpi_set_dev_state_resp()
2874 u32 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_set_nvmd_resp()
2875 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_set_nvmd_resp()
2876 u32 dlen_status = le32_to_cpu(pPayload->dlen_status); in pm8001_mpi_set_nvmd_resp()
2878 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_set_nvmd_resp()
2893 u32 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_get_nvmd_resp()
2894 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_get_nvmd_resp()
2895 u32 dlen_status = le32_to_cpu(pPayload->dlen_status); in pm8001_mpi_get_nvmd_resp()
2897 le32_to_cpu(pPayload->ir_tda_bn_dps_das_nvm); in pm8001_mpi_get_nvmd_resp()
2898 void *virt_addr = pm8001_ha->memoryMap.region[NVMD].virt_ptr; in pm8001_mpi_get_nvmd_resp()
2899 fw_control_context = ccb->fw_control_context; in pm8001_mpi_get_nvmd_resp()
2905 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_get_nvmd_resp()
2913 /* indirect mode - IR bit set */ in pm8001_mpi_get_nvmd_resp()
2917 memcpy(pm8001_ha->sas_addr, in pm8001_mpi_get_nvmd_resp()
2943 memcpy(fw_control_context->usrAddr, in pm8001_mpi_get_nvmd_resp()
2944 pm8001_ha->memoryMap.region[NVMD].virt_ptr, in pm8001_mpi_get_nvmd_resp()
2945 fw_control_context->len); in pm8001_mpi_get_nvmd_resp()
2946 kfree(ccb->fw_control_context); in pm8001_mpi_get_nvmd_resp()
2949 * fw_control_context->usrAddr in pm8001_mpi_get_nvmd_resp()
2951 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_get_nvmd_resp()
2961 u32 status = le32_to_cpu(pPayload->status); in pm8001_mpi_local_phy_ctl()
2962 u32 phy_id = le32_to_cpu(pPayload->phyop_phyid) & ID_BITS; in pm8001_mpi_local_phy_ctl()
2963 u32 phy_op = le32_to_cpu(pPayload->phyop_phyid) & OP_BITS; in pm8001_mpi_local_phy_ctl()
2964 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_local_phy_ctl()
2967 "%x phy execute %x phy op failed!\n", in pm8001_mpi_local_phy_ctl()
2971 "%x phy execute %x phy op success!\n", in pm8001_mpi_local_phy_ctl()
2973 pm8001_ha->phy[phy_id].reset_success = true; in pm8001_mpi_local_phy_ctl()
2975 if (pm8001_ha->phy[phy_id].enable_completion) { in pm8001_mpi_local_phy_ctl()
2976 complete(pm8001_ha->phy[phy_id].enable_completion); in pm8001_mpi_local_phy_ctl()
2977 pm8001_ha->phy[phy_id].enable_completion = NULL; in pm8001_mpi_local_phy_ctl()
2984 * pm8001_bytes_dmaed - one of the interface function communication with libsas
2986 * @i: which phy that received the event.
2996 struct pm8001_phy *phy = &pm8001_ha->phy[i]; in pm8001_bytes_dmaed() local
2997 struct asd_sas_phy *sas_phy = &phy->sas_phy; in pm8001_bytes_dmaed()
2998 if (!phy->phy_attached) in pm8001_bytes_dmaed()
3001 if (phy->phy_type & PORT_TYPE_SAS) { in pm8001_bytes_dmaed()
3003 id = (struct sas_identify_frame *)phy->frame_rcvd; in pm8001_bytes_dmaed()
3004 id->dev_type = phy->identify.device_type; in pm8001_bytes_dmaed()
3005 id->initiator_bits = SAS_PROTOCOL_ALL; in pm8001_bytes_dmaed()
3006 id->target_bits = phy->identify.target_port_protocols; in pm8001_bytes_dmaed()
3007 } else if (phy->phy_type & PORT_TYPE_SATA) { in pm8001_bytes_dmaed()
3010 pm8001_dbg(pm8001_ha, MSG, "phy %d byte dmaded.\n", i); in pm8001_bytes_dmaed()
3012 sas_phy->frame_rcvd_size = phy->frame_rcvd_size; in pm8001_bytes_dmaed()
3017 void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate) in pm8001_get_lrate_mode() argument
3019 struct sas_phy *sas_phy = phy->sas_phy.phy; in pm8001_get_lrate_mode()
3023 phy->sas_phy.linkrate = SAS_LINK_RATE_12_0_GBPS; in pm8001_get_lrate_mode()
3026 phy->sas_phy.linkrate = SAS_LINK_RATE_6_0_GBPS; in pm8001_get_lrate_mode()
3029 phy->sas_phy.linkrate = SAS_LINK_RATE_3_0_GBPS; in pm8001_get_lrate_mode()
3032 phy->sas_phy.linkrate = SAS_LINK_RATE_1_5_GBPS; in pm8001_get_lrate_mode()
3035 sas_phy->negotiated_linkrate = phy->sas_phy.linkrate; in pm8001_get_lrate_mode()
3036 sas_phy->maximum_linkrate_hw = phy->maximum_linkrate; in pm8001_get_lrate_mode()
3037 sas_phy->minimum_linkrate_hw = SAS_LINK_RATE_1_5_GBPS; in pm8001_get_lrate_mode()
3038 sas_phy->maximum_linkrate = phy->maximum_linkrate; in pm8001_get_lrate_mode()
3039 sas_phy->minimum_linkrate = phy->minimum_linkrate; in pm8001_get_lrate_mode()
3043 * pm8001_get_attached_sas_addr - extract/generate attached SAS address
3044 * @phy: pointer to asd_phy
3054 void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, in pm8001_get_attached_sas_addr() argument
3057 if (phy->sas_phy.frame_rcvd[0] == 0x34 in pm8001_get_attached_sas_addr()
3058 && phy->sas_phy.oob_mode == SATA_OOB_MODE) { in pm8001_get_attached_sas_addr()
3059 struct pm8001_hba_info *pm8001_ha = phy->sas_phy.ha->lldd_ha; in pm8001_get_attached_sas_addr()
3060 /* FIS device-to-host */ in pm8001_get_attached_sas_addr()
3061 u64 addr = be64_to_cpu(*(__be64 *)pm8001_ha->sas_addr); in pm8001_get_attached_sas_addr()
3062 addr += phy->sas_phy.id; in pm8001_get_attached_sas_addr()
3066 (void *) phy->sas_phy.frame_rcvd; in pm8001_get_attached_sas_addr()
3067 memcpy(sas_addr, idframe->sas_addr, SAS_ADDR_SIZE); in pm8001_get_attached_sas_addr()
3072 * pm8001_hw_event_ack_req- For PM8001,some events need to acknowage to FW.
3077 * @phyId: phy id.
3101 * hw_event_sas_phy_up -FW tells me a SAS phy up event.
3111 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in hw_event_sas_phy_up()
3117 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); in hw_event_sas_phy_up()
3119 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_sas_phy_up()
3120 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_sas_phy_up() local
3122 u8 deviceType = pPayload->sas_identify.dev_type; in hw_event_sas_phy_up()
3123 phy->port = port; in hw_event_sas_phy_up()
3124 port->port_id = port_id; in hw_event_sas_phy_up()
3125 port->port_state = portstate; in hw_event_sas_phy_up()
3126 phy->phy_state = PHY_STATE_LINK_UP_SPC; in hw_event_sas_phy_up()
3128 "HW_EVENT_SAS_PHY_UP port id = %d, phy id = %d\n", in hw_event_sas_phy_up()
3139 port->port_attached = 1; in hw_event_sas_phy_up()
3140 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3144 port->port_attached = 1; in hw_event_sas_phy_up()
3145 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3149 port->port_attached = 1; in hw_event_sas_phy_up()
3150 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3157 phy->phy_type |= PORT_TYPE_SAS; in hw_event_sas_phy_up()
3158 phy->identify.device_type = deviceType; in hw_event_sas_phy_up()
3159 phy->phy_attached = 1; in hw_event_sas_phy_up()
3160 if (phy->identify.device_type == SAS_END_DEVICE) in hw_event_sas_phy_up()
3161 phy->identify.target_port_protocols = SAS_PROTOCOL_SSP; in hw_event_sas_phy_up()
3162 else if (phy->identify.device_type != SAS_PHY_UNUSED) in hw_event_sas_phy_up()
3163 phy->identify.target_port_protocols = SAS_PROTOCOL_SMP; in hw_event_sas_phy_up()
3164 phy->sas_phy.oob_mode = SAS_OOB_MODE; in hw_event_sas_phy_up()
3165 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC); in hw_event_sas_phy_up()
3166 spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sas_phy_up()
3167 memcpy(phy->frame_rcvd, &pPayload->sas_identify, in hw_event_sas_phy_up()
3168 sizeof(struct sas_identify_frame)-4); in hw_event_sas_phy_up()
3169 phy->frame_rcvd_size = sizeof(struct sas_identify_frame) - 4; in hw_event_sas_phy_up()
3170 pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); in hw_event_sas_phy_up()
3171 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sas_phy_up()
3172 if (pm8001_ha->flags == PM8001F_RUN_TIME) in hw_event_sas_phy_up()
3178 * hw_event_sata_phy_up -FW tells me a SATA phy up event.
3188 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in hw_event_sata_phy_up()
3194 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); in hw_event_sata_phy_up()
3196 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_sata_phy_up()
3197 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_sata_phy_up() local
3199 pm8001_dbg(pm8001_ha, DEVIO, "HW_EVENT_SATA_PHY_UP port id = %d, phy id = %d\n", in hw_event_sata_phy_up()
3201 phy->port = port; in hw_event_sata_phy_up()
3202 port->port_id = port_id; in hw_event_sata_phy_up()
3203 port->port_state = portstate; in hw_event_sata_phy_up()
3204 phy->phy_state = PHY_STATE_LINK_UP_SPC; in hw_event_sata_phy_up()
3205 port->port_attached = 1; in hw_event_sata_phy_up()
3206 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sata_phy_up()
3207 phy->phy_type |= PORT_TYPE_SATA; in hw_event_sata_phy_up()
3208 phy->phy_attached = 1; in hw_event_sata_phy_up()
3209 phy->sas_phy.oob_mode = SATA_OOB_MODE; in hw_event_sata_phy_up()
3210 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC); in hw_event_sata_phy_up()
3211 spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sata_phy_up()
3212 memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4), in hw_event_sata_phy_up()
3214 phy->frame_rcvd_size = sizeof(struct dev_to_host_fis); in hw_event_sata_phy_up()
3215 phy->identify.target_port_protocols = SAS_PROTOCOL_SATA; in hw_event_sata_phy_up()
3216 phy->identify.device_type = SAS_SATA_DEV; in hw_event_sata_phy_up()
3217 pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); in hw_event_sata_phy_up()
3218 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sata_phy_up()
3223 * hw_event_phy_down -we should notify the libsas the phy is down.
3233 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in hw_event_phy_down()
3237 u32 npip_portstate = le32_to_cpu(pPayload->npip_portstate); in hw_event_phy_down()
3239 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_phy_down()
3240 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_phy_down() local
3241 port->port_state = portstate; in hw_event_phy_down()
3242 phy->phy_type = 0; in hw_event_phy_down()
3243 phy->identify.device_type = 0; in hw_event_phy_down()
3244 phy->phy_attached = 0; in hw_event_phy_down()
3245 memset(&phy->dev_sas_addr, 0, SAS_ADDR_SIZE); in hw_event_phy_down()
3253 " Last phy Down and port invalid\n"); in hw_event_phy_down()
3254 port->port_attached = 0; in hw_event_phy_down()
3264 " phy Down and PORT_NOT_ESTABLISHED\n"); in hw_event_phy_down()
3265 port->port_attached = 0; in hw_event_phy_down()
3268 pm8001_dbg(pm8001_ha, MSG, " phy Down and PORT_LOSTCOMM\n"); in hw_event_phy_down()
3270 " Last phy Down and port invalid\n"); in hw_event_phy_down()
3271 port->port_attached = 0; in hw_event_phy_down()
3276 port->port_attached = 0; in hw_event_phy_down()
3277 pm8001_dbg(pm8001_ha, DEVIO, " phy Down and(default) = %x\n", in hw_event_phy_down()
3285 * pm8001_mpi_reg_resp -process register device ID response.
3291 * has assigned, from now, inter-communication with FW is no longer using the
3304 htag = le32_to_cpu(registerRespPayload->tag); in pm8001_mpi_reg_resp()
3305 ccb = &pm8001_ha->ccb_info[htag]; in pm8001_mpi_reg_resp()
3306 pm8001_dev = ccb->device; in pm8001_mpi_reg_resp()
3307 status = le32_to_cpu(registerRespPayload->status); in pm8001_mpi_reg_resp()
3308 device_id = le32_to_cpu(registerRespPayload->device_id); in pm8001_mpi_reg_resp()
3311 status, pm8001_dev->attached_phy, device_id); in pm8001_mpi_reg_resp()
3315 pm8001_dev->device_id = device_id; in pm8001_mpi_reg_resp()
3348 complete(pm8001_dev->dcompletion); in pm8001_mpi_reg_resp()
3360 status = le32_to_cpu(registerRespPayload->status); in pm8001_mpi_dereg_resp()
3361 device_id = le32_to_cpu(registerRespPayload->device_id); in pm8001_mpi_dereg_resp()
3370 * pm8001_mpi_fw_flash_update_resp - Response from FW for flash update command.
3380 u32 tag = le32_to_cpu(ppayload->tag); in pm8001_mpi_fw_flash_update_resp()
3381 struct pm8001_ccb_info *ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_fw_flash_update_resp()
3383 status = le32_to_cpu(ppayload->status); in pm8001_mpi_fw_flash_update_resp()
3419 kfree(ccb->fw_control_context); in pm8001_mpi_fw_flash_update_resp()
3421 complete(pm8001_ha->nvmd_completion); in pm8001_mpi_fw_flash_update_resp()
3431 status = le32_to_cpu(pPayload->status); in pm8001_mpi_general_event()
3436 pPayload->inb_IOMB_payload[i]); in pm8001_mpi_general_event()
3442 struct sas_task *t; in pm8001_mpi_task_abort_resp() local
3453 status = le32_to_cpu(pPayload->status); in pm8001_mpi_task_abort_resp()
3454 tag = le32_to_cpu(pPayload->tag); in pm8001_mpi_task_abort_resp()
3456 scp = le32_to_cpu(pPayload->scp); in pm8001_mpi_task_abort_resp()
3457 ccb = &pm8001_ha->ccb_info[tag]; in pm8001_mpi_task_abort_resp()
3458 t = ccb->task; in pm8001_mpi_task_abort_resp()
3459 pm8001_dev = ccb->device; /* retrieve device */ in pm8001_mpi_task_abort_resp()
3461 if (!t) { in pm8001_mpi_task_abort_resp()
3463 return -1; in pm8001_mpi_task_abort_resp()
3466 if (t->task_proto == SAS_PROTOCOL_INTERNAL_ABORT) in pm8001_mpi_task_abort_resp()
3467 atomic_dec(&pm8001_dev->running_req); in pm8001_mpi_task_abort_resp()
3469 ts = &t->task_status; in pm8001_mpi_task_abort_resp()
3476 ts->resp = SAS_TASK_COMPLETE; in pm8001_mpi_task_abort_resp()
3477 ts->stat = SAS_SAM_STAT_GOOD; in pm8001_mpi_task_abort_resp()
3481 ts->resp = TMF_RESP_FUNC_FAILED; in pm8001_mpi_task_abort_resp()
3484 spin_lock_irqsave(&t->task_state_lock, flags); in pm8001_mpi_task_abort_resp()
3485 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in pm8001_mpi_task_abort_resp()
3486 t->task_state_flags |= SAS_TASK_STATE_DONE; in pm8001_mpi_task_abort_resp()
3487 spin_unlock_irqrestore(&t->task_state_lock, flags); in pm8001_mpi_task_abort_resp()
3491 t->task_done(t); in pm8001_mpi_task_abort_resp()
3497 * mpi_hw_event -The hw event has come.
3507 le32_to_cpu(pPayload->lr_evt_status_phyid_portid); in mpi_hw_event()
3515 struct sas_ha_struct *sas_ha = pm8001_ha->sas; in mpi_hw_event()
3516 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in mpi_hw_event() local
3517 struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; in mpi_hw_event()
3526 phy->phy_state = 1; in mpi_hw_event()
3528 if (pm8001_ha->flags == PM8001F_RUN_TIME && in mpi_hw_event()
3529 phy->enable_completion != NULL) { in mpi_hw_event()
3530 complete(phy->enable_completion); in mpi_hw_event()
3531 phy->enable_completion = NULL; in mpi_hw_event()
3546 phy->phy_state = 0; in mpi_hw_event()
3550 sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD, in mpi_hw_event()
3555 sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL, in mpi_hw_event()
3557 phy->phy_attached = 0; in mpi_hw_event()
3558 phy->phy_state = 0; in mpi_hw_event()
3564 phy->phy_attached = 0; in mpi_hw_event()
3574 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3575 sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE; in mpi_hw_event()
3576 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3582 sas_phy_disconnected(&phy->sas_phy); in mpi_hw_event()
3583 phy->phy_attached = 0; in mpi_hw_event()
3584 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC); in mpi_hw_event()
3588 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3589 sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP; in mpi_hw_event()
3590 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3600 phy->phy_attached = 0; in mpi_hw_event()
3611 phy->phy_attached = 0; in mpi_hw_event()
3622 phy->phy_attached = 0; in mpi_hw_event()
3633 phy->phy_attached = 0; in mpi_hw_event()
3642 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3643 sas_phy->sas_prim = HW_EVENT_BROADCAST_SES; in mpi_hw_event()
3644 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3661 phy->phy_attached = 0; in mpi_hw_event()
3672 phy->phy_attached = 0; in mpi_hw_event()
3679 phy->phy_attached = 0; in mpi_hw_event()
3687 phy->phy_attached = 0; in mpi_hw_event()
3709 * process_one_iomb - process one outbound Queue memory block
3856 spin_lock_irqsave(&pm8001_ha->lock, flags); in process_oq()
3857 circularQ = &pm8001_ha->outbnd_q_tbl[vec]; in process_oq()
3862 process_one_iomb(pm8001_ha, (void *)(pMsg1 - 4)); in process_oq()
3869 circularQ->producer_index = in process_oq()
3870 cpu_to_le32(pm8001_read_32(circularQ->pi_virt)); in process_oq()
3871 if (le32_to_cpu(circularQ->producer_index) == in process_oq()
3872 circularQ->consumer_idx) in process_oq()
3877 spin_unlock_irqrestore(&pm8001_ha->lock, flags); in process_oq()
3896 buf_prd->addr = cpu_to_le64(sg_dma_address(sg)); in pm8001_chip_make_sg()
3897 buf_prd->im_len.len = cpu_to_le32(sg_dma_len(sg)); in pm8001_chip_make_sg()
3898 buf_prd->im_len.e = 0; in pm8001_chip_make_sg()
3905 psmp_cmd->tag = hTag; in build_smp_cmd()
3906 psmp_cmd->device_id = cpu_to_le32(deviceID); in build_smp_cmd()
3907 psmp_cmd->len_ip_ir = cpu_to_le32(1|(1 << 1)); in build_smp_cmd()
3911 * pm8001_chip_smp_req - send a SMP task to FW
3919 struct sas_task *task = ccb->task; in pm8001_chip_smp_req()
3920 struct domain_device *dev = task->dev; in pm8001_chip_smp_req()
3921 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm8001_chip_smp_req()
3929 * DMA-map SMP request, response buffers in pm8001_chip_smp_req()
3931 sg_req = &task->smp_task.smp_req; in pm8001_chip_smp_req()
3932 elem = dma_map_sg(pm8001_ha->dev, sg_req, 1, DMA_TO_DEVICE); in pm8001_chip_smp_req()
3934 return -ENOMEM; in pm8001_chip_smp_req()
3937 sg_resp = &task->smp_task.smp_resp; in pm8001_chip_smp_req()
3938 elem = dma_map_sg(pm8001_ha->dev, sg_resp, 1, DMA_FROM_DEVICE); in pm8001_chip_smp_req()
3940 rc = -ENOMEM; in pm8001_chip_smp_req()
3946 rc = -EINVAL; in pm8001_chip_smp_req()
3951 smp_cmd.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_smp_req()
3953 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req)); in pm8001_chip_smp_req()
3955 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_req)-4); in pm8001_chip_smp_req()
3957 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_resp)); in pm8001_chip_smp_req()
3959 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4); in pm8001_chip_smp_req()
3960 build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, &smp_cmd); in pm8001_chip_smp_req()
3969 dma_unmap_sg(pm8001_ha->dev, &ccb->task->smp_task.smp_resp, 1, in pm8001_chip_smp_req()
3972 dma_unmap_sg(pm8001_ha->dev, &ccb->task->smp_task.smp_req, 1, in pm8001_chip_smp_req()
3978 * pm8001_chip_ssp_io_req - send a SSP task to FW
3985 struct sas_task *task = ccb->task; in pm8001_chip_ssp_io_req()
3986 struct domain_device *dev = task->dev; in pm8001_chip_ssp_io_req()
3987 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm8001_chip_ssp_io_req()
3989 u32 tag = ccb->ccb_tag; in pm8001_chip_ssp_io_req()
3993 memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); in pm8001_chip_ssp_io_req()
3995 cpu_to_le32(data_dir_flags[task->data_dir] << 8 | 0x0);/*0 for in pm8001_chip_ssp_io_req()
3997 ssp_cmd.data_len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_ssp_io_req()
3998 ssp_cmd.device_id = cpu_to_le32(pm8001_dev->device_id); in pm8001_chip_ssp_io_req()
4000 ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); in pm8001_chip_ssp_io_req()
4001 memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, in pm8001_chip_ssp_io_req()
4002 task->ssp_task.cmd->cmd_len); in pm8001_chip_ssp_io_req()
4005 if (task->num_scatter > 1) { in pm8001_chip_ssp_io_req()
4006 pm8001_chip_make_sg(task->scatter, ccb->n_elem, ccb->buf_prd); in pm8001_chip_ssp_io_req()
4007 phys_addr = ccb->ccb_dma_handle; in pm8001_chip_ssp_io_req()
4011 } else if (task->num_scatter == 1) { in pm8001_chip_ssp_io_req()
4012 u64 dma_addr = sg_dma_address(task->scatter); in pm8001_chip_ssp_io_req()
4015 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_ssp_io_req()
4017 } else if (task->num_scatter == 0) { in pm8001_chip_ssp_io_req()
4020 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_ssp_io_req()
4031 struct sas_task *task = ccb->task; in pm8001_chip_sata_req()
4032 struct domain_device *dev = task->dev; in pm8001_chip_sata_req()
4033 struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; in pm8001_chip_sata_req()
4034 u32 tag = ccb->ccb_tag; in pm8001_chip_sata_req()
4044 if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { in pm8001_chip_sata_req()
4047 } else if (likely(!task->ata_task.device_control_reg_update)) { in pm8001_chip_sata_req()
4048 if (task->ata_task.use_ncq && in pm8001_chip_sata_req()
4049 dev->sata_dev.class != ATA_DEV_ATAPI) { in pm8001_chip_sata_req()
4052 } else if (task->ata_task.dma_xfer) { in pm8001_chip_sata_req()
4060 if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) { in pm8001_chip_sata_req()
4061 task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); in pm8001_chip_sata_req()
4064 dir = data_dir_flags[task->data_dir] << 8; in pm8001_chip_sata_req()
4066 sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); in pm8001_chip_sata_req()
4067 sata_cmd.data_len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_sata_req()
4068 if (task->ata_task.return_fis_on_success) in pm8001_chip_sata_req()
4073 sata_cmd.sata_fis = task->ata_task.fis; in pm8001_chip_sata_req()
4074 if (likely(!task->ata_task.device_control_reg_update)) in pm8001_chip_sata_req()
4078 if (task->num_scatter > 1) { in pm8001_chip_sata_req()
4079 pm8001_chip_make_sg(task->scatter, ccb->n_elem, ccb->buf_prd); in pm8001_chip_sata_req()
4080 phys_addr = ccb->ccb_dma_handle; in pm8001_chip_sata_req()
4084 } else if (task->num_scatter == 1) { in pm8001_chip_sata_req()
4085 u64 dma_addr = sg_dma_address(task->scatter); in pm8001_chip_sata_req()
4088 sata_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_sata_req()
4090 } else if (task->num_scatter == 0) { in pm8001_chip_sata_req()
4093 sata_cmd.len = cpu_to_le32(task->total_xfer_len); in pm8001_chip_sata_req()
4102 * pm8001_chip_phy_start_req - start phy via PHY_START COMMAND
4104 * @phy_id: the phy id which we wanted to start up.
4116 ** [0:7] PHY Identifier in pm8001_chip_phy_start_req()
4127 &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE); in pm8001_chip_phy_start_req()
4135 * pm8001_chip_phy_stop_req - start phy via PHY_STOP COMMAND
4137 * @phy_id: the phy id which we wanted to start up.
4169 struct domain_device *dev = pm8001_dev->sas_device; in pm8001_chip_reg_dev_req()
4170 struct domain_device *parent_dev = dev->parent; in pm8001_chip_reg_dev_req()
4171 struct pm8001_port *port = dev->port->lldd_port; in pm8001_chip_reg_dev_req()
4176 return -SAS_QUEUE_FULL; in pm8001_chip_reg_dev_req()
4178 payload.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_reg_dev_req()
4182 if (pm8001_dev->dev_type == SAS_SATA_DEV) in pm8001_chip_reg_dev_req()
4184 else if (pm8001_dev->dev_type == SAS_END_DEVICE || in pm8001_chip_reg_dev_req()
4185 dev_is_expander(pm8001_dev->dev_type)) in pm8001_chip_reg_dev_req()
4188 if (parent_dev && dev_is_expander(parent_dev->dev_type)) in pm8001_chip_reg_dev_req()
4189 phy_id = parent_dev->ex_dev.ex_phy->phy_id; in pm8001_chip_reg_dev_req()
4191 phy_id = pm8001_dev->attached_phy; in pm8001_chip_reg_dev_req()
4193 linkrate = (pm8001_dev->sas_device->linkrate < dev->port->linkrate) ? in pm8001_chip_reg_dev_req()
4194 pm8001_dev->sas_device->linkrate : dev->port->linkrate; in pm8001_chip_reg_dev_req()
4196 cpu_to_le32(((port->port_id) & 0x0F) | in pm8001_chip_reg_dev_req()
4203 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr, in pm8001_chip_reg_dev_req()
4234 * pm8001_chip_phy_ctl_req - support the local phy operation
4236 * @phyId: the phy id which we wanted to operate
4237 * @phy_op: the phy operation to request
4258 if (pm8001_ha->use_msix) in pm8001_chip_is_our_interrupt()
4268 * pm8001_chip_isr - PM8001 isr handler.
4299 return -EIO; in send_task_abort()
4309 * pm8001_chip_abort_task - SAS abort task when error or exception happened.
4314 struct sas_task *task = ccb->task; in pm8001_chip_abort_task()
4315 struct sas_internal_abort_task *abort = &task->abort_task; in pm8001_chip_abort_task()
4316 struct pm8001_device *pm8001_dev = ccb->device; in pm8001_chip_abort_task()
4321 ccb->ccb_tag, abort->tag); in pm8001_chip_abort_task()
4322 if (pm8001_dev->dev_type == SAS_END_DEVICE) in pm8001_chip_abort_task()
4324 else if (pm8001_dev->dev_type == SAS_SATA_DEV) in pm8001_chip_abort_task()
4328 device_id = pm8001_dev->device_id; in pm8001_chip_abort_task()
4329 rc = send_task_abort(pm8001_ha, opc, device_id, abort->type, in pm8001_chip_abort_task()
4330 abort->tag, ccb->ccb_tag); in pm8001_chip_abort_task()
4337 * pm8001_chip_ssp_tm_req - built the task management command.
4345 struct sas_task *task = ccb->task; in pm8001_chip_ssp_tm_req()
4346 struct domain_device *dev = task->dev; in pm8001_chip_ssp_tm_req()
4347 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm8001_chip_ssp_tm_req()
4352 sspTMCmd.device_id = cpu_to_le32(pm8001_dev->device_id); in pm8001_chip_ssp_tm_req()
4353 sspTMCmd.relate_tag = cpu_to_le32((u32)tmf->tag_of_task_to_be_managed); in pm8001_chip_ssp_tm_req()
4354 sspTMCmd.tmf = cpu_to_le32(tmf->tmf); in pm8001_chip_ssp_tm_req()
4355 memcpy(sspTMCmd.lun, task->ssp_task.LUN, 8); in pm8001_chip_ssp_tm_req()
4356 sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_ssp_tm_req()
4357 if (pm8001_ha->chip_id != chip_8001) in pm8001_chip_ssp_tm_req()
4375 nvmd_type = ioctl_payload->minor_function; in pm8001_chip_get_nvmd_req()
4378 return -ENOMEM; in pm8001_chip_get_nvmd_req()
4379 fw_control_context->usrAddr = (u8 *)ioctl_payload->func_specific; in pm8001_chip_get_nvmd_req()
4380 fw_control_context->len = ioctl_payload->rd_length; in pm8001_chip_get_nvmd_req()
4386 return -SAS_QUEUE_FULL; in pm8001_chip_get_nvmd_req()
4388 ccb->fw_control_context = fw_control_context; in pm8001_chip_get_nvmd_req()
4390 nvmd_req.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_get_nvmd_req()
4400 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4402 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4404 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4409 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4411 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4413 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4418 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4420 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4422 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4427 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4429 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4431 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4436 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->rd_length); in pm8001_chip_get_nvmd_req()
4437 nvmd_req.vpd_offset = cpu_to_le32(ioctl_payload->offset); in pm8001_chip_get_nvmd_req()
4439 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_get_nvmd_req()
4441 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_get_nvmd_req()
4468 nvmd_type = ioctl_payload->minor_function; in pm8001_chip_set_nvmd_req()
4471 return -ENOMEM; in pm8001_chip_set_nvmd_req()
4473 memcpy(pm8001_ha->memoryMap.region[NVMD].virt_ptr, in pm8001_chip_set_nvmd_req()
4474 &ioctl_payload->func_specific, in pm8001_chip_set_nvmd_req()
4475 ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4481 return -SAS_QUEUE_FULL; in pm8001_chip_set_nvmd_req()
4483 ccb->fw_control_context = fw_control_context; in pm8001_chip_set_nvmd_req()
4485 nvmd_req.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_set_nvmd_req()
4494 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4496 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4498 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4503 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4506 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4508 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4512 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4515 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4517 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4521 nvmd_req.resp_len = cpu_to_le32(ioctl_payload->wr_length); in pm8001_chip_set_nvmd_req()
4524 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_hi); in pm8001_chip_set_nvmd_req()
4526 cpu_to_le32(pm8001_ha->memoryMap.region[NVMD].phys_addr_lo); in pm8001_chip_set_nvmd_req()
4542 * pm8001_chip_fw_flash_update_build - support the firmware update operation
4558 payload.cur_image_len = cpu_to_le32(info->cur_image_len); in pm8001_chip_fw_flash_update_build()
4559 payload.cur_image_offset = cpu_to_le32(info->cur_image_offset); in pm8001_chip_fw_flash_update_build()
4560 payload.total_image_len = cpu_to_le32(info->total_image_len); in pm8001_chip_fw_flash_update_build()
4561 payload.len = info->sgl.im_len.len ; in pm8001_chip_fw_flash_update_build()
4563 cpu_to_le32(lower_32_bits(le64_to_cpu(info->sgl.addr))); in pm8001_chip_fw_flash_update_build()
4565 cpu_to_le32(upper_32_bits(le64_to_cpu(info->sgl.addr))); in pm8001_chip_fw_flash_update_build()
4580 void *buffer = pm8001_ha->memoryMap.region[FW_FLASH].virt_ptr; in pm8001_chip_fw_flash_update_req()
4581 dma_addr_t phys_addr = pm8001_ha->memoryMap.region[FW_FLASH].phys_addr; in pm8001_chip_fw_flash_update_req()
4586 return -ENOMEM; in pm8001_chip_fw_flash_update_req()
4587 fw_control = (struct fw_control_info *)&ioctl_payload->func_specific; in pm8001_chip_fw_flash_update_req()
4590 fw_control->len); in pm8001_chip_fw_flash_update_req()
4591 memcpy(buffer, fw_control->buffer, fw_control->len); in pm8001_chip_fw_flash_update_req()
4593 flash_update_info.sgl.im_len.len = cpu_to_le32(fw_control->len); in pm8001_chip_fw_flash_update_req()
4595 flash_update_info.cur_image_offset = fw_control->offset; in pm8001_chip_fw_flash_update_req()
4596 flash_update_info.cur_image_len = fw_control->len; in pm8001_chip_fw_flash_update_req()
4597 flash_update_info.total_image_len = fw_control->size; in pm8001_chip_fw_flash_update_req()
4598 fw_control_context->fw_control = fw_control; in pm8001_chip_fw_flash_update_req()
4599 fw_control_context->virtAddr = buffer; in pm8001_chip_fw_flash_update_req()
4600 fw_control_context->phys_addr = phys_addr; in pm8001_chip_fw_flash_update_req()
4601 fw_control_context->len = fw_control->len; in pm8001_chip_fw_flash_update_req()
4606 return -SAS_QUEUE_FULL; in pm8001_chip_fw_flash_update_req()
4608 ccb->fw_control_context = fw_control_context; in pm8001_chip_fw_flash_update_req()
4611 ccb->ccb_tag); in pm8001_chip_fw_flash_update_req()
4629 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm8001_get_gsm_dump()
4632 gsm_dump_offset = pm8001_ha->fatal_forensic_shift_offset; in pm8001_get_gsm_dump()
4637 return -EINVAL; in pm8001_get_gsm_dump()
4639 if (pm8001_ha->chip_id == chip_8001) in pm8001_get_gsm_dump()
4653 if (pm8001_ha->chip_id == chip_8001) in pm8001_get_gsm_dump()
4661 if (pm8001_ha->chip_id == chip_8001) { in pm8001_get_gsm_dump()
4663 if (-1 == pm8001_bar4_shift(pm8001_ha, in pm8001_get_gsm_dump()
4665 return -EIO; in pm8001_get_gsm_dump()
4668 if (-1 == pm80xx_bar4_shift(pm8001_ha, in pm8001_get_gsm_dump()
4670 return -EIO; in pm8001_get_gsm_dump()
4689 if (-1 == pm8001_bar4_shift(pm8001_ha, 0)) in pm8001_get_gsm_dump()
4690 return -EIO; in pm8001_get_gsm_dump()
4691 pm8001_ha->fatal_forensic_shift_offset += 1024; in pm8001_get_gsm_dump()
4693 if (pm8001_ha->fatal_forensic_shift_offset >= 0x100000) in pm8001_get_gsm_dump()
4694 pm8001_ha->fatal_forensic_shift_offset = 0; in pm8001_get_gsm_dump()
4695 return direct_data - buf; in pm8001_get_gsm_dump()
4711 return -SAS_QUEUE_FULL; in pm8001_chip_set_dev_state_req()
4713 payload.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_set_dev_state_req()
4714 payload.device_id = cpu_to_le32(pm8001_dev->device_id); in pm8001_chip_set_dev_state_req()
4737 return -SAS_QUEUE_FULL; in pm8001_chip_sas_re_initialization()
4739 payload.tag = cpu_to_le32(ccb->ccb_tag); in pm8001_chip_sas_re_initialization()