33 std::function<
void()> set_dev_props;
43 QemuDevice::end_of_elaboration();
52 cci::cci_param<std::string> p_serial;
53 cci::cci_param<uint8_t> p_nutrs;
54 cci::cci_param<uint8_t> p_nutmrs;
55 cci::cci_param<bool> p_mcq;
56 cci::cci_param<uint8_t> p_mcq_maxq;
57 std::vector<Device*> m_devices;
63 , q_socket(
"mem", inst)
65 , p_serial(
"serial",
"",
"controller serial")
66 , p_nutrs(
"nutrs", 32,
"number of UTP transfer request slots")
67 , p_nutmrs(
"nutmrs", 8,
"number of UTP task management request slots")
68 , p_mcq(
"mcq",
false,
"multiple command queue support")
69 , p_mcq_maxq(
"mcq_maxq", 2,
"MCQ maximum number of queues")
74 void add_device(Device&
dev)
76 if (m_inst !=
dev.get_qemu_inst()) {
77 SCP_FATAL(
SCMOD) <<
"UFS device and host have to be in same qemu instance";
79 m_devices.push_back(&
dev);
82 void before_end_of_elaboration()
override
84 QemuDevice::before_end_of_elaboration();
85 if (!p_serial.get_value().empty()) {
86 m_dev.set_prop_str(
"serial", p_serial.get_value().c_str());
88 if (!p_nutrs.is_default_value()) m_dev.set_prop_uint(
"nutrs", p_nutrs.get_value());
89 if (!p_nutmrs.is_default_value()) m_dev.set_prop_uint(
"nutmrs", p_nutmrs.get_value());
90 if (!p_mcq.is_default_value()) m_dev.set_prop_bool(
"mcq", p_mcq.get_value());
91 if (!p_mcq_maxq.is_default_value()) m_dev.set_prop_uint(
"mcq-maxq", p_mcq_maxq.get_value());
94 void end_of_elaboration()
override
96 QemuDevice::set_sysbus_as_parent_bus();
97 QemuDevice::end_of_elaboration();
99 q_socket.init(
sbd, 0);
103 for (Device*
device : m_devices) {
104 if (
device->set_dev_props) {
void init_sbd(qemu::SysBusDevice sbd, int gpio_idx)
Initialize this socket with a QEMU SysBusDevice, and a GPIO index.
Definition qemu-initiator-signal-socket.h:173