RubyPort.cc (6922:1620cffaa3b6) RubyPort.cc (7023:185ad61a4117)
1
2/*
3 * Copyright (c) 2009 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

205 //
206 // If valid, copy the pc to the ruby request
207 //
208 Addr pc = 0;
209 if (pkt->req->hasPC()) {
210 pc = pkt->req->getPC();
211 }
212
1
2/*
3 * Copyright (c) 2009 Advanced Micro Devices, Inc.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met: redistributions of source code must retain the above copyright

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

205 //
206 // If valid, copy the pc to the ruby request
207 //
208 Addr pc = 0;
209 if (pkt->req->hasPC()) {
210 pc = pkt->req->getPC();
211 }
212
213 if (pkt->isRead()) {
214 if (pkt->req->isInstFetch()) {
215 type = RubyRequestType_IFETCH;
213 if (pkt->isLLSC()) {
214 if (pkt->isWrite()) {
215 DPRINTF(MemoryAccess, "Issuing SC\n");
216 type = RubyRequestType_Locked_Write;
216 } else {
217 } else {
217 type = RubyRequestType_LD;
218 DPRINTF(MemoryAccess, "Issuing LL\n");
219 assert(pkt->isRead());
220 type = RubyRequestType_Locked_Read;
218 }
221 }
219 } else if (pkt->isWrite()) {
220 type = RubyRequestType_ST;
221 } else if (pkt->isReadWrite()) {
222 type = RubyRequestType_RMW_Write;
223 } else {
222 } else {
224 panic("Unsupported ruby packet type\n");
223 if (pkt->isRead()) {
224 if (pkt->req->isInstFetch()) {
225 type = RubyRequestType_IFETCH;
226 } else {
227 type = RubyRequestType_LD;
228 }
229 } else if (pkt->isWrite()) {
230 type = RubyRequestType_ST;
231 } else if (pkt->isReadWrite()) {
232 //
233 // Fix me. Just because the packet is a read/write request does not
234 // necessary mean it is a read-modify-write atomic operation.
235 //
236 type = RubyRequestType_RMW_Write;
237 } else {
238 panic("Unsupported ruby packet type\n");
239 }
225 }
226
227 RubyRequest ruby_request(pkt->getAddr(),
228 pkt->getPtr<uint8_t>(),
229 pkt->getSize(),
230 pc,
231 type,
232 RubyAccessMode_Supervisor,
233 pkt);
234
235 // Submit the ruby request
236 RequestStatus requestStatus = ruby_port->makeRequest(ruby_request);
240 }
241
242 RubyRequest ruby_request(pkt->getAddr(),
243 pkt->getPtr<uint8_t>(),
244 pkt->getSize(),
245 pc,
246 type,
247 RubyAccessMode_Supervisor,
248 pkt);
249
250 // Submit the ruby request
251 RequestStatus requestStatus = ruby_port->makeRequest(ruby_request);
237 if (requestStatus == RequestStatus_Issued) {
252
253 //
254 // If the request successfully issued or the SC request completed because
255 // exclusive permission was lost, then we should return true.
256 // Otherwise, we need to delete the senderStatus we just created and return
257 // false.
258 //
259 if ((requestStatus == RequestStatus_Issued) ||
260 (requestStatus == RequestStatus_LlscFailed)) {
261
262 //
263 // The communicate to M5 whether the SC command succeeded by seting the
264 // packet's extra data.
265 //
266 if (pkt->isLLSC() && pkt->isWrite()) {
267 if (requestStatus == RequestStatus_LlscFailed) {
268 DPRINTF(MemoryAccess, "SC failed and request completed\n");
269 pkt->req->setExtraData(0);
270 } else {
271 pkt->req->setExtraData(1);
272 }
273 }
238 return true;
239 }
274 return true;
275 }
240
276
241 DPRINTF(MemoryAccess,
242 "Request for address #x did not issue because %s\n",
243 pkt->getAddr(),
244 RequestStatus_to_string(requestStatus));
245
246 SenderState* senderState = safe_cast<SenderState*>(pkt->senderState);
247 pkt->senderState = senderState->saved;
248 delete senderState;

--- 76 unchanged lines hidden ---
277 DPRINTF(MemoryAccess,
278 "Request for address #x did not issue because %s\n",
279 pkt->getAddr(),
280 RequestStatus_to_string(requestStatus));
281
282 SenderState* senderState = safe_cast<SenderState*>(pkt->senderState);
283 pkt->senderState = senderState->saved;
284 delete senderState;

--- 76 unchanged lines hidden ---