Lines Matching defs:scb
64 * manual pause while accessing scb ram, accesses to certain registers
156 ahc_sg_bus_to_virt(struct scb *scb,
159 ahc_sg_virt_to_bus(struct scb *scb,
164 struct scb *scb, int op);
166 struct scb *scb, int op);
172 ahc_sg_bus_to_virt(struct scb *scb, uint32_t sg_busaddr)
176 sg_index = (sg_busaddr - scb->sg_list_phys)/sizeof(struct ahc_dma_seg);
180 return (&scb->sg_list[sg_index]);
184 ahc_sg_virt_to_bus(struct scb *scb, struct ahc_dma_seg *sg)
189 sg_index = sg - &scb->sg_list[1];
191 return (scb->sg_list_phys + (sg_index * sizeof(*scb->sg_list)));
202 ahc_sync_scb(struct ahc_softc *ahc, struct scb *scb, int op)
206 /*offset*/(scb->hscb - ahc->scb_data->hscbs) * sizeof(*scb->hscb),
207 /*len*/sizeof(*scb->hscb), op);
211 ahc_sync_sglist(struct ahc_softc *ahc, struct scb *scb, int op)
213 if (scb->sg_count == 0)
216 ahc_dmamap_sync(ahc, ahc->parent_dmat, scb->sg_map->sg_dmamap,
217 /*offset*/(scb->sg_list - scb->sg_map->sg_vaddr)
219 /*len*/sizeof(struct ahc_dma_seg) * scb->sg_count, op);
240 struct scb *scb);
258 static __inline struct scb*
260 static __inline void ahc_free_scb(struct ahc_softc *ahc, struct scb *scb);
262 struct scb *scb);
263 static __inline void ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb);
266 struct scb *scb);
269 struct scb *scb);
273 * for this SCB/transaction.
276 ahc_update_residual(struct ahc_softc *ahc, struct scb *scb)
280 sgptr = ahc_le32toh(scb->hscb->sgptr);
282 ahc_calc_residual(ahc, scb);
365 * Get a free scb. If there are none, see if we can allocate a new SCB.
367 static __inline struct scb *
370 struct scb *scb;
372 if ((scb = SLIST_FIRST(&ahc->scb_data->free_scbs)) == NULL)
375 return (scb);
379 * Return an SCB resource to the free list.
382 ahc_free_scb(struct ahc_softc *ahc, struct scb *scb)
386 hscb = scb->hscb;
389 scb->flags = SCB_FREE;
392 SLIST_INSERT_HEAD(&ahc->scb_data->free_scbs, scb, links.sle);
395 ahc_platform_scb_free(ahc, scb);
398 static __inline struct scb *
401 struct scb* scb;
403 scb = ahc->scb_data->scbindex[tag];
404 if (scb != NULL)
405 ahc_sync_scb(ahc, scb,
407 return (scb);
411 ahc_swap_with_next_hscb(struct ahc_softc *ahc, struct scb *scb)
420 * SCB to download is saved off in ahc->next_queued_scb.
421 * When we are called to queue "an arbitrary scb",
424 * finally assign the SCB to the tag indexed location
426 * locate the correct SCB by SCB_TAG.
430 memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb));
431 if ((scb->flags & SCB_CDB32_PTR) != 0) {
437 q_hscb->next = scb->hscb->tag;
440 ahc->next_queued_scb->hscb = scb->hscb;
441 scb->hscb = q_hscb;
443 /* Now define the mapping from tag to SCB in the scbindex */
444 ahc->scb_data->scbindex[scb->hscb->tag] = scb;
451 ahc_queue_scb(struct ahc_softc *ahc, struct scb *scb)
453 ahc_swap_with_next_hscb(ahc, scb);
455 if (scb->hscb->tag == SCB_LIST_NULL
456 || scb->hscb->next == SCB_LIST_NULL)
457 panic("Attempt to queue invalid SCB tag %x:%x\n",
458 scb->hscb->tag, scb->hscb->next);
462 ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag;
468 ahc_sync_scb(ahc, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
470 /* Tell the adapter about the newly queued SCB */
483 ahc_get_sense_buf(struct ahc_softc *ahc, struct scb *scb)
487 offset = scb - ahc->scb_data->scbarray;
492 ahc_get_sense_bufaddr(struct ahc_softc *ahc, struct scb *scb)
496 offset = scb - ahc->scb_data->scbarray;