io_device.cc revision 8832
1545SN/A/*
22512SN/A * Copyright (c) 2006 The Regents of The University of Michigan
3545SN/A * All rights reserved.
4545SN/A *
5545SN/A * Redistribution and use in source and binary forms, with or without
6545SN/A * modification, are permitted provided that the following conditions are
7545SN/A * met: redistributions of source code must retain the above copyright
8545SN/A * notice, this list of conditions and the following disclaimer;
9545SN/A * redistributions in binary form must reproduce the above copyright
10545SN/A * notice, this list of conditions and the following disclaimer in the
11545SN/A * documentation and/or other materials provided with the distribution;
12545SN/A * neither the name of the copyright holders nor the names of its
13545SN/A * contributors may be used to endorse or promote products derived from
14545SN/A * this software without specific prior written permission.
15545SN/A *
16545SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17545SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18545SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19545SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20545SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21545SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22545SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23545SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24545SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25545SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26545SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Ali Saidi
292665Ssaidi@eecs.umich.edu *          Nathan Binkert
30545SN/A */
31545SN/A
323090Sstever@eecs.umich.edu#include "base/chunk_generator.hh"
332657Ssaidi@eecs.umich.edu#include "base/trace.hh"
348232Snate@binkert.org#include "debug/BusAddrRanges.hh"
358232Snate@binkert.org#include "debug/DMA.hh"
36545SN/A#include "dev/io_device.hh"
372901Ssaidi@eecs.umich.edu#include "sim/system.hh"
38545SN/A
392901Ssaidi@eecs.umich.eduPioPort::PioPort(PioDevice *dev, System *s, std::string pname)
403401Sktlim@umich.edu    : SimpleTimingPort(dev->name() + pname, dev), device(dev)
412489SN/A{ }
422489SN/A
432489SN/A
442489SN/ATick
453349Sbinkertn@umich.eduPioPort::recvAtomic(PacketPtr pkt)
462489SN/A{
473091Sstever@eecs.umich.edu    return pkt->isRead() ? device->read(pkt) : device->write(pkt);
482489SN/A}
492489SN/A
508711Sandreas.hansson@arm.comAddrRangeList
518711Sandreas.hansson@arm.comPioPort::getAddrRanges()
522489SN/A{
538711Sandreas.hansson@arm.com    return device->getAddrRanges();
542489SN/A}
552489SN/A
562489SN/A
574762Snate@binkert.orgPioDevice::PioDevice(const Params *p)
588742Sgblack@eecs.umich.edu    : MemObject(p), sys(p->system), pioPort(NULL)
594762Snate@binkert.org{}
604762Snate@binkert.org
61545SN/APioDevice::~PioDevice()
62545SN/A{
632384SN/A    if (pioPort)
642489SN/A        delete pioPort;
65545SN/A}
66545SN/A
672542SN/Avoid
682541SN/APioDevice::init()
692541SN/A{
702541SN/A    if (!pioPort)
718674Snilay@cs.wisc.edu        panic("Pio port of %s not connected to anything!", name());
728711Sandreas.hansson@arm.com    pioPort->sendRangeChange();
732541SN/A}
742541SN/A
758598Ssteve.reinhardt@amd.comPort *
768598Ssteve.reinhardt@amd.comPioDevice::getPort(const std::string &if_name, int idx)
778598Ssteve.reinhardt@amd.com{
788598Ssteve.reinhardt@amd.com    if (if_name == "pio") {
798598Ssteve.reinhardt@amd.com        if (pioPort != NULL)
808598Ssteve.reinhardt@amd.com            fatal("%s: pio port already connected to %s",
818598Ssteve.reinhardt@amd.com                  name(), pioPort->getPeer()->name());
828598Ssteve.reinhardt@amd.com        pioPort = new PioPort(this, sys);
838598Ssteve.reinhardt@amd.com        return pioPort;
848598Ssteve.reinhardt@amd.com    }
858598Ssteve.reinhardt@amd.com    return NULL;
868598Ssteve.reinhardt@amd.com}
872901Ssaidi@eecs.umich.edu
882901Ssaidi@eecs.umich.eduunsigned int
892901Ssaidi@eecs.umich.eduPioDevice::drain(Event *de)
902901Ssaidi@eecs.umich.edu{
912901Ssaidi@eecs.umich.edu    unsigned int count;
922901Ssaidi@eecs.umich.edu    count = pioPort->drain(de);
932901Ssaidi@eecs.umich.edu    if (count)
942901Ssaidi@eecs.umich.edu        changeState(Draining);
952901Ssaidi@eecs.umich.edu    else
962901Ssaidi@eecs.umich.edu        changeState(Drained);
972901Ssaidi@eecs.umich.edu    return count;
982901Ssaidi@eecs.umich.edu}
992901Ssaidi@eecs.umich.edu
1004762Snate@binkert.orgBasicPioDevice::BasicPioDevice(const Params *p)
1014762Snate@binkert.org    : PioDevice(p), pioAddr(p->pio_addr), pioSize(0),
1024762Snate@binkert.org      pioDelay(p->pio_latency)
1034762Snate@binkert.org{}
1044762Snate@binkert.org
1058711Sandreas.hansson@arm.comAddrRangeList
1068711Sandreas.hansson@arm.comBasicPioDevice::getAddrRanges()
1072539SN/A{
1082539SN/A    assert(pioSize != 0);
1098711Sandreas.hansson@arm.com    AddrRangeList ranges;
1107729SAli.Saidi@ARM.com    DPRINTF(BusAddrRanges, "registering range: %#x-%#x\n", pioAddr, pioSize);
1118711Sandreas.hansson@arm.com    ranges.push_back(RangeSize(pioAddr, pioSize));
1128711Sandreas.hansson@arm.com    return ranges;
1132539SN/A}
1142539SN/A
1152489SN/A
1168630SMitchell.Hayenga@ARM.comDmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
1178630SMitchell.Hayenga@ARM.com                 bool recv_snoops)
1183401Sktlim@umich.edu    : Port(dev->name() + "-dmaport", dev), device(dev), sys(s),
1198832SAli.Saidi@ARM.com      masterId(s->getMasterId(dev->name())),
1204435Ssaidi@eecs.umich.edu      pendingCount(0), actionInProgress(0), drainEvent(NULL),
1217403SAli.Saidi@ARM.com      backoffTime(0), minBackoffDelay(min_backoff),
1228630SMitchell.Hayenga@ARM.com      maxBackoffDelay(max_backoff), inRetry(false), recvSnoops(recv_snoops),
1238711Sandreas.hansson@arm.com      backoffEvent(this)
1242489SN/A{ }
1252489SN/A
1262489SN/Abool
1273349Sbinkertn@umich.eduDmaPort::recvTiming(PacketPtr pkt)
1282384SN/A{
1294870Sstever@eecs.umich.edu    if (pkt->wasNacked()) {
1304739Sstever@eecs.umich.edu        DPRINTF(DMA, "Received nacked %s addr %#x\n",
1314739Sstever@eecs.umich.edu                pkt->cmdString(), pkt->getAddr());
1324435Ssaidi@eecs.umich.edu
1337403SAli.Saidi@ARM.com        if (backoffTime < minBackoffDelay)
1347403SAli.Saidi@ARM.com            backoffTime = minBackoffDelay;
1357403SAli.Saidi@ARM.com        else if (backoffTime < maxBackoffDelay)
1364435Ssaidi@eecs.umich.edu            backoffTime <<= 1;
1374435Ssaidi@eecs.umich.edu
1388708Sandreas.hansson@arm.com        device->reschedule(backoffEvent, curTick() + backoffTime, true);
1394435Ssaidi@eecs.umich.edu
1404435Ssaidi@eecs.umich.edu        DPRINTF(DMA, "Backoff time set to %d ticks\n", backoffTime);
1414435Ssaidi@eecs.umich.edu
1422685Ssaidi@eecs.umich.edu        pkt->reinitNacked();
1434435Ssaidi@eecs.umich.edu        queueDma(pkt, true);
1448642Ssaidi@eecs.umich.edu    } else if (pkt->isRequest() && recvSnoops) {
1458642Ssaidi@eecs.umich.edu        return true;
1462685Ssaidi@eecs.umich.edu    } else if (pkt->senderState) {
1472565SN/A        DmaReqState *state;
1484435Ssaidi@eecs.umich.edu        backoffTime >>= 2;
1494435Ssaidi@eecs.umich.edu
1504739Sstever@eecs.umich.edu        DPRINTF(DMA, "Received response %s addr %#x size %#x\n",
1514739Sstever@eecs.umich.edu                pkt->cmdString(), pkt->getAddr(), pkt->req->getSize());
1522641Sstever@eecs.umich.edu        state = dynamic_cast<DmaReqState*>(pkt->senderState);
1532685Ssaidi@eecs.umich.edu        pendingCount--;
1542685Ssaidi@eecs.umich.edu
1552685Ssaidi@eecs.umich.edu        assert(pendingCount >= 0);
1562657Ssaidi@eecs.umich.edu        assert(state);
1572685Ssaidi@eecs.umich.edu
1588134SAli.Saidi@ARM.com        // We shouldn't ever get a block in ownership state
1598134SAli.Saidi@ARM.com        assert(!(pkt->memInhibitAsserted() && !pkt->sharedAsserted()));
1608134SAli.Saidi@ARM.com
1612685Ssaidi@eecs.umich.edu        state->numBytes += pkt->req->getSize();
1624435Ssaidi@eecs.umich.edu        assert(state->totBytes >= state->numBytes);
1632685Ssaidi@eecs.umich.edu        if (state->totBytes == state->numBytes) {
1647403SAli.Saidi@ARM.com            if (state->completionEvent) {
1657403SAli.Saidi@ARM.com                if (state->delay)
1668708Sandreas.hansson@arm.com                    device->schedule(state->completionEvent,
1678708Sandreas.hansson@arm.com                                     curTick() + state->delay);
1687403SAli.Saidi@ARM.com                else
1697403SAli.Saidi@ARM.com                    state->completionEvent->process();
1707403SAli.Saidi@ARM.com            }
1712685Ssaidi@eecs.umich.edu            delete state;
1722685Ssaidi@eecs.umich.edu        }
1732630SN/A        delete pkt->req;
1742630SN/A        delete pkt;
1752901Ssaidi@eecs.umich.edu
1762901Ssaidi@eecs.umich.edu        if (pendingCount == 0 && drainEvent) {
1772901Ssaidi@eecs.umich.edu            drainEvent->process();
1782901Ssaidi@eecs.umich.edu            drainEvent = NULL;
1792901Ssaidi@eecs.umich.edu        }
1802569SN/A    }  else {
1812685Ssaidi@eecs.umich.edu        panic("Got packet without sender state... huh?\n");
1822565SN/A    }
1832569SN/A
1842657Ssaidi@eecs.umich.edu    return true;
1852384SN/A}
186679SN/A
1874762Snate@binkert.orgDmaDevice::DmaDevice(const Params *p)
1887403SAli.Saidi@ARM.com    : PioDevice(p), dmaPort(NULL)
1892565SN/A{ }
1902384SN/A
1912901Ssaidi@eecs.umich.eduunsigned int
1922901Ssaidi@eecs.umich.eduDmaDevice::drain(Event *de)
1932901Ssaidi@eecs.umich.edu{
1942901Ssaidi@eecs.umich.edu    unsigned int count;
1952901Ssaidi@eecs.umich.edu    count = pioPort->drain(de) + dmaPort->drain(de);
1962901Ssaidi@eecs.umich.edu    if (count)
1972901Ssaidi@eecs.umich.edu        changeState(Draining);
1982901Ssaidi@eecs.umich.edu    else
1992901Ssaidi@eecs.umich.edu        changeState(Drained);
2002901Ssaidi@eecs.umich.edu    return count;
2012901Ssaidi@eecs.umich.edu}
2022901Ssaidi@eecs.umich.edu
2032901Ssaidi@eecs.umich.eduunsigned int
2042901Ssaidi@eecs.umich.eduDmaPort::drain(Event *de)
2052901Ssaidi@eecs.umich.edu{
2062901Ssaidi@eecs.umich.edu    if (pendingCount == 0)
2072901Ssaidi@eecs.umich.edu        return 0;
2082901Ssaidi@eecs.umich.edu    drainEvent = de;
2092901Ssaidi@eecs.umich.edu    return 1;
2102901Ssaidi@eecs.umich.edu}
2112901Ssaidi@eecs.umich.edu
2122901Ssaidi@eecs.umich.edu
2132384SN/Avoid
2142489SN/ADmaPort::recvRetry()
2152489SN/A{
2164435Ssaidi@eecs.umich.edu    assert(transmitList.size());
2172659Ssaidi@eecs.umich.edu    bool result = true;
2184435Ssaidi@eecs.umich.edu    do {
2195539Scws3k@cs.virginia.edu        PacketPtr pkt = transmitList.front();
2204739Sstever@eecs.umich.edu        DPRINTF(DMA, "Retry on %s addr %#x\n",
2214739Sstever@eecs.umich.edu                pkt->cmdString(), pkt->getAddr());
2222659Ssaidi@eecs.umich.edu        result = sendTiming(pkt);
2232659Ssaidi@eecs.umich.edu        if (result) {
2242659Ssaidi@eecs.umich.edu            DPRINTF(DMA, "-- Done\n");
2252659Ssaidi@eecs.umich.edu            transmitList.pop_front();
2264435Ssaidi@eecs.umich.edu            inRetry = false;
2272659Ssaidi@eecs.umich.edu        } else {
2284435Ssaidi@eecs.umich.edu            inRetry = true;
2292659Ssaidi@eecs.umich.edu            DPRINTF(DMA, "-- Failed, queued\n");
2302659Ssaidi@eecs.umich.edu        }
2314435Ssaidi@eecs.umich.edu    } while (!backoffTime &&  result && transmitList.size());
2324435Ssaidi@eecs.umich.edu
2334435Ssaidi@eecs.umich.edu    if (transmitList.size() && backoffTime && !inRetry) {
2347823Ssteve.reinhardt@amd.com        DPRINTF(DMA, "Scheduling backoff for %d\n", curTick()+backoffTime);
2354435Ssaidi@eecs.umich.edu        if (!backoffEvent.scheduled())
2368708Sandreas.hansson@arm.com            device->schedule(backoffEvent, backoffTime + curTick());
2372657Ssaidi@eecs.umich.edu    }
2384435Ssaidi@eecs.umich.edu    DPRINTF(DMA, "TransmitList: %d, backoffTime: %d inRetry: %d es: %d\n",
2394435Ssaidi@eecs.umich.edu            transmitList.size(), backoffTime, inRetry,
2404435Ssaidi@eecs.umich.edu            backoffEvent.scheduled());
2412489SN/A}
2422641Sstever@eecs.umich.edu
2432641Sstever@eecs.umich.edu
2442489SN/Avoid
2452641Sstever@eecs.umich.eduDmaPort::dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
2467607SGene.Wu@arm.com                   uint8_t *data, Tick delay, Request::Flags flag)
2472384SN/A{
2482901Ssaidi@eecs.umich.edu    assert(device->getState() == SimObject::Running);
2492901Ssaidi@eecs.umich.edu
2505534Ssaidi@eecs.umich.edu    DmaReqState *reqState = new DmaReqState(event, this, size, delay);
2512384SN/A
2524451Ssaidi@eecs.umich.edu
2534451Ssaidi@eecs.umich.edu    DPRINTF(DMA, "Starting DMA for addr: %#x size: %d sched: %d\n", addr, size,
2547607SGene.Wu@arm.com            event ? event->scheduled() : -1 );
2552406SN/A    for (ChunkGenerator gen(addr, size, peerBlockSize());
2562406SN/A         !gen.done(); gen.next()) {
2578832SAli.Saidi@ARM.com            Request *req = new Request(gen.addr(), gen.size(), flag, masterId);
2583349Sbinkertn@umich.edu            PacketPtr pkt = new Packet(req, cmd, Packet::Broadcast);
2592641Sstever@eecs.umich.edu
2602384SN/A            // Increment the data pointer on a write
2612566SN/A            if (data)
2622685Ssaidi@eecs.umich.edu                pkt->dataStatic(data + gen.complete());
2632641Sstever@eecs.umich.edu
2642685Ssaidi@eecs.umich.edu            pkt->senderState = reqState;
2652641Sstever@eecs.umich.edu
2662565SN/A            assert(pendingCount >= 0);
2672565SN/A            pendingCount++;
2684451Ssaidi@eecs.umich.edu            DPRINTF(DMA, "--Queuing DMA for addr: %#x size: %d\n", gen.addr(),
2694451Ssaidi@eecs.umich.edu                    gen.size());
2704435Ssaidi@eecs.umich.edu            queueDma(pkt);
2712384SN/A    }
2722901Ssaidi@eecs.umich.edu
2732384SN/A}
2742384SN/A
2754435Ssaidi@eecs.umich.eduvoid
2764435Ssaidi@eecs.umich.eduDmaPort::queueDma(PacketPtr pkt, bool front)
2774435Ssaidi@eecs.umich.edu{
2784435Ssaidi@eecs.umich.edu
2794435Ssaidi@eecs.umich.edu    if (front)
2804435Ssaidi@eecs.umich.edu        transmitList.push_front(pkt);
2814435Ssaidi@eecs.umich.edu    else
2824435Ssaidi@eecs.umich.edu        transmitList.push_back(pkt);
2834435Ssaidi@eecs.umich.edu    sendDma();
2844435Ssaidi@eecs.umich.edu}
2854435Ssaidi@eecs.umich.edu
2862384SN/A
2872384SN/Avoid
2884435Ssaidi@eecs.umich.eduDmaPort::sendDma()
2892384SN/A{
2902901Ssaidi@eecs.umich.edu    // some kind of selction between access methods
2912901Ssaidi@eecs.umich.edu    // more work is going to have to be done to make
2922901Ssaidi@eecs.umich.edu    // switching actually work
2934435Ssaidi@eecs.umich.edu    assert(transmitList.size());
2944435Ssaidi@eecs.umich.edu    PacketPtr pkt = transmitList.front();
2952902Ssaidi@eecs.umich.edu
2964762Snate@binkert.org    Enums::MemoryMode state = sys->getMemoryMode();
2974762Snate@binkert.org    if (state == Enums::timing) {
2984435Ssaidi@eecs.umich.edu        if (backoffEvent.scheduled() || inRetry) {
2994435Ssaidi@eecs.umich.edu            DPRINTF(DMA, "Can't send immediately, waiting for retry or backoff timer\n");
3004435Ssaidi@eecs.umich.edu            return;
3014435Ssaidi@eecs.umich.edu        }
3024435Ssaidi@eecs.umich.edu
3034739Sstever@eecs.umich.edu        DPRINTF(DMA, "Attempting to send %s addr %#x\n",
3044739Sstever@eecs.umich.edu                pkt->cmdString(), pkt->getAddr());
3054435Ssaidi@eecs.umich.edu
3064435Ssaidi@eecs.umich.edu        bool result;
3074435Ssaidi@eecs.umich.edu        do {
3084435Ssaidi@eecs.umich.edu            result = sendTiming(pkt);
3094435Ssaidi@eecs.umich.edu            if (result) {
3104435Ssaidi@eecs.umich.edu                transmitList.pop_front();
3114435Ssaidi@eecs.umich.edu                DPRINTF(DMA, "-- Done\n");
3124435Ssaidi@eecs.umich.edu            } else {
3134435Ssaidi@eecs.umich.edu                inRetry = true;
3144435Ssaidi@eecs.umich.edu                DPRINTF(DMA, "-- Failed: queued\n");
3154435Ssaidi@eecs.umich.edu            }
3164435Ssaidi@eecs.umich.edu        } while (result && !backoffTime && transmitList.size());
3174435Ssaidi@eecs.umich.edu
3184435Ssaidi@eecs.umich.edu        if (transmitList.size() && backoffTime && !inRetry &&
3194435Ssaidi@eecs.umich.edu                !backoffEvent.scheduled()) {
3204451Ssaidi@eecs.umich.edu            DPRINTF(DMA, "-- Scheduling backoff timer for %d\n",
3217823Ssteve.reinhardt@amd.com                    backoffTime+curTick());
3228708Sandreas.hansson@arm.com            device->schedule(backoffEvent, backoffTime + curTick());
3232901Ssaidi@eecs.umich.edu        }
3244762Snate@binkert.org    } else if (state == Enums::atomic) {
3254435Ssaidi@eecs.umich.edu        transmitList.pop_front();
3264435Ssaidi@eecs.umich.edu
3272902Ssaidi@eecs.umich.edu        Tick lat;
3284451Ssaidi@eecs.umich.edu        DPRINTF(DMA, "--Sending  DMA for addr: %#x size: %d\n",
3294451Ssaidi@eecs.umich.edu                pkt->req->getPaddr(), pkt->req->getSize());
3302902Ssaidi@eecs.umich.edu        lat = sendAtomic(pkt);
3312901Ssaidi@eecs.umich.edu        assert(pkt->senderState);
3322901Ssaidi@eecs.umich.edu        DmaReqState *state = dynamic_cast<DmaReqState*>(pkt->senderState);
3332901Ssaidi@eecs.umich.edu        assert(state);
3344451Ssaidi@eecs.umich.edu        state->numBytes += pkt->req->getSize();
3352384SN/A
3364451Ssaidi@eecs.umich.edu        DPRINTF(DMA, "--Received response for  DMA for addr: %#x size: %d nb: %d, tot: %d sched %d\n",
3374451Ssaidi@eecs.umich.edu                pkt->req->getPaddr(), pkt->req->getSize(), state->numBytes,
3387403SAli.Saidi@ARM.com                state->totBytes,
3397403SAli.Saidi@ARM.com                state->completionEvent ? state->completionEvent->scheduled() : 0 );
3404451Ssaidi@eecs.umich.edu
3412901Ssaidi@eecs.umich.edu        if (state->totBytes == state->numBytes) {
3427403SAli.Saidi@ARM.com            if (state->completionEvent) {
3437403SAli.Saidi@ARM.com                assert(!state->completionEvent->scheduled());
3448708Sandreas.hansson@arm.com                device->schedule(state->completionEvent,
3458708Sandreas.hansson@arm.com                                 curTick() + lat + state->delay);
3467403SAli.Saidi@ARM.com            }
3472901Ssaidi@eecs.umich.edu            delete state;
3482901Ssaidi@eecs.umich.edu            delete pkt->req;
3492901Ssaidi@eecs.umich.edu        }
3502901Ssaidi@eecs.umich.edu        pendingCount--;
3512901Ssaidi@eecs.umich.edu        assert(pendingCount >= 0);
3522901Ssaidi@eecs.umich.edu        delete pkt;
3532566SN/A
3542901Ssaidi@eecs.umich.edu        if (pendingCount == 0 && drainEvent) {
3552901Ssaidi@eecs.umich.edu            drainEvent->process();
3562901Ssaidi@eecs.umich.edu            drainEvent = NULL;
3572901Ssaidi@eecs.umich.edu        }
3582901Ssaidi@eecs.umich.edu
3592384SN/A   } else
3602384SN/A       panic("Unknown memory command state.");
3612384SN/A}
362545SN/A
363545SN/ADmaDevice::~DmaDevice()
364545SN/A{
3652489SN/A    if (dmaPort)
3662489SN/A        delete dmaPort;
367545SN/A}
3688598Ssteve.reinhardt@amd.com
3698598Ssteve.reinhardt@amd.com
3708598Ssteve.reinhardt@amd.comPort *
3718598Ssteve.reinhardt@amd.comDmaDevice::getPort(const std::string &if_name, int idx)
3728598Ssteve.reinhardt@amd.com{
3738598Ssteve.reinhardt@amd.com    if (if_name == "dma") {
3748598Ssteve.reinhardt@amd.com        if (dmaPort != NULL)
3758598Ssteve.reinhardt@amd.com            fatal("%s: dma port already connected to %s",
3768598Ssteve.reinhardt@amd.com                  name(), dmaPort->getPeer()->name());
3778598Ssteve.reinhardt@amd.com        dmaPort = new DmaPort(this, sys, params()->min_backoff_delay,
3788598Ssteve.reinhardt@amd.com                              params()->max_backoff_delay);
3798598Ssteve.reinhardt@amd.com        return dmaPort;
3808598Ssteve.reinhardt@amd.com    }
3818598Ssteve.reinhardt@amd.com    return PioDevice::getPort(if_name, idx);
3828598Ssteve.reinhardt@amd.com}
3838598Ssteve.reinhardt@amd.com
384