X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Fport.hh;h=bb74bf497a35f6667ccef0c77ee1ef8ba155aac8;hb=cb76111a7e79c9b0364e49bdf34120f440e42746;hp=877e0029396e62e27a071a6e275ec78ca3432195;hpb=4ad1b58fdd7cc9ba9704ae966a41c99fd0f1dbc9;p=gem5.git diff --git a/src/mem/port.hh b/src/mem/port.hh index 877e00293..bb74bf497 100644 --- a/src/mem/port.hh +++ b/src/mem/port.hh @@ -41,12 +41,13 @@ #define __MEM_PORT_HH__ #include -#include #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 @@ -58,6 +59,7 @@ typedef std::list > AddrRangeList; typedef std::list >::iterator AddrRangeIter; +class EventQueue; class MemObject; /** @@ -71,10 +73,9 @@ 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; @@ -87,11 +88,6 @@ class Port MemObject *owner; public: - - Port() - : peer(NULL), owner(NULL) - { } - /** * Constructor. * @@ -100,14 +96,12 @@ class Port * @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 @@ -126,7 +120,7 @@ class Port 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; } @@ -135,6 +129,9 @@ class Port * demise. */ void removeConn(); + virtual bool isDefaultPort() const { return false; } + + bool isConnected() { return peer && !peer->isDefaultPort(); } protected: @@ -164,7 +161,7 @@ class Port 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. @@ -172,7 +169,7 @@ class Port @param snoop is a list of ranges snooped */ virtual void getDeviceAddressRanges(AddrRangeList &resp, - AddrRangeList &snoop) + bool &snoop) { panic("??"); } public: @@ -217,12 +214,12 @@ class Port /** 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() @@ -246,6 +243,11 @@ class Port */ 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().