xref: /linux/drivers/pci/pci-pf-stub.c (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1a8ccf8a6SAlexander Duyck // SPDX-License-Identifier: GPL-2.0
2a8ccf8a6SAlexander Duyck /* pci-pf-stub - simple stub driver for PCI SR-IOV PF device
3a8ccf8a6SAlexander Duyck  *
4f6b6aefeSBjorn Helgaas  * This driver is meant to act as a "whitelist" for devices that provide
5a8ccf8a6SAlexander Duyck  * SR-IOV functionality while at the same time not actually needing a
6a8ccf8a6SAlexander Duyck  * driver of their own.
7a8ccf8a6SAlexander Duyck  */
8a8ccf8a6SAlexander Duyck 
9a8ccf8a6SAlexander Duyck #include <linux/module.h>
10a8ccf8a6SAlexander Duyck #include <linux/pci.h>
11a8ccf8a6SAlexander Duyck 
129b41d19aSKrzysztof Kozlowski /*
13a8ccf8a6SAlexander Duyck  * pci_pf_stub_whitelist - White list of devices to bind pci-pf-stub onto
14a8ccf8a6SAlexander Duyck  *
15a8ccf8a6SAlexander Duyck  * This table provides the list of IDs this driver is supposed to bind
16a8ccf8a6SAlexander Duyck  * onto.  You could think of this as a list of "quirked" devices where we
17a8ccf8a6SAlexander Duyck  * are adding support for SR-IOV here since there are no other drivers
18a8ccf8a6SAlexander Duyck  * that they would be running under.
19a8ccf8a6SAlexander Duyck  */
20a8ccf8a6SAlexander Duyck static const struct pci_device_id pci_pf_stub_whitelist[] = {
21a8ccf8a6SAlexander Duyck 	{ PCI_VDEVICE(AMAZON, 0x0053) },
22a8ccf8a6SAlexander Duyck 	/* required last entry */
23a8ccf8a6SAlexander Duyck 	{ 0 }
24a8ccf8a6SAlexander Duyck };
25a8ccf8a6SAlexander Duyck MODULE_DEVICE_TABLE(pci, pci_pf_stub_whitelist);
26a8ccf8a6SAlexander Duyck 
pci_pf_stub_probe(struct pci_dev * dev,const struct pci_device_id * id)27a8ccf8a6SAlexander Duyck static int pci_pf_stub_probe(struct pci_dev *dev,
28a8ccf8a6SAlexander Duyck 			     const struct pci_device_id *id)
29a8ccf8a6SAlexander Duyck {
30a8ccf8a6SAlexander Duyck 	pci_info(dev, "claimed by pci-pf-stub\n");
31a8ccf8a6SAlexander Duyck 	return 0;
32a8ccf8a6SAlexander Duyck }
33a8ccf8a6SAlexander Duyck 
34a8ccf8a6SAlexander Duyck static struct pci_driver pf_stub_driver = {
35a8ccf8a6SAlexander Duyck 	.name			= "pci-pf-stub",
36a8ccf8a6SAlexander Duyck 	.id_table		= pci_pf_stub_whitelist,
37a8ccf8a6SAlexander Duyck 	.probe			= pci_pf_stub_probe,
38a8ccf8a6SAlexander Duyck 	.sriov_configure	= pci_sriov_configure_simple,
39a8ccf8a6SAlexander Duyck };
40462bd2fdSLiu Shixin module_pci_driver(pf_stub_driver);
41a8ccf8a6SAlexander Duyck 
42*359efc9dSJeff Johnson MODULE_DESCRIPTION("SR-IOV PF stub driver with no functionality");
43a8ccf8a6SAlexander Duyck MODULE_LICENSE("GPL");
44