port.cc revision 2405
12405SN/A/* 212342Snikos.nikoleris@arm.com * Copyright (c) 2002-2005 The Regents of The University of Michigan 38922Swilliam.wang@arm.com * All rights reserved. 48922Swilliam.wang@arm.com * 58922Swilliam.wang@arm.com * Redistribution and use in source and binary forms, with or without 68922Swilliam.wang@arm.com * modification, are permitted provided that the following conditions are 78922Swilliam.wang@arm.com * met: redistributions of source code must retain the above copyright 88922Swilliam.wang@arm.com * notice, this list of conditions and the following disclaimer; 98922Swilliam.wang@arm.com * redistributions in binary form must reproduce the above copyright 108922Swilliam.wang@arm.com * notice, this list of conditions and the following disclaimer in the 118922Swilliam.wang@arm.com * documentation and/or other materials provided with the distribution; 128922Swilliam.wang@arm.com * neither the name of the copyright holders nor the names of its 138922Swilliam.wang@arm.com * contributors may be used to endorse or promote products derived from 142405SN/A * this software without specific prior written permission. 152405SN/A * 162405SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172405SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182405SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192405SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202405SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212405SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222405SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232405SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242405SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252405SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262405SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272405SN/A */ 282405SN/A 292405SN/A/** 302405SN/A * @file Port object definitions. 312405SN/A */ 322405SN/A 332405SN/A#include "base/chunk_generator.hh" 342405SN/A#include "mem/port.hh" 352405SN/A 362405SN/Avoid 372405SN/APort::blobHelper(Addr addr, uint8_t *p, int size, Command cmd) 382405SN/A{ 392665Ssaidi@eecs.umich.edu Request rqst; 402665Ssaidi@eecs.umich.edu Packet pkt; 418922Swilliam.wang@arm.com pkt.req = &rqst; 428922Swilliam.wang@arm.com pkt.cmd = cmd; 432405SN/A 442405SN/A for (ChunkGenerator gen(addr, size, sendBlockSizeQuery()); !gen.done(); gen.next()) 452405SN/A { 462982Sstever@eecs.umich.edu pkt.addr = rqst.paddr = gen.addr(); 472982Sstever@eecs.umich.edu pkt.size = rqst.size = gen.size(); 482405SN/A pkt.data = p; 4911793Sbrandon.potter@amd.com sendFunctional(pkt); 5011793Sbrandon.potter@amd.com p += gen.size(); 512642Sstever@eecs.umich.edu } 5213892Sgabeblack@google.com} 532405SN/A 5413769Sgabeblack@google.comvoid 5513769Sgabeblack@google.comPort::writeBlobFunctional(Addr addr, uint8_t *p, int size) 569294Sandreas.hansson@arm.com{ 579294Sandreas.hansson@arm.com blobHelper(addr, p, size, Write); 589294Sandreas.hansson@arm.com} 599294Sandreas.hansson@arm.com 609294Sandreas.hansson@arm.comvoid 619294Sandreas.hansson@arm.comPort::readBlobFunctional(Addr addr, uint8_t *p, int size) 629294Sandreas.hansson@arm.com{ 639294Sandreas.hansson@arm.com blobHelper(addr, p, size, Read); 649294Sandreas.hansson@arm.com} 659294Sandreas.hansson@arm.com 6611321Ssteve.reinhardt@amd.com