atomic.hh revision 14185
16691Stjones1@inf.ed.ac.uk/*
26691Stjones1@inf.ed.ac.uk * Copyright (c) 2011-2012,2015,2017 ARM Limited
36691Stjones1@inf.ed.ac.uk * All rights reserved
46691Stjones1@inf.ed.ac.uk *
56691Stjones1@inf.ed.ac.uk * The license below extends only to copyright in the software and shall
66691Stjones1@inf.ed.ac.uk * not be construed as granting a license to any other intellectual
76691Stjones1@inf.ed.ac.uk * property including but not limited to intellectual property relating
86691Stjones1@inf.ed.ac.uk * to a hardware implementation of the functionality of the software
96691Stjones1@inf.ed.ac.uk * licensed hereunder.  You may use the software subject to the license
106691Stjones1@inf.ed.ac.uk * terms below provided that you ensure that this notice is replicated
116691Stjones1@inf.ed.ac.uk * unmodified and in its entirety in all distributions of the software,
126691Stjones1@inf.ed.ac.uk * modified or unmodified, in source code or in binary form.
136691Stjones1@inf.ed.ac.uk *
146691Stjones1@inf.ed.ac.uk * Copyright (c) 2002-2005 The Regents of The University of Michigan
156691Stjones1@inf.ed.ac.uk * All rights reserved.
166691Stjones1@inf.ed.ac.uk *
176691Stjones1@inf.ed.ac.uk * Redistribution and use in source and binary forms, with or without
186691Stjones1@inf.ed.ac.uk * modification, are permitted provided that the following conditions are
196691Stjones1@inf.ed.ac.uk * met: redistributions of source code must retain the above copyright
206691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer;
216691Stjones1@inf.ed.ac.uk * redistributions in binary form must reproduce the above copyright
226691Stjones1@inf.ed.ac.uk * notice, this list of conditions and the following disclaimer in the
236691Stjones1@inf.ed.ac.uk * documentation and/or other materials provided with the distribution;
246691Stjones1@inf.ed.ac.uk * neither the name of the copyright holders nor the names of its
256691Stjones1@inf.ed.ac.uk * contributors may be used to endorse or promote products derived from
266691Stjones1@inf.ed.ac.uk * this software without specific prior written permission.
276691Stjones1@inf.ed.ac.uk *
286691Stjones1@inf.ed.ac.uk * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
296691Stjones1@inf.ed.ac.uk * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
306691Stjones1@inf.ed.ac.uk * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
316691Stjones1@inf.ed.ac.uk * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
326691Stjones1@inf.ed.ac.uk * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
336691Stjones1@inf.ed.ac.uk * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
346691Stjones1@inf.ed.ac.uk * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3511793Sbrandon.potter@amd.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3611793Sbrandon.potter@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3711793Sbrandon.potter@amd.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
386691Stjones1@inf.ed.ac.uk * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
396691Stjones1@inf.ed.ac.uk *
406691Stjones1@inf.ed.ac.uk * Authors: Ron Dreslinski
416691Stjones1@inf.ed.ac.uk *          Andreas Hansson
426691Stjones1@inf.ed.ac.uk *          William Wang
4311794Sbrandon.potter@amd.com */
446691Stjones1@inf.ed.ac.uk
456691Stjones1@inf.ed.ac.uk#ifndef __MEM_GEM5_PROTOCOL_ATOMIC_HH__
466691Stjones1@inf.ed.ac.uk#define __MEM_GEM5_PROTOCOL_ATOMIC_HH__
476691Stjones1@inf.ed.ac.uk
486691Stjones1@inf.ed.ac.uk#include "mem/backdoor.hh"
496691Stjones1@inf.ed.ac.uk#include "mem/packet.hh"
506691Stjones1@inf.ed.ac.uk
516691Stjones1@inf.ed.ac.ukclass AtomicResponseProtocol;
5211851Sbrandon.potter@amd.com
536691Stjones1@inf.ed.ac.ukclass AtomicRequestProtocol
546691Stjones1@inf.ed.ac.uk{
556701Sgblack@eecs.umich.edu    friend class AtomicResponseProtocol;
566701Sgblack@eecs.umich.edu
576691Stjones1@inf.ed.ac.uk  protected:
586691Stjones1@inf.ed.ac.uk    /**
599149SAli.Saidi@ARM.com     * Send an atomic request packet, where the data is moved and the
609149SAli.Saidi@ARM.com     * state is updated in zero time, without interleaving with other
616691Stjones1@inf.ed.ac.uk     * memory accesses.
626691Stjones1@inf.ed.ac.uk     *
636691Stjones1@inf.ed.ac.uk     * @param peer Peer to send packet to.
648706Sandreas.hansson@arm.com     * @param pkt Packet to send.
656691Stjones1@inf.ed.ac.uk     *
666691Stjones1@inf.ed.ac.uk     * @return Estimated latency of access.
676691Stjones1@inf.ed.ac.uk     */
686691Stjones1@inf.ed.ac.uk    Tick send(AtomicResponseProtocol *peer, PacketPtr pkt);
696691Stjones1@inf.ed.ac.uk
706691Stjones1@inf.ed.ac.uk    /**
716691Stjones1@inf.ed.ac.uk     * Send an atomic request packet like above, but also request a backdoor
7213570Sbrandon.potter@amd.com     * to the data being accessed.
7313570Sbrandon.potter@amd.com     *
746691Stjones1@inf.ed.ac.uk     * @param peer Peer to send packet to.
756691Stjones1@inf.ed.ac.uk     * @param pkt Packet to send.
766691Stjones1@inf.ed.ac.uk     * @param backdoor Can be set to a back door pointer by the target to let
776691Stjones1@inf.ed.ac.uk     *        caller have direct access to the requested data.
786691Stjones1@inf.ed.ac.uk     *
796691Stjones1@inf.ed.ac.uk     * @return Estimated latency of access.
806691Stjones1@inf.ed.ac.uk     */
816691Stjones1@inf.ed.ac.uk    Tick sendBackdoor(AtomicResponseProtocol *peer, PacketPtr pkt,
826691Stjones1@inf.ed.ac.uk                      MemBackdoorPtr &backdoor);
836691Stjones1@inf.ed.ac.uk
846691Stjones1@inf.ed.ac.uk    /**
856691Stjones1@inf.ed.ac.uk     * Receive an atomic snoop request packet from our peer.
866691Stjones1@inf.ed.ac.uk     */
876691Stjones1@inf.ed.ac.uk    virtual Tick recvAtomicSnoop(PacketPtr pkt) = 0;
886691Stjones1@inf.ed.ac.uk};
896691Stjones1@inf.ed.ac.uk
906691Stjones1@inf.ed.ac.ukclass AtomicResponseProtocol
916691Stjones1@inf.ed.ac.uk{
926691Stjones1@inf.ed.ac.uk    friend class AtomicRequestProtocol;
936691Stjones1@inf.ed.ac.uk
946691Stjones1@inf.ed.ac.uk  protected:
956691Stjones1@inf.ed.ac.uk    /**
966691Stjones1@inf.ed.ac.uk     * Send an atomic snoop request packet, where the data is moved
976691Stjones1@inf.ed.ac.uk     * and the state is updated in zero time, without interleaving
986691Stjones1@inf.ed.ac.uk     * with other memory accesses.
996691Stjones1@inf.ed.ac.uk     *
1006691Stjones1@inf.ed.ac.uk     * @param peer Peer to send packet to.
1016691Stjones1@inf.ed.ac.uk     * @param pkt Snoop packet to send.
1026691Stjones1@inf.ed.ac.uk     *
1036691Stjones1@inf.ed.ac.uk     * @return Estimated latency of access.
1046691Stjones1@inf.ed.ac.uk     */
1056691Stjones1@inf.ed.ac.uk    Tick sendSnoop(AtomicRequestProtocol *peer, PacketPtr pkt);
1066691Stjones1@inf.ed.ac.uk
1076691Stjones1@inf.ed.ac.uk    /**
1086691Stjones1@inf.ed.ac.uk     * Receive an atomic request packet from the peer.
1096691Stjones1@inf.ed.ac.uk     */
1106691Stjones1@inf.ed.ac.uk    virtual Tick recvAtomic(PacketPtr pkt) = 0;
1116691Stjones1@inf.ed.ac.uk
1126691Stjones1@inf.ed.ac.uk    /**
1136691Stjones1@inf.ed.ac.uk     * Receive an atomic request packet from the peer, and optionally
1146691Stjones1@inf.ed.ac.uk     * provide a backdoor to the data being accessed.
1156691Stjones1@inf.ed.ac.uk     */
1166691Stjones1@inf.ed.ac.uk    virtual Tick recvAtomicBackdoor(
1176691Stjones1@inf.ed.ac.uk            PacketPtr pkt, MemBackdoorPtr &backdoor) = 0;
1186691Stjones1@inf.ed.ac.uk};
1196691Stjones1@inf.ed.ac.uk
1206691Stjones1@inf.ed.ac.uk#endif //__MEM_GEM5_PROTOCOL_ATOMIC_HH__
1216691Stjones1@inf.ed.ac.uk