summaryrefslogtreecommitdiff
path: root/src/dev/arm/gpu_nomali.hh
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas.sandberg@arm.com>2016-02-23 11:49:34 +0000
committerAndreas Sandberg <andreas.sandberg@arm.com>2016-02-23 11:49:34 +0000
commit81a8ce356460c020bcab12801d91726ea886f7c2 (patch)
treeeb94ed85d9e5cfcbdd82bfd051e0424a5d47d8f1 /src/dev/arm/gpu_nomali.hh
parent826e0047b0a830ea5980ce1d0db7797ab3ee6de2 (diff)
downloadgem5-81a8ce356460c020bcab12801d91726ea886f7c2.tar.xz
dev, arm: Refactor the NoMali GPU
Refactor and cleanup the NoMaliGpu class: * Use a std::map instead of a switch block to map the parameter enum describing the GPU type to a NoMali type. * Remove redundant NoMali handle from the interrupt callback. * Make callbacks and API wrappers protected instead of private to enable future extensions. * Wrap remaining NoMali API calls.
Diffstat (limited to 'src/dev/arm/gpu_nomali.hh')
-rw-r--r--src/dev/arm/gpu_nomali.hh67
1 files changed, 52 insertions, 15 deletions
diff --git a/src/dev/arm/gpu_nomali.hh b/src/dev/arm/gpu_nomali.hh
index 4e4f9dbcb..eaf7f37cb 100644
--- a/src/dev/arm/gpu_nomali.hh
+++ b/src/dev/arm/gpu_nomali.hh
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2015 ARM Limited
+ * Copyright (c) 2014-2016 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -63,22 +63,14 @@ class NoMaliGpu : public PioDevice
Tick write(PacketPtr pkt) override;
AddrRangeList getAddrRanges() const override;
- private:
+ protected: /* API wrappers/helpers */
/**
- * Interrupt callback from the NoMali library.
- *
- * This method calls onInterrupt() on the NoMaliGpu owning this
- * device.
- *
- * @param h NoMali library handle.
- * @param usr Pointer to an instance of the NoMaliGpu
- * @param intno GPU interrupt type
- * @param set Was the interrupt raised (1) or lowered (0)?
+ * @{
+ * @name API wrappers
*/
- static void _interrupt(nomali_handle_t h, void *usr,
- nomali_int_t intno, int set);
- void onInterrupt(nomali_handle_t h, nomali_int_t intno, bool set);
+ /** Wrapper around nomali_reset(). */
+ void reset();
/** Wrapper around nomali_reg_read(). */
uint32_t readReg(nomali_addr_t reg);
@@ -91,6 +83,16 @@ class NoMaliGpu : public PioDevice
void writeRegRaw(nomali_addr_t reg, uint32_t value);
/**
+ * Wrapper around nomali_int_state()
+ *
+ * @param intno Interrupt number
+ * @return True if asserted, false otherwise.
+ */
+ bool intState(nomali_int_t intno);
+
+ /** @} */
+
+ /**
* Format a NoMali error into an error message and panic.
*
* @param err Error code from the NoMali library.
@@ -108,6 +110,42 @@ class NoMaliGpu : public PioDevice
gpuPanic(err, msg);
}
+ protected: /* Callbacks */
+ /**
+ * @{
+ * @name Callbacks
+ */
+
+ /**
+ * Interrupt callback from the NoMali library
+ *
+ * This method is called whenever there is an interrupt state change.
+ *
+ * @param intno Interrupt number
+ * @param set True is the interrupt is being asserted, false otherwise.
+ */
+ virtual void onInterrupt(nomali_int_t intno, bool set);
+
+ /** @} */
+
+ private: /* Callback helpers */
+ /** Wrapper around nomali_set_callback() */
+ void setCallback(const nomali_callback_t &callback);
+
+ /**
+ * Interrupt callback from the NoMali library.
+ *
+ * This method calls onInterrupt() on the NoMaliGpu owning this
+ * device.
+ *
+ * @param h NoMali library handle.
+ * @param usr Pointer to an instance of the NoMaliGpu
+ * @param intno GPU interrupt type
+ * @param set Was the interrupt raised (1) or lowered (0)?
+ */
+ static void _interrupt(nomali_handle_t h, void *usr,
+ nomali_int_t intno, int set);
+ protected:
/** Device base address */
const Addr pioAddr;
@@ -118,7 +156,6 @@ class NoMaliGpu : public PioDevice
* interrupts */
const std::map<nomali_int_t, uint32_t> interruptMap;
-
/** Cached information struct from the NoMali library */
nomali_info_t nomaliInfo;