Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FPGA Configuration Space
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FPGA Configuration Space
Commits
3ef60b31
Commit
3ef60b31
authored
Feb 02, 2016
by
Piotr Miedzik
Committed by
root
Feb 02, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec: MSI routine fixed
parent
ee1e2292
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
spec_wb.c
pcie-wb/spec_wb.c
+22
-8
No files found.
pcie-wb/spec_wb.c
View file @
3ef60b31
...
...
@@ -11,6 +11,7 @@
#include <linux/aer.h>
#include <linux/sched.h>
#include <linux/miscdevice.h>
#include <linux/version.h>
#include <asm/io.h>
#include <asm/spinlock.h>
...
...
@@ -232,6 +233,7 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
u8
revision
;
u16
vendor
;
struct
spec_wb_dev
*
dev
;
int
ret
;
pci_read_config_byte
(
pdev
,
PCI_REVISION_ID
,
&
revision
);
pci_read_config_word
(
pdev
,
PCI_VENDOR_ID
,
&
vendor
);
...
...
@@ -240,13 +242,13 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
case
SPEC1_WB_VENDOR_ID
:
if
(
revision
!=
SPEC1_WB_REVISION_ID
)
{
printk
(
KERN_ALERT
SPEC_WB
": SPECv1 revision ID wrong!
\n
"
);
goto
fail_out
;
return
-
EIO
;
}
break
;
case
SPEC4_WB_VENDOR_ID
:
if
(
revision
!=
SPEC4_WB_REVISION_ID
)
{
printk
(
KERN_ALERT
SPEC_WB
": SPECv4 revision ID wrong!
\n
"
);
goto
fail_out
;
return
-
EIO
;
}
break
;
}
...
...
@@ -254,8 +256,13 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
dev
=
kmalloc
(
sizeof
(
struct
spec_wb_dev
),
GFP_KERNEL
);
if
(
!
dev
)
{
printk
(
KERN_ALERT
SPEC_WB
": could not allocate memory for spec_wb_dev structure!
\n
"
);
goto
fail_out
;
return
-
ENOMEM
;
}
ret
=
pci_enable_device
(
pdev
);
if
(
ret
<
0
)
goto
fail_out
;
pci_set_master
(
pdev
);
/* Initialize structure */
dev
->
pci_dev
=
pdev
;
...
...
@@ -270,9 +277,15 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_set_drvdata
(
pdev
,
dev
);
/* enable message signaled interrupts */
if
(
pci_enable_msi
(
pdev
)
!=
0
)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
ret
=
pci_enable_msi_block
(
pdev
,
1
);
#else
ret
=
pci_enable_msi_exact
(
pdev
,
1
);
#endif
if
(
ret
<
0
)
{
/* resort to legacy interrupts */
printk
(
KERN_ALERT
SPEC_WB
": could not enable MSI interrupting
\n
"
);
dev_err
(
&
pdev
->
dev
,
"%s: could not enable MSI interrupting: error %i
\n
"
,
__func__
,
ret
);
dev
->
msi
=
0
;
}
...
...
@@ -281,6 +294,7 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
pci_intx
(
pdev
,
0
);
}
ret
=
-
ENOMEM
;
if
(
setup_bar
(
pdev
,
&
dev
->
pci_res
[
0
],
0
)
<
0
)
goto
fail_msi
;
if
(
setup_bar
(
pdev
,
&
dev
->
pci_res
[
1
],
2
)
<
0
)
goto
fail_bar0
;
if
(
setup_bar
(
pdev
,
&
dev
->
pci_res
[
2
],
4
)
<
0
)
goto
fail_bar1
;
...
...
@@ -290,7 +304,7 @@ static int probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto
fail_bar2
;
}
return
pci_enable_device
(
pdev
)
;
return
0
;
/* cleaning up */
fail_bar2:
...
...
@@ -304,9 +318,9 @@ fail_msi:
pci_intx
(
pdev
,
1
);
pci_disable_msi
(
pdev
);
}
kfree
(
dev
);
fail_out:
return
-
EIO
;
kfree
(
dev
);
return
ret
;
}
static
void
remove
(
struct
pci_dev
*
pdev
)
...
...
Write
Preview
Markdown
is supported
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