Lines Matching refs:scb

59  * manual pause while accessing scb ram, accesses to certain registers
151 ahc_sg_bus_to_virt(struct scb *scb,
154 ahc_sg_virt_to_bus(struct scb *scb,
159 struct scb *scb, int op);
161 struct scb *scb, int op);
167 ahc_sg_bus_to_virt(struct scb *scb, uint32_t sg_busaddr)
171 sg_index = (sg_busaddr - scb->sg_list_phys)/sizeof(struct ahc_dma_seg);
175 return (&scb->sg_list[sg_index]);
179 ahc_sg_virt_to_bus(struct scb *scb, struct ahc_dma_seg *sg)
184 sg_index = sg - &scb->sg_list[1];
186 return (scb->sg_list_phys + (sg_index * sizeof(*scb->sg_list)));
197 ahc_sync_scb(struct ahc_softc *ahc, struct scb *scb, int op)
201 /*offset*/(scb->hscb - ahc->hscbs) * sizeof(*scb->hscb),
202 /*len*/sizeof(*scb->hscb), op);
206 ahc_sync_sglist(struct ahc_softc *ahc, struct scb *scb, int op)
208 if (scb->sg_count == 0)
211 aic_dmamap_sync(ahc, ahc->scb_data->sg_dmat, scb->sg_map->sg_dmamap,
212 /*offset*/(scb->sg_list - scb->sg_map->sg_vaddr)
214 /*len*/sizeof(struct ahc_dma_seg) * scb->sg_count, op);
235 struct scb *scb);
253 static __inline struct scb*
255 static __inline void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb);
257 struct scb *scb);
258 static __inline void ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb);
261 struct scb *scb);
264 struct scb *scb);
271 ahc_update_residual(struct ahc_softc *ahc, struct scb *scb)
275 sgptr = aic_le32toh(scb->hscb->sgptr);
277 ahc_calc_residual(ahc, scb);
358 * Get a free scb. If there are none, see if we can allocate a new SCB.
360 static __inline struct scb *
363 struct scb *scb;
365 if ((scb = SLIST_FIRST(&ahc->scb_data->free_scbs)) == NULL) {
368 scb = SLIST_FIRST(&ahc->scb_data->free_scbs);
369 if (scb == NULL)
373 return (scb);
380 ahc_free_scb(struct ahc_softc *ahc, struct scb *scb)
384 hscb = scb->hscb;
387 scb->flags = SCB_FLAG_NONE;
390 SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs, scb, links.sle);
393 aic_platform_scb_free(ahc, scb);
396 static __inline struct scb *
399 struct scb* scb;
401 scb = ahc->scb_data->scbindex[tag];
402 if (scb != NULL)
403 ahc_sync_scb(ahc, scb,
405 return (scb);
409 ahc_swap_with_next_hscb(struct ahc_softc *ahc, struct scb *scb)
419 * When we are called to queue "an arbitrary scb",
428 memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb));
429 if ((scb->flags & SCB_CDB32_PTR) != 0) {
435 q_hscb->next = scb->hscb->tag;
438 ahc->next_queued_scb->hscb = scb->hscb;
439 scb->hscb = q_hscb;
442 ahc->scb_data->scbindex[scb->hscb->tag] = scb;
449 ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb)
451 ahc_swap_with_next_hscb(ahc, scb);
453 if (scb->hscb->tag == SCB_LIST_NULL
454 || scb->hscb->next == SCB_LIST_NULL)
456 scb->hscb->tag, scb->hscb->next);
461 scb->hscb->lun &= LID;
462 if (aic_get_transfer_length(scb) & 0x1)
463 scb->hscb->lun |= SCB_XFERLEN_ODD;
468 ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag;
474 ahc_sync_scb(ahc, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
489 ahc_get_sense_buf(struct ahc_softc *ahc, struct scb *scb)
493 offset = scb - ahc->scb_data->scbarray;
498 ahc_get_sense_bufaddr(struct ahc_softc *ahc, struct scb *scb)
502 offset = scb - ahc->scb_data->scbarray;