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