2021-03-24 07:49:16 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Pvpanic PCI Device Support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2021 Oracle.
|
|
|
|
*/
|
|
|
|
|
2023-12-21 07:44:47 -07:00
|
|
|
#include <linux/errno.h>
|
2021-03-24 07:49:16 -07:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
|
|
#include "pvpanic.h"
|
|
|
|
|
|
|
|
#define PCI_DEVICE_ID_REDHAT_PVPANIC 0x0011
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Mihai Carabas <mihai.carabas@oracle.com>");
|
2021-08-29 05:43:54 -07:00
|
|
|
MODULE_DESCRIPTION("pvpanic device driver");
|
2021-03-24 07:49:16 -07:00
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
2021-08-29 05:43:54 -07:00
|
|
|
static int pvpanic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
2021-03-24 07:49:16 -07:00
|
|
|
{
|
|
|
|
void __iomem *base;
|
|
|
|
int ret;
|
|
|
|
|
2021-05-21 23:54:33 -07:00
|
|
|
ret = pcim_enable_device(pdev);
|
2021-03-24 07:49:16 -07:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
2021-05-21 23:54:33 -07:00
|
|
|
base = pcim_iomap(pdev, 0, 0);
|
2021-03-29 18:36:59 -07:00
|
|
|
if (!base)
|
|
|
|
return -ENOMEM;
|
2021-03-24 07:49:16 -07:00
|
|
|
|
2023-10-11 00:18:27 -07:00
|
|
|
return devm_pvpanic_probe(&pdev->dev, base);
|
2021-03-24 07:49:16 -07:00
|
|
|
}
|
|
|
|
|
2021-08-29 05:43:52 -07:00
|
|
|
static const struct pci_device_id pvpanic_pci_id_tbl[] = {
|
|
|
|
{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)},
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl);
|
|
|
|
|
2021-03-24 07:49:16 -07:00
|
|
|
static struct pci_driver pvpanic_pci_driver = {
|
|
|
|
.name = "pvpanic-pci",
|
|
|
|
.id_table = pvpanic_pci_id_tbl,
|
|
|
|
.probe = pvpanic_pci_probe,
|
2024-04-11 14:33:51 -07:00
|
|
|
.dev_groups = pvpanic_dev_groups,
|
2021-03-24 07:49:16 -07:00
|
|
|
};
|
|
|
|
module_pci_driver(pvpanic_pci_driver);
|