@@ -26,6 +26,16 @@ int arch_pci_clean_pirqs(struct domain *d)
return 0;
}
+struct pci_dev *dev_to_pci(struct device *dev)
+{
+ struct arch_pci_dev *arch_dev;
+
+ ASSERT(dev->type == DEV_PCI);
+
+ arch_dev = container_of((dev), struct arch_pci_dev, dev);
+ return container_of(arch_dev, struct pci_dev, arch);
+}
+
static int __init dt_pci_init(void)
{
struct dt_device_node *np;
@@ -27,6 +27,13 @@ struct arch_pci_dev {
struct device dev;
};
+/*
+ * Because of the header cross-dependencies, e.g. we need both
+ * struct pci_dev and struct arch_pci_dev at the same time, this cannot be
+ * done with an inline here. Macro can be implemented, but looks scary.
+ */
+struct pci_dev *dev_to_pci(struct device *dev);
+
/* Arch-specific MSI data for vPCI. */
struct vpci_arch_msi {
};