summaryrefslogtreecommitdiff
path: root/src/mem/packet.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:52 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:52 -0500
commitf012166bb600ebaeefa48e74f7dd7fdfc9742506 (patch)
treed7be12d21ec6629af877b03eeec224c699ac2e29 /src/mem/packet.hh
parenta2ee51f631199f629f36baf2f59161e25be84bdc (diff)
downloadgem5-f012166bb600ebaeefa48e74f7dd7fdfc9742506.tar.xz
mem: Cleanup Packet::checkFunctional and hasData usage
This patch cleans up the use of hasData and checkFunctional in the packet. The hasData function is unfortunately suggesting that it checks if the packet has a valid data pointer, when it does in fact only check if the specific packet type is specified to have a data payload. The confusion led to a bug in checkFunctional. The latter function is also tidied up to avoid name overloading.
Diffstat (limited to 'src/mem/packet.hh')
-rw-r--r--src/mem/packet.hh43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index 357134c75..d0b210975 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -185,6 +185,12 @@ class MemCmd
bool needsExclusive() const { return testCmdAttrib(NeedsExclusive); }
bool needsResponse() const { return testCmdAttrib(NeedsResponse); }
bool isInvalidate() const { return testCmdAttrib(IsInvalidate); }
+
+ /**
+ * Check if this particular packet type carries payload data. Note
+ * that this does not reflect if the data pointer of the packet is
+ * valid or not.
+ */
bool hasData() const { return testCmdAttrib(HasData); }
bool isLLSC() const { return testCmdAttrib(IsLlsc); }
bool isSWPrefetch() const { return testCmdAttrib(IsSWPrefetch); }
@@ -918,28 +924,37 @@ class Packet : public Printable
}
/**
- * Check a functional request against a memory value represented
- * by a base/size pair and an associated data array. If the
- * functional request is a read, it may be satisfied by the memory
- * value. If the functional request is a write, it may update the
- * memory value.
- */
- bool checkFunctional(Printable *obj, Addr base, bool is_secure, int size,
- uint8_t *data);
-
- /**
* Check a functional request against a memory value stored in
- * another packet (i.e. an in-transit request or response).
+ * another packet (i.e. an in-transit request or
+ * response). Returns true if the current packet is a read, and
+ * the other packet provides the data, which is then copied to the
+ * current packet. If the current packet is a write, and the other
+ * packet intersects this one, then we update the data
+ * accordingly.
*/
bool
- checkFunctional(PacketPtr other)
+ checkFunctional(PacketPtr other)
{
- uint8_t *data = other->hasData() ? other->getPtr<uint8_t>() : NULL;
+ // all packets that are carrying a payload should have a valid
+ // data pointer
return checkFunctional(other, other->getAddr(), other->isSecure(),
- other->getSize(), data);
+ other->getSize(),
+ other->hasData() ?
+ other->getPtr<uint8_t>() : NULL);
}
/**
+ * Check a functional request against a memory value represented
+ * by a base/size pair and an associated data array. If the
+ * current packet is a read, it may be satisfied by the memory
+ * value. If the current packet is a write, it may update the
+ * memory value.
+ */
+ bool
+ checkFunctional(Printable *obj, Addr base, bool is_secure, int size,
+ uint8_t *_data);
+
+ /**
* Push label for PrintReq (safe to call unconditionally).
*/
void