atomic.cc revision 14185
114185Sgabeblack@google.com/* 214185Sgabeblack@google.com * Copyright (c) 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: Steve Reinhardt 4114185Sgabeblack@google.com * Andreas Hansson 4214185Sgabeblack@google.com * William Wang 4314185Sgabeblack@google.com */ 4414185Sgabeblack@google.com 4514185Sgabeblack@google.com#include "mem/protocol/atomic.hh" 4614185Sgabeblack@google.com 4714185Sgabeblack@google.com#include "base/trace.hh" 4814185Sgabeblack@google.com 4914185Sgabeblack@google.com/* The request protocol. */ 5014185Sgabeblack@google.com 5114185Sgabeblack@google.comTick 5214185Sgabeblack@google.comAtomicRequestProtocol::send(AtomicResponseProtocol *peer, PacketPtr pkt) 5314185Sgabeblack@google.com{ 5414185Sgabeblack@google.com assert(pkt->isRequest()); 5514185Sgabeblack@google.com return peer->recvAtomic(pkt); 5614185Sgabeblack@google.com} 5714185Sgabeblack@google.com 5814185Sgabeblack@google.comTick 5914185Sgabeblack@google.comAtomicRequestProtocol::sendBackdoor(AtomicResponseProtocol *peer, 6014185Sgabeblack@google.com PacketPtr pkt, MemBackdoorPtr &backdoor) 6114185Sgabeblack@google.com{ 6214185Sgabeblack@google.com assert(pkt->isRequest()); 6314185Sgabeblack@google.com return peer->recvAtomicBackdoor(pkt, backdoor); 6414185Sgabeblack@google.com} 6514185Sgabeblack@google.com 6614185Sgabeblack@google.com/* The response protocol. */ 6714185Sgabeblack@google.com 6814185Sgabeblack@google.comTick 6914185Sgabeblack@google.comAtomicResponseProtocol::sendSnoop(AtomicRequestProtocol *peer, PacketPtr pkt) 7014185Sgabeblack@google.com{ 7114185Sgabeblack@google.com assert(pkt->isRequest()); 7214185Sgabeblack@google.com return peer->recvAtomicSnoop(pkt); 7314185Sgabeblack@google.com} 74