port.hh revision 9087
17405SAli.Saidi@ARM.com/*
27405SAli.Saidi@ARM.com * Copyright (c) 2011-2012 ARM Limited
37405SAli.Saidi@ARM.com * All rights reserved
47405SAli.Saidi@ARM.com *
57405SAli.Saidi@ARM.com * The license below extends only to copyright in the software and shall
67405SAli.Saidi@ARM.com * not be construed as granting a license to any other intellectual
77405SAli.Saidi@ARM.com * property including but not limited to intellectual property relating
87405SAli.Saidi@ARM.com * to a hardware implementation of the functionality of the software
97405SAli.Saidi@ARM.com * licensed hereunder.  You may use the software subject to the license
107405SAli.Saidi@ARM.com * terms below provided that you ensure that this notice is replicated
117405SAli.Saidi@ARM.com * unmodified and in its entirety in all distributions of the software,
127405SAli.Saidi@ARM.com * modified or unmodified, in source code or in binary form.
137405SAli.Saidi@ARM.com *
147405SAli.Saidi@ARM.com * Copyright (c) 2002-2005 The Regents of The University of Michigan
157405SAli.Saidi@ARM.com * All rights reserved.
167405SAli.Saidi@ARM.com *
177405SAli.Saidi@ARM.com * Redistribution and use in source and binary forms, with or without
187405SAli.Saidi@ARM.com * modification, are permitted provided that the following conditions are
197405SAli.Saidi@ARM.com * met: redistributions of source code must retain the above copyright
207405SAli.Saidi@ARM.com * notice, this list of conditions and the following disclaimer;
217405SAli.Saidi@ARM.com * redistributions in binary form must reproduce the above copyright
227405SAli.Saidi@ARM.com * notice, this list of conditions and the following disclaimer in the
237405SAli.Saidi@ARM.com * documentation and/or other materials provided with the distribution;
247405SAli.Saidi@ARM.com * neither the name of the copyright holders nor the names of its
257405SAli.Saidi@ARM.com * contributors may be used to endorse or promote products derived from
267405SAli.Saidi@ARM.com * this software without specific prior written permission.
277405SAli.Saidi@ARM.com *
287405SAli.Saidi@ARM.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
297405SAli.Saidi@ARM.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
307405SAli.Saidi@ARM.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
317405SAli.Saidi@ARM.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
327405SAli.Saidi@ARM.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
337405SAli.Saidi@ARM.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
347405SAli.Saidi@ARM.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
357405SAli.Saidi@ARM.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
367405SAli.Saidi@ARM.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
377405SAli.Saidi@ARM.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
387405SAli.Saidi@ARM.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
397405SAli.Saidi@ARM.com *
407405SAli.Saidi@ARM.com * Authors: Ron Dreslinski
417405SAli.Saidi@ARM.com *          Andreas Hansson
427405SAli.Saidi@ARM.com *          William Wang
437405SAli.Saidi@ARM.com */
447405SAli.Saidi@ARM.com
457405SAli.Saidi@ARM.com/**
467427Sgblack@eecs.umich.edu * @file
477427Sgblack@eecs.umich.edu * Port Object Declaration.
487427Sgblack@eecs.umich.edu */
497427Sgblack@eecs.umich.edu
507427Sgblack@eecs.umich.edu#ifndef __MEM_PORT_HH__
517427Sgblack@eecs.umich.edu#define __MEM_PORT_HH__
527427Sgblack@eecs.umich.edu
537427Sgblack@eecs.umich.edu#include <list>
547427Sgblack@eecs.umich.edu
557427Sgblack@eecs.umich.edu#include "base/range.hh"
567427Sgblack@eecs.umich.edu#include "mem/packet.hh"
577427Sgblack@eecs.umich.edu
587427Sgblack@eecs.umich.edu/**
597427Sgblack@eecs.umich.edu * This typedef is used to clean up getAddrRanges(). It's declared
607427Sgblack@eecs.umich.edu * outside the Port object since it's also used by some mem objects.
617427Sgblack@eecs.umich.edu * Eventually we should move this typedef to wherever Addr is
627427Sgblack@eecs.umich.edu * defined.
637427Sgblack@eecs.umich.edu */
647427Sgblack@eecs.umich.edu
657427Sgblack@eecs.umich.edutypedef std::list<Range<Addr> > AddrRangeList;
667427Sgblack@eecs.umich.edutypedef std::list<Range<Addr> >::iterator AddrRangeIter;
677427Sgblack@eecs.umich.edu
687427Sgblack@eecs.umich.educlass MemObject;
697427Sgblack@eecs.umich.edu
707427Sgblack@eecs.umich.edu/**
717427Sgblack@eecs.umich.edu * Ports are used to interface memory objects to each other. A port is
727427Sgblack@eecs.umich.edu * either a master or a slave and the connected peer is always of the
737427Sgblack@eecs.umich.edu * opposite role. Each port has a name, an owner, and an identifier.
747427Sgblack@eecs.umich.edu */
757427Sgblack@eecs.umich.educlass Port
767427Sgblack@eecs.umich.edu{
777427Sgblack@eecs.umich.edu
787427Sgblack@eecs.umich.edu  private:
797427Sgblack@eecs.umich.edu
807427Sgblack@eecs.umich.edu    /** Descriptive name (for DPRINTF output) */
817427Sgblack@eecs.umich.edu    std::string portName;
827427Sgblack@eecs.umich.edu
837427Sgblack@eecs.umich.edu  protected:
847427Sgblack@eecs.umich.edu
857427Sgblack@eecs.umich.edu    /**
867427Sgblack@eecs.umich.edu     * A numeric identifier to distinguish ports in a vector, and set
877427Sgblack@eecs.umich.edu     * to InvalidPortID in case this port is not part of a vector.
887427Sgblack@eecs.umich.edu     */
897427Sgblack@eecs.umich.edu    const PortID id;
907427Sgblack@eecs.umich.edu
917427Sgblack@eecs.umich.edu    /** A reference to the MemObject that owns this port. */
927427Sgblack@eecs.umich.edu    MemObject& owner;
937427Sgblack@eecs.umich.edu
947427Sgblack@eecs.umich.edu    /**
957427Sgblack@eecs.umich.edu     * Abstract base class for ports
967427Sgblack@eecs.umich.edu     *
977427Sgblack@eecs.umich.edu     * @param _name Port name including the owners name
987427Sgblack@eecs.umich.edu     * @param _owner The MemObject that is the structural owner of this port
997427Sgblack@eecs.umich.edu     * @param _id A port identifier for vector ports
1007427Sgblack@eecs.umich.edu     */
1017427Sgblack@eecs.umich.edu    Port(const std::string& _name, MemObject& _owner, PortID _id);
1027427Sgblack@eecs.umich.edu
1037427Sgblack@eecs.umich.edu    /**
1047427Sgblack@eecs.umich.edu     * Virtual destructor due to inheritance.
1057427Sgblack@eecs.umich.edu     */
1067427Sgblack@eecs.umich.edu    virtual ~Port();
1077427Sgblack@eecs.umich.edu
1087427Sgblack@eecs.umich.edu  public:
1097427Sgblack@eecs.umich.edu
1107427Sgblack@eecs.umich.edu    /** Return port name (for DPRINTF). */
1117427Sgblack@eecs.umich.edu    const std::string name() const { return portName; }
1127427Sgblack@eecs.umich.edu
1137427Sgblack@eecs.umich.edu    /** Get the port id. */
1147427Sgblack@eecs.umich.edu    PortID getId() const { return id; }
1157427Sgblack@eecs.umich.edu
1167427Sgblack@eecs.umich.edu};
1177427Sgblack@eecs.umich.edu
1187427Sgblack@eecs.umich.edu/** Forward declaration */
1197427Sgblack@eecs.umich.educlass SlavePort;
1207436Sdam.sunwoo@arm.com
1217436Sdam.sunwoo@arm.com/**
1227436Sdam.sunwoo@arm.com * A MasterPort is a specialisation of a port. In addition to the
1237436Sdam.sunwoo@arm.com * basic functionality of sending packets to its slave peer, it also
1247436Sdam.sunwoo@arm.com * has functions specific to a master, e.g. to receive range changes
1257436Sdam.sunwoo@arm.com * or determine if the port is snooping or not.
1267436Sdam.sunwoo@arm.com */
1277436Sdam.sunwoo@arm.comclass MasterPort : public Port
1287436Sdam.sunwoo@arm.com{
1297436Sdam.sunwoo@arm.com
1307436Sdam.sunwoo@arm.com    friend class SlavePort;
1317436Sdam.sunwoo@arm.com
1327436Sdam.sunwoo@arm.com  private:
1337436Sdam.sunwoo@arm.com
1347436Sdam.sunwoo@arm.com    SlavePort* _slavePort;
1357436Sdam.sunwoo@arm.com
1367436Sdam.sunwoo@arm.com  public:
1377436Sdam.sunwoo@arm.com
1387436Sdam.sunwoo@arm.com    MasterPort(const std::string& name, MemObject* owner,
1397436Sdam.sunwoo@arm.com               PortID id = InvalidPortID);
1407436Sdam.sunwoo@arm.com    virtual ~MasterPort();
1417436Sdam.sunwoo@arm.com
1427436Sdam.sunwoo@arm.com    void bind(SlavePort& slave_port);
1437436Sdam.sunwoo@arm.com    SlavePort& getSlavePort() const;
1447436Sdam.sunwoo@arm.com    bool isConnected() const;
1457436Sdam.sunwoo@arm.com
1467436Sdam.sunwoo@arm.com    /**
1477436Sdam.sunwoo@arm.com     * Send an atomic request packet, where the data is moved and the
1487436Sdam.sunwoo@arm.com     * state is updated in zero time, without interleaving with other
1497436Sdam.sunwoo@arm.com     * memory accesses.
1507436Sdam.sunwoo@arm.com     *
1517436Sdam.sunwoo@arm.com     * @param pkt Packet to send.
1527427Sgblack@eecs.umich.edu     *
1537427Sgblack@eecs.umich.edu     * @return Estimated latency of access.
1547427Sgblack@eecs.umich.edu     */
1557405SAli.Saidi@ARM.com    Tick sendAtomic(PacketPtr pkt);
1567405SAli.Saidi@ARM.com
1577405SAli.Saidi@ARM.com    /**
1587405SAli.Saidi@ARM.com     * Send a functional request packet, where the data is instantly
1597405SAli.Saidi@ARM.com     * updated everywhere in the memory system, without affecting the
1607405SAli.Saidi@ARM.com     * current state of any block or moving the block.
1617405SAli.Saidi@ARM.com     *
1627405SAli.Saidi@ARM.com     * @param pkt Packet to send.
1637405SAli.Saidi@ARM.com     */
1647405SAli.Saidi@ARM.com    void sendFunctional(PacketPtr pkt);
1657405SAli.Saidi@ARM.com
1667405SAli.Saidi@ARM.com    /**
1677405SAli.Saidi@ARM.com     * Attempt to send a timing request to the slave port by calling
1687405SAli.Saidi@ARM.com     * its corresponding receive function. If the send does not
1697405SAli.Saidi@ARM.com     * succeed, as indicated by the return value, then the sender must
1707405SAli.Saidi@ARM.com     * wait for a recvRetry at which point it can re-issue a
1717405SAli.Saidi@ARM.com     * sendTimingReq.
1727405SAli.Saidi@ARM.com     *
1737405SAli.Saidi@ARM.com     * @param pkt Packet to send.
1747405SAli.Saidi@ARM.com     *
1757405SAli.Saidi@ARM.com     * @return If the send was succesful or not.
1767405SAli.Saidi@ARM.com    */
1777405SAli.Saidi@ARM.com    bool sendTimingReq(PacketPtr pkt);
1787405SAli.Saidi@ARM.com
1797405SAli.Saidi@ARM.com    /**
1807405SAli.Saidi@ARM.com     * Attempt to send a timing snoop response packet to the slave
1817405SAli.Saidi@ARM.com     * port by calling its corresponding receive function. If the send
1827405SAli.Saidi@ARM.com     * does not succeed, as indicated by the return value, then the
1837405SAli.Saidi@ARM.com     * sender must wait for a recvRetry at which point it can re-issue
1847405SAli.Saidi@ARM.com     * a sendTimingSnoopResp.
1857405SAli.Saidi@ARM.com     *
1867405SAli.Saidi@ARM.com     * @param pkt Packet to send.
1877405SAli.Saidi@ARM.com     */
1887405SAli.Saidi@ARM.com    bool sendTimingSnoopResp(PacketPtr pkt);
1897405SAli.Saidi@ARM.com
1907405SAli.Saidi@ARM.com    /**
1917405SAli.Saidi@ARM.com     * Send a retry to the slave port that previously attempted a
1927405SAli.Saidi@ARM.com     * sendTimingResp to this master port and failed.
1937405SAli.Saidi@ARM.com     */
1947405SAli.Saidi@ARM.com    void sendRetry();
1957405SAli.Saidi@ARM.com
1967405SAli.Saidi@ARM.com    /**
1977405SAli.Saidi@ARM.com     * Determine if this master port is snooping or not. The default
1987405SAli.Saidi@ARM.com     * implementation returns false and thus tells the neighbour we
1997405SAli.Saidi@ARM.com     * are not snooping. Any master port that wants to receive snoop
2007405SAli.Saidi@ARM.com     * requests (e.g. a cache connected to a bus) has to override this
2017405SAli.Saidi@ARM.com     * function.
2027405SAli.Saidi@ARM.com     *
2037405SAli.Saidi@ARM.com     * @return true if the port should be considered a snooper
2047405SAli.Saidi@ARM.com     */
2057405SAli.Saidi@ARM.com    virtual bool isSnooping() const { return false; }
2067405SAli.Saidi@ARM.com
2077405SAli.Saidi@ARM.com    /**
2087405SAli.Saidi@ARM.com     * Called by a peer port in order to determine the block size of
2097405SAli.Saidi@ARM.com     * the owner of this port.
2107405SAli.Saidi@ARM.com     */
2117405SAli.Saidi@ARM.com    virtual unsigned deviceBlockSize() const { return 0; }
2127405SAli.Saidi@ARM.com
2137405SAli.Saidi@ARM.com    /** Called by the associated device if it wishes to find out the blocksize
2147405SAli.Saidi@ARM.com        of the device on attached to the peer port.
2157583SAli.Saidi@arm.com    */
2167583SAli.Saidi@arm.com    unsigned peerBlockSize() const;
2177583SAli.Saidi@arm.com
2187583SAli.Saidi@arm.com    /** Inject a PrintReq for the given address to print the state of
2197583SAli.Saidi@arm.com     * that address throughout the memory system.  For debugging.
2207583SAli.Saidi@arm.com     */
2217583SAli.Saidi@arm.com    void printAddr(Addr a);
2227583SAli.Saidi@arm.com
2237583SAli.Saidi@arm.com  protected:
2247583SAli.Saidi@arm.com
2257583SAli.Saidi@arm.com    /**
2267583SAli.Saidi@arm.com     * Receive an atomic snoop request packet from the slave port.
2277583SAli.Saidi@arm.com     */
2287583SAli.Saidi@arm.com    virtual Tick recvAtomicSnoop(PacketPtr pkt)
2297405SAli.Saidi@ARM.com    {
2307405SAli.Saidi@ARM.com        panic("%s was not expecting an atomic snoop request\n", name());
2317405SAli.Saidi@ARM.com        return 0;
2327405SAli.Saidi@ARM.com    }
2337405SAli.Saidi@ARM.com
2347405SAli.Saidi@ARM.com    /**
2357405SAli.Saidi@ARM.com     * Receive a functional snoop request packet from the slave port.
2367405SAli.Saidi@ARM.com     */
2377405SAli.Saidi@ARM.com    virtual void recvFunctionalSnoop(PacketPtr pkt)
2387405SAli.Saidi@ARM.com    {
2397405SAli.Saidi@ARM.com        panic("%s was not expecting a functional snoop request\n", name());
2407405SAli.Saidi@ARM.com    }
2417405SAli.Saidi@ARM.com
2427405SAli.Saidi@ARM.com    /**
2437405SAli.Saidi@ARM.com     * Receive a timing response from the slave port.
2447405SAli.Saidi@ARM.com     */
2457405SAli.Saidi@ARM.com    virtual bool recvTimingResp(PacketPtr pkt) = 0;
2467405SAli.Saidi@ARM.com
2477405SAli.Saidi@ARM.com    /**
2487405SAli.Saidi@ARM.com     * Receive a timing snoop request from the slave port.
2497405SAli.Saidi@ARM.com     */
2507405SAli.Saidi@ARM.com    virtual void recvTimingSnoopReq(PacketPtr pkt)
2517405SAli.Saidi@ARM.com    {
2527405SAli.Saidi@ARM.com        panic("%s was not expecting a timing snoop request\n", name());
2537405SAli.Saidi@ARM.com    }
2547405SAli.Saidi@ARM.com
2557405SAli.Saidi@ARM.com    /**
2567405SAli.Saidi@ARM.com     * Called by the slave port if sendTimingReq or
2577405SAli.Saidi@ARM.com     * sendTimingSnoopResp was called on this master port (causing
2587405SAli.Saidi@ARM.com     * recvTimingReq and recvTimingSnoopResp to be called on the
2597405SAli.Saidi@ARM.com     * slave port) and was unsuccesful.
2607405SAli.Saidi@ARM.com     */
2617405SAli.Saidi@ARM.com    virtual void recvRetry() = 0;
2627405SAli.Saidi@ARM.com
2637405SAli.Saidi@ARM.com    /**
2647405SAli.Saidi@ARM.com     * Called to receive an address range change from the peer slave
2657405SAli.Saidi@ARM.com     * port. the default implementation ignored the change and does
2667405SAli.Saidi@ARM.com     * nothing. Override this function in a derived class if the owner
2677405SAli.Saidi@ARM.com     * needs to be aware of he laesddress ranges, e.g. in an
2687405SAli.Saidi@ARM.com     * interconnect component like a bus.
2697405SAli.Saidi@ARM.com     */
2707405SAli.Saidi@ARM.com    virtual void recvRangeChange() { }
2717405SAli.Saidi@ARM.com};
2727405SAli.Saidi@ARM.com
2737405SAli.Saidi@ARM.com/**
2747405SAli.Saidi@ARM.com * A SlavePort is a specialisation of a port. In addition to the
2757405SAli.Saidi@ARM.com * basic functionality of sending packets to its master peer, it also
2767405SAli.Saidi@ARM.com * has functions specific to a slave, e.g. to send range changes
2777405SAli.Saidi@ARM.com * and get the address ranges that the port responds to.
2787405SAli.Saidi@ARM.com */
2797405SAli.Saidi@ARM.comclass SlavePort : public Port
2807405SAli.Saidi@ARM.com{
2817405SAli.Saidi@ARM.com
2827405SAli.Saidi@ARM.com    friend class MasterPort;
2837405SAli.Saidi@ARM.com
2847405SAli.Saidi@ARM.com  private:
2857408Sgblack@eecs.umich.edu
2867405SAli.Saidi@ARM.com    MasterPort* _masterPort;
2877405SAli.Saidi@ARM.com
2887405SAli.Saidi@ARM.com  public:
2897408Sgblack@eecs.umich.edu
2907408Sgblack@eecs.umich.edu    SlavePort(const std::string& name, MemObject* owner,
2917408Sgblack@eecs.umich.edu              PortID id = InvalidPortID);
2927408Sgblack@eecs.umich.edu    virtual ~SlavePort();
2937408Sgblack@eecs.umich.edu
2947408Sgblack@eecs.umich.edu    void bind(MasterPort& master_port);
2957408Sgblack@eecs.umich.edu    MasterPort& getMasterPort() const;
2967408Sgblack@eecs.umich.edu    bool isConnected() const;
2977408Sgblack@eecs.umich.edu
2987408Sgblack@eecs.umich.edu    /**
2997408Sgblack@eecs.umich.edu     * Send an atomic snoop request packet, where the data is moved
3007408Sgblack@eecs.umich.edu     * and the state is updated in zero time, without interleaving
3017405SAli.Saidi@ARM.com     * with other memory accesses.
3027408Sgblack@eecs.umich.edu     *
3037408Sgblack@eecs.umich.edu     * @param pkt Snoop packet to send.
3047408Sgblack@eecs.umich.edu     *
3057408Sgblack@eecs.umich.edu     * @return Estimated latency of access.
3067408Sgblack@eecs.umich.edu     */
3077408Sgblack@eecs.umich.edu    Tick sendAtomicSnoop(PacketPtr pkt);
3087408Sgblack@eecs.umich.edu
3097408Sgblack@eecs.umich.edu    /**
3107408Sgblack@eecs.umich.edu     * Send a functional snoop request packet, where the data is
3117408Sgblack@eecs.umich.edu     * instantly updated everywhere in the memory system, without
3127408Sgblack@eecs.umich.edu     * affecting the current state of any block or moving the block.
3137408Sgblack@eecs.umich.edu     *
3147408Sgblack@eecs.umich.edu     * @param pkt Snoop packet to send.
3157408Sgblack@eecs.umich.edu     */
3167408Sgblack@eecs.umich.edu    void sendFunctionalSnoop(PacketPtr pkt);
3177408Sgblack@eecs.umich.edu
3187408Sgblack@eecs.umich.edu    /**
3197408Sgblack@eecs.umich.edu     * Attempt to send a timing response to the master port by calling
3207408Sgblack@eecs.umich.edu     * its corresponding receive function. If the send does not
3217408Sgblack@eecs.umich.edu     * succeed, as indicated by the return value, then the sender must
3227408Sgblack@eecs.umich.edu     * wait for a recvRetry at which point it can re-issue a
3237408Sgblack@eecs.umich.edu     * sendTimingResp.
3247408Sgblack@eecs.umich.edu     *
3257408Sgblack@eecs.umich.edu     * @param pkt Packet to send.
3267408Sgblack@eecs.umich.edu     *
3277408Sgblack@eecs.umich.edu     * @return If the send was succesful or not.
3287408Sgblack@eecs.umich.edu    */
3297408Sgblack@eecs.umich.edu    bool sendTimingResp(PacketPtr pkt);
3307408Sgblack@eecs.umich.edu
3317408Sgblack@eecs.umich.edu    /**
3327408Sgblack@eecs.umich.edu     * Attempt to send a timing snoop request packet to the master port
3337408Sgblack@eecs.umich.edu     * by calling its corresponding receive function. Snoop requests
3347408Sgblack@eecs.umich.edu     * always succeed and hence no return value is needed.
3357408Sgblack@eecs.umich.edu     *
3367408Sgblack@eecs.umich.edu     * @param pkt Packet to send.
3377408Sgblack@eecs.umich.edu     */
3387408Sgblack@eecs.umich.edu    void sendTimingSnoopReq(PacketPtr pkt);
3397408Sgblack@eecs.umich.edu
3407408Sgblack@eecs.umich.edu    /**
3417408Sgblack@eecs.umich.edu     * Send a retry to the master port that previously attempted a
3427408Sgblack@eecs.umich.edu     * sendTimingReq or sendTimingSnoopResp to this slave port and
3437408Sgblack@eecs.umich.edu     * failed.
3447408Sgblack@eecs.umich.edu     */
3457408Sgblack@eecs.umich.edu    void sendRetry();
3467408Sgblack@eecs.umich.edu
3477408Sgblack@eecs.umich.edu    /**
3487408Sgblack@eecs.umich.edu     * Called by a peer port in order to determine the block size of
3497408Sgblack@eecs.umich.edu     * the owner of this port.
3507408Sgblack@eecs.umich.edu     */
3517408Sgblack@eecs.umich.edu    virtual unsigned deviceBlockSize() const { return 0; }
3527408Sgblack@eecs.umich.edu
3537408Sgblack@eecs.umich.edu    /** Called by the associated device if it wishes to find out the blocksize
3547408Sgblack@eecs.umich.edu        of the device on attached to the peer port.
3557408Sgblack@eecs.umich.edu    */
3567408Sgblack@eecs.umich.edu    unsigned peerBlockSize() const;
3577408Sgblack@eecs.umich.edu
3587408Sgblack@eecs.umich.edu    /**
3597408Sgblack@eecs.umich.edu     * Called by the owner to send a range change
3607408Sgblack@eecs.umich.edu     */
3617408Sgblack@eecs.umich.edu    void sendRangeChange() const { _masterPort->recvRangeChange(); }
3627408Sgblack@eecs.umich.edu
3637408Sgblack@eecs.umich.edu    /**
3647408Sgblack@eecs.umich.edu     * Get a list of the non-overlapping address ranges the owner is
3657408Sgblack@eecs.umich.edu     * responsible for. All slave ports must override this function
3667408Sgblack@eecs.umich.edu     * and return a populated list with at least one item.
3677408Sgblack@eecs.umich.edu     *
3687408Sgblack@eecs.umich.edu     * @return a list of ranges responded to
3697408Sgblack@eecs.umich.edu     */
3707408Sgblack@eecs.umich.edu    virtual AddrRangeList getAddrRanges() = 0;
3717408Sgblack@eecs.umich.edu
3727408Sgblack@eecs.umich.edu  protected:
3737408Sgblack@eecs.umich.edu
3747408Sgblack@eecs.umich.edu    /**
3757408Sgblack@eecs.umich.edu     * Receive an atomic request packet from the master port.
3767408Sgblack@eecs.umich.edu     */
3777408Sgblack@eecs.umich.edu    virtual Tick recvAtomic(PacketPtr pkt) = 0;
3787408Sgblack@eecs.umich.edu
3797408Sgblack@eecs.umich.edu    /**
3807408Sgblack@eecs.umich.edu     * Receive a functional request packet from the master port.
3817408Sgblack@eecs.umich.edu     */
3827408Sgblack@eecs.umich.edu    virtual void recvFunctional(PacketPtr pkt) = 0;
3837408Sgblack@eecs.umich.edu
3847408Sgblack@eecs.umich.edu    /**
3857408Sgblack@eecs.umich.edu     * Receive a timing request from the master port.
3867408Sgblack@eecs.umich.edu     */
3877408Sgblack@eecs.umich.edu    virtual bool recvTimingReq(PacketPtr pkt) = 0;
3887408Sgblack@eecs.umich.edu
3897408Sgblack@eecs.umich.edu    /**
3907408Sgblack@eecs.umich.edu     * Receive a timing snoop response from the master port.
3917408Sgblack@eecs.umich.edu     */
3927408Sgblack@eecs.umich.edu    virtual bool recvTimingSnoopResp(PacketPtr pkt)
3937408Sgblack@eecs.umich.edu    {
3947408Sgblack@eecs.umich.edu        panic("%s was not expecting a timing snoop response\n", name());
3957408Sgblack@eecs.umich.edu    }
3967408Sgblack@eecs.umich.edu
3977408Sgblack@eecs.umich.edu    /**
3987408Sgblack@eecs.umich.edu     * Called by the master port if sendTimingResp was called on this
3997408Sgblack@eecs.umich.edu     * slave port (causing recvTimingResp to be called on the master
4007408Sgblack@eecs.umich.edu     * port) and was unsuccesful.
4017408Sgblack@eecs.umich.edu     */
4027408Sgblack@eecs.umich.edu    virtual void recvRetry() = 0;
4037408Sgblack@eecs.umich.edu
4047408Sgblack@eecs.umich.edu};
4057408Sgblack@eecs.umich.edu
4067408Sgblack@eecs.umich.edu#endif //__MEM_PORT_HH__
4077408Sgblack@eecs.umich.edu