dm thin metadata: fix __udivdi3 undefined on 32-bit
[linux/fpc-iii.git] / drivers / hwtracing / intel_th / pci.c
blobea85330603b23b7d4762cd65e08ed613c56f4a9a
1 /*
2 * Intel(R) Trace Hub pci driver
4 * Copyright (C) 2014-2015 Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
16 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18 #include <linux/types.h>
19 #include <linux/module.h>
20 #include <linux/device.h>
21 #include <linux/sysfs.h>
22 #include <linux/pci.h>
24 #include "intel_th.h"
26 #define DRIVER_NAME "intel_th_pci"
28 #define BAR_MASK (BIT(TH_MMIO_CONFIG) | BIT(TH_MMIO_SW))
30 static int intel_th_pci_probe(struct pci_dev *pdev,
31 const struct pci_device_id *id)
33 struct intel_th *th;
34 int err;
36 err = pcim_enable_device(pdev);
37 if (err)
38 return err;
40 err = pcim_iomap_regions_request_all(pdev, BAR_MASK, DRIVER_NAME);
41 if (err)
42 return err;
44 th = intel_th_alloc(&pdev->dev, pdev->resource,
45 DEVICE_COUNT_RESOURCE, pdev->irq);
46 if (IS_ERR(th))
47 return PTR_ERR(th);
49 pci_set_drvdata(pdev, th);
51 return 0;
54 static void intel_th_pci_remove(struct pci_dev *pdev)
56 struct intel_th *th = pci_get_drvdata(pdev);
58 intel_th_free(th);
61 static const struct pci_device_id intel_th_pci_id_table[] = {
63 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x9d26),
64 .driver_data = (kernel_ulong_t)0,
67 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa126),
68 .driver_data = (kernel_ulong_t)0,
71 /* Kaby Lake PCH-H */
72 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa2a6),
73 .driver_data = (kernel_ulong_t)0,
76 /* Cannon Lake H */
77 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa326),
78 .driver_data = (kernel_ulong_t)0,
81 /* Cannon Lake LP */
82 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x9da6),
83 .driver_data = (kernel_ulong_t)0,
86 /* Gemini Lake */
87 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x318e),
88 .driver_data = (kernel_ulong_t)0,
90 { 0 },
93 MODULE_DEVICE_TABLE(pci, intel_th_pci_id_table);
95 static struct pci_driver intel_th_pci_driver = {
96 .name = DRIVER_NAME,
97 .id_table = intel_th_pci_id_table,
98 .probe = intel_th_pci_probe,
99 .remove = intel_th_pci_remove,
102 module_pci_driver(intel_th_pci_driver);
104 MODULE_LICENSE("GPL v2");
105 MODULE_DESCRIPTION("Intel(R) Trace Hub PCI controller driver");
106 MODULE_AUTHOR("Alexander Shishkin <alexander.shishkin@intel.com>");