@@ -27,6 +27,13 @@ int arch_pci_clean_pirqs(struct domain *d)
return 0;
}
+struct pci_dev *dev_to_pci(struct device *dev)
+{
+ ASSERT(dev->type == DEV_PCI);
+
+ return container_of(dev, struct pci_dev, arch.dev);
+}
+
static int __init dt_pci_init(void)
{
struct dt_device_node *np;
@@ -4,6 +4,7 @@
enum device_type
{
DEV_DT,
+ DEV_PCI,
};
struct dev_archdata {
@@ -25,8 +26,7 @@ typedef struct device device_t;
#include <xen/device_tree.h>
-/* TODO: Correctly implement dev_is_pci when PCI is supported on ARM */
-#define dev_is_pci(dev) ((void)(dev), 0)
+#define dev_is_pci(dev) ((dev)->type == DEV_PCI)
#define dev_is_dt(dev) ((dev)->type == DEV_DT)
enum device_class
@@ -26,6 +26,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 {
};