diff options
author | Bo Yan <byan@nvidia.com> | 2014-04-14 15:03:27 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:09:38 -0400 |
commit | 9eb1f57ba2b7072c6c53ca9dc59b10a87d88db23 (patch) | |
tree | de095fcbae617e938064e45a96b4e176015fe773 /drivers/gpu/nvgpu/gm20b/fb_gm20b.c | |
parent | 2531751f53fc21bdeb0ece4af550ea1e8efb9653 (diff) |
gpu: nvgpu: Add GPU driver for GM20B
this moves GM20B driver to the new location
Change-Id: I5fde14e114a8db79738a4c61849912b1ae225fb5
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/fb_gm20b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/fb_gm20b.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c new file mode 100644 index 00000000..6df3d401 --- /dev/null +++ b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * GM20B GPC MMU | ||
3 | * | ||
4 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms and conditions of the GNU General Public License, | ||
8 | * version 2, as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
13 | * more details. | ||
14 | */ | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | #include "gk20a/gk20a.h" | ||
19 | #include "gk20a/kind_gk20a.h" | ||
20 | |||
21 | #include "hw_fb_gm20b.h" | ||
22 | #include "hw_top_gm20b.h" | ||
23 | #include "hw_gmmu_gm20b.h" | ||
24 | |||
25 | static void fb_gm20b_init_fs_state(struct gk20a *g) | ||
26 | { | ||
27 | gk20a_dbg_info("initialize gm20b fb"); | ||
28 | |||
29 | gk20a_writel(g, fb_fbhub_num_active_ltcs_r(), | ||
30 | g->ltc_count); | ||
31 | } | ||
32 | |||
33 | static void gm20b_init_uncompressed_kind_map(void) | ||
34 | { | ||
35 | gk20a_init_uncompressed_kind_map(); | ||
36 | |||
37 | gk20a_uc_kind_map[gmmu_pte_kind_s8_v()] = | ||
38 | gk20a_uc_kind_map[gmmu_pte_kind_s8_2s_v()] = | ||
39 | gmmu_pte_kind_s8_v(); | ||
40 | } | ||
41 | |||
42 | static bool gm20b_kind_supported(u8 k) | ||
43 | { | ||
44 | return (k >= gmmu_pte_kind_s8_v() && | ||
45 | k <= gmmu_pte_kind_s8_2s_v()); | ||
46 | } | ||
47 | |||
48 | static bool gm20b_kind_z(u8 k) | ||
49 | { | ||
50 | return (k >= gmmu_pte_kind_s8_v() && | ||
51 | k <= gmmu_pte_kind_s8_2s_v()); | ||
52 | } | ||
53 | |||
54 | static bool gm20b_kind_compressible(u8 k) | ||
55 | { | ||
56 | return (k >= gmmu_pte_kind_s8_v() && | ||
57 | k <= gmmu_pte_kind_s8_2s_v()); | ||
58 | } | ||
59 | |||
60 | static bool gm20b_kind_zbc(u8 k) | ||
61 | { | ||
62 | return (k >= gmmu_pte_kind_s8_v() && | ||
63 | k <= gmmu_pte_kind_s8_2s_v()); | ||
64 | } | ||
65 | |||
66 | void gm20b_init_kind_attr(void) | ||
67 | { | ||
68 | u16 k; | ||
69 | |||
70 | gk20a_init_kind_attr(); | ||
71 | |||
72 | for (k = 0; k < 256; k++) { | ||
73 | if (gm20b_kind_supported((u8)k)) | ||
74 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_SUPPORTED; | ||
75 | if (gm20b_kind_compressible((u8)k)) | ||
76 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_COMPRESSIBLE; | ||
77 | if (gm20b_kind_z((u8)k)) | ||
78 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_Z; | ||
79 | if (gm20b_kind_zbc((u8)k)) | ||
80 | gk20a_kind_attr[k] |= GK20A_KIND_ATTR_ZBC; | ||
81 | } | ||
82 | } | ||
83 | |||
84 | void gm20b_init_fb(struct gpu_ops *gops) | ||
85 | { | ||
86 | gops->fb.init_fs_state = fb_gm20b_init_fs_state; | ||
87 | gm20b_init_uncompressed_kind_map(); | ||
88 | gm20b_init_kind_attr(); | ||
89 | } | ||