packet.hh (10723:b1d90d88420e) packet.hh (10739:4cfe55719da5)
1/*
2 * Copyright (c) 2012-2015 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

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

638 flags.set(STATIC_DATA);
639 } else {
640 allocate();
641 }
642 }
643 }
644
645 /**
1/*
2 * Copyright (c) 2012-2015 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

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

638 flags.set(STATIC_DATA);
639 } else {
640 allocate();
641 }
642 }
643 }
644
645 /**
646 * Change the packet type based on request type.
646 * Generate the appropriate read MemCmd based on the Request flags.
647 */
647 */
648 void
649 refineCommand()
648 static MemCmd
649 makeReadCmd(const RequestPtr req)
650 {
650 {
651 if (cmd == MemCmd::ReadReq) {
652 if (req->isLLSC()) {
653 cmd = MemCmd::LoadLockedReq;
654 } else if (req->isPrefetch()) {
655 cmd = MemCmd::SoftPFReq;
656 }
657 } else if (cmd == MemCmd::WriteReq) {
658 if (req->isLLSC()) {
659 cmd = MemCmd::StoreCondReq;
660 } else if (req->isSwap()) {
661 cmd = MemCmd::SwapReq;
662 }
663 }
651 if (req->isLLSC())
652 return MemCmd::LoadLockedReq;
653 else if (req->isPrefetch())
654 return MemCmd::SoftPFReq;
655 else
656 return MemCmd::ReadReq;
664 }
665
666 /**
657 }
658
659 /**
660 * Generate the appropriate write MemCmd based on the Request flags.
661 */
662 static MemCmd
663 makeWriteCmd(const RequestPtr req)
664 {
665 if (req->isLLSC())
666 return MemCmd::StoreCondReq;
667 else if (req->isSwap())
668 return MemCmd::SwapReq;
669 else
670 return MemCmd::WriteReq;
671 }
672
673 /**
667 * Constructor-like methods that return Packets based on Request objects.
674 * Constructor-like methods that return Packets based on Request objects.
668 * Will call refineCommand() to fine-tune the Packet type if it's not a
669 * vanilla read or write.
675 * Fine-tune the MemCmd type if it's not a vanilla read or write.
670 */
671 static PacketPtr
672 createRead(const RequestPtr req)
673 {
676 */
677 static PacketPtr
678 createRead(const RequestPtr req)
679 {
674 PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
675 pkt->refineCommand();
676 return pkt;
680 return new Packet(req, makeReadCmd(req));
677 }
678
679 static PacketPtr
680 createWrite(const RequestPtr req)
681 {
681 }
682
683 static PacketPtr
684 createWrite(const RequestPtr req)
685 {
682 PacketPtr pkt = new Packet(req, MemCmd::WriteReq);
683 pkt->refineCommand();
684 return pkt;
686 return new Packet(req, makeWriteCmd(req));
685 }
686
687 /**
688 * clean up packet variables
689 */
690 ~Packet()
691 {
692 // If this is a request packet for which there's no response,

--- 280 unchanged lines hidden ---
687 }
688
689 /**
690 * clean up packet variables
691 */
692 ~Packet()
693 {
694 // If this is a request packet for which there's no response,

--- 280 unchanged lines hidden ---