Port *new_dtb_port = newTC->getDTBPtr()->getTableWalkerPort();
// Move over any table walker ports if they exist
- if (new_itb_port) {
- assert(!new_itb_port->isConnected());
- assert(old_itb_port);
- assert(old_itb_port->isConnected());
- auto &slavePort =
- dynamic_cast<BaseMasterPort *>(old_itb_port)->getSlavePort();
- old_itb_port->unbind();
- new_itb_port->bind(slavePort);
- }
- if (new_dtb_port) {
- assert(!new_dtb_port->isConnected());
- assert(old_dtb_port);
- assert(old_dtb_port->isConnected());
- auto &slavePort =
- dynamic_cast<BaseMasterPort *>(old_dtb_port)->getSlavePort();
- old_dtb_port->unbind();
- new_dtb_port->bind(slavePort);
- }
+ if (new_itb_port)
+ new_itb_port->takeOverFrom(old_itb_port);
+ if (new_dtb_port)
+ new_dtb_port->takeOverFrom(old_dtb_port);
newTC->getITBPtr()->takeOverFrom(oldTC->getITBPtr());
newTC->getDTBPtr()->takeOverFrom(oldTC->getDTBPtr());
newChecker->getDTBPtr()->takeOverFrom(oldChecker->getDTBPtr());
// Move over any table walker ports if they exist for checker
- if (new_checker_itb_port) {
- assert(!new_checker_itb_port->isConnected());
- assert(old_checker_itb_port);
- assert(old_checker_itb_port->isConnected());
- auto &slavePort =
- dynamic_cast<BaseMasterPort *>(old_checker_itb_port)->
- getSlavePort();
- old_checker_itb_port->unbind();
- new_checker_itb_port->bind(slavePort);
- }
- if (new_checker_dtb_port) {
- assert(!new_checker_dtb_port->isConnected());
- assert(old_checker_dtb_port);
- assert(old_checker_dtb_port->isConnected());
- auto &slavePort =
- dynamic_cast<BaseMasterPort *>(old_checker_dtb_port)->
- getSlavePort();
- old_checker_dtb_port->unbind();
- new_checker_dtb_port->bind(slavePort);
- }
+ if (new_checker_itb_port)
+ new_checker_itb_port->takeOverFrom(old_checker_itb_port);
+ if (new_checker_dtb_port)
+ new_checker_dtb_port->takeOverFrom(old_checker_dtb_port);
}
}
// ports are dangling while the old CPU has its ports connected
// already. Unbind the old CPU and then bind the ports of the one
// we are switching to.
- assert(!getInstPort().isConnected());
- assert(oldCPU->getInstPort().isConnected());
- auto &inst_peer_port =
- dynamic_cast<BaseMasterPort &>(oldCPU->getInstPort()).getSlavePort();
- oldCPU->getInstPort().unbind();
- getInstPort().bind(inst_peer_port);
-
- assert(!getDataPort().isConnected());
- assert(oldCPU->getDataPort().isConnected());
- auto &data_peer_port =
- dynamic_cast<BaseMasterPort &>(oldCPU->getDataPort()).getSlavePort();
- oldCPU->getDataPort().unbind();
- getDataPort().bind(data_peer_port);
+ getInstPort().takeOverFrom(&oldCPU->getInstPort());
+ getDataPort().takeOverFrom(&oldCPU->getDataPort());
}
void
TraceCPU::takeOverFrom(BaseCPU *oldCPU)
{
// Unbind the ports of the old CPU and bind the ports of the TraceCPU.
- assert(!getInstPort().isConnected());
- assert(oldCPU->getInstPort().isConnected());
- Port &inst_peer_port = oldCPU->getInstPort().getSlavePort();
- oldCPU->getInstPort().unbind();
- getInstPort().bind(inst_peer_port);
-
- assert(!getDataPort().isConnected());
- assert(oldCPU->getDataPort().isConnected());
- Port &data_peer_port = oldCPU->getDataPort().getSlavePort();
- oldCPU->getDataPort().unbind();
- getDataPort().bind(data_peer_port);
+ getInstPort().takeOverFrom(&oldCPU->getInstPort());
+ getDataPort().takeOverFrom(&oldCPU->getDataPort());
}
void
SMMUv3SlaveInterface::sendRange()
{
if (slavePort->isConnected()) {
- inform("Slave port is connected to %d\n",
- slavePort->getMasterPort().name());
+ inform("Slave port is connected to %s\n", slavePort->getPeer());
slavePort->sendRangeChange();
} else {
SMMUv3SlaveInterface::recvAtomic(PacketPtr pkt)
{
DPRINTF(SMMUv3, "[a] req from %s addr=%#x size=%#x\n",
- slavePort->getMasterPort().name(),
- pkt->getAddr(), pkt->getSize());
+ slavePort->getPeer(), pkt->getAddr(), pkt->getSize());
std::string proc_name = csprintf("%s.port", name());
SMMUTranslationProcess proc(proc_name, *smmu, *this);
SMMUv3SlaveInterface::recvTimingReq(PacketPtr pkt)
{
DPRINTF(SMMUv3, "[t] req from %s addr=%#x size=%#x\n",
- slavePort->getMasterPort().name(),
- pkt->getAddr(), pkt->getSize());
+ slavePort->getPeer(), pkt->getAddr(), pkt->getSize());
// @todo: We need to pay for this and not just zero it out
pkt->headerDelay = pkt->payloadDelay = 0;
for (const auto& p: slavePorts) {
// check if the connected master port is snooping
if (p->isSnooping()) {
- DPRINTF(AddrRanges, "Adding snooping master %s\n",
- p->getMasterPort().name());
+ DPRINTF(AddrRanges, "Adding snooping master %s\n", p->getPeer());
snoopPorts.push_back(p);
}
}
return recvMessage(pkt);
} else {
panic("%s received unexpected atomic command %s from %s.\n",
- name(), pkt->cmd.toString(), getMasterPort().name());
+ name(), pkt->cmd.toString(), getPeer());
}
}
BaseXBar::recvRangeChange(PortID master_port_id)
{
DPRINTF(AddrRanges, "Received range change from slave port %s\n",
- masterPorts[master_port_id]->getSlavePort().name());
+ masterPorts[master_port_id]->getPeer());
// remember that we got a range from this master port and thus the
// connected slave module
"%s:\n\t%s\n\t%s\n",
name(),
r.to_string(),
- masterPorts[master_port_id]->getSlavePort().name(),
- masterPorts[conflict_id]->getSlavePort().name());
+ masterPorts[master_port_id]->getPeer(),
+ masterPorts[conflict_id]->getPeer());
}
}
}
// and snoop responses) and what came from the slave and was
// forwarded to the master (responses and snoop requests)
for (int i = 0; i < slavePorts.size(); i++) {
- pktCount.subname(i, slavePorts[i]->getMasterPort().name());
- pktSize.subname(i, slavePorts[i]->getMasterPort().name());
+ pktCount.subname(i, slavePorts[i]->getPeer().name());
+ pktSize.subname(i, slavePorts[i]->getPeer().name());
for (int j = 0; j < masterPorts.size(); j++) {
- pktCount.ysubname(j, masterPorts[j]->getSlavePort().name());
- pktSize.ysubname(j, masterPorts[j]->getSlavePort().name());
+ pktCount.ysubname(j, masterPorts[j]->getPeer().name());
+ pktSize.ysubname(j, masterPorts[j]->getPeer().name());
}
}
}