1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright 2018-2020 Broadcom.
9 #include <linux/dma-mapping.h>
12 /* for userland buffer */
19 * sglist is of the following LE format
20 * [U32] num_sg = number of sg addresses (N)
21 * [U32] totalsize = totalsize of data being transferred in sglist
22 * [U32] size[0] = size of data in address0
23 * [U32] addr_l[0] = lower 32-bits of address0
24 * [U32] addr_h[0] = higher 32-bits of address0
26 * [U32] size[N-1] = size of data in addressN-1
27 * [U32] addr_l[N-1] = lower 32-bits of addressN-1
28 * [U32] addr_h[N-1] = higher 32-bits of addressN-1
31 #define SGLIST_NUM_SG 0
32 #define SGLIST_TOTALSIZE 1
33 #define SGLIST_VKDATA_START 2
35 int sglen
; /* Length (bytes) of sglist */
40 u32 size
; /* data size in bytes */
41 u64 address
; /* Pointer to data */
45 * Scatter-gather DMA buffer API.
47 * These functions provide a simple way to create a page list and a
48 * scatter-gather list from userspace address and map the memory
51 int bcm_vk_sg_alloc(struct device
*dev
,
52 struct bcm_vk_dma
*dma
,
54 struct _vk_data
*vkdata
,
57 int bcm_vk_sg_free(struct device
*dev
, struct bcm_vk_dma
*dma
, int num
,