diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/hal.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/hal.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/hal.c b/drivers/gpu/nvgpu/gk20a/hal.c new file mode 100644 index 00000000..13e6f374 --- /dev/null +++ b/drivers/gpu/nvgpu/gk20a/hal.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * NVIDIA GPU HAL interface. | ||
3 | * | ||
4 | * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
7 | * copy of this software and associated documentation files (the "Software"), | ||
8 | * to deal in the Software without restriction, including without limitation | ||
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
10 | * and/or sell copies of the Software, and to permit persons to whom the | ||
11 | * Software is furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | */ | ||
24 | |||
25 | #include "gk20a.h" | ||
26 | #include "hal.h" | ||
27 | #include "gm20b/hal_gm20b.h" | ||
28 | #include "gp10b/hal_gp10b.h" | ||
29 | #include "gp106/hal_gp106.h" | ||
30 | |||
31 | #ifdef CONFIG_TEGRA_19x_GPU | ||
32 | #include "nvgpu_gpuid_t19x.h" | ||
33 | #endif | ||
34 | |||
35 | #include <nvgpu/log.h> | ||
36 | |||
37 | int gpu_init_hal(struct gk20a *g) | ||
38 | { | ||
39 | u32 ver = g->params.gpu_arch + g->params.gpu_impl; | ||
40 | switch (ver) { | ||
41 | case GK20A_GPUID_GM20B: | ||
42 | case GK20A_GPUID_GM20B_B: | ||
43 | gk20a_dbg_info("gm20b detected"); | ||
44 | if (gm20b_init_hal(g)) | ||
45 | return -ENODEV; | ||
46 | break; | ||
47 | #if defined(CONFIG_ARCH_TEGRA_18x_SOC) | ||
48 | case NVGPU_GPUID_GP10B: | ||
49 | if (gp10b_init_hal(g)) | ||
50 | return -ENODEV; | ||
51 | break; | ||
52 | case NVGPU_GPUID_GP104: | ||
53 | case NVGPU_GPUID_GP106: | ||
54 | if (gp106_init_hal(g)) | ||
55 | return -ENODEV; | ||
56 | break; | ||
57 | #endif | ||
58 | #ifdef CONFIG_TEGRA_19x_GPU | ||
59 | case TEGRA_19x_GPUID: | ||
60 | if (TEGRA_19x_GPUID_HAL(g)) | ||
61 | return -ENODEV; | ||
62 | break; | ||
63 | case BIGGPU_19x_GPUID: | ||
64 | if (BIGGPU_19x_GPUID_HAL(g)) | ||
65 | return -ENODEV; | ||
66 | break; | ||
67 | |||
68 | #endif | ||
69 | default: | ||
70 | nvgpu_err(g, "no support for %x", ver); | ||
71 | return -ENODEV; | ||
72 | } | ||
73 | |||
74 | return 0; | ||
75 | } | ||