12400SN/A/*
28706Sandreas.hansson@arm.com * Copyright (c) 2011 ARM Limited
38706Sandreas.hansson@arm.com * All rights reserved
48706Sandreas.hansson@arm.com *
58706Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall
68706Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual
78706Sandreas.hansson@arm.com * property including but not limited to intellectual property relating
88706Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software
98706Sandreas.hansson@arm.com * licensed hereunder.  You may use the software subject to the license
108706Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated
118706Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software,
128706Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form.
138706Sandreas.hansson@arm.com *
142400SN/A * Copyright (c) 2001-2005 The Regents of The University of Michigan
152400SN/A * All rights reserved.
162400SN/A *
172400SN/A * Redistribution and use in source and binary forms, with or without
182400SN/A * modification, are permitted provided that the following conditions are
192400SN/A * met: redistributions of source code must retain the above copyright
202400SN/A * notice, this list of conditions and the following disclaimer;
212400SN/A * redistributions in binary form must reproduce the above copyright
222400SN/A * notice, this list of conditions and the following disclaimer in the
232400SN/A * documentation and/or other materials provided with the distribution;
242400SN/A * neither the name of the copyright holders nor the names of its
252400SN/A * contributors may be used to endorse or promote products derived from
262400SN/A * this software without specific prior written permission.
272400SN/A *
282400SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292400SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302400SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312400SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322400SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332400SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342400SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352400SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362400SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372400SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382400SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392665SN/A *
402665SN/A * Authors: Ron Dreslinski
412665SN/A *          Ali Saidi
428706Sandreas.hansson@arm.com *          Andreas Hansson
432400SN/A */
442400SN/A
458706Sandreas.hansson@arm.com#ifndef __MEM_SE_TRANSLATING_PORT_PROXY_HH__
468706Sandreas.hansson@arm.com#define __MEM_SE_TRANSLATING_PORT_PROXY_HH__
472400SN/A
488706Sandreas.hansson@arm.com#include "mem/port_proxy.hh"
498852Sandreas.hansson@arm.com
5012448Sgabeblack@google.comclass EmulationPageTable;
518852Sandreas.hansson@arm.comclass Process;
522519SN/A
538706Sandreas.hansson@arm.com/**
548706Sandreas.hansson@arm.com * @file
558706Sandreas.hansson@arm.com * TranslatingPortProxy Object Declaration for SE.
568706Sandreas.hansson@arm.com *
578706Sandreas.hansson@arm.com * Port proxies are used when non structural entities need access to
588706Sandreas.hansson@arm.com * the memory system. Proxy objects replace the previous
598706Sandreas.hansson@arm.com * FunctionalPort, TranslatingPort and VirtualPort objects, which
608706Sandreas.hansson@arm.com * provided the same functionality as the proxies, but were instances
618706Sandreas.hansson@arm.com * of ports not corresponding to real structural ports of the
628706Sandreas.hansson@arm.com * simulated system. Via the port proxies all the accesses go through
638706Sandreas.hansson@arm.com * an actual port and thus are transparent to a potentially
648706Sandreas.hansson@arm.com * distributed memory and automatically adhere to the memory map of
658706Sandreas.hansson@arm.com * the system.
668706Sandreas.hansson@arm.com */
678706Sandreas.hansson@arm.comclass SETranslatingPortProxy : public PortProxy
688706Sandreas.hansson@arm.com{
692400SN/A
704434SN/A  public:
714434SN/A    enum AllocType {
724434SN/A        Always,
734434SN/A        Never,
744434SN/A        NextPage
754434SN/A    };
764434SN/A
772400SN/A  private:
7812448Sgabeblack@google.com    EmulationPageTable *pTable;
794434SN/A    Process *process;
804434SN/A    AllocType allocating;
812400SN/A
822400SN/A  public:
8314196Sgabeblack@google.com    SETranslatingPortProxy(SendFunctionalFunc func,
8414196Sgabeblack@google.com                           Process* p, AllocType alloc);
8514196Sgabeblack@google.com    SETranslatingPortProxy(MasterPort &port, Process* p, AllocType alloc);
8614008Sgabeblack@google.com    ~SETranslatingPortProxy() {}
872400SN/A
8812448Sgabeblack@google.com    void setPageTable(EmulationPageTable *p) { pTable = p; }
8911886Sbrandon.potter@amd.com    void setProcess(Process *p) { process = p; }
9014009Sgabeblack@google.com    bool tryReadBlob(Addr addr, void *p, int size) const override;
9114009Sgabeblack@google.com    bool tryWriteBlob(Addr addr, const void *p, int size) const override;
9214008Sgabeblack@google.com    bool tryMemsetBlob(Addr addr, uint8_t val, int size) const override;
932400SN/A};
942400SN/A
958706Sandreas.hansson@arm.com#endif // __MEM_SE_TRANSLATING_PORT_PROXY_HH__
96