SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
Loading...
Searching...
No Matches
direct_memory_update.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2015 Intel Corporation
5
6 This software and the related documents are Intel copyrighted materials, and
7 your use of them is governed by the express license under which they were
8 provided to you ("License"). Unless the License provides otherwise, you may
9 not use, modify, copy, publish, distribute, disclose or transmit this software
10 or the related documents without Intel's prior written permission.
11
12 This software and the related documents are provided as is, with no express or
13 implied warranties, other than those that are expressly stated in the License.
14*/
15
16#ifndef SIMICS_SYSTEMC_SIMICS2TLM_DIRECT_MEMORY_UPDATE_H
17#define SIMICS_SYSTEMC_SIMICS2TLM_DIRECT_MEMORY_UPDATE_H
18
22
23namespace simics {
24namespace systemc {
25namespace simics2tlm {
26
36 public:
37 DirectMemoryUpdate() : direct_memory_provider_("direct_memory") {}
40 virtual ~DirectMemoryUpdate() = default;
41
42 void release(conf_object_t *target,
43 direct_memory_handle_t handle,
44 direct_memory_ack_id_t id) {
45 invalidate_direct_mem_ptr(target, handle, id);
46 }
47 void update_permission(conf_object_t *target,
48 direct_memory_handle_t handle,
49 access_t lost_access,
50 access_t lost_permission,
51 access_t lost_inhibit,
52 direct_memory_ack_id_t id) {
53 invalidate_direct_mem_ptr(target, handle, id);
54 }
55 void conflicting_access(conf_object_t *target,
56 direct_memory_handle_t handle,
57 access_t conflicting_permission,
58 direct_memory_ack_id_t id) {
59 // Assuming the systemc device does not construct any internal caches
60 // based on the DMI pointer we don't have to do anything here.
61 direct_memory(target)->ack(target, id);
62 }
63
64 // Deprecated
66 }
67
68 protected:
69 // Helper function
71 ConfObjectRef target) {
72 if (target != direct_memory_provider_.target()) {
73 direct_memory_provider_.set_target(target);
74 }
75
76 return direct_memory_provider_.get_interface<
77 const direct_memory_interface_t>();
78 }
79 void invalidate_direct_mem_ptr(conf_object_t *target,
80 direct_memory_handle_t handle,
81 direct_memory_ack_id_t id) {
83 direct_memory(target);
84 void *user_data = dm_iface->get_user_data(target, handle);
86 static_cast<tlm2simics::GasketInterface *>(user_data);
87 if (gasket) {
88 // TODO(zeffer): We don't have to invalidate all pages here. Add
89 // fine-grain invalidation mechanism based on adapter_pages concept
91 static_cast<sc_dt::uint64>(-1));
92 }
93
94 dm_iface->ack(target, id);
95 }
96
97 private:
98 InterfaceProvider direct_memory_provider_;
99};
100
101} // namespace simics2tlm
102} // namespace systemc
103} // namespace simics
104
105#endif
Returns the interface provided by the associated Simics object.
Definition: interface_provider.h:32
virtual void set_target(const ConfObjectRef &obj)
Definition: interface_provider.h:58
SimicsTargetLock< TInterface > get_interface()
Definition: interface_provider.h:94
virtual const simics::ConfObjectRef & target() const
Definition: interface_provider.h:81
Definition: simics_target_lock.h:27
Simics direct_memory_update interface.
Definition: direct_memory_update_interface.h:26
Class that implements the Simics direct_memory_update interface.
Definition: direct_memory_update.h:35
void update_permission(conf_object_t *target, direct_memory_handle_t handle, access_t lost_access, access_t lost_permission, access_t lost_inhibit, direct_memory_ack_id_t id)
Definition: direct_memory_update.h:47
DirectMemoryUpdate & operator=(const DirectMemoryUpdate &)=delete
void conflicting_access(conf_object_t *target, direct_memory_handle_t handle, access_t conflicting_permission, direct_memory_ack_id_t id)
Definition: direct_memory_update.h:55
void set_gasket(tlm2simics::GasketInterface::Ptr gasket)
Definition: direct_memory_update.h:65
DirectMemoryUpdate()
Definition: direct_memory_update.h:37
void release(conf_object_t *target, direct_memory_handle_t handle, direct_memory_ack_id_t id)
Definition: direct_memory_update.h:42
void invalidate_direct_mem_ptr(conf_object_t *target, direct_memory_handle_t handle, direct_memory_ack_id_t id)
Definition: direct_memory_update.h:79
SimicsTargetLock< const direct_memory_interface_t > direct_memory(ConfObjectRef target)
Definition: direct_memory_update.h:70
DirectMemoryUpdate(const DirectMemoryUpdate &)=delete
Interface used by tlm2simics gaskets, implemented by Gasket base class.
Definition: gasket_interface.h:30
virtual void invalidate_direct_mem_ptr(sc_dt::uint64 start_range, sc_dt::uint64 end_range)=0
Calling this method will end up calling the same method on the target socket, that will forward the c...
std::shared_ptr< GasketInterface > Ptr
Definition: gasket_interface.h:32
Definition: pci_bus_interface.h:24