diff options
Diffstat (limited to 'src/dev/io_device.cc')
-rw-r--r-- | src/dev/io_device.cc | 59 |
1 files changed, 22 insertions, 37 deletions
diff --git a/src/dev/io_device.cc b/src/dev/io_device.cc index 28b50f9e8..87fdbb765 100644 --- a/src/dev/io_device.cc +++ b/src/dev/io_device.cc @@ -67,7 +67,7 @@ PioPort::recvRetry() void PioPort::SendEvent::process() { - if (port->Port::sendTiming(packet) == Success) + if (port->Port::sendTiming(packet)) return; port->transmitList.push_back(packet); @@ -79,9 +79,9 @@ PioPort::recvTiming(Packet *pkt) { device->recvAtomic(pkt); // turn packet around to go back to requester - pkt->dest = pkt->src; + pkt->makeTimingResponse(); sendTiming(pkt, pkt->time - pkt->req->getTime()); - return Success; + return true; } PioDevice::~PioDevice() @@ -116,7 +116,7 @@ DmaPort::recvTiming(Packet *pkt) { if (pkt->senderState) { DmaReqState *state; - state = (DmaReqState*)pkt->senderState; + state = dynamic_cast<DmaReqState*>(pkt->senderState); state->completionEvent->schedule(pkt->time - pkt->req->getTime()); delete pkt->req; delete pkt; @@ -125,7 +125,7 @@ DmaPort::recvTiming(Packet *pkt) delete pkt; } - return Success; + return Packet::Success; } DmaDevice::DmaDevice(Params *p) @@ -135,7 +135,7 @@ DmaDevice::DmaDevice(Params *p) void DmaPort::SendEvent::process() { - if (port->Port::sendTiming(packet) == Success) + if (port->Port::sendTiming(packet)) return; port->transmitList.push_back(packet); @@ -148,54 +148,39 @@ DmaPort::recvRetry() transmitList.pop_front(); return pkt; } + + void -DmaPort::dmaAction(Command cmd, Addr addr, int size, Event *event, - uint8_t *data) +DmaPort::dmaAction(Packet::Command cmd, Addr addr, int size, Event *event, + uint8_t *data) { - assert(event); int prevSize = 0; - Packet basePkt; - Request baseReq(false); - - basePkt.flags = 0; - basePkt.coherence = NULL; - basePkt.senderState = NULL; - basePkt.dest = Packet::Broadcast; - basePkt.cmd = cmd; - basePkt.result = Unknown; - basePkt.req = NULL; -// baseReq.nicReq = true; - baseReq.setTime(curTick); for (ChunkGenerator gen(addr, size, peerBlockSize()); !gen.done(); gen.next()) { - Packet *pkt = new Packet(basePkt); - Request *req = new Request(baseReq); - pkt->addr = gen.addr(); - pkt->size = gen.size(); - pkt->req = req; - pkt->req->setPaddr(pkt->addr); - pkt->req->setSize(pkt->size); + Request *req = new Request(false); + req->setPaddr(gen.addr()); + req->setSize(gen.size()); + req->setTime(curTick); + Packet *pkt = new Packet(req, cmd, Packet::Broadcast); + // Increment the data pointer on a write if (data) pkt->dataStatic(data + prevSize) ; - prevSize += pkt->size; + + prevSize += gen.size(); + // Set the last bit of the dma as the final packet for this dma // and set it's completion event. if (prevSize == size) { - DmaReqState *state = new DmaReqState(event, true); - - pkt->senderState = (void*)state; + pkt->senderState = new DmaReqState(event, true); } assert(pendingCount >= 0); pendingCount++; sendDma(pkt); } - // since this isn't getting used and we want a check to make sure that all - // packets had data in them at some point. - basePkt.dataStatic((uint8_t*)NULL); } @@ -208,12 +193,12 @@ DmaPort::sendDma(Packet *pkt) /* MemState state = device->platform->system->memState; if (state == Timing) { - if (sendTiming(pkt) == Failure) + if (!sendTiming(pkt)) transmitList.push_back(&packet); } else if (state == Atomic) {*/ sendAtomic(pkt); if (pkt->senderState) { - DmaReqState *state = (DmaReqState*)pkt->senderState; + DmaReqState *state = dynamic_cast<DmaReqState*>(pkt->senderState); state->completionEvent->schedule(curTick + (pkt->time - pkt->req->getTime()) +1); } pendingCount--; |