0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/kernel.h>
0012 #include <linux/device.h>
0013 #include <linux/eisa.h>
0014 #include <linux/pci.h>
0015 #include <linux/module.h>
0016 #include <linux/init.h>
0017
0018
0019 static struct eisa_root_device pci_eisa_root;
0020
0021 static int __init pci_eisa_init(struct pci_dev *pdev)
0022 {
0023 int rc, i;
0024 struct resource *res, *bus_res = NULL;
0025
0026 if ((rc = pci_enable_device (pdev))) {
0027 dev_err(&pdev->dev, "Could not enable device\n");
0028 return rc;
0029 }
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 pci_bus_for_each_resource(pdev->bus, res, i)
0042 if (res && (res->flags & IORESOURCE_IO)) {
0043 bus_res = res;
0044 break;
0045 }
0046
0047 if (!bus_res) {
0048 dev_err(&pdev->dev, "No resources available\n");
0049 return -1;
0050 }
0051
0052 pci_eisa_root.dev = &pdev->dev;
0053 pci_eisa_root.res = bus_res;
0054 pci_eisa_root.bus_base_addr = bus_res->start;
0055 pci_eisa_root.slots = EISA_MAX_SLOTS;
0056 pci_eisa_root.dma_mask = pdev->dma_mask;
0057 dev_set_drvdata(pci_eisa_root.dev, &pci_eisa_root);
0058
0059 if (eisa_root_register (&pci_eisa_root)) {
0060 dev_err(&pdev->dev, "Could not register EISA root\n");
0061 return -1;
0062 }
0063
0064 return 0;
0065 }
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075 static int __init pci_eisa_init_early(void)
0076 {
0077 struct pci_dev *dev = NULL;
0078 int ret;
0079
0080 for_each_pci_dev(dev)
0081 if ((dev->class >> 8) == PCI_CLASS_BRIDGE_EISA) {
0082 ret = pci_eisa_init(dev);
0083 if (ret)
0084 return ret;
0085 }
0086
0087 return 0;
0088 }
0089 subsys_initcall_sync(pci_eisa_init_early);