port_proxy.cc revision 8861:56d011130987
110448Snilay@cs.wisc.edu/* 210448Snilay@cs.wisc.edu * Copyright (c) 2012 ARM Limited 310448Snilay@cs.wisc.edu * All rights reserved 410448Snilay@cs.wisc.edu * 510448Snilay@cs.wisc.edu * The license below extends only to copyright in the software and shall 610448Snilay@cs.wisc.edu * not be construed as granting a license to any other intellectual 710448Snilay@cs.wisc.edu * property including but not limited to intellectual property relating 810448Snilay@cs.wisc.edu * to a hardware implementation of the functionality of the software 910448Snilay@cs.wisc.edu * licensed hereunder. You may use the software subject to the license 1010448Snilay@cs.wisc.edu * terms below provided that you ensure that this notice is replicated 1110448Snilay@cs.wisc.edu * unmodified and in its entirety in all distributions of the software, 1210448Snilay@cs.wisc.edu * modified or unmodified, in source code or in binary form. 1310448Snilay@cs.wisc.edu * 1410448Snilay@cs.wisc.edu * Redistribution and use in source and binary forms, with or without 1510448Snilay@cs.wisc.edu * modification, are permitted provided that the following conditions are 1610448Snilay@cs.wisc.edu * met: redistributions of source code must retain the above copyright 1710448Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer; 1810448Snilay@cs.wisc.edu * redistributions in binary form must reproduce the above copyright 1910448Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer in the 2010448Snilay@cs.wisc.edu * documentation and/or other materials provided with the distribution; 2110448Snilay@cs.wisc.edu * neither the name of the copyright holders nor the names of its 2210447Snilay@cs.wisc.edu * contributors may be used to endorse or promote products derived from 2310447Snilay@cs.wisc.edu * this software without specific prior written permission. 2410447Snilay@cs.wisc.edu * 2510447Snilay@cs.wisc.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2610447Snilay@cs.wisc.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2710447Snilay@cs.wisc.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2810447Snilay@cs.wisc.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2910447Snilay@cs.wisc.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3010447Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3110447Snilay@cs.wisc.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3210447Snilay@cs.wisc.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3310447Snilay@cs.wisc.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3410447Snilay@cs.wisc.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3510447Snilay@cs.wisc.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3610447Snilay@cs.wisc.edu * 3710447Snilay@cs.wisc.edu * Authors: Andreas Hansson 3810447Snilay@cs.wisc.edu */ 3910447Snilay@cs.wisc.edu 4010447Snilay@cs.wisc.edu#include "base/chunk_generator.hh" 4110447Snilay@cs.wisc.edu#include "mem/port_proxy.hh" 4210447Snilay@cs.wisc.edu 4310447Snilay@cs.wisc.eduvoid 4410447Snilay@cs.wisc.eduPortProxy::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd) const 4510447Snilay@cs.wisc.edu{ 4610447Snilay@cs.wisc.edu Request req; 4710447Snilay@cs.wisc.edu 4810447Snilay@cs.wisc.edu for (ChunkGenerator gen(addr, size, _port.peerBlockSize()); 4910447Snilay@cs.wisc.edu !gen.done(); gen.next()) { 5010447Snilay@cs.wisc.edu req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId); 5110447Snilay@cs.wisc.edu Packet pkt(&req, cmd, Packet::Broadcast); 5210447Snilay@cs.wisc.edu pkt.dataStatic(p); 5310447Snilay@cs.wisc.edu _port.sendFunctional(&pkt); 5410447Snilay@cs.wisc.edu p += gen.size(); 5510447Snilay@cs.wisc.edu } 5610447Snilay@cs.wisc.edu} 5710447Snilay@cs.wisc.edu 5810447Snilay@cs.wisc.eduvoid 5910447Snilay@cs.wisc.eduPortProxy::memsetBlob(Addr addr, uint8_t v, int size) const 6010447Snilay@cs.wisc.edu{ 6110447Snilay@cs.wisc.edu // quick and dirty... 6210447Snilay@cs.wisc.edu uint8_t *buf = new uint8_t[size]; 6310447Snilay@cs.wisc.edu 6410447Snilay@cs.wisc.edu std::memset(buf, v, size); 6510447Snilay@cs.wisc.edu blobHelper(addr, buf, size, MemCmd::WriteReq); 6610447Snilay@cs.wisc.edu 6710447Snilay@cs.wisc.edu delete [] buf; 6810447Snilay@cs.wisc.edu} 6910447Snilay@cs.wisc.edu