packet.hh (11013:7e31bd5968c0) packet.hh (11056:842f56345a42)
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

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

250 /// Special timing-mode atomic snoop for multi-level coherence.
251 EXPRESS_SNOOP = 0x00000002,
252 /// Does supplier have exclusive copy?
253 /// Useful for multi-level coherence.
254 SUPPLY_EXCLUSIVE = 0x00000004,
255 // Snoop response flags
256 MEM_INHIBIT = 0x00000008,
257
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

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

250 /// Special timing-mode atomic snoop for multi-level coherence.
251 EXPRESS_SNOOP = 0x00000002,
252 /// Does supplier have exclusive copy?
253 /// Useful for multi-level coherence.
254 SUPPLY_EXCLUSIVE = 0x00000004,
255 // Snoop response flags
256 MEM_INHIBIT = 0x00000008,
257
258 /// Are the 'addr' and 'size' fields valid?
259 VALID_ADDR = 0x00000100,
260 VALID_SIZE = 0x00000200,
261
262 /// Is the data pointer set to a value that shouldn't be freed
263 /// when the packet is destroyed?
264 STATIC_DATA = 0x00001000,
265 /// The data pointer points to a value that should be freed when
266 /// the packet is destroyed. The pointer is assumed to be pointing
267 /// to an array, and delete [] is consequently called
268 DYNAMIC_DATA = 0x00002000,
269

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

518 setBadAddress()
519 {
520 assert(isResponse());
521 cmd = MemCmd::BadAddressError;
522 }
523
524 void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
525
258 /// Is the data pointer set to a value that shouldn't be freed
259 /// when the packet is destroyed?
260 STATIC_DATA = 0x00001000,
261 /// The data pointer points to a value that should be freed when
262 /// the packet is destroyed. The pointer is assumed to be pointing
263 /// to an array, and delete [] is consequently called
264 DYNAMIC_DATA = 0x00002000,
265

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

514 setBadAddress()
515 {
516 assert(isResponse());
517 cmd = MemCmd::BadAddressError;
518 }
519
520 void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
521
526 Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; }
522 Addr getAddr() const { return addr; }
527 /**
528 * Update the address of this packet mid-transaction. This is used
529 * by the address mapper to change an already set address to a new
530 * one based on the system configuration. It is intended to remap
531 * an existing address, so it asserts that the current address is
532 * valid.
533 */
523 /**
524 * Update the address of this packet mid-transaction. This is used
525 * by the address mapper to change an already set address to a new
526 * one based on the system configuration. It is intended to remap
527 * an existing address, so it asserts that the current address is
528 * valid.
529 */
534 void setAddr(Addr _addr) { assert(flags.isSet(VALID_ADDR)); addr = _addr; }
530 void setAddr(Addr _addr) { addr = _addr; }
535
531
536 unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; }
532 unsigned getSize() const { return size; }
537
538 Addr getOffset(unsigned int blk_size) const
539 {
540 return getAddr() & Addr(blk_size - 1);
541 }
542
543 Addr getBlockAddr(unsigned int blk_size) const
544 {
545 return getAddr() & ~(Addr(blk_size - 1));
546 }
547
533
534 Addr getOffset(unsigned int blk_size) const
535 {
536 return getAddr() & Addr(blk_size - 1);
537 }
538
539 Addr getBlockAddr(unsigned int blk_size) const
540 {
541 return getAddr() & ~(Addr(blk_size - 1));
542 }
543
548 bool isSecure() const
549 {
550 assert(flags.isSet(VALID_ADDR));
551 return _isSecure;
552 }
544 bool isSecure() const { return _isSecure; }
553
554 /**
555 * It has been determined that the SC packet should successfully update
556 * memory. Therefore, convert this SC packet to a normal write.
557 */
558 void
559 convertScToWrite()
560 {

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

572 {
573 assert(isLLSC());
574 assert(isRead());
575 cmd = MemCmd::ReadReq;
576 }
577
578 /**
579 * Constructor. Note that a Request object must be constructed
545
546 /**
547 * It has been determined that the SC packet should successfully update
548 * memory. Therefore, convert this SC packet to a normal write.
549 */
550 void
551 convertScToWrite()
552 {

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

564 {
565 assert(isLLSC());
566 assert(isRead());
567 cmd = MemCmd::ReadReq;
568 }
569
570 /**
571 * Constructor. Note that a Request object must be constructed
580 * first, but the Requests's physical address and size fields need
581 * not be valid. The command must be supplied.
572 * first, and have a valid physical address and size. The command
573 * must be supplied.
582 */
583 Packet(const RequestPtr _req, MemCmd _cmd)
574 */
575 Packet(const RequestPtr _req, MemCmd _cmd)
584 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false),
585 size(0), headerDelay(0), payloadDelay(0),
576 : cmd(_cmd), req(_req), data(nullptr), addr(req->getPaddr()),
577 _isSecure(req->isSecure()), size(req->getSize()),
578 headerDelay(0), payloadDelay(0),
586 senderState(NULL)
579 senderState(NULL)
587 {
588 if (req->hasPaddr()) {
589 addr = req->getPaddr();
590 flags.set(VALID_ADDR);
591 _isSecure = req->isSecure();
592 }
593 if (req->hasSize()) {
594 size = req->getSize();
595 flags.set(VALID_SIZE);
596 }
597 }
580 { }
598
599 /**
581
582 /**
600 * Alternate constructor if you are trying to create a packet with
601 * a request that is for a whole block, not the address from the
602 * req. this allows for overriding the size/addr of the req.
583 * Alternate constructor when creating a packet that is for a
584 * whole block. This allows for overriding the size and addr of
585 * the request.
603 */
586 */
604 Packet(const RequestPtr _req, MemCmd _cmd, int _blkSize)
605 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false),
587 Packet(const RequestPtr _req, MemCmd _cmd, unsigned _blkSize)
588 : cmd(_cmd), req(_req), data(nullptr),
589 addr(_req->getPaddr() & ~Addr(_blkSize - 1)),
590 _isSecure(_req->isSecure()), size(_blkSize),
606 headerDelay(0), payloadDelay(0),
607 senderState(NULL)
591 headerDelay(0), payloadDelay(0),
592 senderState(NULL)
608 {
609 if (req->hasPaddr()) {
610 addr = req->getPaddr() & ~(_blkSize - 1);
611 flags.set(VALID_ADDR);
612 _isSecure = req->isSecure();
613 }
614 size = _blkSize;
615 flags.set(VALID_SIZE);
616 }
593 { }
617
618 /**
619 * Alternate constructor for copying a packet. Copy all fields
620 * *except* if the original packet's data was dynamic, don't copy
621 * that, as we can't guarantee that the new packet's lifetime is
622 * less than that of the original packet. In this case the new
623 * packet should allocate its own data.
624 */

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

629 bytesValid(pkt->bytesValid),
630 headerDelay(pkt->headerDelay),
631 payloadDelay(pkt->payloadDelay),
632 senderState(pkt->senderState)
633 {
634 if (!clear_flags)
635 flags.set(pkt->flags & COPY_FLAGS);
636
594
595 /**
596 * Alternate constructor for copying a packet. Copy all fields
597 * *except* if the original packet's data was dynamic, don't copy
598 * that, as we can't guarantee that the new packet's lifetime is
599 * less than that of the original packet. In this case the new
600 * packet should allocate its own data.
601 */

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

606 bytesValid(pkt->bytesValid),
607 headerDelay(pkt->headerDelay),
608 payloadDelay(pkt->payloadDelay),
609 senderState(pkt->senderState)
610 {
611 if (!clear_flags)
612 flags.set(pkt->flags & COPY_FLAGS);
613
637 flags.set(pkt->flags & (VALID_ADDR|VALID_SIZE));
638
639 // should we allocate space for data, or not, the express
640 // snoops do not need to carry any data as they only serve to
641 // co-ordinate state changes
642 if (alloc_data) {
643 // even if asked to allocate data, if the original packet
644 // holds static data, then the sender will not be doing
645 // any memcpy on receiving the response, thus we simply
646 // carry the pointer forward

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

752 if (isWrite()) {
753 cmd = MemCmd::FunctionalWriteError;
754 } else {
755 cmd = MemCmd::FunctionalReadError;
756 }
757 }
758 }
759
614 // should we allocate space for data, or not, the express
615 // snoops do not need to carry any data as they only serve to
616 // co-ordinate state changes
617 if (alloc_data) {
618 // even if asked to allocate data, if the original packet
619 // holds static data, then the sender will not be doing
620 // any memcpy on receiving the response, thus we simply
621 // carry the pointer forward

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

727 if (isWrite()) {
728 cmd = MemCmd::FunctionalWriteError;
729 } else {
730 cmd = MemCmd::FunctionalReadError;
731 }
732 }
733 }
734
760 void
761 setSize(unsigned size)
762 {
763 assert(!flags.isSet(VALID_SIZE));
764
765 this->size = size;
766 flags.set(VALID_SIZE);
767 }
768
769
770 public:
771 /**
772 * @{
773 * @name Data accessor mehtods
774 */
775
776 /**
777 * Set the data pointer to the following value that should not be

--- 288 unchanged lines hidden ---
735 public:
736 /**
737 * @{
738 * @name Data accessor mehtods
739 */
740
741 /**
742 * Set the data pointer to the following value that should not be

--- 288 unchanged lines hidden ---