diff options
Diffstat (limited to 'include/os/linux/sim.c')
-rw-r--r-- | include/os/linux/sim.c | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/include/os/linux/sim.c b/include/os/linux/sim.c deleted file mode 100644 index 792ce80..0000000 --- a/include/os/linux/sim.c +++ /dev/null | |||
@@ -1,96 +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 <nvgpu/gk20a.h> | ||
30 | |||
31 | #include "platform_gk20a.h" | ||
32 | #include "os_linux.h" | ||
33 | #include "module.h" | ||
34 | |||
35 | void sim_writel(struct sim_nvgpu *sim, u32 r, u32 v) | ||
36 | { | ||
37 | struct sim_nvgpu_linux *sim_linux = | ||
38 | container_of(sim, struct sim_nvgpu_linux, sim); | ||
39 | |||
40 | writel(v, sim_linux->regs + r); | ||
41 | } | ||
42 | |||
43 | u32 sim_readl(struct sim_nvgpu *sim, u32 r) | ||
44 | { | ||
45 | struct sim_nvgpu_linux *sim_linux = | ||
46 | container_of(sim, struct sim_nvgpu_linux, sim); | ||
47 | |||
48 | return readl(sim_linux->regs + r); | ||
49 | } | ||
50 | |||
51 | void nvgpu_remove_sim_support_linux(struct gk20a *g) | ||
52 | { | ||
53 | struct sim_nvgpu_linux *sim_linux; | ||
54 | |||
55 | if (!g->sim) | ||
56 | return; | ||
57 | |||
58 | sim_linux = container_of(g->sim, struct sim_nvgpu_linux, sim); | ||
59 | if (sim_linux->regs) { | ||
60 | sim_writel(g->sim, sim_config_r(), sim_config_mode_disabled_v()); | ||
61 | iounmap(sim_linux->regs); | ||
62 | sim_linux->regs = NULL; | ||
63 | } | ||
64 | nvgpu_kfree(g, sim_linux); | ||
65 | g->sim = NULL; | ||
66 | } | ||
67 | |||
68 | int nvgpu_init_sim_support_linux(struct gk20a *g, | ||
69 | struct platform_device *dev) | ||
70 | { | ||
71 | struct sim_nvgpu_linux *sim_linux; | ||
72 | int err = -ENOMEM; | ||
73 | |||
74 | if (!nvgpu_platform_is_simulation(g)) | ||
75 | return 0; | ||
76 | |||
77 | sim_linux = nvgpu_kzalloc(g, sizeof(*sim_linux)); | ||
78 | if (!sim_linux) | ||
79 | return err; | ||
80 | g->sim = &sim_linux->sim; | ||
81 | g->sim->g = g; | ||
82 | sim_linux->regs = nvgpu_devm_ioremap_resource(dev, | ||
83 | GK20A_SIM_IORESOURCE_MEM, | ||
84 | &sim_linux->reg_mem); | ||
85 | if (IS_ERR(sim_linux->regs)) { | ||
86 | nvgpu_err(g, "failed to remap gk20a sim regs"); | ||
87 | err = PTR_ERR(sim_linux->regs); | ||
88 | goto fail; | ||
89 | } | ||
90 | sim_linux->remove_support_linux = nvgpu_remove_sim_support_linux; | ||
91 | return 0; | ||
92 | |||
93 | fail: | ||
94 | nvgpu_remove_sim_support_linux(g); | ||
95 | return err; | ||
96 | } | ||