request.hh (8551:4e09d02322fb) | request.hh (8832:247fee427324) |
---|---|
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; --- 36 unchanged lines hidden (view full) --- 45#include "base/flags.hh" 46#include "base/misc.hh" 47#include "base/types.hh" 48#include "sim/core.hh" 49 50class Request; 51 52typedef Request* RequestPtr; | 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; --- 36 unchanged lines hidden (view full) --- 45#include "base/flags.hh" 46#include "base/misc.hh" 47#include "base/types.hh" 48#include "sim/core.hh" 49 50class Request; 51 52typedef Request* RequestPtr; |
53typedef uint16_t MasterID; |
|
53 54class Request : public FastAlloc 55{ 56 public: 57 typedef uint32_t FlagsType; 58 typedef ::Flags<FlagsType> Flags; 59 60 /** ASI information for this request if it exists. */ --- 34 unchanged lines hidden (view full) --- 95 static const FlagsType PF_EXCLUSIVE = 0x02000000; 96 /** The request should be marked as LRU. */ 97 static const FlagsType EVICT_NEXT = 0x04000000; 98 99 /** These flags are *not* cleared when a Request object is reused 100 (assigned a new address). */ 101 static const FlagsType STICKY_FLAGS = INST_FETCH; 102 | 54 55class Request : public FastAlloc 56{ 57 public: 58 typedef uint32_t FlagsType; 59 typedef ::Flags<FlagsType> Flags; 60 61 /** ASI information for this request if it exists. */ --- 34 unchanged lines hidden (view full) --- 96 static const FlagsType PF_EXCLUSIVE = 0x02000000; 97 /** The request should be marked as LRU. */ 98 static const FlagsType EVICT_NEXT = 0x04000000; 99 100 /** These flags are *not* cleared when a Request object is reused 101 (assigned a new address). */ 102 static const FlagsType STICKY_FLAGS = INST_FETCH; 103 |
104 /** Request Ids that are statically allocated 105 * @{*/ 106 /** This request id is used for writeback requests by the caches */ 107 static const MasterID wbMasterId = 0; 108 /** This request id is used for functional requests that don't come from a 109 * particular device 110 */ 111 static const MasterID funcMasterId = 1; 112 /** This request id is used for message signaled interrupts */ 113 static const MasterID intMasterId = 2; 114 /** @} */ 115 |
|
103 private: 104 typedef uint8_t PrivateFlagsType; 105 typedef ::Flags<PrivateFlagsType> PrivateFlags; 106 107 /** Whether or not the size is valid. */ 108 static const PrivateFlagsType VALID_SIZE = 0x00000001; 109 /** Whether or not paddr is valid (has been written yet). */ 110 static const PrivateFlagsType VALID_PADDR = 0x00000002; --- 21 unchanged lines hidden (view full) --- 132 133 /** 134 * The size of the request. This field must be set when vaddr or 135 * paddr is written via setVirt() or setPhys(), so it is always 136 * valid as long as one of the address fields is valid. 137 */ 138 int _size; 139 | 116 private: 117 typedef uint8_t PrivateFlagsType; 118 typedef ::Flags<PrivateFlagsType> PrivateFlags; 119 120 /** Whether or not the size is valid. */ 121 static const PrivateFlagsType VALID_SIZE = 0x00000001; 122 /** Whether or not paddr is valid (has been written yet). */ 123 static const PrivateFlagsType VALID_PADDR = 0x00000002; --- 21 unchanged lines hidden (view full) --- 145 146 /** 147 * The size of the request. This field must be set when vaddr or 148 * paddr is written via setVirt() or setPhys(), so it is always 149 * valid as long as one of the address fields is valid. 150 */ 151 int _size; 152 |
153 /** The requestor ID which is unique in the system for all ports 154 * that are capable of issuing a transaction 155 */ 156 MasterID _masterId; 157 |
|
140 /** Flag structure for the request. */ 141 Flags _flags; 142 143 /** Private flags for field validity checking. */ 144 PrivateFlags privateFlags; 145 146 /** 147 * The time this request was started. Used to calculate --- 29 unchanged lines hidden (view full) --- 177 Request() 178 {} 179 180 /** 181 * Constructor for physical (e.g. device) requests. Initializes 182 * just physical address, size, flags, and timestamp (to curTick()). 183 * These fields are adequate to perform a request. 184 */ | 158 /** Flag structure for the request. */ 159 Flags _flags; 160 161 /** Private flags for field validity checking. */ 162 PrivateFlags privateFlags; 163 164 /** 165 * The time this request was started. Used to calculate --- 29 unchanged lines hidden (view full) --- 195 Request() 196 {} 197 198 /** 199 * Constructor for physical (e.g. device) requests. Initializes 200 * just physical address, size, flags, and timestamp (to curTick()). 201 * These fields are adequate to perform a request. 202 */ |
185 Request(Addr paddr, int size, Flags flags) | 203 Request(Addr paddr, int size, Flags flags, MasterID mid) |
186 { | 204 { |
187 setPhys(paddr, size, flags); | 205 setPhys(paddr, size, flags, mid); |
188 } 189 | 206 } 207 |
190 Request(Addr paddr, int size, Flags flags, Tick time) | 208 Request(Addr paddr, int size, Flags flags, MasterID mid, Tick time) |
191 { | 209 { |
192 setPhys(paddr, size, flags, time); | 210 setPhys(paddr, size, flags, mid, time); |
193 } 194 | 211 } 212 |
195 Request(Addr paddr, int size, Flags flags, Tick time, Addr pc) | 213 Request(Addr paddr, int size, Flags flags, MasterID mid, Tick time, Addr pc) |
196 { | 214 { |
197 setPhys(paddr, size, flags, time); | 215 setPhys(paddr, size, flags, mid, time); |
198 privateFlags.set(VALID_PC); 199 _pc = pc; 200 } 201 | 216 privateFlags.set(VALID_PC); 217 _pc = pc; 218 } 219 |
202 Request(int asid, Addr vaddr, int size, Flags flags, Addr pc, | 220 Request(int asid, Addr vaddr, int size, Flags flags, MasterID mid, Addr pc, |
203 int cid, ThreadID tid) 204 { | 221 int cid, ThreadID tid) 222 { |
205 setVirt(asid, vaddr, size, flags, pc); | 223 setVirt(asid, vaddr, size, flags, mid, pc); |
206 setThreadContext(cid, tid); 207 } 208 209 ~Request() {} // for FastAlloc 210 211 /** 212 * Set up CPU and thread numbers. 213 */ --- 5 unchanged lines hidden (view full) --- 219 privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 220 } 221 222 /** 223 * Set up a physical (e.g. device) request in a previously 224 * allocated Request object. 225 */ 226 void | 224 setThreadContext(cid, tid); 225 } 226 227 ~Request() {} // for FastAlloc 228 229 /** 230 * Set up CPU and thread numbers. 231 */ --- 5 unchanged lines hidden (view full) --- 237 privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID); 238 } 239 240 /** 241 * Set up a physical (e.g. device) request in a previously 242 * allocated Request object. 243 */ 244 void |
227 setPhys(Addr paddr, int size, Flags flags, Tick time) | 245 setPhys(Addr paddr, int size, Flags flags, MasterID mid, Tick time) |
228 { 229 assert(size >= 0); 230 _paddr = paddr; 231 _size = size; 232 _time = time; | 246 { 247 assert(size >= 0); 248 _paddr = paddr; 249 _size = size; 250 _time = time; |
233 | 251 _masterId = mid; |
234 _flags.clear(~STICKY_FLAGS); 235 _flags.set(flags); 236 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 237 privateFlags.set(VALID_PADDR|VALID_SIZE); 238 } 239 240 void | 252 _flags.clear(~STICKY_FLAGS); 253 _flags.set(flags); 254 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 255 privateFlags.set(VALID_PADDR|VALID_SIZE); 256 } 257 258 void |
241 setPhys(Addr paddr, int size, Flags flags) | 259 setPhys(Addr paddr, int size, Flags flags, MasterID mid) |
242 { | 260 { |
243 setPhys(paddr, size, flags, curTick()); | 261 setPhys(paddr, size, flags, mid, curTick()); |
244 } 245 246 /** 247 * Set up a virtual (e.g., CPU) request in a previously 248 * allocated Request object. 249 */ 250 void | 262 } 263 264 /** 265 * Set up a virtual (e.g., CPU) request in a previously 266 * allocated Request object. 267 */ 268 void |
251 setVirt(int asid, Addr vaddr, int size, Flags flags, Addr pc) | 269 setVirt(int asid, Addr vaddr, int size, Flags flags, MasterID mid, Addr pc) |
252 { 253 assert(size >= 0); 254 _asid = asid; 255 _vaddr = vaddr; 256 _size = size; | 270 { 271 assert(size >= 0); 272 _asid = asid; 273 _vaddr = vaddr; 274 _size = size; |
275 _masterId = mid; |
|
257 _pc = pc; 258 _time = curTick(); 259 260 _flags.clear(~STICKY_FLAGS); 261 _flags.set(flags); 262 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 263 privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 264 } --- 99 unchanged lines hidden (view full) --- 364 /** Accessor function for vaddr.*/ 365 Addr 366 getVaddr() 367 { 368 assert(privateFlags.isSet(VALID_VADDR)); 369 return _vaddr; 370 } 371 | 276 _pc = pc; 277 _time = curTick(); 278 279 _flags.clear(~STICKY_FLAGS); 280 _flags.set(flags); 281 privateFlags.clear(~STICKY_PRIVATE_FLAGS); 282 privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC); 283 } --- 99 unchanged lines hidden (view full) --- 383 /** Accessor function for vaddr.*/ 384 Addr 385 getVaddr() 386 { 387 assert(privateFlags.isSet(VALID_VADDR)); 388 return _vaddr; 389 } 390 |
391 /** Accesssor for the requestor id. */ 392 MasterID 393 masterId() 394 { 395 return _masterId; 396 } 397 |
|
372 /** Accessor function for asid.*/ 373 int 374 getAsid() 375 { 376 assert(privateFlags.isSet(VALID_VADDR)); 377 return _asid; 378 } 379 --- 88 unchanged lines hidden --- | 398 /** Accessor function for asid.*/ 399 int 400 getAsid() 401 { 402 assert(privateFlags.isSet(VALID_VADDR)); 403 return _asid; 404 } 405 --- 88 unchanged lines hidden --- |