From a5f722a5ff54814ce690f530d67fb946a64a992c Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 16 Sep 2019 18:26:27 +0530 Subject: [PATCH] gpu: nvgpu: doxygen for gr/gr_utils.h Add doxygen documentation for gr/gr_utils.h header Also move nvgpu_gr_checksum_u32() to gr_utils.c instead of declaring it static inline in header file. Jira NVGPU-4028 Change-Id: I383e06582b45ad50eef4b505ed8c57fb6620dff9 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/2199508 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Seshendra Gadagottu Reviewed-by: Alex Waterman Reviewed-by: Vinod Gopalakrishnakurup GVS: Gerrit_Virtual_Submit Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/gr/gr_utils.c | 5 ++ drivers/gpu/nvgpu/include/nvgpu/gr/gr.h | 1 + drivers/gpu/nvgpu/include/nvgpu/gr/gr_utils.h | 57 +++++++++++++++++-- 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nvgpu/common/gr/gr_utils.c b/drivers/gpu/nvgpu/common/gr/gr_utils.c index 24a511957..935a2e487 100644 --- a/drivers/gpu/nvgpu/common/gr/gr_utils.c +++ b/drivers/gpu/nvgpu/common/gr/gr_utils.c @@ -28,6 +28,11 @@ #include "gr_priv.h" +u32 nvgpu_gr_checksum_u32(u32 a, u32 b) +{ + return nvgpu_safe_cast_u64_to_u32(((u64)a + (u64)b) & (U32_MAX)); +} + struct nvgpu_gr_falcon *nvgpu_gr_get_falcon_ptr(struct gk20a *g) { return g->gr->falcon; diff --git a/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h b/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h index 93d8ffbc2..6d70c5a39 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gr/gr.h @@ -83,6 +83,7 @@ * + include/nvgpu/gr/obj_ctx.h * + include/nvgpu/gr/gr_falcon.h * + include/nvgpu/gr/gr_intr.h + * + include/nvgpu/gr/gr_utils.h * * Resource utilization * -------------------- diff --git a/drivers/gpu/nvgpu/include/nvgpu/gr/gr_utils.h b/drivers/gpu/nvgpu/include/nvgpu/gr/gr_utils.h index 80adf5e32..987e48751 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gr/gr_utils.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gr/gr_utils.h @@ -26,11 +26,18 @@ #include #include +/** + * @file + * + * common.gr.utils unit interface + */ struct gk20a; struct nvgpu_gr_falcon; -struct nvgpu_gr_obj_ctx_golden_image; struct nvgpu_gr_config; struct nvgpu_gr_intr; +#ifdef CONFIG_NVGPU_DEBUGGER +struct nvgpu_gr_obj_ctx_golden_image; +#endif #ifdef CONFIG_NVGPU_GRAPHICS struct nvgpu_gr_zbc; struct nvgpu_gr_zcull; @@ -42,15 +49,53 @@ struct nvgpu_gr_hwpm_map; struct nvgpu_gr_global_ctx_buffer_desc; #endif -static inline u32 nvgpu_gr_checksum_u32(u32 a, u32 b) -{ - return nvgpu_safe_cast_u64_to_u32(((u64)a + (u64)b) & (U32_MAX)); -} +/** + * @brief Compute checksum. + * + * @param a[in] First unsigned integer. + * @param b[in] Second unsigned integer. + * + * This function will calculate checksum of two unsigned integers and + * return the result. This function is typically needed to calculate + * checksum of falcon ucode boot binary. + * + * @return Checksum of two unsigned integers. + */ +u32 nvgpu_gr_checksum_u32(u32 a, u32 b); -/* gr struct pointers */ +/** + * @brief Get GR falcon data struct pointer. + * + * @param g[in] Pointer to GPU driver struct. + * + * This function returns pointer to #nvgpu_gr_falcon structure. + * + * @return Pointer to GR falcon data struct. + */ struct nvgpu_gr_falcon *nvgpu_gr_get_falcon_ptr(struct gk20a *g); + +/** + * @brief Get GR configuration struct pointer. + * + * @param g[in] Pointer to GPU driver struct. + * + * This function returns pointer to #nvgpu_gr_config structure. + * + * @return Pointer to GR configuration struct. + */ struct nvgpu_gr_config *nvgpu_gr_get_config_ptr(struct gk20a *g); + +/** + * @brief Get GR interrupt data struct pointer. + * + * @param g[in] Pointer to GPU driver struct. + * + * This function returns pointer to #nvgpu_gr_intr structure. + * + * @return Pointer to GR interrupt data struct. + */ struct nvgpu_gr_intr *nvgpu_gr_get_intr_ptr(struct gk20a *g); + #ifdef CONFIG_NVGPU_NON_FUSA /* gr variables */ u32 nvgpu_gr_get_override_ecc_val(struct gk20a *g);