changeset ef6e57ac0d70 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=ef6e57ac0d70
description:
        dev, arm: Implement the NoMali reset callback

        Add a callback handler for the NoMali reset callback. This callback is
        called whenever the GPU is reset using the register interface or the
        NoMali API. The callback can be used to override ID registers using
        the raw register API.

diffstat:

 src/dev/arm/gpu_nomali.cc |  33 +++++++++++++++++++++++++++++++++
 src/dev/arm/gpu_nomali.hh |  22 ++++++++++++++++++++++
 2 files changed, 55 insertions(+), 0 deletions(-)

diffs (110 lines):

diff -r 9e46b77e5e56 -r ef6e57ac0d70 src/dev/arm/gpu_nomali.cc
--- a/src/dev/arm/gpu_nomali.cc Tue Feb 23 11:49:34 2016 +0000
+++ b/src/dev/arm/gpu_nomali.cc Tue Feb 23 11:49:35 2016 +0000
@@ -92,6 +92,13 @@
     cbk_int.func.interrupt = NoMaliGpu::_interrupt;
     setCallback(cbk_int);
 
+    /* Setup a reset callback */
+    nomali_callback_t cbk_rst;
+    cbk_rst.type = NOMALI_CALLBACK_RESET;
+    cbk_rst.usr = (void *)this;
+    cbk_rst.func.reset = NoMaliGpu::_reset;
+    setCallback(cbk_rst);
+
     panicOnErr(
         nomali_get_info(nomali, &nomaliInfo),
         "Failed to get NoMali information struct");
@@ -102,6 +109,18 @@
     nomali_destroy(nomali);
 }
 
+
+void
+NoMaliGpu::init()
+{
+    PioDevice::init();
+
+    /* Reset the GPU here since the reset callback won't have been
+     * installed when the GPU was reset at instantiation time.
+     */
+    reset();
+}
+
 void
 NoMaliGpu::serialize(CheckpointOut &cp) const
 {
@@ -268,6 +287,12 @@
 }
 
 void
+NoMaliGpu::onReset()
+{
+    DPRINTF(NoMali, "Reset\n");
+}
+
+void
 NoMaliGpu::setCallback(const nomali_callback_t &callback)
 {
     DPRINTF(NoMali, "Registering callback %i\n",
@@ -287,6 +312,14 @@
     _this->onInterrupt(intno, !!set);
 }
 
+void
+NoMaliGpu::_reset(nomali_handle_t h, void *usr)
+{
+    NoMaliGpu *_this(static_cast<NoMaliGpu *>(usr));
+
+    _this->onReset();
+}
+
 NoMaliGpu *
 NoMaliGpuParams::create()
 {
diff -r 9e46b77e5e56 -r ef6e57ac0d70 src/dev/arm/gpu_nomali.hh
--- a/src/dev/arm/gpu_nomali.hh Tue Feb 23 11:49:34 2016 +0000
+++ b/src/dev/arm/gpu_nomali.hh Tue Feb 23 11:49:35 2016 +0000
@@ -54,6 +54,8 @@
     NoMaliGpu(const NoMaliGpuParams *p);
     virtual ~NoMaliGpu();
 
+    void init() override;
+
   public: /* Checkpointing */
     void serialize(CheckpointOut &cp) const override;
     void unserialize(CheckpointIn &cp) override;
@@ -126,6 +128,14 @@
      */
     virtual void onInterrupt(nomali_int_t intno, bool set);
 
+    /**
+     * Reset callback from the NoMali library
+     *
+     * This method is called whenever the GPU is reset through the
+     * register interface or the API (reset() or nomali_reset()).
+     */
+    virtual void onReset();
+
     /** @} */
 
   private: /* Callback helpers */
@@ -145,6 +155,18 @@
      */
     static void _interrupt(nomali_handle_t h, void *usr,
                            nomali_int_t intno, int set);
+
+    /**
+     * Reset callback from the NoMali library.
+     *
+     * This method calls onReset() on the NoMaliGpu owning this
+     * device.
+     *
+     * @param h NoMali library handle.
+     * @param usr Pointer to an instance of the NoMaliGpu
+     */
+    static void _reset(nomali_handle_t h, void *usr);
+
   protected:
     /** Device base address */
     const Addr pioAddr;
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to