Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 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; |
Len Brown | 2f10260 | 2009-05-27 23:59:58 -0400 | [diff] [blame] | 20 | unsigned int enabled; |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | /* |
| 24 | * The i5000 chip-set has the same hooks as the i7300 |
Len Brown | 2f10260 | 2009-05-27 23:59:58 -0400 | [diff] [blame] | 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. |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 28 | */ |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 29 | |
| 30 | static const struct fbd_ioat fbd_ioat_list[] = { |
Len Brown | 2f10260 | 2009-05-27 23:59:58 -0400 | [diff] [blame] | 31 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_CNB, 1}, |
| 32 | {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT, 0}, |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 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) }, |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 39 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 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, |
Len Brown | 2f10260 | 2009-05-27 23:59:58 -0400 | [diff] [blame] | 45 | struct pci_dev **ioat_dev, |
| 46 | int enable_all) |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 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) { |
Len Brown | 2f10260 | 2009-05-27 23:59:58 -0400 | [diff] [blame] | 71 | if (!(fbd_ioat_list[i].enabled || enable_all)) |
| 72 | continue; |
Venki Pallipadi | 3ad0b02 | 2008-10-22 16:34:52 -0700 | [diff] [blame] | 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 |