]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - arch/powerpc/include/asm/pci-bridge.h
Merge tag 'acpica-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[mirror_ubuntu-zesty-kernel.git] / arch / powerpc / include / asm / pci-bridge.h
index 546d036fe925f408f1ff11296ff07d879916df84..1811c44bf34bcb6564036a76fb5b7a63563edf83 100644 (file)
 
 struct device_node;
 
+/*
+ * PCI controller operations
+ */
+struct pci_controller_ops {
+       void            (*dma_dev_setup)(struct pci_dev *dev);
+       void            (*dma_bus_setup)(struct pci_bus *bus);
+
+       int             (*probe_mode)(struct pci_bus *);
+
+       /* Called when pci_enable_device() is called. Returns true to
+        * allow assignment/enabling of the device. */
+       bool            (*enable_device_hook)(struct pci_dev *);
+
+       /* Called during PCI resource reassignment */
+       resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
+       void            (*reset_secondary_bus)(struct pci_dev *dev);
+};
+
 /*
  * Structure of a PCI controller (host bridge)
  */
@@ -46,6 +64,7 @@ struct pci_controller {
        resource_size_t isa_mem_phys;
        resource_size_t isa_mem_size;
 
+       struct pci_controller_ops controller_ops;
        struct pci_ops *ops;
        unsigned int __iomem *cfg_addr;
        void __iomem *cfg_data;
@@ -89,6 +108,7 @@ struct pci_controller {
 
 #ifdef CONFIG_PPC64
        unsigned long buid;
+       struct pci_dn *pci_data;
 #endif /* CONFIG_PPC64 */
 
        void *private_data;
@@ -154,31 +174,51 @@ static inline int isa_vaddr_is_ioport(void __iomem *address)
 struct iommu_table;
 
 struct pci_dn {
+       int     flags;
+#define PCI_DN_FLAG_IOV_VF     0x01
+
        int     busno;                  /* pci bus number */
        int     devfn;                  /* pci device and function number */
+       int     vendor_id;              /* Vendor ID */
+       int     device_id;              /* Device ID */
+       int     class_code;             /* Device class code */
 
+       struct  pci_dn *parent;
        struct  pci_controller *phb;    /* for pci devices */
        struct  iommu_table *iommu_table;       /* for phb's or bridges */
        struct  device_node *node;      /* back-pointer to the device_node */
 
        int     pci_ext_config_space;   /* for pci devices */
 
-       struct  pci_dev *pcidev;        /* back-pointer to the pci device */
 #ifdef CONFIG_EEH
        struct eeh_dev *edev;           /* eeh device */
 #endif
 #define IODA_INVALID_PE                (-1)
 #ifdef CONFIG_PPC_POWERNV
        int     pe_number;
+#ifdef CONFIG_PCI_IOV
+       u16     vfs_expanded;           /* number of VFs IOV BAR expanded */
+       u16     num_vfs;                /* number of VFs enabled*/
+       int     offset;                 /* PE# for the first VF PE */
+#define M64_PER_IOV 4
+       int     m64_per_iov;
+#define IODA_INVALID_M64        (-1)
+       int     m64_wins[PCI_SRIOV_NUM_BARS][M64_PER_IOV];
+#endif /* CONFIG_PCI_IOV */
 #endif
+       struct list_head child_list;
+       struct list_head list;
 };
 
 /* Get the pointer to a device_node's pci_dn */
 #define PCI_DN(dn)     ((struct pci_dn *) (dn)->data)
 
+extern struct pci_dn *pci_get_pdn_by_devfn(struct pci_bus *bus,
+                                          int devfn);
 extern struct pci_dn *pci_get_pdn(struct pci_dev *pdev);
-
-extern void * update_dn_pci_info(struct device_node *dn, void *data);
+extern struct pci_dn *add_dev_pci_data(struct pci_dev *pdev);
+extern void remove_dev_pci_data(struct pci_dev *pdev);
+extern void *update_dn_pci_info(struct device_node *dn, void *data);
 
 static inline int pci_device_from_OF_node(struct device_node *np,
                                          u8 *bus, u8 *devfn)
@@ -191,20 +231,12 @@ static inline int pci_device_from_OF_node(struct device_node *np,
 }
 
 #if defined(CONFIG_EEH)
-static inline struct eeh_dev *of_node_to_eeh_dev(struct device_node *dn)
+static inline struct eeh_dev *pdn_to_eeh_dev(struct pci_dn *pdn)
 {
-       /*
-        * For those OF nodes whose parent isn't PCI bridge, they
-        * don't have PCI_DN actually. So we have to skip them for
-        * any EEH operations.
-        */
-       if (!dn || !PCI_DN(dn))
-               return NULL;
-
-       return PCI_DN(dn)->edev;
+       return pdn ? pdn->edev : NULL;
 }
 #else
-#define of_node_to_eeh_dev(x) (NULL)
+#define pdn_to_eeh_dev(x)      (NULL)
 #endif
 
 /** Find the bus corresponding to the indicated device node */