Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
70440ffb
Commit
70440ffb
authored
Sep 08, 2017
by
Jaco Hofmann
Committed by
Jaco Hofmann
Sep 08, 2017
Browse files
Adds support for older kernel Versions < 4.8
parent
41149f26
Changes
3
Hide whitespace changes
Inline
Side-by-side
platform/vc709/module/Makefile
View file @
70440ffb
# Makefile to build the ffLink module, which can be loaded with 'sudo insmod ffLink.ko' afterwards
# make should not be run as root, otherwise generated files cannot be removed correctly
# Name of Kernel module
# Name of Kernel module
obj-m
:=
ffLink.o
# composition of files needed to compile
...
...
@@ -35,5 +35,5 @@ ccflags-y := $(COMPILEFLAGS) $(DEBUGFLAGS)
all
:
#@ KCFLAGS+="
$(COMPILEFLAGS)
$(DEBUGFLAGS)
" make -C
$(LINUX_HOME)
M=
$(PWD)
modules
@
make -C
$(LINUX_HOME)
M=
$(PWD)
modules
clean
:
clean
:
@
make
-C
$(LINUX_HOME)
M
=
$(PWD)
clean
platform/vc709/module/pcie_device.c
View file @
70440ffb
...
...
@@ -33,6 +33,15 @@
static
struct
pci_data_struct
pci_data
;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
static
struct
msix_entry
msix_entries
[
REQUIRED_INTERRUPTS
];
u32
pci_irq_vector
(
struct
pci_dev
*
pdev
,
int
c
)
{
return
msix_entries
[
c
].
vector
;
}
#endif
/******************************************************************************/
/**
...
...
@@ -125,7 +134,6 @@ static int register_intr_handler(struct pci_dev *pdev, int c)
/* Request interrupt line for unique function
* alternatively function will be called from free_irq as well with flag IRQF_SHARED */
if
(
c
==
0
)
{
err
=
request_irq
(
pci_irq_vector
(
pdev
,
c
),
intr_handler_dma
,
IRQF_EARLY_RESUME
,
FFLINK_PCI_NAME
,
pdev
);
}
...
...
@@ -306,10 +314,17 @@ static int claim_msi(struct pci_dev *pdev)
for
(
i
=
0
;
i
<
REQUIRED_INTERRUPTS
;
i
++
)
{
pci_data
.
irq_mapping
[
i
]
=
-
1
;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
msix_entries
[
i
].
entry
=
i
;
#endif
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
err
=
pci_enable_msix_range
(
pdev
,
msix_entries
,
REQUIRED_INTERRUPTS
,
REQUIRED_INTERRUPTS
);
#else
/* set up MSI interrupt vector to max size */
err
=
pci_alloc_irq_vectors
(
pdev
,
REQUIRED_INTERRUPTS
,
REQUIRED_INTERRUPTS
,
PCI_IRQ_MSIX
);
#endif
if
(
err
<=
0
)
{
fflink_warn
(
"Cannot set MSI vector (%d)
\n
"
,
err
);
...
...
@@ -332,7 +347,11 @@ static int claim_msi(struct pci_dev *pdev)
error_pci_req_irq:
free_irqs
(
pdev
);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
pci_disable_msix
(
pdev
);
#else
pci_free_irq_vectors
(
pdev
);
#endif
error_no_msi:
return
-
ENOSPC
;
}
...
...
@@ -503,7 +522,11 @@ static void fflink_pci_remove(struct pci_dev *pdev)
fflink_info
(
"Unload pci-device
\n
"
);
free_irqs
(
pdev
);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
pci_disable_msix
(
pdev
);
#else
pci_free_irq_vectors
(
pdev
);
#endif
iounmap
(
pci_data
.
kvirt_addr_bar0
);
...
...
platform/vc709/module/pcie_device.h
View file @
70440ffb
...
...
@@ -62,7 +62,6 @@
#include
"common/device_user.h"
#include
"common/dma_ctrl.h"
#include
"common/device_pcie.h"
/******************************************************************************/
#define FFLINK_PCI_NAME "FFLINK_PCI_DRIVER"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment