#include "dev.h"
#include "class_ids.h"
#include "chip_support.h"
-#include "nvhost_memmgr.h"
#include "nvhost_job.h"
#include "host1x_cdma.h"
static int push_buffer_init(struct push_buffer *pb)
{
struct nvhost_cdma *cdma = pb_to_cdma(pb);
- struct mem_mgr *mgr = cdma_to_memmgr(cdma);
int err = 0;
- pb->mem = NULL;
pb->mapped = NULL;
- pb->phys = 0;
+ pb->dma_addr = 0;
pb->client_handle = NULL;
cdma_pb_op().reset(pb);
- /* allocate and map pushbuffer memory */
- pb->mem = nvhost_memmgr_alloc(mgr, PUSH_BUFFER_SIZE + 4, 32,
- mem_mgr_flag_write_combine, 0);
- if (IS_ERR(pb->mem)) {
- err = PTR_ERR(pb->mem);
- pb->mem = NULL;
- goto fail;
- }
- pb->mapped = nvhost_memmgr_mmap(pb->mem);
+ /* allocate the pushbuffer memory */
+ pb->mapped = dma_alloc_writecombine(&cdma_to_dev(cdma)->dev->dev,
+ PUSH_BUFFER_SIZE + 4,
+ &pb->dma_addr,
+ GFP_KERNEL);
if (!pb->mapped) {
err = -ENOMEM;
pb->mapped = NULL;
goto fail;
}
- /* pin pushbuffer and get physical address */
- pb->sgt = nvhost_memmgr_pin(mgr, pb->mem,
- &cdma_to_dev(cdma)->dev->dev, mem_flag_none);
- if (IS_ERR(pb->sgt)) {
- err = PTR_ERR(pb->sgt);
- pb->sgt = 0;
- goto fail;
- }
- pb->phys = nvhost_memmgr_dma_addr(pb->sgt);
-
/* memory for storing nvmap client and handles for each opcode pair */
pb->client_handle = kzalloc(NVHOST_GATHER_QUEUE_SIZE *
sizeof(struct mem_mgr_handle),
/* put the restart at the end of pushbuffer memory */
*(pb->mapped + (PUSH_BUFFER_SIZE >> 2)) =
- nvhost_opcode_restart(pb->phys);
+ nvhost_opcode_restart(pb->dma_addr);
return 0;
static void push_buffer_destroy(struct push_buffer *pb)
{
struct nvhost_cdma *cdma = pb_to_cdma(pb);
- struct mem_mgr *mgr = cdma_to_memmgr(cdma);
if (pb->mapped)
- nvhost_memmgr_munmap(pb->mem, pb->mapped);
-
- if (pb->phys != 0)
- nvhost_memmgr_unpin(mgr, pb->mem,
- &cdma_to_dev(cdma)->dev->dev, pb->sgt);
-
- if (pb->mem)
- nvhost_memmgr_put(mgr, pb->mem);
+ dma_free_writecombine(&cdma_to_dev(cdma)->dev->dev,
+ PUSH_BUFFER_SIZE + 4,
+ pb->mapped,
+ pb->dma_addr);
kfree(pb->client_handle);
- pb->mem = NULL;
pb->mapped = NULL;
- pb->phys = 0;
+ pb->dma_addr = 0;
pb->client_handle = 0;
}
static u32 push_buffer_putptr(struct push_buffer *pb)
{
- return pb->phys + pb->cur;
+ return pb->dma_addr + pb->cur;
}
/*
u32 getidx;
/* NOP all the PB slots */
- getidx = getptr - pb->phys;
+ getidx = getptr - pb->dma_addr;
while (nr_slots--) {
u32 *p = (u32 *)((uintptr_t)pb->mapped + getidx);
*(p++) = NVHOST_OPCODE_NOOP;
*(p++) = NVHOST_OPCODE_NOOP;
dev_dbg(&dev->dev->dev, "%s: NOP at 0x%llx\n",
- __func__, (u64)(pb->phys + getidx));
+ __func__, (u64)(pb->dma_addr + getidx));
getidx = (getidx + 8) & (PUSH_BUFFER_SIZE - 1);
}
wmb();