12521SN/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 *
142521SN/A * Copyright (c) 2006 The Regents of The University of Michigan
152521SN/A * All rights reserved.
162521SN/A *
172521SN/A * Redistribution and use in source and binary forms, with or without
182521SN/A * modification, are permitted provided that the following conditions are
192521SN/A * met: redistributions of source code must retain the above copyright
202521SN/A * notice, this list of conditions and the following disclaimer;
212521SN/A * redistributions in binary form must reproduce the above copyright
222521SN/A * notice, this list of conditions and the following disclaimer in the
232521SN/A * documentation and/or other materials provided with the distribution;
242521SN/A * neither the name of the copyright holders nor the names of its
252521SN/A * contributors may be used to endorse or promote products derived from
262521SN/A * this software without specific prior written permission.
272521SN/A *
282521SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
292521SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
302521SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
312521SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
322521SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332521SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
342521SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
352521SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
362521SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
372521SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
382521SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
392665SN/A *
402665SN/A * Authors: Ali Saidi
418706Sandreas.hansson@arm.com *          Andreas Hansson
422521SN/A */
432521SN/A
442521SN/A/**
452521SN/A * @file
468706Sandreas.hansson@arm.com * TranslatingPortProxy Object Declaration for FS.
478706Sandreas.hansson@arm.com *
488706Sandreas.hansson@arm.com * Port proxies are used when non structural entities need access to
498706Sandreas.hansson@arm.com * the memory system. Proxy objects replace the previous
508706Sandreas.hansson@arm.com * FunctionalPort, TranslatingPort and VirtualPort objects, which
518706Sandreas.hansson@arm.com * provided the same functionality as the proxies, but were instances
528706Sandreas.hansson@arm.com * of ports not corresponding to real structural ports of the
538706Sandreas.hansson@arm.com * simulated system. Via the port proxies all the accesses go through
548706Sandreas.hansson@arm.com * an actual port and thus are transparent to a potentially
558706Sandreas.hansson@arm.com * distributed memory and automatically adhere to the memory map of
568706Sandreas.hansson@arm.com * the system.
572521SN/A */
582521SN/A
5912492Sodanrc@yahoo.com.br#ifndef __MEM_FS_TRANSLATING_PORT_PROXY_HH__
6012492Sodanrc@yahoo.com.br#define __MEM_FS_TRANSLATING_PORT_PROXY_HH__
612521SN/A
628706Sandreas.hansson@arm.com#include "mem/port_proxy.hh"
632521SN/A
649850Sandreas.hansson@arm.comclass ThreadContext;
659850Sandreas.hansson@arm.com
668706Sandreas.hansson@arm.com/**
678706Sandreas.hansson@arm.com * A TranslatingPortProxy in FS mode translates a virtual address to a
688706Sandreas.hansson@arm.com * physical address and then calls the read/write functions of the
698706Sandreas.hansson@arm.com * port. If a thread context is provided the address can alway be
708706Sandreas.hansson@arm.com * translated, If not it can only be translated if it is a simple
718706Sandreas.hansson@arm.com * address masking operation (such as alpha super page accesses).
722521SN/A */
738706Sandreas.hansson@arm.comclass FSTranslatingPortProxy : public PortProxy
742521SN/A{
752521SN/A  private:
768706Sandreas.hansson@arm.com    ThreadContext* _tc;
772521SN/A
782521SN/A  public:
792521SN/A
808706Sandreas.hansson@arm.com    FSTranslatingPortProxy(ThreadContext* tc);
818706Sandreas.hansson@arm.com
8214196Sgabeblack@google.com    FSTranslatingPortProxy(SendFunctionalFunc func,
8314196Sgabeblack@google.com                           unsigned int cacheLineSize);
8414196Sgabeblack@google.com    FSTranslatingPortProxy(MasterPort &port,
8514196Sgabeblack@google.com                           unsigned int cacheLineSize);
868706Sandreas.hansson@arm.com
8714008Sgabeblack@google.com    ~FSTranslatingPortProxy() {}
882521SN/A
8914008Sgabeblack@google.com    /** Version of tryReadblob that translates virt->phys and deals
902521SN/A      * with page boundries. */
9114009Sgabeblack@google.com    bool tryReadBlob(Addr addr, void *p, int size) const override;
922521SN/A
9314008Sgabeblack@google.com    /** Version of tryWriteBlob that translates virt->phys and deals
942521SN/A      * with page boundries. */
9514009Sgabeblack@google.com    bool tryWriteBlob(Addr addr, const void *p, int size) const override;
968706Sandreas.hansson@arm.com
978706Sandreas.hansson@arm.com    /**
988706Sandreas.hansson@arm.com     * Fill size bytes starting at addr with byte value val.
998706Sandreas.hansson@arm.com     */
10014008Sgabeblack@google.com    bool tryMemsetBlob(Addr address, uint8_t  v, int size) const override;
1012521SN/A};
1022521SN/A
10312492Sodanrc@yahoo.com.br#endif //__MEM_FS_TRANSLATING_PORT_PROXY_HH__
104