Skip to content

Commit

Permalink
vcsm: use dma APIs for cache functions
Browse files Browse the repository at this point in the history
* Will handle multi-platform builds
  • Loading branch information
invisiblek authored and popcornmix committed Oct 6, 2017
1 parent 88f6deb commit 9367c44
Showing 1 changed file with 16 additions and 29 deletions.
45 changes: 16 additions & 29 deletions drivers/char/broadcom/vc_sm/vmcs_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,34 +218,6 @@ static const char *const sm_cache_map_vector[] = {
};
#endif

typedef void cache_flush_op_fn(const void *, const void *);

#if defined(CONFIG_CPU_CACHE_V7)
extern cache_flush_op_fn v7_dma_inv_range;
extern cache_flush_op_fn v7_dma_clean_range;
extern cache_flush_op_fn v7_dma_flush_range;
static cache_flush_op_fn * const flushops[4] =
{
0,
v7_dma_inv_range,
v7_dma_clean_range,
v7_dma_flush_range,
};
#elif defined(CONFIG_CPU_CACHE_V6)
extern cache_flush_op_fn v6_dma_inv_range;
extern cache_flush_op_fn v6_dma_clean_range;
extern cache_flush_op_fn v6_dma_flush_range;
static cache_flush_op_fn * const flushops[4] =
{
0,
v6_dma_inv_range,
v6_dma_clean_range,
v6_dma_flush_range,
};
#else
#error Unknown cache config
#endif

/* ---- Private Function Prototypes -------------------------------------- */

/* ---- Private Functions ------------------------------------------------ */
Expand Down Expand Up @@ -3028,7 +3000,22 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)

for (i = 0; i < ioparam.op_count; i++) {
const struct vmcs_sm_ioctl_clean_invalid_block * const op = block + i;
cache_flush_op_fn * const op_fn = flushops[op->invalidate_mode & 3];
void (*op_fn)(const void *, const void *);

switch(op->invalidate_mode & 3) {
case VCSM_CACHE_OP_INV:
op_fn = dmac_inv_range;
break;
case VCSM_CACHE_OP_CLEAN:
op_fn = dmac_clean_range;
break;
case VCSM_CACHE_OP_FLUSH:
op_fn = dmac_flush_range;
break;
default:
op_fn = 0;
break;
}

if ((op->invalidate_mode & ~3) != 0) {
ret = -EINVAL;
Expand Down

0 comments on commit 9367c44

Please sign in to comment.