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");
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
{
platform->gic->clearInt(it_int->second);
}
+void
+NoMaliGpu::onReset()
+{
+ DPRINTF(NoMali, "Reset\n");
+}
+
void
NoMaliGpu::setCallback(const nomali_callback_t &callback)
{
_this->onInterrupt(intno, !!set);
}
+void
+NoMaliGpu::_reset(nomali_handle_t h, void *usr)
+{
+ NoMaliGpu *_this(static_cast<NoMaliGpu *>(usr));
+
+ _this->onReset();
+}
+
NoMaliGpu *
NoMaliGpuParams::create()
{
NoMaliGpu(const NoMaliGpuParams *p);
virtual ~NoMaliGpu();
+ void init() override;
+
public: /* Checkpointing */
void serialize(CheckpointOut &cp) const override;
void unserialize(CheckpointIn &cp) override;
*/
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 */
*/
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;