From 9eb1f57ba2b7072c6c53ca9dc59b10a87d88db23 Mon Sep 17 00:00:00 2001 From: Bo Yan Date: Mon, 14 Apr 2014 12:03:27 -0700 Subject: gpu: nvgpu: Add GPU driver for GM20B this moves GM20B driver to the new location Change-Id: I5fde14e114a8db79738a4c61849912b1ae225fb5 --- drivers/gpu/nvgpu/gm20b/fb_gm20b.c | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 drivers/gpu/nvgpu/gm20b/fb_gm20b.c (limited to 'drivers/gpu/nvgpu/gm20b/fb_gm20b.c') 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 @@ +/* + * GM20B GPC MMU + * + * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. +* + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include + +#include "gk20a/gk20a.h" +#include "gk20a/kind_gk20a.h" + +#include "hw_fb_gm20b.h" +#include "hw_top_gm20b.h" +#include "hw_gmmu_gm20b.h" + +static void fb_gm20b_init_fs_state(struct gk20a *g) +{ + gk20a_dbg_info("initialize gm20b fb"); + + gk20a_writel(g, fb_fbhub_num_active_ltcs_r(), + g->ltc_count); +} + +static void gm20b_init_uncompressed_kind_map(void) +{ + gk20a_init_uncompressed_kind_map(); + + gk20a_uc_kind_map[gmmu_pte_kind_s8_v()] = + gk20a_uc_kind_map[gmmu_pte_kind_s8_2s_v()] = + gmmu_pte_kind_s8_v(); +} + +static bool gm20b_kind_supported(u8 k) +{ + return (k >= gmmu_pte_kind_s8_v() && + k <= gmmu_pte_kind_s8_2s_v()); +} + +static bool gm20b_kind_z(u8 k) +{ + return (k >= gmmu_pte_kind_s8_v() && + k <= gmmu_pte_kind_s8_2s_v()); +} + +static bool gm20b_kind_compressible(u8 k) +{ + return (k >= gmmu_pte_kind_s8_v() && + k <= gmmu_pte_kind_s8_2s_v()); +} + +static bool gm20b_kind_zbc(u8 k) +{ + return (k >= gmmu_pte_kind_s8_v() && + k <= gmmu_pte_kind_s8_2s_v()); +} + +void gm20b_init_kind_attr(void) +{ + u16 k; + + gk20a_init_kind_attr(); + + for (k = 0; k < 256; k++) { + if (gm20b_kind_supported((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_SUPPORTED; + if (gm20b_kind_compressible((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_COMPRESSIBLE; + if (gm20b_kind_z((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_Z; + if (gm20b_kind_zbc((u8)k)) + gk20a_kind_attr[k] |= GK20A_KIND_ATTR_ZBC; + } +} + +void gm20b_init_fb(struct gpu_ops *gops) +{ + gops->fb.init_fs_state = fb_gm20b_init_fs_state; + gm20b_init_uncompressed_kind_map(); + gm20b_init_kind_attr(); +} -- cgit v1.2.2