i7300_idle.h 1.9 KB

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