arm: Replace EventWrapper use with EventFunctionWrapper
authorSean Wilson <spwilson2@wisc.edu>
Wed, 7 Jun 2017 18:23:09 +0000 (13:23 -0500)
committerSean Wilson <spwilson2@wisc.edu>
Tue, 20 Jun 2017 18:03:21 +0000 (18:03 +0000)
Change-Id: I08de5f72513645d1fe92bde99fa205dde897e951
Signed-off-by: Sean Wilson <spwilson2@wisc.edu>
Reviewed-on: https://gem5-review.googlesource.com/3747
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

24 files changed:
src/arch/arm/table_walker.cc
src/arch/arm/table_walker.hh
src/dev/arm/energy_ctrl.cc
src/dev/arm/energy_ctrl.hh
src/dev/arm/flash_device.cc
src/dev/arm/flash_device.hh
src/dev/arm/generic_timer.cc
src/dev/arm/generic_timer.hh
src/dev/arm/hdlcd.cc
src/dev/arm/hdlcd.hh
src/dev/arm/kmi.cc
src/dev/arm/kmi.hh
src/dev/arm/pl011.cc
src/dev/arm/pl011.hh
src/dev/arm/pl111.cc
src/dev/arm/pl111.hh
src/dev/arm/rtc_pl031.cc
src/dev/arm/rtc_pl031.hh
src/dev/arm/timer_cpulocal.cc
src/dev/arm/timer_cpulocal.hh
src/dev/arm/timer_sp804.cc
src/dev/arm/timer_sp804.hh
src/dev/arm/ufs_device.cc
src/dev/arm/ufs_device.hh

index 8783d0a00bb914b3a3a626895d3a9ab5c510d12f..2d6664264c2a859831ad357451cda757b0dba84d 100644 (file)
@@ -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;
 
index c52cfcb4c9ed1ca4b0cea017eaaf39ee5368d7bb..b322c50d71704e0eaab9969d3130f2b384a80d3f 100644 (file)
@@ -920,28 +920,22 @@ class TableWalker : public MemObject
 
     void doL1Descriptor();
     void doL1DescriptorWrapper();
-    EventWrapper<TableWalker,
-                 &TableWalker::doL1DescriptorWrapper> doL1DescEvent;
+    EventFunctionWrapper doL1DescEvent;
 
     void doL2Descriptor();
     void doL2DescriptorWrapper();
-    EventWrapper<TableWalker,
-                 &TableWalker::doL2DescriptorWrapper> doL2DescEvent;
+    EventFunctionWrapper doL2DescEvent;
 
     void doLongDescriptor();
 
     void doL0LongDescriptorWrapper();
-    EventWrapper<TableWalker,
-                 &TableWalker::doL0LongDescriptorWrapper> doL0LongDescEvent;
+    EventFunctionWrapper doL0LongDescEvent;
     void doL1LongDescriptorWrapper();
-    EventWrapper<TableWalker,
-                 &TableWalker::doL1LongDescriptorWrapper> doL1LongDescEvent;
+    EventFunctionWrapper doL1LongDescEvent;
     void doL2LongDescriptorWrapper();
-    EventWrapper<TableWalker,
-                 &TableWalker::doL2LongDescriptorWrapper> doL2LongDescEvent;
+    EventFunctionWrapper doL2LongDescEvent;
     void doL3LongDescriptorWrapper();
-    EventWrapper<TableWalker,
-                 &TableWalker::doL3LongDescriptorWrapper> 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<TableWalker, &TableWalker::processWalkWrapper> doProcessEvent;
+    EventFunctionWrapper doProcessEvent;
 
     void nextWalk(ThreadContext *tc);
 
index 9efdeb12972f6d4f07389499c371139993ee7e75..9cfce3a48777fbbc3a63d9c41d4c5c70fe47cad3 100644 (file)
@@ -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");
index ddfd8d7c7913f1cc0e568b90087a95b1d831e488..2c7eb85f600e5d766e07e7388a69477e069e4c16 100644 (file)
@@ -182,6 +182,6 @@ class EnergyCtrl : public BasicPioDevice
         perfLevelAck = 1;
     }
 
-    EventWrapper<EnergyCtrl, &EnergyCtrl::updatePLAck> updateAckEvent;
+    EventFunctionWrapper updateAckEvent;
 };
 #endif //__DEV_ARM_ENERGY_CTRL_HH__
index 3dc8d5bd20381027bbdd93cff3283b64548ff475..ba28cff4bfc675cca21f80a2b834f9c876e31e00 100644 (file)
@@ -88,7 +88,7 @@ FlashDevice::FlashDevice(const FlashDeviceParams* p):
     blocksPerDisk(0),
     planeMask(numPlanes - 1),
     planeEventQueue(numPlanes),
-    planeEvent(this)
+    planeEvent([this]{ actionComplete(); }, name())
 {
 
     /*
index 307bc042c0801639f0de52c345f0d7f3a7ce6149..f5a3bfdee4e2ba31146e814fc46a4a1f385bb4f3 100644 (file)
@@ -192,6 +192,6 @@ class FlashDevice : public AbstractNVM
     std::vector<std::deque<struct CallBackEntry> > planeEventQueue;
 
     /** Completion event */
-    EventWrapper<FlashDevice, &FlashDevice::actionComplete> planeEvent;
+    EventFunctionWrapper planeEvent;
 };
 #endif //__DEV_ARM_FLASH_DEVICE_HH__
index d33090d743ef7d426c4627b7364a85b847c972a3..efaebb1bad2e3c72845e770b68a7930fd01cf7a1 100644 (file)
@@ -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)
 {
 }
 
index c606f1e60e85396c2ab8f9107a09e90dec7750df..3a389548922385df542de3c8282da1fd460efe65 100644 (file)
@@ -157,8 +157,7 @@ class ArchTimer : public Serializable
 
     /// Called when the upcounter reaches the programmed value.
     void counterLimitReached();
-    EventWrapper<ArchTimer, &ArchTimer::counterLimitReached>
-    _counterLimitReachedEvent;
+    EventFunctionWrapper _counterLimitReachedEvent;
 
   public:
     ArchTimer(const std::string &name,
index 081fec2ffdb5ef937fcf2474256fb75c9bd0970f..98f2a3d44c5708f71e80409f863fa90aa0c9c9c8 100644 (file)
@@ -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)
index 4bca0bbbf64ccacac5485685227d434db613a35a..ecfe1ea87a8a041d74ae6a8860745b6a4025d85b 100644 (file)
@@ -347,7 +347,7 @@ class HDLcd: public AmbaDmaDevice
 
     /** Handler for fast frame refresh in KVM-mode */
     void virtRefresh();
-    EventWrapper<HDLcd, &HDLcd::virtRefresh> virtRefreshEvent;
+    EventFunctionWrapper virtRefreshEvent;
 
     /** Helper to write out bitmaps */
     Bitmap bmp;
index 9230c15d2636546262812616f224a68a816a11e9..8db925471ab5ae6d4992cfbd64e1721f8dccd9bf 100644 (file)
@@ -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)
index 55e4b4285ac9f900dbaf8d9dfc5103cacfb9477b..0593165c0949440304c1ee3d9dad63d243cd51a6 100644 (file)
@@ -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<Pl050, &Pl050::generateInterrupt> intEvent;
+    EventFunctionWrapper intEvent;
 
     /** Receive queue. This list contains all the pending commands that
      * need to be sent to the driver
index f7f5d2d0a28dd78ee86e71b2f22cd27c865618f8..479a28bd8a2f8a8110455744e818db94c2afc8aa 100644 (file)
@@ -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),
index 81745eded7e7bcdf1c9e9cb3645e9c401098ada5..d6c839c4d563e0e435e8b639366c225986f17a63 100644 (file)
@@ -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<Pl011, &Pl011::generateInterrupt> intEvent;
+    EventFunctionWrapper intEvent;
 
   protected: // Registers
     static const uint64_t AMBA_ID = ULL(0xb105f00d00341011);
index b12e7a3527d43bb113606ad78d5b51b81846f3b3..344eb0864b0a43ec0e582e9a9da5e6e602740fa9 100644 (file)
@@ -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;
 
index aea78709c57feddda7c7923e73e54252a3309094..a9189e9a18b635ced135b5c2acfae8f9408e75bd 100644 (file)
@@ -325,10 +325,10 @@ class Pl111: public AmbaDmaDevice
     void dmaDone();
 
     /** DMA framebuffer read event */
-    EventWrapper<Pl111, &Pl111::readFramebuffer> readEvent;
+    EventFunctionWrapper readEvent;
 
     /** Fill fifo */
-    EventWrapper<Pl111, &Pl111::fillFifo> fillFifoEvent;
+    EventFunctionWrapper fillFifoEvent;
 
     /**@{*/
     /**
@@ -354,7 +354,7 @@ class Pl111: public AmbaDmaDevice
     /**@}*/
 
     /** Wrapper to create an event out of the interrupt */
-    EventWrapper<Pl111, &Pl111::generateInterrupt> intEvent;
+    EventFunctionWrapper intEvent;
 
     bool enableCapture;
 
index 46c5d28e7fc7b01e2450b06b03cb760512778df0..3d8e677b98d0a9919f71401897246fdd7394797b 100644 (file)
@@ -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())
 {
 }
 
index d3f1295dde0c6211491dfcd3471ab79e90a10ec3..1ecadd4caaf655bfbcfc85b54aaea91c3557387b 100644 (file)
@@ -91,7 +91,7 @@ class PL031 : public AmbaIntDevice
 
     /** Called when the counter reaches matches */
     void counterMatch();
-    EventWrapper<PL031, &PL031::counterMatch> matchEvent;
+    EventFunctionWrapper matchEvent;
 
     /** Called to update the matchEvent when the load Value or match value are
      * written.
index 448ac2189543dee990eed7801a1fb42c3b3f5e30..033031547e731daf4f0cfd654b0719cc4c7b80c1 100644 (file)
@@ -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())
 {
 }
 
index fc52b3da0bc412e2d9a2a4b2466ce8b77f8b3f00..425f1fd6bf3fd4cea6fc38a134c8415ebee324ea 100644 (file)
@@ -125,10 +125,10 @@ class CpuLocalTimer : public BasicPioDevice
 
         /** Called when the counter reaches 0 */
         void timerAtZero();
-        EventWrapper<Timer, &Timer::timerAtZero> timerZeroEvent;
+        EventFunctionWrapper timerZeroEvent;
 
         void watchdogAtZero();
-        EventWrapper<Timer, &Timer::watchdogAtZero> watchdogZeroEvent;
+        EventFunctionWrapper watchdogZeroEvent;
       public:
         /** Restart the counter ticking at val
          * @param val the value to start at */
index 99c722d79b6700e9f0a1632dc7b517b2153fac67..86fbc7f057451003dcd1fd2bd894366a4f63dc55 100644 (file)
@@ -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())
 {
 }
 
index fafbeba28e6e02b964342568353c11c483bc3b6c..509d95c9fe77d0fe71c47f69396ed675b6308e4e 100644 (file)
@@ -104,7 +104,7 @@ class Sp804 : public AmbaPioDevice
 
         /** Called when the counter reaches 0 */
         void counterAtZero();
-        EventWrapper<Timer, &Timer::counterAtZero> zeroEvent;
+        EventFunctionWrapper zeroEvent;
 
       public:
         /** Restart the counter ticking at val
index fe05b3279a72c674edcc8da352262c71775cdad9..5a5a132155f87b7b84fb6a351df65457b58fa655 100644 (file)
@@ -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);
index 435d5f59ff0784db1e2e7d45f2b546ca5ab9bfac..24a05b02233edb523be97261408c39b825540697 100644 (file)
@@ -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<EventWrapper<UFSHostDevice, &UFSHostDevice::readDone> >
-    readDoneEvent;
-    std::deque<EventWrapper<UFSHostDevice, &UFSHostDevice::writeDone> >
-    writeDoneEvent;
+    std::deque<EventFunctionWrapper> readDoneEvent;
+    std::deque<EventFunctionWrapper> writeDoneEvent;
 
     /**
      * Callbacks for the logic units. One to indicate the completion of a