packet.hh (10896:66e131813346) | packet.hh (10938:75c5a45170d7) |
---|---|
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 --- 222 unchanged lines hidden (view full) --- 231 */ 232class Packet : public Printable 233{ 234 public: 235 typedef uint32_t FlagsType; 236 typedef ::Flags<FlagsType> Flags; 237 238 private: | 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 --- 222 unchanged lines hidden (view full) --- 231 */ 232class Packet : public Printable 233{ 234 public: 235 typedef uint32_t FlagsType; 236 typedef ::Flags<FlagsType> Flags; 237 238 private: |
239 static const FlagsType PUBLIC_FLAGS = 0x00000000; 240 static const FlagsType PRIVATE_FLAGS = 0x00007F0F; 241 static const FlagsType COPY_FLAGS = 0x0000000F; | |
242 | 239 |
243 static const FlagsType SHARED = 0x00000001; 244 // Special control flags 245 /// Special timing-mode atomic snoop for multi-level coherence. 246 static const FlagsType EXPRESS_SNOOP = 0x00000002; 247 /// Does supplier have exclusive copy? 248 /// Useful for multi-level coherence. 249 static const FlagsType SUPPLY_EXCLUSIVE = 0x00000004; 250 // Snoop response flags 251 static const FlagsType MEM_INHIBIT = 0x00000008; 252 /// Are the 'addr' and 'size' fields valid? 253 static const FlagsType VALID_ADDR = 0x00000100; 254 static const FlagsType VALID_SIZE = 0x00000200; 255 /// Is the data pointer set to a value that shouldn't be freed 256 /// when the packet is destroyed? 257 static const FlagsType STATIC_DATA = 0x00001000; 258 /// The data pointer points to a value that should be freed when 259 /// the packet is destroyed. The pointer is assumed to be pointing 260 /// to an array, and delete [] is consequently called 261 static const FlagsType DYNAMIC_DATA = 0x00002000; 262 /// suppress the error if this packet encounters a functional 263 /// access failure. 264 static const FlagsType SUPPRESS_FUNC_ERROR = 0x00008000; 265 // Signal block present to squash prefetch and cache evict packets 266 // through express snoop flag 267 static const FlagsType BLOCK_CACHED = 0x00010000; | 240 enum : FlagsType { 241 // Flags to transfer across when copying a packet 242 COPY_FLAGS = 0x0000000F, |
268 | 243 |
244 SHARED = 0x00000001, 245 // Special control flags 246 /// Special timing-mode atomic snoop for multi-level coherence. 247 EXPRESS_SNOOP = 0x00000002, 248 /// Does supplier have exclusive copy? 249 /// Useful for multi-level coherence. 250 SUPPLY_EXCLUSIVE = 0x00000004, 251 // Snoop response flags 252 MEM_INHIBIT = 0x00000008, 253 254 /// Are the 'addr' and 'size' fields valid? 255 VALID_ADDR = 0x00000100, 256 VALID_SIZE = 0x00000200, 257 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 266 /// suppress the error if this packet encounters a functional 267 /// access failure. 268 SUPPRESS_FUNC_ERROR = 0x00008000, 269 270 // Signal block present to squash prefetch and cache evict packets 271 // through express snoop flag 272 BLOCK_CACHED = 0x00010000 273 }; 274 |
|
269 Flags flags; 270 271 public: 272 typedef MemCmd::Command Command; 273 274 /// The command field of the packet. 275 MemCmd cmd; 276 --- 16 unchanged lines hidden (view full) --- 293 294 /// True if the request targets the secure memory space. 295 bool _isSecure; 296 297 /// The size of the request or transfer. 298 unsigned size; 299 300 /** | 275 Flags flags; 276 277 public: 278 typedef MemCmd::Command Command; 279 280 /// The command field of the packet. 281 MemCmd cmd; 282 --- 16 unchanged lines hidden (view full) --- 299 300 /// True if the request targets the secure memory space. 301 bool _isSecure; 302 303 /// The size of the request or transfer. 304 unsigned size; 305 306 /** |
301 * The original value of the command field. Only valid when the 302 * current command field is an error condition; in that case, the 303 * previous contents of the command field are copied here. This 304 * field is *not* set on non-error responses. 305 */ 306 MemCmd origCmd; 307 308 /** | |
309 * Track the bytes found that satisfy a functional read. 310 */ 311 std::vector<bool> bytesValid; 312 313 public: 314 315 /** 316 * The extra delay from seeing the packet until the header is --- 198 unchanged lines hidden (view full) --- 515 // field, etc.) 516 void 517 setBadAddress() 518 { 519 assert(isResponse()); 520 cmd = MemCmd::BadAddressError; 521 } 522 | 307 * Track the bytes found that satisfy a functional read. 308 */ 309 std::vector<bool> bytesValid; 310 311 public: 312 313 /** 314 * The extra delay from seeing the packet until the header is --- 198 unchanged lines hidden (view full) --- 513 // field, etc.) 514 void 515 setBadAddress() 516 { 517 assert(isResponse()); 518 cmd = MemCmd::BadAddressError; 519 } 520 |
523 bool hadBadAddress() const { return cmd == MemCmd::BadAddressError; } | |
524 void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; } 525 526 Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); 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 */ 534 void setAddr(Addr _addr) { assert(flags.isSet(VALID_ADDR)); addr = _addr; } 535 536 unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } | 521 void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; } 522 523 Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; } 524 /** 525 * Update the address of this packet mid-transaction. This is used 526 * by the address mapper to change an already set address to a new 527 * one based on the system configuration. It is intended to remap 528 * an existing address, so it asserts that the current address is 529 * valid. 530 */ 531 void setAddr(Addr _addr) { assert(flags.isSet(VALID_ADDR)); addr = _addr; } 532 533 unsigned getSize() const { assert(flags.isSet(VALID_SIZE)); return size; } |
537 Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); } | |
538 | 534 |
535 Addr getOffset(unsigned int blk_size) const 536 { 537 return getAddr() & Addr(blk_size - 1); 538 } 539 540 Addr getBlockAddr(unsigned int blk_size) const 541 { 542 return getAddr() & ~(Addr(blk_size - 1)); 543 } 544 |
|
539 bool isSecure() const 540 { 541 assert(flags.isSet(VALID_ADDR)); 542 return _isSecure; 543 } 544 545 /** 546 * It has been determined that the SC packet should successfully update | 545 bool isSecure() const 546 { 547 assert(flags.isSet(VALID_ADDR)); 548 return _isSecure; 549 } 550 551 /** 552 * It has been determined that the SC packet should successfully update |
547 * memory. Therefore, convert this SC packet to a normal write. | 553 * memory. Therefore, convert this SC packet to a normal write. |
548 */ 549 void 550 convertScToWrite() 551 { 552 assert(isLLSC()); 553 assert(isWrite()); 554 cmd = MemCmd::WriteReq; 555 } 556 557 /** | 554 */ 555 void 556 convertScToWrite() 557 { 558 assert(isLLSC()); 559 assert(isWrite()); 560 cmd = MemCmd::WriteReq; 561 } 562 563 /** |
558 * When ruby is in use, Ruby will monitor the cache line and thus M5 559 * phys memory should treat LL ops as normal reads. | 564 * When ruby is in use, Ruby will monitor the cache line and the 565 * phys memory should treat LL ops as normal reads. |
560 */ 561 void 562 convertLlToRead() 563 { 564 assert(isLLSC()); 565 assert(isRead()); 566 cmd = MemCmd::ReadReq; 567 } 568 569 /** | 566 */ 567 void 568 convertLlToRead() 569 { 570 assert(isLLSC()); 571 assert(isRead()); 572 cmd = MemCmd::ReadReq; 573 } 574 575 /** |
570 * Constructor. Note that a Request object must be constructed | 576 * Constructor. Note that a Request object must be constructed |
571 * first, but the Requests's physical address and size fields need 572 * not be valid. The command must be supplied. 573 */ 574 Packet(const RequestPtr _req, MemCmd _cmd) 575 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false), 576 size(0), headerDelay(0), payloadDelay(0), 577 senderState(NULL) 578 { --- 133 unchanged lines hidden (view full) --- 712 * Take a request packet and modify it in place to be suitable for 713 * returning as a response to that request. 714 */ 715 void 716 makeResponse() 717 { 718 assert(needsResponse()); 719 assert(isRequest()); | 577 * first, but the Requests's physical address and size fields need 578 * not be valid. The command must be supplied. 579 */ 580 Packet(const RequestPtr _req, MemCmd _cmd) 581 : cmd(_cmd), req(_req), data(nullptr), addr(0), _isSecure(false), 582 size(0), headerDelay(0), payloadDelay(0), 583 senderState(NULL) 584 { --- 133 unchanged lines hidden (view full) --- 718 * Take a request packet and modify it in place to be suitable for 719 * returning as a response to that request. 720 */ 721 void 722 makeResponse() 723 { 724 assert(needsResponse()); 725 assert(isRequest()); |
720 origCmd = cmd; | |
721 cmd = cmd.responseCommand(); 722 723 // responses are never express, even if the snoop that 724 // triggered them was 725 flags.clear(EXPRESS_SNOOP); 726 } 727 728 void --- 276 unchanged lines hidden --- | 726 cmd = cmd.responseCommand(); 727 728 // responses are never express, even if the snoop that 729 // triggered them was 730 flags.clear(EXPRESS_SNOOP); 731 } 732 733 void --- 276 unchanged lines hidden --- |