From 475f613f2661f3be5f7479c5c7229e5adcb74d93 Mon Sep 17 00:00:00 2001 From: Sean Wilson Date: Wed, 7 Jun 2017 13:23:09 -0500 Subject: [PATCH] arm: Replace EventWrapper use with EventFunctionWrapper Change-Id: I08de5f72513645d1fe92bde99fa205dde897e951 Signed-off-by: Sean Wilson Reviewed-on: https://gem5-review.googlesource.com/3747 Reviewed-by: Jason Lowe-Power Reviewed-by: Anthony Gutierrez Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- src/arch/arm/table_walker.cc | 11 +++++++---- src/arch/arm/table_walker.hh | 20 +++++++------------- src/dev/arm/energy_ctrl.cc | 2 +- src/dev/arm/energy_ctrl.hh | 2 +- src/dev/arm/flash_device.cc | 2 +- src/dev/arm/flash_device.hh | 2 +- src/dev/arm/generic_timer.cc | 2 +- src/dev/arm/generic_timer.hh | 3 +-- src/dev/arm/hdlcd.cc | 2 +- src/dev/arm/hdlcd.hh | 2 +- src/dev/arm/kmi.cc | 3 ++- src/dev/arm/kmi.hh | 2 +- src/dev/arm/pl011.cc | 2 +- src/dev/arm/pl011.hh | 2 +- src/dev/arm/pl111.cc | 7 +++++-- src/dev/arm/pl111.hh | 6 +++--- src/dev/arm/rtc_pl031.cc | 3 ++- src/dev/arm/rtc_pl031.hh | 2 +- src/dev/arm/timer_cpulocal.cc | 4 +++- src/dev/arm/timer_cpulocal.hh | 4 ++-- src/dev/arm/timer_sp804.cc | 3 ++- src/dev/arm/timer_sp804.hh | 2 +- src/dev/arm/ufs_device.cc | 8 ++++++-- src/dev/arm/ufs_device.hh | 6 ++---- 24 files changed, 54 insertions(+), 48 deletions(-) diff --git a/src/arch/arm/table_walker.cc b/src/arch/arm/table_walker.cc index 8783d0a00..2d6664264 100644 --- a/src/arch/arm/table_walker.cc +++ b/src/arch/arm/table_walker.cc @@ -64,12 +64,15 @@ TableWalker::TableWalker(const Params *p) numSquashable(p->num_squash_per_cycle), pendingReqs(0), pendingChangeTick(curTick()), - doL1DescEvent(this), doL2DescEvent(this), - doL0LongDescEvent(this), doL1LongDescEvent(this), - doL2LongDescEvent(this), doL3LongDescEvent(this), + doL1DescEvent([this]{ doL1DescriptorWrapper(); }, name()), + doL2DescEvent([this]{ doL2DescriptorWrapper(); }, name()), + doL0LongDescEvent([this]{ doL0LongDescriptorWrapper(); }, name()), + doL1LongDescEvent([this]{ doL1LongDescriptorWrapper(); }, name()), + doL2LongDescEvent([this]{ doL2LongDescriptorWrapper(); }, name()), + doL3LongDescEvent([this]{ doL3LongDescriptorWrapper(); }, name()), LongDescEventByLevel { &doL0LongDescEvent, &doL1LongDescEvent, &doL2LongDescEvent, &doL3LongDescEvent }, - doProcessEvent(this) + doProcessEvent([this]{ processWalkWrapper(); }, name()) { sctlr = 0; diff --git a/src/arch/arm/table_walker.hh b/src/arch/arm/table_walker.hh index c52cfcb4c..b322c50d7 100644 --- a/src/arch/arm/table_walker.hh +++ b/src/arch/arm/table_walker.hh @@ -920,28 +920,22 @@ class TableWalker : public MemObject void doL1Descriptor(); void doL1DescriptorWrapper(); - EventWrapper doL1DescEvent; + EventFunctionWrapper doL1DescEvent; void doL2Descriptor(); void doL2DescriptorWrapper(); - EventWrapper doL2DescEvent; + EventFunctionWrapper doL2DescEvent; void doLongDescriptor(); void doL0LongDescriptorWrapper(); - EventWrapper doL0LongDescEvent; + EventFunctionWrapper doL0LongDescEvent; void doL1LongDescriptorWrapper(); - EventWrapper doL1LongDescEvent; + EventFunctionWrapper doL1LongDescEvent; void doL2LongDescriptorWrapper(); - EventWrapper doL2LongDescEvent; + EventFunctionWrapper doL2LongDescEvent; void doL3LongDescriptorWrapper(); - EventWrapper doL3LongDescEvent; + EventFunctionWrapper doL3LongDescEvent; void doLongDescriptorWrapper(LookupLevel curr_lookup_level); Event* LongDescEventByLevel[4]; @@ -960,7 +954,7 @@ class TableWalker : public MemObject static bool checkAddrSizeFaultAArch64(Addr addr, int currPhysAddrRange); Fault processWalkAArch64(); void processWalkWrapper(); - EventWrapper doProcessEvent; + EventFunctionWrapper doProcessEvent; void nextWalk(ThreadContext *tc); diff --git a/src/dev/arm/energy_ctrl.cc b/src/dev/arm/energy_ctrl.cc index 9efdeb129..9cfce3a48 100644 --- a/src/dev/arm/energy_ctrl.cc +++ b/src/dev/arm/energy_ctrl.cc @@ -54,7 +54,7 @@ EnergyCtrl::EnergyCtrl(const Params *p) domainIDIndexToRead(0), perfLevelAck(0), perfLevelToRead(0), - updateAckEvent(this) + updateAckEvent([this]{ updatePLAck(); }, name()) { fatal_if(!p->dvfs_handler, "EnergyCtrl: Needs a DVFSHandler for a " "functioning system.\n"); diff --git a/src/dev/arm/energy_ctrl.hh b/src/dev/arm/energy_ctrl.hh index ddfd8d7c7..2c7eb85f6 100644 --- a/src/dev/arm/energy_ctrl.hh +++ b/src/dev/arm/energy_ctrl.hh @@ -182,6 +182,6 @@ class EnergyCtrl : public BasicPioDevice perfLevelAck = 1; } - EventWrapper updateAckEvent; + EventFunctionWrapper updateAckEvent; }; #endif //__DEV_ARM_ENERGY_CTRL_HH__ diff --git a/src/dev/arm/flash_device.cc b/src/dev/arm/flash_device.cc index 3dc8d5bd2..ba28cff4b 100644 --- a/src/dev/arm/flash_device.cc +++ b/src/dev/arm/flash_device.cc @@ -88,7 +88,7 @@ FlashDevice::FlashDevice(const FlashDeviceParams* p): blocksPerDisk(0), planeMask(numPlanes - 1), planeEventQueue(numPlanes), - planeEvent(this) + planeEvent([this]{ actionComplete(); }, name()) { /* diff --git a/src/dev/arm/flash_device.hh b/src/dev/arm/flash_device.hh index 307bc042c..f5a3bfdee 100644 --- a/src/dev/arm/flash_device.hh +++ b/src/dev/arm/flash_device.hh @@ -192,6 +192,6 @@ class FlashDevice : public AbstractNVM std::vector > planeEventQueue; /** Completion event */ - EventWrapper planeEvent; + EventFunctionWrapper planeEvent; }; #endif //__DEV_ARM_FLASH_DEVICE_HH__ diff --git a/src/dev/arm/generic_timer.cc b/src/dev/arm/generic_timer.cc index d33090d74..efaebb1ba 100644 --- a/src/dev/arm/generic_timer.cc +++ b/src/dev/arm/generic_timer.cc @@ -95,7 +95,7 @@ ArchTimer::ArchTimer(const std::string &name, : _name(name), _parent(parent), _systemCounter(sysctr), _interrupt(interrupt), _control(0), _counterLimit(0), _offset(0), - _counterLimitReachedEvent(this) + _counterLimitReachedEvent([this]{ counterLimitReached(); }, name) { } diff --git a/src/dev/arm/generic_timer.hh b/src/dev/arm/generic_timer.hh index c606f1e60..3a3895489 100644 --- a/src/dev/arm/generic_timer.hh +++ b/src/dev/arm/generic_timer.hh @@ -157,8 +157,7 @@ class ArchTimer : public Serializable /// Called when the upcounter reaches the programmed value. void counterLimitReached(); - EventWrapper - _counterLimitReachedEvent; + EventFunctionWrapper _counterLimitReachedEvent; public: ArchTimer(const std::string &name, diff --git a/src/dev/arm/hdlcd.cc b/src/dev/arm/hdlcd.cc index 081fec2ff..98f2a3d44 100644 --- a/src/dev/arm/hdlcd.cc +++ b/src/dev/arm/hdlcd.cc @@ -83,7 +83,7 @@ HDLcd::HDLcd(const HDLcdParams *p) pixel_format(0), red_select(0), green_select(0), blue_select(0), - virtRefreshEvent(this), + virtRefreshEvent([this]{ virtRefresh(); }, name()), // Other bmp(&pixelPump.fb), pic(NULL), conv(PixelConverter::rgba8888_le), pixelPump(*this, *p->pxl_clk, p->pixel_chunk) diff --git a/src/dev/arm/hdlcd.hh b/src/dev/arm/hdlcd.hh index 4bca0bbbf..ecfe1ea87 100644 --- a/src/dev/arm/hdlcd.hh +++ b/src/dev/arm/hdlcd.hh @@ -347,7 +347,7 @@ class HDLcd: public AmbaDmaDevice /** Handler for fast frame refresh in KVM-mode */ void virtRefresh(); - EventWrapper virtRefreshEvent; + EventFunctionWrapper virtRefreshEvent; /** Helper to write out bitmaps */ Bitmap bmp; diff --git a/src/dev/arm/kmi.cc b/src/dev/arm/kmi.cc index 9230c15d2..8db925471 100644 --- a/src/dev/arm/kmi.cc +++ b/src/dev/arm/kmi.cc @@ -54,7 +54,8 @@ Pl050::Pl050(const Params *p) : AmbaIntDevice(p, 0xfff), control(0), status(0x43), clkdiv(0), rawInterrupts(0), ackNext(false), shiftDown(false), - vnc(p->vnc), driverInitialized(false), intEvent(this) + vnc(p->vnc), driverInitialized(false), + intEvent([this]{ generateInterrupt(); }, name()) { if (vnc) { if (!p->is_mouse) diff --git a/src/dev/arm/kmi.hh b/src/dev/arm/kmi.hh index 55e4b4285..0593165c0 100644 --- a/src/dev/arm/kmi.hh +++ b/src/dev/arm/kmi.hh @@ -134,7 +134,7 @@ class Pl050 : public AmbaIntDevice, public VncKeyboard, public VncMouse return tmp_interrupt; } /** Wrapper to create an event out of the thing */ - EventWrapper intEvent; + EventFunctionWrapper intEvent; /** Receive queue. This list contains all the pending commands that * need to be sent to the driver diff --git a/src/dev/arm/pl011.cc b/src/dev/arm/pl011.cc index f7f5d2d0a..479a28bd8 100644 --- a/src/dev/arm/pl011.cc +++ b/src/dev/arm/pl011.cc @@ -56,7 +56,7 @@ Pl011::Pl011(const Pl011Params *p) : Uart(p, 0xfff), - intEvent(this), + intEvent([this]{ generateInterrupt(); }, name()), control(0x300), fbrd(0), ibrd(0), lcrh(0), ifls(0x12), imsc(0), rawInt(0), gic(p->gic), endOnEOT(p->end_on_eot), intNum(p->int_num), diff --git a/src/dev/arm/pl011.hh b/src/dev/arm/pl011.hh index 81745eded..d6c839c4d 100644 --- a/src/dev/arm/pl011.hh +++ b/src/dev/arm/pl011.hh @@ -113,7 +113,7 @@ class Pl011 : public Uart, public AmbaDevice inline uint16_t maskInt() const { return rawInt & imsc; } /** Wrapper to create an event out of the thing */ - EventWrapper intEvent; + EventFunctionWrapper intEvent; protected: // Registers static const uint64_t AMBA_ID = ULL(0xb105f00d00341011); diff --git a/src/dev/arm/pl111.cc b/src/dev/arm/pl111.cc index b12e7a352..344eb0864 100644 --- a/src/dev/arm/pl111.cc +++ b/src/dev/arm/pl111.cc @@ -68,10 +68,13 @@ Pl111::Pl111(const Params *p) vnc(p->vnc), bmp(&fb), pic(NULL), width(LcdMaxWidth), height(LcdMaxHeight), bytesPerPixel(4), startTime(0), startAddr(0), maxAddr(0), curAddr(0), - waterMark(0), dmaPendingNum(0), readEvent(this), fillFifoEvent(this), + waterMark(0), dmaPendingNum(0), + readEvent([this]{ readFramebuffer(); }, name()), + fillFifoEvent([this]{ fillFifo(); }, name()), dmaDoneEventAll(maxOutstandingDma, this), dmaDoneEventFree(maxOutstandingDma), - intEvent(this), enableCapture(p->enable_capture) + intEvent([this]{ generateInterrupt(); }, name()), + enableCapture(p->enable_capture) { pioSize = 0xFFFF; diff --git a/src/dev/arm/pl111.hh b/src/dev/arm/pl111.hh index aea78709c..a9189e9a1 100644 --- a/src/dev/arm/pl111.hh +++ b/src/dev/arm/pl111.hh @@ -325,10 +325,10 @@ class Pl111: public AmbaDmaDevice void dmaDone(); /** DMA framebuffer read event */ - EventWrapper readEvent; + EventFunctionWrapper readEvent; /** Fill fifo */ - EventWrapper fillFifoEvent; + EventFunctionWrapper fillFifoEvent; /**@{*/ /** @@ -354,7 +354,7 @@ class Pl111: public AmbaDmaDevice /**@}*/ /** Wrapper to create an event out of the interrupt */ - EventWrapper intEvent; + EventFunctionWrapper intEvent; bool enableCapture; diff --git a/src/dev/arm/rtc_pl031.cc b/src/dev/arm/rtc_pl031.cc index 46c5d28e7..3d8e677b9 100644 --- a/src/dev/arm/rtc_pl031.cc +++ b/src/dev/arm/rtc_pl031.cc @@ -51,7 +51,8 @@ PL031::PL031(Params *p) : AmbaIntDevice(p, 0xfff), timeVal(mkutctime(&p->time)), lastWrittenTick(0), loadVal(0), matchVal(0), - rawInt(false), maskInt(false), pendingInt(false), matchEvent(this) + rawInt(false), maskInt(false), pendingInt(false), + matchEvent([this]{ counterMatch(); }, name()) { } diff --git a/src/dev/arm/rtc_pl031.hh b/src/dev/arm/rtc_pl031.hh index d3f1295dd..1ecadd4ca 100644 --- a/src/dev/arm/rtc_pl031.hh +++ b/src/dev/arm/rtc_pl031.hh @@ -91,7 +91,7 @@ class PL031 : public AmbaIntDevice /** Called when the counter reaches matches */ void counterMatch(); - EventWrapper matchEvent; + EventFunctionWrapper matchEvent; /** Called to update the matchEvent when the load Value or match value are * written. diff --git a/src/dev/arm/timer_cpulocal.cc b/src/dev/arm/timer_cpulocal.cc index 448ac2189..033031547 100644 --- a/src/dev/arm/timer_cpulocal.cc +++ b/src/dev/arm/timer_cpulocal.cc @@ -66,7 +66,9 @@ CpuLocalTimer::CpuLocalTimer(Params *p) CpuLocalTimer::Timer::Timer() : timerControl(0x0), watchdogControl(0x0), rawIntTimer(false), rawIntWatchdog(false), rawResetWatchdog(false), watchdogDisableReg(0x0), pendingIntTimer(false), pendingIntWatchdog(false), - timerLoadValue(0x0), watchdogLoadValue(0x0), timerZeroEvent(this), watchdogZeroEvent(this) + timerLoadValue(0x0), watchdogLoadValue(0x0), + timerZeroEvent([this]{ timerAtZero(); }, name()), + watchdogZeroEvent([this]{ watchdogAtZero(); }, name()) { } diff --git a/src/dev/arm/timer_cpulocal.hh b/src/dev/arm/timer_cpulocal.hh index fc52b3da0..425f1fd6b 100644 --- a/src/dev/arm/timer_cpulocal.hh +++ b/src/dev/arm/timer_cpulocal.hh @@ -125,10 +125,10 @@ class CpuLocalTimer : public BasicPioDevice /** Called when the counter reaches 0 */ void timerAtZero(); - EventWrapper timerZeroEvent; + EventFunctionWrapper timerZeroEvent; void watchdogAtZero(); - EventWrapper watchdogZeroEvent; + EventFunctionWrapper watchdogZeroEvent; public: /** Restart the counter ticking at val * @param val the value to start at */ diff --git a/src/dev/arm/timer_sp804.cc b/src/dev/arm/timer_sp804.cc index 99c722d79..86fbc7f05 100644 --- a/src/dev/arm/timer_sp804.cc +++ b/src/dev/arm/timer_sp804.cc @@ -56,7 +56,8 @@ Sp804::Sp804(Params *p) Sp804::Timer::Timer(std::string __name, Sp804 *_parent, int int_num, Tick _clock) : _name(__name), parent(_parent), intNum(int_num), clock(_clock), control(0x20), - rawInt(false), pendingInt(false), loadValue(0xffffffff), zeroEvent(this) + rawInt(false), pendingInt(false), loadValue(0xffffffff), + zeroEvent([this]{ counterAtZero(); }, name()) { } diff --git a/src/dev/arm/timer_sp804.hh b/src/dev/arm/timer_sp804.hh index fafbeba28..509d95c9f 100644 --- a/src/dev/arm/timer_sp804.hh +++ b/src/dev/arm/timer_sp804.hh @@ -104,7 +104,7 @@ class Sp804 : public AmbaPioDevice /** Called when the counter reaches 0 */ void counterAtZero(); - EventWrapper zeroEvent; + EventFunctionWrapper zeroEvent; public: /** Restart the counter ticking at val diff --git a/src/dev/arm/ufs_device.cc b/src/dev/arm/ufs_device.cc index fe05b3279..5a5a13215 100644 --- a/src/dev/arm/ufs_device.cc +++ b/src/dev/arm/ufs_device.cc @@ -1890,7 +1890,9 @@ UFSHostDevice::writeDevice(Event* additional_action, bool toDisk, Addr < curTick())) writeDoneEvent.pop_front(); - writeDoneEvent.push_back(this); + writeDoneEvent.push_back( + EventFunctionWrapper([this]{ writeDone(); }, + name())); assert(!writeDoneEvent.back().scheduled()); /**destination is an offset here since we are writing to a disk*/ @@ -2089,7 +2091,9 @@ UFSHostDevice::readDevice(bool lastTransfer, Addr start, uint32_t size, /** check wether interrupt is needed */ if (lastTransfer) { ++readPendingNum; - readDoneEvent.push_back(this); + readDoneEvent.push_back( + EventFunctionWrapper([this]{ readDone(); }, + name())); assert(!readDoneEvent.back().scheduled()); dmaPort.dmaAction(MemCmd::WriteReq, start, size, &readDoneEvent.back(), destination, 0); diff --git a/src/dev/arm/ufs_device.hh b/src/dev/arm/ufs_device.hh index 435d5f59f..24a05b022 100644 --- a/src/dev/arm/ufs_device.hh +++ b/src/dev/arm/ufs_device.hh @@ -1129,10 +1129,8 @@ class UFSHostDevice : public DmaDevice * because the flow of the events is completely in the control of these * classes. (Whereas in the DMA case we rely on an external class) */ - std::deque > - readDoneEvent; - std::deque > - writeDoneEvent; + std::deque readDoneEvent; + std::deque writeDoneEvent; /** * Callbacks for the logic units. One to indicate the completion of a -- 2.30.2