bridge.cc (4918:3214e3694fb2) | bridge.cc (4965:ad0e792a5c78) |
---|---|
1 2/* 3 * Copyright (c) 2006 The Regents of The University of Michigan 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 --- 23 unchanged lines hidden (view full) --- 32 33/** 34 * @file 35 * Definition of a simple bus bridge without buffering. 36 */ 37 38#include <algorithm> 39 | 1 2/* 3 * Copyright (c) 2006 The Regents of The University of Michigan 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 --- 23 unchanged lines hidden (view full) --- 32 33/** 34 * @file 35 * Definition of a simple bus bridge without buffering. 36 */ 37 38#include <algorithm> 39 |
40#include "base/range_ops.hh" |
|
40#include "base/trace.hh" 41#include "mem/bridge.hh" 42#include "params/Bridge.hh" 43 44Bridge::BridgePort::BridgePort(const std::string &_name, 45 Bridge *_bridge, BridgePort *_otherPort, 46 int _delay, int _nack_delay, int _req_limit, | 41#include "base/trace.hh" 42#include "mem/bridge.hh" 43#include "params/Bridge.hh" 44 45Bridge::BridgePort::BridgePort(const std::string &_name, 46 Bridge *_bridge, BridgePort *_otherPort, 47 int _delay, int _nack_delay, int _req_limit, |
47 int _resp_limit, bool fix_partial_write) | 48 int _resp_limit, 49 std::vector<Range<Addr> > filter_ranges) |
48 : Port(_name), bridge(_bridge), otherPort(_otherPort), | 50 : Port(_name), bridge(_bridge), otherPort(_otherPort), |
49 delay(_delay), nackDelay(_nack_delay), fixPartialWrite(fix_partial_write), | 51 delay(_delay), nackDelay(_nack_delay), filterRanges(filter_ranges), |
50 outstandingResponses(0), queuedRequests(0), inRetry(false), 51 reqQueueLimit(_req_limit), respQueueLimit(_resp_limit), sendEvent(this) 52{ 53} 54 55Bridge::Bridge(Params *p) 56 : MemObject(p->name), 57 portA(p->name + "-portA", this, &portB, p->delay, p->nack_delay, | 52 outstandingResponses(0), queuedRequests(0), inRetry(false), 53 reqQueueLimit(_req_limit), respQueueLimit(_resp_limit), sendEvent(this) 54{ 55} 56 57Bridge::Bridge(Params *p) 58 : MemObject(p->name), 59 portA(p->name + "-portA", this, &portB, p->delay, p->nack_delay, |
58 p->req_size_a, p->resp_size_a, p->fix_partial_write_a), | 60 p->req_size_a, p->resp_size_a, p->filter_ranges_a), |
59 portB(p->name + "-portB", this, &portA, p->delay, p->nack_delay, | 61 portB(p->name + "-portB", this, &portA, p->delay, p->nack_delay, |
60 p->req_size_b, p->resp_size_b, p->fix_partial_write_b), | 62 p->req_size_b, p->resp_size_b, p->filter_ranges_b), |
61 ackWrites(p->write_ack), _params(p) 62{ 63 if (ackWrites) 64 panic("No support for acknowledging writes\n"); 65} 66 67Port * 68Bridge::getPort(const std::string &if_name, int idx) --- 169 unchanged lines hidden (view full) --- 238 assert(!sendQueue.empty()); 239 240 PacketBuffer *buf = sendQueue.front(); 241 242 assert(buf->ready <= curTick); 243 244 PacketPtr pkt = buf->pkt; 245 | 63 ackWrites(p->write_ack), _params(p) 64{ 65 if (ackWrites) 66 panic("No support for acknowledging writes\n"); 67} 68 69Port * 70Bridge::getPort(const std::string &if_name, int idx) --- 169 unchanged lines hidden (view full) --- 240 assert(!sendQueue.empty()); 241 242 PacketBuffer *buf = sendQueue.front(); 243 244 assert(buf->ready <= curTick); 245 246 PacketPtr pkt = buf->pkt; 247 |
246 // Ugly! @todo When multilevel coherence works this will be removed 247 if (pkt->cmd == MemCmd::WriteInvalidateReq && fixPartialWrite && 248 !pkt->wasNacked()) { 249 PacketPtr funcPkt = new Packet(pkt->req, MemCmd::WriteReq, 250 Packet::Broadcast); 251 funcPkt->dataStatic(pkt->getPtr<uint8_t>()); 252 sendFunctional(funcPkt); 253 pkt->cmd = MemCmd::WriteReq; 254 delete funcPkt; 255 } 256 | |
257 DPRINTF(BusBridge, "trySend: origSrc %d dest %d addr 0x%x\n", 258 buf->origSrc, pkt->getDest(), pkt->getAddr()); 259 260 bool wasReq = pkt->isRequest(); 261 bool wasNacked = pkt->wasNacked(); 262 263 if (sendTiming(pkt)) { 264 // send successful --- 43 unchanged lines hidden (view full) --- 308 sendEvent.schedule(nextReady); 309} 310 311/** Function called by the port when the bus is receiving a Atomic 312 * transaction.*/ 313Tick 314Bridge::BridgePort::recvAtomic(PacketPtr pkt) 315{ | 248 DPRINTF(BusBridge, "trySend: origSrc %d dest %d addr 0x%x\n", 249 buf->origSrc, pkt->getDest(), pkt->getAddr()); 250 251 bool wasReq = pkt->isRequest(); 252 bool wasNacked = pkt->wasNacked(); 253 254 if (sendTiming(pkt)) { 255 // send successful --- 43 unchanged lines hidden (view full) --- 299 sendEvent.schedule(nextReady); 300} 301 302/** Function called by the port when the bus is receiving a Atomic 303 * transaction.*/ 304Tick 305Bridge::BridgePort::recvAtomic(PacketPtr pkt) 306{ |
316 // fix partial atomic writes... similar to the timing code that does the 317 // same... will be removed once our code gets this right 318 if (pkt->cmd == MemCmd::WriteInvalidateReq && fixPartialWrite) { 319 320 PacketPtr funcPkt = new Packet(pkt->req, MemCmd::WriteReq, 321 Packet::Broadcast); 322 funcPkt->dataStatic(pkt->getPtr<uint8_t>()); 323 otherPort->sendFunctional(funcPkt); 324 delete funcPkt; 325 pkt->cmd = MemCmd::WriteReq; 326 } | |
327 return delay + otherPort->sendAtomic(pkt); 328} 329 330/** Function called by the port when the bus is receiving a Functional 331 * transaction.*/ 332void 333Bridge::BridgePort::recvFunctional(PacketPtr pkt) 334{ --- 15 unchanged lines hidden (view full) --- 350 otherPort->sendStatusChange(status); 351} 352 353void 354Bridge::BridgePort::getDeviceAddressRanges(AddrRangeList &resp, 355 bool &snoop) 356{ 357 otherPort->getPeerAddressRanges(resp, snoop); | 307 return delay + otherPort->sendAtomic(pkt); 308} 309 310/** Function called by the port when the bus is receiving a Functional 311 * transaction.*/ 312void 313Bridge::BridgePort::recvFunctional(PacketPtr pkt) 314{ --- 15 unchanged lines hidden (view full) --- 330 otherPort->sendStatusChange(status); 331} 332 333void 334Bridge::BridgePort::getDeviceAddressRanges(AddrRangeList &resp, 335 bool &snoop) 336{ 337 otherPort->getPeerAddressRanges(resp, snoop); |
338 FilterRangeList(filterRanges, resp); |
|
358 // we don't allow snooping across bridges 359 snoop = false; 360} 361 362Bridge * 363BridgeParams::create() 364{ 365 return new Bridge(this); 366} | 339 // we don't allow snooping across bridges 340 snoop = false; 341} 342 343Bridge * 344BridgeParams::create() 345{ 346 return new Bridge(this); 347} |