Lines Matching full:scb
69 { MPARERR, "Scratch or SCB Memory Parity Error" },
128 struct scb *scb);
131 struct scb *scb);
167 struct scb *scb);
180 struct scb *scb, u_int col_idx);
182 struct scb *scb);
185 struct scb *prev_scb,
186 struct scb *scb);
216 struct scb *scb);
218 struct scb *scb);
239 struct scb *scb);
246 struct scb *scb);
248 struct scb *scb);
257 static int ahd_match_scb(struct ahd_softc *ahd, struct scb *scb,
406 ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb, in ahd_sg_setup() argument
409 scb->sg_count++; in ahd_sg_setup()
430 ahd_setup_scb_common(struct ahd_softc *ahd, struct scb *scb) in ahd_setup_scb_common() argument
433 scb->crc_retry_count = 0; in ahd_setup_scb_common()
434 if ((scb->flags & SCB_PACKETIZED) != 0) { in ahd_setup_scb_common()
436 scb->hscb->task_attribute = scb->hscb->control & SCB_TAG_TYPE; in ahd_setup_scb_common()
438 if (ahd_get_transfer_length(scb) & 0x01) in ahd_setup_scb_common()
439 scb->hscb->task_attribute = SCB_XFERLEN_ODD; in ahd_setup_scb_common()
441 scb->hscb->task_attribute = 0; in ahd_setup_scb_common()
444 if (scb->hscb->cdb_len <= MAX_CDB_LEN_WITH_SENSE_ADDR in ahd_setup_scb_common()
445 || (scb->hscb->cdb_len & SCB_CDB_LEN_PTR) != 0) in ahd_setup_scb_common()
446 scb->hscb->shared_data.idata.cdb_plus_saddr.sense_addr = in ahd_setup_scb_common()
447 ahd_htole32(scb->sense_busaddr); in ahd_setup_scb_common()
451 ahd_setup_data_scb(struct ahd_softc *ahd, struct scb *scb) in ahd_setup_data_scb() argument
459 sg = (struct ahd_dma64_seg *)scb->sg_list; in ahd_setup_data_scb()
460 scb->hscb->dataptr = sg->addr; in ahd_setup_data_scb()
461 scb->hscb->datacnt = sg->len; in ahd_setup_data_scb()
466 sg = (struct ahd_dma_seg *)scb->sg_list; in ahd_setup_data_scb()
467 dataptr_words = (uint32_t*)&scb->hscb->dataptr; in ahd_setup_data_scb()
474 scb->hscb->dataptr |= ahd_htole64(high_addr << 8); in ahd_setup_data_scb()
476 scb->hscb->datacnt = sg->len; in ahd_setup_data_scb()
484 scb->hscb->sgptr = ahd_htole32(scb->sg_list_busaddr|SG_FULL_RESID); in ahd_setup_data_scb()
488 ahd_setup_noxfer_scb(struct ahd_softc *ahd, struct scb *scb) in ahd_setup_noxfer_scb() argument
490 scb->hscb->sgptr = ahd_htole32(SG_LIST_NULL); in ahd_setup_noxfer_scb()
491 scb->hscb->dataptr = 0; in ahd_setup_noxfer_scb()
492 scb->hscb->datacnt = 0; in ahd_setup_noxfer_scb()
497 ahd_sg_bus_to_virt(struct ahd_softc *ahd, struct scb *scb, uint32_t sg_busaddr) in ahd_sg_bus_to_virt() argument
502 sg_offset = sg_busaddr - (scb->sg_list_busaddr - ahd_sg_size(ahd)); in ahd_sg_bus_to_virt()
503 return ((uint8_t *)scb->sg_list + sg_offset); in ahd_sg_bus_to_virt()
507 ahd_sg_virt_to_bus(struct ahd_softc *ahd, struct scb *scb, void *sg) in ahd_sg_virt_to_bus() argument
512 sg_offset = ((uint8_t *)sg - (uint8_t *)scb->sg_list) in ahd_sg_virt_to_bus()
515 return (scb->sg_list_busaddr + sg_offset); in ahd_sg_virt_to_bus()
519 ahd_sync_scb(struct ahd_softc *ahd, struct scb *scb, int op) in ahd_sync_scb() argument
522 scb->hscb_map->dmamap, in ahd_sync_scb()
523 /*offset*/(uint8_t*)scb->hscb - scb->hscb_map->vaddr, in ahd_sync_scb()
524 /*len*/sizeof(*scb->hscb), op); in ahd_sync_scb()
528 ahd_sync_sglist(struct ahd_softc *ahd, struct scb *scb, int op) in ahd_sync_sglist() argument
530 if (scb->sg_count == 0) in ahd_sync_sglist()
534 scb->sg_map->dmamap, in ahd_sync_sglist()
535 /*offset*/scb->sg_list_busaddr - ahd_sg_size(ahd), in ahd_sync_sglist()
536 /*len*/ahd_sg_size(ahd) * scb->sg_count, op); in ahd_sync_sglist()
540 ahd_sync_sense(struct ahd_softc *ahd, struct scb *scb, int op) in ahd_sync_sense() argument
543 scb->sense_map->dmamap, in ahd_sync_sense()
544 /*offset*/scb->sense_busaddr, in ahd_sync_sense()
748 * After a host read of SCB memory, the chip in ahd_inb_scbram()
787 struct scb *
790 struct scb* scb; in ahd_lookup_scb() local
794 scb = ahd->scb_data.scbindex[tag]; in ahd_lookup_scb()
795 if (scb != NULL) in ahd_lookup_scb()
796 ahd_sync_scb(ahd, scb, in ahd_lookup_scb()
798 return (scb); in ahd_lookup_scb()
802 ahd_swap_with_next_hscb(struct ahd_softc *ahd, struct scb *scb) in ahd_swap_with_next_hscb() argument
813 * When we are called to queue "an arbitrary scb", in ahd_swap_with_next_hscb()
816 * finally assign the SCB to the tag indexed location in ahd_swap_with_next_hscb()
818 * locate the correct SCB by SCB_TAG. in ahd_swap_with_next_hscb()
823 memcpy(q_hscb, scb->hscb, sizeof(*scb->hscb)); in ahd_swap_with_next_hscb()
825 q_hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr; in ahd_swap_with_next_hscb()
828 ahd->next_queued_hscb = scb->hscb; in ahd_swap_with_next_hscb()
829 ahd->next_queued_hscb_map = scb->hscb_map; in ahd_swap_with_next_hscb()
830 scb->hscb = q_hscb; in ahd_swap_with_next_hscb()
831 scb->hscb_map = q_hscb_map; in ahd_swap_with_next_hscb()
833 /* Now define the mapping from tag to SCB in the scbindex */ in ahd_swap_with_next_hscb()
834 ahd->scb_data.scbindex[SCB_GET_TAG(scb)] = scb; in ahd_swap_with_next_hscb()
841 ahd_queue_scb(struct ahd_softc *ahd, struct scb *scb) in ahd_queue_scb() argument
843 ahd_swap_with_next_hscb(ahd, scb); in ahd_queue_scb()
845 if (SCBID_IS_NULL(SCB_GET_TAG(scb))) in ahd_queue_scb()
846 panic("Attempt to queue invalid SCB tag %x\n", in ahd_queue_scb()
847 SCB_GET_TAG(scb)); in ahd_queue_scb()
852 ahd->qinfifo[AHD_QIN_WRAP(ahd->qinfifonext)] = SCB_GET_TAG(scb); in ahd_queue_scb()
855 if (scb->sg_count != 0) in ahd_queue_scb()
856 ahd_setup_data_scb(ahd, scb); in ahd_queue_scb()
858 ahd_setup_noxfer_scb(ahd, scb); in ahd_queue_scb()
859 ahd_setup_scb_common(ahd, scb); in ahd_queue_scb()
865 ahd_sync_scb(ahd, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); in ahd_queue_scb()
871 host_dataptr = ahd_le64toh(scb->hscb->dataptr); in ahd_queue_scb()
872 printk("%s: Queueing SCB %d:0x%x bus addr 0x%x - 0x%x%x/0x%x\n", in ahd_queue_scb()
874 SCB_GET_TAG(scb), scb->hscb->scsiid, in ahd_queue_scb()
875 ahd_le32toh(scb->hscb->hscb_busaddr), in ahd_queue_scb()
878 ahd_le32toh(scb->hscb->datacnt)); in ahd_queue_scb()
881 /* Tell the adapter about the newly queued SCB */ in ahd_queue_scb()
1089 * for this SCB/transaction.
1092 ahd_update_residual(struct ahd_softc *ahd, struct scb *scb) in ahd_update_residual() argument
1096 sgptr = ahd_le32toh(scb->hscb->sgptr); in ahd_update_residual()
1098 ahd_calc_residual(ahd, scb); in ahd_update_residual()
1102 ahd_complete_scb(struct ahd_softc *ahd, struct scb *scb) in ahd_complete_scb() argument
1106 sgptr = ahd_le32toh(scb->hscb->sgptr); in ahd_complete_scb()
1108 ahd_handle_scb_status(ahd, scb); in ahd_complete_scb()
1110 ahd_done(ahd, scb); in ahd_complete_scb()
1189 struct scb *scb; in ahd_flush_qoutfifo() local
1208 scb = ahd_lookup_scb(ahd, scbid); in ahd_flush_qoutfifo()
1209 if (scb == NULL) { in ahd_flush_qoutfifo()
1210 printk("%s: Warning - GSFIFO SCB %d invalid\n", in ahd_flush_qoutfifo()
1226 if (ahd_scb_active_in_fifo(ahd, scb) == 0) in ahd_flush_qoutfifo()
1229 ahd_run_data_fifo(ahd, scb); in ahd_flush_qoutfifo()
1258 * Place this SCB on the complete DMA list in ahd_flush_qoutfifo()
1260 * SCB before completing the command. in ahd_flush_qoutfifo()
1282 ahd_complete_scb(ahd, scb); in ahd_flush_qoutfifo()
1293 * if this is for an SCB in the qinfifo. in ahd_flush_qoutfifo()
1307 * chip or a push of an SCB from the COMPLETE_DMA_SCB list), in ahd_flush_qoutfifo()
1332 scb = ahd_lookup_scb(ahd, scbid); in ahd_flush_qoutfifo()
1333 if (scb == NULL) { in ahd_flush_qoutfifo()
1335 "SCB %d invalid\n", ahd_name(ahd), scbid); in ahd_flush_qoutfifo()
1338 hscb_ptr = (uint8_t *)scb->hscb; in ahd_flush_qoutfifo()
1342 ahd_complete_scb(ahd, scb); in ahd_flush_qoutfifo()
1353 scb = ahd_lookup_scb(ahd, scbid); in ahd_flush_qoutfifo()
1354 if (scb == NULL) { in ahd_flush_qoutfifo()
1355 printk("%s: Warning - Complete Qfrz SCB %d invalid\n", in ahd_flush_qoutfifo()
1360 ahd_complete_scb(ahd, scb); in ahd_flush_qoutfifo()
1370 scb = ahd_lookup_scb(ahd, scbid); in ahd_flush_qoutfifo()
1371 if (scb == NULL) { in ahd_flush_qoutfifo()
1372 printk("%s: Warning - Complete SCB %d invalid\n", in ahd_flush_qoutfifo()
1377 ahd_complete_scb(ahd, scb); in ahd_flush_qoutfifo()
1391 * Determine if an SCB for a packetized transaction
1395 ahd_scb_active_in_fifo(struct ahd_softc *ahd, struct scb *scb) in ahd_scb_active_in_fifo() argument
1400 * the SCBPTR matches the SCB's ID and the firmware in ahd_scb_active_in_fifo()
1404 if (ahd_get_scbptr(ahd) != SCB_GET_TAG(scb) in ahd_scb_active_in_fifo()
1424 ahd_run_data_fifo(struct ahd_softc *ahd, struct scb *scb) in ahd_run_data_fifo() argument
1460 * Mark the SCB as having a FIFO in use. in ahd_run_data_fifo()
1578 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr); in ahd_run_data_fifo()
1585 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr); in ahd_run_data_fifo()
1637 * the FIFO use count for the SCB, and release in ahd_run_data_fifo()
1661 struct scb *scb; in ahd_run_qoutfifo() local
1675 scb = ahd_lookup_scb(ahd, scb_index); in ahd_run_qoutfifo()
1676 if (scb == NULL) { in ahd_run_qoutfifo()
1677 printk("%s: WARNING no command for scb %d " in ahd_run_qoutfifo()
1683 ahd_handle_scb_status(ahd, scb); in ahd_run_qoutfifo()
1685 ahd_done(ahd, scb); in ahd_run_qoutfifo()
1727 ahd_dump_sglist(struct scb *scb) in ahd_dump_sglist() argument
1731 if (scb->sg_count > 0) { in ahd_dump_sglist()
1732 if ((scb->ahd_softc->flags & AHD_64BIT_ADDRESSING) != 0) { in ahd_dump_sglist()
1735 sg_list = (struct ahd_dma64_seg*)scb->sg_list; in ahd_dump_sglist()
1736 for (i = 0; i < scb->sg_count; i++) { in ahd_dump_sglist()
1751 sg_list = (struct ahd_dma_seg*)scb->sg_list; in ahd_dump_sglist()
1752 for (i = 0; i < scb->sg_count; i++) { in ahd_dump_sglist()
1801 struct scb *scb; in ahd_handle_seqint() local
1807 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_seqint()
1808 if (scb == NULL) { in ahd_handle_seqint()
1816 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid); in ahd_handle_seqint()
1817 ahd_outb(ahd, SAVED_LUN, scb->hscb->lun); in ahd_handle_seqint()
1851 struct scb *scb; in ahd_handle_seqint() local
1855 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_seqint()
1856 if (scb != NULL) in ahd_handle_seqint()
1857 ahd_print_path(ahd, scb); in ahd_handle_seqint()
1860 printk("SCB %d Packetized Status Overrun", scbid); in ahd_handle_seqint()
1867 struct scb *scb; in ahd_handle_seqint() local
1871 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_seqint()
1872 if (scb == NULL) { in ahd_handle_seqint()
1874 printk("CFG4ISTAT: Free SCB %d referenced", scbid); in ahd_handle_seqint()
1877 ahd_outq(ahd, HADDR, scb->sense_busaddr); in ahd_handle_seqint()
1906 struct scb *scb; in ahd_handle_seqint() local
1921 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_seqint()
1922 if (scb == NULL) { in ahd_handle_seqint()
1923 printk("Invalid phase with no valid SCB. " in ahd_handle_seqint()
1929 ahd_compile_devinfo(&devinfo, SCB_GET_OUR_ID(scb), in ahd_handle_seqint()
1930 SCB_GET_TARGET(ahd, scb), in ahd_handle_seqint()
1931 SCB_GET_LUN(scb), in ahd_handle_seqint()
1932 SCB_GET_CHANNEL(ahd, scb), in ahd_handle_seqint()
1947 scb->hscb->control &= ~(TAG_ENB|SCB_TAG_TYPE); in ahd_handle_seqint()
1948 scb->hscb->control |= MK_MESSAGE; in ahd_handle_seqint()
1949 ahd_outb(ahd, SCB_CONTROL, scb->hscb->control); in ahd_handle_seqint()
1951 ahd_outb(ahd, SAVED_SCSIID, scb->hscb->scsiid); in ahd_handle_seqint()
1953 * The lun is 0, regardless of the SCB's lun in ahd_handle_seqint()
1959 scb->flags &= ~SCB_PACKETIZED; in ahd_handle_seqint()
1960 scb->flags |= SCB_ABORT|SCB_EXTERNAL_RESET; in ahd_handle_seqint()
1961 ahd_freeze_devq(ahd, scb); in ahd_handle_seqint()
1962 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); in ahd_handle_seqint()
1963 ahd_freeze_scb(scb); in ahd_handle_seqint()
1980 ahd_print_path(ahd, scb); in ahd_handle_seqint()
1992 struct scb *scb; in ahd_handle_seqint() local
2002 scb = ahd_lookup_scb(ahd, scb_index); in ahd_handle_seqint()
2003 if (scb == NULL) { in ahd_handle_seqint()
2005 * Attempt to transfer to an SCB that is in ahd_handle_seqint()
2016 * attempt to complete this bogus SCB. in ahd_handle_seqint()
2059 struct scb *scb; in ahd_handle_seqint() local
2079 scb = ahd_lookup_scb(ahd, scb_index); in ahd_handle_seqint()
2084 scb); in ahd_handle_seqint()
2100 scb); in ahd_handle_seqint()
2114 printk("%s:%c:%d: no active SCB for reconnecting " in ahd_handle_seqint()
2194 struct scb *scb; in ahd_handle_seqint() local
2201 scb = ahd_lookup_scb(ahd, scbindex); in ahd_handle_seqint()
2205 ahd_print_path(ahd, scb); in ahd_handle_seqint()
2208 SCB_GET_TAG(scb)); in ahd_handle_seqint()
2209 ahd_print_path(ahd, scb); in ahd_handle_seqint()
2214 ahd_get_transfer_length(scb), scb->sg_count); in ahd_handle_seqint()
2215 ahd_dump_sglist(scb); in ahd_handle_seqint()
2223 ahd_freeze_devq(ahd, scb); in ahd_handle_seqint()
2224 ahd_set_transaction_status(scb, CAM_DATA_RUN_ERR); in ahd_handle_seqint()
2225 ahd_freeze_scb(scb); in ahd_handle_seqint()
2231 struct scb *scb; in ahd_handle_seqint() local
2239 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_seqint()
2240 if (scb != NULL in ahd_handle_seqint()
2241 && (scb->flags & SCB_RECOVERY_SCB) != 0) in ahd_handle_seqint()
2244 * SCB into the QINFIFO. in ahd_handle_seqint()
2246 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb), in ahd_handle_seqint()
2247 SCB_GET_CHANNEL(ahd, scb), in ahd_handle_seqint()
2248 SCB_GET_LUN(scb), SCB_GET_TAG(scb), in ahd_handle_seqint()
2258 struct scb *scb; in ahd_handle_seqint() local
2261 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_seqint()
2262 if (scb != NULL) { in ahd_handle_seqint()
2267 ahd_print_path(ahd, scb); in ahd_handle_seqint()
2269 scb->hscb->task_management); in ahd_handle_seqint()
2273 switch (scb->hscb->task_management) { in ahd_handle_seqint()
2275 tag = SCB_GET_TAG(scb); in ahd_handle_seqint()
2279 lun = scb->hscb->lun; in ahd_handle_seqint()
2281 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), in ahd_handle_seqint()
2286 lun = scb->hscb->lun; in ahd_handle_seqint()
2292 ahd_scb_devinfo(ahd, &devinfo, scb); in ahd_handle_seqint()
2312 struct scb *scb; in ahd_handle_seqint() local
2319 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_seqint()
2320 if (scb != NULL) { in ahd_handle_seqint()
2322 * Remove the second instance of this SCB from in ahd_handle_seqint()
2325 ahd_print_path(ahd, scb); in ahd_handle_seqint()
2326 printk("SCB completes before TMF\n"); in ahd_handle_seqint()
2330 * set the TMF back to zero in this SCB so that in ahd_handle_seqint()
2339 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb), in ahd_handle_seqint()
2340 SCB_GET_CHANNEL(ahd, scb), in ahd_handle_seqint()
2341 SCB_GET_LUN(scb), SCB_GET_TAG(scb), in ahd_handle_seqint()
2375 struct scb *scb; in ahd_handle_scsiint() local
2416 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_scsiint()
2417 if (scb != NULL in ahd_handle_scsiint()
2419 scb = NULL; in ahd_handle_scsiint()
2480 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_scsiint()
2481 if (scb == NULL) { in ahd_handle_scsiint()
2482 printk("%s: ahd_intr - referenced scb not " in ahd_handle_scsiint()
2483 "valid during SELTO scb(0x%x)\n", in ahd_handle_scsiint()
2490 ahd_print_path(ahd, scb); in ahd_handle_scsiint()
2491 printk("Saw Selection Timeout for SCB 0x%x\n", in ahd_handle_scsiint()
2495 ahd_scb_devinfo(ahd, &devinfo, scb); in ahd_handle_scsiint()
2496 ahd_set_transaction_status(scb, CAM_SEL_TIMEOUT); in ahd_handle_scsiint()
2497 ahd_freeze_devq(ahd, scb); in ahd_handle_scsiint()
2570 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_scsiint()
2571 if (scb == NULL) { in ahd_handle_scsiint()
2572 printk("%s: Invalid SCB %d in DFF%d " in ahd_handle_scsiint()
2577 packetized = (scb->flags & SCB_PACKETIZED) != 0; in ahd_handle_scsiint()
2657 struct scb *scb; in ahd_handle_transmission_error() local
2667 scb = NULL; in ahd_handle_transmission_error()
2698 * Try to find the SCB associated with this error. in ahd_handle_transmission_error()
2706 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_transmission_error()
2707 if (scb != NULL && SCB_IS_SILENT(scb)) in ahd_handle_transmission_error()
2802 if (scb == NULL) { in ahd_handle_transmission_error()
2803 printk("%s: No SCB valid for LQICRC_NLQ. " in ahd_handle_transmission_error()
2833 if (scb != NULL && msg_out == INITIATOR_ERROR) in ahd_handle_transmission_error()
2834 scb->flags |= SCB_TRANSMISSION_ERROR; in ahd_handle_transmission_error()
2891 struct scb *scb; in ahd_handle_pkt_busfree() local
2908 * SCB that encountered the failure. Clean in ahd_handle_pkt_busfree()
2915 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_pkt_busfree()
2916 if (scb == NULL) in ahd_handle_pkt_busfree()
2917 panic("SCB not valid during LQOBUSFREE"); in ahd_handle_pkt_busfree()
2938 * we restart on the correct SCB. in ahd_handle_pkt_busfree()
2957 if (scb->crc_retry_count < AHD_MAX_LQ_CRC_ERRORS) { in ahd_handle_pkt_busfree()
2958 if (SCB_IS_SILENT(scb) == FALSE) { in ahd_handle_pkt_busfree()
2959 ahd_print_path(ahd, scb); in ahd_handle_pkt_busfree()
2963 scb->crc_retry_count++; in ahd_handle_pkt_busfree()
2965 ahd_set_transaction_status(scb, CAM_UNCOR_PARITY); in ahd_handle_pkt_busfree()
2966 ahd_freeze_scb(scb); in ahd_handle_pkt_busfree()
2967 ahd_freeze_devq(ahd, scb); in ahd_handle_pkt_busfree()
2991 struct scb *scb; in ahd_handle_pkt_busfree() local
2994 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_pkt_busfree()
2995 ahd_print_path(ahd, scb); in ahd_handle_pkt_busfree()
2998 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), 'A', in ahd_handle_pkt_busfree()
2999 SCB_GET_LUN(scb), SCB_GET_TAG(scb), in ahd_handle_pkt_busfree()
3018 struct scb *scb; in ahd_handle_nonpkt_busfree() local
3043 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_nonpkt_busfree()
3044 if (scb != NULL in ahd_handle_nonpkt_busfree()
3046 scb = NULL; in ahd_handle_nonpkt_busfree()
3058 if (scb == NULL) { in ahd_handle_nonpkt_busfree()
3066 ahd_print_path(ahd, scb); in ahd_handle_nonpkt_busfree()
3067 printk("SCB %d - Abort%s Completed.\n", in ahd_handle_nonpkt_busfree()
3068 SCB_GET_TAG(scb), in ahd_handle_nonpkt_busfree()
3072 tag = SCB_GET_TAG(scb); in ahd_handle_nonpkt_busfree()
3074 if ((scb->flags & SCB_EXTERNAL_RESET) != 0) { in ahd_handle_nonpkt_busfree()
3081 * abort only the SCB that encountered in ahd_handle_nonpkt_busfree()
3083 * lun. The SCB will be retried so the OS in ahd_handle_nonpkt_busfree()
3087 tag = SCB_GET_TAG(scb); in ahd_handle_nonpkt_busfree()
3088 saved_lun = scb->hscb->lun; in ahd_handle_nonpkt_busfree()
3142 if (scb != NULL) { in ahd_handle_nonpkt_busfree()
3149 ahd_freeze_devq(ahd, scb); in ahd_handle_nonpkt_busfree()
3150 ahd_qinfifo_requeue_tail(ahd, scb); in ahd_handle_nonpkt_busfree()
3168 if (scb != NULL) { in ahd_handle_nonpkt_busfree()
3175 ahd_freeze_devq(ahd, scb); in ahd_handle_nonpkt_busfree()
3176 ahd_qinfifo_requeue_tail(ahd, scb); in ahd_handle_nonpkt_busfree()
3194 if (scb != NULL) { in ahd_handle_nonpkt_busfree()
3201 ahd_freeze_devq(ahd, scb); in ahd_handle_nonpkt_busfree()
3202 ahd_qinfifo_requeue_tail(ahd, scb); in ahd_handle_nonpkt_busfree()
3231 if (scb != NULL && printerror != 0 in ahd_handle_nonpkt_busfree()
3235 ahd_freeze_devq(ahd, scb); in ahd_handle_nonpkt_busfree()
3236 ahd_set_transaction_status(scb, CAM_REQUEUE_REQ); in ahd_handle_nonpkt_busfree()
3237 ahd_freeze_scb(scb); in ahd_handle_nonpkt_busfree()
3239 ahd_abort_scbs(ahd, SCB_GET_TARGET(ahd, scb), in ahd_handle_nonpkt_busfree()
3240 SCB_GET_CHANNEL(ahd, scb), in ahd_handle_nonpkt_busfree()
3241 SCB_GET_LUN(scb), SCB_LIST_NULL, in ahd_handle_nonpkt_busfree()
3248 ahd_done(ahd, scb); in ahd_handle_nonpkt_busfree()
3256 if (scb != NULL) { in ahd_handle_nonpkt_busfree()
3259 if ((scb->hscb->control & TAG_ENB) != 0) in ahd_handle_nonpkt_busfree()
3260 tag = SCB_GET_TAG(scb); in ahd_handle_nonpkt_busfree()
3263 ahd_print_path(ahd, scb); in ahd_handle_nonpkt_busfree()
3265 SCB_GET_LUN(scb), tag, in ahd_handle_nonpkt_busfree()
3292 struct scb *scb; in ahd_handle_proto_violation() local
3301 scb = ahd_lookup_scb(ahd, scbid); in ahd_handle_proto_violation()
3309 * identify message, or did, but we didn't find an SCB in ahd_handle_proto_violation()
3315 scb = NULL; in ahd_handle_proto_violation()
3316 } else if (scb == NULL) { in ahd_handle_proto_violation()
3318 * We don't seem to have an SCB active for this in ahd_handle_proto_violation()
3322 printk("No SCB found during protocol violation\n"); in ahd_handle_proto_violation()
3325 ahd_set_transaction_status(scb, CAM_SEQUENCE_FAIL); in ahd_handle_proto_violation()
3327 ahd_print_path(ahd, scb); in ahd_handle_proto_violation()
3338 ahd_print_path(ahd, scb); in ahd_handle_proto_violation()
3341 ahd_print_path(ahd, scb); in ahd_handle_proto_violation()
3368 if (scb == NULL) { in ahd_handle_proto_violation()
3375 ahd_print_path(ahd, scb); in ahd_handle_proto_violation()
3376 scb->flags |= SCB_ABORT; in ahd_handle_proto_violation()
3565 ahd_print_scb(struct scb *scb)
3570 hscb = scb->hscb;
3571 printk("scb:%p control:0x%x scsiid:0x%x lun:%d cdb_len:%d\n",
3572 (void *)scb,
3585 SCB_GET_TAG(scb));
3586 ahd_dump_sglist(scb);
4188 struct scb *pending_scb; in ahd_update_pending_scbs()
4195 * Traverse the pending SCB list and ensure that all of the in ahd_update_pending_scbs()
4200 * SCB. For this reason, all callers only call this routine in ahd_update_pending_scbs()
4343 struct scb *scb) in ahd_scb_devinfo() argument
4348 our_id = SCSIID_OUR_ID(scb->hscb->scsiid); in ahd_scb_devinfo()
4350 if ((scb->hscb->control & TARGET_SCB) != 0) in ahd_scb_devinfo()
4352 ahd_compile_devinfo(devinfo, our_id, SCB_GET_TARGET(ahd, scb), in ahd_scb_devinfo()
4353 SCB_GET_LUN(scb), SCB_GET_CHANNEL(ahd, scb), role); in ahd_scb_devinfo()
4366 struct scb *scb) in ahd_setup_initiator_msgout() argument
4389 } else if (scb == NULL) { in ahd_setup_initiator_msgout()
4398 if ((scb->flags & SCB_DEVICE_RESET) == 0 in ahd_setup_initiator_msgout()
4399 && (scb->flags & SCB_PACKETIZED) == 0 in ahd_setup_initiator_msgout()
4403 identify_msg = MSG_IDENTIFYFLAG | SCB_GET_LUN(scb); in ahd_setup_initiator_msgout()
4404 if ((scb->hscb->control & DISCENB) != 0) in ahd_setup_initiator_msgout()
4409 if ((scb->hscb->control & TAG_ENB) != 0) { in ahd_setup_initiator_msgout()
4411 scb->hscb->control & (TAG_ENB|SCB_TAG_TYPE); in ahd_setup_initiator_msgout()
4412 ahd->msgout_buf[ahd->msgout_index++] = SCB_GET_TAG(scb); in ahd_setup_initiator_msgout()
4417 if (scb->flags & SCB_DEVICE_RESET) { in ahd_setup_initiator_msgout()
4420 ahd_print_path(ahd, scb); in ahd_setup_initiator_msgout()
4430 } else if ((scb->flags & SCB_ABORT) != 0) { in ahd_setup_initiator_msgout()
4432 if ((scb->hscb->control & TAG_ENB) != 0) { in ahd_setup_initiator_msgout()
4438 ahd_print_path(ahd, scb); in ahd_setup_initiator_msgout()
4440 (scb->hscb->control & TAG_ENB) != 0 ? " Tag" : ""); in ahd_setup_initiator_msgout()
4449 } else if ((scb->flags & (SCB_AUTO_NEGOTIATE|SCB_NEGOTIATE)) != 0) { in ahd_setup_initiator_msgout()
4460 printk("ahd_intr: AWAITING_MSG for an SCB that " in ahd_setup_initiator_msgout()
4462 printk("SCSIID = %x, target_mask = %x\n", scb->hscb->scsiid, in ahd_setup_initiator_msgout()
4464 panic("SCB = %d, SCB Control = %x:%x, MSG_OUT = %x " in ahd_setup_initiator_msgout()
4465 "SCB flags = %x", SCB_GET_TAG(scb), scb->hscb->control, in ahd_setup_initiator_msgout()
4467 scb->flags); in ahd_setup_initiator_msgout()
4471 * Clear the MK_MESSAGE flag from the SCB so we aren't in ahd_setup_initiator_msgout()
4476 scb->hscb->control &= ~MK_MESSAGE; in ahd_setup_initiator_msgout()
5492 struct scb *scb; in ahd_handle_msg_reject() local
5500 scb = ahd_lookup_scb(ahd, scb_index); in ahd_handle_msg_reject()
5580 } else if ((scb->hscb->control & SIMPLE_QUEUE_TAG) != 0) { in ahd_handle_msg_reject()
5584 tag_type = (scb->hscb->control & SIMPLE_QUEUE_TAG); in ahd_handle_msg_reject()
5590 ahd_set_tags(ahd, scb->io_ctx, devinfo, AHD_QUEUE_NONE); in ahd_handle_msg_reject()
5598 ahd_set_tags(ahd, scb->io_ctx, devinfo, AHD_QUEUE_BASIC); in ahd_handle_msg_reject()
5608 scb->hscb->control &= mask; in ahd_handle_msg_reject()
5609 ahd_set_transaction_tag(scb, /*enabled*/FALSE, in ahd_handle_msg_reject()
5613 ahd_busy_tcl(ahd, BUILD_TCL(scb->hscb->scsiid, devinfo->lun), in ahd_handle_msg_reject()
5614 SCB_GET_TAG(scb)); in ahd_handle_msg_reject()
5621 ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb), in ahd_handle_msg_reject()
5622 SCB_GET_CHANNEL(ahd, scb), in ahd_handle_msg_reject()
5623 SCB_GET_LUN(scb), /*tag*/SCB_LIST_NULL, in ahd_handle_msg_reject()
5658 struct scb *scb; in ahd_handle_ign_wide_residue() local
5661 scb = ahd_lookup_scb(ahd, scb_index); in ahd_handle_ign_wide_residue()
5667 || ahd_get_transfer_dir(scb) != CAM_DIR_IN) { in ahd_handle_ign_wide_residue()
5715 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr); in ahd_handle_ign_wide_residue()
5723 if (sg != scb->sg_list in ahd_handle_ign_wide_residue()
5742 sgptr = ahd_sg_virt_to_bus(ahd, scb, in ahd_handle_ign_wide_residue()
5748 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr); in ahd_handle_ign_wide_residue()
5756 if (sg != scb->sg_list in ahd_handle_ign_wide_residue()
5775 sgptr = ahd_sg_virt_to_bus(ahd, scb, in ahd_handle_ign_wide_residue()
5807 struct scb *scb; in ahd_reinitialize_dataptrs() local
5819 scb = ahd_lookup_scb(ahd, scb_index); in ahd_reinitialize_dataptrs()
5830 ahd_print_path(ahd, scb); in ahd_reinitialize_dataptrs()
5854 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr); in ahd_reinitialize_dataptrs()
5866 sg = ahd_sg_bus_to_virt(ahd, scb, sgptr); in ahd_reinitialize_dataptrs()
5952 struct scb *scb) in ahd_setup_target_msgin() argument
5963 if (scb != NULL && (scb->flags & SCB_AUTO_NEGOTIATE) != 0) in ahd_setup_target_msgin()
6075 printk("%s: scb size = 0x%x, hscb size = 0x%x\n", in ahd_alloc()
6076 ahd_name(ahd), (u_int)sizeof(struct scb), in ahd_alloc()
6369 printk("%s: No SCB space found\n", ahd_name(ahd)); in ahd_init_scbdata()
6385 /* DMA tag for our hardware scb structures */ in ahd_init_scbdata()
6452 static struct scb *
6455 struct scb *scb; in ahd_find_scb_by_tag() local
6460 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) { in ahd_find_scb_by_tag()
6461 if (SCB_GET_TAG(scb) == tag) in ahd_find_scb_by_tag()
6462 return (scb); in ahd_find_scb_by_tag()
6468 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) { in ahd_find_scb_by_tag()
6469 struct scb *list_scb; in ahd_find_scb_by_tag()
6471 list_scb = scb; in ahd_find_scb_by_tag()
6482 LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) { in ahd_find_scb_by_tag()
6483 if (SCB_GET_TAG(scb) == tag) in ahd_find_scb_by_tag()
6484 return (scb); in ahd_find_scb_by_tag()
6607 /*************************** SCB Management ***********************************/
6609 ahd_add_col_list(struct ahd_softc *ahd, struct scb *scb, u_int col_idx) in ahd_add_col_list() argument
6613 struct scb *first_scb; in ahd_add_col_list()
6615 scb->flags |= SCB_ON_COL_LIST; in ahd_add_col_list()
6616 AHD_SET_SCB_COL_IDX(scb, col_idx); in ahd_add_col_list()
6621 LIST_INSERT_AFTER(first_scb, scb, collision_links); in ahd_add_col_list()
6623 LIST_INSERT_HEAD(free_list, scb, collision_links); in ahd_add_col_list()
6624 TAILQ_INSERT_TAIL(free_tailq, scb, links.tqe); in ahd_add_col_list()
6629 ahd_rem_col_list(struct ahd_softc *ahd, struct scb *scb) in ahd_rem_col_list() argument
6633 struct scb *first_scb; in ahd_rem_col_list()
6636 scb->flags &= ~SCB_ON_COL_LIST; in ahd_rem_col_list()
6637 col_idx = AHD_GET_SCB_COL_IDX(ahd, scb); in ahd_rem_col_list()
6641 if (first_scb == scb) { in ahd_rem_col_list()
6642 struct scb *next_scb; in ahd_rem_col_list()
6649 next_scb = LIST_NEXT(scb, collision_links); in ahd_rem_col_list()
6651 TAILQ_INSERT_AFTER(free_tailq, scb, in ahd_rem_col_list()
6654 TAILQ_REMOVE(free_tailq, scb, links.tqe); in ahd_rem_col_list()
6656 LIST_REMOVE(scb, collision_links); in ahd_rem_col_list()
6660 * Get a free scb. If there are none, see if we can allocate a new SCB.
6662 struct scb *
6665 struct scb *scb; in ahd_get_scb() local
6670 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) { in ahd_get_scb()
6671 if (AHD_GET_SCB_COL_IDX(ahd, scb) != col_idx) { in ahd_get_scb()
6672 ahd_rem_col_list(ahd, scb); in ahd_get_scb()
6676 if ((scb = LIST_FIRST(&ahd->scb_data.any_dev_free_scb_list)) == NULL) { in ahd_get_scb()
6683 LIST_REMOVE(scb, links.le); in ahd_get_scb()
6685 && (scb->col_scb != NULL) in ahd_get_scb()
6686 && (scb->col_scb->flags & SCB_ACTIVE) == 0) { in ahd_get_scb()
6687 LIST_REMOVE(scb->col_scb, links.le); in ahd_get_scb()
6688 ahd_add_col_list(ahd, scb->col_scb, col_idx); in ahd_get_scb()
6691 scb->flags |= SCB_ACTIVE; in ahd_get_scb()
6692 return (scb); in ahd_get_scb()
6696 * Return an SCB resource to the free list.
6699 ahd_free_scb(struct ahd_softc *ahd, struct scb *scb) in ahd_free_scb() argument
6702 scb->flags = SCB_FLAG_NONE; in ahd_free_scb()
6703 scb->hscb->control = 0; in ahd_free_scb()
6704 ahd->scb_data.scbindex[SCB_GET_TAG(scb)] = NULL; in ahd_free_scb()
6706 if (scb->col_scb == NULL) { in ahd_free_scb()
6712 scb, links.le); in ahd_free_scb()
6713 } else if ((scb->col_scb->flags & SCB_ON_COL_LIST) != 0) { in ahd_free_scb()
6716 * The SCB we might have collided with is on in ahd_free_scb()
6720 ahd_rem_col_list(ahd, scb->col_scb); in ahd_free_scb()
6722 scb, links.le); in ahd_free_scb()
6724 scb->col_scb, links.le); in ahd_free_scb()
6725 } else if ((scb->col_scb->flags in ahd_free_scb()
6727 && (scb->col_scb->hscb->control & TAG_ENB) != 0) { in ahd_free_scb()
6730 * The SCB we might collide with on the next allocation in ahd_free_scb()
6732 * Put us on the SCB collision list. in ahd_free_scb()
6734 ahd_add_col_list(ahd, scb, in ahd_free_scb()
6735 AHD_GET_SCB_COL_IDX(ahd, scb->col_scb)); in ahd_free_scb()
6738 * The SCB we might collide with on the next allocation in ahd_free_scb()
6740 * Since we can't collide, put this SCB on the generic in ahd_free_scb()
6744 scb, links.le); in ahd_free_scb()
6747 ahd_platform_scb_free(ahd, scb); in ahd_free_scb()
6754 struct scb *next_scb; in ahd_alloc_scbs()
6907 * The first entry is embedded in the scb. in ahd_alloc_scbs()
7011 panic("Hardware SCB size is incorrect"); in ahd_init()
7090 * We need one SCB to serve as the "next SCB". Since the in ahd_init()
7091 * tag identifier in this SCB will never be used, there is in ahd_init()
7092 * no point in using a valid HSCB tag from an SCB pulled from in ahd_init()
7102 /* Allocate SCB data now that buffer_dmat is initialized */ in ahd_init()
7329 * Setup SCB Offset registers. in ahd_chip_init()
7394 * supported. We use this to catch invalid SCB references. in ahd_chip_init()
7503 * Tell the sequencer which SCB will be the next one it receives. in ahd_chip_init()
7891 * Set SCBPTR to the SCB that contains the busy
7893 * the SCB that contains the entry for TCL.
7902 * Index to the SCB that contains the busy entry. in ahd_index_busy_tcl()
7910 * And now calculate the SCB offset to the entry. in ahd_index_busy_tcl()
7944 /************************** SCB and SCB queue management **********************/
7946 ahd_match_scb(struct ahd_softc *ahd, struct scb *scb, int target, in ahd_match_scb() argument
7949 int targ = SCB_GET_TARGET(ahd, scb); in ahd_match_scb()
7950 char chan = SCB_GET_CHANNEL(ahd, scb); in ahd_match_scb()
7951 int slun = SCB_GET_LUN(scb); in ahd_match_scb()
7963 group = XPT_FC_GROUP(scb->io_ctx->ccb_h.func_code); in ahd_match_scb()
7966 && ((tag == SCB_GET_TAG(scb)) in ahd_match_scb()
7970 && ((tag == scb->io_ctx->csio.tag_id) in ahd_match_scb()
7974 match = ((tag == SCB_GET_TAG(scb)) || (tag == SCB_LIST_NULL)); in ahd_match_scb()
7982 ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb) in ahd_freeze_devq() argument
7988 target = SCB_GET_TARGET(ahd, scb); in ahd_freeze_devq()
7989 lun = SCB_GET_LUN(scb); in ahd_freeze_devq()
7990 channel = SCB_GET_CHANNEL(ahd, scb); in ahd_freeze_devq()
7996 ahd_platform_freeze_devq(ahd, scb); in ahd_freeze_devq()
8000 ahd_qinfifo_requeue_tail(struct ahd_softc *ahd, struct scb *scb) in ahd_qinfifo_requeue_tail() argument
8002 struct scb *prev_scb; in ahd_qinfifo_requeue_tail()
8016 ahd_qinfifo_requeue(ahd, prev_scb, scb); in ahd_qinfifo_requeue_tail()
8022 ahd_qinfifo_requeue(struct ahd_softc *ahd, struct scb *prev_scb, in ahd_qinfifo_requeue()
8023 struct scb *scb) in ahd_qinfifo_requeue() argument
8028 busaddr = ahd_le32toh(scb->hscb->hscb_busaddr); in ahd_qinfifo_requeue()
8031 prev_scb->hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr; in ahd_qinfifo_requeue()
8035 ahd->qinfifo[AHD_QIN_WRAP(ahd->qinfifonext)] = SCB_GET_TAG(scb); in ahd_qinfifo_requeue()
8037 scb->hscb->next_hscb_busaddr = ahd->next_queued_hscb->hscb_busaddr; in ahd_qinfifo_requeue()
8038 ahd_sync_scb(ahd, scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); in ahd_qinfifo_requeue()
8062 struct scb *scb; in ahd_reset_cmds_pending() local
8076 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) { in ahd_reset_cmds_pending()
8085 ahd_done_with_status(struct ahd_softc *ahd, struct scb *scb, uint32_t status) in ahd_done_with_status() argument
8090 ostat = ahd_get_transaction_status(scb); in ahd_done_with_status()
8092 ahd_set_transaction_status(scb, status); in ahd_done_with_status()
8093 cstat = ahd_get_transaction_status(scb); in ahd_done_with_status()
8095 ahd_freeze_scb(scb); in ahd_done_with_status()
8096 ahd_done(ahd, scb); in ahd_done_with_status()
8104 struct scb *scb; in ahd_search_qinfifo() local
8105 struct scb *mk_msg_scb; in ahd_search_qinfifo()
8106 struct scb *prev_scb; in ahd_search_qinfifo()
8125 * Halt any pending SCB DMA. The sequencer will reinitiate in ahd_search_qinfifo()
8156 scb = ahd_lookup_scb(ahd, ahd->qinfifo[qinpos]); in ahd_search_qinfifo()
8157 if (scb == NULL) { in ahd_search_qinfifo()
8158 printk("qinpos = %d, SCB index = %d\n", in ahd_search_qinfifo()
8163 if (ahd_match_scb(ahd, scb, target, channel, lun, tag, role)) { in ahd_search_qinfifo()
8165 * We found an scb that needs to be acted on. in ahd_search_qinfifo()
8170 if ((scb->flags & SCB_ACTIVE) == 0) in ahd_search_qinfifo()
8171 printk("Inactive SCB in qinfifo\n"); in ahd_search_qinfifo()
8172 ahd_done_with_status(ahd, scb, status); in ahd_search_qinfifo()
8180 ahd_qinfifo_requeue(ahd, prev_scb, scb); in ahd_search_qinfifo()
8181 prev_scb = scb; in ahd_search_qinfifo()
8185 ahd_qinfifo_requeue(ahd, prev_scb, scb); in ahd_search_qinfifo()
8186 prev_scb = scb; in ahd_search_qinfifo()
8223 "SCB index == 0x%x, yet numscbs == 0x%x.", in ahd_search_qinfifo()
8228 scb = ahd_lookup_scb(ahd, scbid); in ahd_search_qinfifo()
8229 if (scb == NULL) { in ahd_search_qinfifo()
8230 printk("%s: SCB = 0x%x Not Active!\n", in ahd_search_qinfifo()
8236 if (ahd_match_scb(ahd, scb, target, channel, CAM_LUN_WILDCARD, in ahd_search_qinfifo()
8246 printk(" %d ( ", SCB_GET_TARGET(ahd, scb)); in ahd_search_qinfifo()
8251 SCB_GET_TARGET(ahd, scb)); in ahd_search_qinfifo()
8253 * Check any MK_MESSAGE SCB that is still waiting to in ahd_search_qinfifo()
8261 * We found an scb that needs to be acted on. in ahd_search_qinfifo()
8267 printk("Inactive SCB pending MK_MSG\n"); in ahd_search_qinfifo()
8274 printk("Removing MK_MSG scb\n"); in ahd_search_qinfifo()
8292 printk(" 0x%x", SCB_GET_TAG(scb)); in ahd_search_qinfifo()
8301 && ahd_match_scb(ahd, scb, target, channel, CAM_LUN_WILDCARD, in ahd_search_qinfifo()
8305 * When removing the last SCB for a target in ahd_search_qinfifo()
8306 * queue with a pending MK_MESSAGE scb, we in ahd_search_qinfifo()
8307 * must queue the MK_MESSAGE scb. in ahd_search_qinfifo()
8335 struct scb *scb; in ahd_search_scb_list() local
8348 printk("%s:SCB List inconsistency. " in ahd_search_scb_list()
8349 "SCB == 0x%x, yet numscbs == 0x%x.", in ahd_search_scb_list()
8354 scb = ahd_lookup_scb(ahd, scbid); in ahd_search_scb_list()
8355 if (scb == NULL) { in ahd_search_scb_list()
8356 printk("%s: SCB = %d Not Active!\n", in ahd_search_scb_list()
8363 if (ahd_match_scb(ahd, scb, target, channel, in ahd_search_scb_list()
8371 if ((scb->flags & SCB_ACTIVE) == 0) in ahd_search_scb_list()
8372 printk("Inactive SCB in Waiting List\n"); in ahd_search_scb_list()
8373 ahd_done_with_status(ahd, scb, status); in ahd_search_scb_list()
8389 panic("SCB LIST LOOP"); in ahd_search_scb_list()
8433 * scb that follows the one that we remove.
8451 * Only clear the tail if the removed SCB was in ahd_rem_wscb()
8464 * Add the SCB as selected by SCBPTR onto the on chip list of
8466 * performing SCB paging.
8490 struct scb *scbp; in ahd_abort_scbs()
8491 struct scb *scbp_next; in ahd_abort_scbs()
8571 printk("Inactive SCB on pending list\n"); in ahd_abort_scbs()
8821 ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) in ahd_handle_scsi_status() argument
8835 hscb = scb->hscb; in ahd_handle_scsi_status()
8845 ahd_freeze_devq(ahd, scb); in ahd_handle_scsi_status()
8846 ahd_freeze_scb(scb); in ahd_handle_scsi_status()
8854 if ((scb->flags & SCB_SENSE) != 0) { in ahd_handle_scsi_status()
8859 scb->flags &= ~SCB_SENSE; in ahd_handle_scsi_status()
8860 ahd_set_transaction_status(scb, CAM_AUTOSENSE_FAIL); in ahd_handle_scsi_status()
8861 ahd_done(ahd, scb); in ahd_handle_scsi_status()
8864 ahd_set_transaction_status(scb, CAM_SCSI_STATUS_ERROR); in ahd_handle_scsi_status()
8865 ahd_set_scsi_status(scb, hscb->shared_data.istatus.scsi_status); in ahd_handle_scsi_status()
8871 ahd_sync_sense(ahd, scb, BUS_DMASYNC_POSTREAD); in ahd_handle_scsi_status()
8872 siu = (struct scsi_status_iu_header *)scb->sense_data; in ahd_handle_scsi_status()
8873 ahd_set_scsi_status(scb, siu->status); in ahd_handle_scsi_status()
8876 ahd_print_path(ahd, scb); in ahd_handle_scsi_status()
8877 printk("SCB 0x%x Received PKT Status of 0x%x\n", in ahd_handle_scsi_status()
8878 SCB_GET_TAG(scb), siu->status); in ahd_handle_scsi_status()
8886 ahd_print_path(ahd, scb); in ahd_handle_scsi_status()
8915 ahd_set_transaction_status(scb, in ahd_handle_scsi_status()
8919 scb->flags |= SCB_PKT_SENSE; in ahd_handle_scsi_status()
8925 ahd_done(ahd, scb); in ahd_handle_scsi_status()
8939 ahd_print_path(ahd, scb); in ahd_handle_scsi_status()
8940 printk("SCB %d: requests Check Status\n", in ahd_handle_scsi_status()
8941 SCB_GET_TAG(scb)); in ahd_handle_scsi_status()
8945 if (ahd_perform_autosense(scb) == 0) in ahd_handle_scsi_status()
8948 ahd_compile_devinfo(&devinfo, SCB_GET_OUR_ID(scb), in ahd_handle_scsi_status()
8949 SCB_GET_TARGET(ahd, scb), in ahd_handle_scsi_status()
8950 SCB_GET_LUN(scb), in ahd_handle_scsi_status()
8951 SCB_GET_CHANNEL(ahd, scb), in ahd_handle_scsi_status()
8959 sg = scb->sg_list; in ahd_handle_scsi_status()
8964 ahd_update_residual(ahd, scb); in ahd_handle_scsi_status()
8967 ahd_print_path(ahd, scb); in ahd_handle_scsi_status()
8971 scb->sg_count = 0; in ahd_handle_scsi_status()
8972 sg = ahd_sg_setup(ahd, scb, sg, ahd_get_sense_bufaddr(ahd, scb), in ahd_handle_scsi_status()
8973 ahd_get_sense_bufsize(ahd, scb), in ahd_handle_scsi_status()
8978 && SCB_GET_LUN(scb) < 8) in ahd_handle_scsi_status()
8979 sc->byte2 = SCB_GET_LUN(scb) << 5; in ahd_handle_scsi_status()
8982 sc->length = ahd_get_sense_bufsize(ahd, scb); in ahd_handle_scsi_status()
9002 if (ahd_get_residual(scb) == ahd_get_transfer_length(scb)) { in ahd_handle_scsi_status()
9009 scb->flags &= in ahd_handle_scsi_status()
9011 scb->flags |= SCB_AUTO_NEGOTIATE; in ahd_handle_scsi_status()
9014 ahd_setup_data_scb(ahd, scb); in ahd_handle_scsi_status()
9015 scb->flags |= SCB_SENSE; in ahd_handle_scsi_status()
9016 ahd_queue_scb(ahd, scb); in ahd_handle_scsi_status()
9024 ahd_done(ahd, scb); in ahd_handle_scsi_status()
9030 ahd_handle_scb_status(struct ahd_softc *ahd, struct scb *scb) in ahd_handle_scb_status() argument
9032 if (scb->hscb->shared_data.istatus.scsi_status != 0) { in ahd_handle_scb_status()
9033 ahd_handle_scsi_status(ahd, scb); in ahd_handle_scb_status()
9035 ahd_calc_residual(ahd, scb); in ahd_handle_scb_status()
9036 ahd_done(ahd, scb); in ahd_handle_scb_status()
9041 * Calculate the residual for a just completed SCB.
9044 ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb) in ahd_calc_residual() argument
9068 hscb = scb->hscb; in ahd_calc_residual()
9083 * regardless of the role for this SCB. in ahd_calc_residual()
9089 resid = ahd_get_transfer_length(scb); in ahd_calc_residual()
9094 ahd_print_path(ahd, scb); in ahd_calc_residual()
9096 SCB_GET_TAG(scb)); in ahd_calc_residual()
9097 ahd_freeze_devq(ahd, scb); in ahd_calc_residual()
9098 ahd_set_transaction_status(scb, CAM_DATA_RUN_ERR); in ahd_calc_residual()
9099 ahd_freeze_scb(scb); in ahd_calc_residual()
9112 sg = ahd_sg_bus_to_virt(ahd, scb, resid_sgptr & SG_PTR_MASK); in ahd_calc_residual()
9127 if ((scb->flags & SCB_SENSE) == 0) in ahd_calc_residual()
9128 ahd_set_residual(scb, resid); in ahd_calc_residual()
9130 ahd_set_sense_residual(scb, resid); in ahd_calc_residual()
9134 ahd_print_path(ahd, scb); in ahd_calc_residual()
9136 (scb->flags & SCB_SENSE) ? "Sense " : "", resid); in ahd_calc_residual()
9634 struct scb *scb; in ahd_dump_card_state() local
9717 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) { in ahd_dump_card_state()
9720 cur_col = printk("\n%3d FIFO_USE[0x%x] ", SCB_GET_TAG(scb), in ahd_dump_card_state()
9722 ahd_set_scbptr(ahd, SCB_GET_TAG(scb)); in ahd_dump_card_state()
9730 printk("Kernel Free SCB list: "); in ahd_dump_card_state()
9732 TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) { in ahd_dump_card_state()
9733 struct scb *list_scb; in ahd_dump_card_state()
9735 list_scb = scb; in ahd_dump_card_state()
9742 LIST_FOREACH(scb, &ahd->scb_data.any_dev_free_scb_list, links.le) { in ahd_dump_card_state()
9745 printk("%d ", SCB_GET_TAG(scb)); in ahd_dump_card_state()
9791 struct scb *fifo_scb; in ahd_dump_card_state()
9797 printk("\n\n%s: FIFO%d %s, LONGJMP == 0x%x, SCB 0x%x\n", in ahd_dump_card_state()
10426 struct scb *scb; in ahd_handle_en_lun() local
10437 LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) { in ahd_handle_en_lun()
10440 ccbh = &scb->io_ctx->ccb_h; in ahd_handle_en_lun()