1
2#ifndef I7300_IDLE_H
3#define I7300_IDLE_H
4
5#include <linux/pci.h>
6
7
8
9
10
11#define IOAT_BUS 0
12#define IOAT_DEVFN PCI_DEVFN(8, 0)
13#define MEMCTL_BUS 0
14#define MEMCTL_DEVFN PCI_DEVFN(16, 1)
15
16struct fbd_ioat {
17 unsigned int vendor;
18 unsigned int ioat_dev;
19 unsigned int enabled;
20};
21
22
23
24
25
26
27
28
29static const struct fbd_ioat fbd_ioat_list[] = {
30 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB, 1},
31 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT, 0},
32 {0, 0}
33};
34
35
36static const struct pci_device_id pci_tbl[] = {
37 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) },
38 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
39 { }
40};
41
42
43static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
44 struct pci_dev **ioat_dev,
45 int enable_all)
46{
47 int i;
48 struct pci_dev *memdev, *dmadev;
49
50 memdev = pci_get_bus_and_slot(MEMCTL_BUS, MEMCTL_DEVFN);
51 if (!memdev)
52 return -ENODEV;
53
54 for (i = 0; pci_tbl[i].vendor != 0; i++) {
55 if (memdev->vendor == pci_tbl[i].vendor &&
56 memdev->device == pci_tbl[i].device) {
57 break;
58 }
59 }
60 if (pci_tbl[i].vendor == 0)
61 return -ENODEV;
62
63 dmadev = pci_get_bus_and_slot(IOAT_BUS, IOAT_DEVFN);
64 if (!dmadev)
65 return -ENODEV;
66
67 for (i = 0; fbd_ioat_list[i].vendor != 0; i++) {
68 if (dmadev->vendor == fbd_ioat_list[i].vendor &&
69 dmadev->device == fbd_ioat_list[i].ioat_dev) {
70 if (!(fbd_ioat_list[i].enabled || enable_all))
71 continue;
72 if (fbd_dev)
73 *fbd_dev = memdev;
74 if (ioat_dev)
75 *ioat_dev = dmadev;
76
77 return 0;
78 }
79 }
80 return -ENODEV;
81}
82
83#endif
84