misc: mods: fix compilation with k5.4

Clean up configuration in mods_config.h and make mods_config.h identical
to the official copy in Perforce.

Bug 200587200

Change-Id: I035119eb44025f45d8272729ebc5a918dd8da6fe
Signed-off-by: Chris Dragan <kdragan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2302436
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Chris Dragan
2020-02-26 04:17:32 -08:00
committed by Laxman Dewangan
parent b5b2def304
commit a85680cbc5
17 changed files with 104 additions and 74 deletions

View File

@@ -2,12 +2,12 @@ obj-$(CONFIG_MODS) := mods.o
mods-y := mods_krnl.o
mods-y += mods_mem.o
mods-y += mods_irq.o
mods-y += mods_clock.o
mods-$(CONFIG_COMMON_CLK) += mods_clock.o
mods-$(CONFIG_ARCH_TEGRA) += mods_tegraprod.o
mods-$(CONFIG_ARCH_TEGRA_19x_SOC) += mods_ras.o
mods-$(CONFIG_PCI) += mods_pci.o
mods-$(CONFIG_ACPI) += mods_acpi.o
mods-$(CONFIG_ARCH_TEGRA) += mods_dmabuf.o
mods-$(CONFIG_DMA_SHARED_BUFFER) += mods_dmabuf.o
mods-$(CONFIG_DMA_ENGINE) += mods_dma.o
mods-$(CONFIG_DEBUG_FS) += mods_debugfs.o
mods-$(CONFIG_TEGRA_DC) += mods_tegradc.o

View File

@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods.dts - This file is part of NVIDIA MODS kernel driver.
*
* Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License,

View File

@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods_adsp.c - This file is part of NVIDIA MODS kernel driver.
*

View File

@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods_clock.c - This file is part of NVIDIA MODS kernel driver.
*

View File

@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* mods_config.h - This file is part of NVIDIA MODS kernel driver.
*
* Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2008-2020, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
@@ -20,45 +21,66 @@
#ifndef _MODS_CONFIG_H_
#define _MODS_CONFIG_H_
#define MODS_KERNEL_VERSION KERNEL_VERSION(4, 4, 0)
#define MODS_KERNEL_VERSION LINUX_VERSION_CODE
#define MODS_IRQ_HANDLE_NO_REGS 1
#define MODS_HAS_SET_MEMORY 1
#define MODS_ACPI_DEVID_64 1
#define MODS_HAS_WC 1
#define MODS_HAS_DEV_TO_NUMA_NODE 1
#define MODS_HAS_NEW_ACPI_WALK 1
#ifdef CONFIG_DEBUG_FS
#define MODS_HAS_DEBUGFS 1
#if KERNEL_VERSION(2, 6, 30) <= MODS_KERNEL_VERSION
# define MODS_HAS_DMA_OPS 1
#else
# define MODS_HASNT_PCI_RESCAN_BUS 1
#endif
#if defined(CONFIG_TEGRA_KFUSE)
#define MODS_HAS_KFUSE 1
#if KERNEL_VERSION(2, 6, 31) <= MODS_KERNEL_VERSION
# define MODS_HAS_IORESOURCE_MEM_64 1
#endif
#ifdef CONFIG_DMA_SHARED_BUFFER
#define MODS_HAS_DMABUF 1
#if KERNEL_VERSION(2, 6, 33) <= MODS_KERNEL_VERSION
# define MODS_HAS_NEW_ACPI_WALK 1
#else
# define MODS_HASNT_NUMA_NO_NODE 1
#endif
#define MODS_MULTI_INSTANCE_DEFAULT_VALUE 1
#define MODS_HAS_IORESOURCE_MEM_64 1
#undef MODS_HAS_NEW_ACPI_HANDLE /* new in 3.13 */
#if defined(CONFIG_ARCH_TEGRA)
#define MODS_TEGRA 1
#if KERNEL_VERSION(2, 6, 38) <= MODS_KERNEL_VERSION
# if defined(CONFIG_X86)
# define MODS_HAS_CONSOLE_LOCK 1
# endif
#endif
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF_RESOLVE) && \
defined(CONFIG_OF_DYNAMIC)
#define MODS_HAS_CLOCK 1
#if KERNEL_VERSION(3, 4, 0) > MODS_KERNEL_VERSION
# define MODS_HASNT_PCI_BUS_REMOVE_DEV 1
#endif
#ifdef CONFIG_NET
#define MODS_HAS_NET 1
#if KERNEL_VERSION(3, 8, 0) <= MODS_KERNEL_VERSION
# define MODS_HAS_NEW_ACPI_HANDLE 1
# define MODS_HAS_SRIOV 1
#endif
#ifdef CONFIG_ZONE_DMA32
#define MODS_HAS_DMA32 1
#if KERNEL_VERSION(3, 14, 0) <= MODS_KERNEL_VERSION
# define MODS_HAS_MSIX_RANGE 1
#else
# define MODS_HASNT_PCI_LOCK_RESCAN_REMOVE 1
#endif
#ifdef CONFIG_PCI
#define MODS_CAN_REGISTER_PCI_DEV 1
#if defined(CONFIG_ARM64) && \
KERNEL_VERSION(3, 15, 0) <= MODS_KERNEL_VERSION && \
KERNEL_VERSION(4, 14, 0) > MODS_KERNEL_VERSION
# define MODS_HAS_NONCOH_DMA_OPS 1
#endif
#if KERNEL_VERSION(3, 16, 0) <= MODS_KERNEL_VERSION && \
defined(CONFIG_VT_HW_CONSOLE_BINDING)
# define MODS_HAS_CONSOLE_BINDING 1
#endif
#if defined(CONFIG_PPC64) && KERNEL_VERSION(4, 5, 0) <= MODS_KERNEL_VERSION
# define MODS_HAS_PNV_PCI_GET_NPU_DEV 1
#endif
#if KERNEL_VERSION(4, 12, 0) <= MODS_KERNEL_VERSION && !defined(CONFIG_PPC64)
# define MODS_HAS_SET_MEMORY_HEADER 1
#endif
#if KERNEL_VERSION(4, 16, 0) > MODS_KERNEL_VERSION && defined(CONFIG_X86)
# define MODS_HAS_MAP_SG_ATTRS
#endif
#define MODS_HAS_MSIX_RANGE 1
#define MODS_HAS_SRIOV 1
#endif /* _MODS_CONFIG_H_ */
/* vim: set ts=8 sw=8 noet: */

View File

@@ -2,7 +2,7 @@
/*
* mods_debugfs.c - This file is part of NVIDIA MODS kernel driver.
*
* Copyright (c) 2014-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License,
@@ -33,7 +33,7 @@ static struct dentry *mods_debugfs_dir;
#include "mods_ras.h"
#endif
#if defined(MODS_TEGRA) && defined(MODS_HAS_KFUSE)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_TEGRA_KFUSE)
#include <soc/tegra/kfuse.h>
#endif
@@ -423,7 +423,7 @@ static const struct file_operations mods_dc_crc_latched_fops = {
};
#endif /* CONFIG_TEGRA_DC */
#if defined(MODS_TEGRA) && defined(MODS_HAS_KFUSE)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_TEGRA_KFUSE)
static int mods_kfuse_show(struct seq_file *s, void *unused)
{
unsigned int buf[KFUSE_DATA_SZ / 4];
@@ -453,7 +453,7 @@ static const struct file_operations mods_kfuse_fops = {
.llseek = seq_lseek,
.release = single_release,
};
#endif /* MODS_TEGRA */
#endif /* CONFIG_ARCH_TEGRA */
static int mods_debug_get(void *data, u64 *val)
{
@@ -521,7 +521,6 @@ void mods_remove_debugfs(void)
int mods_create_debugfs(struct miscdevice *modsdev)
{
#ifdef MODS_HAS_DEBUGFS
#ifdef CONFIG_ARCH_TEGRA_19x_SOC
struct dentry *ras_debugfs_entry;
#endif
@@ -618,7 +617,7 @@ int mods_create_debugfs(struct miscdevice *modsdev)
goto remove_out;
}
#if defined(MODS_TEGRA) && defined(MODS_HAS_KFUSE)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_TEGRA_KFUSE)
retval = debugfs_create_file("kfuse_data", 0444,
mods_debugfs_dir, 0, &mods_kfuse_fops);
if (IS_ERR(retval)) {
@@ -764,8 +763,4 @@ remove_out:
dev_err(modsdev->this_device, "could not create debugfs\n");
mods_remove_debugfs();
return err;
#else
return 0;
#endif
}

View File

@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods_dma.c - This file is part of NVIDIA MODS kernel driver.
*

View File

@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods_dmabuf.c - This file is part of NVIDIA MODS kernel driver.
*
@@ -17,11 +18,6 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/version.h>
#include "mods_config.h"
#ifdef MODS_HAS_DMABUF
#include <linux/dma-buf.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
@@ -162,5 +158,3 @@ void mods_exit_dmabuf(void)
{
platform_driver_unregister(&mods_dummy_driver);
}
#endif

View File

@@ -409,7 +409,8 @@ int mods_find_pci_dev(struct mods_client *client,
#endif
/* clock */
#ifdef MODS_TEGRA
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_COMMON_CLK) && \
defined(CONFIG_OF_RESOLVE) && defined(CONFIG_OF_DYNAMIC)
void mods_init_clock_api(void);
void mods_shutdown_clock_api(void);
#endif
@@ -525,7 +526,7 @@ int esc_mods_pci_set_dma_mask(struct mods_client *client,
struct MODS_PCI_DMA_MASK *dma_mask);
#endif
/* irq */
#if defined(MODS_TEGRA) && defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
int esc_mods_map_irq(struct mods_client *client, struct MODS_DT_INFO *p);
int esc_mods_map_irq_to_gpio(struct mods_client *client,
struct MODS_GPIO_INFO *p);
@@ -553,7 +554,7 @@ int esc_mods_register_irq_4(struct mods_client *client,
int esc_mods_query_irq_3(struct mods_client *client,
struct MODS_QUERY_IRQ_3 *p);
#ifdef MODS_TEGRA
#ifdef CONFIG_ARCH_TEGRA
/* clock */
int esc_mods_get_clock_handle(struct mods_client *client,
@@ -608,12 +609,12 @@ int esc_mods_tegra_dc_config_possible(struct mods_client *client,
struct MODS_TEGRA_DC_CONFIG_POSSIBLE *p);
#endif
#ifdef MODS_HAS_NET
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_NET)
int esc_mods_net_force_link(struct mods_client *client,
struct MODS_NET_DEVICE_NAME *p);
#endif
#ifdef MODS_HAS_DMABUF
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_DMA_SHARED_BUFFER)
int esc_mods_dmabuf_get_phys_addr(struct mods_client *client,
struct MODS_DMABUF_GET_PHYSICAL_ADDRESS *p);
#else
@@ -658,7 +659,7 @@ static inline int mods_create_debugfs(struct miscdevice *modsdev)
static inline void mods_remove_debugfs(void) {}
#endif /* CONFIG_DEBUG_FS */
#if defined(MODS_TEGRA) && defined(MODS_HAS_DMABUF)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_DMA_SHARED_BUFFER)
int mods_init_dmabuf(void);
void mods_exit_dmabuf(void);
#else

View File

@@ -24,7 +24,7 @@
#include <linux/poll.h>
#include <linux/interrupt.h>
#include <linux/pci_regs.h>
#if defined(MODS_TEGRA) && defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/io.h>
@@ -1484,7 +1484,7 @@ int esc_mods_irq_handled(struct mods_client *client,
return esc_mods_irq_handled_2(client, &register_irq);
}
#if defined(MODS_TEGRA) && defined(CONFIG_OF_IRQ) && defined(CONFIG_OF)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_OF_IRQ) && defined(CONFIG_OF)
int esc_mods_map_irq(struct mods_client *client,
struct MODS_DT_INFO *p)
{

View File

@@ -136,6 +136,12 @@ struct pci_driver mods_pci_driver = {
* used to avoid globalization of variables *
***********************************************/
#ifdef CONFIG_ARCH_TEGRA
# define MODS_MULTI_INSTANCE_DEFAULT_VALUE 1
#else
# define MODS_MULTI_INSTANCE_DEFAULT_VALUE 0
#endif
static int debug;
static int multi_instance = MODS_MULTI_INSTANCE_DEFAULT_VALUE;
static u32 access_token = MODS_ACCESS_TOKEN_NONE;
@@ -440,7 +446,8 @@ static int __init mods_init_module(void)
return -EBUSY;
#endif
#if defined(MODS_HAS_CLOCK)
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF_RESOLVE) && \
defined(CONFIG_OF_DYNAMIC)
mods_init_clock_api();
#endif
@@ -452,7 +459,7 @@ static int __init mods_init_module(void)
if (rc < 0)
return rc;
#if defined(MODS_TEGRA)
#if defined(CONFIG_ARCH_TEGRA)
/* tegra prod */
mods_tegra_prod_init(&mods_dev);
#endif
@@ -485,7 +492,8 @@ static void __exit mods_exit_module(void)
misc_deregister(&mods_dev);
#if defined(MODS_HAS_CLOCK)
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF_RESOLVE) && \
defined(CONFIG_OF_DYNAMIC)
mods_shutdown_clock_api();
#endif
@@ -1954,7 +1962,7 @@ static long mods_krnl_ioctl(struct file *fp,
err = -EINVAL;
break;
#if defined(MODS_TEGRA) && defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
case MODS_ESC_MAP_INTERRUPT:
MODS_IOCTL(MODS_ESC_MAP_INTERRUPT,
esc_mods_map_irq, MODS_DT_INFO);
@@ -2073,7 +2081,8 @@ static long mods_krnl_ioctl(struct file *fp,
esc_mods_get_kernel_version, MODS_GET_VERSION);
break;
#if defined(MODS_HAS_CLOCK)
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_OF_RESOLVE) && \
defined(CONFIG_OF_DYNAMIC)
case MODS_ESC_GET_CLOCK_HANDLE:
MODS_IOCTL(MODS_ESC_GET_CLOCK_HANDLE,
esc_mods_get_clock_handle, MODS_GET_CLOCK_HANDLE);
@@ -2138,7 +2147,7 @@ static long mods_krnl_ioctl(struct file *fp,
MODS_CLOCK_HANDLE);
break;
#endif
#if defined(MODS_TEGRA)
#if defined(CONFIG_ARCH_TEGRA)
case MODS_ESC_FLUSH_CPU_CACHE_RANGE:
MODS_IOCTL_NORETVAL(MODS_ESC_FLUSH_CPU_CACHE_RANGE,
esc_mods_flush_cpu_cache_range,
@@ -2198,7 +2207,7 @@ static long mods_krnl_ioctl(struct file *fp,
MODS_TEGRA_DC_CONFIG_POSSIBLE);
break;
#endif
#ifdef MODS_HAS_NET
#if defined(CONFIG_ARCH_TEGRA) && defined(CONFIG_NET)
case MODS_ESC_NET_FORCE_LINK:
MODS_IOCTL(MODS_ESC_NET_FORCE_LINK,
esc_mods_net_force_link, MODS_NET_DEVICE_NAME);
@@ -2210,7 +2219,7 @@ static long mods_krnl_ioctl(struct file *fp,
esc_mods_memory_barrier);
break;
#ifdef MODS_TEGRA
#ifdef CONFIG_ARCH_TEGRA
case MODS_ESC_DMABUF_GET_PHYSICAL_ADDRESS:
MODS_IOCTL(MODS_ESC_DMABUF_GET_PHYSICAL_ADDRESS,
esc_mods_dmabuf_get_phys_addr,
@@ -2264,7 +2273,7 @@ static long mods_krnl_ioctl(struct file *fp,
esc_mods_resume_console);
break;
#if defined(MODS_TEGRA)
#if defined(CONFIG_ARCH_TEGRA)
case MODS_ESC_TEGRA_PROD_IS_SUPPORTED:
MODS_IOCTL(MODS_ESC_TEGRA_PROD_IS_SUPPORTED,
esc_mods_tegra_prod_is_supported,

View File

@@ -381,7 +381,7 @@ static struct MODS_DMA_MAP *find_dma_map(struct MODS_MEM_INFO *p_mem_info,
return NULL;
}
#if !defined(MODS_TEGRA) || defined(CONFIG_CPA)
#if !defined(CONFIG_ARCH_TEGRA) || defined(CONFIG_CPA)
static int mods_set_mem_type(u64 virt_addr, u64 pages, u8 type)
{
if (type == MODS_ALLOC_UNCACHED)
@@ -2059,7 +2059,7 @@ int esc_mods_dma_unmap_memory(struct mods_client *client,
}
#endif
#ifdef MODS_TEGRA
#ifdef CONFIG_ARCH_TEGRA
static void clear_contiguous_cache(struct mods_client *client,
u64 virt_start,
@@ -2236,7 +2236,7 @@ static int mods_post_alloc(struct mods_client *client,
cl_error("kmap failed\n");
return -EINVAL;
}
#if defined(MODS_TEGRA) && !defined(CONFIG_CPA)
#if defined(CONFIG_ARCH_TEGRA) && !defined(CONFIG_CPA)
clear_contiguous_cache(client,
ptr,
phys_addr + (i << PAGE_SHIFT),

View File

@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods_net.c - This file is part of NVIDIA MODS kernel driver.
*

View File

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2020, 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,

View File

@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* mods_ras.h - This file is part of NVIDIA MODS kernel driver.
*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License,

View File

@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods_tegradc.c - This file is part of NVIDIA MODS kernel driver.
*

View File

@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0
/*
* mods_tegraprod.c - This file is part of NVIDIA MODS kernel driver.
*