port.hh revision 9716
12221SN/A/*
22221SN/A * Copyright (c) 2011-2012 ARM Limited
32221SN/A * All rights reserved
42221SN/A *
52221SN/A * The license below extends only to copyright in the software and shall
62221SN/A * not be construed as granting a license to any other intellectual
72221SN/A * property including but not limited to intellectual property relating
82221SN/A * to a hardware implementation of the functionality of the software
92221SN/A * licensed hereunder.  You may use the software subject to the license
102221SN/A * terms below provided that you ensure that this notice is replicated
112221SN/A * unmodified and in its entirety in all distributions of the software,
122221SN/A * modified or unmodified, in source code or in binary form.
132221SN/A *
142221SN/A * Copyright (c) 2002-2005 The Regents of The University of Michigan
152221SN/A * All rights reserved.
162221SN/A *
172221SN/A * Redistribution and use in source and binary forms, with or without
182221SN/A * modification, are permitted provided that the following conditions are
192221SN/A * met: redistributions of source code must retain the above copyright
202221SN/A * notice, this list of conditions and the following disclaimer;
212221SN/A * redistributions in binary form must reproduce the above copyright
222221SN/A * notice, this list of conditions and the following disclaimer in the
232221SN/A * documentation and/or other materials provided with the distribution;
242221SN/A * neither the name of the copyright holders nor the names of its
252221SN/A * contributors may be used to endorse or promote products derived from
262221SN/A * this software without specific prior written permission.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292665Ssaidi@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302221SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312221SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
323415Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
333415Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342223SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
353415Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
363578Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
373415Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
383415Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
393523Sgblack@eecs.umich.edu *
403415Sgblack@eecs.umich.edu * Authors: Ron Dreslinski
412680Sktlim@umich.edu *          Andreas Hansson
422800Ssaidi@eecs.umich.edu *          William Wang
433523Sgblack@eecs.umich.edu */
443415Sgblack@eecs.umich.edu
452800Ssaidi@eecs.umich.edu/**
462800Ssaidi@eecs.umich.edu * @file
472221SN/A * Port Object Declaration.
483415Sgblack@eecs.umich.edu */
493415Sgblack@eecs.umich.edu
502223SN/A#ifndef __MEM_PORT_HH__
512221SN/A#define __MEM_PORT_HH__
522221SN/A
533573Sgblack@eecs.umich.edu#include <list>
543576Sgblack@eecs.umich.edu
553576Sgblack@eecs.umich.edu#include "base/addr_range.hh"
562221SN/A#include "mem/packet.hh"
573573Sgblack@eecs.umich.edu
583576Sgblack@eecs.umich.edu/**
593576Sgblack@eecs.umich.edu * This typedef is used to clean up getAddrRanges(). It's declared
602221SN/A * outside the Port object since it's also used by some mem objects.
613573Sgblack@eecs.umich.edu * Eventually we should move this typedef to wherever Addr is
623576Sgblack@eecs.umich.edu * defined.
633576Sgblack@eecs.umich.edu */
642221SN/A
653573Sgblack@eecs.umich.edutypedef std::list<AddrRange> AddrRangeList;
663576Sgblack@eecs.umich.edutypedef std::list<AddrRange>::iterator AddrRangeIter;
673576Sgblack@eecs.umich.edutypedef std::list<AddrRange>::const_iterator AddrRangeConstIter;
682221SN/A
693573Sgblack@eecs.umich.educlass MemObject;
703576Sgblack@eecs.umich.edu
713576Sgblack@eecs.umich.edu/**
722221SN/A * Ports are used to interface memory objects to each other. A port is
733573Sgblack@eecs.umich.edu * either a master or a slave and the connected peer is always of the
743576Sgblack@eecs.umich.edu * opposite role. Each port has a name, an owner, and an identifier.
753576Sgblack@eecs.umich.edu */
762221SN/Aclass Port
773573Sgblack@eecs.umich.edu{
783576Sgblack@eecs.umich.edu
793576Sgblack@eecs.umich.edu  private:
803576Sgblack@eecs.umich.edu
813576Sgblack@eecs.umich.edu    /** Descriptive name (for DPRINTF output) */
823576Sgblack@eecs.umich.edu    std::string portName;
833576Sgblack@eecs.umich.edu
843576Sgblack@eecs.umich.edu  protected:
852221SN/A
863573Sgblack@eecs.umich.edu    /**
873576Sgblack@eecs.umich.edu     * A numeric identifier to distinguish ports in a vector, and set
883576Sgblack@eecs.umich.edu     * to InvalidPortID in case this port is not part of a vector.
892221SN/A     */
903573Sgblack@eecs.umich.edu    const PortID id;
913576Sgblack@eecs.umich.edu
923576Sgblack@eecs.umich.edu    /** A reference to the MemObject that owns this port. */
932221SN/A    MemObject& owner;
943573Sgblack@eecs.umich.edu
953576Sgblack@eecs.umich.edu    /**
963576Sgblack@eecs.umich.edu     * Abstract base class for ports
973576Sgblack@eecs.umich.edu     *
983576Sgblack@eecs.umich.edu     * @param _name Port name including the owners name
993576Sgblack@eecs.umich.edu     * @param _owner The MemObject that is the structural owner of this port
1003576Sgblack@eecs.umich.edu     * @param _id A port identifier for vector ports
1013576Sgblack@eecs.umich.edu     */
1023576Sgblack@eecs.umich.edu    Port(const std::string& _name, MemObject& _owner, PortID _id);
1033576Sgblack@eecs.umich.edu
1043576Sgblack@eecs.umich.edu    /**
1053576Sgblack@eecs.umich.edu     * Virtual destructor due to inheritance.
1063576Sgblack@eecs.umich.edu     */
1072221SN/A    virtual ~Port();
1083573Sgblack@eecs.umich.edu
1093576Sgblack@eecs.umich.edu  public:
1103576Sgblack@eecs.umich.edu
1112221SN/A    /** Return port name (for DPRINTF). */
1123573Sgblack@eecs.umich.edu    const std::string name() const { return portName; }
1133576Sgblack@eecs.umich.edu
1143576Sgblack@eecs.umich.edu    /** Get the port id. */
1152221SN/A    PortID getId() const { return id; }
1163573Sgblack@eecs.umich.edu
1173576Sgblack@eecs.umich.edu};
1183576Sgblack@eecs.umich.edu
1192221SN/A/** Forward declaration */
1203573Sgblack@eecs.umich.educlass BaseSlavePort;
1213576Sgblack@eecs.umich.edu
1223576Sgblack@eecs.umich.edu/**
1232221SN/A * A BaseMasterPort is a protocol-agnostic master port, responsible
1243573Sgblack@eecs.umich.edu * only for the structural connection to a slave port. The final
1253576Sgblack@eecs.umich.edu * master port that inherits from the base class must override the
1263576Sgblack@eecs.umich.edu * bind member function for the specific slave port class.
1272221SN/A */
1283573Sgblack@eecs.umich.educlass BaseMasterPort : public Port
1293576Sgblack@eecs.umich.edu{
1303576Sgblack@eecs.umich.edu
1312223SN/A  protected:
1323573Sgblack@eecs.umich.edu
1333576Sgblack@eecs.umich.edu    BaseSlavePort* _baseSlavePort;
1343576Sgblack@eecs.umich.edu
1352223SN/A    BaseMasterPort(const std::string& name, MemObject* owner,
1363573Sgblack@eecs.umich.edu                   PortID id = InvalidPortID);
1373576Sgblack@eecs.umich.edu    virtual ~BaseMasterPort();
1383576Sgblack@eecs.umich.edu
1392223SN/A  public:
1403573Sgblack@eecs.umich.edu
1413576Sgblack@eecs.umich.edu    virtual void bind(BaseSlavePort& slave_port) = 0;
1423576Sgblack@eecs.umich.edu    virtual void unbind() = 0;
1432223SN/A    BaseSlavePort& getSlavePort() const;
1443573Sgblack@eecs.umich.edu    bool isConnected() const;
1453576Sgblack@eecs.umich.edu
1463576Sgblack@eecs.umich.edu};
1473576Sgblack@eecs.umich.edu
1483576Sgblack@eecs.umich.edu/**
1493576Sgblack@eecs.umich.edu * A BaseSlavePort is a protocol-agnostic slave port, responsible
1503576Sgblack@eecs.umich.edu * only for the structural connection to a master port.
1513576Sgblack@eecs.umich.edu */
1522223SN/Aclass BaseSlavePort : public Port
1533573Sgblack@eecs.umich.edu{
1543576Sgblack@eecs.umich.edu
1553576Sgblack@eecs.umich.edu  protected:
1562223SN/A
1573573Sgblack@eecs.umich.edu    BaseMasterPort* _baseMasterPort;
1583576Sgblack@eecs.umich.edu
1593576Sgblack@eecs.umich.edu    BaseSlavePort(const std::string& name, MemObject* owner,
1602223SN/A                  PortID id = InvalidPortID);
1613573Sgblack@eecs.umich.edu    virtual ~BaseSlavePort();
1623576Sgblack@eecs.umich.edu
1633576Sgblack@eecs.umich.edu  public:
1642223SN/A
1653573Sgblack@eecs.umich.edu    BaseMasterPort& getMasterPort() const;
1663576Sgblack@eecs.umich.edu    bool isConnected() const;
1673576Sgblack@eecs.umich.edu
1682223SN/A};
1693573Sgblack@eecs.umich.edu
1703576Sgblack@eecs.umich.edu/** Forward declaration */
1713576Sgblack@eecs.umich.educlass SlavePort;
1722223SN/A
1733573Sgblack@eecs.umich.edu/**
1743576Sgblack@eecs.umich.edu * A MasterPort is a specialisation of a BaseMasterPort, which
1753576Sgblack@eecs.umich.edu * implements the default protocol for the three different level of
1762223SN/A * transport functions. In addition to the basic functionality of
1773573Sgblack@eecs.umich.edu * sending packets, it also has functions to receive range changes or
1783576Sgblack@eecs.umich.edu * determine if the port is snooping or not.
1793576Sgblack@eecs.umich.edu */
1802223SN/Aclass MasterPort : public BaseMasterPort
1813573Sgblack@eecs.umich.edu{
1823576Sgblack@eecs.umich.edu
1833576Sgblack@eecs.umich.edu    friend class SlavePort;
1842223SN/A
1853573Sgblack@eecs.umich.edu  private:
1863576Sgblack@eecs.umich.edu
1873576Sgblack@eecs.umich.edu    SlavePort* _slavePort;
1882223SN/A
1893573Sgblack@eecs.umich.edu  public:
1903576Sgblack@eecs.umich.edu
1913576Sgblack@eecs.umich.edu    MasterPort(const std::string& name, MemObject* owner,
1922223SN/A               PortID id = InvalidPortID);
1933576Sgblack@eecs.umich.edu    virtual ~MasterPort();
1943576Sgblack@eecs.umich.edu
1953576Sgblack@eecs.umich.edu    /**
1963576Sgblack@eecs.umich.edu     * Bind this master port to a slave port. This also does the
1972527SN/A     * mirror action and binds the slave port to the master port.
1983573Sgblack@eecs.umich.edu     */
1993576Sgblack@eecs.umich.edu    void bind(BaseSlavePort& slave_port);
2003890Ssaidi@eecs.umich.edu
2012223SN/A    /**
2023573Sgblack@eecs.umich.edu     * Unbind this master port and the associated slave port.
2033576Sgblack@eecs.umich.edu     */
2043576Sgblack@eecs.umich.edu    void unbind();
2052223SN/A
2063573Sgblack@eecs.umich.edu    /**
2073576Sgblack@eecs.umich.edu     * Send an atomic request packet, where the data is moved and the
2083576Sgblack@eecs.umich.edu     * state is updated in zero time, without interleaving with other
2092223SN/A     * memory accesses.
2103573Sgblack@eecs.umich.edu     *
2114103Ssaidi@eecs.umich.edu     * @param pkt Packet to send.
2124103Ssaidi@eecs.umich.edu     *
2134103Ssaidi@eecs.umich.edu     * @return Estimated latency of access.
2144103Ssaidi@eecs.umich.edu     */
2153576Sgblack@eecs.umich.edu    Tick sendAtomic(PacketPtr pkt);
2163576Sgblack@eecs.umich.edu
2172223SN/A    /**
2183573Sgblack@eecs.umich.edu     * Send a functional request packet, where the data is instantly
2193576Sgblack@eecs.umich.edu     * updated everywhere in the memory system, without affecting the
2203576Sgblack@eecs.umich.edu     * current state of any block or moving the block.
2212223SN/A     *
2223573Sgblack@eecs.umich.edu     * @param pkt Packet to send.
2233576Sgblack@eecs.umich.edu     */
2243576Sgblack@eecs.umich.edu    void sendFunctional(PacketPtr pkt);
2253576Sgblack@eecs.umich.edu
2263576Sgblack@eecs.umich.edu    /**
2273576Sgblack@eecs.umich.edu     * Attempt to send a timing request to the slave port by calling
2283576Sgblack@eecs.umich.edu     * its corresponding receive function. If the send does not
2293576Sgblack@eecs.umich.edu     * succeed, as indicated by the return value, then the sender must
2303576Sgblack@eecs.umich.edu     * wait for a recvRetry at which point it can re-issue a
2313576Sgblack@eecs.umich.edu     * sendTimingReq.
2323576Sgblack@eecs.umich.edu     *
2333576Sgblack@eecs.umich.edu     * @param pkt Packet to send.
2343576Sgblack@eecs.umich.edu     *
2353576Sgblack@eecs.umich.edu     * @return If the send was succesful or not.
2363576Sgblack@eecs.umich.edu    */
2373576Sgblack@eecs.umich.edu    bool sendTimingReq(PacketPtr pkt);
2383576Sgblack@eecs.umich.edu
2393576Sgblack@eecs.umich.edu    /**
2403576Sgblack@eecs.umich.edu     * Attempt to send a timing snoop response packet to the slave
2413576Sgblack@eecs.umich.edu     * port by calling its corresponding receive function. If the send
2423576Sgblack@eecs.umich.edu     * does not succeed, as indicated by the return value, then the
2433576Sgblack@eecs.umich.edu     * sender must wait for a recvRetry at which point it can re-issue
2443576Sgblack@eecs.umich.edu     * a sendTimingSnoopResp.
2453576Sgblack@eecs.umich.edu     *
2463576Sgblack@eecs.umich.edu     * @param pkt Packet to send.
2473893Shsul@eecs.umich.edu     */
2483576Sgblack@eecs.umich.edu    bool sendTimingSnoopResp(PacketPtr pkt);
2493576Sgblack@eecs.umich.edu
2503576Sgblack@eecs.umich.edu    /**
2513576Sgblack@eecs.umich.edu     * Send a retry to the slave port that previously attempted a
2523576Sgblack@eecs.umich.edu     * sendTimingResp to this master port and failed.
2533576Sgblack@eecs.umich.edu     */
2543576Sgblack@eecs.umich.edu    virtual void sendRetry();
2553576Sgblack@eecs.umich.edu
2563576Sgblack@eecs.umich.edu    /**
2573576Sgblack@eecs.umich.edu     * Determine if this master port is snooping or not. The default
2583576Sgblack@eecs.umich.edu     * implementation returns false and thus tells the neighbour we
2593576Sgblack@eecs.umich.edu     * are not snooping. Any master port that wants to receive snoop
2603576Sgblack@eecs.umich.edu     * requests (e.g. a cache connected to a bus) has to override this
2613576Sgblack@eecs.umich.edu     * function.
2623576Sgblack@eecs.umich.edu     *
2633576Sgblack@eecs.umich.edu     * @return true if the port should be considered a snooper
2643576Sgblack@eecs.umich.edu     */
2653576Sgblack@eecs.umich.edu    virtual bool isSnooping() const { return false; }
2663576Sgblack@eecs.umich.edu
2673576Sgblack@eecs.umich.edu    /**
2683576Sgblack@eecs.umich.edu     * Called by a peer port in order to determine the block size of
2692223SN/A     * the owner of this port.
2703415Sgblack@eecs.umich.edu     */
2713578Sgblack@eecs.umich.edu    virtual unsigned deviceBlockSize() const { return 0; }
2723578Sgblack@eecs.umich.edu
2733415Sgblack@eecs.umich.edu    /** Called by the associated device if it wishes to find out the blocksize
2743415Sgblack@eecs.umich.edu        of the device on attached to the peer port.
2753578Sgblack@eecs.umich.edu    */
2763415Sgblack@eecs.umich.edu    unsigned peerBlockSize() const;
2773578Sgblack@eecs.umich.edu
2783578Sgblack@eecs.umich.edu    /**
2794172Ssaidi@eecs.umich.edu     * Get the address ranges of the connected slave port.
2803578Sgblack@eecs.umich.edu     */
2813578Sgblack@eecs.umich.edu    AddrRangeList getAddrRanges() const;
2823578Sgblack@eecs.umich.edu
2833578Sgblack@eecs.umich.edu    /** Inject a PrintReq for the given address to print the state of
2844172Ssaidi@eecs.umich.edu     * that address throughout the memory system.  For debugging.
2853746Sgblack@eecs.umich.edu     */
2863746Sgblack@eecs.umich.edu    void printAddr(Addr a);
2874172Ssaidi@eecs.umich.edu
2883746Sgblack@eecs.umich.edu  protected:
2894172Ssaidi@eecs.umich.edu
2903578Sgblack@eecs.umich.edu    /**
2913578Sgblack@eecs.umich.edu     * Receive an atomic snoop request packet from the slave port.
2923578Sgblack@eecs.umich.edu     */
2933578Sgblack@eecs.umich.edu    virtual Tick recvAtomicSnoop(PacketPtr pkt)
2943578Sgblack@eecs.umich.edu    {
2953578Sgblack@eecs.umich.edu        panic("%s was not expecting an atomic snoop request\n", name());
2963578Sgblack@eecs.umich.edu        return 0;
2973578Sgblack@eecs.umich.edu    }
2983578Sgblack@eecs.umich.edu
2994172Ssaidi@eecs.umich.edu    /**
3004172Ssaidi@eecs.umich.edu     * Receive a functional snoop request packet from the slave port.
3014172Ssaidi@eecs.umich.edu     */
3024172Ssaidi@eecs.umich.edu    virtual void recvFunctionalSnoop(PacketPtr pkt)
3034172Ssaidi@eecs.umich.edu    {
3043761Sgblack@eecs.umich.edu        panic("%s was not expecting a functional snoop request\n", name());
3054172Ssaidi@eecs.umich.edu    }
3064172Ssaidi@eecs.umich.edu
3074172Ssaidi@eecs.umich.edu    /**
3084172Ssaidi@eecs.umich.edu     * Receive a timing response from the slave port.
3094172Ssaidi@eecs.umich.edu     */
3103578Sgblack@eecs.umich.edu    virtual bool recvTimingResp(PacketPtr pkt) = 0;
3113578Sgblack@eecs.umich.edu
3123578Sgblack@eecs.umich.edu    /**
3133578Sgblack@eecs.umich.edu     * Receive a timing snoop request from the slave port.
3143578Sgblack@eecs.umich.edu     */
3153928Ssaidi@eecs.umich.edu    virtual void recvTimingSnoopReq(PacketPtr pkt)
3163928Ssaidi@eecs.umich.edu    {
3173928Ssaidi@eecs.umich.edu        panic("%s was not expecting a timing snoop request\n", name());
3183928Ssaidi@eecs.umich.edu    }
3193928Ssaidi@eecs.umich.edu
3203578Sgblack@eecs.umich.edu    /**
3213578Sgblack@eecs.umich.edu     * Called by the slave port if sendTimingReq or
3223578Sgblack@eecs.umich.edu     * sendTimingSnoopResp was called on this master port (causing
3233578Sgblack@eecs.umich.edu     * recvTimingReq and recvTimingSnoopResp to be called on the
3243578Sgblack@eecs.umich.edu     * slave port) and was unsuccesful.
3253578Sgblack@eecs.umich.edu     */
3263578Sgblack@eecs.umich.edu    virtual void recvRetry() = 0;
3273578Sgblack@eecs.umich.edu
3283578Sgblack@eecs.umich.edu    /**
3293578Sgblack@eecs.umich.edu     * Called to receive an address range change from the peer slave
3303578Sgblack@eecs.umich.edu     * port. The default implementation ignores the change and does
3313578Sgblack@eecs.umich.edu     * nothing. Override this function in a derived class if the owner
3324172Ssaidi@eecs.umich.edu     * needs to be aware of the address ranges, e.g. in an
3333578Sgblack@eecs.umich.edu     * interconnect component like a bus.
3343578Sgblack@eecs.umich.edu     */
3354172Ssaidi@eecs.umich.edu    virtual void recvRangeChange() { }
3363578Sgblack@eecs.umich.edu};
3374172Ssaidi@eecs.umich.edu
3383578Sgblack@eecs.umich.edu/**
3393578Sgblack@eecs.umich.edu * A SlavePort is a specialisation of a port. In addition to the
3404172Ssaidi@eecs.umich.edu * basic functionality of sending packets to its master peer, it also
3413578Sgblack@eecs.umich.edu * has functions specific to a slave, e.g. to send range changes
3423578Sgblack@eecs.umich.edu * and get the address ranges that the port responds to.
3434172Ssaidi@eecs.umich.edu */
3443578Sgblack@eecs.umich.educlass SlavePort : public BaseSlavePort
3453578Sgblack@eecs.umich.edu{
3464172Ssaidi@eecs.umich.edu
3473578Sgblack@eecs.umich.edu    friend class MasterPort;
3483926Ssaidi@eecs.umich.edu
3493926Ssaidi@eecs.umich.edu  private:
3504172Ssaidi@eecs.umich.edu
3513578Sgblack@eecs.umich.edu    MasterPort* _masterPort;
3523578Sgblack@eecs.umich.edu
3533578Sgblack@eecs.umich.edu  public:
3543578Sgblack@eecs.umich.edu
3553578Sgblack@eecs.umich.edu    SlavePort(const std::string& name, MemObject* owner,
3563578Sgblack@eecs.umich.edu              PortID id = InvalidPortID);
3573578Sgblack@eecs.umich.edu    virtual ~SlavePort();
3583578Sgblack@eecs.umich.edu
3593578Sgblack@eecs.umich.edu    /**
3604172Ssaidi@eecs.umich.edu     * Send an atomic snoop request packet, where the data is moved
3613578Sgblack@eecs.umich.edu     * and the state is updated in zero time, without interleaving
3623578Sgblack@eecs.umich.edu     * with other memory accesses.
3633578Sgblack@eecs.umich.edu     *
3643578Sgblack@eecs.umich.edu     * @param pkt Snoop packet to send.
3653578Sgblack@eecs.umich.edu     *
3663578Sgblack@eecs.umich.edu     * @return Estimated latency of access.
3673578Sgblack@eecs.umich.edu     */
3683578Sgblack@eecs.umich.edu    Tick sendAtomicSnoop(PacketPtr pkt);
3693578Sgblack@eecs.umich.edu
3703578Sgblack@eecs.umich.edu    /**
3713578Sgblack@eecs.umich.edu     * Send a functional snoop request packet, where the data is
3723578Sgblack@eecs.umich.edu     * instantly updated everywhere in the memory system, without
3733578Sgblack@eecs.umich.edu     * affecting the current state of any block or moving the block.
3743578Sgblack@eecs.umich.edu     *
3754172Ssaidi@eecs.umich.edu     * @param pkt Snoop packet to send.
3763578Sgblack@eecs.umich.edu     */
3773578Sgblack@eecs.umich.edu    void sendFunctionalSnoop(PacketPtr pkt);
3783578Sgblack@eecs.umich.edu
3793578Sgblack@eecs.umich.edu    /**
3803578Sgblack@eecs.umich.edu     * Attempt to send a timing response to the master port by calling
3813578Sgblack@eecs.umich.edu     * its corresponding receive function. If the send does not
3823578Sgblack@eecs.umich.edu     * succeed, as indicated by the return value, then the sender must
3833578Sgblack@eecs.umich.edu     * wait for a recvRetry at which point it can re-issue a
3843578Sgblack@eecs.umich.edu     * sendTimingResp.
3853578Sgblack@eecs.umich.edu     *
3864172Ssaidi@eecs.umich.edu     * @param pkt Packet to send.
3874172Ssaidi@eecs.umich.edu     *
3884172Ssaidi@eecs.umich.edu     * @return If the send was succesful or not.
3894172Ssaidi@eecs.umich.edu    */
3904172Ssaidi@eecs.umich.edu    bool sendTimingResp(PacketPtr pkt);
3913761Sgblack@eecs.umich.edu
3924172Ssaidi@eecs.umich.edu    /**
3934172Ssaidi@eecs.umich.edu     * Attempt to send a timing snoop request packet to the master port
3944172Ssaidi@eecs.umich.edu     * by calling its corresponding receive function. Snoop requests
3953761Sgblack@eecs.umich.edu     * always succeed and hence no return value is needed.
3964172Ssaidi@eecs.umich.edu     *
3973578Sgblack@eecs.umich.edu     * @param pkt Packet to send.
3983578Sgblack@eecs.umich.edu     */
3993415Sgblack@eecs.umich.edu    void sendTimingSnoopReq(PacketPtr pkt);
4003928Ssaidi@eecs.umich.edu
4013928Ssaidi@eecs.umich.edu    /**
4023928Ssaidi@eecs.umich.edu     * Send a retry to the master port that previously attempted a
4033928Ssaidi@eecs.umich.edu     * sendTimingReq or sendTimingSnoopResp to this slave port and
4043928Ssaidi@eecs.umich.edu     * failed.
4053415Sgblack@eecs.umich.edu     */
4063415Sgblack@eecs.umich.edu    void sendRetry();
4074172Ssaidi@eecs.umich.edu
4083415Sgblack@eecs.umich.edu    /**
4093415Sgblack@eecs.umich.edu     * Called by a peer port in order to determine the block size of
4103415Sgblack@eecs.umich.edu     * the owner of this port.
4113415Sgblack@eecs.umich.edu     */
4123415Sgblack@eecs.umich.edu    virtual unsigned deviceBlockSize() const { return 0; }
4133415Sgblack@eecs.umich.edu
4143415Sgblack@eecs.umich.edu    /** Called by the associated device if it wishes to find out the blocksize
4153415Sgblack@eecs.umich.edu        of the device on attached to the peer port.
4163415Sgblack@eecs.umich.edu    */
4173415Sgblack@eecs.umich.edu    unsigned peerBlockSize() const;
4183415Sgblack@eecs.umich.edu
4193415Sgblack@eecs.umich.edu    /**
4203415Sgblack@eecs.umich.edu     * Find out if the peer master port is snooping or not.
4213415Sgblack@eecs.umich.edu     *
4223415Sgblack@eecs.umich.edu     * @return true if the peer master port is snooping
4234172Ssaidi@eecs.umich.edu     */
4243415Sgblack@eecs.umich.edu    bool isSnooping() const { return _masterPort->isSnooping(); }
4253415Sgblack@eecs.umich.edu
4264172Ssaidi@eecs.umich.edu    /**
4273415Sgblack@eecs.umich.edu     * Called by the owner to send a range change
4284172Ssaidi@eecs.umich.edu     */
4293415Sgblack@eecs.umich.edu    void sendRangeChange() const { _masterPort->recvRangeChange(); }
4303415Sgblack@eecs.umich.edu
4314172Ssaidi@eecs.umich.edu    /**
4323415Sgblack@eecs.umich.edu     * Get a list of the non-overlapping address ranges the owner is
4333415Sgblack@eecs.umich.edu     * responsible for. All slave ports must override this function
4344172Ssaidi@eecs.umich.edu     * and return a populated list with at least one item.
4353415Sgblack@eecs.umich.edu     *
4363415Sgblack@eecs.umich.edu     * @return a list of ranges responded to
4373893Shsul@eecs.umich.edu     */
4384172Ssaidi@eecs.umich.edu    virtual AddrRangeList getAddrRanges() const = 0;
4393415Sgblack@eecs.umich.edu
4404172Ssaidi@eecs.umich.edu  protected:
4413415Sgblack@eecs.umich.edu
4423415Sgblack@eecs.umich.edu    /**
4433926Ssaidi@eecs.umich.edu     * Called by the master port to unbind. Should never be called
4443926Ssaidi@eecs.umich.edu     * directly.
4453926Ssaidi@eecs.umich.edu     */
4463415Sgblack@eecs.umich.edu    void unbind();
4473415Sgblack@eecs.umich.edu
4483415Sgblack@eecs.umich.edu    /**
4493893Shsul@eecs.umich.edu     * Called by the master port to bind. Should never be called
4503415Sgblack@eecs.umich.edu     * directly.
4513926Ssaidi@eecs.umich.edu     */
4523926Ssaidi@eecs.umich.edu    void bind(MasterPort& master_port);
4533926Ssaidi@eecs.umich.edu
4543926Ssaidi@eecs.umich.edu    /**
4553926Ssaidi@eecs.umich.edu     * Receive an atomic request packet from the master port.
4563415Sgblack@eecs.umich.edu     */
4574172Ssaidi@eecs.umich.edu    virtual Tick recvAtomic(PacketPtr pkt) = 0;
4583926Ssaidi@eecs.umich.edu
4593926Ssaidi@eecs.umich.edu    /**
4603926Ssaidi@eecs.umich.edu     * Receive a functional request packet from the master port.
4613415Sgblack@eecs.umich.edu     */
4624172Ssaidi@eecs.umich.edu    virtual void recvFunctional(PacketPtr pkt) = 0;
4633926Ssaidi@eecs.umich.edu
4643415Sgblack@eecs.umich.edu    /**
4653415Sgblack@eecs.umich.edu     * Receive a timing request from the master port.
4663893Shsul@eecs.umich.edu     */
4673415Sgblack@eecs.umich.edu    virtual bool recvTimingReq(PacketPtr pkt) = 0;
4683893Shsul@eecs.umich.edu
4693415Sgblack@eecs.umich.edu    /**
4703893Shsul@eecs.umich.edu     * Receive a timing snoop response from the master port.
4713415Sgblack@eecs.umich.edu     */
4723415Sgblack@eecs.umich.edu    virtual bool recvTimingSnoopResp(PacketPtr pkt)
4733415Sgblack@eecs.umich.edu    {
4743420Sgblack@eecs.umich.edu        panic("%s was not expecting a timing snoop response\n", name());
4753893Shsul@eecs.umich.edu    }
4763415Sgblack@eecs.umich.edu
4773415Sgblack@eecs.umich.edu    /**
4784172Ssaidi@eecs.umich.edu     * Called by the master port if sendTimingResp was called on this
4793415Sgblack@eecs.umich.edu     * slave port (causing recvTimingResp to be called on the master
4803415Sgblack@eecs.umich.edu     * port) and was unsuccesful.
4813415Sgblack@eecs.umich.edu     */
4823595Sgblack@eecs.umich.edu    virtual void recvRetry() = 0;
4833578Sgblack@eecs.umich.edu
4843585Sgblack@eecs.umich.edu};
4853603Ssaidi@eecs.umich.edu
4863595Sgblack@eecs.umich.edu#endif //__MEM_PORT_HH__
4873578Sgblack@eecs.umich.edu