pci-acpi.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. int pci_acpi_osc_support(acpi_handle handle, u32 flags);
  46. static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
  47. {
  48. /* Find root host bridge */
  49. while (pdev->bus->self)
  50. pdev = pdev->bus->self;
  51. return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
  52. pdev->bus->number);
  53. }
  54. static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
  55. {
  56. int seg = pci_domain_nr(pbus), busnr = pbus->number;
  57. struct pci_dev *bridge = pbus->self;
  58. if (bridge)
  59. return DEVICE_ACPI_HANDLE(&(bridge->dev));
  60. return acpi_get_pci_rootbridge_handle(seg, busnr);
  61. }
  62. #else
  63. #if !defined(AE_ERROR)
  64. typedef u32 acpi_status;
  65. #define AE_ERROR (acpi_status) (0x0001)
  66. #endif
  67. static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
  68. {return AE_ERROR;}
  69. static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
  70. { return NULL; }
  71. #endif
  72. #endif /* _PCI_ACPI_H_ */