summaryrefslogtreecommitdiff
path: root/drivers/video/tegra/host/host1x
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2012-05-31 15:04:53 +0300
committerSimone Willett <swillett@nvidia.com>2012-06-11 16:27:55 -0700
commitb08927a712005ae3f6941e59f530b7896ac5f407 (patch)
treec6a974f266565dec2b7d619a67d2e9a61677e553 /drivers/video/tegra/host/host1x
parent273ceab50c24ba53fcc7a90072dd02d1038d2a97 (diff)
video: tegra: host: Abstract nvmap support
Abstract nvmap support to one file, and use it via function pointers from other parts of nvhost. Bug 965206 Change-Id: I4e5e7de4271e0797d117ac8210af4732b6018973 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/105665 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/host/host1x')
-rw-r--r--drivers/video/tegra/host/host1x/host1x_cdma.c43
-rw-r--r--drivers/video/tegra/host/host1x/host1x_cdma.h1
-rw-r--r--drivers/video/tegra/host/host1x/host1x_channel.c8
-rw-r--r--drivers/video/tegra/host/host1x/host1x_debug.c18
-rw-r--r--drivers/video/tegra/host/host1x/host1x_hwctx.h4
-rw-r--r--drivers/video/tegra/host/host1x/host1x_intr.c1
6 files changed, 40 insertions, 35 deletions
diff --git a/drivers/video/tegra/host/host1x/host1x_cdma.c b/drivers/video/tegra/host/host1x/host1x_cdma.c
index 4569c3d62494..00289fc6d980 100644
--- a/drivers/video/tegra/host/host1x/host1x_cdma.c
+++ b/drivers/video/tegra/host/host1x/host1x_cdma.c
@@ -23,6 +23,8 @@
#include "nvhost_cdma.h"
#include "nvhost_channel.h"
#include "dev.h"
+#include "chip_support.h"
+#include "nvhost_memmgr.h"
#include "host1x_hardware.h"
#include "host1x_syncpt.h"
@@ -62,38 +64,38 @@ static void push_buffer_reset(struct push_buffer *pb)
static int push_buffer_init(struct push_buffer *pb)
{
struct nvhost_cdma *cdma = pb_to_cdma(pb);
- struct nvmap_client *nvmap = cdma_to_nvmap(cdma);
+ struct mem_mgr *mgr = cdma_to_memmgr(cdma);
pb->mem = NULL;
pb->mapped = NULL;
pb->phys = 0;
- pb->nvmap = NULL;
+ pb->client_handle = NULL;
BUG_ON(!cdma_pb_op().reset);
cdma_pb_op().reset(pb);
/* allocate and map pushbuffer memory */
- pb->mem = nvmap_alloc(nvmap, PUSH_BUFFER_SIZE + 4, 32,
- NVMAP_HANDLE_WRITE_COMBINE, 0);
+ pb->mem = mem_op().alloc(mgr, PUSH_BUFFER_SIZE + 4, 32,
+ mem_mgr_flag_write_combine);
if (IS_ERR_OR_NULL(pb->mem)) {
pb->mem = NULL;
goto fail;
}
- pb->mapped = nvmap_mmap(pb->mem);
+ pb->mapped = mem_op().mmap(pb->mem);
if (pb->mapped == NULL)
goto fail;
/* pin pushbuffer and get physical address */
- pb->phys = nvmap_pin(nvmap, pb->mem);
+ pb->phys = mem_op().pin(mgr, pb->mem);
if (pb->phys >= 0xfffff000) {
pb->phys = 0;
goto fail;
}
/* memory for storing nvmap client and handles for each opcode pair */
- pb->nvmap = kzalloc(NVHOST_GATHER_QUEUE_SIZE *
- sizeof(struct nvmap_client_handle),
+ pb->client_handle = kzalloc(NVHOST_GATHER_QUEUE_SIZE *
+ sizeof(struct mem_mgr_handle),
GFP_KERNEL);
- if (!pb->nvmap)
+ if (!pb->client_handle)
goto fail;
/* put the restart at the end of pushbuffer memory */
@@ -113,22 +115,22 @@ fail:
static void push_buffer_destroy(struct push_buffer *pb)
{
struct nvhost_cdma *cdma = pb_to_cdma(pb);
- struct nvmap_client *nvmap = cdma_to_nvmap(cdma);
+ struct mem_mgr *mgr = cdma_to_memmgr(cdma);
if (pb->mapped)
- nvmap_munmap(pb->mem, pb->mapped);
+ mem_op().munmap(pb->mem, pb->mapped);
if (pb->phys != 0)
- nvmap_unpin(nvmap, pb->mem);
+ mem_op().unpin(mgr, pb->mem);
if (pb->mem)
- nvmap_free(nvmap, pb->mem);
+ mem_op().put(mgr, pb->mem);
- kfree(pb->nvmap);
+ kfree(pb->client_handle);
pb->mem = NULL;
pb->mapped = NULL;
pb->phys = 0;
- pb->nvmap = 0;
+ pb->client_handle = 0;
}
/**
@@ -136,8 +138,8 @@ static void push_buffer_destroy(struct push_buffer *pb)
* Caller must ensure push buffer is not full
*/
static void push_buffer_push_to(struct push_buffer *pb,
- struct nvmap_client *client,
- struct nvmap_handle_ref *handle, u32 op1, u32 op2)
+ struct mem_mgr *client, struct mem_handle *handle,
+ u32 op1, u32 op2)
{
u32 cur = pb->cur;
u32 *p = (u32 *)((u32)pb->mapped + cur);
@@ -145,8 +147,8 @@ static void push_buffer_push_to(struct push_buffer *pb,
BUG_ON(cur == pb->fence);
*(p++) = op1;
*(p++) = op2;
- pb->nvmap[cur_nvmap].client = client;
- pb->nvmap[cur_nvmap].handle = handle;
+ pb->client_handle[cur_nvmap].client = client;
+ pb->client_handle[cur_nvmap].handle = handle;
pb->cur = (cur + 8) & (PUSH_BUFFER_SIZE - 1);
}
@@ -163,8 +165,7 @@ static void push_buffer_pop_from(struct push_buffer *pb,
for (i = 0; i < slots; i++) {
int cur_fence_nvmap = (fence_nvmap+i)
& (NVHOST_GATHER_QUEUE_SIZE - 1);
- struct nvmap_client_handle *h =
- &pb->nvmap[cur_fence_nvmap];
+ struct mem_mgr_handle *h = &pb->client_handle[cur_fence_nvmap];
h->client = NULL;
h->handle = NULL;
}
diff --git a/drivers/video/tegra/host/host1x/host1x_cdma.h b/drivers/video/tegra/host/host1x/host1x_cdma.h
index 374097272d3f..9c533d6a5154 100644
--- a/drivers/video/tegra/host/host1x/host1x_cdma.h
+++ b/drivers/video/tegra/host/host1x/host1x_cdma.h
@@ -36,6 +36,7 @@
* and replaces the original timed out contexts GATHER slots */
#define SYNCPT_INCR_BUFFER_SIZE_WORDS (4096 / sizeof(u32))
+struct nvhost_chip_support;
int host1x_init_cdma_support(struct nvhost_chip_support *);
#endif
diff --git a/drivers/video/tegra/host/host1x/host1x_channel.c b/drivers/video/tegra/host/host1x/host1x_channel.c
index c72e6478b806..4b167a3753a1 100644
--- a/drivers/video/tegra/host/host1x/host1x_channel.c
+++ b/drivers/video/tegra/host/host1x/host1x_channel.c
@@ -142,7 +142,7 @@ static void submit_ctxrestore(struct nvhost_job *job)
/* Send restore buffer to channel */
nvhost_cdma_push_gather(&ch->cdma,
- host->nvmap,
+ host->memmgr,
ctx->restore,
0,
nvhost_opcode_gather(ctx->restore_size),
@@ -187,7 +187,7 @@ void submit_gathers(struct nvhost_job *job)
u32 op1 = nvhost_opcode_gather(job->gathers[i].words);
u32 op2 = job->gathers[i].mem;
nvhost_cdma_push_gather(&job->ch->cdma,
- job->nvmap,
+ job->memmgr,
job->gathers[i].ref,
job->gathers[i].offset,
op1, op2);
@@ -329,7 +329,7 @@ int host1x_channel_read_3d_reg(
job = nvhost_job_alloc(channel, hwctx,
NULL,
- nvhost_get_host(channel->dev)->nvmap, 0, 0);
+ nvhost_get_host(channel->dev)->memmgr, 0, 0);
if (!job) {
err = -ENOMEM;
goto done;
@@ -555,7 +555,7 @@ int host1x_save_context(struct nvhost_device *dev, u32 syncpt_id)
job = nvhost_job_alloc(ch, hwctx_to_save,
NULL,
- nvhost_get_host(ch->dev)->nvmap, 0, 0);
+ nvhost_get_host(ch->dev)->memmgr, 0, 0);
if (IS_ERR_OR_NULL(job)) {
err = PTR_ERR(job);
mutex_unlock(&ch->submitlock);
diff --git a/drivers/video/tegra/host/host1x/host1x_debug.c b/drivers/video/tegra/host/host1x/host1x_debug.c
index 7de342298c4d..3b14aeeae153 100644
--- a/drivers/video/tegra/host/host1x/host1x_debug.c
+++ b/drivers/video/tegra/host/host1x/host1x_debug.c
@@ -30,6 +30,8 @@
#include "nvhost_channel.h"
#include "host1x_cdma.h"
#include "nvhost_job.h"
+#include "chip_support.h"
+#include "nvhost_memmgr.h"
#define NVHOST_DEBUG_MAX_PAGE_OFFSET 102400
@@ -196,7 +198,7 @@ static void show_channel_gather(struct output *o, u32 addr,
/* Map dmaget cursor to corresponding nvmap_handle */
struct push_buffer *pb = &cdma->push_buffer;
u32 cur = addr - pb->phys;
- struct nvmap_client_handle *nvmap = &pb->nvmap[cur/8];
+ struct mem_mgr_handle *nvmap = &pb->client_handle[cur/8];
u32 *map_addr, offset;
phys_addr_t pin_addr;
@@ -205,25 +207,25 @@ static void show_channel_gather(struct output *o, u32 addr,
return;
}
- map_addr = nvmap_mmap(nvmap->handle);
+ map_addr = mem_op().mmap(nvmap->handle);
if (!map_addr) {
nvhost_debug_output(o, "[could not mmap]\n");
return;
}
/* Get base address from nvmap */
- pin_addr = nvmap_pin(nvmap->client, nvmap->handle);
+ pin_addr = mem_op().pin(nvmap->client, nvmap->handle);
if (IS_ERR_VALUE(pin_addr)) {
nvhost_debug_output(o, "[couldn't pin]\n");
- nvmap_munmap(nvmap->handle, map_addr);
+ mem_op().munmap(nvmap->handle, map_addr);
return;
}
offset = phys_addr - pin_addr;
do_show_channel_gather(o, phys_addr, words, cdma,
pin_addr, map_addr);
- nvmap_unpin(nvmap->client, nvmap->handle);
- nvmap_munmap(nvmap->handle, map_addr);
+ mem_op().unpin(nvmap->client, nvmap->handle);
+ mem_op().munmap(nvmap->handle, map_addr);
#endif
}
@@ -256,7 +258,7 @@ void show_channel_gathers(struct output *o, struct nvhost_cdma *cdma)
for (i = 0; i < job->num_gathers; i++) {
struct nvhost_job_gather *g = &job->gathers[i];
- u32 *mapped = nvmap_mmap(g->ref);
+ u32 *mapped = mem_op().mmap(g->ref);
if (!mapped) {
nvhost_debug_output(o, "[could not mmap]\n");
continue;
@@ -267,7 +269,7 @@ void show_channel_gathers(struct output *o, struct nvhost_cdma *cdma)
do_show_channel_gather(o, g->mem + g->offset,
g->words, cdma, g->mem, mapped);
- nvmap_munmap(g->ref, mapped);
+ mem_op().munmap(g->ref, mapped);
}
}
}
diff --git a/drivers/video/tegra/host/host1x/host1x_hwctx.h b/drivers/video/tegra/host/host1x/host1x_hwctx.h
index b5046c461d9d..13f0071d1e33 100644
--- a/drivers/video/tegra/host/host1x/host1x_hwctx.h
+++ b/drivers/video/tegra/host/host1x/host1x_hwctx.h
@@ -41,7 +41,7 @@ struct host1x_hwctx {
u32 save_thresh;
u32 save_slots;
- struct nvmap_handle_ref *restore;
+ struct mem_handle *restore;
u32 *restore_virt;
phys_addr_t restore_phys;
u32 restore_size;
@@ -55,7 +55,7 @@ struct host1x_hwctx_handler {
u32 waitbase;
u32 restore_size;
u32 restore_incrs;
- struct nvmap_handle_ref *save_buf;
+ struct mem_handle *save_buf;
u32 save_incrs;
u32 save_thresh;
u32 save_slots;
diff --git a/drivers/video/tegra/host/host1x/host1x_intr.c b/drivers/video/tegra/host/host1x/host1x_intr.c
index 2b611faaa708..e8d1a81c49bb 100644
--- a/drivers/video/tegra/host/host1x/host1x_intr.c
+++ b/drivers/video/tegra/host/host1x/host1x_intr.c
@@ -27,6 +27,7 @@
#include "nvhost_intr.h"
#include "dev.h"
#include "host1x_hardware.h"
+#include "chip_support.h"
/*** HW host sync management ***/