2010-01-30 05:29:17 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2009 Advanced Micro Devices, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2011-02-07 07:14:18 +01:00
|
|
|
#include "config/the_isa.hh"
|
|
|
|
#if THE_ISA == X86_ISA
|
|
|
|
#include "arch/x86/insts/microldstop.hh"
|
|
|
|
#endif // X86_ISA
|
2010-08-24 21:07:22 +02:00
|
|
|
#include "cpu/testers/rubytest/RubyTester.hh"
|
2011-04-15 19:44:32 +02:00
|
|
|
#include "debug/MemoryAccess.hh"
|
|
|
|
#include "debug/Ruby.hh"
|
2010-01-30 05:29:17 +01:00
|
|
|
#include "mem/ruby/slicc_interface/AbstractController.hh"
|
2010-03-23 02:43:53 +01:00
|
|
|
#include "mem/ruby/system/RubyPort.hh"
|
2011-04-15 19:44:06 +02:00
|
|
|
#include "mem/physical.hh"
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-01-30 05:29:17 +01:00
|
|
|
RubyPort::RubyPort(const Params *p)
|
2010-01-30 05:29:21 +01:00
|
|
|
: MemObject(p)
|
2010-01-30 05:29:17 +01:00
|
|
|
{
|
|
|
|
m_version = p->version;
|
|
|
|
assert(m_version != -1);
|
|
|
|
|
2010-01-30 05:29:21 +01:00
|
|
|
physmem = p->physmem;
|
2010-03-23 02:43:53 +01:00
|
|
|
|
2010-01-30 05:29:19 +01:00
|
|
|
m_controller = NULL;
|
|
|
|
m_mandatory_q_ptr = NULL;
|
2010-01-30 05:29:17 +01:00
|
|
|
|
|
|
|
m_request_cnt = 0;
|
2010-01-30 05:29:19 +01:00
|
|
|
pio_port = NULL;
|
2010-01-30 05:29:21 +01:00
|
|
|
physMemPort = NULL;
|
2011-02-07 07:14:18 +01:00
|
|
|
|
|
|
|
m_usingRubyTester = p->using_ruby_tester;
|
2011-02-07 07:14:19 +01:00
|
|
|
access_phys_mem = p->access_phys_mem;
|
2010-01-30 05:29:17 +01:00
|
|
|
}
|
|
|
|
|
2010-03-23 02:43:53 +01:00
|
|
|
void
|
|
|
|
RubyPort::init()
|
2010-01-30 05:29:19 +01:00
|
|
|
{
|
|
|
|
assert(m_controller != NULL);
|
|
|
|
m_mandatory_q_ptr = m_controller->getMandatoryQueue();
|
|
|
|
}
|
|
|
|
|
2010-01-30 05:29:17 +01:00
|
|
|
Port *
|
|
|
|
RubyPort::getPort(const std::string &if_name, int idx)
|
|
|
|
{
|
2010-01-30 05:29:19 +01:00
|
|
|
if (if_name == "port") {
|
2011-02-07 07:14:19 +01:00
|
|
|
return new M5Port(csprintf("%s-port%d", name(), idx), this,
|
|
|
|
access_phys_mem);
|
2010-03-23 02:43:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (if_name == "pio_port") {
|
2010-01-30 05:29:19 +01:00
|
|
|
// ensure there is only one pio port
|
|
|
|
assert(pio_port == NULL);
|
|
|
|
|
2010-03-23 02:43:53 +01:00
|
|
|
pio_port = new PioPort(csprintf("%s-pio-port%d", name(), idx), this);
|
2010-01-30 05:29:19 +01:00
|
|
|
|
|
|
|
return pio_port;
|
2010-03-23 02:43:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (if_name == "physMemPort") {
|
2010-01-30 05:29:21 +01:00
|
|
|
// RubyPort should only have one port to physical memory
|
|
|
|
assert (physMemPort == NULL);
|
|
|
|
|
2011-02-07 07:14:19 +01:00
|
|
|
physMemPort = new M5Port(csprintf("%s-physMemPort", name()), this,
|
|
|
|
access_phys_mem);
|
2010-03-23 02:43:53 +01:00
|
|
|
|
2010-01-30 05:29:21 +01:00
|
|
|
return physMemPort;
|
2010-03-23 02:43:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (if_name == "functional") {
|
|
|
|
// Calls for the functional port only want to access
|
|
|
|
// functional memory. Therefore, directly pass these calls
|
|
|
|
// ports to physmem.
|
2010-01-30 05:29:21 +01:00
|
|
|
assert(physmem != NULL);
|
|
|
|
return physmem->getPort(if_name, idx);
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
2010-03-23 02:43:53 +01:00
|
|
|
|
2010-01-30 05:29:17 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
2010-01-30 05:29:19 +01:00
|
|
|
|
2010-03-23 02:43:53 +01:00
|
|
|
RubyPort::PioPort::PioPort(const std::string &_name,
|
2010-01-30 05:29:19 +01:00
|
|
|
RubyPort *_port)
|
|
|
|
: SimpleTimingPort(_name, _port)
|
|
|
|
{
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "creating port to ruby sequencer to cpu %s\n", _name);
|
2010-01-30 05:29:19 +01:00
|
|
|
ruby_port = _port;
|
|
|
|
}
|
|
|
|
|
2010-03-23 02:43:53 +01:00
|
|
|
RubyPort::M5Port::M5Port(const std::string &_name,
|
2011-02-07 07:14:19 +01:00
|
|
|
RubyPort *_port, bool _access_phys_mem)
|
2010-01-30 05:29:19 +01:00
|
|
|
: SimpleTimingPort(_name, _port)
|
|
|
|
{
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "creating port from ruby sequcner to cpu %s\n", _name);
|
2010-01-30 05:29:19 +01:00
|
|
|
ruby_port = _port;
|
2011-02-07 07:14:18 +01:00
|
|
|
_onRetryList = false;
|
2011-02-07 07:14:19 +01:00
|
|
|
access_phys_mem = _access_phys_mem;
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Tick
|
|
|
|
RubyPort::PioPort::recvAtomic(PacketPtr pkt)
|
|
|
|
{
|
|
|
|
panic("RubyPort::PioPort::recvAtomic() not implemented!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Tick
|
|
|
|
RubyPort::M5Port::recvAtomic(PacketPtr pkt)
|
|
|
|
{
|
|
|
|
panic("RubyPort::M5Port::recvAtomic() not implemented!\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
RubyPort::PioPort::recvTiming(PacketPtr pkt)
|
|
|
|
{
|
2010-03-23 02:43:53 +01:00
|
|
|
// In FS mode, ruby memory will receive pio responses from devices
|
|
|
|
// and it must forward these responses back to the particular CPU.
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Pio response for address %#x\n", pkt->getAddr());
|
2010-01-30 05:29:19 +01:00
|
|
|
|
|
|
|
assert(pkt->isResponse());
|
|
|
|
|
|
|
|
// First we must retrieve the request port from the sender State
|
2010-03-23 02:43:53 +01:00
|
|
|
RubyPort::SenderState *senderState =
|
2010-01-30 05:29:19 +01:00
|
|
|
safe_cast<RubyPort::SenderState *>(pkt->senderState);
|
|
|
|
M5Port *port = senderState->port;
|
|
|
|
assert(port != NULL);
|
2010-03-23 02:43:53 +01:00
|
|
|
|
2010-01-30 05:29:19 +01:00
|
|
|
// pop the sender state from the packet
|
|
|
|
pkt->senderState = senderState->saved;
|
|
|
|
delete senderState;
|
2010-03-23 02:43:53 +01:00
|
|
|
|
2010-01-30 05:29:19 +01:00
|
|
|
port->sendTiming(pkt);
|
2010-03-23 02:43:53 +01:00
|
|
|
|
2010-01-30 05:29:19 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
RubyPort::M5Port::recvTiming(PacketPtr pkt)
|
|
|
|
{
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort,
|
2010-03-23 02:43:53 +01:00
|
|
|
"Timing access caught for address %#x\n", pkt->getAddr());
|
2010-01-30 05:29:19 +01:00
|
|
|
|
|
|
|
//dsm: based on SimpleTimingPort::recvTiming(pkt);
|
|
|
|
|
2010-03-23 02:43:53 +01:00
|
|
|
// The received packets should only be M5 requests, which should never
|
|
|
|
// get nacked. There used to be code to hanldle nacks here, but
|
|
|
|
// I'm pretty sure it didn't work correctly with the drain code,
|
2010-01-30 05:29:19 +01:00
|
|
|
// so that would need to be fixed if we ever added it back.
|
|
|
|
assert(pkt->isRequest());
|
|
|
|
|
|
|
|
if (pkt->memInhibitAsserted()) {
|
|
|
|
warn("memInhibitAsserted???");
|
|
|
|
// snooper will supply based on copy of packet
|
|
|
|
// still target's responsibility to delete packet
|
|
|
|
delete pkt;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-01-30 05:29:33 +01:00
|
|
|
// Save the port in the sender state object to be used later to
|
|
|
|
// route the response
|
|
|
|
pkt->senderState = new SenderState(this, pkt->senderState);
|
|
|
|
|
2010-01-30 05:29:19 +01:00
|
|
|
// Check for pio requests and directly send them to the dedicated
|
|
|
|
// pio port.
|
|
|
|
if (!isPhysMemAddress(pkt->getAddr())) {
|
|
|
|
assert(ruby_port->pio_port != NULL);
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort,
|
2010-01-30 05:29:33 +01:00
|
|
|
"Request for address 0x%#x is assumed to be a pio request\n",
|
|
|
|
pkt->getAddr());
|
2010-01-30 05:29:19 +01:00
|
|
|
|
|
|
|
return ruby_port->pio_port->sendTiming(pkt);
|
|
|
|
}
|
|
|
|
|
|
|
|
// For DMA and CPU requests, translate them to ruby requests before
|
|
|
|
// sending them to our assigned ruby port.
|
|
|
|
RubyRequestType type = RubyRequestType_NULL;
|
2010-01-30 05:29:23 +01:00
|
|
|
|
|
|
|
// If valid, copy the pc to the ruby request
|
2010-01-30 05:29:19 +01:00
|
|
|
Addr pc = 0;
|
2010-01-30 05:29:23 +01:00
|
|
|
if (pkt->req->hasPC()) {
|
|
|
|
pc = pkt->req->getPC();
|
|
|
|
}
|
|
|
|
|
2010-03-22 05:22:21 +01:00
|
|
|
if (pkt->isLLSC()) {
|
|
|
|
if (pkt->isWrite()) {
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Issuing SC\n");
|
2011-02-07 07:14:18 +01:00
|
|
|
type = RubyRequestType_Store_Conditional;
|
2010-01-30 05:29:19 +01:00
|
|
|
} else {
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Issuing LL\n");
|
2010-03-22 05:22:21 +01:00
|
|
|
assert(pkt->isRead());
|
2011-02-07 07:14:18 +01:00
|
|
|
type = RubyRequestType_Load_Linked;
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
2011-02-07 07:14:18 +01:00
|
|
|
} else if (pkt->req->isLocked()) {
|
|
|
|
if (pkt->isWrite()) {
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Issuing Locked RMW Write\n");
|
2011-02-07 07:14:18 +01:00
|
|
|
type = RubyRequestType_Locked_RMW_Write;
|
|
|
|
} else {
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Issuing Locked RMW Read\n");
|
2011-02-07 07:14:18 +01:00
|
|
|
assert(pkt->isRead());
|
|
|
|
type = RubyRequestType_Locked_RMW_Read;
|
|
|
|
}
|
2010-01-30 05:29:33 +01:00
|
|
|
} else {
|
2010-03-22 05:22:21 +01:00
|
|
|
if (pkt->isRead()) {
|
|
|
|
if (pkt->req->isInstFetch()) {
|
|
|
|
type = RubyRequestType_IFETCH;
|
|
|
|
} else {
|
2011-02-07 07:14:18 +01:00
|
|
|
#if THE_ISA == X86_ISA
|
|
|
|
uint32_t flags = pkt->req->getFlags();
|
|
|
|
bool storeCheck = flags &
|
|
|
|
(TheISA::StoreCheck << TheISA::FlagShift);
|
|
|
|
#else
|
|
|
|
bool storeCheck = false;
|
|
|
|
#endif // X86_ISA
|
|
|
|
if (storeCheck) {
|
|
|
|
type = RubyRequestType_RMW_Read;
|
|
|
|
} else {
|
|
|
|
type = RubyRequestType_LD;
|
|
|
|
}
|
2010-03-22 05:22:21 +01:00
|
|
|
}
|
|
|
|
} else if (pkt->isWrite()) {
|
2011-02-07 07:14:18 +01:00
|
|
|
//
|
|
|
|
// Note: M5 packets do not differentiate ST from RMW_Write
|
|
|
|
//
|
2010-03-22 05:22:21 +01:00
|
|
|
type = RubyRequestType_ST;
|
2011-03-28 17:49:45 +02:00
|
|
|
} else if (pkt->isFlush()) {
|
|
|
|
type = RubyRequestType_FLUSH;
|
2010-03-22 05:22:21 +01:00
|
|
|
} else {
|
|
|
|
panic("Unsupported ruby packet type\n");
|
|
|
|
}
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
|
|
|
|
2011-02-07 07:14:19 +01:00
|
|
|
RubyRequest ruby_request(pkt->getAddr(), pkt->getPtr<uint8_t>(true),
|
2010-03-23 02:43:53 +01:00
|
|
|
pkt->getSize(), pc, type,
|
|
|
|
RubyAccessMode_Supervisor, pkt);
|
2010-01-30 05:29:19 +01:00
|
|
|
|
2011-03-22 12:41:54 +01:00
|
|
|
assert(ruby_request.m_PhysicalAddress.getOffset() + ruby_request.m_Size <=
|
2011-02-07 07:14:18 +01:00
|
|
|
RubySystem::getBlockSizeBytes());
|
|
|
|
|
2010-01-30 05:29:19 +01:00
|
|
|
// Submit the ruby request
|
2010-01-30 05:29:33 +01:00
|
|
|
RequestStatus requestStatus = ruby_port->makeRequest(ruby_request);
|
2010-03-22 05:22:21 +01:00
|
|
|
|
2010-08-20 20:46:12 +02:00
|
|
|
// If the request successfully issued then we should return true.
|
2010-03-22 05:22:21 +01:00
|
|
|
// Otherwise, we need to delete the senderStatus we just created and return
|
|
|
|
// false.
|
2010-08-20 20:46:12 +02:00
|
|
|
if (requestStatus == RequestStatus_Issued) {
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Request %#x issued\n", pkt->getAddr());
|
2010-01-30 05:29:33 +01:00
|
|
|
return true;
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
2010-03-22 05:22:21 +01:00
|
|
|
|
2011-02-07 07:14:18 +01:00
|
|
|
//
|
|
|
|
// Unless one is using the ruby tester, record the stalled M5 port for
|
|
|
|
// later retry when the sequencer becomes free.
|
|
|
|
//
|
|
|
|
if (!ruby_port->m_usingRubyTester) {
|
|
|
|
ruby_port->addToRetryList(this);
|
|
|
|
}
|
|
|
|
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort,
|
2011-02-07 07:14:18 +01:00
|
|
|
"Request for address %#x did not issue because %s\n",
|
2010-03-23 02:43:53 +01:00
|
|
|
pkt->getAddr(), RequestStatus_to_string(requestStatus));
|
|
|
|
|
2010-01-30 05:29:33 +01:00
|
|
|
SenderState* senderState = safe_cast<SenderState*>(pkt->senderState);
|
|
|
|
pkt->senderState = senderState->saved;
|
|
|
|
delete senderState;
|
|
|
|
return false;
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2010-01-30 05:29:33 +01:00
|
|
|
RubyPort::ruby_hit_callback(PacketPtr pkt)
|
2010-01-30 05:29:19 +01:00
|
|
|
{
|
2010-01-30 05:29:33 +01:00
|
|
|
// Retrieve the request port from the sender State
|
2010-03-23 02:43:53 +01:00
|
|
|
RubyPort::SenderState *senderState =
|
2010-01-30 05:29:33 +01:00
|
|
|
safe_cast<RubyPort::SenderState *>(pkt->senderState);
|
|
|
|
M5Port *port = senderState->port;
|
|
|
|
assert(port != NULL);
|
2010-03-23 02:43:53 +01:00
|
|
|
|
2010-01-30 05:29:33 +01:00
|
|
|
// pop the sender state from the packet
|
|
|
|
pkt->senderState = senderState->saved;
|
|
|
|
delete senderState;
|
2010-01-30 05:29:19 +01:00
|
|
|
|
|
|
|
port->hitCallback(pkt);
|
2011-02-07 07:14:18 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
// If we had to stall the M5Ports, wake them up because the sequencer
|
|
|
|
// likely has free resources now.
|
|
|
|
//
|
|
|
|
if (waitingOnSequencer) {
|
2011-03-19 22:17:48 +01:00
|
|
|
//
|
|
|
|
// Record the current list of ports to retry on a temporary list before
|
|
|
|
// calling sendRetry on those ports. sendRetry will cause an
|
|
|
|
// immediate retry, which may result in the ports being put back on the
|
|
|
|
// list. Therefore we want to clear the retryList before calling
|
|
|
|
// sendRetry.
|
|
|
|
//
|
|
|
|
std::list<M5Port*> curRetryList(retryList);
|
|
|
|
|
|
|
|
retryList.clear();
|
|
|
|
waitingOnSequencer = false;
|
|
|
|
|
|
|
|
for (std::list<M5Port*>::iterator i = curRetryList.begin();
|
|
|
|
i != curRetryList.end(); ++i) {
|
|
|
|
DPRINTF(RubyPort,
|
2011-02-07 07:14:18 +01:00
|
|
|
"Sequencer may now be free. SendRetry to port %s\n",
|
|
|
|
(*i)->name());
|
2011-03-19 22:17:48 +01:00
|
|
|
(*i)->onRetryList(false);
|
|
|
|
(*i)->sendRetry();
|
2011-02-07 07:14:18 +01:00
|
|
|
}
|
|
|
|
}
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
RubyPort::M5Port::hitCallback(PacketPtr pkt)
|
|
|
|
{
|
|
|
|
bool needsResponse = pkt->needsResponse();
|
|
|
|
|
2010-08-20 20:46:12 +02:00
|
|
|
//
|
2011-02-07 07:14:19 +01:00
|
|
|
// Unless specified at configuraiton, all responses except failed SC
|
2011-03-28 17:49:45 +02:00
|
|
|
// and Flush operations access M5 physical memory.
|
2010-08-20 20:46:12 +02:00
|
|
|
//
|
2011-02-07 07:14:19 +01:00
|
|
|
bool accessPhysMem = access_phys_mem;
|
2010-08-20 20:46:12 +02:00
|
|
|
|
|
|
|
if (pkt->isLLSC()) {
|
|
|
|
if (pkt->isWrite()) {
|
|
|
|
if (pkt->req->getExtraData() != 0) {
|
|
|
|
//
|
|
|
|
// Successful SC packets convert to normal writes
|
|
|
|
//
|
|
|
|
pkt->convertScToWrite();
|
|
|
|
} else {
|
|
|
|
//
|
|
|
|
// Failed SC packets don't access physical memory and thus
|
|
|
|
// the RubyPort itself must convert it to a response.
|
|
|
|
//
|
|
|
|
accessPhysMem = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//
|
|
|
|
// All LL packets convert to normal loads so that M5 PhysMem does
|
|
|
|
// not lock the blocks.
|
|
|
|
//
|
|
|
|
pkt->convertLlToRead();
|
|
|
|
}
|
|
|
|
}
|
2011-03-28 17:49:45 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// Flush requests don't access physical memory
|
|
|
|
//
|
|
|
|
if (pkt->isFlush()) {
|
|
|
|
accessPhysMem = false;
|
|
|
|
}
|
|
|
|
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Hit callback needs response %d\n", needsResponse);
|
2010-01-30 05:29:19 +01:00
|
|
|
|
2010-08-20 20:46:12 +02:00
|
|
|
if (accessPhysMem) {
|
|
|
|
ruby_port->physMemPort->sendAtomic(pkt);
|
2011-03-28 17:49:45 +02:00
|
|
|
} else if (needsResponse) {
|
2011-02-07 07:14:19 +01:00
|
|
|
pkt->makeResponse();
|
2010-08-20 20:46:12 +02:00
|
|
|
}
|
2010-01-30 05:29:19 +01:00
|
|
|
|
|
|
|
// turn packet around to go back to requester if response expected
|
|
|
|
if (needsResponse) {
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Sending packet back over port\n");
|
2010-01-30 05:29:19 +01:00
|
|
|
sendTiming(pkt);
|
|
|
|
} else {
|
|
|
|
delete pkt;
|
|
|
|
}
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Hit callback done!\n");
|
2010-01-30 05:29:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
RubyPort::M5Port::sendTiming(PacketPtr pkt)
|
|
|
|
{
|
2010-08-20 20:46:13 +02:00
|
|
|
//minimum latency, must be > 0
|
2011-01-08 06:50:29 +01:00
|
|
|
schedSendTiming(pkt, curTick() + (1 * g_eventQueue_ptr->getClock()));
|
2010-01-30 05:29:19 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
RubyPort::PioPort::sendTiming(PacketPtr pkt)
|
|
|
|
{
|
2010-08-20 20:46:13 +02:00
|
|
|
//minimum latency, must be > 0
|
2011-01-08 06:50:29 +01:00
|
|
|
schedSendTiming(pkt, curTick() + (1 * g_eventQueue_ptr->getClock()));
|
2010-01-30 05:29:19 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
RubyPort::M5Port::isPhysMemAddress(Addr addr)
|
|
|
|
{
|
|
|
|
AddrRangeList physMemAddrList;
|
|
|
|
bool snoop = false;
|
2010-01-30 05:29:21 +01:00
|
|
|
ruby_port->physMemPort->getPeerAddressRanges(physMemAddrList, snoop);
|
2010-03-23 02:43:53 +01:00
|
|
|
for (AddrRangeIter iter = physMemAddrList.begin();
|
|
|
|
iter != physMemAddrList.end();
|
|
|
|
iter++) {
|
2010-01-30 05:29:19 +01:00
|
|
|
if (addr >= iter->start && addr <= iter->end) {
|
2011-03-19 22:17:48 +01:00
|
|
|
DPRINTF(RubyPort, "Request found in %#llx - %#llx range\n",
|
2010-01-30 05:29:19 +01:00
|
|
|
iter->start, iter->end);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2011-02-07 07:14:18 +01:00
|
|
|
|
|
|
|
unsigned
|
|
|
|
RubyPort::M5Port::deviceBlockSize() const
|
|
|
|
{
|
|
|
|
return (unsigned) RubySystem::getBlockSizeBytes();
|
|
|
|
}
|