Skip to content

Commit 49dcc01

Browse files
YijingWangbjorn-helgaas
authored andcommitted
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: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 262a2ba commit 49dcc01

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎arch/arm/include/asm/mach/pci.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ struct device;
2121
struct hw_pci {
2222
#ifdef CONFIG_PCI_DOMAINS
2323
int domain;
24+
#endif
25+
#ifdef CONFIG_PCI_MSI
26+
struct msi_controller *msi_ctrl;
2427
#endif
2528
struct pci_ops *ops;
2629
int nr_controllers;
@@ -46,6 +49,9 @@ struct hw_pci {
4649
struct pci_sys_data {
4750
#ifdef CONFIG_PCI_DOMAINS
4851
int domain;
52+
#endif
53+
#ifdef CONFIG_PCI_MSI
54+
struct msi_controller *msi_ctrl;
4955
#endif
5056
struct list_head node;
5157
int busnr; /* primary bus number */

‎arch/arm/kernel/bios32.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@
1818

1919
static int debug_pci;
2020

21+
#ifdef CONFIG_PCI_MSI
22+
struct msi_controller *pcibios_msi_controller(struct pci_dev *dev)
23+
{
24+
struct pci_sys_data *sysdata = dev->bus->sysdata;
25+
26+
return sysdata->msi_ctrl;
27+
}
28+
#endif
29+
2130
/*
2231
* We can't use pci_get_device() here since we are
2332
* called from interrupt context.
@@ -470,6 +479,9 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
470479

471480
#ifdef CONFIG_PCI_DOMAINS
472481
sys->domain = hw->domain;
482+
#endif
483+
#ifdef CONFIG_PCI_MSI
484+
sys->msi_ctrl = hw->msi_ctrl;
473485
#endif
474486
sys->busnr = busnr;
475487
sys->swizzle = hw->swizzle;

0 commit comments

Comments
 (0)