Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Minimalist driver for a generic PCI-to-EISA bridge. |
| 3 | * |
| 4 | * (C) 2003 Marc Zyngier <maz@wild-wind.fr.eu.org> |
| 5 | * |
| 6 | * This code is released under the GPL version 2. |
| 7 | * |
| 8 | * Ivan Kokshaysky <ink@jurassic.park.msu.ru> : |
| 9 | * Generalisation from i82375 to PCI_CLASS_BRIDGE_EISA. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/kernel.h> |
| 13 | #include <linux/device.h> |
| 14 | #include <linux/eisa.h> |
| 15 | #include <linux/pci.h> |
| 16 | #include <linux/module.h> |
| 17 | #include <linux/init.h> |
| 18 | |
| 19 | /* There is only *one* pci_eisa device per machine, right ? */ |
| 20 | static struct eisa_root_device pci_eisa_root; |
| 21 | |
Yinghai Lu | 27bd92f | 2013-03-27 21:28:05 -0700 | [diff] [blame^] | 22 | static int __init pci_eisa_init(struct pci_dev *pdev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | { |
| 24 | int rc; |
| 25 | |
| 26 | if ((rc = pci_enable_device (pdev))) { |
| 27 | printk (KERN_ERR "pci_eisa : Could not enable device %s\n", |
| 28 | pci_name(pdev)); |
| 29 | return rc; |
| 30 | } |
| 31 | |
| 32 | pci_eisa_root.dev = &pdev->dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | pci_eisa_root.res = pdev->bus->resource[0]; |
| 34 | pci_eisa_root.bus_base_addr = pdev->bus->resource[0]->start; |
| 35 | pci_eisa_root.slots = EISA_MAX_SLOTS; |
| 36 | pci_eisa_root.dma_mask = pdev->dma_mask; |
Greg Kroah-Hartman | 4b9d0d3 | 2009-04-30 14:43:31 -0700 | [diff] [blame] | 37 | dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | if (eisa_root_register (&pci_eisa_root)) { |
| 40 | printk (KERN_ERR "pci_eisa : Could not register EISA root\n"); |
| 41 | return -1; |
| 42 | } |
| 43 | |
| 44 | return 0; |
| 45 | } |
| 46 | |
Yinghai Lu | 27bd92f | 2013-03-27 21:28:05 -0700 | [diff] [blame^] | 47 | /* |
| 48 | * We have to call pci_eisa_init_early() before pnpacpi_init()/isapnp_init(). |
| 49 | * Otherwise pnp resource will get enabled early and could prevent eisa |
| 50 | * to be initialized. |
| 51 | * Also need to make sure pci_eisa_init_early() is called after |
| 52 | * x86/pci_subsys_init(). |
| 53 | * So need to use subsys_initcall_sync with it. |
| 54 | */ |
| 55 | static int __init pci_eisa_init_early(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | { |
Yinghai Lu | 27bd92f | 2013-03-27 21:28:05 -0700 | [diff] [blame^] | 57 | struct pci_dev *dev = NULL; |
| 58 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
Yinghai Lu | 27bd92f | 2013-03-27 21:28:05 -0700 | [diff] [blame^] | 60 | for_each_pci_dev(dev) |
| 61 | if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) { |
| 62 | ret = pci_eisa_init(dev); |
| 63 | if (ret) |
| 64 | return ret; |
| 65 | } |
| 66 | |
| 67 | return 0; |
| 68 | } |
| 69 | subsys_initcall_sync(pci_eisa_init_early); |