提交 49dcc01a 编写于 作者: Y Yijing Wang 提交者: Bjorn Helgaas

ARM/PCI: Save MSI controller in pci_sys_data

Currently ARM associates an MSI controller with a PCI bus by defining
pcibios_add_bus() and using it to call a struct hw_pci.add_bus() method.
That method sets the struct pci_bus "msi" member.  That's unwieldy and
unnecessarily couples MSI with the PCI enumeration code.

On ARM, all devices under the same PCI host bridge share an MSI controller,
so add an msi_controller pointer to the struct pci_sys_data and implement
pcibios_msi_controller() to retrieve it.

This is a step toward moving the msi_controller pointer into the generic
struct pci_host_bridge.

[bhelgaas: changelog, take pci_dev instead of pci_bus]
Signed-off-by: NYijing Wang <wangyijing@huawei.com>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
上级 262a2baf
...@@ -21,6 +21,9 @@ struct device; ...@@ -21,6 +21,9 @@ struct device;
struct hw_pci { struct hw_pci {
#ifdef CONFIG_PCI_DOMAINS #ifdef CONFIG_PCI_DOMAINS
int domain; int domain;
#endif
#ifdef CONFIG_PCI_MSI
struct msi_controller *msi_ctrl;
#endif #endif
struct pci_ops *ops; struct pci_ops *ops;
int nr_controllers; int nr_controllers;
...@@ -46,6 +49,9 @@ struct hw_pci { ...@@ -46,6 +49,9 @@ struct hw_pci {
struct pci_sys_data { struct pci_sys_data {
#ifdef CONFIG_PCI_DOMAINS #ifdef CONFIG_PCI_DOMAINS
int domain; int domain;
#endif
#ifdef CONFIG_PCI_MSI
struct msi_controller *msi_ctrl;
#endif #endif
struct list_head node; struct list_head node;
int busnr; /* primary bus number */ int busnr; /* primary bus number */
......
...@@ -18,6 +18,15 @@ ...@@ -18,6 +18,15 @@
static int debug_pci; static int debug_pci;
#ifdef CONFIG_PCI_MSI
struct msi_controller *pcibios_msi_controller(struct pci_dev *dev)
{
struct pci_sys_data *sysdata = dev->bus->sysdata;
return sysdata->msi_ctrl;
}
#endif
/* /*
* We can't use pci_get_device() here since we are * We can't use pci_get_device() here since we are
* called from interrupt context. * called from interrupt context.
...@@ -470,6 +479,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, ...@@ -470,6 +479,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
#ifdef CONFIG_PCI_DOMAINS #ifdef CONFIG_PCI_DOMAINS
sys->domain = hw->domain; sys->domain = hw->domain;
#endif
#ifdef CONFIG_PCI_MSI
sys->msi_ctrl = hw->msi_ctrl;
#endif #endif
sys->busnr = busnr; sys->busnr = busnr;
sys->swizzle = hw->swizzle; sys->swizzle = hw->swizzle;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册