blob: 1587b7dec505ff182f6f5beceaee97907ecb9381 [file] [log] [blame]
Venki Pallipadi3ad0b022008-10-22 16:34:52 -07001
2#ifndef I7300_IDLE_H
3#define I7300_IDLE_H
4
5#include <linux/pci.h>
6
7/*
8 * I/O AT controls (PCI bus 0 device 8 function 0)
9 * DIMM controls (PCI bus 0 device 16 function 1)
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;
Len Brown2f102602009-05-27 23:59:58 -040019 unsigned int enabled;
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070020};
21
22/*
23 * The i5000 chip-set has the same hooks as the i7300
Len Brown2f102602009-05-27 23:59:58 -040024 * but it is not enabled by default and must be manually
25 * manually enabled with "forceload=1" because it is
26 * only lightly validated.
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070027 */
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070028
29static const struct fbd_ioat fbd_ioat_list[] = {
Len Brown2f102602009-05-27 23:59:58 -040030 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB, 1},
31 {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT, 0},
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070032 {0, 0}
33};
34
35/* table of devices that work with this driver */
36static const struct pci_device_id pci_tbl[] = {
37 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_FBD_CNB) },
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070038 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) },
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070039 { } /* Terminating entry */
40};
41
42/* Check for known platforms with I/O-AT */
43static inline int i7300_idle_platform_probe(struct pci_dev **fbd_dev,
Len Brown2f102602009-05-27 23:59:58 -040044 struct pci_dev **ioat_dev,
45 int enable_all)
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070046{
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) {
Len Brown2f102602009-05-27 23:59:58 -040070 if (!(fbd_ioat_list[i].enabled || enable_all))
71 continue;
Venki Pallipadi3ad0b022008-10-22 16:34:52 -070072 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