From b61e34fab8a653a5e015e4b9b0f4a121ca59335c Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Mon, 10 Oct 2011 17:01:33 -0500 Subject: mc146818: Correctly serialize tickEvent 'tickEvent' was not being serialized as in its place 'event' was being used. This patch rectifies this error. --- src/dev/mc146818.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dev') diff --git a/src/dev/mc146818.cc b/src/dev/mc146818.cc index 9397a599b..b0aaf6e64 100644 --- a/src/dev/mc146818.cc +++ b/src/dev/mc146818.cc @@ -217,7 +217,7 @@ MC146818::serialize(const string &base, ostream &os) // Tick rtcTimerInterruptTickOffset = event.when() - curTick(); SERIALIZE_SCALAR(rtcTimerInterruptTickOffset); - Tick rtcClockTickOffset = event.when() - curTick(); + Tick rtcClockTickOffset = tickEvent.when() - curTick(); SERIALIZE_SCALAR(rtcClockTickOffset); } -- cgit v1.2.3 From 38aef4c4c7e58e9166616554465bea70afab824f Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 20 Oct 2011 13:11:56 -0700 Subject: dev: clean up PioDevice and DmaDevive getPort() methods. Make DmaDevice::getPort() call PioDevice::getPort() instead of just copying and pasting the code. Also move definitions from .hh to .cc file. --- src/dev/io_device.cc | 28 ++++++++++++++++++++++++++++ src/dev/io_device.hh | 32 +++----------------------------- 2 files changed, 31 insertions(+), 29 deletions(-) (limited to 'src/dev') diff --git a/src/dev/io_device.cc b/src/dev/io_device.cc index bfdf3d486..5e2395bf9 100644 --- a/src/dev/io_device.cc +++ b/src/dev/io_device.cc @@ -75,6 +75,18 @@ PioDevice::init() pioPort->sendStatusChange(Port::RangeChange); } +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 NULL; +} unsigned int PioDevice::drain(Event *de) @@ -349,3 +361,19 @@ DmaDevice::~DmaDevice() if (dmaPort) delete dmaPort; } + + +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 PioDevice::getPort(if_name, idx); +} + diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh index bc6f1d4f7..812c276d6 100644 --- a/src/dev/io_device.hh +++ b/src/dev/io_device.hh @@ -215,17 +215,8 @@ class PioDevice : public MemObject virtual unsigned int drain(Event *de); - virtual Port *getPort(const std::string &if_name, int idx = -1) - { - 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; - } else - return NULL; - } + virtual Port *getPort(const std::string &if_name, int idx = -1); + friend class PioPort; }; @@ -291,24 +282,7 @@ class DmaDevice : public PioDevice unsigned cacheBlockSize() const { return dmaPort->cacheBlockSize(); } - virtual Port *getPort(const std::string &if_name, int idx = -1) - { - 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; - } else 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; - } else - return NULL; - } + virtual Port *getPort(const std::string &if_name, int idx = -1); friend class DmaPort; }; -- cgit v1.2.3