-/** Function called by the port when the bus is receiving a Atomic
- * transaction.*/
-Tick
-Bus::recvAtomic(PacketPtr pkt)
-{
- DPRINTF(Bus, "recvAtomic: packet src %d dest %d addr 0x%x cmd %s\n",
- pkt->getSrc(), pkt->getDest(), pkt->getAddr(), pkt->cmdString());
- assert(pkt->getDest() == Packet::Broadcast);
- assert(pkt->isRequest());
-
- // Variables for recording original command and snoop response (if
- // any)... if a snooper respondes, we will need to restore
- // original command so that additional snoops can take place
- // properly
- MemCmd orig_cmd = pkt->cmd;
- MemCmd snoop_response_cmd = MemCmd::InvalidCmd;
- Tick snoop_response_latency = 0;
- int orig_src = pkt->getSrc();
-
- int target_port_id = findPort(pkt->getAddr());
- Port *target_port = (target_port_id == defaultId) ?
- defaultPort : interfaces[target_port_id];
-
- SnoopIter s_end = snoopPorts.end();
- for (SnoopIter s_iter = snoopPorts.begin(); s_iter != s_end; s_iter++) {
- BusPort *p = *s_iter;
- // same port should not have both target addresses and snooping
- assert(p != target_port);
- if (p->getId() != pkt->getSrc()) {
- Tick latency = p->sendAtomic(pkt);
- if (pkt->isResponse()) {
- // response from snoop agent
- assert(pkt->cmd != orig_cmd);
- assert(pkt->memInhibitAsserted());
- // should only happen once
- assert(snoop_response_cmd == MemCmd::InvalidCmd);
- // save response state
- snoop_response_cmd = pkt->cmd;
- snoop_response_latency = latency;
- // restore original packet state for remaining snoopers
- pkt->cmd = orig_cmd;
- pkt->setSrc(orig_src);
- pkt->setDest(Packet::Broadcast);
- }
- }
- }