[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 5/7] hw/pci: Add pci_bus_add_fw_cfg_extra_pci_roots() helper
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 5/7] hw/pci: Add pci_bus_add_fw_cfg_extra_pci_roots() helper |
Date: |
Fri, 13 Dec 2024 14:33:50 +0100 |
pci_bus_add_fw_cfg_extra_pci_roots() calls the fw_cfg
API with PCI bus specific arguments.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
include/hw/pci/pci.h | 3 +++
hw/pci/pci.c | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index c0717e31219..603c456c3a8 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -297,6 +297,9 @@ int pci_bus_get_irq_level(PCIBus *bus, int irq_num);
uint32_t pci_bus_get_slot_reserved_mask(PCIBus *bus);
void pci_bus_set_slot_reserved_mask(PCIBus *bus, uint32_t mask);
void pci_bus_clear_slot_reserved_mask(PCIBus *bus, uint32_t mask);
+bool pci_bus_add_fw_cfg_extra_pci_roots(FWCfgState *fw_cfg,
+ PCIBus *bus,
+ Error **errp);
/* 0 <= pin <= 3 0 = INTA, 1 = INTB, 2 = INTC, 3 = INTD */
static inline int pci_swizzle(int slot, int pin)
{
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 8844251eceb..bf0a1840dbe 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -217,6 +217,22 @@ static uint16_t pcibus_numa_node(PCIBus *bus)
return NUMA_NODE_UNASSIGNED;
}
+bool pci_bus_add_fw_cfg_extra_pci_roots(FWCfgState *fw_cfg,
+ PCIBus *bus,
+ Error **errp)
+{
+ Object *obj;
+
+ if (!bus) {
+ return true;
+ }
+ obj = OBJECT(bus);
+
+ return fw_cfg_add_file_from_generator(fw_cfg, obj->parent,
+
object_get_canonical_path_component(obj),
+ "etc/extra-pci-roots", errp);
+}
+
static GByteArray *pci_bus_fw_cfg_gen_data(Object *obj, Error **errp)
{
PCIBus *bus = PCI_BUS(obj);
--
2.45.2
- [PATCH v2 0/7] hw/nvram/fw_cfg: Move PCI bus methods out, Philippe Mathieu-Daudé, 2024/12/13
- [PATCH v2 1/7] hw/nvram/fw_cfg: Rename fw_cfg_add_[file]_from_generator(), Philippe Mathieu-Daudé, 2024/12/13
- [PATCH v2 2/7] hw/nvram/fw_cfg: Pass QOM parent to fw_cfg_add_file_from_generator(), Philippe Mathieu-Daudé, 2024/12/13
- [PATCH v2 3/7] hw/nvram/fw_cfg: Skip FW_CFG_DATA_GENERATOR when no data to generate, Philippe Mathieu-Daudé, 2024/12/13
- [PATCH v2 4/7] hw/pci: Have PCI_BUS implement TYPE_FW_CFG_DATA_GENERATOR_INTERFACE, Philippe Mathieu-Daudé, 2024/12/13
- [PATCH v2 6/7] hw: Use pci_bus_add_fw_cfg_extra_pci_roots(), Philippe Mathieu-Daudé, 2024/12/13
- [PATCH v2 5/7] hw/pci: Add pci_bus_add_fw_cfg_extra_pci_roots() helper,
Philippe Mathieu-Daudé <=
- [PATCH v2 7/7] hw/nvram/fw_cfg: Remove fw_cfg_add_extra_pci_roots(), Philippe Mathieu-Daudé, 2024/12/13
- Re: [PATCH v2 0/7] hw/nvram/fw_cfg: Move PCI bus methods out, Philippe Mathieu-Daudé, 2024/12/13