Deleted Added
sdiff udiff text old ( 9030:047bd5f02c6e ) new ( 9031:32ecc0217c5e )
full compact
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 27 unchanged lines hidden (view full) ---

36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 *
41 * Authors: Ron Dreslinski
42 * Steve Reinhardt
43 * Ali Saidi
44 */
45
46/**
47 * @file
48 * Declaration of the Packet class.
49 */
50
51#ifndef __MEM_PACKET_HH__

--- 174 unchanged lines hidden (view full) ---

226 * ultimate destination and back, possibly being conveyed by several
227 * different Packets along the way.)
228 */
229class Packet : public FastAlloc, public Printable
230{
231 public:
232 typedef uint32_t FlagsType;
233 typedef ::Flags<FlagsType> Flags;
234 typedef short NodeID;
235
236 private:
237 static const FlagsType PUBLIC_FLAGS = 0x00000000;
238 static const FlagsType PRIVATE_FLAGS = 0x00007F0F;
239 static const FlagsType COPY_FLAGS = 0x0000000F;
240
241 static const FlagsType SHARED = 0x00000001;
242 // Special control flags
243 /// Special timing-mode atomic snoop for multi-level coherence.
244 static const FlagsType EXPRESS_SNOOP = 0x00000002;
245 /// Does supplier have exclusive copy?
246 /// Useful for multi-level coherence.
247 static const FlagsType SUPPLY_EXCLUSIVE = 0x00000004;
248 // Snoop response flags
249 static const FlagsType MEM_INHIBIT = 0x00000008;
250 /// Are the 'addr' and 'size' fields valid?
251 static const FlagsType VALID_ADDR = 0x00000100;
252 static const FlagsType VALID_SIZE = 0x00000200;
253 /// Is the 'src' field valid?
254 static const FlagsType VALID_SRC = 0x00000400;
255 static const FlagsType VALID_DST = 0x00000800;
256 /// Is the data pointer set to a value that shouldn't be freed
257 /// when the packet is destroyed?
258 static const FlagsType STATIC_DATA = 0x00001000;
259 /// The data pointer points to a value that should be freed when
260 /// the packet is destroyed.
261 static const FlagsType DYNAMIC_DATA = 0x00002000;
262 /// the data pointer points to an array (thus delete []) needs to
263 /// be called on it rather than simply delete.

--- 37 unchanged lines hidden (view full) ---

301 * the timing responses need this information to be routed back to
302 * the appropriate port at a later point in time. The field can be
303 * updated (over-written) as the request packet passes through
304 * additional multiplexing components, and it is their
305 * responsibility to remember the original source port identifier,
306 * for example by using an appropriate sender state. The latter is
307 * done in the cache and bridge.
308 */
309 NodeID src;
310
311 /**
312 * Destination port identifier that is present on all response
313 * packets that passed through a multiplexing component as a
314 * request packet. The source port identifier is turned into a
315 * destination port identifier when the packet is turned into a
316 * response, and the destination is used, e.g. by the bus, to
317 * select the appropriate path through the interconnect.
318 */
319 NodeID dest;
320
321 /**
322 * The original value of the command field. Only valid when the
323 * current command field is an error condition; in that case, the
324 * previous contents of the command field are copied here. This
325 * field is *not* set on non-error responses.
326 */
327 MemCmd origCmd;

--- 154 unchanged lines hidden (view full) ---

482 assert(isResponse());
483 cmd = MemCmd::BadAddressError;
484 }
485
486 bool wasNacked() const { return cmd == MemCmd::NetworkNackError; }
487 bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; }
488 void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
489
490 bool isSrcValid() { return flags.isSet(VALID_SRC); }
491 /// Accessor function to get the source index of the packet.
492 NodeID getSrc() const { assert(flags.isSet(VALID_SRC)); return src; }
493 /// Accessor function to set the source index of the packet.
494 void setSrc(NodeID _src) { src = _src; flags.set(VALID_SRC); }
495 /// Reset source field, e.g. to retransmit packet on different bus.
496 void clearSrc() { flags.clear(VALID_SRC); }
497
498 bool isDestValid() { return flags.isSet(VALID_DST); }
499 /// Accessor function for the destination index of the packet.
500 NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; }
501 /// Accessor function to set the destination index of the packet.
502 void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); }
503 /// Reset destination field, e.g. to turn a response into a request again.
504 void clearDest() { flags.clear(VALID_DST); }
505
506 Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; }
507 unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; }
508 Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); }
509
510 /**
511 * It has been determined that the SC packet should successfully update
512 * memory. Therefore, convert this SC packet to a normal write.

--- 20 unchanged lines hidden (view full) ---

533
534 /**
535 * Constructor. Note that a Request object must be constructed
536 * first, but the Requests's physical address and size fields need
537 * not be valid. The command must be supplied.
538 */
539 Packet(Request *_req, MemCmd _cmd)
540 : cmd(_cmd), req(_req), data(NULL),
541 bytesValidStart(0), bytesValidEnd(0),
542 time(curTick()), senderState(NULL)
543 {
544 if (req->hasPaddr()) {
545 addr = req->getPaddr();
546 flags.set(VALID_ADDR);
547 }
548 if (req->hasSize()) {

--- 4 unchanged lines hidden (view full) ---

553
554 /**
555 * Alternate constructor if you are trying to create a packet with
556 * a request that is for a whole block, not the address from the
557 * req. this allows for overriding the size/addr of the req.
558 */
559 Packet(Request *_req, MemCmd _cmd, int _blkSize)
560 : cmd(_cmd), req(_req), data(NULL),
561 bytesValidStart(0), bytesValidEnd(0),
562 time(curTick()), senderState(NULL)
563 {
564 if (req->hasPaddr()) {
565 addr = req->getPaddr() & ~(_blkSize - 1);
566 flags.set(VALID_ADDR);
567 }
568 size = _blkSize;

--- 12 unchanged lines hidden (view full) ---

581 data(pkt->flags.isSet(STATIC_DATA) ? pkt->data : NULL),
582 addr(pkt->addr), size(pkt->size), src(pkt->src), dest(pkt->dest),
583 bytesValidStart(pkt->bytesValidStart), bytesValidEnd(pkt->bytesValidEnd),
584 time(curTick()), senderState(pkt->senderState)
585 {
586 if (!clearFlags)
587 flags.set(pkt->flags & COPY_FLAGS);
588
589 flags.set(pkt->flags & (VALID_ADDR|VALID_SIZE|VALID_SRC|VALID_DST));
590 flags.set(pkt->flags & STATIC_DATA);
591
592 }
593
594 /**
595 * clean up packet variables
596 */
597 ~Packet()

--- 41 unchanged lines hidden (view full) ---

639 origCmd = cmd;
640 cmd = cmd.responseCommand();
641
642 // responses are never express, even if the snoop that
643 // triggered them was
644 flags.clear(EXPRESS_SNOOP);
645
646 dest = src;
647 flags.set(VALID_DST, flags.isSet(VALID_SRC));
648 flags.clear(VALID_SRC);
649 }
650
651 void
652 makeAtomicResponse()
653 {
654 makeResponse();
655 }
656

--- 219 unchanged lines hidden ---