port_proxy.hh (14012:1bdf42ed6add) port_proxy.hh (14196:ce364f5517f3)
1/*
2 * Copyright (c) 2011-2013, 2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 45 unchanged lines hidden (view full) ---

54 * CPU, e.g. for threads) and thus are transparent to a potentially
55 * distributed memory and automatically adhere to the memory map of
56 * the system.
57 */
58
59#ifndef __MEM_PORT_PROXY_HH__
60#define __MEM_PORT_PROXY_HH__
61
1/*
2 * Copyright (c) 2011-2013, 2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 45 unchanged lines hidden (view full) ---

54 * CPU, e.g. for threads) and thus are transparent to a potentially
55 * distributed memory and automatically adhere to the memory map of
56 * the system.
57 */
58
59#ifndef __MEM_PORT_PROXY_HH__
60#define __MEM_PORT_PROXY_HH__
61
62#include <functional>
62#include <limits>
63
64#include "mem/port.hh"
65#include "sim/byteswap.hh"
66
67/**
63#include <limits>
64
65#include "mem/port.hh"
66#include "sim/byteswap.hh"
67
68/**
68 * This object is a proxy for a structural port, to be used for debug
69 * accesses.
69 * This object is a proxy for a port or other object which implements the
70 * functional response protocol, to be used for debug accesses.
70 *
71 * This proxy object is used when non structural entities
72 * (e.g. thread contexts, object file loaders) need access to the
73 * memory system. It calls the corresponding functions on the underlying
71 *
72 * This proxy object is used when non structural entities
73 * (e.g. thread contexts, object file loaders) need access to the
74 * memory system. It calls the corresponding functions on the underlying
74 * structural port, and provides templatized convenience access functions.
75 * protocol, and provides templatized convenience access functions.
75 *
76 * The addresses are interpreted as physical addresses.
77 *
78 * @sa SETranslatingProxy
79 * @sa FSTranslatingProxy
80 */
76 *
77 * The addresses are interpreted as physical addresses.
78 *
79 * @sa SETranslatingProxy
80 * @sa FSTranslatingProxy
81 */
81class PortProxy
82class PortProxy : FunctionalRequestProtocol
82{
83{
84 public:
85 typedef std::function<void(PacketPtr pkt)> SendFunctionalFunc;
86
83 private:
87 private:
88 SendFunctionalFunc sendFunctional;
84
89
85 /** The actual physical port used by this proxy. */
86 MasterPort &_port;
87
88 /** Granularity of any transactions issued through this proxy. */
89 const unsigned int _cacheLineSize;
90
90 /** Granularity of any transactions issued through this proxy. */
91 const unsigned int _cacheLineSize;
92
93 void
94 recvFunctionalSnoop(PacketPtr pkt) override
95 {
96 // Since port proxies aren't anyone else's peer, they should never
97 // receive snoops.
98 panic("Port proxies should never receive snoops.");
99 }
100
91 public:
101 public:
92 PortProxy(MasterPort &port, unsigned int cacheLineSize) :
93 _port(port), _cacheLineSize(cacheLineSize)
102 PortProxy(SendFunctionalFunc func, unsigned int cacheLineSize) :
103 sendFunctional(func), _cacheLineSize(cacheLineSize)
94 {}
104 {}
105 PortProxy(const MasterPort &port, unsigned int cacheLineSize) :
106 sendFunctional([&port](PacketPtr pkt)->void {
107 port.sendFunctional(pkt);
108 }), _cacheLineSize(cacheLineSize)
109 {}
95 virtual ~PortProxy() { }
96
97
98
99 /** Fixed functionality for use in base classes. */
100
101 /**
102 * Read size bytes memory at physical address and store in p.

--- 198 unchanged lines hidden ---
110 virtual ~PortProxy() { }
111
112
113
114 /** Fixed functionality for use in base classes. */
115
116 /**
117 * Read size bytes memory at physical address and store in p.

--- 198 unchanged lines hidden ---