114184Sgabeblack@google.com/*
214184Sgabeblack@google.com * Copyright (c) 2019 ARM Limited
314184Sgabeblack@google.com * All rights reserved
414184Sgabeblack@google.com *
514184Sgabeblack@google.com * The license below extends only to copyright in the software and shall
614184Sgabeblack@google.com * not be construed as granting a license to any other intellectual
714184Sgabeblack@google.com * property including but not limited to intellectual property relating
814184Sgabeblack@google.com * to a hardware implementation of the functionality of the software
914184Sgabeblack@google.com * licensed hereunder.  You may use the software subject to the license
1014184Sgabeblack@google.com * terms below provided that you ensure that this notice is replicated
1114184Sgabeblack@google.com * unmodified and in its entirety in all distributions of the software,
1214184Sgabeblack@google.com * modified or unmodified, in source code or in binary form.
1314184Sgabeblack@google.com *
1414184Sgabeblack@google.com * Copyright (c) 1999-2005 Mark D. Hill and David A. Wood
1514184Sgabeblack@google.com * All rights reserved.
1614184Sgabeblack@google.com *
1714184Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without
1814184Sgabeblack@google.com * modification, are permitted provided that the following conditions are
1914184Sgabeblack@google.com * met: redistributions of source code must retain the above copyright
2014184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer;
2114184Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright
2214184Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the
2314184Sgabeblack@google.com * documentation and/or other materials provided with the distribution;
2414184Sgabeblack@google.com * neither the name of the copyright holders nor the names of its
2514184Sgabeblack@google.com * contributors may be used to endorse or promote products derived from
2614184Sgabeblack@google.com * this software without specific prior written permission.
2714184Sgabeblack@google.com *
2814184Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2914184Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3014184Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3114184Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3214184Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3314184Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3414184Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3514184Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3614184Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3714184Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3814184Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3914184Sgabeblack@google.com */
4014184Sgabeblack@google.com
4114184Sgabeblack@google.com/*
4214184Sgabeblack@google.com * $Id$
4314184Sgabeblack@google.com *
4414184Sgabeblack@google.com */
4514184Sgabeblack@google.com
4614184Sgabeblack@google.com// CoherenceRequestType
4714184Sgabeblack@google.comenumeration(CoherenceRequestType, desc="...") {
4814184Sgabeblack@google.com  GETX,      desc="Get eXclusive";
4914184Sgabeblack@google.com  GETS,      desc="Get Shared";
5014184Sgabeblack@google.com  PUTX,      desc="Put eXclusive";
5114184Sgabeblack@google.com  PUTO,      desc="Put Owned";
5214184Sgabeblack@google.com  PUTO_SHARERS,      desc="Put Owned, but sharers exist so don't remove from sharers list";
5314184Sgabeblack@google.com  PUTS,      desc="Put Shared";
5414184Sgabeblack@google.com  INV,       desc="Invalidation";
5514184Sgabeblack@google.com  WRITEBACK_CLEAN_DATA,   desc="Clean writeback (contains data)";
5614184Sgabeblack@google.com  WRITEBACK_CLEAN_ACK,    desc="Clean writeback (contains no data)";
5714184Sgabeblack@google.com  WRITEBACK_DIRTY_DATA,   desc="Dirty writeback (contains data)";
5814184Sgabeblack@google.com  DMA_READ,  desc="DMA Read";
5914184Sgabeblack@google.com  DMA_WRITE, desc="DMA Write";
6014184Sgabeblack@google.com}
6114184Sgabeblack@google.com
6214184Sgabeblack@google.com// CoherenceResponseType
6314184Sgabeblack@google.comenumeration(CoherenceResponseType, desc="...") {
6414184Sgabeblack@google.com  ACK,               desc="ACKnowledgment, responder doesn't have a copy";
6514184Sgabeblack@google.com  DATA,              desc="Data";
6614184Sgabeblack@google.com  DATA_EXCLUSIVE,    desc="Data, no processor has a copy";
6714184Sgabeblack@google.com  UNBLOCK,           desc="Unblock";
6814184Sgabeblack@google.com  UNBLOCK_EXCLUSIVE, desc="Unblock, we're in E/M";
6914184Sgabeblack@google.com  WB_ACK,            desc="Writeback ack";
7014184Sgabeblack@google.com  WB_ACK_DATA,       desc="Writeback ack";
7114184Sgabeblack@google.com  WB_NACK,           desc="Writeback neg. ack";
7214184Sgabeblack@google.com  DMA_ACK,           desc="Ack that a DMA write completed";
7314184Sgabeblack@google.com}
7414184Sgabeblack@google.com
7514184Sgabeblack@google.com// TriggerType
7614184Sgabeblack@google.comenumeration(TriggerType, desc="...") {
7714184Sgabeblack@google.com  ALL_ACKS,            desc="See corresponding event";
7814184Sgabeblack@google.com}
7914184Sgabeblack@google.com
8014184Sgabeblack@google.com// TriggerMsg
8114184Sgabeblack@google.comstructure(TriggerMsg, desc="...", interface="Message") {
8214184Sgabeblack@google.com  Addr addr,             desc="Physical address for this request";
8314184Sgabeblack@google.com  TriggerType Type,            desc="Type of trigger";
8414184Sgabeblack@google.com
8514184Sgabeblack@google.com  bool functionalRead(Packet *pkt) {
8614184Sgabeblack@google.com    // Trigger message does not hold data
8714184Sgabeblack@google.com    return false;
8814184Sgabeblack@google.com  }
8914184Sgabeblack@google.com
9014184Sgabeblack@google.com  bool functionalWrite(Packet *pkt) {
9114184Sgabeblack@google.com    // Trigger message does not hold data
9214184Sgabeblack@google.com    return false;
9314184Sgabeblack@google.com  }
9414184Sgabeblack@google.com}
9514184Sgabeblack@google.com
9614184Sgabeblack@google.com// RequestMsg (and also forwarded requests)
9714184Sgabeblack@google.comstructure(RequestMsg, desc="...", interface="Message") {
9814184Sgabeblack@google.com  Addr addr,             desc="Physical address for this request";
9914184Sgabeblack@google.com  int Len,                     desc="Length of Request";
10014184Sgabeblack@google.com  CoherenceRequestType Type,   desc="Type of request (GetS, GetX, PutX, etc)";
10114184Sgabeblack@google.com  MachineID Requestor,            desc="Node who initiated the request";
10214184Sgabeblack@google.com  MachineType RequestorMachine,   desc="type of component";
10314184Sgabeblack@google.com  NetDest Destination,             desc="Multicast destination mask";
10414184Sgabeblack@google.com  DataBlock DataBlk,           desc="data for the cache line (DMA WRITE request)";
10514184Sgabeblack@google.com  int Acks,                    desc="How many acks to expect";
10614184Sgabeblack@google.com  MessageSizeType MessageSize, desc="size category of the message";
10714184Sgabeblack@google.com  RubyAccessMode AccessMode,    desc="user/supervisor access type";
10814184Sgabeblack@google.com  PrefetchBit Prefetch,         desc="Is this a prefetch request";
10914184Sgabeblack@google.com
11014184Sgabeblack@google.com  bool functionalRead(Packet *pkt) {
11114184Sgabeblack@google.com    // Read only those messages that contain the data
11214184Sgabeblack@google.com    if (Type == CoherenceRequestType:DMA_READ ||
11314184Sgabeblack@google.com        Type == CoherenceRequestType:DMA_WRITE ||
11414184Sgabeblack@google.com        Type == CoherenceRequestType:WRITEBACK_CLEAN_DATA ||
11514184Sgabeblack@google.com        Type == CoherenceRequestType:WRITEBACK_DIRTY_DATA) {
11614184Sgabeblack@google.com        return testAndRead(addr, DataBlk, pkt);
11714184Sgabeblack@google.com    }
11814184Sgabeblack@google.com    return false;
11914184Sgabeblack@google.com  }
12014184Sgabeblack@google.com
12114184Sgabeblack@google.com  bool functionalWrite(Packet *pkt) {
12214184Sgabeblack@google.com    // No check required since all messages are written
12314184Sgabeblack@google.com    return testAndWrite(addr, DataBlk, pkt);
12414184Sgabeblack@google.com  }
12514184Sgabeblack@google.com}
12614184Sgabeblack@google.com
12714184Sgabeblack@google.com// ResponseMsg (and also unblock requests)
12814184Sgabeblack@google.comstructure(ResponseMsg, desc="...", interface="Message") {
12914184Sgabeblack@google.com  Addr addr,             desc="Physical address for this request";
13014184Sgabeblack@google.com  CoherenceResponseType Type,  desc="Type of response (Ack, Data, etc)";
13114184Sgabeblack@google.com  MachineID Sender,               desc="Node who sent the data";
13214184Sgabeblack@google.com  MachineType SenderMachine,   desc="type of component sending msg";
13314184Sgabeblack@google.com  NetDest Destination,             desc="Node to whom the data is sent";
13414184Sgabeblack@google.com  DataBlock DataBlk,           desc="data for the cache line";
13514184Sgabeblack@google.com  bool Dirty,                  desc="Is the data dirty (different than memory)?";
13614184Sgabeblack@google.com  int Acks,                    desc="How many acks to expect";
13714184Sgabeblack@google.com  MessageSizeType MessageSize, desc="size category of the message";
13814184Sgabeblack@google.com
13914184Sgabeblack@google.com  bool functionalRead(Packet *pkt) {
14014184Sgabeblack@google.com    // Read only those messages that contain the data
14114184Sgabeblack@google.com    if (Type == CoherenceResponseType:DATA ||
14214184Sgabeblack@google.com        Type == CoherenceResponseType:DATA_EXCLUSIVE) {
14314184Sgabeblack@google.com        return testAndRead(addr, DataBlk, pkt);
14414184Sgabeblack@google.com    }
14514184Sgabeblack@google.com    return false;
14614184Sgabeblack@google.com  }
14714184Sgabeblack@google.com
14814184Sgabeblack@google.com  bool functionalWrite(Packet *pkt) {
14914184Sgabeblack@google.com    // No check required since all messages are written
15014184Sgabeblack@google.com    return testAndWrite(addr, DataBlk, pkt);
15114184Sgabeblack@google.com  }
15214184Sgabeblack@google.com}
153