#define __MEM_PORT_HH__
#include <list>
-#include <inttypes.h>
#include "base/misc.hh"
#include "base/range.hh"
+#include "base/types.hh"
#include "mem/packet.hh"
#include "mem/request.hh"
+#include "sim/eventq.hh"
/** This typedef is used to clean up the parameter list of
* getDeviceAddressRanges() and getPeerAddressRanges(). It's declared
typedef std::list<Range<Addr> > AddrRangeList;
typedef std::list<Range<Addr> >::iterator AddrRangeIter;
+class EventQueue;
class MemObject;
/**
* Send accessor functions are being called from the device the port is
* associated with, and it will call the peer recv. accessor function.
*/
-class Port
+class Port : public EventManager
{
- private:
-
+ protected:
/** Descriptive name (for DPRINTF output) */
mutable std::string portName;
MemObject *owner;
public:
-
- Port()
- : peer(NULL), owner(NULL)
- { }
-
/**
* Constructor.
*
* @param _owner Pointer to the MemObject that owns this port.
* Will not necessarily be set.
*/
- Port(const std::string &_name, MemObject *_owner = NULL)
- : portName(_name), peer(NULL), owner(_owner)
- { }
+ Port(const std::string &_name, MemObject *_owner);
/** Return port name (for DPRINTF). */
const std::string &name() const { return portName; }
- virtual ~Port() {};
+ virtual ~Port();
// mey be better to use subclasses & RTTI?
/** Holds the ports status. Currently just that a range recomputation needs
Port *getPeer() { return peer; }
/** Function to set the owner of this port. */
- void setOwner(MemObject *_owner) { owner = _owner; }
+ void setOwner(MemObject *_owner);
/** Function to return the owner of this port. */
MemObject *getOwner() { return owner; }
* demise. */
void removeConn();
+ virtual bool isDefaultPort() const { return false; }
+
+ bool isConnected() { return peer && !peer->isDefaultPort(); }
protected:
this function to be called, so it just returns 0. Anytthing that is
concerned with the size should just ignore that.
*/
- virtual int deviceBlockSize() { return 0; }
+ virtual unsigned deviceBlockSize() const { return 0; }
/** The peer port is requesting us to reply with a list of the ranges we
are responsible for.
@param snoop is a list of ranges snooped
*/
virtual void getDeviceAddressRanges(AddrRangeList &resp,
- AddrRangeList &snoop)
+ bool &snoop)
{ panic("??"); }
public:
/** Called by the associated device if it wishes to find out the blocksize
of the device on attached to the peer port.
*/
- int peerBlockSize() { return peer->deviceBlockSize(); }
+ unsigned peerBlockSize() const { return peer->deviceBlockSize(); }
/** Called by the associated device if it wishes to find out the address
ranges connected to the peer ports devices.
*/
- void getPeerAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
+ void getPeerAddressRanges(AddrRangeList &resp, bool &snoop)
{ peer->getDeviceAddressRanges(resp, snoop); }
/** This function is a wrapper around sendFunctional()
*/
virtual void memsetBlob(Addr addr, uint8_t val, int size);
+ /** Inject a PrintReq for the given address to print the state of
+ * that address throughout the memory system. For debugging.
+ */
+ void printAddr(Addr a);
+
private:
/** Internal helper function for read/writeBlob().