SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
pcie_map_extension.h
Go to the documentation of this file.
1/*
2 © 2024 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_IFACE_PCIE_MAP_EXTENSION_H
15#define SIMICS_SYSTEMC_IFACE_PCIE_MAP_EXTENSION_H
16
19
20namespace simics {
21namespace systemc {
22namespace iface {
23
25class PcieMapExtension : public Extension<PcieMapExtension,
26 PcieMapInterface> {
27 public:
28 void call(PcieMapInterface *device) override {
29 switch (method_.value<Method>()) {
30 case ADD_MAP:
31 device->add_map(
32 method_input_[0].value<types::map_info_t>(),
33 method_input_[1].value<types::pcie_type_t>());
34 break;
35 case DEL_MAP:
36 device->del_map(
37 method_input_[0].value<types::map_info_t::physical_address_t>(),
38 method_input_[1].value<types::pcie_type_t>());
39 break;
40 case ADD_FUNCTION:
41 device->add_function(
42 method_input_[0].value<conf_object_t *>(),
43 method_input_[1].value<uint16_t>());
44 break;
45 case DEL_FUNCTION:
46 device->del_function(
47 method_input_[0].value<conf_object_t *>(),
48 method_input_[1].value<uint16_t>());
49 break;
50 case ENABLE_FUNCTION:
51 device->enable_function(
52 method_input_[0].value<uint16_t>());
53 break;
54 case DISABLE_FUNCTION:
55 device->disable_function(
56 method_input_[0].value<uint16_t>());
57 break;
58 case GET_DEVICE_ID:
60 method_input_[0].value<conf_object_t *>());
61 break;
62 }
63 }
64
65 void add_map(types::map_info_t info, types::pcie_type_t type) override {
66 method_ = ADD_MAP;
67 method_input_.push_back(info);
68 method_input_.push_back(type);
69 send();
70 }
71
73 types::pcie_type_t type) override {
74 method_ = DEL_MAP;
75 method_input_.push_back(base);
76 method_input_.push_back(type);
77 send();
78 }
79
80 void add_function(conf_object_t *map_obj,
81 uint16_t device_and_function) override {
82 method_ = ADD_FUNCTION;
83 method_input_.push_back(map_obj);
84 method_input_.push_back(device_and_function);
85 send();
86 }
87
88 void del_function(conf_object_t *map_obj,
89 uint16_t device_and_function) override {
90 method_ = DEL_FUNCTION;
91 method_input_.push_back(map_obj);
92 method_input_.push_back(device_and_function);
93 send();
94 }
95
96 void enable_function(uint16_t device_and_function) override {
97 method_ = ENABLE_FUNCTION;
98 method_input_.push_back(device_and_function);
99 send();
100 }
101
102 void disable_function(uint16_t device_and_function) override {
103 method_ = DISABLE_FUNCTION;
104 method_input_.push_back(device_and_function);
105 send();
106 }
107
108 uint16_t get_device_id(conf_object_t *dev_obj) override {
109 method_ = GET_DEVICE_ID;
110 method_input_.push_back(dev_obj);
111 send();
112 return method_return_.value<uint16_t>();
113 }
114
115 private:
116 enum Method {
117 ADD_MAP,
118 DEL_MAP,
119 ADD_FUNCTION,
120 DEL_FUNCTION,
121 ENABLE_FUNCTION,
122 DISABLE_FUNCTION,
123 GET_DEVICE_ID
124 };
125};
126
127} // namespace iface
128} // namespace systemc
129} // namespace simics
130
131#endif
Base class for TLM2 extension, responsible for marshal/unmarshal of a Simics interface.
Definition: extension.h:38
std::vector< types::AnyType > method_input_
Definition: extension.h:116
Extension for Simics pcie_map interface.
Definition: pcie_map_extension.h:26
void enable_function(uint16_t device_and_function) override
Definition: pcie_map_extension.h:96
uint16_t get_device_id(conf_object_t *dev_obj) override
Definition: pcie_map_extension.h:108
void disable_function(uint16_t device_and_function) override
Definition: pcie_map_extension.h:102
void del_map(types::map_info_t::physical_address_t base, types::pcie_type_t type) override
Definition: pcie_map_extension.h:72
void add_map(types::map_info_t info, types::pcie_type_t type) override
Definition: pcie_map_extension.h:65
void add_function(conf_object_t *map_obj, uint16_t device_and_function) override
Definition: pcie_map_extension.h:80
void del_function(conf_object_t *map_obj, uint16_t device_and_function) override
Definition: pcie_map_extension.h:88
void call(PcieMapInterface *device) override
Definition: pcie_map_extension.h:28
Simics pcie_map interface.
Definition: pcie_map_interface.h:27
virtual void del_map(types::map_info_t::physical_address_t base, types::pcie_type_t type)=0
virtual void disable_function(uint16_t device_and_function)=0
virtual void add_map(types::map_info_t info, types::pcie_type_t type)=0
virtual uint16_t get_device_id(conf_object_t *dev_obj)=0
virtual void add_function(conf_object_t *map_obj, uint16_t device_and_function)=0
virtual void enable_function(uint16_t device_and_function)=0
virtual void del_function(conf_object_t *map_obj, uint16_t device_and_function)=0
T value()
Definition: any_type.h:87
pcie_type_t
Definition: pcie_type.h:20
Definition: adapter.h:79
Reduced, stand-alone, version of the Simics map_info_t struct.
Definition: map_info.h:23
uint64_t physical_address_t
Definition: map_info.h:24