diff options
Diffstat (limited to 'src/dev')
-rw-r--r-- | src/dev/alpha/tsunami_pchip.cc | 3 | ||||
-rw-r--r-- | src/dev/arm/pl111.cc | 6 | ||||
-rw-r--r-- | src/dev/copy_engine.cc | 42 | ||||
-rw-r--r-- | src/dev/copy_engine.hh | 2 | ||||
-rw-r--r-- | src/dev/i8254xGBe.cc | 2 | ||||
-rw-r--r-- | src/dev/io_device.cc | 39 | ||||
-rw-r--r-- | src/dev/io_device.hh | 20 | ||||
-rwxr-xr-x | src/dev/mips/malta_pchip.cc | 3 | ||||
-rw-r--r-- | src/dev/pcidev.cc | 16 | ||||
-rw-r--r-- | src/dev/pcidev.hh | 9 | ||||
-rw-r--r-- | src/dev/sinic.cc | 2 | ||||
-rw-r--r-- | src/dev/x86/i82094aa.cc | 4 | ||||
-rw-r--r-- | src/dev/x86/i82094aa.hh | 2 | ||||
-rw-r--r-- | src/dev/x86/intdev.cc | 4 | ||||
-rw-r--r-- | src/dev/x86/intdev.hh | 11 |
15 files changed, 80 insertions, 85 deletions
diff --git a/src/dev/alpha/tsunami_pchip.cc b/src/dev/alpha/tsunami_pchip.cc index f8c9104e2..f49f1e6b6 100644 --- a/src/dev/alpha/tsunami_pchip.cc +++ b/src/dev/alpha/tsunami_pchip.cc @@ -284,7 +284,8 @@ TsunamiPChip::translatePciToDma(Addr busAddr) baMask = (wsm[i] & (ULL(0xfff) << 20)) | (ULL(0x7f) << 13); pteAddr = (tba[i] & tbaMask) | ((busAddr & baMask) >> 10); - pioPort->readBlob(pteAddr, (uint8_t*)&pteEntry, sizeof(uint64_t)); + pioPort.readBlob(pteAddr, (uint8_t*)&pteEntry, + sizeof(uint64_t)); dmaAddr = ((pteEntry & ~ULL(0x1)) << 12) | (busAddr & ULL(0x1fff)); diff --git a/src/dev/arm/pl111.cc b/src/dev/arm/pl111.cc index d416ab31f..7c25958e0 100644 --- a/src/dev/arm/pl111.cc +++ b/src/dev/arm/pl111.cc @@ -460,9 +460,9 @@ Pl111::fillFifo() // will be uncacheable as well. If we have uncacheable and cacheable // requests in the memory system for the same address it won't be // pleased - dmaPort->dmaAction(MemCmd::ReadReq, curAddr + startAddr, dmaSize, - &dmaDoneEvent[dmaPendingNum-1], curAddr + dmaBuffer, 0, - Request::UNCACHEABLE); + dmaPort.dmaAction(MemCmd::ReadReq, curAddr + startAddr, dmaSize, + &dmaDoneEvent[dmaPendingNum-1], curAddr + dmaBuffer, + 0, Request::UNCACHEABLE); curAddr += dmaSize; } } diff --git a/src/dev/copy_engine.cc b/src/dev/copy_engine.cc index a3958127b..7b17a86a3 100644 --- a/src/dev/copy_engine.cc +++ b/src/dev/copy_engine.cc @@ -77,7 +77,9 @@ CopyEngine::CopyEngine(const Params *p) CopyEngine::CopyEngineChannel::CopyEngineChannel(CopyEngine *_ce, int cid) - : cePort(NULL), ce(_ce), channelId(cid), busy(false), underReset(false), + : cePort(_ce, _ce->sys, _ce->params()->min_backoff_delay, + _ce->params()->max_backoff_delay), + ce(_ce), channelId(cid), busy(false), underReset(false), refreshNext(false), latBeforeBegin(ce->params()->latBeforeBegin), latAfterCompletion(ce->params()->latAfterCompletion), completionDataReg(0), nextState(Idle), drainEvent(NULL), @@ -106,7 +108,6 @@ CopyEngine::CopyEngineChannel::~CopyEngineChannel() { delete curDmaDesc; delete [] copyBuffer; - delete cePort; } Port * @@ -123,10 +124,7 @@ CopyEngine::getPort(const std::string &if_name, int idx) Port * CopyEngine::CopyEngineChannel::getPort() { - assert(cePort == NULL); - cePort = new DmaPort(ce, ce->sys, ce->params()->min_backoff_delay, - ce->params()->max_backoff_delay); - return cePort; + return &cePort; } void @@ -451,9 +449,9 @@ CopyEngine::CopyEngineChannel::fetchDescriptor(Addr address) DPRINTF(DMACopyEngine, "dmaAction: %#x, %d bytes, to addr %#x\n", ce->platform->pciToDma(address), sizeof(DmaDesc), curDmaDesc); - cePort->dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(address), - sizeof(DmaDesc), &fetchCompleteEvent, (uint8_t*)curDmaDesc, - latBeforeBegin); + cePort.dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(address), + sizeof(DmaDesc), &fetchCompleteEvent, + (uint8_t*)curDmaDesc, latBeforeBegin); lastDescriptorAddr = address; } @@ -495,8 +493,8 @@ CopyEngine::CopyEngineChannel::readCopyBytes() DPRINTF(DMACopyEngine, "Reading %d bytes from buffer to memory location %#x(%#x)\n", curDmaDesc->len, curDmaDesc->dest, ce->platform->pciToDma(curDmaDesc->src)); - cePort->dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(curDmaDesc->src), - curDmaDesc->len, &readCompleteEvent, copyBuffer, 0); + cePort.dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(curDmaDesc->src), + curDmaDesc->len, &readCompleteEvent, copyBuffer, 0); } void @@ -517,8 +515,8 @@ CopyEngine::CopyEngineChannel::writeCopyBytes() curDmaDesc->len, curDmaDesc->dest, ce->platform->pciToDma(curDmaDesc->dest)); - cePort->dmaAction(MemCmd::WriteReq, ce->platform->pciToDma(curDmaDesc->dest), - curDmaDesc->len, &writeCompleteEvent, copyBuffer, 0); + cePort.dmaAction(MemCmd::WriteReq, ce->platform->pciToDma(curDmaDesc->dest), + curDmaDesc->len, &writeCompleteEvent, copyBuffer, 0); ce->bytesCopied[channelId] += curDmaDesc->len; ce->copiesProcessed[channelId]++; @@ -586,9 +584,10 @@ CopyEngine::CopyEngineChannel::writeCompletionStatus() completionDataReg, cr.completionAddr, ce->platform->pciToDma(cr.completionAddr)); - cePort->dmaAction(MemCmd::WriteReq, ce->platform->pciToDma(cr.completionAddr), - sizeof(completionDataReg), &statusCompleteEvent, - (uint8_t*)&completionDataReg, latAfterCompletion); + cePort.dmaAction(MemCmd::WriteReq, + ce->platform->pciToDma(cr.completionAddr), + sizeof(completionDataReg), &statusCompleteEvent, + (uint8_t*)&completionDataReg, latAfterCompletion); } void @@ -604,9 +603,10 @@ CopyEngine::CopyEngineChannel::fetchNextAddr(Addr address) anBegin("FetchNextAddr"); DPRINTF(DMACopyEngine, "Fetching next address...\n"); busy = true; - cePort->dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(address + - offsetof(DmaDesc, next)), sizeof(Addr), &addrCompleteEvent, - (uint8_t*)curDmaDesc + offsetof(DmaDesc, next), 0); + cePort.dmaAction(MemCmd::ReadReq, + ce->platform->pciToDma(address + offsetof(DmaDesc, next)), + sizeof(Addr), &addrCompleteEvent, + (uint8_t*)curDmaDesc + offsetof(DmaDesc, next), 0); } void @@ -648,7 +648,7 @@ CopyEngine::CopyEngineChannel::drain(Event *de) if (nextState == Idle || ce->getState() != SimObject::Running) return 0; unsigned int count = 1; - count += cePort->drain(de); + count += cePort.drain(de); DPRINTF(DMACopyEngine, "unable to drain, returning %d\n", count); drainEvent = de; @@ -659,7 +659,7 @@ unsigned int CopyEngine::drain(Event *de) { unsigned int count; - count = pioPort->drain(de) + dmaPort->drain(de) + configPort->drain(de); + count = pioPort.drain(de) + dmaPort.drain(de) + configPort.drain(de); for (int x = 0;x < chan.size(); x++) count += chan[x]->drain(de); diff --git a/src/dev/copy_engine.hh b/src/dev/copy_engine.hh index 65a3ac82d..aa0bf0896 100644 --- a/src/dev/copy_engine.hh +++ b/src/dev/copy_engine.hh @@ -61,7 +61,7 @@ class CopyEngine : public PciDev class CopyEngineChannel { private: - DmaPort *cePort; + DmaPort cePort; CopyEngine *ce; CopyEngineReg::ChanRegs cr; int channelId; diff --git a/src/dev/i8254xGBe.cc b/src/dev/i8254xGBe.cc index 957aca19c..effc2a589 100644 --- a/src/dev/i8254xGBe.cc +++ b/src/dev/i8254xGBe.cc @@ -2051,7 +2051,7 @@ unsigned int IGbE::drain(Event *de) { unsigned int count; - count = pioPort->drain(de) + dmaPort->drain(de); + count = pioPort.drain(de) + dmaPort.drain(de); if (rxDescCache.hasOutstandingEvents() || txDescCache.hasOutstandingEvents()) { count++; diff --git a/src/dev/io_device.cc b/src/dev/io_device.cc index b1f6f5e02..5d6255f5c 100644 --- a/src/dev/io_device.cc +++ b/src/dev/io_device.cc @@ -55,33 +55,28 @@ PioPort::getAddrRanges() PioDevice::PioDevice(const Params *p) - : MemObject(p), sys(p->system), pioPort(NULL) + : MemObject(p), sys(p->system), pioPort(this, sys) {} PioDevice::~PioDevice() { - if (pioPort) - delete pioPort; } void PioDevice::init() { - if (!pioPort) + if (!pioPort.isConnected()) panic("Pio port of %s not connected to anything!", name()); - pioPort->sendRangeChange(); + pioPort.sendRangeChange(); } Port * PioDevice::getPort(const std::string &if_name, int idx) { if (if_name == "pio") { - if (pioPort != NULL) - fatal("%s: pio port already connected to %s", - name(), pioPort->getPeer()->name()); - pioPort = new PioPort(this, sys); - return pioPort; + return &pioPort; } + panic("PioDevice %s has no port named %s\n", name(), if_name); return NULL; } @@ -89,7 +84,7 @@ unsigned int PioDevice::drain(Event *de) { unsigned int count; - count = pioPort->drain(de); + count = pioPort.drain(de); if (count) changeState(Draining); else @@ -185,14 +180,23 @@ DmaPort::recvTiming(PacketPtr pkt) } DmaDevice::DmaDevice(const Params *p) - : PioDevice(p), dmaPort(NULL) + : PioDevice(p), dmaPort(this, sys, params()->min_backoff_delay, + params()->max_backoff_delay) { } +void +DmaDevice::init() +{ + if (!dmaPort.isConnected()) + panic("DMA port of %s not connected to anything!", name()); + PioDevice::init(); +} + unsigned int DmaDevice::drain(Event *de) { unsigned int count; - count = pioPort->drain(de) + dmaPort->drain(de); + count = pioPort.drain(de) + dmaPort.drain(de); if (count) changeState(Draining); else @@ -362,8 +366,6 @@ DmaPort::sendDma() DmaDevice::~DmaDevice() { - if (dmaPort) - delete dmaPort; } @@ -371,12 +373,7 @@ Port * DmaDevice::getPort(const std::string &if_name, int idx) { if (if_name == "dma") { - if (dmaPort != NULL) - fatal("%s: dma port already connected to %s", - name(), dmaPort->getPeer()->name()); - dmaPort = new DmaPort(this, sys, params()->min_backoff_delay, - params()->max_backoff_delay); - return dmaPort; + return &dmaPort; } return PioDevice::getPort(if_name, idx); } diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh index c5f6958ee..d7ed93805 100644 --- a/src/dev/io_device.hh +++ b/src/dev/io_device.hh @@ -192,7 +192,7 @@ class PioDevice : public MemObject /** The pioPort that handles the requests for us and provides us requests * that it sees. */ - PioPort *pioPort; + PioPort pioPort; /** * Every PIO device is obliged to provide an implementation that @@ -271,7 +271,7 @@ class BasicPioDevice : public PioDevice class DmaDevice : public PioDevice { protected: - DmaPort *dmaPort; + DmaPort dmaPort; public: typedef DmaDeviceParams Params; @@ -284,21 +284,25 @@ class DmaDevice : public PioDevice return dynamic_cast<const Params *>(_params); } - void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, Tick delay = 0) + void dmaWrite(Addr addr, int size, Event *event, uint8_t *data, + Tick delay = 0) { - dmaPort->dmaAction(MemCmd::WriteReq, addr, size, event, data, delay); + dmaPort.dmaAction(MemCmd::WriteReq, addr, size, event, data, delay); } - void dmaRead(Addr addr, int size, Event *event, uint8_t *data, Tick delay = 0) + void dmaRead(Addr addr, int size, Event *event, uint8_t *data, + Tick delay = 0) { - dmaPort->dmaAction(MemCmd::ReadReq, addr, size, event, data, delay); + dmaPort.dmaAction(MemCmd::ReadReq, addr, size, event, data, delay); } - bool dmaPending() { return dmaPort->dmaPending(); } + bool dmaPending() { return dmaPort.dmaPending(); } + + virtual void init(); virtual unsigned int drain(Event *de); - unsigned cacheBlockSize() const { return dmaPort->cacheBlockSize(); } + unsigned cacheBlockSize() const { return dmaPort.cacheBlockSize(); } virtual Port *getPort(const std::string &if_name, int idx = -1); diff --git a/src/dev/mips/malta_pchip.cc b/src/dev/mips/malta_pchip.cc index dd1993cc6..fe00f98dd 100755 --- a/src/dev/mips/malta_pchip.cc +++ b/src/dev/mips/malta_pchip.cc @@ -283,7 +283,8 @@ MaltaPChip::translatePciToDma(Addr busAddr) baMask = (wsm[i] & (ULL(0xfff) << 20)) | (ULL(0x7f) << 13); pteAddr = (tba[i] & tbaMask) | ((busAddr & baMask) >> 10); - pioPort->readBlob(pteAddr, (uint8_t*)&pteEntry, sizeof(uint64_t)); + pioPort.readBlob(pteAddr, (uint8_t*)&pteEntry, + sizeof(uint64_t)); dmaAddr = ((pteEntry & ~ULL(0x1)) << 12) | (busAddr & ULL(0x1fff)); diff --git a/src/dev/pcidev.cc b/src/dev/pcidev.cc index cb27f8b3d..3c15bb002 100644 --- a/src/dev/pcidev.cc +++ b/src/dev/pcidev.cc @@ -82,7 +82,9 @@ PciDev::PciConfigPort::getAddrRanges() PciDev::PciDev(const Params *p) : DmaDevice(p), platform(p->platform), pioDelay(p->pio_latency), - configDelay(p->config_latency), configPort(NULL) + configDelay(p->config_latency), + configPort(this, params()->pci_bus, params()->pci_dev, + params()->pci_func, params()->platform) { config.vendor = htole(p->VendorID); config.device = htole(p->DeviceID); @@ -148,17 +150,17 @@ PciDev::PciDev(const Params *p) void PciDev::init() { - if (!configPort && !configPort->isConnected()) + if (!configPort.isConnected()) panic("PCI config port on %s not connected to anything!\n", name()); - configPort->sendRangeChange(); - PioDevice::init(); + configPort.sendRangeChange(); + DmaDevice::init(); } unsigned int PciDev::drain(Event *de) { unsigned int count; - count = pioPort->drain(de) + dmaPort->drain(de) + configPort->drain(de); + count = pioPort.drain(de) + dmaPort.drain(de) + configPort.drain(de); if (count) changeState(Draining); else @@ -300,7 +302,7 @@ PciDev::writeConfig(PacketPtr pkt) BARAddrs[barnum] = BAR_IO_SPACE(he_old_bar) ? platform->calcPciIOAddr(he_new_bar) : platform->calcPciMemAddr(he_new_bar); - pioPort->sendRangeChange(); + pioPort.sendRangeChange(); } } config.baseAddr[barnum] = htole((he_new_bar & ~bar_mask) | @@ -353,7 +355,7 @@ PciDev::unserialize(Checkpoint *cp, const std::string §ion) UNSERIALIZE_ARRAY(BARAddrs, sizeof(BARAddrs) / sizeof(BARAddrs[0])); UNSERIALIZE_ARRAY(config.data, sizeof(config.data) / sizeof(config.data[0])); - pioPort->sendRangeChange(); + pioPort.sendRangeChange(); } diff --git a/src/dev/pcidev.hh b/src/dev/pcidev.hh index c0c3df0a6..07089fd0e 100644 --- a/src/dev/pcidev.hh +++ b/src/dev/pcidev.hh @@ -151,7 +151,7 @@ class PciDev : public DmaDevice Platform *platform; Tick pioDelay; Tick configDelay; - PciConfigPort *configPort; + PciConfigPort configPort; /** * Write to the PCI config space data that is stored locally. This may be @@ -221,12 +221,7 @@ class PciDev : public DmaDevice virtual Port *getPort(const std::string &if_name, int idx = -1) { if (if_name == "config") { - if (configPort != NULL) - panic("pciconfig port already connected to."); - configPort = new PciConfigPort(this, params()->pci_bus, - params()->pci_dev, params()->pci_func, - params()->platform); - return configPort; + return &configPort; } return DmaDevice::getPort(if_name, idx); } diff --git a/src/dev/sinic.cc b/src/dev/sinic.cc index 741442918..1030e1a9c 100644 --- a/src/dev/sinic.cc +++ b/src/dev/sinic.cc @@ -1714,7 +1714,7 @@ Device::unserialize(Checkpoint *cp, const std::string §ion) if (transmitTick) schedule(txEvent, curTick() + transmitTick); - pioPort->sendRangeChange(); + pioPort.sendRangeChange(); } diff --git a/src/dev/x86/i82094aa.cc b/src/dev/x86/i82094aa.cc index d9c07f5ae..3d7454dfd 100644 --- a/src/dev/x86/i82094aa.cc +++ b/src/dev/x86/i82094aa.cc @@ -222,8 +222,8 @@ X86ISA::I82094AA::signalInterrupt(int line) apics.push_back(selected); } } - intPort->sendMessage(apics, message, - sys->getMemoryMode() == Enums::timing); + intPort.sendMessage(apics, message, + sys->getMemoryMode() == Enums::timing); } } diff --git a/src/dev/x86/i82094aa.hh b/src/dev/x86/i82094aa.hh index 60ef27012..f0837cc27 100644 --- a/src/dev/x86/i82094aa.hh +++ b/src/dev/x86/i82094aa.hh @@ -124,7 +124,7 @@ class I82094AA : public PioDevice, public IntDev Port *getPort(const std::string &if_name, int idx = -1) { if (if_name == "int_master") - return intPort; + return &intPort; return PioDevice::getPort(if_name, idx); } diff --git a/src/dev/x86/intdev.cc b/src/dev/x86/intdev.cc index a991005bc..23ec20b9a 100644 --- a/src/dev/x86/intdev.cc +++ b/src/dev/x86/intdev.cc @@ -51,10 +51,10 @@ X86ISA::IntDev::IntPort::sendMessage(ApicList apics, void X86ISA::IntDev::init() { - if (!intPort) { + if (!intPort.isConnected()) { panic("Int port not connected to anything!"); } - intPort->sendRangeChange(); + intPort.sendRangeChange(); } X86ISA::IntSourcePin * diff --git a/src/dev/x86/intdev.hh b/src/dev/x86/intdev.hh index 05b4d12a1..5549df637 100644 --- a/src/dev/x86/intdev.hh +++ b/src/dev/x86/intdev.hh @@ -84,17 +84,12 @@ class IntDev TriggerIntMessage message, bool timing); }; - IntPort * intPort; + IntPort intPort; public: - IntDev(MemObject * parent, Tick latency = 0) + IntDev(MemObject * parent, Tick latency = 0) : + intPort(parent->name() + ".int_master", parent, this, latency) { - if (parent != NULL) { - intPort = new IntPort(parent->name() + ".int_master", - parent, this, latency); - } else { - intPort = NULL; - } } virtual ~IntDev() |