port.hh revision 10713
12381SN/A/*
210713Sandreas.hansson@arm.com * Copyright (c) 2011-2012,2015 ARM Limited
38711Sandreas.hansson@arm.com * All rights reserved
48711Sandreas.hansson@arm.com *
58711Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall
68711Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual
78711Sandreas.hansson@arm.com * property including but not limited to intellectual property relating
88711Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software
98711Sandreas.hansson@arm.com * licensed hereunder.  You may use the software subject to the license
108711Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated
118711Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software,
128711Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form.
138711Sandreas.hansson@arm.com *
142381SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
152381SN/A * All rights reserved.
162381SN/A *
172381SN/A * Redistribution and use in source and binary forms, with or without
182381SN/A * modification, are permitted provided that the following conditions are
192381SN/A * met: redistributions of source code must retain the above copyright
202381SN/A * notice, this list of conditions and the following disclaimer;
212381SN/A * redistributions in binary form must reproduce the above copyright
222381SN/A * notice, this list of conditions and the following disclaimer in the
232381SN/A * documentation and/or other materials provided with the distribution;
242381SN/A * neither the name of the copyright holders nor the names of its
252381SN/A * contributors may be used to endorse or promote products derived from
262381SN/A * this software without specific prior written permission.
272381SN/A *
282381SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292381SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302381SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312381SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322381SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332381SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342381SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352381SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362381SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372381SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382381SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392665Ssaidi@eecs.umich.edu *
402665Ssaidi@eecs.umich.edu * Authors: Ron Dreslinski
418853Sandreas.hansson@arm.com *          Andreas Hansson
428922Swilliam.wang@arm.com *          William Wang
432381SN/A */
442381SN/A
452381SN/A/**
462381SN/A * @file
478922Swilliam.wang@arm.com * Port Object Declaration.
482381SN/A */
492381SN/A
502381SN/A#ifndef __MEM_PORT_HH__
512381SN/A#define __MEM_PORT_HH__
522381SN/A
539235Sandreas.hansson@arm.com#include "base/addr_range.hh"
542381SN/A#include "mem/packet.hh"
552381SN/A
563401Sktlim@umich.educlass MemObject;
573401Sktlim@umich.edu
582381SN/A/**
598922Swilliam.wang@arm.com * Ports are used to interface memory objects to each other. A port is
608922Swilliam.wang@arm.com * either a master or a slave and the connected peer is always of the
619087Sandreas.hansson@arm.com * opposite role. Each port has a name, an owner, and an identifier.
622381SN/A */
638708Sandreas.hansson@arm.comclass Port
642381SN/A{
658922Swilliam.wang@arm.com
668922Swilliam.wang@arm.com  private:
678922Swilliam.wang@arm.com
688922Swilliam.wang@arm.com    /** Descriptive name (for DPRINTF output) */
698922Swilliam.wang@arm.com    std::string portName;
708922Swilliam.wang@arm.com
715476Snate@binkert.org  protected:
722640Sstever@eecs.umich.edu
738965Sandreas.hansson@arm.com    /**
748965Sandreas.hansson@arm.com     * A numeric identifier to distinguish ports in a vector, and set
759031Sandreas.hansson@arm.com     * to InvalidPortID in case this port is not part of a vector.
768965Sandreas.hansson@arm.com     */
779031Sandreas.hansson@arm.com    const PortID id;
788965Sandreas.hansson@arm.com
798922Swilliam.wang@arm.com    /** A reference to the MemObject that owns this port. */
808922Swilliam.wang@arm.com    MemObject& owner;
818922Swilliam.wang@arm.com
828922Swilliam.wang@arm.com    /**
838922Swilliam.wang@arm.com     * Abstract base class for ports
848922Swilliam.wang@arm.com     *
858922Swilliam.wang@arm.com     * @param _name Port name including the owners name
868922Swilliam.wang@arm.com     * @param _owner The MemObject that is the structural owner of this port
878965Sandreas.hansson@arm.com     * @param _id A port identifier for vector ports
888922Swilliam.wang@arm.com     */
899031Sandreas.hansson@arm.com    Port(const std::string& _name, MemObject& _owner, PortID _id);
908922Swilliam.wang@arm.com
918922Swilliam.wang@arm.com    /**
928922Swilliam.wang@arm.com     * Virtual destructor due to inheritance.
938922Swilliam.wang@arm.com     */
948922Swilliam.wang@arm.com    virtual ~Port();
953401Sktlim@umich.edu
962381SN/A  public:
972640Sstever@eecs.umich.edu
982640Sstever@eecs.umich.edu    /** Return port name (for DPRINTF). */
998922Swilliam.wang@arm.com    const std::string name() const { return portName; }
1004190Ssaidi@eecs.umich.edu
1018965Sandreas.hansson@arm.com    /** Get the port id. */
1029031Sandreas.hansson@arm.com    PortID getId() const { return id; }
1038965Sandreas.hansson@arm.com
1048922Swilliam.wang@arm.com};
1058922Swilliam.wang@arm.com
1068922Swilliam.wang@arm.com/** Forward declaration */
1079294Sandreas.hansson@arm.comclass BaseSlavePort;
1089294Sandreas.hansson@arm.com
1099294Sandreas.hansson@arm.com/**
1109294Sandreas.hansson@arm.com * A BaseMasterPort is a protocol-agnostic master port, responsible
1119294Sandreas.hansson@arm.com * only for the structural connection to a slave port. The final
1129294Sandreas.hansson@arm.com * master port that inherits from the base class must override the
1139294Sandreas.hansson@arm.com * bind member function for the specific slave port class.
1149294Sandreas.hansson@arm.com */
1159294Sandreas.hansson@arm.comclass BaseMasterPort : public Port
1169294Sandreas.hansson@arm.com{
1179294Sandreas.hansson@arm.com
1189294Sandreas.hansson@arm.com  protected:
1199294Sandreas.hansson@arm.com
1209294Sandreas.hansson@arm.com    BaseSlavePort* _baseSlavePort;
1219294Sandreas.hansson@arm.com
1229294Sandreas.hansson@arm.com    BaseMasterPort(const std::string& name, MemObject* owner,
1239294Sandreas.hansson@arm.com                   PortID id = InvalidPortID);
1249294Sandreas.hansson@arm.com    virtual ~BaseMasterPort();
1259294Sandreas.hansson@arm.com
1269294Sandreas.hansson@arm.com  public:
1279294Sandreas.hansson@arm.com
1289294Sandreas.hansson@arm.com    virtual void bind(BaseSlavePort& slave_port) = 0;
1299294Sandreas.hansson@arm.com    virtual void unbind() = 0;
1309294Sandreas.hansson@arm.com    BaseSlavePort& getSlavePort() const;
1319294Sandreas.hansson@arm.com    bool isConnected() const;
1329294Sandreas.hansson@arm.com
1339294Sandreas.hansson@arm.com};
1349294Sandreas.hansson@arm.com
1359294Sandreas.hansson@arm.com/**
1369294Sandreas.hansson@arm.com * A BaseSlavePort is a protocol-agnostic slave port, responsible
1379294Sandreas.hansson@arm.com * only for the structural connection to a master port.
1389294Sandreas.hansson@arm.com */
1399294Sandreas.hansson@arm.comclass BaseSlavePort : public Port
1409294Sandreas.hansson@arm.com{
1419294Sandreas.hansson@arm.com
1429294Sandreas.hansson@arm.com  protected:
1439294Sandreas.hansson@arm.com
1449294Sandreas.hansson@arm.com    BaseMasterPort* _baseMasterPort;
1459294Sandreas.hansson@arm.com
1469294Sandreas.hansson@arm.com    BaseSlavePort(const std::string& name, MemObject* owner,
1479294Sandreas.hansson@arm.com                  PortID id = InvalidPortID);
1489294Sandreas.hansson@arm.com    virtual ~BaseSlavePort();
1499294Sandreas.hansson@arm.com
1509294Sandreas.hansson@arm.com  public:
1519294Sandreas.hansson@arm.com
1529294Sandreas.hansson@arm.com    BaseMasterPort& getMasterPort() const;
1539294Sandreas.hansson@arm.com    bool isConnected() const;
1549294Sandreas.hansson@arm.com
1559294Sandreas.hansson@arm.com};
1569294Sandreas.hansson@arm.com
1579294Sandreas.hansson@arm.com/** Forward declaration */
1588922Swilliam.wang@arm.comclass SlavePort;
1598922Swilliam.wang@arm.com
1608922Swilliam.wang@arm.com/**
1619294Sandreas.hansson@arm.com * A MasterPort is a specialisation of a BaseMasterPort, which
1629294Sandreas.hansson@arm.com * implements the default protocol for the three different level of
1639294Sandreas.hansson@arm.com * transport functions. In addition to the basic functionality of
1649294Sandreas.hansson@arm.com * sending packets, it also has functions to receive range changes or
1659294Sandreas.hansson@arm.com * determine if the port is snooping or not.
1668922Swilliam.wang@arm.com */
1679294Sandreas.hansson@arm.comclass MasterPort : public BaseMasterPort
1688922Swilliam.wang@arm.com{
1698922Swilliam.wang@arm.com
1708975Sandreas.hansson@arm.com    friend class SlavePort;
1718975Sandreas.hansson@arm.com
1728922Swilliam.wang@arm.com  private:
1738922Swilliam.wang@arm.com
1748922Swilliam.wang@arm.com    SlavePort* _slavePort;
1758922Swilliam.wang@arm.com
1768922Swilliam.wang@arm.com  public:
1778922Swilliam.wang@arm.com
1788965Sandreas.hansson@arm.com    MasterPort(const std::string& name, MemObject* owner,
1799031Sandreas.hansson@arm.com               PortID id = InvalidPortID);
1808922Swilliam.wang@arm.com    virtual ~MasterPort();
1818922Swilliam.wang@arm.com
1829178Sandreas.hansson@arm.com    /**
1839178Sandreas.hansson@arm.com     * Bind this master port to a slave port. This also does the
1849178Sandreas.hansson@arm.com     * mirror action and binds the slave port to the master port.
1859178Sandreas.hansson@arm.com     */
1869294Sandreas.hansson@arm.com    void bind(BaseSlavePort& slave_port);
1879178Sandreas.hansson@arm.com
1889178Sandreas.hansson@arm.com    /**
1899178Sandreas.hansson@arm.com     * Unbind this master port and the associated slave port.
1909178Sandreas.hansson@arm.com     */
1919178Sandreas.hansson@arm.com    void unbind();
1929178Sandreas.hansson@arm.com
1938922Swilliam.wang@arm.com    /**
1948948Sandreas.hansson@arm.com     * Send an atomic request packet, where the data is moved and the
1958948Sandreas.hansson@arm.com     * state is updated in zero time, without interleaving with other
1968948Sandreas.hansson@arm.com     * memory accesses.
1978948Sandreas.hansson@arm.com     *
1988948Sandreas.hansson@arm.com     * @param pkt Packet to send.
1998948Sandreas.hansson@arm.com     *
2008948Sandreas.hansson@arm.com     * @return Estimated latency of access.
2018948Sandreas.hansson@arm.com     */
2028948Sandreas.hansson@arm.com    Tick sendAtomic(PacketPtr pkt);
2038948Sandreas.hansson@arm.com
2048948Sandreas.hansson@arm.com    /**
2058948Sandreas.hansson@arm.com     * Send a functional request packet, where the data is instantly
2068948Sandreas.hansson@arm.com     * updated everywhere in the memory system, without affecting the
2078948Sandreas.hansson@arm.com     * current state of any block or moving the block.
2088948Sandreas.hansson@arm.com     *
2098948Sandreas.hansson@arm.com     * @param pkt Packet to send.
2108948Sandreas.hansson@arm.com     */
2118948Sandreas.hansson@arm.com    void sendFunctional(PacketPtr pkt);
2128948Sandreas.hansson@arm.com
2138948Sandreas.hansson@arm.com    /**
2148975Sandreas.hansson@arm.com     * Attempt to send a timing request to the slave port by calling
2158975Sandreas.hansson@arm.com     * its corresponding receive function. If the send does not
2168975Sandreas.hansson@arm.com     * succeed, as indicated by the return value, then the sender must
21710713Sandreas.hansson@arm.com     * wait for a recvReqRetry at which point it can re-issue a
2188975Sandreas.hansson@arm.com     * sendTimingReq.
2198975Sandreas.hansson@arm.com     *
2208975Sandreas.hansson@arm.com     * @param pkt Packet to send.
2218975Sandreas.hansson@arm.com     *
2228975Sandreas.hansson@arm.com     * @return If the send was succesful or not.
2238975Sandreas.hansson@arm.com    */
2248975Sandreas.hansson@arm.com    bool sendTimingReq(PacketPtr pkt);
2258948Sandreas.hansson@arm.com
2268948Sandreas.hansson@arm.com    /**
2278975Sandreas.hansson@arm.com     * Attempt to send a timing snoop response packet to the slave
2288975Sandreas.hansson@arm.com     * port by calling its corresponding receive function. If the send
2298975Sandreas.hansson@arm.com     * does not succeed, as indicated by the return value, then the
23010713Sandreas.hansson@arm.com     * sender must wait for a recvRetrySnoop at which point it can
23110713Sandreas.hansson@arm.com     * re-issue a sendTimingSnoopResp.
2328975Sandreas.hansson@arm.com     *
2338975Sandreas.hansson@arm.com     * @param pkt Packet to send.
2348948Sandreas.hansson@arm.com     */
2358975Sandreas.hansson@arm.com    bool sendTimingSnoopResp(PacketPtr pkt);
2368922Swilliam.wang@arm.com
2378922Swilliam.wang@arm.com    /**
2389087Sandreas.hansson@arm.com     * Send a retry to the slave port that previously attempted a
23910713Sandreas.hansson@arm.com     * sendTimingResp to this master port and failed. Note that this
24010713Sandreas.hansson@arm.com     * is virtual so that the "fake" snoop response port in the
24110713Sandreas.hansson@arm.com     * coherent crossbar can override the behaviour.
2429087Sandreas.hansson@arm.com     */
24310713Sandreas.hansson@arm.com    virtual void sendRetryResp();
2449087Sandreas.hansson@arm.com
2459087Sandreas.hansson@arm.com    /**
2468922Swilliam.wang@arm.com     * Determine if this master port is snooping or not. The default
2478711Sandreas.hansson@arm.com     * implementation returns false and thus tells the neighbour we
2488922Swilliam.wang@arm.com     * are not snooping. Any master port that wants to receive snoop
2498922Swilliam.wang@arm.com     * requests (e.g. a cache connected to a bus) has to override this
2508922Swilliam.wang@arm.com     * function.
2518711Sandreas.hansson@arm.com     *
2528711Sandreas.hansson@arm.com     * @return true if the port should be considered a snooper
2538711Sandreas.hansson@arm.com     */
2548922Swilliam.wang@arm.com    virtual bool isSnooping() const { return false; }
2552381SN/A
2568711Sandreas.hansson@arm.com    /**
2579089Sandreas.hansson@arm.com     * Get the address ranges of the connected slave port.
2589089Sandreas.hansson@arm.com     */
2599089Sandreas.hansson@arm.com    AddrRangeList getAddrRanges() const;
2609089Sandreas.hansson@arm.com
2615314Sstever@gmail.com    /** Inject a PrintReq for the given address to print the state of
2625314Sstever@gmail.com     * that address throughout the memory system.  For debugging.
2635314Sstever@gmail.com     */
2645314Sstever@gmail.com    void printAddr(Addr a);
2658975Sandreas.hansson@arm.com
2668975Sandreas.hansson@arm.com  protected:
2678975Sandreas.hansson@arm.com
2688975Sandreas.hansson@arm.com    /**
2698975Sandreas.hansson@arm.com     * Receive an atomic snoop request packet from the slave port.
2708975Sandreas.hansson@arm.com     */
2718975Sandreas.hansson@arm.com    virtual Tick recvAtomicSnoop(PacketPtr pkt)
2728975Sandreas.hansson@arm.com    {
2738975Sandreas.hansson@arm.com        panic("%s was not expecting an atomic snoop request\n", name());
2748975Sandreas.hansson@arm.com        return 0;
2758975Sandreas.hansson@arm.com    }
2768975Sandreas.hansson@arm.com
2778975Sandreas.hansson@arm.com    /**
2788975Sandreas.hansson@arm.com     * Receive a functional snoop request packet from the slave port.
2798975Sandreas.hansson@arm.com     */
2808975Sandreas.hansson@arm.com    virtual void recvFunctionalSnoop(PacketPtr pkt)
2818975Sandreas.hansson@arm.com    {
2828975Sandreas.hansson@arm.com        panic("%s was not expecting a functional snoop request\n", name());
2838975Sandreas.hansson@arm.com    }
2848975Sandreas.hansson@arm.com
2858975Sandreas.hansson@arm.com    /**
2868975Sandreas.hansson@arm.com     * Receive a timing response from the slave port.
2878975Sandreas.hansson@arm.com     */
2888975Sandreas.hansson@arm.com    virtual bool recvTimingResp(PacketPtr pkt) = 0;
2898975Sandreas.hansson@arm.com
2908975Sandreas.hansson@arm.com    /**
2918975Sandreas.hansson@arm.com     * Receive a timing snoop request from the slave port.
2928975Sandreas.hansson@arm.com     */
2938975Sandreas.hansson@arm.com    virtual void recvTimingSnoopReq(PacketPtr pkt)
2948975Sandreas.hansson@arm.com    {
2958975Sandreas.hansson@arm.com        panic("%s was not expecting a timing snoop request\n", name());
2968975Sandreas.hansson@arm.com    }
2978975Sandreas.hansson@arm.com
2988975Sandreas.hansson@arm.com    /**
29910713Sandreas.hansson@arm.com     * Called by the slave port if sendTimingReq was called on this
30010713Sandreas.hansson@arm.com     * master port (causing recvTimingReq to be called on the slave
30110713Sandreas.hansson@arm.com     * port) and was unsuccesful.
3029087Sandreas.hansson@arm.com     */
30310713Sandreas.hansson@arm.com    virtual void recvReqRetry() = 0;
30410713Sandreas.hansson@arm.com
30510713Sandreas.hansson@arm.com    /**
30610713Sandreas.hansson@arm.com     * Called by the slave port if sendTimingSnoopResp was called on this
30710713Sandreas.hansson@arm.com     * master port (causing recvTimingSnoopResp to be called on the slave
30810713Sandreas.hansson@arm.com     * port) and was unsuccesful.
30910713Sandreas.hansson@arm.com     */
31010713Sandreas.hansson@arm.com    virtual void recvRetrySnoopResp()
31110713Sandreas.hansson@arm.com    {
31210713Sandreas.hansson@arm.com        panic("%s was not expecting a snoop retry\n", name());
31310713Sandreas.hansson@arm.com    }
3149087Sandreas.hansson@arm.com
3159087Sandreas.hansson@arm.com    /**
3168975Sandreas.hansson@arm.com     * Called to receive an address range change from the peer slave
3179325Sandreas.hansson@arm.com     * port. The default implementation ignores the change and does
3188975Sandreas.hansson@arm.com     * nothing. Override this function in a derived class if the owner
3199325Sandreas.hansson@arm.com     * needs to be aware of the address ranges, e.g. in an
3208975Sandreas.hansson@arm.com     * interconnect component like a bus.
3218975Sandreas.hansson@arm.com     */
3228975Sandreas.hansson@arm.com    virtual void recvRangeChange() { }
3232381SN/A};
3242381SN/A
3258922Swilliam.wang@arm.com/**
3268922Swilliam.wang@arm.com * A SlavePort is a specialisation of a port. In addition to the
3278922Swilliam.wang@arm.com * basic functionality of sending packets to its master peer, it also
3288922Swilliam.wang@arm.com * has functions specific to a slave, e.g. to send range changes
3298922Swilliam.wang@arm.com * and get the address ranges that the port responds to.
3308922Swilliam.wang@arm.com */
3319294Sandreas.hansson@arm.comclass SlavePort : public BaseSlavePort
3328922Swilliam.wang@arm.com{
3338922Swilliam.wang@arm.com
3348975Sandreas.hansson@arm.com    friend class MasterPort;
3358975Sandreas.hansson@arm.com
3368922Swilliam.wang@arm.com  private:
3378922Swilliam.wang@arm.com
3388922Swilliam.wang@arm.com    MasterPort* _masterPort;
3398922Swilliam.wang@arm.com
3408922Swilliam.wang@arm.com  public:
3418922Swilliam.wang@arm.com
3428965Sandreas.hansson@arm.com    SlavePort(const std::string& name, MemObject* owner,
3439031Sandreas.hansson@arm.com              PortID id = InvalidPortID);
3448922Swilliam.wang@arm.com    virtual ~SlavePort();
3458922Swilliam.wang@arm.com
3468922Swilliam.wang@arm.com    /**
3478948Sandreas.hansson@arm.com     * Send an atomic snoop request packet, where the data is moved
3488948Sandreas.hansson@arm.com     * and the state is updated in zero time, without interleaving
3498948Sandreas.hansson@arm.com     * with other memory accesses.
3508948Sandreas.hansson@arm.com     *
3518948Sandreas.hansson@arm.com     * @param pkt Snoop packet to send.
3528948Sandreas.hansson@arm.com     *
3538948Sandreas.hansson@arm.com     * @return Estimated latency of access.
3548948Sandreas.hansson@arm.com     */
3558948Sandreas.hansson@arm.com    Tick sendAtomicSnoop(PacketPtr pkt);
3568948Sandreas.hansson@arm.com
3578948Sandreas.hansson@arm.com    /**
3588948Sandreas.hansson@arm.com     * Send a functional snoop request packet, where the data is
3598948Sandreas.hansson@arm.com     * instantly updated everywhere in the memory system, without
3608948Sandreas.hansson@arm.com     * affecting the current state of any block or moving the block.
3618948Sandreas.hansson@arm.com     *
3628948Sandreas.hansson@arm.com     * @param pkt Snoop packet to send.
3638948Sandreas.hansson@arm.com     */
3648948Sandreas.hansson@arm.com    void sendFunctionalSnoop(PacketPtr pkt);
3658948Sandreas.hansson@arm.com
3668948Sandreas.hansson@arm.com    /**
3678975Sandreas.hansson@arm.com     * Attempt to send a timing response to the master port by calling
3688975Sandreas.hansson@arm.com     * its corresponding receive function. If the send does not
3698975Sandreas.hansson@arm.com     * succeed, as indicated by the return value, then the sender must
37010713Sandreas.hansson@arm.com     * wait for a recvRespRetry at which point it can re-issue a
3718975Sandreas.hansson@arm.com     * sendTimingResp.
3728975Sandreas.hansson@arm.com     *
3738975Sandreas.hansson@arm.com     * @param pkt Packet to send.
3748975Sandreas.hansson@arm.com     *
3758975Sandreas.hansson@arm.com     * @return If the send was succesful or not.
3768975Sandreas.hansson@arm.com    */
3778975Sandreas.hansson@arm.com    bool sendTimingResp(PacketPtr pkt);
3788948Sandreas.hansson@arm.com
3798948Sandreas.hansson@arm.com    /**
3808975Sandreas.hansson@arm.com     * Attempt to send a timing snoop request packet to the master port
3818975Sandreas.hansson@arm.com     * by calling its corresponding receive function. Snoop requests
3828975Sandreas.hansson@arm.com     * always succeed and hence no return value is needed.
3838975Sandreas.hansson@arm.com     *
3848975Sandreas.hansson@arm.com     * @param pkt Packet to send.
3858948Sandreas.hansson@arm.com     */
3868975Sandreas.hansson@arm.com    void sendTimingSnoopReq(PacketPtr pkt);
3878948Sandreas.hansson@arm.com
3888948Sandreas.hansson@arm.com    /**
3899087Sandreas.hansson@arm.com     * Send a retry to the master port that previously attempted a
39010713Sandreas.hansson@arm.com     * sendTimingReq to this slave port and failed.
3919087Sandreas.hansson@arm.com     */
39210713Sandreas.hansson@arm.com    void sendRetryReq();
39310713Sandreas.hansson@arm.com
39410713Sandreas.hansson@arm.com    /**
39510713Sandreas.hansson@arm.com     * Send a retry to the master port that previously attempted a
39610713Sandreas.hansson@arm.com     * sendTimingSnoopResp to this slave port and failed.
39710713Sandreas.hansson@arm.com     */
39810713Sandreas.hansson@arm.com    void sendRetrySnoopResp();
3999087Sandreas.hansson@arm.com
4009087Sandreas.hansson@arm.com    /**
4019088Sandreas.hansson@arm.com     * Find out if the peer master port is snooping or not.
4029088Sandreas.hansson@arm.com     *
4039088Sandreas.hansson@arm.com     * @return true if the peer master port is snooping
4049088Sandreas.hansson@arm.com     */
4059088Sandreas.hansson@arm.com    bool isSnooping() const { return _masterPort->isSnooping(); }
4069088Sandreas.hansson@arm.com
4079088Sandreas.hansson@arm.com    /**
4088922Swilliam.wang@arm.com     * Called by the owner to send a range change
4098922Swilliam.wang@arm.com     */
41010413SCurtis.Dunham@arm.com    void sendRangeChange() const {
41110413SCurtis.Dunham@arm.com        if (!_masterPort)
41210413SCurtis.Dunham@arm.com            fatal("%s cannot sendRangeChange() without master port", name());
41310413SCurtis.Dunham@arm.com        _masterPort->recvRangeChange();
41410413SCurtis.Dunham@arm.com    }
4158922Swilliam.wang@arm.com
4168922Swilliam.wang@arm.com    /**
4178922Swilliam.wang@arm.com     * Get a list of the non-overlapping address ranges the owner is
4188922Swilliam.wang@arm.com     * responsible for. All slave ports must override this function
4198922Swilliam.wang@arm.com     * and return a populated list with at least one item.
4208922Swilliam.wang@arm.com     *
4218922Swilliam.wang@arm.com     * @return a list of ranges responded to
4228922Swilliam.wang@arm.com     */
4239090Sandreas.hansson@arm.com    virtual AddrRangeList getAddrRanges() const = 0;
4248975Sandreas.hansson@arm.com
4258975Sandreas.hansson@arm.com  protected:
4268975Sandreas.hansson@arm.com
4278975Sandreas.hansson@arm.com    /**
4289178Sandreas.hansson@arm.com     * Called by the master port to unbind. Should never be called
4299178Sandreas.hansson@arm.com     * directly.
4309178Sandreas.hansson@arm.com     */
4319178Sandreas.hansson@arm.com    void unbind();
4329178Sandreas.hansson@arm.com
4339178Sandreas.hansson@arm.com    /**
4349178Sandreas.hansson@arm.com     * Called by the master port to bind. Should never be called
4359178Sandreas.hansson@arm.com     * directly.
4369178Sandreas.hansson@arm.com     */
4379178Sandreas.hansson@arm.com    void bind(MasterPort& master_port);
4389178Sandreas.hansson@arm.com
4399178Sandreas.hansson@arm.com    /**
4408975Sandreas.hansson@arm.com     * Receive an atomic request packet from the master port.
4418975Sandreas.hansson@arm.com     */
4428975Sandreas.hansson@arm.com    virtual Tick recvAtomic(PacketPtr pkt) = 0;
4438975Sandreas.hansson@arm.com
4448975Sandreas.hansson@arm.com    /**
4458975Sandreas.hansson@arm.com     * Receive a functional request packet from the master port.
4468975Sandreas.hansson@arm.com     */
4478975Sandreas.hansson@arm.com    virtual void recvFunctional(PacketPtr pkt) = 0;
4488975Sandreas.hansson@arm.com
4498975Sandreas.hansson@arm.com    /**
4508975Sandreas.hansson@arm.com     * Receive a timing request from the master port.
4518975Sandreas.hansson@arm.com     */
4528975Sandreas.hansson@arm.com    virtual bool recvTimingReq(PacketPtr pkt) = 0;
4538975Sandreas.hansson@arm.com
4548975Sandreas.hansson@arm.com    /**
4558975Sandreas.hansson@arm.com     * Receive a timing snoop response from the master port.
4568975Sandreas.hansson@arm.com     */
4578975Sandreas.hansson@arm.com    virtual bool recvTimingSnoopResp(PacketPtr pkt)
4588975Sandreas.hansson@arm.com    {
4598975Sandreas.hansson@arm.com        panic("%s was not expecting a timing snoop response\n", name());
4608975Sandreas.hansson@arm.com    }
4618975Sandreas.hansson@arm.com
4629087Sandreas.hansson@arm.com    /**
4639087Sandreas.hansson@arm.com     * Called by the master port if sendTimingResp was called on this
4649087Sandreas.hansson@arm.com     * slave port (causing recvTimingResp to be called on the master
4659087Sandreas.hansson@arm.com     * port) and was unsuccesful.
4669087Sandreas.hansson@arm.com     */
46710713Sandreas.hansson@arm.com    virtual void recvRespRetry() = 0;
4689087Sandreas.hansson@arm.com
4698922Swilliam.wang@arm.com};
4708922Swilliam.wang@arm.com
4712381SN/A#endif //__MEM_PORT_HH__
472