Print this page
4888 Undocument dma_req(9s)
4884 EOF scsi_hba_attach
4886 EOF ddi_dmae_getlim
4887 EOF ddi_iomin
4634 undocument scsi_hba_attach() and ddi_dma_lim(9s)
4630 clean stale references to ddi_iopb_alloc and ddi_iopb_free


 326  * Common iopbmap data area packet allocation routines
 327  */
 328 
 329 struct scsi_pkt *
 330 get_pktiopb(struct scsi_address *ap, caddr_t *datap, int cdblen, int statuslen,
 331     int datalen, int readflag, int (*func)())
 332 {
 333         scsi_hba_tran_t *tran = A_TO_TRAN(ap);
 334         dev_info_t      *pdip = tran->tran_hba_dip;
 335         struct scsi_pkt *pkt = NULL;
 336         struct buf      local;
 337         size_t          rlen;
 338 
 339         if (!datap)
 340                 return (pkt);
 341         *datap = (caddr_t)0;
 342         bzero((caddr_t)&local, sizeof (struct buf));
 343 
 344         /*
 345          * use i_ddi_mem_alloc() for now until we have an interface to allocate
 346          * memory for DMA which doesn't require a DMA handle. ddi_iopb_alloc()
 347          * is obsolete and we want more flexibility in controlling the DMA
 348          * address constraints.
 349          */
 350         if (i_ddi_mem_alloc(pdip, &scsi_alloc_attr, datalen,
 351             ((func == SLEEP_FUNC) ? 1 : 0), 0, NULL, &local.b_un.b_addr, &rlen,
 352             NULL) != DDI_SUCCESS) {
 353                 return (pkt);
 354         }
 355         if (readflag)
 356                 local.b_flags = B_READ;
 357         local.b_bcount = datalen;
 358         pkt = (*tran->tran_init_pkt) (ap, NULL, &local,
 359             cdblen, statuslen, 0, PKT_CONSISTENT,
 360             (func == SLEEP_FUNC) ? SLEEP_FUNC : NULL_FUNC, NULL);
 361         if (!pkt) {
 362                 i_ddi_mem_free(local.b_un.b_addr, NULL);
 363                 if (func != NULL_FUNC) {
 364                         ddi_set_callback(func, NULL, &scsi_callback_id);
 365                 }
 366         } else {
 367                 *datap = local.b_un.b_addr;
 368         }




 326  * Common iopbmap data area packet allocation routines
 327  */
 328 
 329 struct scsi_pkt *
 330 get_pktiopb(struct scsi_address *ap, caddr_t *datap, int cdblen, int statuslen,
 331     int datalen, int readflag, int (*func)())
 332 {
 333         scsi_hba_tran_t *tran = A_TO_TRAN(ap);
 334         dev_info_t      *pdip = tran->tran_hba_dip;
 335         struct scsi_pkt *pkt = NULL;
 336         struct buf      local;
 337         size_t          rlen;
 338 
 339         if (!datap)
 340                 return (pkt);
 341         *datap = (caddr_t)0;
 342         bzero((caddr_t)&local, sizeof (struct buf));
 343 
 344         /*
 345          * use i_ddi_mem_alloc() for now until we have an interface to allocate
 346          * memory for DMA which doesn't require a DMA handle.


 347          */
 348         if (i_ddi_mem_alloc(pdip, &scsi_alloc_attr, datalen,
 349             ((func == SLEEP_FUNC) ? 1 : 0), 0, NULL, &local.b_un.b_addr, &rlen,
 350             NULL) != DDI_SUCCESS) {
 351                 return (pkt);
 352         }
 353         if (readflag)
 354                 local.b_flags = B_READ;
 355         local.b_bcount = datalen;
 356         pkt = (*tran->tran_init_pkt) (ap, NULL, &local,
 357             cdblen, statuslen, 0, PKT_CONSISTENT,
 358             (func == SLEEP_FUNC) ? SLEEP_FUNC : NULL_FUNC, NULL);
 359         if (!pkt) {
 360                 i_ddi_mem_free(local.b_un.b_addr, NULL);
 361                 if (func != NULL_FUNC) {
 362                         ddi_set_callback(func, NULL, &scsi_callback_id);
 363                 }
 364         } else {
 365                 *datap = local.b_un.b_addr;
 366         }