SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
inject_pcie_device.h
Go to the documentation of this file.
1/*
2 © 2026 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_INJECTION_EXTENSION_INJECT_PCIE_DEVICE_H
15#define SIMICS_SYSTEMC_INJECTION_EXTENSION_INJECT_PCIE_DEVICE_H
16
17
18
22
23#include <string>
24
25namespace simics {
26namespace systemc {
27namespace injection {
28namespace extension {
29
31template <typename TPAYLOAD>
32class InjectPcieDevice : public InjectBase<TPAYLOAD> {
33 public:
34 ATTR_DICT_PARSER_NAMESPACE("pcie_device.")
35
36 bool setValue(AttrDictParser *parser, const std::string &key,
37 attr_value_t *attr, TPAYLOAD *gp) override {
38 if (key == "hot_reset") {
40 ->hot_reset();
41 return true;
42 } else if (key == "connected") {
43 AttrDictParser p = parser->init(attr);
44 conf_object_t *port_obj = nullptr;
45 if (!p.lookUp("port_obj", &port_obj))
46 return false;
47
48 uint16_t device_id = 0;
49 if (!p.lookUp("device_id", &device_id))
50 return false;
51
53 ->connected(port_obj, device_id);
54 return true;
55 } else if (key == "disconnected") {
56 AttrDictParser p = parser->init(attr);
57 conf_object_t *port_obj = nullptr;
58 if (!p.lookUp("port_obj", &port_obj))
59 return false;
60
61 uint16_t device_id = 0;
62 if (!p.lookUp("device_id", &device_id))
63 return false;
64
66 ->disconnected(port_obj, device_id);
67 return true;
68 }
69
70 return false;
71 }
72};
73
74} // namespace extension
75} // namespace injection
76} // namespace systemc
77} // namespace simics
78
79#endif
#define ATTR_DICT_PARSER_NAMESPACE(ns)
Definition: attr_dict_parser.h:32
Definition: attr_dict_parser.h:38
AttrDictParser init(const attr_value_t *attr)
bool lookUp(const std::string &key, T *v)
Definition: attr_dict_parser.h:53
Definition: inject_base.h:43
bool setValue(AttrDictParser *parser, const std::string &key, attr_value_t *attr, TPAYLOAD *gp) override
Definition: inject_pcie_device.h:36
Definition: adapter.h:79