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