se_translating_port_proxy.hh revision 11800:54436a1784dc
16145Snate@binkert.org/*
26145Snate@binkert.org * Copyright (c) 2011 ARM Limited
36145Snate@binkert.org * All rights reserved
46145Snate@binkert.org *
56145Snate@binkert.org * The license below extends only to copyright in the software and shall
66145Snate@binkert.org * not be construed as granting a license to any other intellectual
76145Snate@binkert.org * property including but not limited to intellectual property relating
86145Snate@binkert.org * to a hardware implementation of the functionality of the software
96145Snate@binkert.org * licensed hereunder.  You may use the software subject to the license
106145Snate@binkert.org * terms below provided that you ensure that this notice is replicated
116145Snate@binkert.org * unmodified and in its entirety in all distributions of the software,
126145Snate@binkert.org * modified or unmodified, in source code or in binary form.
136145Snate@binkert.org *
146145Snate@binkert.org * Copyright (c) 2001-2005 The Regents of The University of Michigan
156145Snate@binkert.org * All rights reserved.
166145Snate@binkert.org *
176145Snate@binkert.org * Redistribution and use in source and binary forms, with or without
186145Snate@binkert.org * modification, are permitted provided that the following conditions are
196145Snate@binkert.org * met: redistributions of source code must retain the above copyright
206145Snate@binkert.org * notice, this list of conditions and the following disclaimer;
216145Snate@binkert.org * redistributions in binary form must reproduce the above copyright
226145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
236145Snate@binkert.org * documentation and/or other materials provided with the distribution;
246145Snate@binkert.org * neither the name of the copyright holders nor the names of its
256145Snate@binkert.org * contributors may be used to endorse or promote products derived from
266145Snate@binkert.org * this software without specific prior written permission.
276145Snate@binkert.org *
286145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
297454Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
307454Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
317454Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
327054Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
337054Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
347054Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
357054Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
368259SBrad.Beckmann@amd.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
376154Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
386154Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
396145Snate@binkert.org *
407055Snate@binkert.org * Authors: Ron Dreslinski
417454Snate@binkert.org *          Ali Saidi
427454Snate@binkert.org *          Andreas Hansson
437055Snate@binkert.org */
446145Snate@binkert.org
456145Snate@binkert.org#ifndef __MEM_SE_TRANSLATING_PORT_PROXY_HH__
467054Snate@binkert.org#define __MEM_SE_TRANSLATING_PORT_PROXY_HH__
477054Snate@binkert.org
486145Snate@binkert.org#include "mem/port_proxy.hh"
496145Snate@binkert.org
506145Snate@binkert.orgclass PageTableBase;
516145Snate@binkert.orgclass Process;
527054Snate@binkert.org
536145Snate@binkert.org/**
547054Snate@binkert.org * @file
557454Snate@binkert.org * TranslatingPortProxy Object Declaration for SE.
566145Snate@binkert.org *
577054Snate@binkert.org * Port proxies are used when non structural entities need access to
587454Snate@binkert.org * the memory system. Proxy objects replace the previous
596145Snate@binkert.org * FunctionalPort, TranslatingPort and VirtualPort objects, which
606145Snate@binkert.org * provided the same functionality as the proxies, but were instances
617054Snate@binkert.org * of ports not corresponding to real structural ports of the
627454Snate@binkert.org * simulated system. Via the port proxies all the accesses go through
636145Snate@binkert.org * an actual port and thus are transparent to a potentially
647054Snate@binkert.org * distributed memory and automatically adhere to the memory map of
656145Snate@binkert.org * the system.
666145Snate@binkert.org */
677054Snate@binkert.orgclass SETranslatingPortProxy : public PortProxy
687454Snate@binkert.org{
697054Snate@binkert.org
706145Snate@binkert.org  public:
717054Snate@binkert.org    enum AllocType {
728259SBrad.Beckmann@amd.com        Always,
738259SBrad.Beckmann@amd.com        Never,
746145Snate@binkert.org        NextPage
757054Snate@binkert.org    };
767054Snate@binkert.org
778259SBrad.Beckmann@amd.com  private:
787454Snate@binkert.org    PageTableBase *pTable;
796145Snate@binkert.org    Process *process;
807054Snate@binkert.org    AllocType allocating;
817454Snate@binkert.org
827054Snate@binkert.org  public:
837054Snate@binkert.org    SETranslatingPortProxy(MasterPort& port, Process* p, AllocType alloc);
847054Snate@binkert.org    virtual ~SETranslatingPortProxy();
857054Snate@binkert.org
867054Snate@binkert.org    bool tryReadBlob(Addr addr, uint8_t *p, int size) const;
877454Snate@binkert.org    bool tryWriteBlob(Addr addr, const uint8_t *p, int size) const;
887054Snate@binkert.org    bool tryMemsetBlob(Addr addr, uint8_t val, int size) const;
897454Snate@binkert.org    bool tryWriteString(Addr addr, const char *str) const;
907454Snate@binkert.org    bool tryReadString(std::string &str, Addr addr) const;
916145Snate@binkert.org
926145Snate@binkert.org    virtual void readBlob(Addr addr, uint8_t *p, int size) const;
937054Snate@binkert.org    virtual void writeBlob(Addr addr, const uint8_t *p, int size) const;
947054Snate@binkert.org    virtual void memsetBlob(Addr addr, uint8_t val, int size) const;
956145Snate@binkert.org
967054Snate@binkert.org    void writeString(Addr addr, const char *str) const;
977054Snate@binkert.org    void readString(std::string &str, Addr addr) const;
986145Snate@binkert.org};
996145Snate@binkert.org
1007054Snate@binkert.org#endif // __MEM_SE_TRANSLATING_PORT_PROXY_HH__
1017054Snate@binkert.org