Lines Matching +full:asi +full:- +full:format

1 // SPDX-License-Identifier: GPL-2.0-only
23 /* ---------- Initialization ---------- */
28 if (asd_ha->hw_prof.sas_addr[0]) in asd_get_user_sas_addr()
31 return sas_request_addr(asd_ha->sas_ha.shost, in asd_get_user_sas_addr()
32 asd_ha->hw_prof.sas_addr); in asd_get_user_sas_addr()
40 if (asd_ha->hw_prof.phy_desc[i].sas_addr[0] == 0) in asd_propagate_sas_addr()
45 SAS_ADDR(asd_ha->hw_prof.sas_addr)); in asd_propagate_sas_addr()
46 memcpy(asd_ha->hw_prof.phy_desc[i].sas_addr, in asd_propagate_sas_addr()
47 asd_ha->hw_prof.sas_addr, SAS_ADDR_SIZE); in asd_propagate_sas_addr()
51 /* ---------- PHY initialization ---------- */
55 phy->identify_frame = phy->id_frm_tok->vaddr; in asd_init_phy_identify()
57 memset(phy->identify_frame, 0, sizeof(*phy->identify_frame)); in asd_init_phy_identify()
59 phy->identify_frame->dev_type = SAS_END_DEVICE; in asd_init_phy_identify()
60 if (phy->sas_phy.role & PHY_ROLE_INITIATOR) in asd_init_phy_identify()
61 phy->identify_frame->initiator_bits = phy->sas_phy.iproto; in asd_init_phy_identify()
62 if (phy->sas_phy.role & PHY_ROLE_TARGET) in asd_init_phy_identify()
63 phy->identify_frame->target_bits = phy->sas_phy.tproto; in asd_init_phy_identify()
64 memcpy(phy->identify_frame->sas_addr, phy->phy_desc->sas_addr, in asd_init_phy_identify()
66 phy->identify_frame->phy_id = phy->sas_phy.id; in asd_init_phy_identify()
71 struct asd_ha_struct *asd_ha = phy->sas_phy.ha->lldd_ha; in asd_init_phy()
72 struct asd_sas_phy *sas_phy = &phy->sas_phy; in asd_init_phy()
74 sas_phy->enabled = 1; in asd_init_phy()
75 sas_phy->iproto = SAS_PROTOCOL_ALL; in asd_init_phy()
76 sas_phy->tproto = 0; in asd_init_phy()
77 sas_phy->role = PHY_ROLE_INITIATOR; in asd_init_phy()
78 sas_phy->oob_mode = OOB_NOT_CONNECTED; in asd_init_phy()
79 sas_phy->linkrate = SAS_LINK_RATE_UNKNOWN; in asd_init_phy()
81 phy->id_frm_tok = asd_alloc_coherent(asd_ha, in asd_init_phy()
82 sizeof(*phy->identify_frame), in asd_init_phy()
84 if (!phy->id_frm_tok) { in asd_init_phy()
85 asd_printk("no mem for IDENTIFY for phy%d\n", sas_phy->id); in asd_init_phy()
86 return -ENOMEM; in asd_init_phy()
90 memset(phy->frame_rcvd, 0, sizeof(phy->frame_rcvd)); in asd_init_phy()
99 spin_lock_init(&asd_ha->asd_ports_lock); in asd_init_ports()
101 struct asd_port *asd_port = &asd_ha->asd_ports[i]; in asd_init_ports()
103 memset(asd_port->sas_addr, 0, SAS_ADDR_SIZE); in asd_init_ports()
104 memset(asd_port->attached_sas_addr, 0, SAS_ADDR_SIZE); in asd_init_ports()
105 asd_port->phy_mask = 0; in asd_init_ports()
106 asd_port->num_phys = 0; in asd_init_ports()
113 u8 phy_mask = asd_ha->hw_prof.enabled_phys; in asd_init_phys()
116 struct asd_phy *phy = &asd_ha->phys[i]; in asd_init_phys()
118 phy->phy_desc = &asd_ha->hw_prof.phy_desc[i]; in asd_init_phys()
119 phy->asd_port = NULL; in asd_init_phys()
121 phy->sas_phy.enabled = 0; in asd_init_phys()
122 phy->sas_phy.id = i; in asd_init_phys()
123 phy->sas_phy.sas_addr = &phy->phy_desc->sas_addr[0]; in asd_init_phys()
124 phy->sas_phy.frame_rcvd = &phy->frame_rcvd[0]; in asd_init_phys()
125 phy->sas_phy.ha = &asd_ha->sas_ha; in asd_init_phys()
126 phy->sas_phy.lldd_phy = phy; in asd_init_phys()
131 int err = asd_init_phy(&asd_ha->phys[i]); in asd_init_phys()
139 /* ---------- Sliding windows ---------- */
143 struct pci_dev *pcidev = asd_ha->pcidev; in asd_init_sw()
169 asd_ha->io_handle[0].swa_base = REG_BASE_ADDR; in asd_init_sw()
170 asd_ha->io_handle[0].swb_base = REG_BASE_ADDR_CSEQCIO; in asd_init_sw()
171 asd_ha->io_handle[0].swc_base = REG_BASE_ADDR_EXSI; in asd_init_sw()
172 MBAR0_SWB_SIZE = asd_ha->io_handle[0].len - 0x80; in asd_init_sw()
173 if (!asd_ha->iospace) { in asd_init_sw()
176 asd_ha->io_handle[1].swa_base = OCM_BASE_ADDR; in asd_init_sw()
178 spin_lock_init(&asd_ha->iolock); in asd_init_sw()
183 /* ---------- SCB initialization ---------- */
186 * asd_init_scbs - manually allocate the first SCB.
192 * the _next_ scb to be DMA-ed to the host adapter is read from the last
193 * SCB DMA-ed to the host adapter, we have to always stay one step
198 struct asd_seq_data *seq = &asd_ha->seq; in asd_init_scbs()
202 asd_ha->seq.tc_index_bitmap_bits = asd_ha->hw_prof.max_scbs; in asd_init_scbs()
203 asd_ha->seq.tc_index_array = kcalloc(asd_ha->seq.tc_index_bitmap_bits, in asd_init_scbs()
206 if (!asd_ha->seq.tc_index_array) in asd_init_scbs()
207 return -ENOMEM; in asd_init_scbs()
209 bitmap_bytes = (asd_ha->seq.tc_index_bitmap_bits+7)/8; in asd_init_scbs()
211 asd_ha->seq.tc_index_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL); in asd_init_scbs()
212 if (!asd_ha->seq.tc_index_bitmap) { in asd_init_scbs()
213 kfree(asd_ha->seq.tc_index_array); in asd_init_scbs()
214 asd_ha->seq.tc_index_array = NULL; in asd_init_scbs()
215 return -ENOMEM; in asd_init_scbs()
218 spin_lock_init(&seq->tc_index_lock); in asd_init_scbs()
220 seq->next_scb.size = sizeof(struct scb); in asd_init_scbs()
221 seq->next_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool, GFP_KERNEL, in asd_init_scbs()
222 &seq->next_scb.dma_handle); in asd_init_scbs()
223 if (!seq->next_scb.vaddr) { in asd_init_scbs()
224 kfree(asd_ha->seq.tc_index_bitmap); in asd_init_scbs()
225 kfree(asd_ha->seq.tc_index_array); in asd_init_scbs()
226 asd_ha->seq.tc_index_bitmap = NULL; in asd_init_scbs()
227 asd_ha->seq.tc_index_array = NULL; in asd_init_scbs()
228 return -ENOMEM; in asd_init_scbs()
231 seq->pending = 0; in asd_init_scbs()
232 spin_lock_init(&seq->pend_q_lock); in asd_init_scbs()
233 INIT_LIST_HEAD(&seq->pend_q); in asd_init_scbs()
240 asd_ha->hw_prof.max_scbs = asd_get_cmdctx_size(asd_ha)/ASD_SCB_SIZE; in asd_get_max_scb_ddb()
241 asd_ha->hw_prof.max_ddbs = asd_get_devctx_size(asd_ha)/ASD_DDB_SIZE; in asd_get_max_scb_ddb()
243 asd_ha->hw_prof.max_scbs, in asd_get_max_scb_ddb()
244 asd_ha->hw_prof.max_ddbs); in asd_get_max_scb_ddb()
247 /* ---------- Done List initialization ---------- */
253 asd_ha->seq.actual_dl in asd_init_dl()
257 if (!asd_ha->seq.actual_dl) in asd_init_dl()
258 return -ENOMEM; in asd_init_dl()
259 asd_ha->seq.dl = asd_ha->seq.actual_dl->vaddr; in asd_init_dl()
260 asd_ha->seq.dl_toggle = ASD_DEF_DL_TOGGLE; in asd_init_dl()
261 asd_ha->seq.dl_next = 0; in asd_init_dl()
262 tasklet_init(&asd_ha->seq.dl_tasklet, asd_dl_tasklet_handler, in asd_init_dl()
268 /* ---------- EDB and ESCB init ---------- */
272 struct asd_seq_data *seq = &asd_ha->seq; in asd_alloc_edbs()
275 seq->edb_arr = kmalloc_array(seq->num_edbs, sizeof(*seq->edb_arr), in asd_alloc_edbs()
277 if (!seq->edb_arr) in asd_alloc_edbs()
278 return -ENOMEM; in asd_alloc_edbs()
280 for (i = 0; i < seq->num_edbs; i++) { in asd_alloc_edbs()
281 seq->edb_arr[i] = asd_alloc_coherent(asd_ha, ASD_EDB_SIZE, in asd_alloc_edbs()
283 if (!seq->edb_arr[i]) in asd_alloc_edbs()
285 memset(seq->edb_arr[i]->vaddr, 0, ASD_EDB_SIZE); in asd_alloc_edbs()
288 ASD_DPRINTK("num_edbs:%d\n", seq->num_edbs); in asd_alloc_edbs()
293 for (i-- ; i >= 0; i--) in asd_alloc_edbs()
294 asd_free_coherent(asd_ha, seq->edb_arr[i]); in asd_alloc_edbs()
295 kfree(seq->edb_arr); in asd_alloc_edbs()
296 seq->edb_arr = NULL; in asd_alloc_edbs()
298 return -ENOMEM; in asd_alloc_edbs()
304 struct asd_seq_data *seq = &asd_ha->seq; in asd_alloc_escbs()
308 seq->escb_arr = kmalloc_array(seq->num_escbs, sizeof(*seq->escb_arr), in asd_alloc_escbs()
310 if (!seq->escb_arr) in asd_alloc_escbs()
311 return -ENOMEM; in asd_alloc_escbs()
313 escbs = seq->num_escbs; in asd_alloc_escbs()
319 seq->num_escbs -= escbs; /* subtract what was not allocated */ in asd_alloc_escbs()
320 ASD_DPRINTK("num_escbs:%d\n", seq->num_escbs); in asd_alloc_escbs()
322 for (i = 0; i < seq->num_escbs; i++, escb = list_entry(escb->list.next, in asd_alloc_escbs()
325 seq->escb_arr[i] = escb; in asd_alloc_escbs()
326 escb->scb->header.opcode = EMPTY_SCB; in asd_alloc_escbs()
331 kfree(seq->escb_arr); in asd_alloc_escbs()
332 seq->escb_arr = NULL; in asd_alloc_escbs()
333 return -ENOMEM; in asd_alloc_escbs()
339 struct asd_seq_data *seq = &asd_ha->seq; in asd_assign_edbs2escbs()
342 for (i = 0; i < seq->num_escbs; i++) { in asd_assign_edbs2escbs()
343 struct asd_ascb *ascb = seq->escb_arr[i]; in asd_assign_edbs2escbs()
344 struct empty_scb *escb = &ascb->scb->escb; in asd_assign_edbs2escbs()
346 ascb->edb_index = z; in asd_assign_edbs2escbs()
348 escb->num_valid = ASD_EDBS_PER_SCB; in asd_assign_edbs2escbs()
351 struct sg_el *eb = &escb->eb[k]; in asd_assign_edbs2escbs()
352 struct asd_dma_tok *edb = seq->edb_arr[z++]; in asd_assign_edbs2escbs()
355 eb->bus_addr = cpu_to_le64(((u64) edb->dma_handle)); in asd_assign_edbs2escbs()
356 eb->size = cpu_to_le32(((u32) edb->size)); in asd_assign_edbs2escbs()
362 * asd_init_escbs -- allocate and initialize empty scbs
370 struct asd_seq_data *seq = &asd_ha->seq; in asd_init_escbs()
374 int edbs = 2*(1+asd_ha->hw_prof.num_phys); in asd_init_escbs()
376 seq->num_escbs = (edbs+ASD_EDBS_PER_SCB-1)/ASD_EDBS_PER_SCB; in asd_init_escbs()
377 seq->num_edbs = seq->num_escbs * ASD_EDBS_PER_SCB; in asd_init_escbs()
397 seq->pending = seq->num_escbs; in asd_init_escbs()
398 seq->can_queue = 1 + (asd_ha->hw_prof.max_scbs - seq->pending)/2; in asd_init_escbs()
403 /* ---------- HW initialization ---------- */
406 * asd_chip_hardrst -- hard reset the chip
430 } while (--count > 0); in asd_chip_hardrst()
432 return -ENODEV; in asd_chip_hardrst()
436 * asd_init_chip -- initialize the chip
450 pci_name(asd_ha->pcidev)); in asd_init_chip()
459 pci_name(asd_ha->pcidev)); in asd_init_chip()
466 pci_name(asd_ha->pcidev)); in asd_init_chip()
492 dma_addr -= asd_ha->hw_prof.max_ddbs * ASD_DDB_SIZE; in asd_extend_devctx_ocm()
497 asd_ha->hw_prof.max_ddbs += MAX_DEVS; in asd_extend_devctx_ocm()
509 asd_ha->hw_prof.ddb_ext = NULL; in asd_extend_devctx()
510 if (max_devs <= asd_ha->hw_prof.max_ddbs || max_devs > 0xFFFF) { in asd_extend_devctx()
511 max_devs = asd_ha->hw_prof.max_ddbs; in asd_extend_devctx()
515 size = (max_devs - asd_ha->hw_prof.max_ddbs + 1) * ASD_DDB_SIZE; in asd_extend_devctx()
517 asd_ha->hw_prof.ddb_ext = asd_alloc_coherent(asd_ha, size, GFP_KERNEL); in asd_extend_devctx()
518 if (!asd_ha->hw_prof.ddb_ext) { in asd_extend_devctx()
521 max_devs = asd_ha->hw_prof.max_ddbs; in asd_extend_devctx()
522 return -ENOMEM; in asd_extend_devctx()
524 dma_handle = asd_ha->hw_prof.ddb_ext->dma_handle; in asd_extend_devctx()
526 dma_addr -= asd_ha->hw_prof.max_ddbs * ASD_DDB_SIZE; in asd_extend_devctx()
533 asd_ha->hw_prof.max_ddbs = max_devs; in asd_extend_devctx()
545 asd_ha->hw_prof.scb_ext = NULL; in asd_extend_cmdctx()
546 if (max_cmnds <= asd_ha->hw_prof.max_scbs || max_cmnds > 0xFFFF) { in asd_extend_cmdctx()
547 max_cmnds = asd_ha->hw_prof.max_scbs; in asd_extend_cmdctx()
551 size = (max_cmnds - asd_ha->hw_prof.max_scbs + 1) * ASD_SCB_SIZE; in asd_extend_cmdctx()
553 asd_ha->hw_prof.scb_ext = asd_alloc_coherent(asd_ha, size, GFP_KERNEL); in asd_extend_cmdctx()
554 if (!asd_ha->hw_prof.scb_ext) { in asd_extend_cmdctx()
557 max_cmnds = asd_ha->hw_prof.max_scbs; in asd_extend_cmdctx()
558 return -ENOMEM; in asd_extend_cmdctx()
560 dma_handle = asd_ha->hw_prof.scb_ext->dma_handle; in asd_extend_cmdctx()
562 dma_addr -= asd_ha->hw_prof.max_scbs * ASD_SCB_SIZE; in asd_extend_cmdctx()
569 asd_ha->hw_prof.max_scbs = max_cmnds; in asd_extend_cmdctx()
575 * asd_init_ctxmem -- initialize context memory
583 * thus allowing unlimited support for SCBs and DDBs -- only limited
595 bitmap_bytes = (asd_ha->hw_prof.max_ddbs+7)/8; in asd_init_ctxmem()
597 asd_ha->hw_prof.ddb_bitmap = kzalloc(bitmap_bytes, GFP_KERNEL); in asd_init_ctxmem()
598 if (!asd_ha->hw_prof.ddb_bitmap) in asd_init_ctxmem()
599 return -ENOMEM; in asd_init_ctxmem()
600 spin_lock_init(&asd_ha->hw_prof.ddb_lock); in asd_init_ctxmem()
614 err = pci_read_config_dword(asd_ha->pcidev, PCIC_HSTPCIX_CNTRL, &v); in asd_init_hw()
617 pci_name(asd_ha->pcidev)); in asd_init_hw()
620 err = pci_write_config_dword(asd_ha->pcidev, PCIC_HSTPCIX_CNTRL, in asd_init_hw()
624 pci_name(asd_ha->pcidev)); in asd_init_hw()
647 pci_name(asd_ha->pcidev)); in asd_init_hw()
648 err = -ENODEV; in asd_init_hw()
657 pci_name(asd_ha->pcidev)); in asd_init_hw()
666 pci_name(asd_ha->pcidev)); in asd_init_hw()
692 /* ---------- Chip reset ---------- */
695 * asd_chip_reset -- reset the host adapter, etc
699 * timeout. This should be no different than hot-unplugging the
706 ASD_DPRINTK("chip reset for %s\n", pci_name(asd_ha->pcidev)); in asd_chip_reset()
710 /* ---------- Done List Routines ---------- */
715 struct asd_seq_data *seq = &asd_ha->seq; in asd_dl_tasklet_handler()
719 struct done_list_struct *dl = &seq->dl[seq->dl_next]; in asd_dl_tasklet_handler()
722 if ((dl->toggle & DL_TOGGLE_MASK) != seq->dl_toggle) in asd_dl_tasklet_handler()
726 spin_lock_irqsave(&seq->tc_index_lock, flags); in asd_dl_tasklet_handler()
727 ascb = asd_tc_index_find(seq, (int)le16_to_cpu(dl->index)); in asd_dl_tasklet_handler()
728 spin_unlock_irqrestore(&seq->tc_index_lock, flags); in asd_dl_tasklet_handler()
732 } else if (ascb->scb->header.opcode == EMPTY_SCB) { in asd_dl_tasklet_handler()
734 } else if (!ascb->uldd_timer && !del_timer(&ascb->timer)) { in asd_dl_tasklet_handler()
737 spin_lock_irqsave(&seq->pend_q_lock, flags); in asd_dl_tasklet_handler()
738 list_del_init(&ascb->list); in asd_dl_tasklet_handler()
739 seq->pending--; in asd_dl_tasklet_handler()
740 spin_unlock_irqrestore(&seq->pend_q_lock, flags); in asd_dl_tasklet_handler()
742 ascb->tasklet_complete(ascb, dl); in asd_dl_tasklet_handler()
745 seq->dl_next = (seq->dl_next + 1) & (ASD_DL_SIZE-1); in asd_dl_tasklet_handler()
746 if (!seq->dl_next) in asd_dl_tasklet_handler()
747 seq->dl_toggle ^= DL_TOGGLE_MASK; in asd_dl_tasklet_handler()
751 /* ---------- Interrupt Service Routines ---------- */
754 * asd_process_donelist_isr -- schedule processing of done list entries
759 tasklet_schedule(&asd_ha->seq.dl_tasklet); in asd_process_donelist_isr()
763 * asd_com_sas_isr -- process device communication interrupt (COMINT)
775 pci_name(asd_ha->pcidev)); in asd_com_sas_isr()
782 pci_name(asd_ha->pcidev), in asd_com_sas_isr()
799 pci_name(asd_ha->pcidev), in asd_com_sas_isr()
851 pci_name(asd_ha->pcidev), in asd_arp2_err()
855 pci_name(asd_ha->pcidev), in asd_arp2_err()
859 pci_name(asd_ha->pcidev), in asd_arp2_err()
872 pci_name(asd_ha->pcidev), in asd_arp2_err()
877 pci_name(asd_ha->pcidev), in asd_arp2_err()
881 pci_name(asd_ha->pcidev), lseq, in asd_arp2_err()
889 * asd_dch_sas_isr -- process device channel interrupt (DEVINT)
897 asd_printk("%s: CFIFTOERR\n", pci_name(asd_ha->pcidev)); in asd_dch_sas_isr()
904 * asd_rbi_exsi_isr -- process external system interface interrupt (INITERR)
917 asd_printk("ASI SEEPROM format error for %s\n", in asd_rbi_exsi_isr()
918 pci_name(asd_ha->pcidev)); in asd_rbi_exsi_isr()
921 asd_printk("ASI SEEPROM checksum 0x%x error for %s\n", in asd_rbi_exsi_isr()
923 pci_name(asd_ha->pcidev)); in asd_rbi_exsi_isr()
937 pci_name(asd_ha->pcidev), in asd_rbi_exsi_isr()
950 * asd_hst_pcix_isr -- process host interface interrupts
961 pci_read_config_word(asd_ha->pcidev, PCI_STATUS, &status); in asd_hst_pcix_isr()
962 pci_read_config_dword(asd_ha->pcidev, PCIX_STATUS, &pcix_status); in asd_hst_pcix_isr()
963 pci_read_config_dword(asd_ha->pcidev, ECC_CTRL_STAT, &ecc_status); in asd_hst_pcix_isr()
966 asd_printk("parity error for %s\n", pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
968 asd_printk("master abort for %s\n", pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
970 asd_printk("target abort for %s\n", pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
972 asd_printk("data parity for %s\n", pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
975 pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
976 pci_write_config_dword(asd_ha->pcidev,PCIX_STATUS,pcix_status); in asd_hst_pcix_isr()
981 pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
982 pci_write_config_dword(asd_ha->pcidev,PCIX_STATUS,pcix_status); in asd_hst_pcix_isr()
987 pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
990 pci_name(asd_ha->pcidev)); in asd_hst_pcix_isr()
995 * asd_hw_isr -- host adapter interrupt service routine
1026 /* ---------- SCB handling ---------- */
1032 struct asd_seq_data *seq = &asd_ha->seq; in asd_ascb_alloc()
1039 ascb->dma_scb.size = sizeof(struct scb); in asd_ascb_alloc()
1040 ascb->dma_scb.vaddr = dma_pool_zalloc(asd_ha->scb_pool, in asd_ascb_alloc()
1042 &ascb->dma_scb.dma_handle); in asd_ascb_alloc()
1043 if (!ascb->dma_scb.vaddr) { in asd_ascb_alloc()
1049 spin_lock_irqsave(&seq->tc_index_lock, flags); in asd_ascb_alloc()
1050 ascb->tc_index = asd_tc_index_get(seq, ascb); in asd_ascb_alloc()
1051 spin_unlock_irqrestore(&seq->tc_index_lock, flags); in asd_ascb_alloc()
1052 if (ascb->tc_index == -1) in asd_ascb_alloc()
1055 ascb->scb->header.index = cpu_to_le16((u16)ascb->tc_index); in asd_ascb_alloc()
1060 dma_pool_free(asd_ha->scb_pool, ascb->dma_scb.vaddr, in asd_ascb_alloc()
1061 ascb->dma_scb.dma_handle); in asd_ascb_alloc()
1068 * asd_ascb_alloc_list -- allocate a list of aSCBs
1089 for ( ; *num > 0; --*num) { in asd_ascb_alloc_list()
1097 struct asd_ascb *last = list_entry(first->list.prev, in asd_ascb_alloc_list()
1100 list_add_tail(&ascb->list, &first->list); in asd_ascb_alloc_list()
1101 last->scb->header.next_scb = in asd_ascb_alloc_list()
1102 cpu_to_le64(((u64)ascb->dma_scb.dma_handle)); in asd_ascb_alloc_list()
1110 * asd_swap_head_scb -- swap the head scb
1116 * seq->next_scb keeps the address of this SCB. The sequencer will
1122 * of number of memcpy calls to the number of SCB DMA-ed is as small
1130 struct asd_seq_data *seq = &asd_ha->seq; in asd_swap_head_scb()
1131 struct asd_ascb *last = list_entry(ascb->list.prev, in asd_swap_head_scb()
1134 struct asd_dma_tok t = ascb->dma_scb; in asd_swap_head_scb()
1136 memcpy(seq->next_scb.vaddr, ascb->scb, sizeof(*ascb->scb)); in asd_swap_head_scb()
1137 ascb->dma_scb = seq->next_scb; in asd_swap_head_scb()
1138 ascb->scb = ascb->dma_scb.vaddr; in asd_swap_head_scb()
1139 seq->next_scb = t; in asd_swap_head_scb()
1140 last->scb->header.next_scb = in asd_swap_head_scb()
1141 cpu_to_le64(((u64)seq->next_scb.dma_handle)); in asd_swap_head_scb()
1145 * asd_start_scb_timers -- (add and) start timers of SCBs
1157 if (!ascb->uldd_timer) { in asd_start_scb_timers()
1158 ascb->timer.function = asd_ascb_timedout; in asd_start_scb_timers()
1159 ascb->timer.expires = jiffies + AIC94XX_SCB_TIMEOUT; in asd_start_scb_timers()
1160 add_timer(&ascb->timer); in asd_start_scb_timers()
1166 * asd_post_ascb_list -- post a list of 1 or more aSCBs to the host adapter
1174 * to the number of ascbs sent, we try to batch-send as many ascbs as possible
1191 spin_lock_irqsave(&asd_ha->seq.pend_q_lock, flags); in asd_post_ascb_list()
1192 can_queue = asd_ha->hw_prof.max_scbs - asd_ha->seq.pending; in asd_post_ascb_list()
1194 asd_ha->seq.pending += num; in asd_post_ascb_list()
1199 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); in asd_post_ascb_list()
1200 asd_printk("%s: scb queue full\n", pci_name(asd_ha->pcidev)); in asd_post_ascb_list()
1201 return -SAS_QUEUE_FULL; in asd_post_ascb_list()
1206 __list_add(&list, ascb->list.prev, &ascb->list); in asd_post_ascb_list()
1210 asd_ha->seq.scbpro += num; in asd_post_ascb_list()
1211 list_splice_init(&list, asd_ha->seq.pend_q.prev); in asd_post_ascb_list()
1212 asd_write_reg_dword(asd_ha, SCBPRO, (u32)asd_ha->seq.scbpro); in asd_post_ascb_list()
1213 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); in asd_post_ascb_list()
1219 * asd_post_escb_list -- post a list of 1 or more empty scb
1241 spin_lock_irqsave(&asd_ha->seq.pend_q_lock, flags); in asd_post_escb_list()
1243 asd_ha->seq.scbpro += num; in asd_post_escb_list()
1244 asd_write_reg_dword(asd_ha, SCBPRO, (u32)asd_ha->seq.scbpro); in asd_post_escb_list()
1245 spin_unlock_irqrestore(&asd_ha->seq.pend_q_lock, flags); in asd_post_escb_list()
1250 /* ---------- LED ---------- */
1253 * asd_turn_led -- turn on/off an LED
1271 * asd_control_led -- enable/disable an LED on the board
1300 /* ---------- PHY enable ---------- */
1304 struct asd_phy *phy = &asd_ha->phys[phy_id]; in asd_enable_phy()
1313 phy->phy_desc->phy_control_0); in asd_enable_phy()
1315 phy->phy_desc->phy_control_1); in asd_enable_phy()
1317 phy->phy_desc->phy_control_2); in asd_enable_phy()
1319 phy->phy_desc->phy_control_3); in asd_enable_phy()
1325 phy->id_frm_tok->dma_handle); in asd_enable_phy()
1354 return -ENOMEM; in asd_enable_phys()
1356 num -= k; in asd_enable_phys()
1361 ascb = list_entry(ascb->list.next, struct asd_ascb, list); in asd_enable_phys()