pci-acpi.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * File pci-acpi.h
  3. *
  4. * Copyright (C) 2004 Intel
  5. * Copyright (C) Tom Long Nguyen (tom.l.nguyen@intel.com)
  6. */
  7. #ifndef _PCI_ACPI_H_
  8. #define _PCI_ACPI_H_
  9. #include <linux/acpi.h>
  10. #define OSC_QUERY_TYPE 0
  11. #define OSC_SUPPORT_TYPE 1
  12. #define OSC_CONTROL_TYPE 2
  13. #define OSC_SUPPORT_MASKS 0x1f
  14. /*
  15. * _OSC DW0 Definition
  16. */
  17. #define OSC_QUERY_ENABLE 1
  18. #define OSC_REQUEST_ERROR 2
  19. #define OSC_INVALID_UUID_ERROR 4
  20. #define OSC_INVALID_REVISION_ERROR 8
  21. #define OSC_CAPABILITIES_MASK_ERROR 16
  22. /*
  23. * _OSC DW1 Definition (OS Support Fields)
  24. */
  25. #define OSC_EXT_PCI_CONFIG_SUPPORT 1
  26. #define OSC_ACTIVE_STATE_PWR_SUPPORT 2
  27. #define OSC_CLOCK_PWR_CAPABILITY_SUPPORT 4
  28. #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 8
  29. #define OSC_MSI_SUPPORT 16
  30. /*
  31. * _OSC DW1 Definition (OS Control Fields)
  32. */
  33. #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 1
  34. #define OSC_SHPC_NATIVE_HP_CONTROL 2
  35. #define OSC_PCI_EXPRESS_PME_CONTROL 4
  36. #define OSC_PCI_EXPRESS_AER_CONTROL 8
  37. #define OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL 16
  38. #define OSC_CONTROL_MASKS (OSC_PCI_EXPRESS_NATIVE_HP_CONTROL | \
  39. OSC_SHPC_NATIVE_HP_CONTROL | \
  40. OSC_PCI_EXPRESS_PME_CONTROL | \
  41. OSC_PCI_EXPRESS_AER_CONTROL | \
  42. OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
  43. #ifdef CONFIG_ACPI
  44. extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
  45. static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
  46. {
  47. /* Find root host bridge */
  48. while (pdev->bus->self)
  49. pdev = pdev->bus->self;
  50. return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
  51. pdev->bus->number);
  52. }
  53. static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
  54. {
  55. int seg = pci_domain_nr(pbus), busnr = pbus->number;
  56. struct pci_dev *bridge = pbus->self;
  57. if (bridge)
  58. return DEVICE_ACPI_HANDLE(&(bridge->dev));
  59. return acpi_get_pci_rootbridge_handle(seg, busnr);
  60. }
  61. #else
  62. #if !defined(AE_ERROR)
  63. typedef u32 acpi_status;
  64. #define AE_ERROR (acpi_status) (0x0001)
  65. #endif
  66. static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
  67. {return AE_ERROR;}
  68. static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
  69. { return NULL; }
  70. #endif
  71. #endif /* _PCI_ACPI_H_ */