23 cci::cci_param<std::string> p_serial;
24 cci::cci_param<std::string> p_blob_file;
25 cci::cci_param<uint32_t> max_ioqpairs;
26 std::string m_drive_id;
29 nvme(
const sc_core::sc_module_name& name, sc_core::sc_object*
o, sc_core::sc_object*
t)
35 , p_serial(
"serial",
basename(),
"Serial name of the nvme disk")
36 , p_blob_file(
"blob_file",
"",
"Blob file to load as data storage")
37 , max_ioqpairs(
"max_ioqpairs", 64,
"Passed through to QEMU max_ioqpairs")
40 if (p_blob_file.get_value().empty()) {
41 SCP_FATAL(()) <<
"the nvme device needs blob_file CCI parameter!";
43 m_drive_id +=
"_drive";
44 std::string
file = p_blob_file.get_value();
46 std::stringstream
opts;
47 opts <<
"if=sd,id=" << m_drive_id <<
",file=" <<
file <<
",format=raw";
51 gpex->add_device(*
this);
54 void before_end_of_elaboration()
override
56 qemu_gpex::Device::before_end_of_elaboration();
58 std::string
serial = p_serial;
59 m_dev.set_prop_str(
"serial",
serial.c_str());
60 m_dev.set_prop_parse(
"drive", m_drive_id.c_str());
61 m_dev.set_prop_int(
"max_ioqpairs", max_ioqpairs);
64 void gpex_realize(
qemu::Bus&
bus)
override { qemu_gpex::Device::gpex_realize(
bus); }
void add_arg(const char *arg)
Add a command line argument to the qemu instance.
Definition qemu-instance.h:327