Lines Matching refs:dmb
216 static void ism_free_dmb(struct ism_dev *ism, struct smcd_dmb *dmb) in ism_free_dmb() argument
218 clear_bit(dmb->sba_idx, ism->sba_bitmap); in ism_free_dmb()
219 dma_free_coherent(&ism->pdev->dev, dmb->dmb_len, in ism_free_dmb()
220 dmb->cpu_addr, dmb->dma_addr); in ism_free_dmb()
223 static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb) in ism_alloc_dmb() argument
227 if (PAGE_ALIGN(dmb->dmb_len) > dma_get_max_seg_size(&ism->pdev->dev)) in ism_alloc_dmb()
230 if (!dmb->sba_idx) { in ism_alloc_dmb()
236 dmb->sba_idx = bit; in ism_alloc_dmb()
238 if (dmb->sba_idx < ISM_DMB_BIT_OFFSET || in ism_alloc_dmb()
239 test_and_set_bit(dmb->sba_idx, ism->sba_bitmap)) in ism_alloc_dmb()
242 dmb->cpu_addr = dma_alloc_coherent(&ism->pdev->dev, dmb->dmb_len, in ism_alloc_dmb()
243 &dmb->dma_addr, in ism_alloc_dmb()
245 if (!dmb->cpu_addr) in ism_alloc_dmb()
246 clear_bit(dmb->sba_idx, ism->sba_bitmap); in ism_alloc_dmb()
248 return dmb->cpu_addr ? 0 : -ENOMEM; in ism_alloc_dmb()
251 static int ism_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb) in ism_register_dmb() argument
257 ret = ism_alloc_dmb(ism, dmb); in ism_register_dmb()
265 cmd.request.dmb = dmb->dma_addr; in ism_register_dmb()
266 cmd.request.dmb_len = dmb->dmb_len; in ism_register_dmb()
267 cmd.request.sba_idx = dmb->sba_idx; in ism_register_dmb()
268 cmd.request.vlan_valid = dmb->vlan_valid; in ism_register_dmb()
269 cmd.request.vlan_id = dmb->vlan_id; in ism_register_dmb()
270 cmd.request.rgid = dmb->rgid; in ism_register_dmb()
274 ism_free_dmb(ism, dmb); in ism_register_dmb()
277 dmb->dmb_tok = cmd.response.dmb_tok; in ism_register_dmb()
282 static int ism_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb) in ism_unregister_dmb() argument
292 cmd.request.dmb_tok = dmb->dmb_tok; in ism_unregister_dmb()
298 ism_free_dmb(ism, dmb); in ism_unregister_dmb()