Commit 1abe739a authored by Sujatha Banoth's avatar Sujatha Banoth

Merge branch 'master' of https://github.com/Xilinx/dma_ip_drivers

parents 0eb756ff a1d510f4
This diff is collapsed.
...@@ -31,9 +31,32 @@ ...@@ -31,9 +31,32 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE
/* Add compatibility checking for RHEL versions */
#if defined(RHEL_RELEASE_CODE)
# define ACCESS_OK_2_ARGS (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 0))
#else
# define ACCESS_OK_2_ARGS (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0))
#endif
#if defined(RHEL_RELEASE_CODE)
# define HAS_MMIOWB (RHEL_RELEASE_CODE <= RHEL_RELEASE_VERSION(8, 0))
#else
# define HAS_MMIOWB (LINUX_VERSION_CODE <= KERNEL_VERSION(5, 1, 0))
#endif
#if defined(RHEL_RELEASE_CODE)
# define HAS_SWAKE_UP_ONE (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 0))
# define HAS_SWAKE_UP (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(8, 0))
#else
# define HAS_SWAKE_UP_ONE (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
# define HAS_SWAKE_UP (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0))
#endif
#if HAS_SWAKE_UP
#include <linux/swait.h> #include <linux/swait.h>
#endif #endif
/* /*
* if the config bar is fixed, the driver does not neeed to search through * if the config bar is fixed, the driver does not neeed to search through
* all of the bars * all of the bars
...@@ -58,7 +81,8 @@ ...@@ -58,7 +81,8 @@
* .REG_IRQ_OUT (reg_irq_from_ch[(channel*2) +: 2]), * .REG_IRQ_OUT (reg_irq_from_ch[(channel*2) +: 2]),
*/ */
#define XDMA_ENG_IRQ_NUM (1) #define XDMA_ENG_IRQ_NUM (1)
#define MAX_EXTRA_ADJ (0x3F) #define XDMA_MAX_ADJ_BLOCK_SIZE 0x40
#define XDMA_PAGE_SIZE 0x1000
#define RX_STATUS_EOP (1) #define RX_STATUS_EOP (1)
/* Target internal components on XDMA control BAR */ /* Target internal components on XDMA control BAR */
...@@ -417,7 +441,7 @@ struct xdma_transfer { ...@@ -417,7 +441,7 @@ struct xdma_transfer {
int desc_num; /* number of descriptors in transfer */ int desc_num; /* number of descriptors in transfer */
int desc_index; /* index for 1st desc. in transfer */ int desc_index; /* index for 1st desc. in transfer */
enum dma_data_direction dir; enum dma_data_direction dir;
#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE #if HAS_SWAKE_UP
struct swait_queue_head wq; struct swait_queue_head wq;
#else #else
wait_queue_head_t wq; /* wait queue for transfer completion */ wait_queue_head_t wq; /* wait queue for transfer completion */
...@@ -503,7 +527,7 @@ struct xdma_engine { ...@@ -503,7 +527,7 @@ struct xdma_engine {
dma_addr_t poll_mode_bus; /* bus addr for descriptor writeback */ dma_addr_t poll_mode_bus; /* bus addr for descriptor writeback */
/* Members associated with interrupt mode support */ /* Members associated with interrupt mode support */
#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE #if HAS_SWAKE_UP
struct swait_queue_head shutdown_wq; struct swait_queue_head shutdown_wq;
#else #else
wait_queue_head_t shutdown_wq; /* wait queue for shutdown sync */ wait_queue_head_t shutdown_wq; /* wait queue for shutdown sync */
...@@ -522,7 +546,7 @@ struct xdma_engine { ...@@ -522,7 +546,7 @@ struct xdma_engine {
/* for performance test support */ /* for performance test support */
struct xdma_performance_ioctl *xdma_perf; /* perf test control */ struct xdma_performance_ioctl *xdma_perf; /* perf test control */
#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE #if HAS_SWAKE_UP
struct swait_queue_head xdma_perf_wq; struct swait_queue_head xdma_perf_wq;
#else #else
wait_queue_head_t xdma_perf_wq; /* Perf test sync */ wait_queue_head_t xdma_perf_wq; /* Perf test sync */
......
...@@ -28,6 +28,7 @@ all : ...@@ -28,6 +28,7 @@ all :
clean: clean:
$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) clean $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) clean
@/bin/rm -f *.o.ur-safe
install: all install: all
$(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules_install $(MAKE) -C $(BUILDSYSTEM_DIR) M=$(PWD) modules_install
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* The full GNU General Public License is included in this distribution in * The full GNU General Public License is included in this distribution in
* the file called "COPYING". * the file called "COPYING".
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
#include "libxdma_api.h" #include "libxdma_api.h"
#include "xdma_cdev.h" #include "xdma_cdev.h"
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "xdma_cdev.h" #include "xdma_cdev.h"
#include "cdev_ctrl.h" #include "cdev_ctrl.h"
#if KERNEL_VERSION(5, 0, 0) <= LINUX_VERSION_CODE #if ACCESS_OK_2_ARGS
#define xlx_access_ok(X, Y, Z) access_ok(Y, Z) #define xlx_access_ok(X, Y, Z) access_ok(Y, Z)
#else #else
#define xlx_access_ok(X, Y, Z) access_ok(X, Y, Z) #define xlx_access_ok(X, Y, Z) access_ok(X, Y, Z)
......
...@@ -611,7 +611,7 @@ static int ioctl_do_perf_start(struct xdma_engine *engine, unsigned long arg) ...@@ -611,7 +611,7 @@ static int ioctl_do_perf_start(struct xdma_engine *engine, unsigned long arg)
enable_perf(engine); enable_perf(engine);
dbg_perf("transfer_size = %d\n", engine->xdma_perf->transfer_size); dbg_perf("transfer_size = %d\n", engine->xdma_perf->transfer_size);
/* initialize wait queue */ /* initialize wait queue */
#if KERNEL_VERSION(4, 6, 0) <= LINUX_VERSION_CODE #if HAS_SWAKE_UP
init_swait_queue_head(&engine->xdma_perf_wq); init_swait_queue_head(&engine->xdma_perf_wq);
#else #else
init_waitqueue_head(&engine->xdma_perf_wq); init_waitqueue_head(&engine->xdma_perf_wq);
......
...@@ -213,7 +213,7 @@ static long xvc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -213,7 +213,7 @@ static long xvc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
pr_info("copy back tdo_buf failed: %d/%u.\n", rv, total_bytes); pr_info("copy back tdo_buf failed: %d/%u.\n", rv, total_bytes);
unlock: unlock:
#if KERNEL_VERSION(5, 1, 0) >= LINUX_VERSION_CODE #if HAS_MMIOWB
mmiowb(); mmiowb();
#endif #endif
spin_unlock(&xcdev->lock); spin_unlock(&xcdev->lock);
......
...@@ -23,8 +23,7 @@ ...@@ -23,8 +23,7 @@
#include <linux/ioctl.h> #include <linux/ioctl.h>
/* /*
* !!! TODO !!! * the bar offset can be changed at compile time
* need a better way set the bar offset dynamicly
*/ */
#define XVC_BAR_OFFSET_DFLT 0x40000 /* DSA 4.0 */ #define XVC_BAR_OFFSET_DFLT 0x40000 /* DSA 4.0 */
......
...@@ -522,7 +522,6 @@ int xpdev_create_interfaces(struct xdma_pci_dev *xpdev) ...@@ -522,7 +522,6 @@ int xpdev_create_interfaces(struct xdma_pci_dev *xpdev)
} }
xpdev_flag_set(xpdev, XDF_CDEV_SG); xpdev_flag_set(xpdev, XDF_CDEV_SG);
/* ??? Bypass */
/* Initialize Bypass Character Device */ /* Initialize Bypass Character Device */
if (xdev->bypass_bar_idx > 0) { if (xdev->bypass_bar_idx > 0) {
for (i = 0; i < xpdev->h2c_channel_max; i++) { for (i = 0; i < xpdev->h2c_channel_max; i++) {
......
...@@ -108,6 +108,10 @@ static const struct pci_device_id pci_ids[] = { ...@@ -108,6 +108,10 @@ static const struct pci_device_id pci_ids[] = {
#ifdef INTERNAL_TESTING #ifdef INTERNAL_TESTING
{ PCI_DEVICE(0x1d0f, 0x1042), 0}, { PCI_DEVICE(0x1d0f, 0x1042), 0},
#endif #endif
/* aws */
{ PCI_DEVICE(0x1d0f, 0xf000), },
{ PCI_DEVICE(0x1d0f, 0xf001), },
{0,} {0,}
}; };
MODULE_DEVICE_TABLE(pci, pci_ids); MODULE_DEVICE_TABLE(pci, pci_ids);
...@@ -289,7 +293,11 @@ static void xdma_error_resume(struct pci_dev *pdev) ...@@ -289,7 +293,11 @@ static void xdma_error_resume(struct pci_dev *pdev)
struct xdma_pci_dev *xpdev = dev_get_drvdata(&pdev->dev); struct xdma_pci_dev *xpdev = dev_get_drvdata(&pdev->dev);
pr_info("dev 0x%p,0x%p.\n", pdev, xpdev); pr_info("dev 0x%p,0x%p.\n", pdev, xpdev);
#if KERNEL_VERSION(5, 7, 0) <= LINUX_VERSION_CODE
pci_aer_clear_nonfatal_status(pdev);
#else
pci_cleanup_aer_uncorrect_error_status(pdev); pci_cleanup_aer_uncorrect_error_status(pdev);
#endif
} }
#if KERNEL_VERSION(4, 13, 0) <= LINUX_VERSION_CODE #if KERNEL_VERSION(4, 13, 0) <= LINUX_VERSION_CODE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment