summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/sim.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/sim.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/sim.c95
1 files changed, 0 insertions, 95 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/sim.c b/drivers/gpu/nvgpu/common/linux/sim.c
deleted file mode 100644
index 8e964f39..00000000
--- a/drivers/gpu/nvgpu/common/linux/sim.c
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/io.h>
18#include <linux/highmem.h>
19#include <linux/platform_device.h>
20
21#include <nvgpu/log.h>
22#include <nvgpu/linux/vm.h>
23#include <nvgpu/bitops.h>
24#include <nvgpu/nvgpu_mem.h>
25#include <nvgpu/dma.h>
26#include <nvgpu/soc.h>
27#include <nvgpu/hw_sim.h>
28#include <nvgpu/sim.h>
29#include "gk20a/gk20a.h"
30#include "platform_gk20a.h"
31#include "os_linux.h"
32#include "module.h"
33
34void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v)
35{
36 struct sim_nvgpu_linux *sim_linux =
37 container_of(sim, struct sim_nvgpu_linux, sim);
38
39 writel(v, sim_linux->regs + r);
40}
41
42u32 sim_readl(struct sim_nvgpu *sim, u32 r)
43{
44 struct sim_nvgpu_linux *sim_linux =
45 container_of(sim, struct sim_nvgpu_linux, sim);
46
47 return readl(sim_linux->regs + r);
48}
49
50void nvgpu_remove_sim_support_linux(struct gk20a *g)
51{
52 struct sim_nvgpu_linux *sim_linux;
53
54 if (!g->sim)
55 return;
56
57 sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim);
58 if (sim_linux->regs) {
59 sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v());
60 iounmap(sim_linux->regs);
61 sim_linux->regs = NULL;
62 }
63 nvgpu_kfree(g, sim_linux);
64 g->sim = NULL;
65}
66
67int nvgpu_init_sim_support_linux(struct gk20a *g,
68 struct platform_device *dev)
69{
70 struct sim_nvgpu_linux *sim_linux;
71 int err = -ENOMEM;
72
73 if (!nvgpu_platform_is_simulation(g))
74 return 0;
75
76 sim_linux = nvgpu_kzalloc(g, sizeof(*sim_linux));
77 if (!sim_linux)
78 return err;
79 g->sim = &sim_linux->sim;
80 g->sim->g = g;
81 sim_linux->regs = nvgpu_ioremap_resource(dev,
82 GK20A_SIM_IORESOURCE_MEM,
83 &sim_linux->reg_mem);
84 if (IS_ERR(sim_linux->regs)) {
85 nvgpu_err(g, "failed to remap gk20a sim regs");
86 err = PTR_ERR(sim_linux->regs);
87 goto fail;
88 }
89 sim_linux->remove_support_linux = nvgpu_remove_sim_support_linux;
90 return 0;
91
92fail:
93 nvgpu_remove_sim_support_linux(g);
94 return err;
95}