atomic.hh revision 14185
114185Sgabeblack@google.com/* 214185Sgabeblack@google.com * Copyright (c) 2011-2012,2015,2017 ARM Limited 314185Sgabeblack@google.com * All rights reserved 414185Sgabeblack@google.com * 514185Sgabeblack@google.com * The license below extends only to copyright in the software and shall 614185Sgabeblack@google.com * not be construed as granting a license to any other intellectual 714185Sgabeblack@google.com * property including but not limited to intellectual property relating 814185Sgabeblack@google.com * to a hardware implementation of the functionality of the software 914185Sgabeblack@google.com * licensed hereunder. You may use the software subject to the license 1014185Sgabeblack@google.com * terms below provided that you ensure that this notice is replicated 1114185Sgabeblack@google.com * unmodified and in its entirety in all distributions of the software, 1214185Sgabeblack@google.com * modified or unmodified, in source code or in binary form. 1314185Sgabeblack@google.com * 1414185Sgabeblack@google.com * Copyright (c) 2002-2005 The Regents of The University of Michigan 1514185Sgabeblack@google.com * All rights reserved. 1614185Sgabeblack@google.com * 1714185Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 1814185Sgabeblack@google.com * modification, are permitted provided that the following conditions are 1914185Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 2014185Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 2114185Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 2214185Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 2314185Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 2414185Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 2514185Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 2614185Sgabeblack@google.com * this software without specific prior written permission. 2714185Sgabeblack@google.com * 2814185Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2914185Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3014185Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3114185Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3214185Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3314185Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3414185Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3514185Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3614185Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3714185Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3814185Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3914185Sgabeblack@google.com * 4014185Sgabeblack@google.com * Authors: Ron Dreslinski 4114185Sgabeblack@google.com * Andreas Hansson 4214185Sgabeblack@google.com * William Wang 4314185Sgabeblack@google.com */ 4414185Sgabeblack@google.com 4514185Sgabeblack@google.com#ifndef __MEM_GEM5_PROTOCOL_ATOMIC_HH__ 4614185Sgabeblack@google.com#define __MEM_GEM5_PROTOCOL_ATOMIC_HH__ 4714185Sgabeblack@google.com 4814185Sgabeblack@google.com#include "mem/backdoor.hh" 4914185Sgabeblack@google.com#include "mem/packet.hh" 5014185Sgabeblack@google.com 5114185Sgabeblack@google.comclass AtomicResponseProtocol; 5214185Sgabeblack@google.com 5314185Sgabeblack@google.comclass AtomicRequestProtocol 5414185Sgabeblack@google.com{ 5514185Sgabeblack@google.com friend class AtomicResponseProtocol; 5614185Sgabeblack@google.com 5714185Sgabeblack@google.com protected: 5814185Sgabeblack@google.com /** 5914185Sgabeblack@google.com * Send an atomic request packet, where the data is moved and the 6014185Sgabeblack@google.com * state is updated in zero time, without interleaving with other 6114185Sgabeblack@google.com * memory accesses. 6214185Sgabeblack@google.com * 6314185Sgabeblack@google.com * @param peer Peer to send packet to. 6414185Sgabeblack@google.com * @param pkt Packet to send. 6514185Sgabeblack@google.com * 6614185Sgabeblack@google.com * @return Estimated latency of access. 6714185Sgabeblack@google.com */ 6814185Sgabeblack@google.com Tick send(AtomicResponseProtocol *peer, PacketPtr pkt); 6914185Sgabeblack@google.com 7014185Sgabeblack@google.com /** 7114185Sgabeblack@google.com * Send an atomic request packet like above, but also request a backdoor 7214185Sgabeblack@google.com * to the data being accessed. 7314185Sgabeblack@google.com * 7414185Sgabeblack@google.com * @param peer Peer to send packet to. 7514185Sgabeblack@google.com * @param pkt Packet to send. 7614185Sgabeblack@google.com * @param backdoor Can be set to a back door pointer by the target to let 7714185Sgabeblack@google.com * caller have direct access to the requested data. 7814185Sgabeblack@google.com * 7914185Sgabeblack@google.com * @return Estimated latency of access. 8014185Sgabeblack@google.com */ 8114185Sgabeblack@google.com Tick sendBackdoor(AtomicResponseProtocol *peer, PacketPtr pkt, 8214185Sgabeblack@google.com MemBackdoorPtr &backdoor); 8314185Sgabeblack@google.com 8414185Sgabeblack@google.com /** 8514185Sgabeblack@google.com * Receive an atomic snoop request packet from our peer. 8614185Sgabeblack@google.com */ 8714185Sgabeblack@google.com virtual Tick recvAtomicSnoop(PacketPtr pkt) = 0; 8814185Sgabeblack@google.com}; 8914185Sgabeblack@google.com 9014185Sgabeblack@google.comclass AtomicResponseProtocol 9114185Sgabeblack@google.com{ 9214185Sgabeblack@google.com friend class AtomicRequestProtocol; 9314185Sgabeblack@google.com 9414185Sgabeblack@google.com protected: 9514185Sgabeblack@google.com /** 9614185Sgabeblack@google.com * Send an atomic snoop request packet, where the data is moved 9714185Sgabeblack@google.com * and the state is updated in zero time, without interleaving 9814185Sgabeblack@google.com * with other memory accesses. 9914185Sgabeblack@google.com * 10014185Sgabeblack@google.com * @param peer Peer to send packet to. 10114185Sgabeblack@google.com * @param pkt Snoop packet to send. 10214185Sgabeblack@google.com * 10314185Sgabeblack@google.com * @return Estimated latency of access. 10414185Sgabeblack@google.com */ 10514185Sgabeblack@google.com Tick sendSnoop(AtomicRequestProtocol *peer, PacketPtr pkt); 10614185Sgabeblack@google.com 10714185Sgabeblack@google.com /** 10814185Sgabeblack@google.com * Receive an atomic request packet from the peer. 10914185Sgabeblack@google.com */ 11014185Sgabeblack@google.com virtual Tick recvAtomic(PacketPtr pkt) = 0; 11114185Sgabeblack@google.com 11214185Sgabeblack@google.com /** 11314185Sgabeblack@google.com * Receive an atomic request packet from the peer, and optionally 11414185Sgabeblack@google.com * provide a backdoor to the data being accessed. 11514185Sgabeblack@google.com */ 11614185Sgabeblack@google.com virtual Tick recvAtomicBackdoor( 11714185Sgabeblack@google.com PacketPtr pkt, MemBackdoorPtr &backdoor) = 0; 11814185Sgabeblack@google.com}; 11914185Sgabeblack@google.com 12014185Sgabeblack@google.com#endif //__MEM_GEM5_PROTOCOL_ATOMIC_HH__ 121