18 std::string blkdev_id;
19 cci::cci_param<std::string> blkdev_str;
22 usb_storage(
const sc_core::sc_module_name& name, sc_core::sc_object* o, sc_core::sc_object* t)
23 : usb_storage(name, *(
dynamic_cast<QemuInstance*
>(o)), (
dynamic_cast<qemu_xhci*
>(t)))
26 usb_storage(
const sc_core::sc_module_name& n,
QemuInstance& inst, qemu_xhci* xhci)
28 , blkdev_id(std::string(name()) +
"-id")
29 , blkdev_str(
"blkdev_str",
"",
"blkdev string for QEMU (do not specify ID)")
31 if (!blkdev_str.get_value().empty()) {
32 std::stringstream opts;
33 opts << blkdev_str.get_value();
34 opts <<
",id=" << blkdev_id;
36 m_inst.add_arg(
"-drive");
37 m_inst.add_arg(opts.str().c_str());
39 set_dev_props = [
this]() ->
void { m_dev.set_prop_parse(
"drive", blkdev_id.c_str()); };
41 SCP_FATAL(()) <<
"usb storage needs a blkdev_str CCI Parameter!";
43 xhci->add_device(*
this);