30 std::string m_netdev_id;
31 cci::cci_param<std::string> p_mac;
32 cci::cci_param<std::string> p_netdev_str;
39 cci::cci_param<std::string> p_addr;
42 e1000e_pci(
const sc_core::sc_module_name& name, sc_core::sc_object* o, sc_core::sc_object* t)
43 : e1000e_pci(name, *(
dynamic_cast<QemuInstance*
>(o)), (
dynamic_cast<qemu_gpex*
>(t)))
46 e1000e_pci(
const sc_core::sc_module_name& name,
QemuInstance& inst, qemu_gpex* gpex)
48 , m_netdev_id(std::string(sc_core::sc_module::name()) +
"-id")
49 , p_mac(
"mac",
"",
"MAC address of NIC")
50 , p_netdev_str(
"netdev_str",
"type=user",
"netdev string for QEMU (do not specify ID)")
51 , p_addr(
"addr",
"",
"PCI slot pinning, e.g. \"02.0\"; empty leaves it to gpex auto-assignment")
53 std::stringstream opts;
54 opts << p_netdev_str.get_value();
55 opts <<
",id=" << m_netdev_id;
57 m_inst.add_arg(
"-netdev");
58 m_inst.add_arg(opts.str().c_str());
60 gpex->add_device(*
this);
63 void before_end_of_elaboration()
override
65 qemu_gpex::Device::before_end_of_elaboration();
66 if (!p_mac.get_value().empty()) m_dev.set_prop_str(
"mac", p_mac.get_value().c_str());
67 m_dev.set_prop_str(
"netdev", m_netdev_id.c_str());
68 m_dev.set_prop_str(
"romfile",
"");
69 if (!p_addr.get_value().empty()) m_dev.set_prop_str(
"addr", p_addr.get_value().c_str());