diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2018-04-18 15:59:00 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-06-15 20:47:31 -0400 |
commit | 2a2c16af5f9f1ccfc93a13e820d5381e5c881e92 (patch) | |
tree | 2e5d7b042270a649978e5bb540857012c85fb5b5 /drivers/gpu/nvgpu/common/linux/io.c | |
parent | 98d996f4ffb0137d119b5849cae46d7b7e5693e1 (diff) |
gpu: nvgpu: Move Linux files away from common
Move all Linux source code files to drivers/gpu/nvgpu/os/linux from
drivers/gpu/nvgpu/common/linux. This changes the meaning of common
to be OS independent.
JIRA NVGPU-598
JIRA NVGPU-601
Change-Id: Ib7f2a43d3688bb0d0b7dcc48469a6783fd988ce9
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1747714
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/io.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/io.c | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/io.c b/drivers/gpu/nvgpu/common/linux/io.c deleted file mode 100644 index c06512a5..00000000 --- a/drivers/gpu/nvgpu/common/linux/io.c +++ /dev/null | |||
@@ -1,118 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017-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 | |||
14 | #include <nvgpu/io.h> | ||
15 | #include <nvgpu/types.h> | ||
16 | |||
17 | #include "os_linux.h" | ||
18 | #include "gk20a/gk20a.h" | ||
19 | |||
20 | void nvgpu_writel(struct gk20a *g, u32 r, u32 v) | ||
21 | { | ||
22 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
23 | |||
24 | if (unlikely(!l->regs)) { | ||
25 | __gk20a_warn_on_no_regs(); | ||
26 | nvgpu_log(g, gpu_dbg_reg, "r=0x%x v=0x%x (failed)", r, v); | ||
27 | } else { | ||
28 | writel_relaxed(v, l->regs + r); | ||
29 | nvgpu_wmb(); | ||
30 | nvgpu_log(g, gpu_dbg_reg, "r=0x%x v=0x%x", r, v); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | u32 nvgpu_readl(struct gk20a *g, u32 r) | ||
35 | { | ||
36 | u32 v = __nvgpu_readl(g, r); | ||
37 | |||
38 | if (v == 0xffffffff) | ||
39 | __nvgpu_check_gpu_state(g); | ||
40 | |||
41 | return v; | ||
42 | } | ||
43 | |||
44 | u32 __nvgpu_readl(struct gk20a *g, u32 r) | ||
45 | { | ||
46 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
47 | u32 v = 0xffffffff; | ||
48 | |||
49 | if (unlikely(!l->regs)) { | ||
50 | __gk20a_warn_on_no_regs(); | ||
51 | nvgpu_log(g, gpu_dbg_reg, "r=0x%x v=0x%x (failed)", r, v); | ||
52 | } else { | ||
53 | v = readl(l->regs + r); | ||
54 | nvgpu_log(g, gpu_dbg_reg, "r=0x%x v=0x%x", r, v); | ||
55 | } | ||
56 | |||
57 | return v; | ||
58 | } | ||
59 | |||
60 | void nvgpu_writel_check(struct gk20a *g, u32 r, u32 v) | ||
61 | { | ||
62 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
63 | |||
64 | if (unlikely(!l->regs)) { | ||
65 | __gk20a_warn_on_no_regs(); | ||
66 | nvgpu_log(g, gpu_dbg_reg, "r=0x%x v=0x%x (failed)", r, v); | ||
67 | } else { | ||
68 | nvgpu_wmb(); | ||
69 | do { | ||
70 | writel_relaxed(v, l->regs + r); | ||
71 | } while (readl(l->regs + r) != v); | ||
72 | nvgpu_log(g, gpu_dbg_reg, "r=0x%x v=0x%x", r, v); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | void nvgpu_bar1_writel(struct gk20a *g, u32 b, u32 v) | ||
77 | { | ||
78 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
79 | |||
80 | if (unlikely(!l->bar1)) { | ||
81 | __gk20a_warn_on_no_regs(); | ||
82 | nvgpu_log(g, gpu_dbg_reg, "b=0x%x v=0x%x (failed)", b, v); | ||
83 | } else { | ||
84 | nvgpu_wmb(); | ||
85 | writel_relaxed(v, l->bar1 + b); | ||
86 | nvgpu_log(g, gpu_dbg_reg, "b=0x%x v=0x%x", b, v); | ||
87 | } | ||
88 | } | ||
89 | |||
90 | u32 nvgpu_bar1_readl(struct gk20a *g, u32 b) | ||
91 | { | ||
92 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
93 | u32 v = 0xffffffff; | ||
94 | |||
95 | if (unlikely(!l->bar1)) { | ||
96 | __gk20a_warn_on_no_regs(); | ||
97 | nvgpu_log(g, gpu_dbg_reg, "b=0x%x v=0x%x (failed)", b, v); | ||
98 | } else { | ||
99 | v = readl(l->bar1 + b); | ||
100 | nvgpu_log(g, gpu_dbg_reg, "b=0x%x v=0x%x", b, v); | ||
101 | } | ||
102 | |||
103 | return v; | ||
104 | } | ||
105 | |||
106 | bool nvgpu_io_exists(struct gk20a *g) | ||
107 | { | ||
108 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
109 | |||
110 | return l->regs != NULL; | ||
111 | } | ||
112 | |||
113 | bool nvgpu_io_valid_reg(struct gk20a *g, u32 r) | ||
114 | { | ||
115 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
116 | |||
117 | return r < resource_size(l->regs); | ||
118 | } | ||