summaryrefslogtreecommitdiffstats
path: root/0001-add-pci_hw_vendor_status.patch
blob: 3c4f0b84563442dae40d84784dd1c90b592f1954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Mon, 18 Jun 2018 12:51:25 -0400
Subject: [PATCH] add pci_hw_vendor_status()

Message-id: <1529326285-28560-1-git-send-email-mlombard@redhat.com>
Patchwork-id: 222337
O-Subject: [RHEL8 PATCH] pci: add pci_hw_vendor_status()
Bugzilla: 1590829
RH-Acked-by: Tomas Henzl <thenzl@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>

This patch adds pci_hw_vendor_status() like in RHEL7 which should be called
during the driver's probe to identify deprecated devices.

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1590829
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=16761315

See RHEL7 commits e0dddd9a63403ec82077ed410074fc6485873d4b and
3fcddde5ddf4b190c84ce9d83d56a75137513bd7

RHEL_only.

Upstream Status: RHEL only
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
---
 drivers/pci/pci-driver.c | 29 +++++++++++++++++++++++++++++
 include/linux/pci.h      |  4 ++++
 2 files changed, 33 insertions(+)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index da6510af1221..2ec02cbfda72 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -18,6 +18,7 @@
 #include <linux/kexec.h>
 #include <linux/of_device.h>
 #include <linux/acpi.h>
+#include <linux/kernel.h>
 #include "pci.h"
 #include "pcie/portdrv.h"

@@ -278,6 +279,34 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
 	return found_id;
 }

+/**
+ * pci_hw_vendor_status - Tell if a PCI device is supported by the HW vendor
+ * @ids: array of PCI device id structures to search in
+ * @dev: the PCI device structure to match against
+ *
+ * Used by a driver to check whether this device is in its list of unsupported
+ * devices.  Returns the matching pci_device_id structure or %NULL if there is
+ * no match.
+ *
+ * Reserved for Internal Red Hat use only.
+ */
+const struct pci_device_id *pci_hw_vendor_status(
+						const struct pci_device_id *ids,
+						struct pci_dev *dev)
+{
+	char devinfo[64];
+	const struct pci_device_id *ret = pci_match_id(ids, dev);
+
+	if (ret) {
+		snprintf(devinfo, sizeof(devinfo), "%s %s",
+			 dev_driver_string(&dev->dev), dev_name(&dev->dev));
+		mark_hardware_deprecated(devinfo);
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(pci_hw_vendor_status);
+
 struct drv_dev_and_id {
 	struct pci_driver *drv;
 	struct pci_dev *dev;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f020eae17126..f7dc569f150d 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1406,6 +1406,10 @@ int pci_add_dynid(struct pci_driver *drv,
 		  unsigned long driver_data);
 const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
 					 struct pci_dev *dev);
+/* Reserved for Internal Red Hat use only */
+const struct pci_device_id *pci_hw_vendor_status(
+						const struct pci_device_id *ids,
+						struct pci_dev *dev);
 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 		    int pass);

-- 
2.26.2