packet.hh (10567:926802ed1536) | packet.hh (10569:ffd46545b284) |
---|---|
1/* 2 * Copyright (c) 2012-2014 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 --- 251 unchanged lines hidden (view full) --- 260 261 public: 262 typedef MemCmd::Command Command; 263 264 /// The command field of the packet. 265 MemCmd cmd; 266 267 /// A pointer to the original request. | 1/* 2 * Copyright (c) 2012-2014 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 --- 251 unchanged lines hidden (view full) --- 260 261 public: 262 typedef MemCmd::Command Command; 263 264 /// The command field of the packet. 265 MemCmd cmd; 266 267 /// A pointer to the original request. |
268 RequestPtr req; | 268 const RequestPtr req; |
269 270 private: 271 /** 272 * A pointer to the data being transfered. It can be differnt 273 * sizes at each level of the heirarchy so it belongs in the 274 * packet, not request. This may or may not be populated when a 275 * responder recieves the packet. If not populated it memory should 276 * be allocated. --- 318 unchanged lines hidden (view full) --- 595 cmd = MemCmd::ReadReq; 596 } 597 598 /** 599 * Constructor. Note that a Request object must be constructed 600 * first, but the Requests's physical address and size fields need 601 * not be valid. The command must be supplied. 602 */ | 269 270 private: 271 /** 272 * A pointer to the data being transfered. It can be differnt 273 * sizes at each level of the heirarchy so it belongs in the 274 * packet, not request. This may or may not be populated when a 275 * responder recieves the packet. If not populated it memory should 276 * be allocated. --- 318 unchanged lines hidden (view full) --- 595 cmd = MemCmd::ReadReq; 596 } 597 598 /** 599 * Constructor. Note that a Request object must be constructed 600 * first, but the Requests's physical address and size fields need 601 * not be valid. The command must be supplied. 602 */ |
603 Packet(Request *_req, MemCmd _cmd) | 603 Packet(const RequestPtr _req, MemCmd _cmd) |
604 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false), 605 size(0), src(InvalidPortID), dest(InvalidPortID), 606 bytesValidStart(0), bytesValidEnd(0), 607 firstWordDelay(0), lastWordDelay(0), 608 senderState(NULL) 609 { 610 if (req->hasPaddr()) { 611 addr = req->getPaddr(); --- 6 unchanged lines hidden (view full) --- 618 } 619 } 620 621 /** 622 * Alternate constructor if you are trying to create a packet with 623 * a request that is for a whole block, not the address from the 624 * req. this allows for overriding the size/addr of the req. 625 */ | 604 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false), 605 size(0), src(InvalidPortID), dest(InvalidPortID), 606 bytesValidStart(0), bytesValidEnd(0), 607 firstWordDelay(0), lastWordDelay(0), 608 senderState(NULL) 609 { 610 if (req->hasPaddr()) { 611 addr = req->getPaddr(); --- 6 unchanged lines hidden (view full) --- 618 } 619 } 620 621 /** 622 * Alternate constructor if you are trying to create a packet with 623 * a request that is for a whole block, not the address from the 624 * req. this allows for overriding the size/addr of the req. 625 */ |
626 Packet(Request *_req, MemCmd _cmd, int _blkSize) | 626 Packet(const RequestPtr _req, MemCmd _cmd, int _blkSize) |
627 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false), 628 src(InvalidPortID), dest(InvalidPortID), 629 bytesValidStart(0), bytesValidEnd(0), 630 firstWordDelay(0), lastWordDelay(0), 631 senderState(NULL) 632 { 633 if (req->hasPaddr()) { 634 addr = req->getPaddr() & ~(_blkSize - 1); --- 6 unchanged lines hidden (view full) --- 641 642 /** 643 * Alternate constructor for copying a packet. Copy all fields 644 * *except* if the original packet's data was dynamic, don't copy 645 * that, as we can't guarantee that the new packet's lifetime is 646 * less than that of the original packet. In this case the new 647 * packet should allocate its own data. 648 */ | 627 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false), 628 src(InvalidPortID), dest(InvalidPortID), 629 bytesValidStart(0), bytesValidEnd(0), 630 firstWordDelay(0), lastWordDelay(0), 631 senderState(NULL) 632 { 633 if (req->hasPaddr()) { 634 addr = req->getPaddr() & ~(_blkSize - 1); --- 6 unchanged lines hidden (view full) --- 641 642 /** 643 * Alternate constructor for copying a packet. Copy all fields 644 * *except* if the original packet's data was dynamic, don't copy 645 * that, as we can't guarantee that the new packet's lifetime is 646 * less than that of the original packet. In this case the new 647 * packet should allocate its own data. 648 */ |
649 Packet(Packet *pkt, bool clearFlags = false) | 649 Packet(PacketPtr pkt, bool clearFlags = false) |
650 : cmd(pkt->cmd), req(pkt->req), 651 data(pkt->flags.isSet(STATIC_DATA) ? pkt->data : NULL), 652 addr(pkt->addr), _isSecure(pkt->_isSecure), size(pkt->size), 653 src(pkt->src), dest(pkt->dest), 654 bytesValidStart(pkt->bytesValidStart), 655 bytesValidEnd(pkt->bytesValidEnd), 656 firstWordDelay(pkt->firstWordDelay), 657 lastWordDelay(pkt->lastWordDelay), --- 33 unchanged lines hidden (view full) --- 691 } 692 693 /** 694 * Constructor-like methods that return Packets based on Request objects. 695 * Will call refineCommand() to fine-tune the Packet type if it's not a 696 * vanilla read or write. 697 */ 698 static PacketPtr | 650 : cmd(pkt->cmd), req(pkt->req), 651 data(pkt->flags.isSet(STATIC_DATA) ? pkt->data : NULL), 652 addr(pkt->addr), _isSecure(pkt->_isSecure), size(pkt->size), 653 src(pkt->src), dest(pkt->dest), 654 bytesValidStart(pkt->bytesValidStart), 655 bytesValidEnd(pkt->bytesValidEnd), 656 firstWordDelay(pkt->firstWordDelay), 657 lastWordDelay(pkt->lastWordDelay), --- 33 unchanged lines hidden (view full) --- 691 } 692 693 /** 694 * Constructor-like methods that return Packets based on Request objects. 695 * Will call refineCommand() to fine-tune the Packet type if it's not a 696 * vanilla read or write. 697 */ 698 static PacketPtr |
699 createRead(Request *req) | 699 createRead(const RequestPtr req) |
700 { 701 PacketPtr pkt = new Packet(req, MemCmd::ReadReq); 702 pkt->refineCommand(); 703 return pkt; 704 } 705 706 static PacketPtr | 700 { 701 PacketPtr pkt = new Packet(req, MemCmd::ReadReq); 702 pkt->refineCommand(); 703 return pkt; 704 } 705 706 static PacketPtr |
707 createWrite(Request *req) | 707 createWrite(const RequestPtr req) |
708 { 709 PacketPtr pkt = new Packet(req, MemCmd::WriteReq); 710 pkt->refineCommand(); 711 return pkt; 712 } 713 714 /** 715 * clean up packet variables --- 4 unchanged lines hidden (view full) --- 720 // delete the request object here, since the requester will 721 // never get the chance. 722 if (req && isRequest() && !needsResponse()) 723 delete req; 724 deleteData(); 725 } 726 727 /** | 708 { 709 PacketPtr pkt = new Packet(req, MemCmd::WriteReq); 710 pkt->refineCommand(); 711 return pkt; 712 } 713 714 /** 715 * clean up packet variables --- 4 unchanged lines hidden (view full) --- 720 // delete the request object here, since the requester will 721 // never get the chance. 722 if (req && isRequest() && !needsResponse()) 723 delete req; 724 deleteData(); 725 } 726 727 /** |
728 * Reinitialize packet address and size from the associated 729 * Request object, and reset other fields that may have been 730 * modified by a previous transaction. Typically called when a 731 * statically allocated Request/Packet pair is reused for multiple 732 * transactions. 733 */ 734 void 735 reinitFromRequest() 736 { 737 assert(req->hasPaddr()); 738 flags = 0; 739 addr = req->getPaddr(); 740 _isSecure = req->isSecure(); 741 size = req->getSize(); 742 743 src = InvalidPortID; 744 dest = InvalidPortID; 745 bytesValidStart = 0; 746 bytesValidEnd = 0; 747 firstWordDelay = 0; 748 lastWordDelay = 0; 749 750 flags.set(VALID_ADDR|VALID_SIZE); 751 deleteData(); 752 } 753 754 /** | |
755 * Take a request packet and modify it in place to be suitable for 756 * returning as a response to that request. The source field is 757 * turned into the destination, and subsequently cleared. Note 758 * that the latter is not necessary for atomic requests, but 759 * causes no harm as neither field is valid. 760 */ 761 void 762 makeResponse() --- 239 unchanged lines hidden --- | 728 * Take a request packet and modify it in place to be suitable for 729 * returning as a response to that request. The source field is 730 * turned into the destination, and subsequently cleared. Note 731 * that the latter is not necessary for atomic requests, but 732 * causes no harm as neither field is valid. 733 */ 734 void 735 makeResponse() --- 239 unchanged lines hidden --- |