Deleted Added
sdiff udiff text old ( 6882:898047a3672c ) new ( 6893:9cdf9b65d946 )
full compact
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

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

31#include "mem/ruby/system/RubyPort.hh"
32#include "mem/ruby/slicc_interface/AbstractController.hh"
33
34uint16_t RubyPort::m_num_ports = 0;
35
36RubyPort::RequestMap RubyPort::pending_cpu_requests;
37
38RubyPort::RubyPort(const Params *p)
39 : MemObject(p),
40 funcMemPort(csprintf("%s-funcmem_port", name()), this)
41{
42 m_version = p->version;
43 assert(m_version != -1);
44
45 m_controller = NULL;
46 m_mandatory_q_ptr = NULL;
47
48 m_port_id = m_num_ports++;
49 m_request_cnt = 0;
50 m_hit_callback = ruby_hit_callback;
51 pio_port = NULL;
52 assert(m_num_ports <= 2048); // see below for reason
53}
54
55void RubyPort::init()
56{
57 assert(m_controller != NULL);
58 m_mandatory_q_ptr = m_controller->getMandatoryQueue();
59}

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

68 // ensure there is only one pio port
69 //
70 assert(pio_port == NULL);
71
72 pio_port = new PioPort(csprintf("%s-pio-port%d", name(), idx),
73 this);
74
75 return pio_port;
76 } else if (if_name == "funcmem_port") {
77 return &funcMemPort;
78 }
79 return NULL;
80}
81
82RubyPort::PioPort::PioPort(const std::string &_name,
83 RubyPort *_port)
84 : SimpleTimingPort(_name, _port)
85{

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

243RubyPort::M5Port::hitCallback(PacketPtr pkt)
244{
245
246 bool needsResponse = pkt->needsResponse();
247
248 DPRINTF(MemoryAccess, "Hit callback needs response %d\n",
249 needsResponse);
250
251 ruby_port->funcMemPort.sendFunctional(pkt);
252
253 // turn packet around to go back to requester if response expected
254 if (needsResponse) {
255 // recvAtomic() should already have turned packet into
256 // atomic response
257 assert(pkt->isResponse());
258 DPRINTF(MemoryAccess, "Sending packet back over port\n");
259 sendTiming(pkt);
260 } else {
261 delete pkt;
262 }
263 DPRINTF(MemoryAccess, "Hit callback done!\n");

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

277 return true;
278}
279
280bool
281RubyPort::M5Port::isPhysMemAddress(Addr addr)
282{
283 AddrRangeList physMemAddrList;
284 bool snoop = false;
285 ruby_port->funcMemPort.getPeerAddressRanges(physMemAddrList, snoop);
286 for(AddrRangeIter iter = physMemAddrList.begin();
287 iter != physMemAddrList.end();
288 iter++) {
289 if (addr >= iter->start && addr <= iter->end) {
290 DPRINTF(MemoryAccess, "Request found in %#llx - %#llx range\n",
291 iter->start, iter->end);
292 return true;
293 }
294 }
295 assert(isPioAddress(addr));
296 return false;
297}
298
299bool
300RubyPort::M5Port::isPioAddress(Addr addr)
301{
302 AddrRangeList pioAddrList;
303 bool snoop = false;
304 if (ruby_port->pio_port == NULL) {
305 return false;
306 }
307
308 ruby_port->pio_port->getPeerAddressRanges(pioAddrList, snoop);
309 for(AddrRangeIter iter = pioAddrList.begin();
310 iter != pioAddrList.end();
311 iter++) {
312 if (addr >= iter->start && addr <= iter->end) {
313 DPRINTF(MemoryAccess, "Pio request found in %#llx - %#llx range\n",
314 iter->start, iter->end);
315 return true;
316 }
317 }
318 return false;
319}
320