Commit 01bdcb45 authored by Jonas Kaufmann's avatar Jonas Kaufmann Committed by Antoine Kaufmann
Browse files

lib/nicbm: implement posted writes

parent a0a2473d
...@@ -295,24 +295,29 @@ void Runner::H2DRead(volatile struct SimbricksProtoPcieH2DRead *read) { ...@@ -295,24 +295,29 @@ void Runner::H2DRead(volatile struct SimbricksProtoPcieH2DRead *read) {
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP); SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP);
} }
void Runner::H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write) { void Runner::H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write,
bool posted) {
volatile union SimbricksProtoPcieD2H *msg; volatile union SimbricksProtoPcieD2H *msg;
volatile struct SimbricksProtoPcieD2HWritecomp *wc; volatile struct SimbricksProtoPcieD2HWritecomp *wc;
msg = D2HAlloc();
wc = &msg->writecomp;
#ifdef DEBUG_NICBM #ifdef DEBUG_NICBM
uint64_t dbg_val = 0; uint64_t dbg_val = 0;
memcpy(&dbg_val, (const void *)write->data, write->len <= 8 ? write->len : 8); memcpy(&dbg_val, (const void *)write->data, write->len <= 8 ? write->len : 8);
printf("main_time = %lu: nicbm: write(off=0x%lx, len=%u, val=0x%lx)\n", printf(
main_time_, write->offset, write->len, dbg_val); "main_time = %lu: nicbm: write(off=0x%lx, len=%u, val=0x%lx, "
"posted=%u)\n",
main_time_, write->offset, write->len, dbg_val, posted);
#endif #endif
dev_.RegWrite(write->bar, write->offset, (void *)write->data, write->len); dev_.RegWrite(write->bar, write->offset, (void *)write->data, write->len);
if (!posted) {
msg = D2HAlloc();
wc = &msg->writecomp;
wc->req_id = write->req_id; wc->req_id = write->req_id;
SimbricksPcieIfD2HOutSend(&nicif_.pcie, msg, SimbricksPcieIfD2HOutSend(&nicif_.pcie, msg,
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP); SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP);
}
} }
void Runner::H2DReadcomp(volatile struct SimbricksProtoPcieH2DReadcomp *rc) { void Runner::H2DReadcomp(volatile struct SimbricksProtoPcieH2DReadcomp *rc) {
...@@ -399,7 +404,11 @@ void Runner::PollH2D() { ...@@ -399,7 +404,11 @@ void Runner::PollH2D() {
break; break;
case SIMBRICKS_PROTO_PCIE_H2D_MSG_WRITE: case SIMBRICKS_PROTO_PCIE_H2D_MSG_WRITE:
H2DWrite(&msg->write); H2DWrite(&msg->write, false);
break;
case SIMBRICKS_PROTO_PCIE_H2D_MSG_WRITE_POSTED:
H2DWrite(&msg->write, true);
break; break;
case SIMBRICKS_PROTO_PCIE_H2D_MSG_READCOMP: case SIMBRICKS_PROTO_PCIE_H2D_MSG_READCOMP:
......
...@@ -141,7 +141,7 @@ class Runner { ...@@ -141,7 +141,7 @@ class Runner {
volatile union SimbricksProtoNetMsg *D2NAlloc(); volatile union SimbricksProtoNetMsg *D2NAlloc();
void H2DRead(volatile struct SimbricksProtoPcieH2DRead *read); void H2DRead(volatile struct SimbricksProtoPcieH2DRead *read);
void H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write); void H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write, bool posted);
void H2DReadcomp(volatile struct SimbricksProtoPcieH2DReadcomp *rc); void H2DReadcomp(volatile struct SimbricksProtoPcieH2DReadcomp *rc);
void H2DWritecomp(volatile struct SimbricksProtoPcieH2DWritecomp *wc); void H2DWritecomp(volatile struct SimbricksProtoPcieH2DWritecomp *wc);
void H2DDevctrl(volatile struct SimbricksProtoPcieH2DDevctrl *dc); void H2DDevctrl(volatile struct SimbricksProtoPcieH2DDevctrl *dc);
......
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