41 cci::cci_param<uint32_t> p_devfn;
42 cci::cci_param<uint32_t> p_vendor_id;
43 cci::cci_param<uint32_t> p_device_id;
44 cci::cci_param<uint32_t> p_class_id;
45 cci::cci_param<uint32_t> p_revision;
46 cci::cci_param<uint32_t> p_num_vfs;
47 cci::cci_param<uint32_t> p_num_msi_vectors;
48 cci::cci_param<uint64_t> p_bar0_size;
49 cci::cci_param<uint64_t> p_private_base;
50 cci::cci_param<uint64_t> p_pf_shadow_base;
51 cci::cci_param<uint64_t> p_commblock_base;
53 qemu_rciep_pci(
const sc_core::sc_module_name& name, sc_core::sc_object* o, sc_core::sc_object* t)
54 : qemu_rciep_pci(name, *(
dynamic_cast<QemuInstance*
>(o)), (
dynamic_cast<qemu_gpex*
>(t)))
58 qemu_rciep_pci(
const sc_core::sc_module_name& name,
QemuInstance& inst, qemu_gpex* gpex)
60 , p_devfn(
"devfn", 0,
"PCI devfn (dev<<3 | fn)")
61 , p_vendor_id(
"vendor_id", 0x17CB,
"PCI Vendor ID")
62 , p_device_id(
"device_id", 0x0D0A,
"PCI Device ID")
63 , p_class_id(
"class_id", 0x1200,
"PCI class code")
64 , p_revision(
"revision", 0x00,
"PCI revision ID")
65 , p_num_vfs(
"num_vfs", 8,
"Number of SR-IOV VFs")
66 , p_num_msi_vectors(
"num_msi_vectors", 4,
67 "MSI vectors advertised per PF (keep small vs platform IRQ pool, e.g. GICv2m 64 SPIs)")
68 , p_bar0_size(
"bar0_size", 0x800000,
"PF BAR0 MMIO window size in bytes (8 MiB doorbell/comm-block aperture)")
69 , p_private_base(
"private_base", 0,
"Reserved — not consumed yet (future CPU-facing PRIVATE window)")
70 , p_pf_shadow_base(
"pf_shadow_base", 0,
"Reserved — not consumed yet (future config-monitor mirror)")
71 , p_commblock_base(
"commblock_base", 0,
72 "System-bus base of the external comm-block component (BAR0 forward target)")
74 gpex->add_device(*
this);
77 void before_end_of_elaboration()
override
79 qemu_gpex::Device::before_end_of_elaboration();
82 uint32_t devfn = p_devfn.get_value();
83 uint32_t dev = (devfn >> 3) & 0x1f;
84 uint32_t fn = devfn & 0x7;
85 std::ostringstream addr_str;
86 addr_str << std::hex << std::setfill(
'0') << std::setw(2) << dev <<
"." << fn;
87 m_dev.set_prop_str(
"addr", addr_str.str().c_str());
89 m_dev.set_prop_uint(
"vendor-id", p_vendor_id.get_value());
90 m_dev.set_prop_uint(
"device-id", p_device_id.get_value());
91 m_dev.set_prop_uint(
"class-id", p_class_id.get_value());
92 m_dev.set_prop_uint(
"revision", p_revision.get_value());
93 m_dev.set_prop_uint(
"num-vfs", p_num_vfs.get_value());
94 m_dev.set_prop_uint(
"num-msi-vectors", p_num_msi_vectors.get_value());
95 m_dev.set_prop_uint(
"bar0-size", p_bar0_size.get_value());
96 m_dev.set_prop_uint(
"private-base", p_private_base.get_value());
97 m_dev.set_prop_uint(
"pf-shadow-base", p_pf_shadow_base.get_value());
98 m_dev.set_prop_uint(
"commblock-base", p_commblock_base.get_value());