port.hh revision 13782
12810Srdreslin@umich.edu/*
212665Snikos.nikoleris@arm.com * Copyright (c) 2011-2012,2015,2017 ARM Limited
39796Sprakash.ramrakhyani@arm.com * All rights reserved
49796Sprakash.ramrakhyani@arm.com *
59796Sprakash.ramrakhyani@arm.com * The license below extends only to copyright in the software and shall
69796Sprakash.ramrakhyani@arm.com * not be construed as granting a license to any other intellectual
79796Sprakash.ramrakhyani@arm.com * property including but not limited to intellectual property relating
89796Sprakash.ramrakhyani@arm.com * to a hardware implementation of the functionality of the software
99796Sprakash.ramrakhyani@arm.com * licensed hereunder.  You may use the software subject to the license
109796Sprakash.ramrakhyani@arm.com * terms below provided that you ensure that this notice is replicated
119796Sprakash.ramrakhyani@arm.com * unmodified and in its entirety in all distributions of the software,
129796Sprakash.ramrakhyani@arm.com * modified or unmodified, in source code or in binary form.
139796Sprakash.ramrakhyani@arm.com *
142810Srdreslin@umich.edu * Copyright (c) 2002-2005 The Regents of The University of Michigan
152810Srdreslin@umich.edu * All rights reserved.
162810Srdreslin@umich.edu *
172810Srdreslin@umich.edu * Redistribution and use in source and binary forms, with or without
182810Srdreslin@umich.edu * modification, are permitted provided that the following conditions are
192810Srdreslin@umich.edu * met: redistributions of source code must retain the above copyright
202810Srdreslin@umich.edu * notice, this list of conditions and the following disclaimer;
212810Srdreslin@umich.edu * redistributions in binary form must reproduce the above copyright
222810Srdreslin@umich.edu * notice, this list of conditions and the following disclaimer in the
232810Srdreslin@umich.edu * documentation and/or other materials provided with the distribution;
242810Srdreslin@umich.edu * neither the name of the copyright holders nor the names of its
252810Srdreslin@umich.edu * contributors may be used to endorse or promote products derived from
262810Srdreslin@umich.edu * this software without specific prior written permission.
272810Srdreslin@umich.edu *
282810Srdreslin@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292810Srdreslin@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302810Srdreslin@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312810Srdreslin@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322810Srdreslin@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332810Srdreslin@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342810Srdreslin@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352810Srdreslin@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362810Srdreslin@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372810Srdreslin@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382810Srdreslin@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392810Srdreslin@umich.edu *
402810Srdreslin@umich.edu * Authors: Ron Dreslinski
4112665Snikos.nikoleris@arm.com *          Andreas Hansson
422810Srdreslin@umich.edu *          William Wang
432810Srdreslin@umich.edu */
442810Srdreslin@umich.edu
452810Srdreslin@umich.edu/**
462810Srdreslin@umich.edu * @file
472810Srdreslin@umich.edu * Port Object Declaration.
482810Srdreslin@umich.edu */
4911486Snikos.nikoleris@arm.com
5011486Snikos.nikoleris@arm.com#ifndef __MEM_PORT_HH__
516216Snate@binkert.org#define __MEM_PORT_HH__
522810Srdreslin@umich.edu
532810Srdreslin@umich.edu#include "base/addr_range.hh"
542810Srdreslin@umich.edu#include "mem/packet.hh"
5512334Sgabeblack@google.com#include "sim/port.hh"
562810Srdreslin@umich.edu
579796Sprakash.ramrakhyani@arm.comclass MemObject;
5812665Snikos.nikoleris@arm.com
5912665Snikos.nikoleris@arm.com/** Forward declaration */
6012665Snikos.nikoleris@arm.comclass BaseSlavePort;
612810Srdreslin@umich.edu
622810Srdreslin@umich.edu/**
632810Srdreslin@umich.edu * A BaseMasterPort is a protocol-agnostic master port, responsible
642810Srdreslin@umich.edu * only for the structural connection to a slave port. The final
652810Srdreslin@umich.edu * master port that inherits from the base class must override the
662810Srdreslin@umich.edu * bind member function for the specific slave port class.
672810Srdreslin@umich.edu */
6812665Snikos.nikoleris@arm.comclass BaseMasterPort : public Port
692810Srdreslin@umich.edu{
702810Srdreslin@umich.edu
7111484Snikos.nikoleris@arm.com  protected:
722810Srdreslin@umich.edu
7312665Snikos.nikoleris@arm.com    BaseSlavePort* _baseSlavePort;
7412665Snikos.nikoleris@arm.com
7512629Sodanrc@yahoo.com.br    BaseMasterPort(const std::string& name, PortID id=InvalidPortID);
762810Srdreslin@umich.edu    virtual ~BaseMasterPort();
776978SLisa.Hsu@amd.com
782810Srdreslin@umich.edu  public:
792810Srdreslin@umich.edu
8010941Sdavid.guillen@arm.com    BaseSlavePort& getSlavePort() const;
8110941Sdavid.guillen@arm.com
8212629Sodanrc@yahoo.com.br};
8312629Sodanrc@yahoo.com.br
8412629Sodanrc@yahoo.com.br/**
852810Srdreslin@umich.edu * A BaseSlavePort is a protocol-agnostic slave port, responsible
8612665Snikos.nikoleris@arm.com * only for the structural connection to a master port.
8712665Snikos.nikoleris@arm.com */
8812665Snikos.nikoleris@arm.comclass BaseSlavePort : public Port
8912665Snikos.nikoleris@arm.com{
9012665Snikos.nikoleris@arm.com
9112665Snikos.nikoleris@arm.com  protected:
9212665Snikos.nikoleris@arm.com
9312665Snikos.nikoleris@arm.com    BaseMasterPort* _baseMasterPort;
9412665Snikos.nikoleris@arm.com
952810Srdreslin@umich.edu    BaseSlavePort(const std::string& name, PortID id=InvalidPortID);
962810Srdreslin@umich.edu    virtual ~BaseSlavePort();
979086Sandreas.hansson@arm.com
989086Sandreas.hansson@arm.com  public:
999086Sandreas.hansson@arm.com
1009086Sandreas.hansson@arm.com    BaseMasterPort& getMasterPort() const;
1019086Sandreas.hansson@arm.com
1022810Srdreslin@umich.edu};
1039796Sprakash.ramrakhyani@arm.com
1042810Srdreslin@umich.edu/** Forward declaration */
1059796Sprakash.ramrakhyani@arm.comclass SlavePort;
10612665Snikos.nikoleris@arm.com
1072810Srdreslin@umich.edu/**
1082810Srdreslin@umich.edu * A MasterPort is a specialisation of a BaseMasterPort, which
1092810Srdreslin@umich.edu * implements the default protocol for the three different level of
1102810Srdreslin@umich.edu * transport functions. In addition to the basic functionality of
1112810Srdreslin@umich.edu * sending packets, it also has functions to receive range changes or
1122810Srdreslin@umich.edu * determine if the port is snooping or not.
1132810Srdreslin@umich.edu */
1142810Srdreslin@umich.educlass MasterPort : public BaseMasterPort
1152810Srdreslin@umich.edu{
11611484Snikos.nikoleris@arm.com
1172810Srdreslin@umich.edu    friend class SlavePort;
1182810Srdreslin@umich.edu
1192810Srdreslin@umich.edu  private:
12010815Sdavid.guillen@arm.com
1212810Srdreslin@umich.edu    SlavePort* _slavePort;
12212566Snikos.nikoleris@arm.com
12312636Sodanrc@yahoo.com.br  protected:
12412648Sodanrc@yahoo.com.br
12512648Sodanrc@yahoo.com.br    MemObject& owner;
12612648Sodanrc@yahoo.com.br
12712636Sodanrc@yahoo.com.br  public:
12812636Sodanrc@yahoo.com.br
1292810Srdreslin@umich.edu    MasterPort(const std::string& name, MemObject* _owner,
1302810Srdreslin@umich.edu               PortID id=InvalidPortID);
13110815Sdavid.guillen@arm.com    virtual ~MasterPort();
13211870Snikos.nikoleris@arm.com
13310815Sdavid.guillen@arm.com    /**
13411870Snikos.nikoleris@arm.com     * Bind this master port to a slave port. This also does the
13510815Sdavid.guillen@arm.com     * mirror action and binds the slave port to the master port.
13610815Sdavid.guillen@arm.com     */
13710815Sdavid.guillen@arm.com    void bind(Port &peer) override;
13812665Snikos.nikoleris@arm.com
13912665Snikos.nikoleris@arm.com    /**
1402810Srdreslin@umich.edu     * Unbind this master port and the associated slave port.
14112665Snikos.nikoleris@arm.com     */
1422810Srdreslin@umich.edu    void unbind() override;
1432810Srdreslin@umich.edu
1442810Srdreslin@umich.edu    /**
1452810Srdreslin@umich.edu     * Send an atomic request packet, where the data is moved and the
14611722Ssophiane.senni@gmail.com     * state is updated in zero time, without interleaving with other
14711722Ssophiane.senni@gmail.com     * memory accesses.
14811722Ssophiane.senni@gmail.com     *
14911722Ssophiane.senni@gmail.com     * @param pkt Packet to send.
15011722Ssophiane.senni@gmail.com     *
15111722Ssophiane.senni@gmail.com     * @return Estimated latency of access.
15211722Ssophiane.senni@gmail.com     */
15311722Ssophiane.senni@gmail.com    Tick sendAtomic(PacketPtr pkt);
15411722Ssophiane.senni@gmail.com
15511722Ssophiane.senni@gmail.com    /**
1562810Srdreslin@umich.edu     * Send a functional request packet, where the data is instantly
15712665Snikos.nikoleris@arm.com     * updated everywhere in the memory system, without affecting the
15812665Snikos.nikoleris@arm.com     * current state of any block or moving the block.
1592810Srdreslin@umich.edu     *
16011722Ssophiane.senni@gmail.com     * @param pkt Packet to send.
16111722Ssophiane.senni@gmail.com     */
16211484Snikos.nikoleris@arm.com    void sendFunctional(PacketPtr pkt);
1632810Srdreslin@umich.edu
16412665Snikos.nikoleris@arm.com    /**
16512665Snikos.nikoleris@arm.com     * Attempt to send a timing request to the slave port by calling
1662810Srdreslin@umich.edu     * its corresponding receive function. If the send does not
1672810Srdreslin@umich.edu     * succeed, as indicated by the return value, then the sender must
16812665Snikos.nikoleris@arm.com     * wait for a recvReqRetry at which point it can re-issue a
16912665Snikos.nikoleris@arm.com     * sendTimingReq.
1702810Srdreslin@umich.edu     *
1712810Srdreslin@umich.edu     * @param pkt Packet to send.
1722810Srdreslin@umich.edu     *
1732810Srdreslin@umich.edu     * @return If the send was succesful or not.
17410815Sdavid.guillen@arm.com    */
17510028SGiacomo.Gabrielli@arm.com    bool sendTimingReq(PacketPtr pkt);
1762810Srdreslin@umich.edu
1772810Srdreslin@umich.edu    /**
1782810Srdreslin@umich.edu     * Check if the slave can handle a timing request.
1792810Srdreslin@umich.edu     *
1802810Srdreslin@umich.edu     * If the send cannot be handled at the moment, as indicated by
1812810Srdreslin@umich.edu     * the return value, then the sender will receive a recvReqRetry
18212676Sodanrc@yahoo.com.br     * at which point it can re-issue a sendTimingReq.
1832810Srdreslin@umich.edu     *
18411484Snikos.nikoleris@arm.com     * @param pkt Packet to send.
1852810Srdreslin@umich.edu     *
1862810Srdreslin@umich.edu     * @return If the send was succesful or not.
1872810Srdreslin@umich.edu     */
1882810Srdreslin@umich.edu    bool tryTiming(PacketPtr pkt) const;
18910815Sdavid.guillen@arm.com
19010941Sdavid.guillen@arm.com    /**
19110941Sdavid.guillen@arm.com     * Attempt to send a timing snoop response packet to the slave
19210941Sdavid.guillen@arm.com     * port by calling its corresponding receive function. If the send
19310941Sdavid.guillen@arm.com     * does not succeed, as indicated by the return value, then the
19410941Sdavid.guillen@arm.com     * sender must wait for a recvRetrySnoop at which point it can
19510941Sdavid.guillen@arm.com     * re-issue a sendTimingSnoopResp.
19610941Sdavid.guillen@arm.com     *
19710048Saminfar@gmail.com     * @param pkt Packet to send.
1982810Srdreslin@umich.edu     */
19912636Sodanrc@yahoo.com.br    bool sendTimingSnoopResp(PacketPtr pkt);
2002810Srdreslin@umich.edu
2012810Srdreslin@umich.edu    /**
2022810Srdreslin@umich.edu     * Send a retry to the slave port that previously attempted a
20310815Sdavid.guillen@arm.com     * sendTimingResp to this master port and failed. Note that this
2045717Shsul@eecs.umich.edu     * is virtual so that the "fake" snoop response port in the
20512636Sodanrc@yahoo.com.br     * coherent crossbar can override the behaviour.
20612636Sodanrc@yahoo.com.br     */
20712636Sodanrc@yahoo.com.br    virtual void sendRetryResp();
20812665Snikos.nikoleris@arm.com
20912636Sodanrc@yahoo.com.br    /**
21012636Sodanrc@yahoo.com.br     * Determine if this master port is snooping or not. The default
21112636Sodanrc@yahoo.com.br     * implementation returns false and thus tells the neighbour we
21212636Sodanrc@yahoo.com.br     * are not snooping. Any master port that wants to receive snoop
21312636Sodanrc@yahoo.com.br     * requests (e.g. a cache connected to a bus) has to override this
21412636Sodanrc@yahoo.com.br     * function.
21512636Sodanrc@yahoo.com.br     *
21612636Sodanrc@yahoo.com.br     * @return true if the port should be considered a snooper
21712636Sodanrc@yahoo.com.br     */
2185717Shsul@eecs.umich.edu    virtual bool isSnooping() const { return false; }
2195717Shsul@eecs.umich.edu
2205717Shsul@eecs.umich.edu    /**
2212810Srdreslin@umich.edu     * Get the address ranges of the connected slave port.
2222810Srdreslin@umich.edu     */
22312648Sodanrc@yahoo.com.br    AddrRangeList getAddrRanges() const;
22412648Sodanrc@yahoo.com.br
22512665Snikos.nikoleris@arm.com    /** Inject a PrintReq for the given address to print the state of
22612648Sodanrc@yahoo.com.br     * that address throughout the memory system.  For debugging.
2272810Srdreslin@umich.edu     */
22811484Snikos.nikoleris@arm.com    void printAddr(Addr a);
2292810Srdreslin@umich.edu
23011484Snikos.nikoleris@arm.com  protected:
23112648Sodanrc@yahoo.com.br
2322810Srdreslin@umich.edu    /**
2332810Srdreslin@umich.edu     * Receive an atomic snoop request packet from the slave port.
2342810Srdreslin@umich.edu     */
2352810Srdreslin@umich.edu    virtual Tick recvAtomicSnoop(PacketPtr pkt)
23612648Sodanrc@yahoo.com.br    {
23712648Sodanrc@yahoo.com.br        panic("%s was not expecting an atomic snoop request\n", name());
2382810Srdreslin@umich.edu        return 0;
23911484Snikos.nikoleris@arm.com    }
2402810Srdreslin@umich.edu
2412810Srdreslin@umich.edu    /**
24212665Snikos.nikoleris@arm.com     * Receive a functional snoop request packet from the slave port.
24312665Snikos.nikoleris@arm.com     */
2442810Srdreslin@umich.edu    virtual void recvFunctionalSnoop(PacketPtr pkt)
2452810Srdreslin@umich.edu    {
2462810Srdreslin@umich.edu        panic("%s was not expecting a functional snoop request\n", name());
24712648Sodanrc@yahoo.com.br    }
24812648Sodanrc@yahoo.com.br
24912648Sodanrc@yahoo.com.br    /**
25012648Sodanrc@yahoo.com.br     * Receive a timing response from the slave port.
25112648Sodanrc@yahoo.com.br     */
25212665Snikos.nikoleris@arm.com    virtual bool recvTimingResp(PacketPtr pkt) = 0;
25312648Sodanrc@yahoo.com.br
25412648Sodanrc@yahoo.com.br    /**
25512648Sodanrc@yahoo.com.br     * Receive a timing snoop request from the slave port.
25612648Sodanrc@yahoo.com.br     */
25712648Sodanrc@yahoo.com.br    virtual void recvTimingSnoopReq(PacketPtr pkt)
25812648Sodanrc@yahoo.com.br    {
25912648Sodanrc@yahoo.com.br        panic("%s was not expecting a timing snoop request\n", name());
26012648Sodanrc@yahoo.com.br    }
26112648Sodanrc@yahoo.com.br
26212648Sodanrc@yahoo.com.br    /**
26312648Sodanrc@yahoo.com.br     * Called by the slave port if sendTimingReq was called on this
26412648Sodanrc@yahoo.com.br     * master port (causing recvTimingReq to be called on the slave
26512648Sodanrc@yahoo.com.br     * port) and was unsuccesful.
26612648Sodanrc@yahoo.com.br     */
26712648Sodanrc@yahoo.com.br    virtual void recvReqRetry() = 0;
26812648Sodanrc@yahoo.com.br
26912665Snikos.nikoleris@arm.com    /**
27012665Snikos.nikoleris@arm.com     * Called by the slave port if sendTimingSnoopResp was called on this
27112648Sodanrc@yahoo.com.br     * master port (causing recvTimingSnoopResp to be called on the slave
27212648Sodanrc@yahoo.com.br     * port) and was unsuccesful.
27312648Sodanrc@yahoo.com.br     */
2749796Sprakash.ramrakhyani@arm.com    virtual void recvRetrySnoopResp()
2759796Sprakash.ramrakhyani@arm.com    {
2769796Sprakash.ramrakhyani@arm.com        panic("%s was not expecting a snoop retry\n", name());
2779796Sprakash.ramrakhyani@arm.com    }
2789796Sprakash.ramrakhyani@arm.com
2799796Sprakash.ramrakhyani@arm.com    /**
28012665Snikos.nikoleris@arm.com     * Called to receive an address range change from the peer slave
28112665Snikos.nikoleris@arm.com     * port. The default implementation ignores the change and does
28212665Snikos.nikoleris@arm.com     * nothing. Override this function in a derived class if the owner
28312665Snikos.nikoleris@arm.com     * needs to be aware of the address ranges, e.g. in an
28412665Snikos.nikoleris@arm.com     * interconnect component like a bus.
28512665Snikos.nikoleris@arm.com     */
28612665Snikos.nikoleris@arm.com    virtual void recvRangeChange() { }
28712665Snikos.nikoleris@arm.com};
28812665Snikos.nikoleris@arm.com
28912665Snikos.nikoleris@arm.com/**
29012665Snikos.nikoleris@arm.com * A SlavePort is a specialisation of a port. In addition to the
29112665Snikos.nikoleris@arm.com * basic functionality of sending packets to its master peer, it also
29212665Snikos.nikoleris@arm.com * has functions specific to a slave, e.g. to send range changes
29312665Snikos.nikoleris@arm.com * and get the address ranges that the port responds to.
29412665Snikos.nikoleris@arm.com */
29512665Snikos.nikoleris@arm.comclass SlavePort : public BaseSlavePort
29612665Snikos.nikoleris@arm.com{
29712665Snikos.nikoleris@arm.com
29812665Snikos.nikoleris@arm.com    friend class MasterPort;
29912665Snikos.nikoleris@arm.com
30012665Snikos.nikoleris@arm.com  private:
30112665Snikos.nikoleris@arm.com
30212665Snikos.nikoleris@arm.com    MasterPort* _masterPort;
30312665Snikos.nikoleris@arm.com
30412665Snikos.nikoleris@arm.com  protected:
30512665Snikos.nikoleris@arm.com
30612665Snikos.nikoleris@arm.com    MemObject& owner;
30712665Snikos.nikoleris@arm.com
30812665Snikos.nikoleris@arm.com  public:
30912665Snikos.nikoleris@arm.com
31012665Snikos.nikoleris@arm.com    SlavePort(const std::string& name, MemObject* _owner,
31112665Snikos.nikoleris@arm.com              PortID id=InvalidPortID);
31212665Snikos.nikoleris@arm.com    virtual ~SlavePort();
31312665Snikos.nikoleris@arm.com
31412665Snikos.nikoleris@arm.com    /**
31512665Snikos.nikoleris@arm.com     * Send an atomic snoop request packet, where the data is moved
31612665Snikos.nikoleris@arm.com     * and the state is updated in zero time, without interleaving
31712665Snikos.nikoleris@arm.com     * with other memory accesses.
31812665Snikos.nikoleris@arm.com     *
31912665Snikos.nikoleris@arm.com     * @param pkt Snoop packet to send.
32012665Snikos.nikoleris@arm.com     *
32112665Snikos.nikoleris@arm.com     * @return Estimated latency of access.
32212665Snikos.nikoleris@arm.com     */
32312665Snikos.nikoleris@arm.com    Tick sendAtomicSnoop(PacketPtr pkt);
32412665Snikos.nikoleris@arm.com
32512665Snikos.nikoleris@arm.com    /**
32612665Snikos.nikoleris@arm.com     * Send a functional snoop request packet, where the data is
32712665Snikos.nikoleris@arm.com     * instantly updated everywhere in the memory system, without
32812665Snikos.nikoleris@arm.com     * affecting the current state of any block or moving the block.
32912665Snikos.nikoleris@arm.com     *
33012665Snikos.nikoleris@arm.com     * @param pkt Snoop packet to send.
33112665Snikos.nikoleris@arm.com     */
33212665Snikos.nikoleris@arm.com    void sendFunctionalSnoop(PacketPtr pkt);
33312665Snikos.nikoleris@arm.com
33412665Snikos.nikoleris@arm.com    /**
33512665Snikos.nikoleris@arm.com     * Attempt to send a timing response to the master port by calling
33612665Snikos.nikoleris@arm.com     * its corresponding receive function. If the send does not
33712665Snikos.nikoleris@arm.com     * succeed, as indicated by the return value, then the sender must
33812665Snikos.nikoleris@arm.com     * wait for a recvRespRetry at which point it can re-issue a
33912665Snikos.nikoleris@arm.com     * sendTimingResp.
34012665Snikos.nikoleris@arm.com     *
34112665Snikos.nikoleris@arm.com     * @param pkt Packet to send.
34212665Snikos.nikoleris@arm.com     *
34312665Snikos.nikoleris@arm.com     * @return If the send was succesful or not.
34412665Snikos.nikoleris@arm.com    */
34512665Snikos.nikoleris@arm.com    bool sendTimingResp(PacketPtr pkt);
34612665Snikos.nikoleris@arm.com
34712665Snikos.nikoleris@arm.com    /**
34812665Snikos.nikoleris@arm.com     * Attempt to send a timing snoop request packet to the master port
34912665Snikos.nikoleris@arm.com     * by calling its corresponding receive function. Snoop requests
35012665Snikos.nikoleris@arm.com     * always succeed and hence no return value is needed.
35112665Snikos.nikoleris@arm.com     *
35212665Snikos.nikoleris@arm.com     * @param pkt Packet to send.
35312665Snikos.nikoleris@arm.com     */
35412665Snikos.nikoleris@arm.com    void sendTimingSnoopReq(PacketPtr pkt);
35512665Snikos.nikoleris@arm.com
35612665Snikos.nikoleris@arm.com    /**
35712665Snikos.nikoleris@arm.com     * Send a retry to the master port that previously attempted a
35812665Snikos.nikoleris@arm.com     * sendTimingReq to this slave port and failed.
35912665Snikos.nikoleris@arm.com     */
36012665Snikos.nikoleris@arm.com    void sendRetryReq();
36112665Snikos.nikoleris@arm.com
36212665Snikos.nikoleris@arm.com    /**
36312665Snikos.nikoleris@arm.com     * Send a retry to the master port that previously attempted a
36412665Snikos.nikoleris@arm.com     * sendTimingSnoopResp to this slave port and failed.
36512665Snikos.nikoleris@arm.com     */
36612665Snikos.nikoleris@arm.com    void sendRetrySnoopResp();
36712665Snikos.nikoleris@arm.com
36812665Snikos.nikoleris@arm.com    /**
36912665Snikos.nikoleris@arm.com     * Find out if the peer master port is snooping or not.
37012665Snikos.nikoleris@arm.com     *
37112665Snikos.nikoleris@arm.com     * @return true if the peer master port is snooping
37212665Snikos.nikoleris@arm.com     */
37312665Snikos.nikoleris@arm.com    bool isSnooping() const { return _masterPort->isSnooping(); }
37412665Snikos.nikoleris@arm.com
37512665Snikos.nikoleris@arm.com    /**
37612665Snikos.nikoleris@arm.com     * Called by the owner to send a range change
37712665Snikos.nikoleris@arm.com     */
37812665Snikos.nikoleris@arm.com    void sendRangeChange() const {
37912665Snikos.nikoleris@arm.com        if (!_masterPort)
38012665Snikos.nikoleris@arm.com            fatal("%s cannot sendRangeChange() without master port", name());
38112665Snikos.nikoleris@arm.com        _masterPort->recvRangeChange();
38212665Snikos.nikoleris@arm.com    }
38312665Snikos.nikoleris@arm.com
38412665Snikos.nikoleris@arm.com    /**
38512665Snikos.nikoleris@arm.com     * Get a list of the non-overlapping address ranges the owner is
38612665Snikos.nikoleris@arm.com     * responsible for. All slave ports must override this function
38712665Snikos.nikoleris@arm.com     * and return a populated list with at least one item.
38812665Snikos.nikoleris@arm.com     *
38912665Snikos.nikoleris@arm.com     * @return a list of ranges responded to
39012665Snikos.nikoleris@arm.com     */
39112665Snikos.nikoleris@arm.com    virtual AddrRangeList getAddrRanges() const = 0;
39212665Snikos.nikoleris@arm.com
39312665Snikos.nikoleris@arm.com    /**
39412665Snikos.nikoleris@arm.com     * We let the master port do the work, so these don't do anything.
39512665Snikos.nikoleris@arm.com     */
39612665Snikos.nikoleris@arm.com    void unbind() override {}
39712665Snikos.nikoleris@arm.com    void bind(Port &peer) override {}
39812665Snikos.nikoleris@arm.com
39912665Snikos.nikoleris@arm.com  protected:
40012665Snikos.nikoleris@arm.com
40112665Snikos.nikoleris@arm.com    /**
40212665Snikos.nikoleris@arm.com     * Called by the master port to unbind. Should never be called
40312665Snikos.nikoleris@arm.com     * directly.
40412665Snikos.nikoleris@arm.com     */
40512665Snikos.nikoleris@arm.com    void slaveUnbind();
40612665Snikos.nikoleris@arm.com
40712665Snikos.nikoleris@arm.com    /**
40812665Snikos.nikoleris@arm.com     * Called by the master port to bind. Should never be called
40912665Snikos.nikoleris@arm.com     * directly.
41012665Snikos.nikoleris@arm.com     */
41112665Snikos.nikoleris@arm.com    void slaveBind(MasterPort& master_port);
41212665Snikos.nikoleris@arm.com
41312665Snikos.nikoleris@arm.com    /**
41412665Snikos.nikoleris@arm.com     * Receive an atomic request packet from the master port.
41512665Snikos.nikoleris@arm.com     */
41612665Snikos.nikoleris@arm.com    virtual Tick recvAtomic(PacketPtr pkt) = 0;
41712665Snikos.nikoleris@arm.com
41812665Snikos.nikoleris@arm.com    /**
41912665Snikos.nikoleris@arm.com     * Receive a functional request packet from the master port.
42012665Snikos.nikoleris@arm.com     */
42112665Snikos.nikoleris@arm.com    virtual void recvFunctional(PacketPtr pkt) = 0;
42212665Snikos.nikoleris@arm.com
42312665Snikos.nikoleris@arm.com    /**
42412665Snikos.nikoleris@arm.com     * Receive a timing request from the master port.
42512665Snikos.nikoleris@arm.com     */
42612665Snikos.nikoleris@arm.com    virtual bool recvTimingReq(PacketPtr pkt) = 0;
42712665Snikos.nikoleris@arm.com
42812665Snikos.nikoleris@arm.com    /**
42912665Snikos.nikoleris@arm.com     * Availability request from the master port.
43012665Snikos.nikoleris@arm.com     */
43112665Snikos.nikoleris@arm.com    virtual bool tryTiming(PacketPtr pkt) {
43212665Snikos.nikoleris@arm.com        panic("%s was not expecting a %s\n", name(), __func__);
43312665Snikos.nikoleris@arm.com    }
43412665Snikos.nikoleris@arm.com
43512665Snikos.nikoleris@arm.com    /**
43612665Snikos.nikoleris@arm.com     * Receive a timing snoop response from the master port.
43712665Snikos.nikoleris@arm.com     */
43812665Snikos.nikoleris@arm.com    virtual bool recvTimingSnoopResp(PacketPtr pkt)
43912665Snikos.nikoleris@arm.com    {
44012665Snikos.nikoleris@arm.com        panic("%s was not expecting a timing snoop response\n", name());
44112665Snikos.nikoleris@arm.com    }
44212665Snikos.nikoleris@arm.com
44312665Snikos.nikoleris@arm.com    /**
44412665Snikos.nikoleris@arm.com     * Called by the master port if sendTimingResp was called on this
44512665Snikos.nikoleris@arm.com     * slave port (causing recvTimingResp to be called on the master
446     * port) and was unsuccesful.
447     */
448    virtual void recvRespRetry() = 0;
449
450};
451
452#endif //__MEM_PORT_HH__
453