Files
linux-nvgpu/drivers/gpu/nvgpu/os/linux/linux-io.c
Antony Clince Alex 1bcc22ab19 gpu: nvgpu: make mssnvlink programming OS agnositc
Make ga10b_init_nvlink_soc_credits OS agnostic by replacing OS
specific functions with corresponding nvgpu wrappers. This function is now
assigned to gops.mssnvlink.init_soc_credits HAL.

Introduce nvgpu wrapper, nvgpu_io_map/unmap to map/unmap specified
physical address range.

Jira NVGPU-6641

Change-Id: I337bc75b8ec36552fe471bf5e42f62c19f67ed4a
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2618237
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2021-11-12 07:31:15 -08:00

43 lines
1.1 KiB
C

/*
* Copyright (c) 2017-2021, 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 <linux/io.h>
#include <nvgpu/io.h>
#include "os_linux.h"
u32 nvgpu_os_readl(uintptr_t addr)
{
return readl((void __iomem *)addr);
}
void nvgpu_os_writel(u32 v, uintptr_t addr)
{
writel(v, (void __iomem *)addr);
}
void nvgpu_os_writel_relaxed(u32 v, uintptr_t addr)
{
writel_relaxed(v, (void __iomem *)addr);
}
uintptr_t nvgpu_io_map(struct gk20a *g, uintptr_t addr, size_t size)
{
return (uintptr_t)devm_ioremap(dev_from_gk20a(g), addr, size);
}
void nvgpu_io_unmap(struct gk20a *g, uintptr_t addr, size_t size)
{
devm_iounmap(dev_from_gk20a(g), (void __iomem *)addr);
}