Lines Matching +full:sierra +full:- +full:phy

2  * PMC-Sierra SPCv/ve 8088/8089 SAS/SATA based host adapters driver
4 * Copyright (c) 2008-2009 PMC-Sierra, Inc.,
18 * 3. Neither the names of the above-listed copyright holders nor the names
64 return -1; in pm80xx_bar4_shift()
90 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm80xx_get_fatal_dump()
91 void __iomem *fatal_table_address = pm8001_ha->fatal_tbl_addr; in pm80xx_get_fatal_dump()
100 pm8001_ha->forensic_info.data_buf.direct_data = buf; in pm80xx_get_fatal_dump()
101 if (pm8001_ha->chip_id == chip_8001) { in pm80xx_get_fatal_dump()
102 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
103 sprintf(pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
105 return (char *)pm8001_ha->forensic_info.data_buf.direct_data - in pm80xx_get_fatal_dump()
109 if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) { in pm80xx_get_fatal_dump()
113 pm8001_ha->forensic_info.data_type = TYPE_NON_FATAL; in pm80xx_get_fatal_dump()
114 pm8001_ha->forensic_info.data_buf.direct_len = SYSFS_OFFSET; in pm80xx_get_fatal_dump()
115 pm8001_ha->forensic_info.data_buf.direct_offset = 0; in pm80xx_get_fatal_dump()
116 pm8001_ha->forensic_info.data_buf.read_len = 0; in pm80xx_get_fatal_dump()
117 pm8001_ha->forensic_preserved_accumulated_transfer = 0; in pm80xx_get_fatal_dump()
123 pm8001_ha->forensic_info.data_buf.direct_data = direct_data; in pm80xx_get_fatal_dump()
126 pm8001_ha->forensic_info.data_buf.read_len); in pm80xx_get_fatal_dump()
128 pm8001_ha->forensic_info.data_buf.direct_len); in pm80xx_get_fatal_dump()
130 pm8001_ha->forensic_info.data_buf.direct_offset); in pm80xx_get_fatal_dump()
132 if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) { in pm80xx_get_fatal_dump()
136 pm8001_ha->fatal_forensic_shift_offset); in pm80xx_get_fatal_dump()
137 pm8001_ha->forensic_last_offset = 0; in pm80xx_get_fatal_dump()
138 pm8001_ha->forensic_fatal_step = 0; in pm80xx_get_fatal_dump()
139 pm8001_ha->fatal_bar_loc = 0; in pm80xx_get_fatal_dump()
149 accum_len - pm8001_ha->forensic_preserved_accumulated_transfer; in pm80xx_get_fatal_dump()
155 pm8001_ha->forensic_last_offset); in pm80xx_get_fatal_dump()
157 pm8001_ha->forensic_info.data_buf.read_len); in pm80xx_get_fatal_dump()
159 pm8001_ha->forensic_info.data_buf.direct_len); in pm80xx_get_fatal_dump()
161 pm8001_ha->forensic_info.data_buf.direct_offset); in pm80xx_get_fatal_dump()
172 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
173 sprintf(pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
175 return (char *)pm8001_ha->forensic_info.data_buf.direct_data - in pm80xx_get_fatal_dump()
179 temp = (u32 *)pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr; in pm80xx_get_fatal_dump()
180 if (pm8001_ha->forensic_fatal_step == 0) { in pm80xx_get_fatal_dump()
185 if (pm8001_ha->forensic_last_offset + SYSFS_OFFSET in pm80xx_get_fatal_dump()
187 pm8001_ha->forensic_info.data_buf.direct_len = in pm80xx_get_fatal_dump()
188 length_to_read - in pm80xx_get_fatal_dump()
189 pm8001_ha->forensic_last_offset; in pm80xx_get_fatal_dump()
191 pm8001_ha->forensic_info.data_buf.direct_len = in pm80xx_get_fatal_dump()
194 if (pm8001_ha->forensic_info.data_buf.direct_data) { in pm80xx_get_fatal_dump()
197 pm8001_ha->fatal_bar_loc, in pm80xx_get_fatal_dump()
198 pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr, in pm80xx_get_fatal_dump()
199 pm8001_ha->forensic_info.data_buf.direct_len, 1); in pm80xx_get_fatal_dump()
201 pm8001_ha->fatal_bar_loc += in pm80xx_get_fatal_dump()
202 pm8001_ha->forensic_info.data_buf.direct_len; in pm80xx_get_fatal_dump()
203 pm8001_ha->forensic_info.data_buf.direct_offset += in pm80xx_get_fatal_dump()
204 pm8001_ha->forensic_info.data_buf.direct_len; in pm80xx_get_fatal_dump()
205 pm8001_ha->forensic_last_offset += in pm80xx_get_fatal_dump()
206 pm8001_ha->forensic_info.data_buf.direct_len; in pm80xx_get_fatal_dump()
207 pm8001_ha->forensic_info.data_buf.read_len = in pm80xx_get_fatal_dump()
208 pm8001_ha->forensic_info.data_buf.direct_len; in pm80xx_get_fatal_dump()
210 if (pm8001_ha->forensic_last_offset >= length_to_read) { in pm80xx_get_fatal_dump()
211 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
212 sprintf(pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
215 (pm8001_ha->forensic_info.data_buf.direct_len in pm80xx_get_fatal_dump()
217 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
219 pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
223 pm8001_ha->fatal_bar_loc = 0; in pm80xx_get_fatal_dump()
224 pm8001_ha->forensic_fatal_step = 1; in pm80xx_get_fatal_dump()
225 pm8001_ha->fatal_forensic_shift_offset = 0; in pm80xx_get_fatal_dump()
226 pm8001_ha->forensic_last_offset = 0; in pm80xx_get_fatal_dump()
229 ((char *)pm8001_ha->forensic_info.data_buf.direct_data in pm80xx_get_fatal_dump()
230 - (char *)buf); in pm80xx_get_fatal_dump()
233 return (char *)pm8001_ha-> in pm80xx_get_fatal_dump()
234 forensic_info.data_buf.direct_data - in pm80xx_get_fatal_dump()
237 if (pm8001_ha->fatal_bar_loc < (64 * 1024)) { in pm80xx_get_fatal_dump()
238 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
239 sprintf(pm8001_ha-> in pm80xx_get_fatal_dump()
243 (pm8001_ha->forensic_info.data_buf.direct_len in pm80xx_get_fatal_dump()
245 pm8001_ha->forensic_info.data_buf.direct_data in pm80xx_get_fatal_dump()
246 += sprintf(pm8001_ha-> in pm80xx_get_fatal_dump()
252 ((char *)pm8001_ha->forensic_info.data_buf.direct_data in pm80xx_get_fatal_dump()
253 - (char *)buf); in pm80xx_get_fatal_dump()
256 return (char *)pm8001_ha-> in pm80xx_get_fatal_dump()
257 forensic_info.data_buf.direct_data - in pm80xx_get_fatal_dump()
262 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
263 sprintf(pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
266 (pm8001_ha->forensic_info.data_buf.direct_len in pm80xx_get_fatal_dump()
268 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
269 sprintf(pm8001_ha-> in pm80xx_get_fatal_dump()
273 pm8001_ha->fatal_forensic_shift_offset += 0x100; in pm80xx_get_fatal_dump()
275 pm8001_ha->fatal_forensic_shift_offset); in pm80xx_get_fatal_dump()
276 pm8001_ha->fatal_bar_loc = 0; in pm80xx_get_fatal_dump()
279 ((char *)pm8001_ha->forensic_info.data_buf.direct_data in pm80xx_get_fatal_dump()
280 - (char *)buf); in pm80xx_get_fatal_dump()
283 return (char *)pm8001_ha->forensic_info.data_buf.direct_data - in pm80xx_get_fatal_dump()
286 if (pm8001_ha->forensic_fatal_step == 1) { in pm80xx_get_fatal_dump()
290 pm8001_ha->forensic_preserved_accumulated_transfer = in pm80xx_get_fatal_dump()
323 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
325 pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
328 pm8001_ha->forensic_info.data_buf.direct_data in pm80xx_get_fatal_dump()
329 - (char *)buf); in pm80xx_get_fatal_dump()
347 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
349 pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
351 return((char *)pm8001_ha->forensic_info.data_buf.direct_data - in pm80xx_get_fatal_dump()
355 pm8001_ha->fatal_forensic_shift_offset = 0; /* location in 64k region */ in pm80xx_get_fatal_dump()
358 pm8001_ha->fatal_forensic_shift_offset); in pm80xx_get_fatal_dump()
362 MPI_FATAL_EDUMP_TABLE_ACCUM_LEN) - in pm80xx_get_fatal_dump()
363 pm8001_ha->forensic_preserved_accumulated_transfer; in pm80xx_get_fatal_dump()
365 pm8001_ha->forensic_fatal_step = 0; in pm80xx_get_fatal_dump()
368 pm8001_ha->forensic_info.data_buf.direct_data += in pm80xx_get_fatal_dump()
369 sprintf(pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_fatal_dump()
371 pm8001_ha->forensic_info.data_buf.read_len = 0xFFFFFFFF; in pm80xx_get_fatal_dump()
372 pm8001_ha->forensic_info.data_buf.direct_len = 0; in pm80xx_get_fatal_dump()
373 pm8001_ha->forensic_info.data_buf.direct_offset = 0; in pm80xx_get_fatal_dump()
374 pm8001_ha->forensic_info.data_buf.read_len = 0; in pm80xx_get_fatal_dump()
377 offset = (int)((char *)pm8001_ha->forensic_info.data_buf.direct_data in pm80xx_get_fatal_dump()
378 - (char *)buf); in pm80xx_get_fatal_dump()
380 return ((char *)pm8001_ha->forensic_info.data_buf.direct_data - in pm80xx_get_fatal_dump()
384 /* pm80xx_get_non_fatal_dump - dump the nonfatal data from the dma
392 struct pm8001_hba_info *pm8001_ha = sha->lldd_ha; in pm80xx_get_non_fatal_dump()
393 void __iomem *nonfatal_table_address = pm8001_ha->fatal_tbl_addr; in pm80xx_get_non_fatal_dump()
403 temp = (u32 *)pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr; in pm80xx_get_non_fatal_dump()
404 if (++pm8001_ha->non_fatal_count == 1) { in pm80xx_get_non_fatal_dump()
405 if (pm8001_ha->chip_id == chip_8001) { in pm80xx_get_non_fatal_dump()
406 snprintf(pm8001_ha->forensic_info.data_buf.direct_data, in pm80xx_get_non_fatal_dump()
413 * Non-Fatal Error Dump Capture Table.This is the buffer in pm80xx_get_non_fatal_dump()
418 pm8001_ha->memoryMap.region[FORENSIC_MEM].phys_addr_lo); in pm80xx_get_non_fatal_dump()
422 pm8001_ha->memoryMap.region[FORENSIC_MEM].phys_addr_hi); in pm80xx_get_non_fatal_dump()
428 * keeps sending active I/Os while capturing the non-fatal in pm80xx_get_non_fatal_dump()
436 * [ACCDDLEN] field in the MPI Fatal and Non-Fatal Error Dump in pm80xx_get_non_fatal_dump()
443 pm8001_ha->forensic_preserved_accumulated_transfer = 0; in pm80xx_get_non_fatal_dump()
444 pm8001_ha->non_fatal_read_length = 0; in pm80xx_get_non_fatal_dump()
450 * Step 3:Clear Fatal/Non-Fatal Debug Data Transfer Status [FDDTSTAT] in pm80xx_get_non_fatal_dump()
471 * the MPI Fatal and Non-Fatal Error Dump Capture Table. in pm80xx_get_non_fatal_dump()
482 pm8001_ha->non_fatal_read_length = 0; in pm80xx_get_non_fatal_dump()
484 pm8001_ha->non_fatal_count = 0; in pm80xx_get_non_fatal_dump()
485 return (buf_copy - buf); in pm80xx_get_non_fatal_dump()
490 (pm8001_ha->non_fatal_read_length >= total_len)) { in pm80xx_get_non_fatal_dump()
491 pm8001_ha->non_fatal_read_length = 0; in pm80xx_get_non_fatal_dump()
493 pm8001_ha->non_fatal_count = 0; in pm80xx_get_non_fatal_dump()
497 output_length = accum_len - in pm80xx_get_non_fatal_dump()
498 pm8001_ha->forensic_preserved_accumulated_transfer; in pm80xx_get_non_fatal_dump()
504 pm8001_ha->non_fatal_read_length += output_length; in pm80xx_get_non_fatal_dump()
509 pm8001_ha->forensic_preserved_accumulated_transfer = accum_len; in pm80xx_get_non_fatal_dump()
510 return (buf_copy - buf); in pm80xx_get_non_fatal_dump()
514 * read_main_config_table - read the configure table and save it.
519 void __iomem *address = pm8001_ha->main_cfg_tbl_addr; in read_main_config_table()
521 pm8001_ha->main_cfg_tbl.pm80xx_tbl.signature = in read_main_config_table()
523 pm8001_ha->main_cfg_tbl.pm80xx_tbl.interface_rev = in read_main_config_table()
525 pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev = in read_main_config_table()
527 pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_out_io = in read_main_config_table()
529 pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl = in read_main_config_table()
531 pm8001_ha->main_cfg_tbl.pm80xx_tbl.ctrl_cap_flag = in read_main_config_table()
533 pm8001_ha->main_cfg_tbl.pm80xx_tbl.gst_offset = in read_main_config_table()
535 pm8001_ha->main_cfg_tbl.pm80xx_tbl.inbound_queue_offset = in read_main_config_table()
537 pm8001_ha->main_cfg_tbl.pm80xx_tbl.outbound_queue_offset = in read_main_config_table()
541 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_dump_offset0 = in read_main_config_table()
543 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_dump_length0 = in read_main_config_table()
545 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_dump_offset1 = in read_main_config_table()
547 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_dump_length1 = in read_main_config_table()
551 pm8001_ha->main_cfg_tbl.pm80xx_tbl.gpio_led_mapping = in read_main_config_table()
555 pm8001_ha->main_cfg_tbl.pm80xx_tbl.analog_setup_table_offset = in read_main_config_table()
558 pm8001_ha->main_cfg_tbl.pm80xx_tbl.int_vec_table_offset = in read_main_config_table()
560 pm8001_ha->main_cfg_tbl.pm80xx_tbl.phy_attr_table_offset = in read_main_config_table()
563 pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer = in read_main_config_table()
566 pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version = in read_main_config_table()
568 pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version = in read_main_config_table()
573 pm8001_ha->main_cfg_tbl.pm80xx_tbl.signature, in read_main_config_table()
574 pm8001_ha->main_cfg_tbl.pm80xx_tbl.interface_rev, in read_main_config_table()
575 pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev); in read_main_config_table()
578 "table offset: gst:%x iq:%x oq:%x int vec:%x phy attr:%x\n", in read_main_config_table()
579 pm8001_ha->main_cfg_tbl.pm80xx_tbl.gst_offset, in read_main_config_table()
580 pm8001_ha->main_cfg_tbl.pm80xx_tbl.inbound_queue_offset, in read_main_config_table()
581 pm8001_ha->main_cfg_tbl.pm80xx_tbl.outbound_queue_offset, in read_main_config_table()
582 pm8001_ha->main_cfg_tbl.pm80xx_tbl.int_vec_table_offset, in read_main_config_table()
583 pm8001_ha->main_cfg_tbl.pm80xx_tbl.phy_attr_table_offset); in read_main_config_table()
587 pm8001_ha->main_cfg_tbl.pm80xx_tbl.ila_version, in read_main_config_table()
588 pm8001_ha->main_cfg_tbl.pm80xx_tbl.inc_fw_version); in read_main_config_table()
592 * read_general_status_table - read the general status table and save it.
597 void __iomem *address = pm8001_ha->general_stat_tbl_addr; in read_general_status_table()
598 pm8001_ha->gs_tbl.pm80xx_tbl.gst_len_mpistate = in read_general_status_table()
600 pm8001_ha->gs_tbl.pm80xx_tbl.iq_freeze_state0 = in read_general_status_table()
602 pm8001_ha->gs_tbl.pm80xx_tbl.iq_freeze_state1 = in read_general_status_table()
604 pm8001_ha->gs_tbl.pm80xx_tbl.msgu_tcnt = in read_general_status_table()
606 pm8001_ha->gs_tbl.pm80xx_tbl.iop_tcnt = in read_general_status_table()
608 pm8001_ha->gs_tbl.pm80xx_tbl.gpio_input_val = in read_general_status_table()
610 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[0] = in read_general_status_table()
612 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[1] = in read_general_status_table()
614 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[2] = in read_general_status_table()
616 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[3] = in read_general_status_table()
618 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[4] = in read_general_status_table()
620 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[5] = in read_general_status_table()
622 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[6] = in read_general_status_table()
624 pm8001_ha->gs_tbl.pm80xx_tbl.recover_err_info[7] = in read_general_status_table()
628 * read_phy_attr_table - read the phy attribute table and save it.
633 void __iomem *address = pm8001_ha->pspa_q_tbl_addr; in read_phy_attr_table()
634 pm8001_ha->phy_attr_table.phystart1_16[0] = in read_phy_attr_table()
636 pm8001_ha->phy_attr_table.phystart1_16[1] = in read_phy_attr_table()
638 pm8001_ha->phy_attr_table.phystart1_16[2] = in read_phy_attr_table()
640 pm8001_ha->phy_attr_table.phystart1_16[3] = in read_phy_attr_table()
642 pm8001_ha->phy_attr_table.phystart1_16[4] = in read_phy_attr_table()
644 pm8001_ha->phy_attr_table.phystart1_16[5] = in read_phy_attr_table()
646 pm8001_ha->phy_attr_table.phystart1_16[6] = in read_phy_attr_table()
648 pm8001_ha->phy_attr_table.phystart1_16[7] = in read_phy_attr_table()
650 pm8001_ha->phy_attr_table.phystart1_16[8] = in read_phy_attr_table()
652 pm8001_ha->phy_attr_table.phystart1_16[9] = in read_phy_attr_table()
654 pm8001_ha->phy_attr_table.phystart1_16[10] = in read_phy_attr_table()
656 pm8001_ha->phy_attr_table.phystart1_16[11] = in read_phy_attr_table()
658 pm8001_ha->phy_attr_table.phystart1_16[12] = in read_phy_attr_table()
660 pm8001_ha->phy_attr_table.phystart1_16[13] = in read_phy_attr_table()
662 pm8001_ha->phy_attr_table.phystart1_16[14] = in read_phy_attr_table()
664 pm8001_ha->phy_attr_table.phystart1_16[15] = in read_phy_attr_table()
667 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[0] = in read_phy_attr_table()
669 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[1] = in read_phy_attr_table()
671 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[2] = in read_phy_attr_table()
673 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[3] = in read_phy_attr_table()
675 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[4] = in read_phy_attr_table()
677 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[5] = in read_phy_attr_table()
679 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[6] = in read_phy_attr_table()
681 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[7] = in read_phy_attr_table()
683 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[8] = in read_phy_attr_table()
685 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[9] = in read_phy_attr_table()
687 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[10] = in read_phy_attr_table()
689 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[11] = in read_phy_attr_table()
691 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[12] = in read_phy_attr_table()
693 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[13] = in read_phy_attr_table()
695 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[14] = in read_phy_attr_table()
697 pm8001_ha->phy_attr_table.outbound_hw_event_pid1_16[15] = in read_phy_attr_table()
703 * read_inbnd_queue_table - read the inbound queue table and save it.
709 void __iomem *address = pm8001_ha->inbnd_q_tbl_addr; in read_inbnd_queue_table()
712 pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = in read_inbnd_queue_table()
715 pm8001_ha->inbnd_q_tbl[i].pi_offset = in read_inbnd_queue_table()
721 * read_outbnd_queue_table - read the outbound queue table and save it.
727 void __iomem *address = pm8001_ha->outbnd_q_tbl_addr; in read_outbnd_queue_table()
730 pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = in read_outbnd_queue_table()
733 pm8001_ha->outbnd_q_tbl[i].ci_offset = in read_outbnd_queue_table()
739 * init_default_table_values - init the default table.
746 void __iomem *addressib = pm8001_ha->inbnd_q_tbl_addr; in init_default_table_values()
747 void __iomem *addressob = pm8001_ha->outbnd_q_tbl_addr; in init_default_table_values()
748 u32 ib_offset = pm8001_ha->ib_offset; in init_default_table_values()
749 u32 ob_offset = pm8001_ha->ob_offset; in init_default_table_values()
750 u32 ci_offset = pm8001_ha->ci_offset; in init_default_table_values()
751 u32 pi_offset = pm8001_ha->pi_offset; in init_default_table_values()
753 pm8001_ha->main_cfg_tbl.pm80xx_tbl.upper_event_log_addr = in init_default_table_values()
754 pm8001_ha->memoryMap.region[AAP1].phys_addr_hi; in init_default_table_values()
755 pm8001_ha->main_cfg_tbl.pm80xx_tbl.lower_event_log_addr = in init_default_table_values()
756 pm8001_ha->memoryMap.region[AAP1].phys_addr_lo; in init_default_table_values()
757 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size = in init_default_table_values()
759 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_severity = 0x01; in init_default_table_values()
760 pm8001_ha->main_cfg_tbl.pm80xx_tbl.upper_pcs_event_log_addr = in init_default_table_values()
761 pm8001_ha->memoryMap.region[IOP].phys_addr_hi; in init_default_table_values()
762 pm8001_ha->main_cfg_tbl.pm80xx_tbl.lower_pcs_event_log_addr = in init_default_table_values()
763 pm8001_ha->memoryMap.region[IOP].phys_addr_lo; in init_default_table_values()
764 pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_size = in init_default_table_values()
766 pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity = 0x01; in init_default_table_values()
767 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt = 0x01; in init_default_table_values()
770 if (pm8001_ha->max_q_num > 32) in init_default_table_values()
771 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |= in init_default_table_values()
774 pm8001_ha->main_cfg_tbl.pm80xx_tbl.crc_core_dump = (0x1 << 16); in init_default_table_values()
776 for (i = 0; i < pm8001_ha->max_q_num; i++) { in init_default_table_values()
777 pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt = in init_default_table_values()
778 PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x00<<30); in init_default_table_values()
779 pm8001_ha->inbnd_q_tbl[i].upper_base_addr = in init_default_table_values()
780 pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_hi; in init_default_table_values()
781 pm8001_ha->inbnd_q_tbl[i].lower_base_addr = in init_default_table_values()
782 pm8001_ha->memoryMap.region[ib_offset + i].phys_addr_lo; in init_default_table_values()
783 pm8001_ha->inbnd_q_tbl[i].base_virt = in init_default_table_values()
784 (u8 *)pm8001_ha->memoryMap.region[ib_offset + i].virt_ptr; in init_default_table_values()
785 pm8001_ha->inbnd_q_tbl[i].total_length = in init_default_table_values()
786 pm8001_ha->memoryMap.region[ib_offset + i].total_len; in init_default_table_values()
787 pm8001_ha->inbnd_q_tbl[i].ci_upper_base_addr = in init_default_table_values()
788 pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_hi; in init_default_table_values()
789 pm8001_ha->inbnd_q_tbl[i].ci_lower_base_addr = in init_default_table_values()
790 pm8001_ha->memoryMap.region[ci_offset + i].phys_addr_lo; in init_default_table_values()
791 pm8001_ha->inbnd_q_tbl[i].ci_virt = in init_default_table_values()
792 pm8001_ha->memoryMap.region[ci_offset + i].virt_ptr; in init_default_table_values()
793 pm8001_write_32(pm8001_ha->inbnd_q_tbl[i].ci_virt, 0, 0); in init_default_table_values()
795 pm8001_ha->inbnd_q_tbl[i].pi_pci_bar = in init_default_table_values()
798 pm8001_ha->inbnd_q_tbl[i].pi_offset = in init_default_table_values()
800 pm8001_ha->inbnd_q_tbl[i].producer_idx = 0; in init_default_table_values()
801 pm8001_ha->inbnd_q_tbl[i].consumer_index = 0; in init_default_table_values()
805 pm8001_ha->inbnd_q_tbl[i].pi_pci_bar, in init_default_table_values()
806 pm8001_ha->inbnd_q_tbl[i].pi_offset); in init_default_table_values()
808 for (i = 0; i < pm8001_ha->max_q_num; i++) { in init_default_table_values()
809 pm8001_ha->outbnd_q_tbl[i].element_size_cnt = in init_default_table_values()
810 PM8001_MPI_QUEUE | (pm8001_ha->iomb_size << 16) | (0x01<<30); in init_default_table_values()
811 pm8001_ha->outbnd_q_tbl[i].upper_base_addr = in init_default_table_values()
812 pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_hi; in init_default_table_values()
813 pm8001_ha->outbnd_q_tbl[i].lower_base_addr = in init_default_table_values()
814 pm8001_ha->memoryMap.region[ob_offset + i].phys_addr_lo; in init_default_table_values()
815 pm8001_ha->outbnd_q_tbl[i].base_virt = in init_default_table_values()
816 (u8 *)pm8001_ha->memoryMap.region[ob_offset + i].virt_ptr; in init_default_table_values()
817 pm8001_ha->outbnd_q_tbl[i].total_length = in init_default_table_values()
818 pm8001_ha->memoryMap.region[ob_offset + i].total_len; in init_default_table_values()
819 pm8001_ha->outbnd_q_tbl[i].pi_upper_base_addr = in init_default_table_values()
820 pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_hi; in init_default_table_values()
821 pm8001_ha->outbnd_q_tbl[i].pi_lower_base_addr = in init_default_table_values()
822 pm8001_ha->memoryMap.region[pi_offset + i].phys_addr_lo; in init_default_table_values()
824 pm8001_ha->outbnd_q_tbl[i].interrup_vec_cnt_delay = (i << 24); in init_default_table_values()
825 pm8001_ha->outbnd_q_tbl[i].pi_virt = in init_default_table_values()
826 pm8001_ha->memoryMap.region[pi_offset + i].virt_ptr; in init_default_table_values()
827 pm8001_write_32(pm8001_ha->outbnd_q_tbl[i].pi_virt, 0, 0); in init_default_table_values()
829 pm8001_ha->outbnd_q_tbl[i].ci_pci_bar = in init_default_table_values()
832 pm8001_ha->outbnd_q_tbl[i].ci_offset = in init_default_table_values()
834 pm8001_ha->outbnd_q_tbl[i].consumer_idx = 0; in init_default_table_values()
835 pm8001_ha->outbnd_q_tbl[i].producer_index = 0; in init_default_table_values()
839 pm8001_ha->outbnd_q_tbl[i].ci_pci_bar, in init_default_table_values()
840 pm8001_ha->outbnd_q_tbl[i].ci_offset); in init_default_table_values()
845 * update_main_config_table - update the main default table to the HBA.
850 void __iomem *address = pm8001_ha->main_cfg_tbl_addr; in update_main_config_table()
852 pm8001_ha->main_cfg_tbl.pm80xx_tbl.inbound_q_nppd_hppd); in update_main_config_table()
854 pm8001_ha->main_cfg_tbl.pm80xx_tbl.upper_event_log_addr); in update_main_config_table()
856 pm8001_ha->main_cfg_tbl.pm80xx_tbl.lower_event_log_addr); in update_main_config_table()
858 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_size); in update_main_config_table()
860 pm8001_ha->main_cfg_tbl.pm80xx_tbl.event_log_severity); in update_main_config_table()
862 pm8001_ha->main_cfg_tbl.pm80xx_tbl.upper_pcs_event_log_addr); in update_main_config_table()
864 pm8001_ha->main_cfg_tbl.pm80xx_tbl.lower_pcs_event_log_addr); in update_main_config_table()
866 pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_size); in update_main_config_table()
868 pm8001_ha->main_cfg_tbl.pm80xx_tbl.pcs_event_log_severity); in update_main_config_table()
870 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt |= in update_main_config_table()
871 ((pm8001_ha->max_q_num - 1) << 8); in update_main_config_table()
873 pm8001_ha->main_cfg_tbl.pm80xx_tbl.fatal_err_interrupt); in update_main_config_table()
879 pm8001_ha->main_cfg_tbl.pm80xx_tbl.crc_core_dump); in update_main_config_table()
882 pm8001_ha->main_cfg_tbl.pm80xx_tbl.gpio_led_mapping &= 0xCFFFFFFF; in update_main_config_table()
884 pm8001_ha->main_cfg_tbl.pm80xx_tbl.gpio_led_mapping |= 0x20000000; in update_main_config_table()
886 pm8001_ha->main_cfg_tbl.pm80xx_tbl.gpio_led_mapping); in update_main_config_table()
892 pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer); in update_main_config_table()
894 pm8001_ha->main_cfg_tbl.pm80xx_tbl.interrupt_reassertion_delay); in update_main_config_table()
896 pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer &= 0xffff0000; in update_main_config_table()
897 pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer |= in update_main_config_table()
899 if (pm8001_ha->chip_id == chip_8006) { in update_main_config_table()
900 pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer &= in update_main_config_table()
902 pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer |= in update_main_config_table()
906 pm8001_ha->main_cfg_tbl.pm80xx_tbl.port_recovery_timer); in update_main_config_table()
910 * update_inbnd_queue_table - update the inbound queue table to the HBA.
917 void __iomem *address = pm8001_ha->inbnd_q_tbl_addr; in update_inbnd_queue_table()
920 pm8001_ha->inbnd_q_tbl[number].element_pri_size_cnt); in update_inbnd_queue_table()
922 pm8001_ha->inbnd_q_tbl[number].upper_base_addr); in update_inbnd_queue_table()
924 pm8001_ha->inbnd_q_tbl[number].lower_base_addr); in update_inbnd_queue_table()
926 pm8001_ha->inbnd_q_tbl[number].ci_upper_base_addr); in update_inbnd_queue_table()
928 pm8001_ha->inbnd_q_tbl[number].ci_lower_base_addr); in update_inbnd_queue_table()
933 pm8001_ha->inbnd_q_tbl[number].element_pri_size_cnt); in update_inbnd_queue_table()
937 pm8001_ha->inbnd_q_tbl[number].upper_base_addr, in update_inbnd_queue_table()
938 pm8001_ha->inbnd_q_tbl[number].lower_base_addr); in update_inbnd_queue_table()
942 pm8001_ha->inbnd_q_tbl[number].ci_upper_base_addr, in update_inbnd_queue_table()
943 pm8001_ha->inbnd_q_tbl[number].ci_lower_base_addr); in update_inbnd_queue_table()
947 * update_outbnd_queue_table - update the outbound queue table to the HBA.
954 void __iomem *address = pm8001_ha->outbnd_q_tbl_addr; in update_outbnd_queue_table()
957 pm8001_ha->outbnd_q_tbl[number].element_size_cnt); in update_outbnd_queue_table()
959 pm8001_ha->outbnd_q_tbl[number].upper_base_addr); in update_outbnd_queue_table()
961 pm8001_ha->outbnd_q_tbl[number].lower_base_addr); in update_outbnd_queue_table()
963 pm8001_ha->outbnd_q_tbl[number].pi_upper_base_addr); in update_outbnd_queue_table()
965 pm8001_ha->outbnd_q_tbl[number].pi_lower_base_addr); in update_outbnd_queue_table()
967 pm8001_ha->outbnd_q_tbl[number].interrup_vec_cnt_delay); in update_outbnd_queue_table()
972 pm8001_ha->outbnd_q_tbl[number].element_size_cnt); in update_outbnd_queue_table()
976 pm8001_ha->outbnd_q_tbl[number].upper_base_addr, in update_outbnd_queue_table()
977 pm8001_ha->outbnd_q_tbl[number].lower_base_addr); in update_outbnd_queue_table()
981 pm8001_ha->outbnd_q_tbl[number].pi_upper_base_addr, in update_outbnd_queue_table()
982 pm8001_ha->outbnd_q_tbl[number].pi_lower_base_addr); in update_outbnd_queue_table()
986 * mpi_init_check - check firmware initialization status.
999 if (IS_SPCV_12G(pm8001_ha->pdev)) { in mpi_init_check()
1008 } while ((value != 0) && (--max_wait_count)); in mpi_init_check()
1015 return -EBUSY; in mpi_init_check()
1017 /* check the MPI-State for initialization up to 100ms*/ in mpi_init_check()
1022 pm8001_mr32(pm8001_ha->general_stat_tbl_addr, in mpi_init_check()
1025 (gst_len_mpistate & GST_MPI_STATE_MASK)) && (--max_wait_count)); in mpi_init_check()
1027 return -EBUSY; in mpi_init_check()
1032 return -EBUSY; in mpi_init_check()
1045 * check_fw_ready - The LLDD check if the FW is ready, if not, return error.
1062 } while ((value == 0xFFFFFFFF) && (--max_wait_count)); in check_fw_ready()
1065 if ((pm8001_ha->chip_id != chip_8008) && in check_fw_ready()
1066 (pm8001_ha->chip_id != chip_8009)) { in check_fw_ready()
1082 expected_mask) && (--max_wait_count)); in check_fw_ready()
1087 ret = -1; in check_fw_ready()
1091 (max_wait_time - max_wait_count) * FW_READY_INTERVAL); in check_fw_ready()
1125 if (offset > pm8001_ha->io_mem[pcibar].memsize) { in init_pci_device_addresses()
1128 offset, pm8001_ha->io_mem[pcibar].memsize); in init_pci_device_addresses()
1129 return -EBUSY; in init_pci_device_addresses()
1131 pm8001_ha->main_cfg_tbl_addr = base_addr = in init_pci_device_addresses()
1132 pm8001_ha->io_mem[pcibar].memvirtaddr + offset; in init_pci_device_addresses()
1138 value = pm8001_mr32(pm8001_ha->main_cfg_tbl_addr, 0); in init_pci_device_addresses()
1143 return -EBUSY; in init_pci_device_addresses()
1147 pm8001_ha->general_stat_tbl_addr = in init_pci_device_addresses()
1150 pm8001_ha->inbnd_q_tbl_addr = in init_pci_device_addresses()
1153 pm8001_ha->outbnd_q_tbl_addr = in init_pci_device_addresses()
1156 pm8001_ha->ivt_tbl_addr = in init_pci_device_addresses()
1159 pm8001_ha->pspa_q_tbl_addr = in init_pci_device_addresses()
1162 pm8001_ha->fatal_tbl_addr = in init_pci_device_addresses()
1176 pm8001_dbg(pm8001_ha, INIT, "addr - main cfg %p general status %p\n", in init_pci_device_addresses()
1177 pm8001_ha->main_cfg_tbl_addr, in init_pci_device_addresses()
1178 pm8001_ha->general_stat_tbl_addr); in init_pci_device_addresses()
1179 pm8001_dbg(pm8001_ha, INIT, "addr - inbnd %p obnd %p\n", in init_pci_device_addresses()
1180 pm8001_ha->inbnd_q_tbl_addr, in init_pci_device_addresses()
1181 pm8001_ha->outbnd_q_tbl_addr); in init_pci_device_addresses()
1182 pm8001_dbg(pm8001_ha, INIT, "addr - pspa %p ivt %p\n", in init_pci_device_addresses()
1183 pm8001_ha->pspa_q_tbl_addr, in init_pci_device_addresses()
1184 pm8001_ha->ivt_tbl_addr); in init_pci_device_addresses()
1189 * pm80xx_set_thermal_config - support the thermal configuration
1208 if (IS_SPCV_12G(pm8001_ha->pdev)) in pm80xx_set_thermal_config()
1232 * pm80xx_set_sas_protocol_timer_config - support the SAS Protocol
1302 * pm80xx_get_encrypt_info - Check for encryption
1309 int ret = -1; in pm80xx_get_encrypt_info()
1317 pm8001_ha->encrypt_info.cipher_mode = CIPHER_MODE_XTS; in pm80xx_get_encrypt_info()
1320 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMF; in pm80xx_get_encrypt_info()
1323 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMA; in pm80xx_get_encrypt_info()
1326 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMB; in pm80xx_get_encrypt_info()
1327 pm8001_ha->encrypt_info.status = 0; in pm80xx_get_encrypt_info()
1331 pm8001_ha->encrypt_info.cipher_mode, in pm80xx_get_encrypt_info()
1332 pm8001_ha->encrypt_info.sec_mode, in pm80xx_get_encrypt_info()
1333 pm8001_ha->encrypt_info.status); in pm80xx_get_encrypt_info()
1340 pm8001_ha->encrypt_info.status = 0xFFFFFFFF; in pm80xx_get_encrypt_info()
1341 pm8001_ha->encrypt_info.cipher_mode = 0; in pm80xx_get_encrypt_info()
1342 pm8001_ha->encrypt_info.sec_mode = 0; in pm80xx_get_encrypt_info()
1346 pm8001_ha->encrypt_info.status = in pm80xx_get_encrypt_info()
1349 pm8001_ha->encrypt_info.cipher_mode = CIPHER_MODE_XTS; in pm80xx_get_encrypt_info()
1352 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMF; in pm80xx_get_encrypt_info()
1355 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMA; in pm80xx_get_encrypt_info()
1358 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMB; in pm80xx_get_encrypt_info()
1362 pm8001_ha->encrypt_info.cipher_mode, in pm80xx_get_encrypt_info()
1363 pm8001_ha->encrypt_info.sec_mode, in pm80xx_get_encrypt_info()
1364 pm8001_ha->encrypt_info.status); in pm80xx_get_encrypt_info()
1368 pm8001_ha->encrypt_info.status = in pm80xx_get_encrypt_info()
1371 pm8001_ha->encrypt_info.cipher_mode = CIPHER_MODE_XTS; in pm80xx_get_encrypt_info()
1374 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMF; in pm80xx_get_encrypt_info()
1377 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMA; in pm80xx_get_encrypt_info()
1380 pm8001_ha->encrypt_info.sec_mode = SEC_MODE_SMB; in pm80xx_get_encrypt_info()
1385 pm8001_ha->encrypt_info.cipher_mode, in pm80xx_get_encrypt_info()
1386 pm8001_ha->encrypt_info.sec_mode, in pm80xx_get_encrypt_info()
1387 pm8001_ha->encrypt_info.status); in pm80xx_get_encrypt_info()
1393 * pm80xx_encrypt_update - update flash with encryption information
1429 * pm80xx_chip_init - the main init function that initializes whole PM8001 chip.
1438 if (-1 == check_fw_ready(pm8001_ha)) { in pm80xx_chip_init()
1440 return -EBUSY; in pm80xx_chip_init()
1444 pm8001_ha->controller_fatal_error = false; in pm80xx_chip_init()
1462 for (i = 0; i < pm8001_ha->max_q_num; i++) { in pm80xx_chip_init()
1470 return -EBUSY; in pm80xx_chip_init()
1481 if (pm8001_ha->chip->encrypt) { in pm80xx_chip_post_init()
1486 if (ret == -1) { in pm80xx_chip_post_init()
1488 if (pm8001_ha->encrypt_info.status == 0x81) { in pm80xx_chip_post_init()
1516 if (IS_SPCV_12G(pm8001_ha->pdev)) { in mpi_uninit_check()
1525 } while ((value != 0) && (--max_wait_count)); in mpi_uninit_check()
1529 return -1; in mpi_uninit_check()
1532 /* check the MPI-State for termination in progress */ in mpi_uninit_check()
1538 pm8001_mr32(pm8001_ha->general_stat_tbl_addr, in mpi_uninit_check()
1543 } while (--max_wait_count); in mpi_uninit_check()
1547 return -1; in mpi_uninit_check()
1554 * pm80xx_fatal_errors - returns non-zero *ONLY* when fatal errors
1571 if (pm8001_ha->chip_id != chip_8006 && in pm80xx_fatal_errors()
1572 pm8001_ha->chip_id != chip_8074 && in pm80xx_fatal_errors()
1573 pm8001_ha->chip_id != chip_8076) { in pm80xx_fatal_errors()
1589 * pm80xx_chip_soft_rst - soft reset the PM8001 chip, so that all
1602 if (!pm8001_ha->controller_fatal_error) { in pm80xx_chip_soft_rst()
1616 return -1; in pm80xx_chip_soft_rst()
1648 "Bootloader state - HDA mode SEEPROM\n"); in pm80xx_chip_soft_rst()
1652 "Bootloader state - HDA mode Bootstrap Pin\n"); in pm80xx_chip_soft_rst()
1656 "Bootloader state - HDA mode soft reset\n"); in pm80xx_chip_soft_rst()
1660 "Bootloader state-HDA mode critical error\n"); in pm80xx_chip_soft_rst()
1662 return -EBUSY; in pm80xx_chip_soft_rst()
1666 if (-1 == check_fw_ready(pm8001_ha)) { in pm80xx_chip_soft_rst()
1669 if (pm8001_ha->pdev->subsystem_vendor != in pm80xx_chip_soft_rst()
1671 pm8001_ha->pdev->subsystem_vendor != in pm80xx_chip_soft_rst()
1673 pm8001_ha->pdev->subsystem_vendor != 0) { in pm80xx_chip_soft_rst()
1681 return -EBUSY; in pm80xx_chip_soft_rst()
1686 return -EBUSY; in pm80xx_chip_soft_rst()
1712 } while ((--i) != 0); in pm80xx_hw_chip_rst()
1718 * pm80xx_chip_interrupt_enable - enable PM8001 chip interrupt
1725 if (!pm8001_ha->use_msix) { in pm80xx_chip_interrupt_enable()
1734 pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_CLR_U, 1U << (vec - 32)); in pm80xx_chip_interrupt_enable()
1738 * pm80xx_chip_interrupt_disable - disable PM8001 chip interrupt
1745 if (!pm8001_ha->use_msix) { in pm80xx_chip_interrupt_disable()
1751 /* disable all vectors 0-31, 32-63 */ in pm80xx_chip_interrupt_disable()
1757 pm8001_cw32(pm8001_ha, 0, MSGU_ODMR_U, 1U << (vec - 32)); in pm80xx_chip_interrupt_disable()
1762 * mpi_ssp_completion - process the event that FW response to the SSP request.
1786 status = le32_to_cpu(psspPayload->status); in mpi_ssp_completion()
1787 tag = le32_to_cpu(psspPayload->tag); in mpi_ssp_completion()
1788 ccb = &pm8001_ha->ccb_info[tag]; in mpi_ssp_completion()
1789 if ((status == IO_ABORTED) && ccb->open_retry) { in mpi_ssp_completion()
1791 ccb->open_retry = 0; in mpi_ssp_completion()
1794 pm8001_dev = ccb->device; in mpi_ssp_completion()
1795 param = le32_to_cpu(psspPayload->param); in mpi_ssp_completion()
1796 t = ccb->task; in mpi_ssp_completion()
1800 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_ssp_completion()
1802 ts = &t->task_status; in mpi_ssp_completion()
1811 SAS_ADDR(t->dev->sas_addr)); in mpi_ssp_completion()
1818 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1819 ts->stat = SAS_SAM_STAT_GOOD; in mpi_ssp_completion()
1821 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1822 ts->stat = SAS_PROTO_RESPONSE; in mpi_ssp_completion()
1823 ts->residual = param; in mpi_ssp_completion()
1824 iu = &psspPayload->ssp_resp_iu; in mpi_ssp_completion()
1825 sas_ssp_task_response(pm8001_ha->dev, t, iu); in mpi_ssp_completion()
1828 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1832 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1833 ts->stat = SAS_ABORTED_TASK; in mpi_ssp_completion()
1835 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1841 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1842 ts->stat = SAS_DATA_UNDERRUN; in mpi_ssp_completion()
1843 ts->residual = param; in mpi_ssp_completion()
1845 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1849 ts->resp = SAS_TASK_UNDELIVERED; in mpi_ssp_completion()
1850 ts->stat = SAS_PHY_DOWN; in mpi_ssp_completion()
1852 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1856 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1857 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1859 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1861 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1865 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1866 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1867 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1869 atomic_dec(&pm8001_dev->running_req); 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()
1878 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1883 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1884 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1885 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_ssp_completion()
1887 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1892 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1893 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1894 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_completion()
1896 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1900 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1901 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1902 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1904 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1913 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1914 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1915 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_completion()
1916 if (!t->uldd_task) in mpi_ssp_completion()
1924 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1925 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1926 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_ssp_completion()
1928 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1933 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1934 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1935 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_ssp_completion()
1937 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1942 ts->resp = SAS_TASK_UNDELIVERED; in mpi_ssp_completion()
1943 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1944 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_ssp_completion()
1946 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1950 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1951 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1952 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1954 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1958 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1959 ts->stat = SAS_NAK_R_ERR; in mpi_ssp_completion()
1961 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1965 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1966 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1968 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1972 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1973 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1974 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
1976 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1980 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1981 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1983 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1987 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1988 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1990 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
1994 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
1995 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
1996 if (!t->uldd_task) in mpi_ssp_completion()
2003 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
2004 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
2006 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
2010 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
2011 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
2013 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
2017 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
2018 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
2020 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
2025 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
2026 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
2027 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_completion()
2029 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
2034 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_completion()
2035 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_completion()
2037 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_completion()
2041 psspPayload->ssp_resp_iu.status); in mpi_ssp_completion()
2042 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_ssp_completion()
2043 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_ssp_completion()
2044 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_ssp_completion()
2045 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_ssp_completion()
2046 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_completion()
2049 t, status, ts->resp, ts->stat); in mpi_ssp_completion()
2051 if (t->slow_task) in mpi_ssp_completion()
2052 complete(&t->slow_task->completion); in mpi_ssp_completion()
2054 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_completion()
2069 u32 event = le32_to_cpu(psspPayload->event); in mpi_ssp_event()
2070 u32 tag = le32_to_cpu(psspPayload->tag); in mpi_ssp_event()
2071 u32 port_id = le32_to_cpu(psspPayload->port_id); in mpi_ssp_event()
2073 ccb = &pm8001_ha->ccb_info[tag]; in mpi_ssp_event()
2074 t = ccb->task; in mpi_ssp_event()
2075 pm8001_dev = ccb->device; in mpi_ssp_event()
2078 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_ssp_event()
2080 ts = &t->task_status; in mpi_ssp_event()
2086 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2087 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2088 ts->residual = 0; in mpi_ssp_event()
2090 atomic_dec(&pm8001_dev->running_req); in mpi_ssp_event()
2098 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2099 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2100 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2105 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2106 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2107 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_ssp_event()
2112 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2113 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2114 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_event()
2118 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2119 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2120 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2129 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2130 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2131 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_ssp_event()
2132 if (!t->uldd_task) in mpi_ssp_event()
2140 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2141 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2142 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_ssp_event()
2147 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2148 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2149 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_ssp_event()
2154 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2155 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2156 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_ssp_event()
2160 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2161 ts->stat = SAS_OPEN_REJECT; in mpi_ssp_event()
2162 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_ssp_event()
2166 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2167 ts->stat = SAS_NAK_R_ERR; in mpi_ssp_event()
2175 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2176 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2180 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2181 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2186 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2187 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2192 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2193 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2197 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2198 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2203 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2204 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2210 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2211 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2219 ts->resp = SAS_TASK_COMPLETE; in mpi_ssp_event()
2220 ts->stat = SAS_DATA_OVERRUN; in mpi_ssp_event()
2223 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_ssp_event()
2224 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_ssp_event()
2225 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_ssp_event()
2226 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_ssp_event()
2227 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_event()
2230 t, event, ts->resp, ts->stat); in mpi_ssp_event()
2233 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_ssp_event()
2260 status = le32_to_cpu(psataPayload->status); in mpi_sata_completion()
2261 param = le32_to_cpu(psataPayload->param); in mpi_sata_completion()
2262 tag = le32_to_cpu(psataPayload->tag); in mpi_sata_completion()
2264 ccb = &pm8001_ha->ccb_info[tag]; in mpi_sata_completion()
2265 t = ccb->task; in mpi_sata_completion()
2266 pm8001_dev = ccb->device; in mpi_sata_completion()
2269 if (t->dev && (t->dev->lldd_dev)) in mpi_sata_completion()
2270 pm8001_dev = t->dev->lldd_dev; in mpi_sata_completion()
2273 ccb->ccb_tag); in mpi_sata_completion()
2279 if (pm8001_dev && unlikely(!t->lldd_task || !t->dev)) in mpi_sata_completion()
2282 ts = &t->task_status; in mpi_sata_completion()
2287 pm8001_dev->device_id, status, tag); in mpi_sata_completion()
2293 if (!((t->dev->parent) && in mpi_sata_completion()
2294 (dev_is_expander(t->dev->parent->dev_type)))) { in mpi_sata_completion()
2296 sata_addr_low[i] = pm8001_ha->sas_addr[j]; in mpi_sata_completion()
2298 sata_addr_hi[i] = pm8001_ha->sas_addr[j]; in mpi_sata_completion()
2318 pm8001_dev->attached_phy + in mpi_sata_completion()
2328 SAS_ADDR(t->dev->sas_addr)); in mpi_sata_completion()
2335 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2336 ts->stat = SAS_SAM_STAT_GOOD; in mpi_sata_completion()
2339 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2340 ts->stat = SAS_PROTO_RESPONSE; in mpi_sata_completion()
2341 ts->residual = param; in mpi_sata_completion()
2345 sata_resp = &psataPayload->sata_resp[0]; in mpi_sata_completion()
2346 resp = (struct ata_task_resp *)ts->buf; in mpi_sata_completion()
2347 if (t->ata_task.dma_xfer == 0 && in mpi_sata_completion()
2348 t->data_dir == DMA_FROM_DEVICE) { in mpi_sata_completion()
2352 } else if (t->ata_task.use_ncq && in mpi_sata_completion()
2353 t->data_dir != DMA_NONE) { in mpi_sata_completion()
2363 resp->frame_len = len; in mpi_sata_completion()
2364 memcpy(&resp->ending_fis[0], sata_resp, len); in mpi_sata_completion()
2365 ts->buf_valid_size = sizeof(*resp); in mpi_sata_completion()
2371 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2375 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2376 ts->stat = SAS_ABORTED_TASK; in mpi_sata_completion()
2378 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2384 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2385 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_completion()
2386 ts->residual = param; in mpi_sata_completion()
2388 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2392 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2393 ts->stat = SAS_PHY_DOWN; in mpi_sata_completion()
2395 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2399 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2400 ts->stat = SAS_INTERRUPTED; in mpi_sata_completion()
2402 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2406 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2407 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2408 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_completion()
2410 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2415 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2416 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2417 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_sata_completion()
2419 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2424 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2425 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2426 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_sata_completion()
2428 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2432 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2433 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2434 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_sata_completion()
2436 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2445 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2446 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2447 if (!t->uldd_task) { in mpi_sata_completion()
2451 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2452 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2453 spin_unlock_irqrestore(&circularQ->oq_lock, in mpi_sata_completion()
2454 circularQ->lock_flags); in mpi_sata_completion()
2456 spin_lock_irqsave(&circularQ->oq_lock, in mpi_sata_completion()
2457 circularQ->lock_flags); in mpi_sata_completion()
2464 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2465 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2466 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_sata_completion()
2467 if (!t->uldd_task) { in mpi_sata_completion()
2471 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2472 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2473 spin_unlock_irqrestore(&circularQ->oq_lock, in mpi_sata_completion()
2474 circularQ->lock_flags); in mpi_sata_completion()
2476 spin_lock_irqsave(&circularQ->oq_lock, in mpi_sata_completion()
2477 circularQ->lock_flags); in mpi_sata_completion()
2484 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2485 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2486 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_sata_completion()
2488 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2493 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2494 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2495 if (!t->uldd_task) { in mpi_sata_completion()
2499 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2500 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2501 spin_unlock_irqrestore(&circularQ->oq_lock, in mpi_sata_completion()
2502 circularQ->lock_flags); in mpi_sata_completion()
2504 spin_lock_irqsave(&circularQ->oq_lock, in mpi_sata_completion()
2505 circularQ->lock_flags); in mpi_sata_completion()
2512 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2513 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2514 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_sata_completion()
2516 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2520 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2521 ts->stat = SAS_NAK_R_ERR; in mpi_sata_completion()
2523 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2527 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2528 ts->stat = SAS_NAK_R_ERR; in mpi_sata_completion()
2530 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2534 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2535 ts->stat = SAS_ABORTED_TASK; in mpi_sata_completion()
2537 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2541 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2542 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2544 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2548 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2549 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_completion()
2551 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2555 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2556 ts->stat = SAS_OPEN_TO; in mpi_sata_completion()
2558 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2562 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2563 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2565 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2569 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2570 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2571 if (!t->uldd_task) { in mpi_sata_completion()
2574 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2575 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2576 spin_unlock_irqrestore(&circularQ->oq_lock, in mpi_sata_completion()
2577 circularQ->lock_flags); in mpi_sata_completion()
2579 spin_lock_irqsave(&circularQ->oq_lock, in mpi_sata_completion()
2580 circularQ->lock_flags); in mpi_sata_completion()
2586 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2587 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2589 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2593 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2594 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2595 if (!t->uldd_task) { in mpi_sata_completion()
2598 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_completion()
2599 ts->stat = SAS_QUEUE_FULL; in mpi_sata_completion()
2600 spin_unlock_irqrestore(&circularQ->oq_lock, in mpi_sata_completion()
2601 circularQ->lock_flags); in mpi_sata_completion()
2603 spin_lock_irqsave(&circularQ->oq_lock, in mpi_sata_completion()
2604 circularQ->lock_flags); in mpi_sata_completion()
2611 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2612 ts->stat = SAS_OPEN_REJECT; in mpi_sata_completion()
2613 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_completion()
2615 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2620 pm8001_dev->device_id, status, tag); in mpi_sata_completion()
2622 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_completion()
2623 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_completion()
2625 atomic_dec(&pm8001_dev->running_req); in mpi_sata_completion()
2628 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_sata_completion()
2629 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_sata_completion()
2630 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_sata_completion()
2631 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_sata_completion()
2632 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_sata_completion()
2635 t, status, ts->resp, ts->stat); in mpi_sata_completion()
2637 if (t->slow_task) in mpi_sata_completion()
2638 complete(&t->slow_task->completion); in mpi_sata_completion()
2640 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_sata_completion()
2641 spin_unlock_irqrestore(&circularQ->oq_lock, in mpi_sata_completion()
2642 circularQ->lock_flags); in mpi_sata_completion()
2644 spin_lock_irqsave(&circularQ->oq_lock, in mpi_sata_completion()
2645 circularQ->lock_flags); in mpi_sata_completion()
2659 u32 event = le32_to_cpu(psataPayload->event); in mpi_sata_event()
2660 u32 tag = le32_to_cpu(psataPayload->tag); in mpi_sata_event()
2661 u32 port_id = le32_to_cpu(psataPayload->port_id); in mpi_sata_event()
2662 u32 dev_id = le32_to_cpu(psataPayload->device_id); in mpi_sata_event()
2671 /* send read log extension by aborting the link - libata does what we want */ in mpi_sata_event()
2679 ccb = &pm8001_ha->ccb_info[tag]; in mpi_sata_event()
2680 t = ccb->task; in mpi_sata_event()
2681 pm8001_dev = ccb->device; in mpi_sata_event()
2684 ccb->ccb_tag); in mpi_sata_event()
2689 if (unlikely(!t->lldd_task || !t->dev)) in mpi_sata_event()
2692 ts = &t->task_status; in mpi_sata_event()
2698 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2699 ts->stat = SAS_DATA_OVERRUN; in mpi_sata_event()
2700 ts->residual = 0; in mpi_sata_event()
2704 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2705 ts->stat = SAS_INTERRUPTED; in mpi_sata_event()
2709 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2710 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2711 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_sata_event()
2716 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2717 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2718 ts->open_rej_reason = SAS_OREJ_EPROTO; in mpi_sata_event()
2723 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2724 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2725 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_sata_event()
2729 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2730 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2731 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_sata_event()
2741 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_event()
2742 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_sata_event()
2743 if (!t->uldd_task) { in mpi_sata_event()
2747 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2748 ts->stat = SAS_QUEUE_FULL; in mpi_sata_event()
2755 ts->resp = SAS_TASK_UNDELIVERED; in mpi_sata_event()
2756 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2757 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_sata_event()
2762 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2763 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2764 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_sata_event()
2769 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2770 ts->stat = SAS_OPEN_REJECT; in mpi_sata_event()
2771 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_sata_event()
2775 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2776 ts->stat = SAS_NAK_R_ERR; in mpi_sata_event()
2780 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2781 ts->stat = SAS_NAK_R_ERR; in mpi_sata_event()
2785 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2786 ts->stat = SAS_DATA_UNDERRUN; in mpi_sata_event()
2790 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2791 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2795 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2796 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2800 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2801 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2806 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2807 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2811 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2812 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2817 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2818 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2825 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2826 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2832 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2833 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2838 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2839 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2844 ts->resp = SAS_TASK_COMPLETE; in mpi_sata_event()
2845 ts->stat = SAS_OPEN_TO; in mpi_sata_event()
2865 status = le32_to_cpu(psmpPayload->status); in mpi_smp_completion()
2866 tag = le32_to_cpu(psmpPayload->tag); in mpi_smp_completion()
2868 ccb = &pm8001_ha->ccb_info[tag]; in mpi_smp_completion()
2869 param = le32_to_cpu(psmpPayload->param); in mpi_smp_completion()
2870 t = ccb->task; in mpi_smp_completion()
2871 ts = &t->task_status; in mpi_smp_completion()
2872 pm8001_dev = ccb->device; in mpi_smp_completion()
2875 if (unlikely(!t || !t->lldd_task || !t->dev)) in mpi_smp_completion()
2884 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2885 ts->stat = SAS_SAM_STAT_GOOD; in mpi_smp_completion()
2887 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2888 if (pm8001_ha->smp_exp_mode == SMP_DIRECT) { in mpi_smp_completion()
2889 struct scatterlist *sg_resp = &t->smp_task.smp_resp; in mpi_smp_completion()
2897 payload = to + sg_resp->offset; in mpi_smp_completion()
2899 *(payload + i) = psmpPayload->_r_a[i]; in mpi_smp_completion()
2903 psmpPayload->_r_a[i]); in mpi_smp_completion()
2910 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2911 ts->stat = SAS_ABORTED_TASK; in mpi_smp_completion()
2913 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2917 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2918 ts->stat = SAS_DATA_OVERRUN; in mpi_smp_completion()
2919 ts->residual = 0; in mpi_smp_completion()
2921 atomic_dec(&pm8001_dev->running_req); in mpi_smp_completion()
2925 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2926 ts->stat = SAS_PHY_DOWN; in mpi_smp_completion()
2930 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2931 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2935 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2936 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2940 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2941 ts->stat = SAS_SAM_STAT_BUSY; in mpi_smp_completion()
2946 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2947 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2948 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2953 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2954 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2955 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2959 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2960 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2961 ts->open_rej_reason = SAS_OREJ_RSVD_CONT0; in mpi_smp_completion()
2970 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2971 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2972 ts->open_rej_reason = SAS_OREJ_UNKNOWN; in mpi_smp_completion()
2980 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2981 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2982 ts->open_rej_reason = SAS_OREJ_BAD_DEST; in mpi_smp_completion()
2987 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2988 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2989 ts->open_rej_reason = SAS_OREJ_CONN_RATE; in mpi_smp_completion()
2994 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
2995 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
2996 ts->open_rej_reason = SAS_OREJ_WRONG_DEST; in mpi_smp_completion()
3000 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3001 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
3005 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3006 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
3007 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
3011 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3012 ts->stat = SAS_QUEUE_FULL; in mpi_smp_completion()
3016 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3017 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
3018 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
3022 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3023 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
3027 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3028 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
3029 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
3034 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3035 ts->stat = SAS_OPEN_REJECT; in mpi_smp_completion()
3036 ts->open_rej_reason = SAS_OREJ_RSVD_RETRY; in mpi_smp_completion()
3040 ts->resp = SAS_TASK_COMPLETE; in mpi_smp_completion()
3041 ts->stat = SAS_DEV_NO_RESPONSE; in mpi_smp_completion()
3045 spin_lock_irqsave(&t->task_state_lock, flags); in mpi_smp_completion()
3046 t->task_state_flags &= ~SAS_TASK_STATE_PENDING; in mpi_smp_completion()
3047 t->task_state_flags |= SAS_TASK_STATE_DONE; in mpi_smp_completion()
3048 if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) { in mpi_smp_completion()
3049 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_smp_completion()
3052 t, status, ts->resp, ts->stat); in mpi_smp_completion()
3055 spin_unlock_irqrestore(&t->task_state_lock, flags); in mpi_smp_completion()
3058 t->task_done(t); in mpi_smp_completion()
3063 * pm80xx_hw_event_ack_req- For PM8001, some events need to acknowledge to FW.
3068 * @phyId: phy id.
3096 u32 phyid_npip_portstate = le32_to_cpu(pPayload->phyid_npip_portstate); in hw_event_port_recover()
3099 le32_to_cpu(pPayload->lr_status_evt_portid); in hw_event_port_recover()
3100 u8 deviceType = pPayload->sas_identify.dev_type; in hw_event_port_recover()
3102 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_port_recover() local
3104 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_port_recover()
3111 port->wide_port_phymap |= (1U << phy_id); in hw_event_port_recover()
3112 pm8001_get_lrate_mode(phy, link_rate); in hw_event_port_recover()
3113 phy->sas_phy.oob_mode = SAS_OOB_MODE; in hw_event_port_recover()
3114 phy->phy_state = PHY_STATE_LINK_UP_SPCV; in hw_event_port_recover()
3115 phy->phy_attached = 1; in hw_event_port_recover()
3119 * hw_event_sas_phy_up - FW tells me a SAS phy up event.
3129 le32_to_cpu(pPayload->lr_status_evt_portid); in hw_event_sas_phy_up()
3130 u32 phyid_npip_portstate = le32_to_cpu(pPayload->phyid_npip_portstate); in hw_event_sas_phy_up()
3139 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_sas_phy_up()
3140 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_sas_phy_up() local
3142 u8 deviceType = pPayload->sas_identify.dev_type; in hw_event_sas_phy_up()
3143 phy->port = port; in hw_event_sas_phy_up()
3144 port->port_id = port_id; in hw_event_sas_phy_up()
3145 port->port_state = portstate; in hw_event_sas_phy_up()
3146 port->wide_port_phymap |= (1U << phy_id); in hw_event_sas_phy_up()
3147 phy->phy_state = PHY_STATE_LINK_UP_SPCV; in hw_event_sas_phy_up()
3160 port->port_attached = 1; in hw_event_sas_phy_up()
3161 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3165 port->port_attached = 1; in hw_event_sas_phy_up()
3166 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3170 port->port_attached = 1; in hw_event_sas_phy_up()
3171 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sas_phy_up()
3178 phy->phy_type |= PORT_TYPE_SAS; in hw_event_sas_phy_up()
3179 phy->identify.device_type = deviceType; in hw_event_sas_phy_up()
3180 phy->phy_attached = 1; in hw_event_sas_phy_up()
3181 if (phy->identify.device_type == SAS_END_DEVICE) in hw_event_sas_phy_up()
3182 phy->identify.target_port_protocols = SAS_PROTOCOL_SSP; in hw_event_sas_phy_up()
3183 else if (phy->identify.device_type != SAS_PHY_UNUSED) in hw_event_sas_phy_up()
3184 phy->identify.target_port_protocols = SAS_PROTOCOL_SMP; in hw_event_sas_phy_up()
3185 phy->sas_phy.oob_mode = SAS_OOB_MODE; in hw_event_sas_phy_up()
3186 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC); in hw_event_sas_phy_up()
3187 spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sas_phy_up()
3188 memcpy(phy->frame_rcvd, &pPayload->sas_identify, in hw_event_sas_phy_up()
3189 sizeof(struct sas_identify_frame)-4); in hw_event_sas_phy_up()
3190 phy->frame_rcvd_size = sizeof(struct sas_identify_frame) - 4; in hw_event_sas_phy_up()
3191 pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); in hw_event_sas_phy_up()
3192 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sas_phy_up()
3193 if (pm8001_ha->flags == PM8001F_RUN_TIME) in hw_event_sas_phy_up()
3199 * hw_event_sata_phy_up - FW tells me a SATA phy up event.
3208 u32 phyid_npip_portstate = le32_to_cpu(pPayload->phyid_npip_portstate); in hw_event_sata_phy_up()
3210 le32_to_cpu(pPayload->lr_status_evt_portid); in hw_event_sata_phy_up()
3219 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_sata_phy_up()
3220 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_sata_phy_up() local
3226 phy->port = port; in hw_event_sata_phy_up()
3227 port->port_id = port_id; in hw_event_sata_phy_up()
3228 port->port_state = portstate; in hw_event_sata_phy_up()
3229 phy->phy_state = PHY_STATE_LINK_UP_SPCV; in hw_event_sata_phy_up()
3230 port->port_attached = 1; in hw_event_sata_phy_up()
3231 pm8001_get_lrate_mode(phy, link_rate); in hw_event_sata_phy_up()
3232 phy->phy_type |= PORT_TYPE_SATA; in hw_event_sata_phy_up()
3233 phy->phy_attached = 1; in hw_event_sata_phy_up()
3234 phy->sas_phy.oob_mode = SATA_OOB_MODE; in hw_event_sata_phy_up()
3235 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_DONE, GFP_ATOMIC); in hw_event_sata_phy_up()
3236 spin_lock_irqsave(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sata_phy_up()
3237 memcpy(phy->frame_rcvd, ((u8 *)&pPayload->sata_fis - 4), in hw_event_sata_phy_up()
3239 phy->frame_rcvd_size = sizeof(struct dev_to_host_fis); in hw_event_sata_phy_up()
3240 phy->identify.target_port_protocols = SAS_PROTOCOL_SATA; in hw_event_sata_phy_up()
3241 phy->identify.device_type = SAS_SATA_DEV; in hw_event_sata_phy_up()
3242 pm8001_get_attached_sas_addr(phy, phy->sas_phy.attached_sas_addr); in hw_event_sata_phy_up()
3243 spin_unlock_irqrestore(&phy->sas_phy.frame_rcvd_lock, flags); in hw_event_sata_phy_up()
3248 * hw_event_phy_down - we should notify the libsas the phy is down.
3259 le32_to_cpu(pPayload->lr_status_evt_portid); in hw_event_phy_down()
3261 u32 phyid_npip_portstate = le32_to_cpu(pPayload->phyid_npip_portstate); in hw_event_phy_down()
3266 struct pm8001_port *port = &pm8001_ha->port[port_id]; in hw_event_phy_down()
3267 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in hw_event_phy_down() local
3268 u32 port_sata = (phy->phy_type & PORT_TYPE_SATA); in hw_event_phy_down()
3269 port->port_state = portstate; in hw_event_phy_down()
3270 phy->identify.device_type = 0; in hw_event_phy_down()
3271 phy->phy_attached = 0; in hw_event_phy_down()
3283 " Last phy Down and port invalid\n"); in hw_event_phy_down()
3285 phy->phy_type = 0; in hw_event_phy_down()
3286 port->port_attached = 0; in hw_event_phy_down()
3290 sas_phy_disconnected(&phy->sas_phy); in hw_event_phy_down()
3301 port->port_attached = 0; in hw_event_phy_down()
3307 pm8001_dbg(pm8001_ha, MSG, " Last phy Down and port invalid\n"); in hw_event_phy_down()
3309 port->port_attached = 0; in hw_event_phy_down()
3310 phy->phy_type = 0; in hw_event_phy_down()
3314 sas_phy_disconnected(&phy->sas_phy); in hw_event_phy_down()
3317 port->port_attached = 0; in hw_event_phy_down()
3325 sas_notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL, in hw_event_phy_down()
3334 le32_to_cpu(pPayload->status); in mpi_phy_start_resp()
3336 le32_to_cpu(pPayload->phyid) & 0xFF; in mpi_phy_start_resp()
3337 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in mpi_phy_start_resp() local
3340 "phy start resp status:0x%x, phyid:0x%x\n", in mpi_phy_start_resp()
3343 phy->phy_state = PHY_LINK_DOWN; in mpi_phy_start_resp()
3345 if (pm8001_ha->flags == PM8001F_RUN_TIME && in mpi_phy_start_resp()
3346 phy->enable_completion != NULL) { in mpi_phy_start_resp()
3347 complete(phy->enable_completion); in mpi_phy_start_resp()
3348 phy->enable_completion = NULL; in mpi_phy_start_resp()
3355 * mpi_thermal_hw_event - a thermal hw event has come.
3364 u32 thermal_event = le32_to_cpu(pPayload->thermal_event); in mpi_thermal_hw_event()
3365 u32 rht_lht = le32_to_cpu(pPayload->rht_lht); in mpi_thermal_hw_event()
3385 * mpi_hw_event - The hw event has come.
3395 le32_to_cpu(pPayload->lr_status_evt_portid); in mpi_hw_event()
3396 u32 phyid_npip_portstate = le32_to_cpu(pPayload->phyid_npip_portstate); in mpi_hw_event()
3405 struct sas_ha_struct *sas_ha = pm8001_ha->sas; in mpi_hw_event()
3406 struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; in mpi_hw_event() local
3407 struct pm8001_port *port = &pm8001_ha->port[port_id]; in mpi_hw_event()
3408 struct asd_sas_phy *sas_phy = sas_ha->sas_phy[phy_id]; in mpi_hw_event()
3428 sas_notify_phy_event(&phy->sas_phy, PHYE_SPINUP_HOLD, in mpi_hw_event()
3433 phy->phy_state = PHY_LINK_DISABLE; in mpi_hw_event()
3440 phy->phy_attached = 0; in mpi_hw_event()
3450 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3451 sas_phy->sas_prim = HW_EVENT_BROADCAST_CHANGE; in mpi_hw_event()
3452 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3460 sas_phy_disconnected(&phy->sas_phy); in mpi_hw_event()
3461 phy->phy_attached = 0; in mpi_hw_event()
3462 sas_notify_phy_event(&phy->sas_phy, PHYE_OOB_ERROR, GFP_ATOMIC); in mpi_hw_event()
3466 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3467 sas_phy->sas_prim = HW_EVENT_BROADCAST_EXP; in mpi_hw_event()
3468 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3509 spin_lock_irqsave(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3510 sas_phy->sas_prim = HW_EVENT_BROADCAST_SES; in mpi_hw_event()
3511 spin_unlock_irqrestore(&sas_phy->sas_prim_lock, flags); in mpi_hw_event()
3532 phy->phy_attached = 0; in mpi_hw_event()
3544 phy->phy_attached = 0; in mpi_hw_event()
3552 if (!pm8001_ha->phy[phy_id].reset_completion) { in mpi_hw_event()
3557 phy->phy_attached = 0; in mpi_hw_event()
3558 port->port_state = portstate; in mpi_hw_event()
3561 if (pm8001_ha->phy[phy_id].reset_completion) { in mpi_hw_event()
3562 pm8001_ha->phy[phy_id].port_reset_status = in mpi_hw_event()
3564 complete(pm8001_ha->phy[phy_id].reset_completion); in mpi_hw_event()
3565 pm8001_ha->phy[phy_id].reset_completion = NULL; in mpi_hw_event()
3575 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in mpi_hw_event()
3576 if (port->wide_port_phymap & (1 << i)) { in mpi_hw_event()
3577 phy = &pm8001_ha->phy[i]; in mpi_hw_event()
3578 sas_notify_phy_event(&phy->sas_phy, in mpi_hw_event()
3580 port->wide_port_phymap &= ~(1 << i); in mpi_hw_event()
3594 if (pm8001_ha->phy[phy_id].reset_completion) { in mpi_hw_event()
3595 pm8001_ha->phy[phy_id].port_reset_status = in mpi_hw_event()
3597 complete(pm8001_ha->phy[phy_id].reset_completion); in mpi_hw_event()
3598 pm8001_ha->phy[phy_id].reset_completion = NULL; in mpi_hw_event()
3600 phy->phy_attached = 1; in mpi_hw_event()
3601 phy->phy_state = PHY_STATE_LINK_UP_SPCV; in mpi_hw_event()
3602 port->port_state = portstate; in mpi_hw_event()
3617 * mpi_phy_stop_resp - SPCv specific
3626 le32_to_cpu(pPayload->status); in mpi_phy_stop_resp()
3628 le32_to_cpu(pPayload->phyid) & 0xFF; in mpi_phy_stop_resp()
3629 struct pm8001_phy *phy = &pm8001_ha->phy[phyid]; in mpi_phy_stop_resp() local
3630 pm8001_dbg(pm8001_ha, MSG, "phy:0x%x status:0x%x\n", in mpi_phy_stop_resp()
3634 phy->phy_state = PHY_LINK_DISABLE; in mpi_phy_stop_resp()
3635 phy->sas_phy.phy->negotiated_linkrate = SAS_PHY_DISABLED; in mpi_phy_stop_resp()
3636 phy->sas_phy.linkrate = SAS_PHY_DISABLED; in mpi_phy_stop_resp()
3643 * mpi_set_controller_config_resp - SPCv specific
3652 u32 status = le32_to_cpu(pPayload->status); in mpi_set_controller_config_resp()
3653 u32 err_qlfr_pgcd = le32_to_cpu(pPayload->err_qlfr_pgcd); in mpi_set_controller_config_resp()
3654 u32 tag = le32_to_cpu(pPayload->tag); in mpi_set_controller_config_resp()
3665 * mpi_get_controller_config_resp - SPCv specific
3678 * mpi_get_phy_profile_resp - SPCv specific
3691 * mpi_flash_op_ext_resp - SPCv specific
3703 * mpi_set_phy_profile_resp - SPCv specific
3715 u32 ppc_phyid = le32_to_cpu(pPayload->ppc_phyid); in mpi_set_phy_profile_resp()
3716 u32 status = le32_to_cpu(pPayload->status); in mpi_set_phy_profile_resp()
3718 tag = le32_to_cpu(pPayload->tag); in mpi_set_phy_profile_resp()
3725 rc = -1; in mpi_set_phy_profile_resp()
3730 rc = -1; in mpi_set_phy_profile_resp()
3738 * mpi_kek_management_resp - SPCv specific
3747 u32 status = le32_to_cpu(pPayload->status); in mpi_kek_management_resp()
3748 u32 kidx_new_curr_ksop = le32_to_cpu(pPayload->kidx_new_curr_ksop); in mpi_kek_management_resp()
3749 u32 err_qlfr = le32_to_cpu(pPayload->err_qlfr); in mpi_kek_management_resp()
3759 * mpi_dek_management_resp - SPCv specific
3772 * ssp_coalesced_comp_resp - SPCv specific
3785 * process_one_iomb - process one outbound Queue memory block
4010 * pm8001_ha->max_q_num - 1 through pm8001_ha->main_cfg_tbl.pm80xx_tbl. in process_oq()
4013 if (vec == (pm8001_ha->max_q_num - 1)) { in process_oq()
4016 if (pm8001_ha->chip_id == chip_8008 || in process_oq()
4017 pm8001_ha->chip_id == chip_8009) in process_oq()
4024 pm8001_ha->controller_fatal_error = true; in process_oq()
4049 circularQ = &pm8001_ha->outbnd_q_tbl[vec]; in process_oq()
4050 spin_lock_irqsave(&circularQ->oq_lock, circularQ->lock_flags); in process_oq()
4052 /* spurious interrupt during setup if kexec-ing and in process_oq()
4053 * driver doing a doorbell access w/ the pre-kexec oq in process_oq()
4056 if (!circularQ->pi_virt) in process_oq()
4062 (void *)(pMsg1 - 4)); in process_oq()
4069 circularQ->producer_index = in process_oq()
4070 cpu_to_le32(pm8001_read_32(circularQ->pi_virt)); in process_oq()
4071 if (le32_to_cpu(circularQ->producer_index) == in process_oq()
4072 circularQ->consumer_idx) in process_oq()
4077 spin_unlock_irqrestore(&circularQ->oq_lock, circularQ->lock_flags); in process_oq()
4092 psmp_cmd->tag = hTag; in build_smp_cmd()
4093 psmp_cmd->device_id = cpu_to_le32(deviceID); in build_smp_cmd()
4095 length = length - 4; /* subtract crc */ in build_smp_cmd()
4096 psmp_cmd->len_ip_ir = cpu_to_le32(length << 16); in build_smp_cmd()
4098 psmp_cmd->len_ip_ir = cpu_to_le32(1|(1 << 1)); in build_smp_cmd()
4103 * pm80xx_chip_smp_req - send an SMP task to FW
4111 struct sas_task *task = ccb->task; in pm80xx_chip_smp_req()
4112 struct domain_device *dev = task->dev; in pm80xx_chip_smp_req()
4113 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm80xx_chip_smp_req()
4124 * DMA-map SMP request, response buffers in pm80xx_chip_smp_req()
4126 sg_req = &task->smp_task.smp_req; in pm80xx_chip_smp_req()
4127 elem = dma_map_sg(pm8001_ha->dev, sg_req, 1, DMA_TO_DEVICE); in pm80xx_chip_smp_req()
4129 return -ENOMEM; in pm80xx_chip_smp_req()
4132 sg_resp = &task->smp_task.smp_resp; in pm80xx_chip_smp_req()
4133 elem = dma_map_sg(pm8001_ha->dev, sg_resp, 1, DMA_FROM_DEVICE); in pm80xx_chip_smp_req()
4135 rc = -ENOMEM; in pm80xx_chip_smp_req()
4141 rc = -EINVAL; in pm80xx_chip_smp_req()
4146 smp_cmd.tag = cpu_to_le32(ccb->ccb_tag); in pm80xx_chip_smp_req()
4148 length = sg_req->length; in pm80xx_chip_smp_req()
4149 pm8001_dbg(pm8001_ha, IO, "SMP Frame Length %d\n", sg_req->length); in pm80xx_chip_smp_req()
4150 if (!(length - 8)) in pm80xx_chip_smp_req()
4151 pm8001_ha->smp_exp_mode = SMP_DIRECT; in pm80xx_chip_smp_req()
4153 pm8001_ha->smp_exp_mode = SMP_INDIRECT; in pm80xx_chip_smp_req()
4156 smp_req = &task->smp_task.smp_req; in pm80xx_chip_smp_req()
4158 payload = to + smp_req->offset; in pm80xx_chip_smp_req()
4161 if (pm8001_ha->smp_exp_mode == SMP_INDIRECT) { in pm80xx_chip_smp_req()
4170 (&task->smp_task.smp_req) + 4); in pm80xx_chip_smp_req()
4173 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_req)-8); in pm80xx_chip_smp_req()
4176 (&task->smp_task.smp_resp)); in pm80xx_chip_smp_req()
4179 (&task->smp_task.smp_resp)-4); in pm80xx_chip_smp_req()
4183 (&task->smp_task.smp_req)); in pm80xx_chip_smp_req()
4185 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_req)-4); in pm80xx_chip_smp_req()
4188 (&task->smp_task.smp_resp)); in pm80xx_chip_smp_req()
4191 ((u32)sg_dma_len(&task->smp_task.smp_resp)-4); in pm80xx_chip_smp_req()
4193 if (pm8001_ha->smp_exp_mode == SMP_DIRECT) { in pm80xx_chip_smp_req()
4211 build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, in pm80xx_chip_smp_req()
4212 &smp_cmd, pm8001_ha->smp_exp_mode, length); in pm80xx_chip_smp_req()
4220 dma_unmap_sg(pm8001_ha->dev, &ccb->task->smp_task.smp_resp, 1, in pm80xx_chip_smp_req()
4223 dma_unmap_sg(pm8001_ha->dev, &ccb->task->smp_task.smp_req, 1, in pm80xx_chip_smp_req()
4230 u8 cmd = task->ssp_task.cmd->cmnd[0]; in check_enc_sas_cmd()
4241 switch (task->ata_task.fis.command) { in check_enc_sat_cmd()
4272 * pm80xx_chip_ssp_io_req - send an SSP task to FW
4279 struct sas_task *task = ccb->task; in pm80xx_chip_ssp_io_req()
4280 struct domain_device *dev = task->dev; in pm80xx_chip_ssp_io_req()
4281 struct pm8001_device *pm8001_dev = dev->lldd_dev; in pm80xx_chip_ssp_io_req()
4283 u32 tag = ccb->ccb_tag; in pm80xx_chip_ssp_io_req()
4290 memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); in pm80xx_chip_ssp_io_req()
4297 cpu_to_le32(data_dir_flags[task->data_dir] << 8 | 0x0); in pm80xx_chip_ssp_io_req()
4298 ssp_cmd.data_len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_ssp_io_req()
4299 ssp_cmd.device_id = cpu_to_le32(pm8001_dev->device_id); in pm80xx_chip_ssp_io_req()
4301 ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); in pm80xx_chip_ssp_io_req()
4302 memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, in pm80xx_chip_ssp_io_req()
4303 task->ssp_task.cmd->cmd_len); in pm80xx_chip_ssp_io_req()
4307 if (pm8001_ha->chip->encrypt && in pm80xx_chip_ssp_io_req()
4308 !(pm8001_ha->encrypt_info.status) && check_enc_sas_cmd(task)) { in pm80xx_chip_ssp_io_req()
4311 task->ssp_task.cmd->cmnd[0]); in pm80xx_chip_ssp_io_req()
4315 ((data_dir_flags[task->data_dir] << 8) | 0x20 | 0x0); in pm80xx_chip_ssp_io_req()
4318 if (task->num_scatter > 1) { in pm80xx_chip_ssp_io_req()
4319 pm8001_chip_make_sg(task->scatter, in pm80xx_chip_ssp_io_req()
4320 ccb->n_elem, ccb->buf_prd); in pm80xx_chip_ssp_io_req()
4321 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_ssp_io_req()
4327 } else if (task->num_scatter == 1) { in pm80xx_chip_ssp_io_req()
4328 u64 dma_addr = sg_dma_address(task->scatter); in pm80xx_chip_ssp_io_req()
4334 ssp_cmd.enc_len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_ssp_io_req()
4338 end_addr = dma_addr + le32_to_cpu(ssp_cmd.enc_len) - 1; in pm80xx_chip_ssp_io_req()
4348 pm8001_chip_make_sg(task->scatter, 1, in pm80xx_chip_ssp_io_req()
4349 ccb->buf_prd); in pm80xx_chip_ssp_io_req()
4350 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_ssp_io_req()
4357 } else if (task->num_scatter == 0) { in pm80xx_chip_ssp_io_req()
4360 ssp_cmd.enc_len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_ssp_io_req()
4368 ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cmd->cmnd[2] << 24) | in pm80xx_chip_ssp_io_req()
4369 (task->ssp_task.cmd->cmnd[3] << 16) | in pm80xx_chip_ssp_io_req()
4370 (task->ssp_task.cmd->cmnd[4] << 8) | in pm80xx_chip_ssp_io_req()
4371 (task->ssp_task.cmd->cmnd[5])); in pm80xx_chip_ssp_io_req()
4375 task->ssp_task.cmd->cmnd[0], q_index); in pm80xx_chip_ssp_io_req()
4377 if (task->num_scatter > 1) { in pm80xx_chip_ssp_io_req()
4378 pm8001_chip_make_sg(task->scatter, ccb->n_elem, in pm80xx_chip_ssp_io_req()
4379 ccb->buf_prd); in pm80xx_chip_ssp_io_req()
4380 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_ssp_io_req()
4386 } else if (task->num_scatter == 1) { in pm80xx_chip_ssp_io_req()
4387 u64 dma_addr = sg_dma_address(task->scatter); in pm80xx_chip_ssp_io_req()
4392 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_ssp_io_req()
4396 end_addr = dma_addr + le32_to_cpu(ssp_cmd.len) - 1; in pm80xx_chip_ssp_io_req()
4405 pm8001_chip_make_sg(task->scatter, 1, in pm80xx_chip_ssp_io_req()
4406 ccb->buf_prd); in pm80xx_chip_ssp_io_req()
4407 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_ssp_io_req()
4414 } else if (task->num_scatter == 0) { in pm80xx_chip_ssp_io_req()
4417 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_ssp_io_req()
4429 struct sas_task *task = ccb->task; in pm80xx_chip_sata_req()
4430 struct domain_device *dev = task->dev; in pm80xx_chip_sata_req()
4431 struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; in pm80xx_chip_sata_req()
4432 struct ata_queued_cmd *qc = task->uldd_task; in pm80xx_chip_sata_req()
4433 u32 tag = ccb->ccb_tag, q_index; in pm80xx_chip_sata_req()
4445 if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { in pm80xx_chip_sata_req()
4448 } else if (likely(!task->ata_task.device_control_reg_update)) { in pm80xx_chip_sata_req()
4449 if (task->ata_task.use_ncq && in pm80xx_chip_sata_req()
4450 dev->sata_dev.class != ATA_DEV_ATAPI) { in pm80xx_chip_sata_req()
4453 } else if (task->ata_task.dma_xfer) { in pm80xx_chip_sata_req()
4461 if (task->ata_task.use_ncq && pm8001_get_ncq_tag(task, &hdr_tag)) { in pm80xx_chip_sata_req()
4462 task->ata_task.fis.sector_count |= (u8) (hdr_tag << 3); in pm80xx_chip_sata_req()
4465 dir = data_dir_flags[task->data_dir] << 8; in pm80xx_chip_sata_req()
4467 sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); in pm80xx_chip_sata_req()
4468 sata_cmd.data_len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_sata_req()
4469 if (task->ata_task.return_fis_on_success) in pm80xx_chip_sata_req()
4471 sata_cmd.sata_fis = task->ata_task.fis; in pm80xx_chip_sata_req()
4472 if (likely(!task->ata_task.device_control_reg_update)) in pm80xx_chip_sata_req()
4477 if (pm8001_ha->chip->encrypt && in pm80xx_chip_sata_req()
4478 !(pm8001_ha->encrypt_info.status) && check_enc_sat_cmd(task)) { in pm80xx_chip_sata_req()
4483 /* set encryption bit; dad (bits 0-1) is 0 */ in pm80xx_chip_sata_req()
4488 if (task->num_scatter > 1) { in pm80xx_chip_sata_req()
4489 pm8001_chip_make_sg(task->scatter, in pm80xx_chip_sata_req()
4490 ccb->n_elem, ccb->buf_prd); in pm80xx_chip_sata_req()
4491 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_sata_req()
4497 } else if (task->num_scatter == 1) { in pm80xx_chip_sata_req()
4498 u64 dma_addr = sg_dma_address(task->scatter); in pm80xx_chip_sata_req()
4504 sata_cmd.enc_len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_sata_req()
4508 end_addr = dma_addr + le32_to_cpu(sata_cmd.enc_len) - 1; in pm80xx_chip_sata_req()
4517 pm8001_chip_make_sg(task->scatter, 1, in pm80xx_chip_sata_req()
4518 ccb->buf_prd); in pm80xx_chip_sata_req()
4519 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_sata_req()
4527 } else if (task->num_scatter == 0) { in pm80xx_chip_sata_req()
4530 sata_cmd.enc_len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_sata_req()
4549 /* dad (bits 0-1) is 0 */ in pm80xx_chip_sata_req()
4554 if (task->num_scatter > 1) { in pm80xx_chip_sata_req()
4555 pm8001_chip_make_sg(task->scatter, in pm80xx_chip_sata_req()
4556 ccb->n_elem, ccb->buf_prd); in pm80xx_chip_sata_req()
4557 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_sata_req()
4561 } else if (task->num_scatter == 1) { in pm80xx_chip_sata_req()
4562 u64 dma_addr = sg_dma_address(task->scatter); in pm80xx_chip_sata_req()
4566 sata_cmd.len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_sata_req()
4570 end_addr = dma_addr + le32_to_cpu(sata_cmd.len) - 1; in pm80xx_chip_sata_req()
4579 pm8001_chip_make_sg(task->scatter, 1, in pm80xx_chip_sata_req()
4580 ccb->buf_prd); in pm80xx_chip_sata_req()
4581 phys_addr = ccb->ccb_dma_handle; in pm80xx_chip_sata_req()
4586 } else if (task->num_scatter == 0) { in pm80xx_chip_sata_req()
4589 sata_cmd.len = cpu_to_le32(task->total_xfer_len); in pm80xx_chip_sata_req()
4595 cpu_to_le32(((task->ata_task.atapi_packet[0]) | in pm80xx_chip_sata_req()
4596 (task->ata_task.atapi_packet[1] << 8) | in pm80xx_chip_sata_req()
4597 (task->ata_task.atapi_packet[2] << 16) | in pm80xx_chip_sata_req()
4598 (task->ata_task.atapi_packet[3] << 24))); in pm80xx_chip_sata_req()
4600 cpu_to_le32(((task->ata_task.atapi_packet[4]) | in pm80xx_chip_sata_req()
4601 (task->ata_task.atapi_packet[5] << 8) | in pm80xx_chip_sata_req()
4602 (task->ata_task.atapi_packet[6] << 16) | in pm80xx_chip_sata_req()
4603 (task->ata_task.atapi_packet[7] << 24))); in pm80xx_chip_sata_req()
4605 cpu_to_le32(((task->ata_task.atapi_packet[8]) | in pm80xx_chip_sata_req()
4606 (task->ata_task.atapi_packet[9] << 8) | in pm80xx_chip_sata_req()
4607 (task->ata_task.atapi_packet[10] << 16) | in pm80xx_chip_sata_req()
4608 (task->ata_task.atapi_packet[11] << 24))); in pm80xx_chip_sata_req()
4610 cpu_to_le32(((task->ata_task.atapi_packet[12]) | in pm80xx_chip_sata_req()
4611 (task->ata_task.atapi_packet[13] << 8) | in pm80xx_chip_sata_req()
4612 (task->ata_task.atapi_packet[14] << 16) | in pm80xx_chip_sata_req()
4613 (task->ata_task.atapi_packet[15] << 24))); in pm80xx_chip_sata_req()
4616 trace_pm80xx_request_issue(pm8001_ha->id, in pm80xx_chip_sata_req()
4617 ccb->device ? ccb->device->attached_phy : PM8001_MAX_PHYS, in pm80xx_chip_sata_req()
4618 ccb->ccb_tag, opc, in pm80xx_chip_sata_req()
4619 qc ? qc->tf.command : 0, // ata opcode in pm80xx_chip_sata_req()
4620 ccb->device ? atomic_read(&ccb->device->running_req) : 0); in pm80xx_chip_sata_req()
4626 * pm80xx_chip_phy_start_req - start phy via PHY_START COMMAND
4628 * @phy_id: the phy id which we wanted to start up.
4640 pm8001_dbg(pm8001_ha, INIT, "PHY START REQ for phy_id %d\n", phy_id); in pm80xx_chip_phy_start_req()
4643 LINKMODE_AUTO | pm8001_ha->link_rate | phy_id); in pm80xx_chip_phy_start_req()
4650 Have to add "SAS PHY Analog Setup SPASTI 1 Byte" Based on need in pm80xx_chip_phy_start_req()
4656 &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE); in pm80xx_chip_phy_start_req()
4664 * pm80xx_chip_phy_stop_req - start phy via PHY_STOP COMMAND
4666 * @phy_id: the phy id which we wanted to start up.
4698 struct domain_device *dev = pm8001_dev->sas_device; in pm80xx_chip_reg_dev_req()
4699 struct domain_device *parent_dev = dev->parent; in pm80xx_chip_reg_dev_req()
4700 struct pm8001_port *port = dev->port->lldd_port; in pm80xx_chip_reg_dev_req()
4705 return -SAS_QUEUE_FULL; in pm80xx_chip_reg_dev_req()
4707 payload.tag = cpu_to_le32(ccb->ccb_tag); in pm80xx_chip_reg_dev_req()
4712 if (pm8001_dev->dev_type == SAS_SATA_DEV) in pm80xx_chip_reg_dev_req()
4714 else if (pm8001_dev->dev_type == SAS_END_DEVICE || in pm80xx_chip_reg_dev_req()
4715 dev_is_expander(pm8001_dev->dev_type)) in pm80xx_chip_reg_dev_req()
4718 if (parent_dev && dev_is_expander(parent_dev->dev_type)) in pm80xx_chip_reg_dev_req()
4719 phy_id = parent_dev->ex_dev.ex_phy->phy_id; in pm80xx_chip_reg_dev_req()
4721 phy_id = pm8001_dev->attached_phy; in pm80xx_chip_reg_dev_req()
4725 linkrate = (pm8001_dev->sas_device->linkrate < dev->port->linkrate) ? in pm80xx_chip_reg_dev_req()
4726 pm8001_dev->sas_device->linkrate : dev->port->linkrate; in pm80xx_chip_reg_dev_req()
4729 cpu_to_le32(((port->port_id) & 0xFF) | in pm80xx_chip_reg_dev_req()
4738 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr, in pm80xx_chip_reg_dev_req()
4743 (port->port_id & 0xFF)); in pm80xx_chip_reg_dev_req()
4753 * pm80xx_chip_phy_ctl_req - support the local phy operation
4755 * @phyId: the phy id which we wanted to operate
4756 * @phy_op: phy operation to request
4787 if (pm8001_ha->use_msix) in pm80xx_chip_is_our_interrupt()
4797 * pm80xx_chip_isr - PM8001 isr handler.
4833 " phy profile command for phy %x ,length is %d\n", in mpi_set_phy_profile_req()
4835 for (i = length; i < (length + PHY_DWORD_LENGTH - 1); i++) { in mpi_set_phy_profile_req()
4850 for (i = 0; i < pm8001_ha->chip->n_phy; i++) { in pm8001_set_phy_profile()
4855 pm8001_dbg(pm8001_ha, INIT, "phy settings completed\n"); in pm8001_set_phy_profile()
4859 u32 phy, u32 length, u32 *buf) in pm8001_set_phy_profile_single() argument
4878 | (phy & 0xFF)); in pm8001_set_phy_profile_single()
4888 pm8001_dbg(pm8001_ha, INIT, "PHY %d settings applied\n", phy); in pm8001_set_phy_profile_single()