1/* 2 * Copyright (c) 2012-2017 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 --- 56 unchanged lines hidden (view full) --- 65#include "base/types.hh" 66#include "mem/request.hh" 67#include "sim/core.hh" 68 69class Packet; 70typedef Packet *PacketPtr; 71typedef uint8_t* PacketDataPtr; 72typedef std::list<PacketPtr> PacketList; |
73typedef uint64_t PacketId; |
74 75class MemCmd 76{ 77 friend class Packet; 78 79 public: 80 /** 81 * List of all commands associated with a packet. --- 230 unchanged lines hidden (view full) --- 312 Flags flags; 313 314 public: 315 typedef MemCmd::Command Command; 316 317 /// The command field of the packet. 318 MemCmd cmd; 319 |
320 const PacketId id; 321 |
322 /// A pointer to the original request. 323 const RequestPtr req; 324 325 private: 326 /** 327 * A pointer to the data being transfered. It can be differnt 328 * sizes at each level of the heirarchy so it belongs in the 329 * packet, not request. This may or may not be populated when a --- 411 unchanged lines hidden (view full) --- 741 } 742 743 /** 744 * Constructor. Note that a Request object must be constructed 745 * first, but the Requests's physical address and size fields need 746 * not be valid. The command must be supplied. 747 */ 748 Packet(const RequestPtr _req, MemCmd _cmd) |
749 : cmd(_cmd), id((PacketId)_req), req(_req), data(nullptr), addr(0), 750 _isSecure(false), size(0), headerDelay(0), snoopDelay(0), 751 payloadDelay(0), senderState(NULL) |
752 { 753 if (req->hasPaddr()) { 754 addr = req->getPaddr(); 755 flags.set(VALID_ADDR); 756 _isSecure = req->isSecure(); 757 } 758 if (req->hasSize()) { 759 size = req->getSize(); 760 flags.set(VALID_SIZE); 761 } 762 } 763 764 /** 765 * Alternate constructor if you are trying to create a packet with 766 * a request that is for a whole block, not the address from the 767 * req. this allows for overriding the size/addr of the req. 768 */ |
769 Packet(const RequestPtr _req, MemCmd _cmd, int _blkSize, PacketId _id = 0) 770 : cmd(_cmd), id(_id ? _id : (PacketId)_req), req(_req), data(nullptr), 771 addr(0), _isSecure(false), headerDelay(0), snoopDelay(0), 772 payloadDelay(0), senderState(NULL) |
773 { 774 if (req->hasPaddr()) { 775 addr = req->getPaddr() & ~(_blkSize - 1); 776 flags.set(VALID_ADDR); 777 _isSecure = req->isSecure(); 778 } 779 size = _blkSize; 780 flags.set(VALID_SIZE); 781 } 782 783 /** 784 * Alternate constructor for copying a packet. Copy all fields 785 * *except* if the original packet's data was dynamic, don't copy 786 * that, as we can't guarantee that the new packet's lifetime is 787 * less than that of the original packet. In this case the new 788 * packet should allocate its own data. 789 */ 790 Packet(const PacketPtr pkt, bool clear_flags, bool alloc_data) |
791 : cmd(pkt->cmd), id(pkt->id), req(pkt->req), |
792 data(nullptr), 793 addr(pkt->addr), _isSecure(pkt->_isSecure), size(pkt->size), 794 bytesValid(pkt->bytesValid), 795 headerDelay(pkt->headerDelay), 796 snoopDelay(0), 797 payloadDelay(pkt->payloadDelay), 798 senderState(pkt->senderState) 799 { --- 440 unchanged lines hidden --- |