Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
3ad0b02e VP |
2 | |
3 | #ifndef I7300_IDLE_H | |
4 | #define I7300_IDLE_H | |
5 | ||
6 | #include <linux/pci.h> | |
7 | ||
8 | /* | |
9 | * I/O AT controls (PCI bus 0 device 8 function 0) | |
10 | * DIMM controls (PCI bus 0 device 16 function 1) | |
11 | */ | |
12 | #define IOAT_BUS 0 | |
13 | #define IOAT_DEVFN PCI_DEVFN(8, 0) | |
14 | #define MEMCTL_BUS 0 | |
15 | #define MEMCTL_DEVFN PCI_DEVFN(16, 1) | |
16 | ||
17 | struct fbd_ioat { | |
18 | unsigned int vendor; | |
19 | unsigned int ioat_dev; | |
2f102607 | 20 | unsigned int enabled; |
3ad0b02e VP |
21 | }; |
22 | ||
23 | /* | |
24 | * The i5000 chip-set has the same hooks as the i7300 | |
2f102607 LB |
25 | * but it is not enabled by default and must be manually |
26 | * manually enabled with "forceload=1" because it is | |
27 | * only lightly validated. | |
3ad0b02e | 28 | */ |
3ad0b02e VP |
29 | |
30 | static const struct fbd_ioat fbd_ioat_list[] = { | |
2f102607 LB |
31 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB, 1}, |
32 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT, 0}, | |
3ad0b02e VP |
33 | {0, 0} |
34 | }; | |
35 | ||
36 | /* table of devices that work with this driver */ | |
37 | static const struct pci_device_id pci_tbl[] = { | |
38 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) }, | |
3ad0b02e | 39 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, |
3ad0b02e VP |
40 | { } /* Terminating entry */ |
41 | }; | |
42 | ||
43 | /* Check for known platforms with I/O-AT */ | |
44 | static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev, | |
2f102607 LB |
45 | struct pci_dev **ioat_dev, |
46 | int enable_all) | |
3ad0b02e VP |
47 | { |
48 | int i; | |
49 | struct pci_dev *memdev, *dmadev; | |
50 | ||
51 | memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN); | |
52 | if (!memdev) | |
53 | return -ENODEV; | |
54 | ||
55 | for (i = 0; pci_tbl[i].vendor != 0; i++) { | |
56 | if (memdev->vendor == pci_tbl[i].vendor && | |
57 | memdev->device == pci_tbl[i].device) { | |
58 | break; | |
59 | } | |
60 | } | |
61 | if (pci_tbl[i].vendor == 0) | |
62 | return -ENODEV; | |
63 | ||
64 | dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN); | |
65 | if (!dmadev) | |
66 | return -ENODEV; | |
67 | ||
68 | for (i = 0; fbd_ioat_list[i].vendor != 0; i++) { | |
69 | if (dmadev->vendor == fbd_ioat_list[i].vendor && | |
70 | dmadev->device == fbd_ioat_list[i].ioat_dev) { | |
2f102607 LB |
71 | if (!(fbd_ioat_list[i].enabled || enable_all)) |
72 | continue; | |
3ad0b02e VP |
73 | if (fbd_dev) |
74 | *fbd_dev = memdev; | |
75 | if (ioat_dev) | |
76 | *ioat_dev = dmadev; | |
77 | ||
78 | return 0; | |
79 | } | |
80 | } | |
81 | return -ENODEV; | |
82 | } | |
83 | ||
84 | #endif |