Lines Matching refs:acp

149 #define	AAC_CMDQ(acp)		(!((acp)->flags & AAC_CMD_SYNC))  argument
1205 aac_set_arq_data_hwerr(struct aac_cmd *acp) in aac_set_arq_data_hwerr() argument
1210 cdbp = (void *)acp->pkt->pkt_cdbp; in aac_set_arq_data_hwerr()
1211 err_blkno = AAC_GETGXADDR(acp->cmdlen, cdbp); in aac_set_arq_data_hwerr()
1212 aac_set_arq_data(acp->pkt, KEY_HARDWARE_ERROR, 0x00, 0x00, err_blkno); in aac_set_arq_data_hwerr()
1236 PCI_MEM_PUT32(softs, device, slotp->acp->fib_size); in aac_send_command()
1242 aac_end_io(struct aac_softstate *softs, struct aac_cmd *acp) in aac_end_io() argument
1244 struct aac_device *dvp = acp->dvp; in aac_end_io()
1245 int q = AAC_CMDQ(acp); in aac_end_io()
1247 if (acp->slotp) { /* outstanding cmd */ in aac_end_io()
1248 if (!(acp->flags & AAC_CMD_IN_SYNC_SLOT)) { in aac_end_io()
1249 aac_release_slot(softs, acp->slotp); in aac_end_io()
1250 acp->slotp = NULL; in aac_end_io()
1274 aac_set_arq_data(acp->pkt, KEY_UNIT_ATTENTION, in aac_end_io()
1280 aac_cmd_delete(&softs->q_busy, acp); in aac_end_io()
1282 aac_cmd_delete(&softs->q_wait[q], acp); in aac_end_io()
1285 if (!(acp->flags & (AAC_CMD_NO_CB | AAC_CMD_NO_INTR))) { /* async IO */ in aac_end_io()
1287 aac_cmd_enqueue(&softs->q_comp, acp); in aac_end_io()
1289 } else if (acp->flags & AAC_CMD_NO_CB) { /* sync IO */ in aac_end_io()
1298 struct aac_cmd *acp; in aac_handle_io() local
1308 acp = slotp->acp; in aac_handle_io()
1310 if (acp == NULL || acp->slotp != slotp) { in aac_handle_io()
1316 acp->flags |= AAC_CMD_CMPLT; in aac_handle_io()
1342 acp->ac_comp(softs, acp); in aac_handle_io()
1345 acp->flags |= AAC_CMD_ERR; in aac_handle_io()
1346 if (acp->pkt) { in aac_handle_io()
1347 acp->pkt->pkt_reason = CMD_TRAN_ERR; in aac_handle_io()
1348 acp->pkt->pkt_statistics = 0; in aac_handle_io()
1351 aac_end_io(softs, acp); in aac_handle_io()
1776 aac_set_pkt_reason(struct aac_softstate *softs, struct aac_cmd *acp, in aac_set_pkt_reason() argument
1782 if (acp->pkt->pkt_reason == CMD_CMPLT) in aac_set_pkt_reason()
1783 acp->pkt->pkt_reason = reason; in aac_set_pkt_reason()
1784 acp->pkt->pkt_statistics |= stat; in aac_set_pkt_reason()
1791 aac_soft_callback(struct aac_softstate *softs, struct aac_cmd *acp) in aac_soft_callback() argument
1793 ASSERT(acp->pkt); in aac_soft_callback()
1795 acp->flags |= AAC_CMD_CMPLT; in aac_soft_callback()
1797 acp->pkt->pkt_state |= STATE_GOT_BUS | STATE_GOT_TARGET | \ in aac_soft_callback()
1799 if (acp->pkt->pkt_state & STATE_XFERRED_DATA) in aac_soft_callback()
1800 acp->pkt->pkt_resid = 0; in aac_soft_callback()
1803 if (!(acp->flags & AAC_CMD_NO_INTR)) { in aac_soft_callback()
1805 aac_cmd_enqueue(&softs->q_comp, acp); in aac_soft_callback()
1820 aac_ld_complete(struct aac_softstate *softs, struct aac_cmd *acp) in aac_ld_complete() argument
1822 struct aac_slot *slotp = acp->slotp; in aac_ld_complete()
1826 ASSERT(!(acp->flags & AAC_CMD_SYNC)); in aac_ld_complete()
1827 ASSERT(!(acp->flags & AAC_CMD_NO_CB)); in aac_ld_complete()
1829 acp->pkt->pkt_state |= STATE_GOT_STATUS; in aac_ld_complete()
1838 acp->pkt->pkt_resid = 0; in aac_ld_complete()
1839 acp->pkt->pkt_state |= STATE_XFERRED_DATA; in aac_ld_complete()
1841 aac_set_arq_data_hwerr(acp); in aac_ld_complete()
1849 aac_pd_complete(struct aac_softstate *softs, struct aac_cmd *acp) in aac_pd_complete() argument
1851 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_pd_complete()
1852 struct aac_fib *fibp = acp->slotp->fibp; in aac_pd_complete()
1853 struct scsi_pkt *pkt = acp->pkt; in aac_pd_complete()
1857 ASSERT(!(acp->flags & AAC_CMD_SYNC)); in aac_pd_complete()
1858 ASSERT(!(acp->flags & AAC_CMD_NO_CB)); in aac_pd_complete()
1885 acp->bcount); in aac_pd_complete()
1896 aac_set_pkt_reason(softs, acp, in aac_pd_complete()
1911 pkt->pkt_resid = acp->bcount - \ in aac_pd_complete()
1920 aac_set_pkt_reason(softs, acp, CMD_ABORTED, in aac_pd_complete()
1928 aac_set_pkt_reason(softs, acp, CMD_ABORT_FAIL, in aac_pd_complete()
1936 aac_set_pkt_reason(softs, acp, CMD_PER_FAIL, 0); in aac_pd_complete()
1944 if (AAC_DEV_IS_VALID(acp->dvp)) { in aac_pd_complete()
1952 aac_set_pkt_reason(softs, acp, CMD_DEV_GONE, 0); in aac_pd_complete()
1960 aac_set_pkt_reason(softs, acp, CMD_TIMEOUT, in aac_pd_complete()
1968 aac_set_pkt_reason(softs, acp, CMD_RESET, in aac_pd_complete()
1975 aac_set_pkt_reason(softs, acp, CMD_TRAN_ERR, 0); in aac_pd_complete()
2012 aac_set_pkt_reason(softs, acp, CMD_TRAN_ERR, 0); in aac_pd_complete()
2017 aac_set_pkt_reason(softs, acp, CMD_TRAN_ERR, 0); in aac_pd_complete()
2026 aac_ioctl_complete(struct aac_softstate *softs, struct aac_cmd *acp) in aac_ioctl_complete() argument
2028 struct aac_slot *slotp = acp->slotp; in aac_ioctl_complete()
2035 ASSERT(acp->flags & AAC_CMD_SYNC); in aac_ioctl_complete()
2036 ASSERT(acp->flags & AAC_CMD_NO_CB); in aac_ioctl_complete()
2039 acp->fib_size = ddi_get16(slotp->fib_acc_handle, in aac_ioctl_complete()
2042 ASSERT(acp->fib_size <= softs->aac_max_fib_size); in aac_ioctl_complete()
2043 ddi_rep_get8(slotp->fib_acc_handle, (uint8_t *)acp->fibp, in aac_ioctl_complete()
2044 (uint8_t *)slotp->fibp, acp->fib_size, DDI_DEV_AUTOINCR); in aac_ioctl_complete()
2052 aac_sync_complete(struct aac_softstate *softs, struct aac_cmd *acp) in aac_sync_complete() argument
2061 aac_synccache_complete(struct aac_softstate *softs, struct aac_cmd *acp) in aac_synccache_complete() argument
2063 struct aac_slot *slotp = acp->slotp; in aac_synccache_complete()
2068 ASSERT(!(acp->flags & AAC_CMD_SYNC)); in aac_synccache_complete()
2070 acp->pkt->pkt_state |= STATE_GOT_STATUS; in aac_synccache_complete()
2075 aac_set_arq_data_hwerr(acp); in aac_synccache_complete()
2080 aac_startstop_complete(struct aac_softstate *softs, struct aac_cmd *acp) in aac_startstop_complete() argument
2082 struct aac_slot *slotp = acp->slotp; in aac_startstop_complete()
2087 ASSERT(!(acp->flags & AAC_CMD_SYNC)); in aac_startstop_complete()
2089 acp->pkt->pkt_state |= STATE_GOT_STATUS; in aac_startstop_complete()
2095 aac_set_arq_data_hwerr(acp); in aac_startstop_complete()
2500 struct aac_cmd *acp = &softs->sync_ac; in aac_get_adapter_info() local
2507 (void) aac_sync_fib_slot_bind(softs, acp); in aac_get_adapter_info()
2508 acc = acp->slotp->fib_acc_handle; in aac_get_adapter_info()
2509 fibp = acp->slotp->fibp; in aac_get_adapter_info()
2595 aac_sync_fib_slot_release(softs, acp); in aac_get_adapter_info()
2603 struct aac_cmd *acp = &softs->sync_ac; in aac_get_bus_info() local
2613 (void) aac_sync_fib_slot_bind(softs, acp); in aac_get_bus_info()
2614 acc = acp->slotp->fib_acc_handle; in aac_get_bus_info()
2615 fibp = acp->slotp->fibp; in aac_get_bus_info()
2660 aac_sync_fib_slot_release(softs, acp); in aac_get_bus_info()
2705 struct aac_cmd *acp = &softs->sync_ac; in aac_handle_adapter_config_issues() local
2716 (void) aac_sync_fib_slot_bind(softs, acp); in aac_handle_adapter_config_issues()
2717 acc = acp->slotp->fib_acc_handle; in aac_handle_adapter_config_issues()
2718 fibp = acp->slotp->fibp; in aac_handle_adapter_config_issues()
2768 aac_sync_fib_slot_release(softs, acp); in aac_handle_adapter_config_issues()
3106 struct aac_cmd *acp = &softs->sync_ac; in aac_sync_fib() local
3108 acp->flags = AAC_CMD_SYNC | AAC_CMD_IN_SYNC_SLOT; in aac_sync_fib()
3110 acp->flags |= AAC_CMD_NO_CB; in aac_sync_fib()
3112 acp->flags |= AAC_CMD_NO_INTR; in aac_sync_fib()
3114 acp->ac_comp = aac_sync_complete; in aac_sync_fib()
3115 acp->timeout = AAC_SYNC_TIMEOUT; in aac_sync_fib()
3116 acp->fib_size = fibsize; in aac_sync_fib()
3122 aac_cmd_fib_header(softs, acp, cmd); in aac_sync_fib()
3124 (void) ddi_dma_sync(acp->slotp->fib_dma_handle, 0, fibsize, in aac_sync_fib()
3127 aac_start_io(softs, acp); in aac_sync_fib()
3130 return (aac_do_sync_io(softs, acp)); in aac_sync_fib()
3132 return (aac_do_poll_io(softs, acp)); in aac_sync_fib()
3148 struct aac_cmd *acp; in aac_cmd_dequeue() local
3152 if ((acp = q->q_head) != NULL) { in aac_cmd_dequeue()
3153 if ((q->q_head = acp->next) != NULL) in aac_cmd_dequeue()
3154 acp->next = NULL; in aac_cmd_dequeue()
3157 acp->prev = NULL; in aac_cmd_dequeue()
3159 return (acp); in aac_cmd_dequeue()
3166 aac_cmd_enqueue(struct aac_cmd_queue *q, struct aac_cmd *acp) in aac_cmd_enqueue() argument
3168 ASSERT(acp->next == NULL); in aac_cmd_enqueue()
3169 acp->prev = q->q_tail; in aac_cmd_enqueue()
3170 q->q_tail->next = acp; in aac_cmd_enqueue()
3171 q->q_tail = acp; in aac_cmd_enqueue()
3178 aac_cmd_delete(struct aac_cmd_queue *q, struct aac_cmd *acp) in aac_cmd_delete() argument
3180 if (acp->prev) { in aac_cmd_delete()
3181 if ((acp->prev->next = acp->next) != NULL) { in aac_cmd_delete()
3182 acp->next->prev = acp->prev; in aac_cmd_delete()
3183 acp->next = NULL; in aac_cmd_delete()
3185 q->q_tail = acp->prev; in aac_cmd_delete()
3187 acp->prev = NULL; in aac_cmd_delete()
4278 aac_abort_iocmd(struct aac_softstate *softs, struct aac_cmd *acp, in aac_abort_iocmd() argument
4281 acp->flags |= AAC_CMD_ABORT; in aac_abort_iocmd()
4283 if (acp->pkt) { in aac_abort_iocmd()
4284 if (acp->slotp) { /* outstanding cmd */ in aac_abort_iocmd()
4285 acp->pkt->pkt_state |= STATE_GOT_STATUS; in aac_abort_iocmd()
4291 acp); in aac_abort_iocmd()
4292 aac_set_pkt_reason(softs, acp, CMD_TIMEOUT, in aac_abort_iocmd()
4297 AACDB_PRINT(softs, CE_NOTE, "CMD_RESET: acp=0x%p", acp); in aac_abort_iocmd()
4298 aac_set_pkt_reason(softs, acp, CMD_RESET, in aac_abort_iocmd()
4303 acp); in aac_abort_iocmd()
4304 aac_set_pkt_reason(softs, acp, CMD_ABORTED, in aac_abort_iocmd()
4309 aac_end_io(softs, acp); in aac_abort_iocmd()
4320 struct aac_cmd *ac_arg, *acp; in aac_abort_iocmds() local
4337 struct aac_cmd *acp; in aac_abort_iocmds() local
4343 while ((acp = softs->q_busy.q_head) != NULL) in aac_abort_iocmds()
4344 aac_abort_iocmd(softs, acp, reason); in aac_abort_iocmds()
4353 while ((acp = softs->q_wait[i].q_head) != NULL) in aac_abort_iocmds()
4354 aac_abort_iocmd(softs, acp, reason); in aac_abort_iocmds()
4716 aac_free_dmamap(struct aac_cmd *acp) in aac_free_dmamap() argument
4719 if (acp->flags & AAC_CMD_DMA_VALID) { in aac_free_dmamap()
4720 ASSERT(acp->buf_dma_handle); in aac_free_dmamap()
4721 (void) ddi_dma_unbind_handle(acp->buf_dma_handle); in aac_free_dmamap()
4722 acp->flags &= ~AAC_CMD_DMA_VALID; in aac_free_dmamap()
4725 if (acp->abp != NULL) { /* free non-aligned buf DMA */ in aac_free_dmamap()
4726 ASSERT(acp->buf_dma_handle); in aac_free_dmamap()
4727 if ((acp->flags & AAC_CMD_BUF_WRITE) == 0 && acp->bp) in aac_free_dmamap()
4728 ddi_rep_get8(acp->abh, (uint8_t *)acp->bp->b_un.b_addr, in aac_free_dmamap()
4729 (uint8_t *)acp->abp, acp->bp->b_bcount, in aac_free_dmamap()
4731 ddi_dma_mem_free(&acp->abh); in aac_free_dmamap()
4732 acp->abp = NULL; in aac_free_dmamap()
4735 if (acp->buf_dma_handle) { in aac_free_dmamap()
4736 ddi_dma_free_handle(&acp->buf_dma_handle); in aac_free_dmamap()
4737 acp->buf_dma_handle = NULL; in aac_free_dmamap()
4742 aac_unknown_scmd(struct aac_softstate *softs, struct aac_cmd *acp) in aac_unknown_scmd() argument
4745 ((union scsi_cdb *)(void *)acp->pkt->pkt_cdbp)->scc_cmd); in aac_unknown_scmd()
4746 aac_free_dmamap(acp); in aac_unknown_scmd()
4747 aac_set_arq_data(acp->pkt, KEY_ILLEGAL_REQUEST, 0x20, 0x00, 0); in aac_unknown_scmd()
4748 aac_soft_callback(softs, acp); in aac_unknown_scmd()
4755 aac_tran_start_ld(struct aac_softstate *softs, struct aac_cmd *acp) in aac_tran_start_ld() argument
4763 dvp = (struct aac_container *)acp->dvp; in aac_tran_start_ld()
4764 pkt = acp->pkt; in aac_tran_start_ld()
4766 bp = acp->bp; in aac_tran_start_ld()
4770 aac_free_dmamap(acp); in aac_tran_start_ld()
4772 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4790 aac_free_dmamap(acp); in aac_tran_start_ld()
4796 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4811 aac_free_dmamap(acp); in aac_tran_start_ld()
4818 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4820 aac_unknown_scmd(softs, acp); in aac_tran_start_ld()
4829 acp->blkno = ((uint64_t) \ in aac_tran_start_ld()
4835 aac_unknown_scmd(softs, acp); in aac_tran_start_ld()
4841 acp->blkno = GETG0ADDR(cdbp); in aac_tran_start_ld()
4846 acp->blkno = GETG5ADDR(cdbp); in aac_tran_start_ld()
4851 acp->blkno = (uint32_t)GETG1ADDR(cdbp); in aac_tran_start_ld()
4853 if (acp->flags & AAC_CMD_DMA_VALID) { in aac_tran_start_ld()
4862 if ((acp->blkno < cnt_size) && in aac_tran_start_ld()
4863 ((acp->blkno + acp->bcount / in aac_tran_start_ld()
4865 rval = aac_do_io(softs, acp); in aac_tran_start_ld()
4875 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4878 } else if (acp->bcount == 0) { in aac_tran_start_ld()
4880 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4891 aac_free_dmamap(acp); in aac_tran_start_ld()
4897 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4904 acp->aac_cmd_fib = aac_cmd_fib_startstop; in aac_tran_start_ld()
4905 acp->ac_comp = aac_startstop_complete; in aac_tran_start_ld()
4906 rval = aac_do_io(softs, acp); in aac_tran_start_ld()
4913 aac_free_dmamap(acp); in aac_tran_start_ld()
4915 if (acp->flags & AAC_CMD_BUF_READ) { in aac_tran_start_ld()
4922 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4927 acp->flags |= AAC_CMD_NTAG; in aac_tran_start_ld()
4928 acp->aac_cmd_fib = aac_cmd_fib_sync; in aac_tran_start_ld()
4929 acp->ac_comp = aac_synccache_complete; in aac_tran_start_ld()
4930 rval = aac_do_io(softs, acp); in aac_tran_start_ld()
4934 aac_free_dmamap(acp); in aac_tran_start_ld()
4936 aac_soft_callback(softs, acp); in aac_tran_start_ld()
4941 aac_unknown_scmd(softs, acp); in aac_tran_start_ld()
4953 struct aac_cmd *acp = PKT2AC(pkt); in aac_tran_start() local
4954 struct aac_device *dvp = acp->dvp; in aac_tran_start()
4963 acp->flags &= AAC_CMD_CONSISTENT | AAC_CMD_DMA_PARTIAL | \ in aac_tran_start()
4965 acp->timeout = acp->pkt->pkt_time; in aac_tran_start()
4967 acp->flags |= AAC_CMD_NO_INTR; in aac_tran_start()
4969 acp->fib_flags = AACDB_FLAGS_FIB_SCMD; in aac_tran_start()
4976 if (acp->flags & AAC_CMD_DMA_VALID) { in aac_tran_start()
4977 pkt->pkt_resid = acp->bcount; in aac_tran_start()
4979 if ((acp->flags & AAC_CMD_CONSISTENT) && in aac_tran_start()
4980 (acp->flags & AAC_CMD_BUF_WRITE)) in aac_tran_start()
4981 if (aac_dma_sync_ac(acp) != AACOK) { in aac_tran_start()
4991 AACDB_PRINT_SCMD(softs, acp); in aac_tran_start()
4996 rval = aac_tran_start_ld(softs, acp); in aac_tran_start()
5000 rval = aac_do_io(softs, acp); in aac_tran_start()
5119 struct aac_cmd *acp = PKT2AC(pkt); in aac_tran_destroy_pkt() local
5123 if (acp->sgt) { in aac_tran_destroy_pkt()
5124 kmem_free(acp->sgt, sizeof (struct aac_sge) * \ in aac_tran_destroy_pkt()
5125 acp->left_cookien); in aac_tran_destroy_pkt()
5127 aac_free_dmamap(acp); in aac_tran_destroy_pkt()
5128 ASSERT(acp->slotp == NULL); in aac_tran_destroy_pkt()
5133 aac_cmd_dma_alloc(struct aac_softstate *softs, struct aac_cmd *acp, in aac_cmd_dma_alloc() argument
5141 oldcookiec = acp->left_cookien; in aac_cmd_dma_alloc()
5144 if (acp->total_nwin > 0) { in aac_cmd_dma_alloc()
5145 if (++acp->cur_win < acp->total_nwin) { in aac_cmd_dma_alloc()
5149 rval = ddi_dma_getwin(acp->buf_dma_handle, acp->cur_win, in aac_cmd_dma_alloc()
5150 &off, &len, &acp->cookie, &acp->left_cookien); in aac_cmd_dma_alloc()
5162 if (bp && bp->b_bcount != 0 && !(acp->flags & AAC_CMD_DMA_VALID)) { in aac_cmd_dma_alloc()
5170 acp->bp = bp; in aac_cmd_dma_alloc()
5175 acp->flags |= AAC_CMD_BUF_READ; in aac_cmd_dma_alloc()
5178 acp->flags |= AAC_CMD_BUF_WRITE; in aac_cmd_dma_alloc()
5186 if (!acp->buf_dma_handle) { in aac_cmd_dma_alloc()
5189 &acp->buf_dma_handle); in aac_cmd_dma_alloc()
5200 rval = ddi_dma_buf_bind_handle(acp->buf_dma_handle, in aac_cmd_dma_alloc()
5201 bp, dma_flags, cb, arg, &acp->cookie, in aac_cmd_dma_alloc()
5202 &acp->left_cookien); in aac_cmd_dma_alloc()
5212 rval = ddi_dma_mem_alloc(acp->buf_dma_handle, in aac_cmd_dma_alloc()
5215 cb, arg, &acp->abp, &bufsz, &acp->abh); in aac_cmd_dma_alloc()
5224 if (acp->flags & AAC_CMD_BUF_WRITE) in aac_cmd_dma_alloc()
5225 ddi_rep_put8(acp->abh, in aac_cmd_dma_alloc()
5227 (uint8_t *)acp->abp, bp->b_bcount, in aac_cmd_dma_alloc()
5230 rval = ddi_dma_addr_bind_handle(acp->buf_dma_handle, in aac_cmd_dma_alloc()
5231 NULL, acp->abp, bufsz, dma_flags, cb, arg, in aac_cmd_dma_alloc()
5232 &acp->cookie, &acp->left_cookien); in aac_cmd_dma_alloc()
5237 if (ddi_dma_numwin(acp->buf_dma_handle, in aac_cmd_dma_alloc()
5238 &acp->total_nwin) == DDI_FAILURE) { in aac_cmd_dma_alloc()
5245 acp->left_cookien); in aac_cmd_dma_alloc()
5246 acp->cur_win = 0; in aac_cmd_dma_alloc()
5251 acp->left_cookien); in aac_cmd_dma_alloc()
5252 acp->cur_win = 0; in aac_cmd_dma_alloc()
5253 acp->total_nwin = 1; in aac_cmd_dma_alloc()
5279 acp->flags |= AAC_CMD_DMA_VALID; in aac_cmd_dma_alloc()
5282 ASSERT(acp->left_cookien > 0); in aac_cmd_dma_alloc()
5283 if (acp->left_cookien > softs->aac_sg_tablesize) { in aac_cmd_dma_alloc()
5285 acp->left_cookien); in aac_cmd_dma_alloc()
5289 if (oldcookiec != acp->left_cookien && acp->sgt != NULL) { in aac_cmd_dma_alloc()
5290 kmem_free(acp->sgt, sizeof (struct aac_sge) * \ in aac_cmd_dma_alloc()
5292 acp->sgt = NULL; in aac_cmd_dma_alloc()
5294 if (acp->sgt == NULL) { in aac_cmd_dma_alloc()
5295 acp->sgt = kmem_alloc(sizeof (struct aac_sge) * \ in aac_cmd_dma_alloc()
5296 acp->left_cookien, kf); in aac_cmd_dma_alloc()
5297 if (acp->sgt == NULL) { in aac_cmd_dma_alloc()
5305 sge = &acp->sgt[0]; in aac_cmd_dma_alloc()
5306 sge->bcount = acp->cookie.dmac_size; in aac_cmd_dma_alloc()
5307 sge->addr.ad64.lo = AAC_LS32(acp->cookie.dmac_laddress); in aac_cmd_dma_alloc()
5308 sge->addr.ad64.hi = AAC_MS32(acp->cookie.dmac_laddress); in aac_cmd_dma_alloc()
5309 acp->bcount = acp->cookie.dmac_size; in aac_cmd_dma_alloc()
5310 for (sge++; sge < &acp->sgt[acp->left_cookien]; sge++) { in aac_cmd_dma_alloc()
5311 ddi_dma_nextcookie(acp->buf_dma_handle, &acp->cookie); in aac_cmd_dma_alloc()
5312 sge->bcount = acp->cookie.dmac_size; in aac_cmd_dma_alloc()
5313 sge->addr.ad64.lo = AAC_LS32(acp->cookie.dmac_laddress); in aac_cmd_dma_alloc()
5314 sge->addr.ad64.hi = AAC_MS32(acp->cookie.dmac_laddress); in aac_cmd_dma_alloc()
5315 acp->bcount += acp->cookie.dmac_size; in aac_cmd_dma_alloc()
5323 if (acp->bcount > softs->buf_dma_attr.dma_attr_maxxfer) { in aac_cmd_dma_alloc()
5325 "large xfer size received %d\n", acp->bcount); in aac_cmd_dma_alloc()
5330 acp->total_xfer += acp->bcount; in aac_cmd_dma_alloc()
5332 if (acp->pkt) { in aac_cmd_dma_alloc()
5334 if (acp->total_xfer <= bp->b_bcount) { in aac_cmd_dma_alloc()
5335 acp->pkt->pkt_resid = bp->b_bcount - \ in aac_cmd_dma_alloc()
5336 acp->total_xfer; in aac_cmd_dma_alloc()
5344 acp->pkt->pkt_resid = 0; in aac_cmd_dma_alloc()
5348 (void *)bp->b_un.b_addr, (int)acp->total_xfer, in aac_cmd_dma_alloc()
5349 (int)bp->b_bcount, (int)acp->pkt->pkt_resid); in aac_cmd_dma_alloc()
5365 struct aac_cmd *acp, *new_acp; in aac_tran_init_pkt() local
5381 acp = new_acp = PKT2AC(pkt); in aac_tran_init_pkt()
5382 acp->pkt = pkt; in aac_tran_init_pkt()
5383 acp->cmdlen = cmdlen; in aac_tran_init_pkt()
5386 acp->dvp = &softs->containers[ap->a_target].dev; in aac_tran_init_pkt()
5387 acp->aac_cmd_fib = softs->aac_cmd_fib; in aac_tran_init_pkt()
5388 acp->ac_comp = aac_ld_complete; in aac_tran_init_pkt()
5392 acp->dvp = &softs->nondasds[AAC_PD(ap->a_target)].dev; in aac_tran_init_pkt()
5393 acp->aac_cmd_fib = softs->aac_cmd_fib_scsi; in aac_tran_init_pkt()
5394 acp->ac_comp = aac_pd_complete; in aac_tran_init_pkt()
5397 acp = PKT2AC(pkt); in aac_tran_init_pkt()
5401 if (aac_cmd_dma_alloc(softs, acp, bp, flags, callback, arg) == AACOK) in aac_tran_init_pkt()
5416 struct aac_cmd *acp = PKT2AC(pkt); in aac_tran_sync_pkt() local
5420 if (aac_dma_sync_ac(acp) != AACOK) in aac_tran_sync_pkt()
5433 struct aac_cmd *acp = PKT2AC(pkt); in aac_tran_dmafree() local
5437 aac_free_dmamap(acp); in aac_tran_dmafree()
5552 aac_cmd_fib_header(struct aac_softstate *softs, struct aac_cmd *acp, in aac_cmd_fib_header() argument
5555 struct aac_slot *slotp = acp->slotp; in aac_cmd_fib_header()
5569 if (!(acp->flags & AAC_CMD_SYNC)) in aac_cmd_fib_header()
5576 ddi_put16(acc, &fibp->Header.Size, acp->fib_size); in aac_cmd_fib_header()
5587 aac_cmd_fib_rawio(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_rawio() argument
5589 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_rawio()
5590 struct aac_raw_io *io = (struct aac_raw_io *)&acp->slotp->fibp->data[0]; in aac_cmd_fib_rawio()
5595 acp->fib_size = sizeof (struct aac_fib_header) + \ in aac_cmd_fib_rawio()
5596 sizeof (struct aac_raw_io) + (acp->left_cookien - 1) * \ in aac_cmd_fib_rawio()
5599 aac_cmd_fib_header(softs, acp, RawIo); in aac_cmd_fib_rawio()
5601 ddi_put16(acc, &io->Flags, (acp->flags & AAC_CMD_BUF_READ) ? 1 : 0); in aac_cmd_fib_rawio()
5605 ddi_put32(acc, AAC_LO32(&io->BlockNumber), AAC_LS32(acp->blkno)); in aac_cmd_fib_rawio()
5606 ddi_put32(acc, AAC_HI32(&io->BlockNumber), AAC_MS32(acp->blkno)); in aac_cmd_fib_rawio()
5608 ((struct aac_container *)acp->dvp)->cid); in aac_cmd_fib_rawio()
5611 ddi_put32(acc, &io->SgMapRaw.SgCount, acp->left_cookien); in aac_cmd_fib_rawio()
5612 ddi_put32(acc, &io->ByteCount, acp->bcount); in aac_cmd_fib_rawio()
5614 for (sge = &acp->sgt[0], sgp = &io->SgMapRaw.SgEntryRaw[0]; in aac_cmd_fib_rawio()
5615 sge < &acp->sgt[acp->left_cookien]; sge++, sgp++) { in aac_cmd_fib_rawio()
5627 aac_cmd_fib_brw64(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_brw64() argument
5629 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_brw64()
5631 &acp->slotp->fibp->data[0]; in aac_cmd_fib_brw64()
5635 acp->fib_size = sizeof (struct aac_fib_header) + \ in aac_cmd_fib_brw64()
5636 sizeof (struct aac_blockread64) + (acp->left_cookien - 1) * \ in aac_cmd_fib_brw64()
5639 aac_cmd_fib_header(softs, acp, ContainerCommand64); in aac_cmd_fib_brw64()
5645 ddi_put32(acc, &br->BlockNumber, (uint32_t)acp->blkno); in aac_cmd_fib_brw64()
5647 ((struct aac_container *)acp->dvp)->cid); in aac_cmd_fib_brw64()
5648 ddi_put32(acc, &br->Command, (acp->flags & AAC_CMD_BUF_READ) ? in aac_cmd_fib_brw64()
5654 ddi_put32(acc, &br->SgMap64.SgCount, acp->left_cookien); in aac_cmd_fib_brw64()
5655 ddi_put16(acc, &br->SectorCount, acp->bcount / AAC_BLK_SIZE); in aac_cmd_fib_brw64()
5657 for (sge = &acp->sgt[0], sgp = &br->SgMap64.SgEntry64[0]; in aac_cmd_fib_brw64()
5658 sge < &acp->sgt[acp->left_cookien]; sge++, sgp++) { in aac_cmd_fib_brw64()
5667 aac_cmd_fib_brw(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_brw() argument
5669 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_brw()
5671 &acp->slotp->fibp->data[0]; in aac_cmd_fib_brw()
5673 struct aac_sge *sge = &acp->sgt[0]; in aac_cmd_fib_brw()
5675 if (acp->flags & AAC_CMD_BUF_READ) { in aac_cmd_fib_brw()
5676 acp->fib_size = sizeof (struct aac_fib_header) + \ in aac_cmd_fib_brw()
5677 sizeof (struct aac_blockread) + (acp->left_cookien - 1) * \ in aac_cmd_fib_brw()
5681 ddi_put32(acc, &br->SgMap.SgCount, acp->left_cookien); in aac_cmd_fib_brw()
5686 acp->fib_size = sizeof (struct aac_fib_header) + \ in aac_cmd_fib_brw()
5687 sizeof (struct aac_blockwrite) + (acp->left_cookien - 1) * \ in aac_cmd_fib_brw()
5692 ddi_put32(acc, &bw->SgMap.SgCount, acp->left_cookien); in aac_cmd_fib_brw()
5695 aac_cmd_fib_header(softs, acp, ContainerCommand); in aac_cmd_fib_brw()
5701 ddi_put32(acc, &br->BlockNumber, (uint32_t)acp->blkno); in aac_cmd_fib_brw()
5703 ((struct aac_container *)acp->dvp)->cid); in aac_cmd_fib_brw()
5704 ddi_put32(acc, &br->ByteCount, acp->bcount); in aac_cmd_fib_brw()
5707 for (sge = &acp->sgt[0]; in aac_cmd_fib_brw()
5708 sge < &acp->sgt[acp->left_cookien]; sge++, sgp++) { in aac_cmd_fib_brw()
5716 aac_cmd_fib_copy(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_copy() argument
5718 struct aac_slot *slotp = acp->slotp; in aac_cmd_fib_copy()
5722 ddi_rep_put8(acc, (uint8_t *)acp->fibp, (uint8_t *)fibp, in aac_cmd_fib_copy()
5723 acp->fib_size, /* only copy data of needed length */ in aac_cmd_fib_copy()
5730 aac_cmd_fib_sync(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_sync() argument
5732 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_sync()
5734 (struct aac_synchronize_command *)&acp->slotp->fibp->data[0]; in aac_cmd_fib_sync()
5736 acp->fib_size = AAC_FIB_SIZEOF(struct aac_synchronize_command); in aac_cmd_fib_sync()
5738 aac_cmd_fib_header(softs, acp, ContainerCommand); in aac_cmd_fib_sync()
5741 ddi_put32(acc, &sync->Cid, ((struct aac_container *)acp->dvp)->cid); in aac_cmd_fib_sync()
5750 aac_cmd_fib_startstop(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_startstop() argument
5752 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_startstop()
5754 (struct aac_Container *)&acp->slotp->fibp->data[0]; in aac_cmd_fib_startstop()
5755 union scsi_cdb *cdbp = (void *)acp->pkt->pkt_cdbp; in aac_cmd_fib_startstop()
5757 acp->fib_size = AAC_FIB_SIZEOF(struct aac_Container); in aac_cmd_fib_startstop()
5759 aac_cmd_fib_header(softs, acp, ContainerCommand); in aac_cmd_fib_startstop()
5766 ((struct aac_container *)acp->dvp)->cid); in aac_cmd_fib_startstop()
5774 aac_cmd_fib_srb(struct aac_cmd *acp) in aac_cmd_fib_srb() argument
5776 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_srb()
5777 struct aac_srb *srb = (struct aac_srb *)&acp->slotp->fibp->data[0]; in aac_cmd_fib_srb()
5782 ddi_put32(acc, &srb->cdb_size, acp->cmdlen); in aac_cmd_fib_srb()
5784 if (acp->fibp == NULL) { in aac_cmd_fib_srb()
5785 if (acp->flags & AAC_CMD_BUF_READ) in aac_cmd_fib_srb()
5787 else if (acp->flags & AAC_CMD_BUF_WRITE) in aac_cmd_fib_srb()
5790 ((struct aac_nondasd *)acp->dvp)->bus); in aac_cmd_fib_srb()
5791 ddi_put32(acc, &srb->id, ((struct aac_nondasd *)acp->dvp)->tid); in aac_cmd_fib_srb()
5793 cdb = acp->pkt->pkt_cdbp; in aac_cmd_fib_srb()
5795 struct aac_srb *srb0 = (struct aac_srb *)&acp->fibp->data[0]; in aac_cmd_fib_srb()
5803 ddi_rep_put8(acc, cdb, srb->cdb, acp->cmdlen, DDI_DEV_AUTOINCR); in aac_cmd_fib_srb()
5807 aac_cmd_fib_scsi32(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_scsi32() argument
5809 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_scsi32()
5810 struct aac_srb *srb = (struct aac_srb *)&acp->slotp->fibp->data[0]; in aac_cmd_fib_scsi32()
5814 acp->fib_size = sizeof (struct aac_fib_header) + \ in aac_cmd_fib_scsi32()
5816 acp->left_cookien * sizeof (struct aac_sg_entry); in aac_cmd_fib_scsi32()
5819 aac_cmd_fib_header(softs, acp, ScsiPortCommand); in aac_cmd_fib_scsi32()
5820 aac_cmd_fib_srb(acp); in aac_cmd_fib_scsi32()
5823 ddi_put32(acc, &srb->sg.SgCount, acp->left_cookien); in aac_cmd_fib_scsi32()
5824 ddi_put32(acc, &srb->count, acp->bcount); in aac_cmd_fib_scsi32()
5826 for (sge = &acp->sgt[0], sgp = &srb->sg.SgEntry[0]; in aac_cmd_fib_scsi32()
5827 sge < &acp->sgt[acp->left_cookien]; sge++, sgp++) { in aac_cmd_fib_scsi32()
5834 aac_cmd_fib_scsi64(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_fib_scsi64() argument
5836 ddi_acc_handle_t acc = acp->slotp->fib_acc_handle; in aac_cmd_fib_scsi64()
5837 struct aac_srb *srb = (struct aac_srb *)&acp->slotp->fibp->data[0]; in aac_cmd_fib_scsi64()
5841 acp->fib_size = sizeof (struct aac_fib_header) + \ in aac_cmd_fib_scsi64()
5843 acp->left_cookien * sizeof (struct aac_sg_entry64); in aac_cmd_fib_scsi64()
5846 aac_cmd_fib_header(softs, acp, ScsiPortCommandU64); in aac_cmd_fib_scsi64()
5847 aac_cmd_fib_srb(acp); in aac_cmd_fib_scsi64()
5850 ddi_put32(acc, &srb->sg.SgCount, acp->left_cookien); in aac_cmd_fib_scsi64()
5851 ddi_put32(acc, &srb->count, acp->bcount); in aac_cmd_fib_scsi64()
5853 for (sge = &acp->sgt[0], in aac_cmd_fib_scsi64()
5855 sge < &acp->sgt[acp->left_cookien]; sge++, sgp++) { in aac_cmd_fib_scsi64()
5863 aac_cmd_slot_bind(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_slot_bind() argument
5868 acp->slotp = slotp; in aac_cmd_slot_bind()
5869 slotp->acp = acp; in aac_cmd_slot_bind()
5870 acp->aac_cmd_fib(softs, acp); in aac_cmd_slot_bind()
5879 aac_bind_io(struct aac_softstate *softs, struct aac_cmd *acp) in aac_bind_io() argument
5881 struct aac_device *dvp = acp->dvp; in aac_bind_io()
5882 int q = AAC_CMDQ(acp); in aac_bind_io()
5887 if (!(acp->flags & AAC_CMD_NTAG) || in aac_bind_io()
5889 return (aac_cmd_slot_bind(softs, acp)); in aac_bind_io()
5896 return (aac_cmd_slot_bind(softs, acp)); in aac_bind_io()
5903 aac_sync_fib_slot_bind(struct aac_softstate *softs, struct aac_cmd *acp) in aac_sync_fib_slot_bind() argument
5911 ASSERT(acp->slotp == NULL); in aac_sync_fib_slot_bind()
5913 acp->slotp = slotp; in aac_sync_fib_slot_bind()
5914 slotp->acp = acp; in aac_sync_fib_slot_bind()
5921 aac_sync_fib_slot_release(struct aac_softstate *softs, struct aac_cmd *acp) in aac_sync_fib_slot_release() argument
5923 ASSERT(acp->slotp); in aac_sync_fib_slot_release()
5925 aac_release_slot(softs, acp->slotp); in aac_sync_fib_slot_release()
5926 acp->slotp->acp = NULL; in aac_sync_fib_slot_release()
5927 acp->slotp = NULL; in aac_sync_fib_slot_release()
5933 aac_start_io(struct aac_softstate *softs, struct aac_cmd *acp) in aac_start_io() argument
5935 struct aac_slot *slotp = acp->slotp; in aac_start_io()
5936 int q = AAC_CMDQ(acp); in aac_start_io()
5940 if (acp->pkt) { /* ac from ioctl has no pkt */ in aac_start_io()
5941 acp->pkt->pkt_state |= in aac_start_io()
5944 if (acp->timeout) /* 0 indicates no timeout */ in aac_start_io()
5945 acp->timeout += aac_timebase + aac_tick; in aac_start_io()
5947 if (acp->dvp) in aac_start_io()
5948 acp->dvp->ncmds[q]++; in aac_start_io()
5950 aac_cmd_enqueue(&softs->q_busy, acp); in aac_start_io()
5962 slotp->fib_phyaddr, acp->fib_size); in aac_start_io()
5974 if (acp->pkt) { in aac_start_io()
5975 acp->pkt->pkt_state &= ~STATE_SENT_CMD; in aac_start_io()
5976 aac_set_pkt_reason(softs, acp, CMD_INCOMPLETE, 0); in aac_start_io()
5978 aac_end_io(softs, acp); in aac_start_io()
5979 if (!(acp->flags & (AAC_CMD_NO_INTR | AAC_CMD_NO_CB))) in aac_start_io()
5987 struct aac_cmd *acp, *next_acp; in aac_start_waitq() local
5990 for (acp = q->q_head; acp; acp = next_acp) { in aac_start_waitq()
5991 next_acp = acp->next; in aac_start_waitq()
5992 if (aac_bind_io(softs, acp) == AACOK) { in aac_start_waitq()
5993 aac_cmd_delete(q, acp); in aac_start_waitq()
5994 aac_start_io(softs, acp); in aac_start_waitq()
6017 struct aac_cmd *acp; in aac_drain_comp_q() local
6023 acp = aac_cmd_dequeue(&softs->q_comp); in aac_drain_comp_q()
6025 if (acp != NULL) { in aac_drain_comp_q()
6026 ASSERT(acp->pkt != NULL); in aac_drain_comp_q()
6027 pkt = acp->pkt; in aac_drain_comp_q()
6033 if ((acp->flags & AAC_CMD_CONSISTENT) && in aac_drain_comp_q()
6034 (acp->flags & AAC_CMD_BUF_READ)) { in aac_drain_comp_q()
6035 if (aac_dma_sync_ac(acp) != AACOK) { in aac_drain_comp_q()
6237 slotp->acp = NULL; in aac_release_slot()
6243 aac_do_io(struct aac_softstate *softs, struct aac_cmd *acp) in aac_do_io() argument
6245 if (aac_bind_io(softs, acp) == AACOK) in aac_do_io()
6246 aac_start_io(softs, acp); in aac_do_io()
6248 aac_cmd_enqueue(&softs->q_wait[AAC_CMDQ(acp)], acp); in aac_do_io()
6250 if (!(acp->flags & (AAC_CMD_NO_CB | AAC_CMD_NO_INTR))) in aac_do_io()
6256 if (acp->flags & AAC_CMD_NO_INTR) { in aac_do_io()
6257 if (aac_do_poll_io(softs, acp) == AACOK) in aac_do_io()
6260 if (aac_do_sync_io(softs, acp) == AACOK) in aac_do_io()
6267 aac_do_poll_io(struct aac_softstate *softs, struct aac_cmd *acp) in aac_do_poll_io() argument
6276 while (!(acp->flags & (AAC_CMD_CMPLT | AAC_CMD_ABORT))) { in aac_do_poll_io()
6281 aac_cmd_timeout(softs, acp); in aac_do_poll_io()
6286 if ((acp->flags & AAC_CMD_CMPLT) && !(acp->flags & AAC_CMD_ERR)) in aac_do_poll_io()
6292 aac_do_sync_io(struct aac_softstate *softs, struct aac_cmd *acp) in aac_do_sync_io() argument
6294 ASSERT(softs && acp); in aac_do_sync_io()
6296 while (!(acp->flags & (AAC_CMD_CMPLT | AAC_CMD_ABORT))) in aac_do_sync_io()
6299 if (acp->flags & AAC_CMD_CMPLT) in aac_do_sync_io()
6305 aac_dma_sync_ac(struct aac_cmd *acp) in aac_dma_sync_ac() argument
6307 if (acp->buf_dma_handle) { in aac_dma_sync_ac()
6308 if (acp->flags & AAC_CMD_BUF_WRITE) { in aac_dma_sync_ac()
6309 if (acp->abp != NULL) in aac_dma_sync_ac()
6310 ddi_rep_put8(acp->abh, in aac_dma_sync_ac()
6311 (uint8_t *)acp->bp->b_un.b_addr, in aac_dma_sync_ac()
6312 (uint8_t *)acp->abp, acp->bp->b_bcount, in aac_dma_sync_ac()
6314 (void) ddi_dma_sync(acp->buf_dma_handle, 0, 0, in aac_dma_sync_ac()
6317 (void) ddi_dma_sync(acp->buf_dma_handle, 0, 0, in aac_dma_sync_ac()
6319 if (aac_check_dma_handle(acp->buf_dma_handle) != in aac_dma_sync_ac()
6322 if (acp->abp != NULL) in aac_dma_sync_ac()
6323 ddi_rep_get8(acp->abh, in aac_dma_sync_ac()
6324 (uint8_t *)acp->bp->b_un.b_addr, in aac_dma_sync_ac()
6325 (uint8_t *)acp->abp, acp->bp->b_bcount, in aac_dma_sync_ac()
6583 aac_cmd_timeout(struct aac_softstate *softs, struct aac_cmd *acp) in aac_cmd_timeout() argument
6586 acp->fib_flags |= AACDB_FLAGS_FIB_TIMEOUT; in aac_cmd_timeout()
6587 AACDB_PRINT(softs, CE_WARN, "acp %p timed out", acp); in aac_cmd_timeout()
6588 AACDB_PRINT_FIB(softs, acp->slotp); in aac_cmd_timeout()
6669 struct aac_cmd *acp; in aac_daemon() local
6672 for (acp = softs->q_busy.q_head; acp; acp = acp->next) { in aac_daemon()
6673 if (acp->timeout == 0) in aac_daemon()
6681 acp->timeout += time_adjust; in aac_daemon()
6685 if (acp->timeout <= softs_timebase) { in aac_daemon()
6686 aac_cmd_timeout(softs, acp); in aac_daemon()
8163 aac_print_scmd(struct aac_softstate *softs, struct aac_cmd *acp) in aac_print_scmd() argument
8165 struct scsi_pkt *pkt = acp->pkt; in aac_print_scmd()
8177 ctl = ((struct aac_nondasd *)acp->dvp)->bus; in aac_print_scmd()
8178 tgt = ((struct aac_nondasd *)acp->dvp)->tid; in aac_print_scmd()
8196 (acp->flags & AAC_CMD_NO_INTR) ? "poll" : "intr", in aac_print_scmd()
8204 (acp->flags & AAC_CMD_NO_INTR) ? "poll" : "intr", in aac_print_scmd()
8213 (acp->flags & AAC_CMD_NO_INTR) ? "poll" : "intr", in aac_print_scmd()
8221 (acp->flags & AAC_CMD_NO_INTR) ? "poll" : "intr", in aac_print_scmd()
8233 struct aac_cmd *acp = slotp->acp; in aac_print_fib() local
8242 if (acp) { in aac_print_fib()
8243 if (!(softs->debug_fib_flags & acp->fib_flags)) in aac_print_fib()
8245 if (acp->fib_flags & AACDB_FLAGS_FIB_SCMD) in aac_print_fib()
8247 else if (acp->fib_flags & AACDB_FLAGS_FIB_IOCTL) in aac_print_fib()
8249 else if (acp->fib_flags & AACDB_FLAGS_FIB_SRB) in aac_print_fib()