61 bp = in_bp;
62
63 /* we are establishing a new buffer memory association */
64 bp->b_flags &= ~(B_PAGEIO | B_PHYS | B_REMAPPED | B_SHADOW);
65 bp->b_proc = NULL;
66 bp->b_pages = NULL;
67 bp->b_shadow = NULL;
68 }
69
70 /* limit bits that can be set by bflags argument */
71 ASSERT(!(bflags & ~(B_READ | B_WRITE)));
72 bflags &= (B_READ | B_WRITE);
73 bp->b_un.b_addr = 0;
74
75 if (datalen) {
76 pdip = (A_TO_TRAN(ap))->tran_hba_dip;
77
78 /*
79 * use i_ddi_mem_alloc() for now until we have an interface to
80 * allocate memory for DMA which doesn't require a DMA handle.
81 * ddi_iopb_alloc() is obsolete and we want more flexibility in
82 * controlling the DMA address constraints.
83 */
84 while (i_ddi_mem_alloc(pdip, &scsi_alloc_attr, datalen,
85 ((callback == SLEEP_FUNC) ? 1 : 0), 0, NULL,
86 &bp->b_un.b_addr, &rlen, NULL) != DDI_SUCCESS) {
87 if (callback == SLEEP_FUNC) {
88 delay(drv_usectohz(10000));
89 } else {
90 if (!in_bp)
91 freerbuf(bp);
92 goto no_resource;
93 }
94 }
95 bp->b_flags |= bflags;
96 }
97 bp->b_bcount = datalen;
98 bp->b_resid = 0;
99
100 TRACE_0(TR_FAC_SCSI_RES, TR_SCSI_ALLOC_CONSISTENT_BUF_END,
101 "scsi_alloc_consistent_buf_end");
102 return (bp);
|
61 bp = in_bp;
62
63 /* we are establishing a new buffer memory association */
64 bp->b_flags &= ~(B_PAGEIO | B_PHYS | B_REMAPPED | B_SHADOW);
65 bp->b_proc = NULL;
66 bp->b_pages = NULL;
67 bp->b_shadow = NULL;
68 }
69
70 /* limit bits that can be set by bflags argument */
71 ASSERT(!(bflags & ~(B_READ | B_WRITE)));
72 bflags &= (B_READ | B_WRITE);
73 bp->b_un.b_addr = 0;
74
75 if (datalen) {
76 pdip = (A_TO_TRAN(ap))->tran_hba_dip;
77
78 /*
79 * use i_ddi_mem_alloc() for now until we have an interface to
80 * allocate memory for DMA which doesn't require a DMA handle.
81 */
82 while (i_ddi_mem_alloc(pdip, &scsi_alloc_attr, datalen,
83 ((callback == SLEEP_FUNC) ? 1 : 0), 0, NULL,
84 &bp->b_un.b_addr, &rlen, NULL) != DDI_SUCCESS) {
85 if (callback == SLEEP_FUNC) {
86 delay(drv_usectohz(10000));
87 } else {
88 if (!in_bp)
89 freerbuf(bp);
90 goto no_resource;
91 }
92 }
93 bp->b_flags |= bflags;
94 }
95 bp->b_bcount = datalen;
96 bp->b_resid = 0;
97
98 TRACE_0(TR_FAC_SCSI_RES, TR_SCSI_ALLOC_CONSISTENT_BUF_END,
99 "scsi_alloc_consistent_buf_end");
100 return (bp);
|