SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
pci_bus_extension.h
Go to the documentation of this file.
1/*
2 © 2015 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_PCI_BUS_EXTENSION_H
15#define SIMICS_SYSTEMC_IFACE_PCI_BUS_EXTENSION_H
16
19
20namespace simics {
21namespace systemc {
22namespace iface {
23
25class PciBusExtension : public Extension<PciBusExtension, PciBusInterface> {
26 public:
27 void call(PciBusInterface *device) override {
28 switch (method_.value<Method>()) {
29 case RAISE_INTERRUPT:
30 device->raise_interrupt(
31 method_input_[0].value<int>());
32 break;
33 case LOWER_INTERRUPT:
34 device->lower_interrupt(
35 method_input_[0].value<int>());
36 break;
37 case INTERRUPT_ACKNOWLEDGE:
39 break;
40 case ADD_MAP:
41 method_return_ = device->add_map(
42 method_input_[0].value<types::addr_space_t>(),
43 method_input_[1].value<types::map_info_t>());
44 break;
45 case REMOVE_MAP:
46 method_return_ = device->remove_map(
47 method_input_[0].value<types::addr_space_t>(),
48 method_input_[1].value<int>());
49 break;
50 case SET_BUS_NUMBER:
51 device->set_bus_number(method_input_[0].value<int>());
52 break;
53 case SET_SUB_BUS_NUMBER:
54 device->set_sub_bus_number(method_input_[0].value<int>());
55 break;
56 case ADD_DEFAULT:
57 device->add_default(
58 method_input_[0].value<types::addr_space_t>(),
59 method_input_[1].value<types::map_info_t>());
60 break;
61 case REMOVE_DEFAULT:
62 device->remove_default(
63 method_input_[0].value<types::addr_space_t>());
64 break;
65 case BUS_RESET:
66 device->bus_reset();
67 break;
68 case SPECIAL_CYCLE:
69 device->special_cycle(method_input_[0].value<uint32_t>());
70 break;
71 case SYSTEM_ERROR:
72 device->system_error();
73 break;
74 case GET_BUS_ADDRESS:
76 break;
77 case SET_DEVICE_STATUS:
78 device->set_device_status(method_input_[0].value<int>(),
79 method_input_[1].value<int>(),
80 method_input_[2].value<int>());
81 break;
82 }
83 }
84
85 void raise_interrupt(int pin) override {
86 method_ = RAISE_INTERRUPT;
87 method_input_.push_back(pin);
88 send();
89 }
90 void lower_interrupt(int pin) override {
91 method_ = LOWER_INTERRUPT;
92 method_input_.push_back(pin);
93 send();
94 }
95 int interrupt_acknowledge() override {
96 method_ = INTERRUPT_ACKNOWLEDGE;
98 send();
99 return method_return_.value<int>();
100 }
102 method_ = ADD_MAP;
103 method_input_.push_back(space);
104 method_input_.push_back(info);
105 send();
106 return method_return_.value<int>();
107 }
108 int remove_map(types::addr_space_t space, int function) override {
109 method_ = REMOVE_MAP;
110 method_input_.push_back(space);
111 method_input_.push_back(function);
112 send();
113 return method_return_.value<int>();
114 }
115 void set_bus_number(int bus_id) override {
116 method_ = SET_BUS_NUMBER;
117 method_input_.push_back(bus_id);
118 send();
119 }
120 void set_sub_bus_number(int bus_id) override {
121 method_ = SET_SUB_BUS_NUMBER;
122 method_input_.push_back(bus_id);
123 send();
124 }
126 types::map_info_t info) override {
127 method_ = ADD_DEFAULT;
128 method_input_.push_back(space);
129 method_input_.push_back(info);
130 send();
131 }
132 void remove_default(types::addr_space_t space) override {
133 method_ = REMOVE_DEFAULT;
134 method_input_.push_back(space);
135 send();
136 }
137 void bus_reset() override {
138 method_ = BUS_RESET;
139 send();
140 }
141 void special_cycle(uint32_t value) override {
142 method_ = SPECIAL_CYCLE;
143 method_input_.push_back(value);
144 send();
145 }
146 void system_error() override {
147 method_ = SYSTEM_ERROR;
148 send();
149 }
150 int get_bus_address() override {
151 method_ = GET_BUS_ADDRESS;
153 send();
154 return method_return_.value<int>();
155 }
156 void set_device_status(int device, int function, int enabled) override {
157 method_ = SET_DEVICE_STATUS;
158 method_input_.push_back(device);
159 method_input_.push_back(function);
160 method_input_.push_back(enabled);
161 send();
162 }
163
164 private:
165 enum Method {
166 RAISE_INTERRUPT,
167 LOWER_INTERRUPT,
168 INTERRUPT_ACKNOWLEDGE,
169 ADD_MAP,
170 REMOVE_MAP,
171 SET_BUS_NUMBER,
172 SET_SUB_BUS_NUMBER,
173 ADD_DEFAULT,
174 REMOVE_DEFAULT,
175 BUS_RESET,
176 SPECIAL_CYCLE,
177 SYSTEM_ERROR,
178 GET_BUS_ADDRESS,
179 SET_DEVICE_STATUS
180 };
181};
182
183} // namespace iface
184} // namespace systemc
185} // namespace simics
186
187#endif
Base class for TLM2 extension, responsible for marshal/unmarshal of a Simics interface.
Definition: extension.h:38
types::AnyType method_return_error_
Definition: extension.h:118
std::vector< types::AnyType > method_input_
Definition: extension.h:116
Extension for Simics pci_bus interface.
Definition: pci_bus_extension.h:25
void set_device_status(int device, int function, int enabled) override
Definition: pci_bus_extension.h:156
void remove_default(types::addr_space_t space) override
Definition: pci_bus_extension.h:132
void special_cycle(uint32_t value) override
Definition: pci_bus_extension.h:141
void bus_reset() override
Definition: pci_bus_extension.h:137
void system_error() override
Definition: pci_bus_extension.h:146
int interrupt_acknowledge() override
Definition: pci_bus_extension.h:95
int remove_map(types::addr_space_t space, int function) override
Definition: pci_bus_extension.h:108
void call(PciBusInterface *device) override
Definition: pci_bus_extension.h:27
int add_map(types::addr_space_t space, types::map_info_t info) override
Definition: pci_bus_extension.h:101
int get_bus_address() override
Definition: pci_bus_extension.h:150
void set_bus_number(int bus_id) override
Definition: pci_bus_extension.h:115
void set_sub_bus_number(int bus_id) override
Definition: pci_bus_extension.h:120
void lower_interrupt(int pin) override
Definition: pci_bus_extension.h:90
void add_default(types::addr_space_t space, types::map_info_t info) override
Definition: pci_bus_extension.h:125
void raise_interrupt(int pin) override
Definition: pci_bus_extension.h:85
Simics SystemC pci_bus interface.
Definition: pci_bus_interface.h:26
virtual void set_device_status(int device, int function, int enabled)=0
virtual void lower_interrupt(int pin)=0
virtual int add_map(types::addr_space_t space, types::map_info_t info)=0
virtual void set_bus_number(int bus_id)=0
virtual void raise_interrupt(int pin)=0
virtual void set_sub_bus_number(int bus_id)=0
virtual void special_cycle(uint32_t value)=0
virtual void add_default(types::addr_space_t space, types::map_info_t info)=0
virtual void remove_default(types::addr_space_t space)=0
virtual int remove_map(types::addr_space_t space, int function)=0
T value()
Definition: any_type.h:87
addr_space_t
Stand-alone, version of the Simics addr_space_t enum.
Definition: addr_space.h:21
Definition: adapter.h:79
Reduced, stand-alone, version of the Simics map_info_t struct.
Definition: map_info.h:23