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
7160ddbb
Commit
7160ddbb
authored
Apr 27, 2016
by
Wesley W. Terpstra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wishbone: read-out any MSI data we enqueue
parent
7019dabd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
wishbone.c
pcie-wb/wishbone.c
+26
-11
No files found.
pcie-wb/wishbone.c
View file @
7160ddbb
...
...
@@ -109,6 +109,13 @@ static inline void eb_from_cpu(unsigned char* x, wb_data_t dat)
}
}
static
int
deliver_msi
(
struct
etherbone_master_context
*
context
)
{
return
context
->
msi_unread
>
0
&&
context
->
sent
==
context
->
processed
&&
context
->
sent
==
context
->
received
;
}
static
void
claim_msi
(
struct
etherbone_master_context
*
context
)
{
unsigned
i
;
...
...
@@ -327,19 +334,26 @@ static ssize_t char_master_aio_read(struct kiocb *iocb, const struct iovec *iov,
if
(
mutex_lock_interruptible
(
&
context
->
mutex
))
return
-
EINTR
;
ring_len
=
RING_READ_LEN
(
context
);
len
=
min_t
(
unsigned
int
,
ring_len
,
iov_len
);
/* How far till we must wrap? */
buf_len
=
sizeof
(
context
->
buf
)
-
RING_INDEX
(
context
->
sent
);
if
(
buf_len
<
len
)
{
memcpy_toiovecend
(
iov
,
RING_POINTER
(
context
,
sent
),
0
,
buf_len
);
memcpy_toiovecend
(
iov
,
&
context
->
buf
[
0
],
buf_len
,
len
-
buf_len
);
/* If MSI is pending, deliver it */
if
(
deliver_msi
(
context
))
{
len
=
min_t
(
unsigned
int
,
context
->
msi_unread
,
iov_len
);
memcpy_toiovecend
(
iov
,
context
->
msi
+
sizeof
(
context
->
msi
)
-
context
->
msi_unread
,
0
,
len
);
context
->
msi_unread
-=
len
;
}
else
{
memcpy_toiovecend
(
iov
,
RING_POINTER
(
context
,
sent
),
0
,
len
);
ring_len
=
RING_READ_LEN
(
context
);
len
=
min_t
(
unsigned
int
,
ring_len
,
iov_len
);
/* How far till we must wrap? */
buf_len
=
sizeof
(
context
->
buf
)
-
RING_INDEX
(
context
->
sent
);
if
(
buf_len
<
len
)
{
memcpy_toiovecend
(
iov
,
RING_POINTER
(
context
,
sent
),
0
,
buf_len
);
memcpy_toiovecend
(
iov
,
&
context
->
buf
[
0
],
buf_len
,
len
-
buf_len
);
}
else
{
memcpy_toiovecend
(
iov
,
RING_POINTER
(
context
,
sent
),
0
,
len
);
}
context
->
sent
=
RING_POS
(
context
->
sent
+
len
);
}
context
->
sent
=
RING_POS
(
context
->
sent
+
len
);
mutex_unlock
(
&
context
->
mutex
);
...
...
@@ -403,6 +417,7 @@ static unsigned int char_master_poll(struct file *filep, poll_table *wait)
mutex_lock
(
&
context
->
mutex
);
if
(
deliver_msi
(
context
))
mask
|=
POLLIN
|
POLLRDNORM
;
if
(
RING_READ_LEN
(
context
)
!=
0
)
mask
|=
POLLIN
|
POLLRDNORM
;
if
(
RING_WRITE_LEN
(
context
)
!=
0
)
mask
|=
POLLOUT
|
POLLWRNORM
;
...
...
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