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