Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
82bd1894
Commit
82bd1894
authored
Nov 23, 2020
by
Antoine Kaufmann
Browse files
libnicbm: add devctrl support
parent
c93522ab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
libnicbm/include/nicbm.h
libnicbm/include/nicbm.h
+15
-3
libnicbm/nicbm.cc
libnicbm/nicbm.cc
+17
-0
No files found.
libnicbm/include/nicbm.h
View file @
82bd1894
#include <set>
#include <deque>
extern
"C"
{
#include <nicsim.h>
}
namespace
nicbm
{
#include <cassert>
extern
"C"
{
#include <nicsim.h>
}
static
const
size_t
MAX_DMA_LEN
=
2048
;
...
...
@@ -36,6 +36,11 @@ class TimedEvent {
class
Runner
{
public:
class
Device
{
protected:
bool
int_intx_en
;
bool
int_msi_en
;
bool
int_msix_en
;
public:
/**
* Initialize device specific parameters (pci dev/vendor id,
...
...
@@ -74,6 +79,12 @@ class Runner {
* A timed event is due.
*/
virtual
void
timed_event
(
TimedEvent
&
ev
);
/**
* Device control update
*/
virtual
void
devctrl_update
(
struct
cosim_pcie_proto_h2d_devctrl
&
devctrl
);
};
protected:
...
...
@@ -99,6 +110,7 @@ class Runner {
void
h2d_write
(
volatile
struct
cosim_pcie_proto_h2d_write
*
write
);
void
h2d_readcomp
(
volatile
struct
cosim_pcie_proto_h2d_readcomp
*
rc
);
void
h2d_writecomp
(
volatile
struct
cosim_pcie_proto_h2d_writecomp
*
wc
);
void
h2d_devctrl
(
volatile
struct
cosim_pcie_proto_h2d_devctrl
*
dc
);
void
poll_h2d
();
void
eth_recv
(
volatile
struct
cosim_eth_proto_n2d_recv
*
recv
);
...
...
libnicbm/nicbm.cc
View file @
82bd1894
...
...
@@ -245,6 +245,11 @@ void Runner::h2d_writecomp(volatile struct cosim_pcie_proto_h2d_writecomp *wc)
dma_trigger
();
}
void
Runner
::
h2d_devctrl
(
volatile
struct
cosim_pcie_proto_h2d_devctrl
*
dc
)
{
dev
.
devctrl_update
(
*
(
struct
cosim_pcie_proto_h2d_devctrl
*
)
dc
);
}
void
Runner
::
eth_recv
(
volatile
struct
cosim_eth_proto_n2d_recv
*
recv
)
{
#ifdef DEBUG_NICBM
...
...
@@ -296,6 +301,10 @@ void Runner::poll_h2d()
h2d_writecomp
(
&
msg
->
writecomp
);
break
;
case
COSIM_PCIE_PROTO_H2D_MSG_DEVCTRL
:
h2d_devctrl
(
&
msg
->
devctrl
);
break
;
case
COSIM_PCIE_PROTO_H2D_MSG_SYNC
:
break
;
...
...
@@ -452,3 +461,11 @@ int Runner::runMain(int argc, char *argv[])
void
Runner
::
Device
::
timed_event
(
TimedEvent
&
te
)
{
}
void
Runner
::
Device
::
devctrl_update
(
struct
cosim_pcie_proto_h2d_devctrl
&
devctrl
)
{
int_intx_en
=
devctrl
.
flags
&
COSIM_PCIE_PROTO_CTRL_INTX_EN
;
int_msi_en
=
devctrl
.
flags
&
COSIM_PCIE_PROTO_CTRL_MSI_EN
;
int_msix_en
=
devctrl
.
flags
&
COSIM_PCIE_PROTO_CTRL_MSIX_EN
;
}
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