1db3a4f0aSMihai Carabas // SPDX-License-Identifier: GPL-2.0+ 2db3a4f0aSMihai Carabas /* 3db3a4f0aSMihai Carabas * Pvpanic PCI Device Support 4db3a4f0aSMihai Carabas * 5db3a4f0aSMihai Carabas * Copyright (C) 2021 Oracle. 6db3a4f0aSMihai Carabas */ 7db3a4f0aSMihai Carabas 8*7037f714SAndy Shevchenko #include <linux/errno.h> 9db3a4f0aSMihai Carabas #include <linux/module.h> 10db3a4f0aSMihai Carabas #include <linux/pci.h> 11db3a4f0aSMihai Carabas #include <linux/types.h> 12db3a4f0aSMihai Carabas 13db3a4f0aSMihai Carabas #include "pvpanic.h" 14db3a4f0aSMihai Carabas 15db3a4f0aSMihai Carabas #define PCI_VENDOR_ID_REDHAT 0x1b36 16db3a4f0aSMihai Carabas #define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011 17db3a4f0aSMihai Carabas 18db3a4f0aSMihai Carabas MODULE_AUTHOR("Mihai Carabas <mihai.carabas@oracle.com>"); 19db3a4f0aSMihai Carabas MODULE_DESCRIPTION("pvpanic device driver"); 20db3a4f0aSMihai Carabas MODULE_LICENSE("GPL"); 21db3a4f0aSMihai Carabas 2284b0f12aSAndy Shevchenko static int pvpanic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 23db3a4f0aSMihai Carabas { 24db3a4f0aSMihai Carabas void __iomem *base; 25db3a4f0aSMihai Carabas int ret; 26db3a4f0aSMihai Carabas 27372dae89SChristophe JAILLET ret = pcim_enable_device(pdev); 28db3a4f0aSMihai Carabas if (ret < 0) 29db3a4f0aSMihai Carabas return ret; 30db3a4f0aSMihai Carabas 31372dae89SChristophe JAILLET base = pcim_iomap(pdev, 0, 0); 32642fa28bSQiheng Lin if (!base) 33642fa28bSQiheng Lin return -ENOMEM; 34db3a4f0aSMihai Carabas 35c1426d39SThomas Weißschuh return devm_pvpanic_probe(&pdev->dev, base); 36db3a4f0aSMihai Carabas } 37db3a4f0aSMihai Carabas 3833a43041SAndy Shevchenko static const struct pci_device_id pvpanic_pci_id_tbl[] = { 3933a43041SAndy Shevchenko { PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)}, 4033a43041SAndy Shevchenko {} 4133a43041SAndy Shevchenko }; 4233a43041SAndy Shevchenko MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl); 4333a43041SAndy Shevchenko 44db3a4f0aSMihai Carabas static struct pci_driver pvpanic_pci_driver = { 45db3a4f0aSMihai Carabas .name = "pvpanic-pci", 46db3a4f0aSMihai Carabas .id_table = pvpanic_pci_id_tbl, 47db3a4f0aSMihai Carabas .probe = pvpanic_pci_probe, 48db3a4f0aSMihai Carabas .driver = { 49c1426d39SThomas Weißschuh .dev_groups = pvpanic_dev_groups, 50db3a4f0aSMihai Carabas }, 51db3a4f0aSMihai Carabas }; 52db3a4f0aSMihai Carabas module_pci_driver(pvpanic_pci_driver); 53