Skip to content

Commit c5fb301

Browse files
Yinghai Lubjorn-helgaas
authored andcommitted
EISA/PCI: Init EISA early, before PNP
Matthew reported kernels fail the pci_eisa probe and are later successful with the virtual_eisa_root_init force probe without slot0. The reason for that is: PNP probing is before pci_eisa_init gets called as pci_eisa_init is called via pci_driver. pnp 00:0f has 0xc80 - 0xc84 reserved. [ 9.700409] pnp 00:0f: [io 0x0c80-0x0c84] so eisa_probe will fail from pci_eisa_init ==>eisa_root_register ==>eisa_probe path. as force_probe is not set in pci_eisa_root, it will bail early when slot0 is not probed and initialized. Try to use subsys_initcall_sync instead, and will keep following sequence: pci_subsys_init pci_eisa_init_early pnpacpi_init/isapnp_init After this patch EISA can be initialized properly, and PNP overlapping resource will not be reserved. [ 10.104434] system 00:0f: [io 0x0c80-0x0c84] could not be reserved Reported-by: Matthew Whitehead <mwhitehe@redhat.com> Tested-by: Matthew Whitehead <mwhitehe@redhat.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: stable@vger.kernel.org
1 parent 2cfda63 commit c5fb301

1 file changed

Lines changed: 21 additions & 18 deletions

File tree

‎drivers/eisa/pci_eisa.c‎

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
/* There is only *one* pci_eisa device per machine, right ? */
2020
static struct eisa_root_device pci_eisa_root;
2121

22-
static int __init pci_eisa_init(struct pci_dev *pdev,
23-
const struct pci_device_id *ent)
22+
static int __init pci_eisa_init(struct pci_dev *pdev)
2423
{
2524
int rc, i;
2625
struct resource *res, *bus_res = NULL;
@@ -67,22 +66,26 @@ static int __init pci_eisa_init(struct pci_dev *pdev,
6766
return 0;
6867
}
6968

70-
static struct pci_device_id pci_eisa_pci_tbl[] = {
71-
{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
72-
PCI_CLASS_BRIDGE_EISA << 8, 0xffff00, 0 },
73-
{ 0, }
74-
};
69+
/*
70+
* We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init().
71+
* Otherwise pnp resource will get enabled early and could prevent eisa
72+
* to be initialized.
73+
* Also need to make sure pci_eisa_init_early() is called after
74+
* x86/pci_subsys_init().
75+
* So need to use subsys_initcall_sync with it.
76+
*/
77+
static int __init pci_eisa_init_early(void)
78+
{
79+
struct pci_dev *dev = NULL;
80+
int ret;
7581

76-
static struct pci_driver __refdata pci_eisa_driver = {
77-
.name = "pci_eisa",
78-
.id_table = pci_eisa_pci_tbl,
79-
.probe = pci_eisa_init,
80-
};
82+
for_each_pci_dev(dev)
83+
if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) {
84+
ret = pci_eisa_init(dev);
85+
if (ret)
86+
return ret;
87+
}
8188

82-
static int __init pci_eisa_init_module (void)
83-
{
84-
return pci_register_driver (&pci_eisa_driver);
89+
return 0;
8590
}
86-
87-
device_initcall(pci_eisa_init_module);
88-
MODULE_DEVICE_TABLE(pci, pci_eisa_pci_tbl);
91+
subsys_initcall_sync(pci_eisa_init_early);

0 commit comments

Comments
 (0)