1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| 1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27 */ 28 29/** 30 * @file Decleration of a request, the overall memory request consisting of 31 the parts of the request that are persistent throughout the transaction. 32 */ 33 34#ifndef __MEM_REQUEST_HH__ 35#define __MEM_REQUEST_HH__ 36 37#include "arch/isa_traits.hh" 38 39class Request; 40 41typedef Request* RequestPtr; 42 43/** The request is a Load locked/store conditional. */ 44const unsigned LOCKED = 0x001; 45/** The virtual address is also the physical address. */ 46const unsigned PHYSICAL = 0x002; 47/** The request is an ALPHA VPTE pal access (hw_ld). */ 48const unsigned VPTE = 0x004; 49/** Use the alternate mode bits in ALPHA. */ 50const unsigned ALTMODE = 0x008; 51/** The request is to an uncacheable address. */ 52const unsigned UNCACHEABLE = 0x010; 53/** The request should not cause a page fault. */ 54const unsigned NO_FAULT = 0x020; 55/** The request should be prefetched into the exclusive state. */ 56const unsigned PF_EXCLUSIVE = 0x100; 57/** The request should be marked as LRU. */ 58const unsigned EVICT_NEXT = 0x200; 59/** The request should ignore unaligned access faults */ 60const unsigned NO_ALIGN_FAULT = 0x400; 61 62class Request 63{ 64 private: 65 /** 66 * The physical address of the request. Valid only if validPaddr 67 * is set. */ 68 Addr paddr; 69 70 /** 71 * The size of the request. This field must be set when vaddr or 72 * paddr is written via setVirt() or setPhys(), so it is always 73 * valid as long as one of the address fields is valid. */ 74 int size; 75 76 /** Flag structure for the request. */ 77 uint32_t flags; 78 79 /** 80 * The time this request was started. Used to calculate 81 * latencies. This field is set to curTick any time paddr or vaddr 82 * is written. */ 83 Tick time; 84 85 /** The address space ID. */ 86 int asid; 87 /** The virtual address of the request. */ 88 Addr vaddr; 89 90 /** The return value of store conditional. */ 91 uint64_t scResult; 92 93 /** The cpu number (for statistics, typically). */ 94 int cpuNum; 95 /** The requesting thread id (for statistics, typically). */ 96 int threadNum; 97 98 /** program counter of initiating access; for tracing/debugging */ 99 Addr pc; 100 101 /** Whether or not paddr is valid (has been written yet). */ 102 bool validPaddr; 103 /** Whether or not the asid & vaddr are valid. */ 104 bool validAsidVaddr; 105 /** Whether or not the sc result is valid. */ 106 bool validScResult; 107 /** Whether or not the cpu number & thread ID are valid. */ 108 bool validCpuAndThreadNums; 109 /** Whether or not the pc is valid. */ 110 bool validPC; 111 112 public: 113 /** Minimal constructor. No fields are initialized. */ 114 Request() 115 : validPaddr(false), validAsidVaddr(false), 116 validScResult(false), validCpuAndThreadNums(false), validPC(false) 117 {} 118 119 /** 120 * Constructor for physical (e.g. device) requests. Initializes 121 * just physical address, size, flags, and timestamp (to curTick). 122 * These fields are adequate to perform a request. */ 123 Request(Addr _paddr, int _size, int _flags) 124 : validCpuAndThreadNums(false) 125 { setPhys(_paddr, _size, _flags); } 126 127 /** 128 * Set up CPU and thread numbers. */ 129 void setThreadContext(int _cpuNum, int _threadNum) 130 { 131 cpuNum = _cpuNum; 132 threadNum = _threadNum; 133 validCpuAndThreadNums = true; 134 } 135 136 /** 137 * Set up a physical (e.g. device) request in a previously 138 * allocated Request object. */ 139 void setPhys(Addr _paddr, int _size, int _flags) 140 { 141 paddr = _paddr; 142 size = _size; 143 flags = _flags; 144 time = curTick; 145 validPaddr = true; 146 validAsidVaddr = false; 147 validPC = false; 148 validScResult = false; 149 } 150 151 /** 152 * Set up a virtual (e.g., CPU) request in a previously 153 * allocated Request object. */ 154 void setVirt(int _asid, Addr _vaddr, int _size, int _flags, Addr _pc) 155 { 156 asid = _asid; 157 vaddr = _vaddr; 158 size = _size; 159 flags = _flags; 160 pc = _pc; 161 time = curTick; 162 validPaddr = false; 163 validAsidVaddr = true; 164 validPC = true; 165 validScResult = false; 166 } 167 168 /** Set just the physical address. This should only be used to 169 * record the result of a translation, and thus the vaddr must be 170 * valid before this method is called. Otherwise, use setPhys() 171 * to guarantee that the size and flags are also set. 172 */ 173 void setPaddr(Addr _paddr) 174 { 175 assert(validAsidVaddr); 176 paddr = _paddr; 177 validPaddr = true; 178 } 179 180 /** Accessor for paddr. */ 181 Addr getPaddr() { assert(validPaddr); return paddr; } 182 183 /** Accessor for size. */ 184 int getSize() { assert(validPaddr || validAsidVaddr); return size; } 185 /** Accessor for time. */ 186 Tick getTime() { assert(validPaddr || validAsidVaddr); return time; } 187 188 /** Accessor for flags. */ 189 uint32_t getFlags() { assert(validPaddr || validAsidVaddr); return flags; } 190 /** Accessor for paddr. */ 191 void setFlags(uint32_t _flags) 192 { assert(validPaddr || validAsidVaddr); flags = _flags; } 193 194 /** Accessor function for vaddr.*/ 195 Addr getVaddr() { assert(validAsidVaddr); return vaddr; } 196 197 /** Accessor function for asid.*/ 198 int getAsid() { assert(validAsidVaddr); return asid; } 199 200 /** Accessor function for store conditional return value.*/ 201 uint64_t getScResult() { assert(validScResult); return scResult; } 202 /** Accessor function for store conditional return value.*/ 203 void setScResult(uint64_t _scResult) 204 { scResult = _scResult; validScResult = true; } 205 206 /** Accessor function for cpu number.*/ 207 int getCpuNum() { assert(validCpuAndThreadNums); return cpuNum; } 208 /** Accessor function for thread number.*/ 209 int getThreadNum() { assert(validCpuAndThreadNums); return threadNum; } 210 211 /** Accessor function for pc.*/ 212 Addr getPC() { assert(validPC); return pc; } 213 214 friend class Packet; 215}; 216 217#endif // __MEM_REQUEST_HH__
| 31 */ 32 33/** 34 * @file Decleration of a request, the overall memory request consisting of 35 the parts of the request that are persistent throughout the transaction. 36 */ 37 38#ifndef __MEM_REQUEST_HH__ 39#define __MEM_REQUEST_HH__ 40 41#include "arch/isa_traits.hh" 42 43class Request; 44 45typedef Request* RequestPtr; 46 47/** The request is a Load locked/store conditional. */ 48const unsigned LOCKED = 0x001; 49/** The virtual address is also the physical address. */ 50const unsigned PHYSICAL = 0x002; 51/** The request is an ALPHA VPTE pal access (hw_ld). */ 52const unsigned VPTE = 0x004; 53/** Use the alternate mode bits in ALPHA. */ 54const unsigned ALTMODE = 0x008; 55/** The request is to an uncacheable address. */ 56const unsigned UNCACHEABLE = 0x010; 57/** The request should not cause a page fault. */ 58const unsigned NO_FAULT = 0x020; 59/** The request should be prefetched into the exclusive state. */ 60const unsigned PF_EXCLUSIVE = 0x100; 61/** The request should be marked as LRU. */ 62const unsigned EVICT_NEXT = 0x200; 63/** The request should ignore unaligned access faults */ 64const unsigned NO_ALIGN_FAULT = 0x400; 65 66class Request 67{ 68 private: 69 /** 70 * The physical address of the request. Valid only if validPaddr 71 * is set. */ 72 Addr paddr; 73 74 /** 75 * The size of the request. This field must be set when vaddr or 76 * paddr is written via setVirt() or setPhys(), so it is always 77 * valid as long as one of the address fields is valid. */ 78 int size; 79 80 /** Flag structure for the request. */ 81 uint32_t flags; 82 83 /** 84 * The time this request was started. Used to calculate 85 * latencies. This field is set to curTick any time paddr or vaddr 86 * is written. */ 87 Tick time; 88 89 /** The address space ID. */ 90 int asid; 91 /** The virtual address of the request. */ 92 Addr vaddr; 93 94 /** The return value of store conditional. */ 95 uint64_t scResult; 96 97 /** The cpu number (for statistics, typically). */ 98 int cpuNum; 99 /** The requesting thread id (for statistics, typically). */ 100 int threadNum; 101 102 /** program counter of initiating access; for tracing/debugging */ 103 Addr pc; 104 105 /** Whether or not paddr is valid (has been written yet). */ 106 bool validPaddr; 107 /** Whether or not the asid & vaddr are valid. */ 108 bool validAsidVaddr; 109 /** Whether or not the sc result is valid. */ 110 bool validScResult; 111 /** Whether or not the cpu number & thread ID are valid. */ 112 bool validCpuAndThreadNums; 113 /** Whether or not the pc is valid. */ 114 bool validPC; 115 116 public: 117 /** Minimal constructor. No fields are initialized. */ 118 Request() 119 : validPaddr(false), validAsidVaddr(false), 120 validScResult(false), validCpuAndThreadNums(false), validPC(false) 121 {} 122 123 /** 124 * Constructor for physical (e.g. device) requests. Initializes 125 * just physical address, size, flags, and timestamp (to curTick). 126 * These fields are adequate to perform a request. */ 127 Request(Addr _paddr, int _size, int _flags) 128 : validCpuAndThreadNums(false) 129 { setPhys(_paddr, _size, _flags); } 130 131 /** 132 * Set up CPU and thread numbers. */ 133 void setThreadContext(int _cpuNum, int _threadNum) 134 { 135 cpuNum = _cpuNum; 136 threadNum = _threadNum; 137 validCpuAndThreadNums = true; 138 } 139 140 /** 141 * Set up a physical (e.g. device) request in a previously 142 * allocated Request object. */ 143 void setPhys(Addr _paddr, int _size, int _flags) 144 { 145 paddr = _paddr; 146 size = _size; 147 flags = _flags; 148 time = curTick; 149 validPaddr = true; 150 validAsidVaddr = false; 151 validPC = false; 152 validScResult = false; 153 } 154 155 /** 156 * Set up a virtual (e.g., CPU) request in a previously 157 * allocated Request object. */ 158 void setVirt(int _asid, Addr _vaddr, int _size, int _flags, Addr _pc) 159 { 160 asid = _asid; 161 vaddr = _vaddr; 162 size = _size; 163 flags = _flags; 164 pc = _pc; 165 time = curTick; 166 validPaddr = false; 167 validAsidVaddr = true; 168 validPC = true; 169 validScResult = false; 170 } 171 172 /** Set just the physical address. This should only be used to 173 * record the result of a translation, and thus the vaddr must be 174 * valid before this method is called. Otherwise, use setPhys() 175 * to guarantee that the size and flags are also set. 176 */ 177 void setPaddr(Addr _paddr) 178 { 179 assert(validAsidVaddr); 180 paddr = _paddr; 181 validPaddr = true; 182 } 183 184 /** Accessor for paddr. */ 185 Addr getPaddr() { assert(validPaddr); return paddr; } 186 187 /** Accessor for size. */ 188 int getSize() { assert(validPaddr || validAsidVaddr); return size; } 189 /** Accessor for time. */ 190 Tick getTime() { assert(validPaddr || validAsidVaddr); return time; } 191 192 /** Accessor for flags. */ 193 uint32_t getFlags() { assert(validPaddr || validAsidVaddr); return flags; } 194 /** Accessor for paddr. */ 195 void setFlags(uint32_t _flags) 196 { assert(validPaddr || validAsidVaddr); flags = _flags; } 197 198 /** Accessor function for vaddr.*/ 199 Addr getVaddr() { assert(validAsidVaddr); return vaddr; } 200 201 /** Accessor function for asid.*/ 202 int getAsid() { assert(validAsidVaddr); return asid; } 203 204 /** Accessor function for store conditional return value.*/ 205 uint64_t getScResult() { assert(validScResult); return scResult; } 206 /** Accessor function for store conditional return value.*/ 207 void setScResult(uint64_t _scResult) 208 { scResult = _scResult; validScResult = true; } 209 210 /** Accessor function for cpu number.*/ 211 int getCpuNum() { assert(validCpuAndThreadNums); return cpuNum; } 212 /** Accessor function for thread number.*/ 213 int getThreadNum() { assert(validCpuAndThreadNums); return threadNum; } 214 215 /** Accessor function for pc.*/ 216 Addr getPC() { assert(validPC); return pc; } 217 218 friend class Packet; 219}; 220 221#endif // __MEM_REQUEST_HH__
|