From 485d103255c0f64ebf697650c899fe7a80db1d6d Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 24 Feb 2012 11:46:39 -0500 Subject: MEM: Move all read/write blob functions from Port to PortProxy This patch moves the readBlob/writeBlob/memsetBlob from the Port class to the PortProxy class, thus making a clear separation of the basic port functionality (recv/send functional/atomic/timing), and the higher-level functional accessors available on the port proxies. There are only a few places in the code base where the blob functions were used on ports, and they are all for peeking into the memory system without making a normal memory access (in the memtest, and the malta and tsunami pchip). The memtest also exemplifies how easy it is to create a non-translating proxy if desired. The malta and tsunami pchip used a slave port to perform a functional read, and this is now changed to rely on the physProxy of the system (to which they already have a pointer). --- src/mem/port.cc | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'src/mem/port.cc') diff --git a/src/mem/port.cc b/src/mem/port.cc index e489b9d7a..8edca16f7 100644 --- a/src/mem/port.cc +++ b/src/mem/port.cc @@ -32,9 +32,6 @@ * @file * Port object definitions. */ -#include - -#include "base/chunk_generator.hh" #include "base/trace.hh" #include "debug/Config.hh" #include "mem/mem_object.hh" @@ -63,46 +60,6 @@ Port::setOwner(MemObject *_owner) owner = _owner; } -void -Port::blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd) -{ - Request req; - - for (ChunkGenerator gen(addr, size, peerBlockSize()); - !gen.done(); gen.next()) { - req.setPhys(gen.addr(), gen.size(), 0, Request::funcMasterId); - Packet pkt(&req, cmd, Packet::Broadcast); - pkt.dataStatic(p); - sendFunctional(&pkt); - p += gen.size(); - } -} - -void -Port::writeBlob(Addr addr, uint8_t *p, int size) -{ - blobHelper(addr, p, size, MemCmd::WriteReq); -} - -void -Port::readBlob(Addr addr, uint8_t *p, int size) -{ - blobHelper(addr, p, size, MemCmd::ReadReq); -} - -void -Port::memsetBlob(Addr addr, uint8_t val, int size) -{ - // quick and dirty... - uint8_t *buf = new uint8_t[size]; - - std::memset(buf, val, size); - blobHelper(addr, buf, size, MemCmd::WriteReq); - - delete [] buf; -} - - void Port::printAddr(Addr a) { -- cgit v1.2.3