1/* 2 * Copyright (c) 2012 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 33 unchanged lines hidden (view full) --- 42 */ 43 44#include "base/chunk_generator.hh" 45#include "debug/DMA.hh" 46#include "debug/Drain.hh" 47#include "dev/dma_device.hh" 48#include "sim/system.hh" 49 |
50DmaPort::DmaPort(MemObject *dev, System *s) |
51 : MasterPort(dev->name() + ".dma", dev), device(dev), sys(s), 52 masterId(s->getMasterId(dev->name())), 53 pendingCount(0), drainEvent(NULL), |
54 inRetry(false) |
55{ } 56 57bool 58DmaPort::recvTimingResp(PacketPtr pkt) 59{ |
60 if (pkt->senderState) { |
61 DmaReqState *state; |
62 63 DPRINTF(DMA, "Received response %s addr %#x size %#x\n", 64 pkt->cmdString(), pkt->getAddr(), pkt->req->getSize()); 65 state = dynamic_cast<DmaReqState*>(pkt->senderState); 66 pendingCount--; 67 68 assert(pendingCount >= 0); 69 assert(state); --- 23 unchanged lines hidden (view full) --- 93 } else { 94 panic("Got packet without sender state... huh?\n"); 95 } 96 97 return true; 98} 99 100DmaDevice::DmaDevice(const Params *p) |
101 : PioDevice(p), dmaPort(this, sys) |
102{ } 103 104void 105DmaDevice::init() 106{ 107 if (!dmaPort.isConnected()) 108 panic("DMA port of %s not connected to anything!", name()); 109 PioDevice::init(); --- 34 unchanged lines hidden (view full) --- 144 if (result) { 145 DPRINTF(DMA, "-- Done\n"); 146 transmitList.pop_front(); 147 inRetry = false; 148 } else { 149 inRetry = true; 150 DPRINTF(DMA, "-- Failed, queued\n"); 151 } |
152 } while (result && transmitList.size()); |
153 |
154 DPRINTF(DMA, "TransmitList: %d, inRetry: %d\n", 155 transmitList.size(), inRetry); |
156} 157 158void 159DmaPort::dmaAction(Packet::Command cmd, Addr addr, int size, Event *event, 160 uint8_t *data, Tick delay, Request::Flags flag) 161{ 162 DmaReqState *reqState = new DmaReqState(event, size, delay); 163 --- 37 unchanged lines hidden (view full) --- 201 // some kind of selction between access methods 202 // more work is going to have to be done to make 203 // switching actually work 204 assert(transmitList.size()); 205 PacketPtr pkt = transmitList.front(); 206 207 Enums::MemoryMode state = sys->getMemoryMode(); 208 if (state == Enums::timing) { |
209 if (inRetry) { 210 DPRINTF(DMA, "Can't send immediately, waiting for retry\n"); |
211 return; 212 } 213 214 DPRINTF(DMA, "Attempting to send %s addr %#x\n", 215 pkt->cmdString(), pkt->getAddr()); 216 217 bool result; 218 do { 219 result = sendTimingReq(pkt); 220 if (result) { 221 transmitList.pop_front(); 222 DPRINTF(DMA, "-- Done\n"); 223 } else { 224 inRetry = true; 225 DPRINTF(DMA, "-- Failed: queued\n"); 226 } |
227 } while (result && transmitList.size()); |
228 } else if (state == Enums::atomic) { 229 transmitList.pop_front(); 230 231 Tick lat; 232 DPRINTF(DMA, "--Sending DMA for addr: %#x size: %d\n", 233 pkt->req->getPaddr(), pkt->req->getSize()); 234 lat = sendAtomic(pkt); 235 assert(pkt->senderState); --- 44 unchanged lines hidden --- |