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;
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
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
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)
204 {
187 setPhys(paddr, size, flags);
205 setPhys(paddr, size, flags, mid);
206 }
207
190 Request(Addr paddr, int size, Flags flags, Tick time)
208 Request(Addr paddr, int size, Flags flags, MasterID mid, Tick time)
209 {
192 setPhys(paddr, size, flags, time);
210 setPhys(paddr, size, flags, mid, time);
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)
214 {
197 setPhys(paddr, size, flags, time);
215 setPhys(paddr, size, flags, mid, time);
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,
221 int cid, ThreadID tid)
222 {
205 setVirt(asid, vaddr, size, flags, pc);
223 setVirt(asid, vaddr, size, flags, mid, pc);
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)
246 {
247 assert(size >= 0);
248 _paddr = paddr;
249 _size = size;
250 _time = time;
233
251 _masterId = mid;
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)
260 {
243 setPhys(paddr, size, flags, curTick());
261 setPhys(paddr, size, flags, mid, curTick());
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)
270 {
271 assert(size >= 0);
272 _asid = asid;
273 _vaddr = vaddr;
274 _size = size;
275 _masterId = mid;
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
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 ---