3 * Purpose: PCI Express Port Bus Driver
5 * Copyright (C) 2004 Intel
6 * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
9 #include <linux/module.h>
10 #include <linux/pci.h>
11 #include <linux/kernel.h>
12 #include <linux/errno.h>
14 #include <linux/init.h>
15 #include <linux/pcieport_if.h>
22 #define DRIVER_VERSION "v1.0"
23 #define DRIVER_AUTHOR "tom.l.nguyen@intel.com"
24 #define DRIVER_DESC "PCIE Port Bus Driver"
25 MODULE_AUTHOR(DRIVER_AUTHOR);
26 MODULE_DESCRIPTION(DRIVER_DESC);
27 MODULE_LICENSE("GPL");
30 static const char device_name[] = "pcieport-driver";
33 * pcie_portdrv_probe - Probe PCI-Express port devices
34 * @dev: PCI-Express port device being probed
36 * If detected invokes the pcie_port_device_register() method for
40 static int __devinit pcie_portdrv_probe (struct pci_dev *dev,
41 const struct pci_device_id *id )
45 status = pcie_port_device_probe(dev);
49 if (pci_enable_device(dev) < 0)
55 "%s->Dev[%04x:%04x] has invalid IRQ. Check vendor BIOS\n",
56 __FUNCTION__, dev->device, dev->vendor);
58 if (pcie_port_device_register(dev))
64 static void pcie_portdrv_remove (struct pci_dev *dev)
66 pcie_port_device_remove(dev);
70 static int pcie_portdrv_suspend (struct pci_dev *dev, pm_message_t state)
72 return pcie_port_device_suspend(dev, state);
75 static int pcie_portdrv_resume (struct pci_dev *dev)
77 return pcie_port_device_resume(dev);
82 * LINUX Device Driver Model
84 static const struct pci_device_id port_pci_ids[] = { {
85 /* handle any PCI-Express port */
86 PCI_DEVICE_CLASS(((PCI_CLASS_BRIDGE_PCI << 8) | 0x00), ~0),
87 }, { /* end: all zeroes */ }
89 MODULE_DEVICE_TABLE(pci, port_pci_ids);
91 static struct pci_driver pcie_portdrv = {
92 .name = (char *)device_name,
93 .id_table = &port_pci_ids[0],
95 .probe = pcie_portdrv_probe,
96 .remove = pcie_portdrv_remove,
99 .suspend = pcie_portdrv_suspend,
100 .resume = pcie_portdrv_resume,
104 static int __init pcie_portdrv_init(void)
108 pcie_port_bus_register();
109 retval = pci_register_driver(&pcie_portdrv);
111 pcie_port_bus_unregister();
115 static void __exit pcie_portdrv_exit(void)
117 pci_unregister_driver(&pcie_portdrv);
118 pcie_port_bus_unregister();
121 module_init(pcie_portdrv_init);
122 module_exit(pcie_portdrv_exit);