Lines Matching defs:scb

233 static __inline void	*ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
237 struct scb *scb);
239 struct scb *scb);
241 struct scb *scb);
244 ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb,
247 scb->sg_count++;
268 ahd_setup_scb_common(struct ahd_softc *ahd, struct scb *scb)
271 scb->crc_retry_count = 0;
272 if ((scb->flags & SCB_PACKETIZED) != 0) {
274 scb->hscb->task_attribute = scb->hscb->control & SCB_TAG_TYPE;
276 if (aic_get_transfer_length(scb) & 0x01)
277 scb->hscb->task_attribute = SCB_XFERLEN_ODD;
279 scb->hscb->task_attribute = 0;
282 if (scb->hscb->cdb_len <= MAX_CDB_LEN_WITH_SENSE_ADDR
283 || (scb->hscb->cdb_len & SCB_CDB_LEN_PTR) != 0)
284 scb->hscb->shared_data.idata.cdb_plus_saddr.sense_addr =
285 aic_htole32(scb->sense_busaddr);
289 ahd_setup_data_scb(struct ahd_softc *ahd, struct scb *scb)
297 sg = (struct ahd_dma64_seg *)scb->sg_list;
298 scb->hscb->dataptr = sg->addr;
299 scb->hscb->datacnt = sg->len;
304 sg = (struct ahd_dma_seg *)scb->sg_list;
305 dataptr_words = (uint32_t*)&scb->hscb->dataptr;
312 scb->hscb->dataptr |= aic_htole64(high_addr << 8);
314 scb->hscb->datacnt = sg->len;
322 scb->hscb->sgptr = aic_htole32(scb->sg_list_busaddr|SG_FULL_RESID);
326 ahd_setup_noxfer_scb(struct ahd_softc *ahd, struct scb *scb)
328 scb->hscb->sgptr = aic_htole32(SG_LIST_NULL);
329 scb->hscb->dataptr = 0;
330 scb->hscb->datacnt = 0;
337 struct scb *scb,
341 struct scb *scb,
344 struct scb *scb, int op);
346 struct scb *scb, int op);
348 struct scb *scb, int op);
362 ahd_sg_bus_to_virt(struct ahd_softc *ahd, struct scb *scb, uint32_t sg_busaddr)
367 sg_offset = sg_busaddr - (scb->sg_list_busaddr - ahd_sg_size(ahd));
368 return ((uint8_t *)scb->sg_list + sg_offset);
372 ahd_sg_virt_to_bus(struct ahd_softc *ahd, struct scb *scb, void *sg)
377 sg_offset = ((uint8_t *)sg - (uint8_t *)scb->sg_list)
380 return (scb->sg_list_busaddr + sg_offset);
384 ahd_sync_scb(struct ahd_softc *ahd, struct scb *scb, int op)
387 scb->hscb_map->dmamap,
388 /*offset*/(uint8_t*)scb->hscb - scb->hscb_map->vaddr,
389 /*len*/sizeof(*scb->hscb), op);
393 ahd_sync_sglist(struct ahd_softc *ahd, struct scb *scb, int op)
395 if (scb->sg_count == 0)
399 scb->sg_map->dmamap,
400 /*offset*/scb->sg_list_busaddr - ahd_sg_size(ahd),
401 /*len*/ahd_sg_size(ahd) * scb->sg_count, op);
405 ahd_sync_sense(struct ahd_softc *ahd, struct scb *scb, int op)
408 scb->sense_map->dmamap,
409 /*offset*/scb->sense_busaddr,
422 struct scb *scb);
424 struct scb *scb);
461 struct scb *scb);
462 static __inline void ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb);
465 struct scb *scb);
468 struct scb *scb);
471 ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb)
475 sgptr = aic_le32toh(scb->hscb->sgptr);
477 ahd_handle_scb_status(ahd, scb);
479 ahd_done(ahd, scb);
487 ahd_update_residual(struct ahd_softc *ahd, struct scb *scb)
491 sgptr = aic_le32toh(scb->hscb->sgptr);
493 ahd_calc_residual(ahd, scb);
722 static __inline struct scb *
725 struct scb* scb;
729 scb = ahd->scb_data.scbindex[tag];
730 if (scb != NULL)
731 ahd_sync_scb(ahd, scb,
733 return (scb);
737 ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb)
748 * When we are called to queue "an arbitrary scb",
758 memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb));
760 q_hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr;
763 ahd->next_queued_hscb = scb->hscb;
764 ahd->next_queued_hscb_map = scb->hscb_map;
765 scb->hscb = q_hscb;
766 scb->hscb_map = q_hscb_map;
769 ahd->scb_data.scbindex[SCB_GET_TAG(scb)] = scb;
776 ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb)
778 ahd_swap_with_next_hscb(ahd, scb);
780 if (SCBID_IS_NULL(SCB_GET_TAG(scb)))
782 SCB_GET_TAG(scb));
787 ahd->qinfifo[AHD_QIN_WRAP(ahd->qinfifonext)] = SCB_GET_TAG(scb);
790 if (scb->sg_count != 0)
791 ahd_setup_data_scb(ahd, scb);
793 ahd_setup_noxfer_scb(ahd, scb);
794 ahd_setup_scb_common(ahd, scb);
800 ahd_sync_scb(ahd, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
806 host_dataptr = aic_le64toh(scb->hscb->dataptr);
809 SCB_GET_TAG(scb), scb->hscb->scsiid,
810 aic_le32toh(scb->hscb->hscb_busaddr),
813 aic_le32toh(scb->hscb->datacnt));
821 ahd_get_sense_buf(struct ahd_softc *ahd, struct scb *scb)
823 return (scb->sense_data);
827 ahd_get_sense_bufaddr(struct ahd_softc *ahd, struct scb *scb)
829 return (scb->sense_busaddr);