diff options
author | Len Brown <len.brown@intel.com> | 2009-04-05 01:38:42 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-04-05 01:38:42 -0400 |
commit | e857b33d1879fc4284e3151222eee2415c1de88a (patch) | |
tree | 455f060a62e510046f1fdb060af4587c3eddb009 /drivers/acpi | |
parent | 9a38f4eec57cc5104b6a85bc6d0a91b268fbe803 (diff) | |
parent | 1c48aa36ef301d7b07674313bae65ef2496801a7 (diff) |
Merge branch 'bjorn-cleanups' into release
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 150 | ||||
-rw-r--r-- | drivers/acpi/pci_irq.c | 2 | ||||
-rw-r--r-- | drivers/acpi/pci_link.c | 147 |
3 files changed, 135 insertions, 164 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 8a851d0f4384..431f8b439553 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -11,9 +11,9 @@ menuconfig ACPI | |||
11 | select PNP | 11 | select PNP |
12 | select CPU_IDLE | 12 | select CPU_IDLE |
13 | default y | 13 | default y |
14 | ---help--- | 14 | help |
15 | Advanced Configuration and Power Interface (ACPI) support for | 15 | Advanced Configuration and Power Interface (ACPI) support for |
16 | Linux requires an ACPI compliant platform (hardware/firmware), | 16 | Linux requires an ACPI-compliant platform (hardware/firmware), |
17 | and assumes the presence of OS-directed configuration and power | 17 | and assumes the presence of OS-directed configuration and power |
18 | management (OSPM) software. This option will enlarge your | 18 | management (OSPM) software. This option will enlarge your |
19 | kernel by about 70K. | 19 | kernel by about 70K. |
@@ -23,20 +23,19 @@ menuconfig ACPI | |||
23 | the Plug-and-Play BIOS specification (PnP BIOS), the | 23 | the Plug-and-Play BIOS specification (PnP BIOS), the |
24 | MultiProcessor Specification (MPS), and the Advanced Power | 24 | MultiProcessor Specification (MPS), and the Advanced Power |
25 | Management (APM) specification. If both ACPI and APM support | 25 | Management (APM) specification. If both ACPI and APM support |
26 | are configured, whichever is loaded first shall be used. | 26 | are configured, ACPI is used. |
27 | 27 | ||
28 | The ACPI SourceForge project contains the latest source code, | 28 | The project home page for the Linux ACPI subsystem is here: |
29 | documentation, tools, mailing list subscription, and other | 29 | <http://www.lesswatts.org/projects/acpi/> |
30 | information. This project is available at: | ||
31 | <http://sourceforge.net/projects/acpi> | ||
32 | 30 | ||
33 | Linux support for ACPI is based on Intel Corporation's ACPI | 31 | Linux support for ACPI is based on Intel Corporation's ACPI |
34 | Component Architecture (ACPI CA). For more information see: | 32 | Component Architecture (ACPI CA). For more information on the |
35 | <http://developer.intel.com/technology/iapc/acpi> | 33 | ACPI CA, see: |
34 | <http://acpica.org/> | ||
36 | 35 | ||
37 | ACPI is an open industry specification co-developed by Compaq, | 36 | ACPI is an open industry specification co-developed by |
38 | Intel, Microsoft, Phoenix, and Toshiba. The specification is | 37 | Hewlett-Packard, Intel, Microsoft, Phoenix, and Toshiba. |
39 | available at: | 38 | The specification is available at: |
40 | <http://www.acpi.info> | 39 | <http://www.acpi.info> |
41 | 40 | ||
42 | if ACPI | 41 | if ACPI |
@@ -49,14 +48,14 @@ config ACPI_SLEEP | |||
49 | config ACPI_PROCFS | 48 | config ACPI_PROCFS |
50 | bool "Deprecated /proc/acpi files" | 49 | bool "Deprecated /proc/acpi files" |
51 | depends on PROC_FS | 50 | depends on PROC_FS |
52 | ---help--- | 51 | help |
53 | For backwards compatibility, this option allows | 52 | For backwards compatibility, this option allows |
54 | deprecated /proc/acpi/ files to exist, even when | 53 | deprecated /proc/acpi/ files to exist, even when |
55 | they have been replaced by functions in /sys. | 54 | they have been replaced by functions in /sys. |
56 | The deprecated files (and their replacements) include: | 55 | The deprecated files (and their replacements) include: |
57 | 56 | ||
58 | /proc/acpi/sleep (/sys/power/state) | 57 | /proc/acpi/sleep (/sys/power/state) |
59 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) | 58 | /proc/acpi/info (/sys/module/acpi/parameters/acpica_version) |
60 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) | 59 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) |
61 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) | 60 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) |
62 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) | 61 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) |
@@ -66,11 +65,12 @@ config ACPI_PROCFS | |||
66 | and functions which do not yet exist in /sys. | 65 | and functions which do not yet exist in /sys. |
67 | 66 | ||
68 | Say N to delete /proc/acpi/ files that have moved to /sys/ | 67 | Say N to delete /proc/acpi/ files that have moved to /sys/ |
68 | |||
69 | config ACPI_PROCFS_POWER | 69 | config ACPI_PROCFS_POWER |
70 | bool "Deprecated power /proc/acpi directories" | 70 | bool "Deprecated power /proc/acpi directories" |
71 | depends on PROC_FS | 71 | depends on PROC_FS |
72 | default y | 72 | default y |
73 | ---help--- | 73 | help |
74 | For backwards compatibility, this option allows | 74 | For backwards compatibility, this option allows |
75 | deprecated power /proc/acpi/ directories to exist, even when | 75 | deprecated power /proc/acpi/ directories to exist, even when |
76 | they have been replaced by functions in /sys. | 76 | they have been replaced by functions in /sys. |
@@ -86,19 +86,19 @@ config ACPI_SYSFS_POWER | |||
86 | bool "Future power /sys interface" | 86 | bool "Future power /sys interface" |
87 | select POWER_SUPPLY | 87 | select POWER_SUPPLY |
88 | default y | 88 | default y |
89 | ---help--- | 89 | help |
90 | Say N to disable power /sys interface | 90 | Say N to disable power /sys interface |
91 | 91 | ||
92 | config ACPI_PROC_EVENT | 92 | config ACPI_PROC_EVENT |
93 | bool "Deprecated /proc/acpi/event support" | 93 | bool "Deprecated /proc/acpi/event support" |
94 | depends on PROC_FS | 94 | depends on PROC_FS |
95 | default y | 95 | default y |
96 | ---help--- | 96 | help |
97 | A user-space daemon, acpi, typically read /proc/acpi/event | 97 | A user-space daemon, acpid, typically reads /proc/acpi/event |
98 | and handled all ACPI sub-system generated events. | 98 | and handles all ACPI-generated events. |
99 | 99 | ||
100 | These events are now delivered to user-space via | 100 | These events are now delivered to user-space either |
101 | either the input layer, or as netlink events. | 101 | via the input layer or as netlink events. |
102 | 102 | ||
103 | This build option enables the old code for legacy | 103 | This build option enables the old code for legacy |
104 | user-space implementation. After some time, this will | 104 | user-space implementation. After some time, this will |
@@ -112,10 +112,13 @@ config ACPI_AC | |||
112 | depends on X86 | 112 | depends on X86 |
113 | default y | 113 | default y |
114 | help | 114 | help |
115 | This driver adds support for the AC Adapter object, which indicates | 115 | This driver supports the AC Adapter object, which indicates |
116 | whether a system is on AC, or not. If you have a system that can | 116 | whether a system is on AC or not. If you have a system that can |
117 | switch between A/C and battery, say Y. | 117 | switch between A/C and battery, say Y. |
118 | 118 | ||
119 | To compile this driver as a module, choose M here: | ||
120 | the module will be called ac. | ||
121 | |||
119 | config ACPI_BATTERY | 122 | config ACPI_BATTERY |
120 | tristate "Battery" | 123 | tristate "Battery" |
121 | depends on X86 | 124 | depends on X86 |
@@ -125,15 +128,21 @@ config ACPI_BATTERY | |||
125 | /proc/acpi/battery. If you have a mobile system with a battery, | 128 | /proc/acpi/battery. If you have a mobile system with a battery, |
126 | say Y. | 129 | say Y. |
127 | 130 | ||
131 | To compile this driver as a module, choose M here: | ||
132 | the module will be called battery. | ||
133 | |||
128 | config ACPI_BUTTON | 134 | config ACPI_BUTTON |
129 | tristate "Button" | 135 | tristate "Button" |
130 | depends on INPUT | 136 | depends on INPUT |
131 | default y | 137 | default y |
132 | help | 138 | help |
133 | This driver handles events on the power, sleep and lid buttons. | 139 | This driver handles events on the power, sleep, and lid buttons. |
134 | A daemon reads /proc/acpi/event and perform user-defined actions | 140 | A daemon reads /proc/acpi/event and perform user-defined actions |
135 | such as shutting down the system. This is necessary for | 141 | such as shutting down the system. This is necessary for |
136 | software controlled poweroff. | 142 | software-controlled poweroff. |
143 | |||
144 | To compile this driver as a module, choose M here: | ||
145 | the module will be called button. | ||
137 | 146 | ||
138 | config ACPI_VIDEO | 147 | config ACPI_VIDEO |
139 | tristate "Video" | 148 | tristate "Video" |
@@ -141,38 +150,45 @@ config ACPI_VIDEO | |||
141 | depends on INPUT | 150 | depends on INPUT |
142 | select THERMAL | 151 | select THERMAL |
143 | help | 152 | help |
144 | This driver implement the ACPI Extensions For Display Adapters | 153 | This driver implements the ACPI Extensions For Display Adapters |
145 | for integrated graphics devices on motherboard, as specified in | 154 | for integrated graphics devices on motherboard, as specified in |
146 | ACPI 2.0 Specification, Appendix B, allowing to perform some basic | 155 | ACPI 2.0 Specification, Appendix B. This supports basic operations |
147 | control like defining the video POST device, retrieving EDID information | 156 | such as defining the video POST device, retrieving EDID information, |
148 | or to setup a video output, etc. | 157 | and setting up a video output. |
149 | Note that this is an ref. implementation only. It may or may not work | 158 | |
150 | for your integrated video device. | 159 | To compile this driver as a module, choose M here: |
160 | the module will be called video. | ||
151 | 161 | ||
152 | config ACPI_FAN | 162 | config ACPI_FAN |
153 | tristate "Fan" | 163 | tristate "Fan" |
154 | select THERMAL | 164 | select THERMAL |
155 | default y | 165 | default y |
156 | help | 166 | help |
157 | This driver adds support for ACPI fan devices, allowing user-mode | 167 | This driver supports ACPI fan devices, allowing user-mode |
158 | applications to perform basic fan control (on, off, status). | 168 | applications to perform basic fan control (on, off, status). |
159 | 169 | ||
170 | To compile this driver as a module, choose M here: | ||
171 | the module will be called fan. | ||
172 | |||
160 | config ACPI_DOCK | 173 | config ACPI_DOCK |
161 | bool "Dock" | 174 | bool "Dock" |
162 | depends on EXPERIMENTAL | 175 | depends on EXPERIMENTAL |
163 | help | 176 | help |
164 | This driver adds support for ACPI controlled docking stations and removable | 177 | This driver supports ACPI-controlled docking stations and removable |
165 | drive bays such as the IBM ultrabay or the Dell Module Bay. | 178 | drive bays such as the IBM Ultrabay and the Dell Module Bay. |
166 | 179 | ||
167 | config ACPI_PROCESSOR | 180 | config ACPI_PROCESSOR |
168 | tristate "Processor" | 181 | tristate "Processor" |
169 | select THERMAL | 182 | select THERMAL |
170 | default y | 183 | default y |
171 | help | 184 | help |
172 | This driver installs ACPI as the idle handler for Linux, and uses | 185 | This driver installs ACPI as the idle handler for Linux and uses |
173 | ACPI C2 and C3 processor states to save power, on systems that | 186 | ACPI C2 and C3 processor states to save power on systems that |
174 | support it. It is required by several flavors of cpufreq | 187 | support it. It is required by several flavors of cpufreq |
175 | Performance-state drivers. | 188 | performance-state drivers. |
189 | |||
190 | To compile this driver as a module, choose M here: | ||
191 | the module will be called processor. | ||
176 | 192 | ||
177 | config ACPI_HOTPLUG_CPU | 193 | config ACPI_HOTPLUG_CPU |
178 | bool | 194 | bool |
@@ -186,11 +202,14 @@ config ACPI_THERMAL | |||
186 | select THERMAL | 202 | select THERMAL |
187 | default y | 203 | default y |
188 | help | 204 | help |
189 | This driver adds support for ACPI thermal zones. Most mobile and | 205 | This driver supports ACPI thermal zones. Most mobile and |
190 | some desktop systems support ACPI thermal zones. It is HIGHLY | 206 | some desktop systems support ACPI thermal zones. It is HIGHLY |
191 | recommended that this option be enabled, as your processor(s) | 207 | recommended that this option be enabled, as your processor(s) |
192 | may be damaged without it. | 208 | may be damaged without it. |
193 | 209 | ||
210 | To compile this driver as a module, choose M here: | ||
211 | the module will be called thermal. | ||
212 | |||
194 | config ACPI_NUMA | 213 | config ACPI_NUMA |
195 | bool "NUMA support" | 214 | bool "NUMA support" |
196 | depends on NUMA | 215 | depends on NUMA |
@@ -218,7 +237,7 @@ config ACPI_BLACKLIST_YEAR | |||
218 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 | 237 | int "Disable ACPI for systems before Jan 1st this year" if X86_32 |
219 | default 0 | 238 | default 0 |
220 | help | 239 | help |
221 | enter a 4-digit year, eg. 2001 to disable ACPI by default | 240 | Enter a 4-digit year, e.g., 2001, to disable ACPI by default |
222 | on platforms with DMI BIOS date before January 1st that year. | 241 | on platforms with DMI BIOS date before January 1st that year. |
223 | "acpi=force" can be used to override this mechanism. | 242 | "acpi=force" can be used to override this mechanism. |
224 | 243 | ||
@@ -249,10 +268,13 @@ config ACPI_PCI_SLOT | |||
249 | tristate "PCI slot detection driver" | 268 | tristate "PCI slot detection driver" |
250 | default n | 269 | default n |
251 | help | 270 | help |
252 | This driver will attempt to discover all PCI slots in your system, | 271 | This driver creates entries in /sys/bus/pci/slots/ for all PCI |
253 | and creates entries in /sys/bus/pci/slots/. This feature can | 272 | slots in the system. This can help correlate PCI bus addresses, |
254 | help you correlate PCI bus addresses with the physical geography | 273 | i.e., segment/bus/device/function tuples, with physical slots in |
255 | of your slots. If you are unsure, say N. | 274 | the system. If you are unsure, say N. |
275 | |||
276 | To compile this driver as a module, choose M here: | ||
277 | the module will be called pci_slot. | ||
256 | 278 | ||
257 | config X86_PM_TIMER | 279 | config X86_PM_TIMER |
258 | bool "Power Management Timer Support" if EMBEDDED | 280 | bool "Power Management Timer Support" if EMBEDDED |
@@ -271,43 +293,43 @@ config X86_PM_TIMER | |||
271 | systems require this timer. | 293 | systems require this timer. |
272 | 294 | ||
273 | config ACPI_CONTAINER | 295 | config ACPI_CONTAINER |
274 | tristate "ACPI0004,PNP0A05 and PNP0A06 Container Driver (EXPERIMENTAL)" | 296 | tristate "Container and Module Devices (EXPERIMENTAL)" |
275 | depends on EXPERIMENTAL | 297 | depends on EXPERIMENTAL |
276 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) | 298 | default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) |
277 | ---help--- | 299 | help |
278 | This allows _physical_ insertion and removal of CPUs and memory. | 300 | This driver supports ACPI Container and Module devices (IDs |
279 | This can be useful, for example, on NUMA machines that support | 301 | ACPI0004, PNP0A05, and PNP0A06). |
280 | ACPI based physical hotplug of nodes, or non-NUMA machines that | ||
281 | support physical cpu/memory hot-plug. | ||
282 | 302 | ||
283 | If one selects "m", this driver can be loaded with | 303 | This helps support hotplug of nodes, CPUs, and memory. |
284 | "modprobe container". | 304 | |
305 | To compile this driver as a module, choose M here: | ||
306 | the module will be called container. | ||
285 | 307 | ||
286 | config ACPI_HOTPLUG_MEMORY | 308 | config ACPI_HOTPLUG_MEMORY |
287 | tristate "Memory Hotplug" | 309 | tristate "Memory Hotplug" |
288 | depends on MEMORY_HOTPLUG | 310 | depends on MEMORY_HOTPLUG |
289 | default n | 311 | default n |
290 | help | 312 | help |
291 | This driver adds supports for ACPI Memory Hotplug. This driver | 313 | This driver supports ACPI memory hotplug. The driver |
292 | provides support for fielding notifications on ACPI memory | 314 | fields notifications on ACPI memory devices (PNP0C80), |
293 | devices (PNP0C80) which represent memory ranges that may be | 315 | which represent memory ranges that may be onlined or |
294 | onlined or offlined during runtime. | 316 | offlined during runtime. |
295 | 317 | ||
296 | Enabling this driver assumes that your platform hardware | 318 | If your hardware and firmware do not support adding or |
297 | and firmware have support for hot-plugging physical memory. If | 319 | removing memory devices at runtime, you need not enable |
298 | your system does not support physically adding or ripping out | 320 | this driver. |
299 | memory DIMMs at some platform defined granularity (individually | ||
300 | or as a bank) at runtime, then you need not enable this driver. | ||
301 | 321 | ||
302 | If one selects "m," this driver can be loaded using the following | 322 | To compile this driver as a module, choose M here: |
303 | command: | 323 | the module will be called acpi_memhotplug. |
304 | $>modprobe acpi_memhotplug | ||
305 | 324 | ||
306 | config ACPI_SBS | 325 | config ACPI_SBS |
307 | tristate "Smart Battery System" | 326 | tristate "Smart Battery System" |
308 | depends on X86 | 327 | depends on X86 |
309 | help | 328 | help |
310 | This driver adds support for the Smart Battery System, another | 329 | This driver supports the Smart Battery System, another |
311 | type of access to battery information, found on some laptops. | 330 | type of access to battery information, found on some laptops. |
312 | 331 | ||
332 | To compile this driver as a module, choose M here: | ||
333 | the modules will be called sbs and sbshc. | ||
334 | |||
313 | endif # ACPI | 335 | endif # ACPI |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 891bdf6679f3..be6b9093f8df 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -319,7 +319,7 @@ static struct acpi_prt_entry *acpi_pci_irq_lookup(struct pci_dev *dev, int pin) | |||
319 | */ | 319 | */ |
320 | bridge = dev->bus->self; | 320 | bridge = dev->bus->self; |
321 | while (bridge) { | 321 | while (bridge) { |
322 | pin = (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1; | 322 | pin = pci_swizzle_interrupt_pin(dev, pin); |
323 | 323 | ||
324 | if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { | 324 | if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) { |
325 | /* PC card has the same IRQ as its cardbridge */ | 325 | /* PC card has the same IRQ as its cardbridge */ |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 6c772ca76bd1..16e0f9d3d17c 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -43,13 +43,14 @@ | |||
43 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
44 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
45 | 45 | ||
46 | #define _COMPONENT ACPI_PCI_COMPONENT | 46 | #define _COMPONENT ACPI_PCI_COMPONENT |
47 | ACPI_MODULE_NAME("pci_link"); | 47 | ACPI_MODULE_NAME("pci_link"); |
48 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" | 48 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" |
49 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" | 49 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" |
50 | #define ACPI_PCI_LINK_FILE_INFO "info" | 50 | #define ACPI_PCI_LINK_FILE_INFO "info" |
51 | #define ACPI_PCI_LINK_FILE_STATUS "state" | 51 | #define ACPI_PCI_LINK_FILE_STATUS "state" |
52 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 | 52 | #define ACPI_PCI_LINK_MAX_POSSIBLE 16 |
53 | |||
53 | static int acpi_pci_link_add(struct acpi_device *device); | 54 | static int acpi_pci_link_add(struct acpi_device *device); |
54 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 55 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
55 | 56 | ||
@@ -66,7 +67,7 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
66 | .ops = { | 67 | .ops = { |
67 | .add = acpi_pci_link_add, | 68 | .add = acpi_pci_link_add, |
68 | .remove = acpi_pci_link_remove, | 69 | .remove = acpi_pci_link_remove, |
69 | }, | 70 | }, |
70 | }; | 71 | }; |
71 | 72 | ||
72 | /* | 73 | /* |
@@ -76,7 +77,7 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
76 | struct acpi_pci_link_irq { | 77 | struct acpi_pci_link_irq { |
77 | u8 active; /* Current IRQ */ | 78 | u8 active; /* Current IRQ */ |
78 | u8 triggering; /* All IRQs */ | 79 | u8 triggering; /* All IRQs */ |
79 | u8 polarity; /* All IRQs */ | 80 | u8 polarity; /* All IRQs */ |
80 | u8 resource_type; | 81 | u8 resource_type; |
81 | u8 possible_count; | 82 | u8 possible_count; |
82 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 83 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
@@ -85,16 +86,13 @@ struct acpi_pci_link_irq { | |||
85 | }; | 86 | }; |
86 | 87 | ||
87 | struct acpi_pci_link { | 88 | struct acpi_pci_link { |
88 | struct list_head node; | 89 | struct list_head list; |
89 | struct acpi_device *device; | 90 | struct acpi_device *device; |
90 | struct acpi_pci_link_irq irq; | 91 | struct acpi_pci_link_irq irq; |
91 | int refcnt; | 92 | int refcnt; |
92 | }; | 93 | }; |
93 | 94 | ||
94 | static struct { | 95 | static LIST_HEAD(acpi_link_list); |
95 | int count; | ||
96 | struct list_head entries; | ||
97 | } acpi_link; | ||
98 | static DEFINE_MUTEX(acpi_link_lock); | 96 | static DEFINE_MUTEX(acpi_link_lock); |
99 | 97 | ||
100 | /* -------------------------------------------------------------------------- | 98 | /* -------------------------------------------------------------------------- |
@@ -104,12 +102,11 @@ static DEFINE_MUTEX(acpi_link_lock); | |||
104 | /* | 102 | /* |
105 | * set context (link) possible list from resource list | 103 | * set context (link) possible list from resource list |
106 | */ | 104 | */ |
107 | static acpi_status | 105 | static acpi_status acpi_pci_link_check_possible(struct acpi_resource *resource, |
108 | acpi_pci_link_check_possible(struct acpi_resource *resource, void *context) | 106 | void *context) |
109 | { | 107 | { |
110 | struct acpi_pci_link *link = context; | 108 | struct acpi_pci_link *link = context; |
111 | u32 i = 0; | 109 | u32 i; |
112 | |||
113 | 110 | ||
114 | switch (resource->type) { | 111 | switch (resource->type) { |
115 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 112 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -179,10 +176,6 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) | |||
179 | { | 176 | { |
180 | acpi_status status; | 177 | acpi_status status; |
181 | 178 | ||
182 | |||
183 | if (!link) | ||
184 | return -EINVAL; | ||
185 | |||
186 | status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS, | 179 | status = acpi_walk_resources(link->device->handle, METHOD_NAME__PRS, |
187 | acpi_pci_link_check_possible, link); | 180 | acpi_pci_link_check_possible, link); |
188 | if (ACPI_FAILURE(status)) { | 181 | if (ACPI_FAILURE(status)) { |
@@ -197,11 +190,10 @@ static int acpi_pci_link_get_possible(struct acpi_pci_link *link) | |||
197 | return 0; | 190 | return 0; |
198 | } | 191 | } |
199 | 192 | ||
200 | static acpi_status | 193 | static acpi_status acpi_pci_link_check_current(struct acpi_resource *resource, |
201 | acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | 194 | void *context) |
202 | { | 195 | { |
203 | int *irq = (int *)context; | 196 | int *irq = context; |
204 | |||
205 | 197 | ||
206 | switch (resource->type) { | 198 | switch (resource->type) { |
207 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 199 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -258,12 +250,9 @@ acpi_pci_link_check_current(struct acpi_resource *resource, void *context) | |||
258 | static int acpi_pci_link_get_current(struct acpi_pci_link *link) | 250 | static int acpi_pci_link_get_current(struct acpi_pci_link *link) |
259 | { | 251 | { |
260 | int result = 0; | 252 | int result = 0; |
261 | acpi_status status = AE_OK; | 253 | acpi_status status; |
262 | int irq = 0; | 254 | int irq = 0; |
263 | 255 | ||
264 | if (!link) | ||
265 | return -EINVAL; | ||
266 | |||
267 | link->irq.active = 0; | 256 | link->irq.active = 0; |
268 | 257 | ||
269 | /* in practice, status disabled is meaningless, ignore it */ | 258 | /* in practice, status disabled is meaningless, ignore it */ |
@@ -308,16 +297,15 @@ static int acpi_pci_link_get_current(struct acpi_pci_link *link) | |||
308 | 297 | ||
309 | static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) | 298 | static int acpi_pci_link_set(struct acpi_pci_link *link, int irq) |
310 | { | 299 | { |
311 | int result = 0; | 300 | int result; |
312 | acpi_status status = AE_OK; | 301 | acpi_status status; |
313 | struct { | 302 | struct { |
314 | struct acpi_resource res; | 303 | struct acpi_resource res; |
315 | struct acpi_resource end; | 304 | struct acpi_resource end; |
316 | } *resource; | 305 | } *resource; |
317 | struct acpi_buffer buffer = { 0, NULL }; | 306 | struct acpi_buffer buffer = { 0, NULL }; |
318 | 307 | ||
319 | 308 | if (!irq) | |
320 | if (!link || !irq) | ||
321 | return -EINVAL; | 309 | return -EINVAL; |
322 | 310 | ||
323 | resource = kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); | 311 | resource = kzalloc(sizeof(*resource) + 1, irqs_disabled() ? GFP_ATOMIC: GFP_KERNEL); |
@@ -479,30 +467,22 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = { | |||
479 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */ | 467 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */ |
480 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */ | 468 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */ |
481 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */ | 469 | PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */ |
482 | PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */ | 470 | PIRQ_PENALTY_ISA_USED, /* IRQ12 mouse */ |
483 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ | 471 | PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ |
484 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ | 472 | PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ |
485 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ | 473 | PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ |
486 | /* >IRQ15 */ | 474 | /* >IRQ15 */ |
487 | }; | 475 | }; |
488 | 476 | ||
489 | int __init acpi_irq_penalty_init(void) | 477 | int __init acpi_irq_penalty_init(void) |
490 | { | 478 | { |
491 | struct list_head *node = NULL; | 479 | struct acpi_pci_link *link; |
492 | struct acpi_pci_link *link = NULL; | 480 | int i; |
493 | int i = 0; | ||
494 | |||
495 | 481 | ||
496 | /* | 482 | /* |
497 | * Update penalties to facilitate IRQ balancing. | 483 | * Update penalties to facilitate IRQ balancing. |
498 | */ | 484 | */ |
499 | list_for_each(node, &acpi_link.entries) { | 485 | list_for_each_entry(link, &acpi_link_list, list) { |
500 | |||
501 | link = list_entry(node, struct acpi_pci_link, node); | ||
502 | if (!link) { | ||
503 | printk(KERN_ERR PREFIX "Invalid link context\n"); | ||
504 | continue; | ||
505 | } | ||
506 | 486 | ||
507 | /* | 487 | /* |
508 | * reflect the possible and active irqs in the penalty table -- | 488 | * reflect the possible and active irqs in the penalty table -- |
@@ -527,7 +507,6 @@ int __init acpi_irq_penalty_init(void) | |||
527 | } | 507 | } |
528 | /* Add a penalty for the SCI */ | 508 | /* Add a penalty for the SCI */ |
529 | acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING; | 509 | acpi_irq_penalty[acpi_gbl_FADT.sci_interrupt] += PIRQ_PENALTY_PCI_USING; |
530 | |||
531 | return 0; | 510 | return 0; |
532 | } | 511 | } |
533 | 512 | ||
@@ -538,7 +517,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
538 | int irq; | 517 | int irq; |
539 | int i; | 518 | int i; |
540 | 519 | ||
541 | |||
542 | if (link->irq.initialized) { | 520 | if (link->irq.initialized) { |
543 | if (link->refcnt == 0) | 521 | if (link->refcnt == 0) |
544 | /* This means the link is disabled but initialized */ | 522 | /* This means the link is disabled but initialized */ |
@@ -566,11 +544,10 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
566 | /* | 544 | /* |
567 | * if active found, use it; else pick entry from end of possible list. | 545 | * if active found, use it; else pick entry from end of possible list. |
568 | */ | 546 | */ |
569 | if (link->irq.active) { | 547 | if (link->irq.active) |
570 | irq = link->irq.active; | 548 | irq = link->irq.active; |
571 | } else { | 549 | else |
572 | irq = link->irq.possible[link->irq.possible_count - 1]; | 550 | irq = link->irq.possible[link->irq.possible_count - 1]; |
573 | } | ||
574 | 551 | ||
575 | if (acpi_irq_balance || !link->irq.active) { | 552 | if (acpi_irq_balance || !link->irq.active) { |
576 | /* | 553 | /* |
@@ -599,7 +576,6 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
599 | } | 576 | } |
600 | 577 | ||
601 | link->irq.initialized = 1; | 578 | link->irq.initialized = 1; |
602 | |||
603 | return 0; | 579 | return 0; |
604 | } | 580 | } |
605 | 581 | ||
@@ -608,16 +584,12 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link) | |||
608 | * success: return IRQ >= 0 | 584 | * success: return IRQ >= 0 |
609 | * failure: return -1 | 585 | * failure: return -1 |
610 | */ | 586 | */ |
611 | 587 | int acpi_pci_link_allocate_irq(acpi_handle handle, int index, int *triggering, | |
612 | int | 588 | int *polarity, char **name) |
613 | acpi_pci_link_allocate_irq(acpi_handle handle, | ||
614 | int index, | ||
615 | int *triggering, int *polarity, char **name) | ||
616 | { | 589 | { |
617 | int result = 0; | 590 | int result; |
618 | struct acpi_device *device = NULL; | 591 | struct acpi_device *device; |
619 | struct acpi_pci_link *link = NULL; | 592 | struct acpi_pci_link *link; |
620 | |||
621 | 593 | ||
622 | result = acpi_bus_get_device(handle, &device); | 594 | result = acpi_bus_get_device(handle, &device); |
623 | if (result) { | 595 | if (result) { |
@@ -669,11 +641,10 @@ acpi_pci_link_allocate_irq(acpi_handle handle, | |||
669 | */ | 641 | */ |
670 | int acpi_pci_link_free_irq(acpi_handle handle) | 642 | int acpi_pci_link_free_irq(acpi_handle handle) |
671 | { | 643 | { |
672 | struct acpi_device *device = NULL; | 644 | struct acpi_device *device; |
673 | struct acpi_pci_link *link = NULL; | 645 | struct acpi_pci_link *link; |
674 | acpi_status result; | 646 | acpi_status result; |
675 | 647 | ||
676 | |||
677 | result = acpi_bus_get_device(handle, &device); | 648 | result = acpi_bus_get_device(handle, &device); |
678 | if (result) { | 649 | if (result) { |
679 | printk(KERN_ERR PREFIX "Invalid link device\n"); | 650 | printk(KERN_ERR PREFIX "Invalid link device\n"); |
@@ -708,9 +679,9 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
708 | "Link %s is dereferenced\n", | 679 | "Link %s is dereferenced\n", |
709 | acpi_device_bid(link->device))); | 680 | acpi_device_bid(link->device))); |
710 | 681 | ||
711 | if (link->refcnt == 0) { | 682 | if (link->refcnt == 0) |
712 | acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); | 683 | acpi_evaluate_object(link->device->handle, "_DIS", NULL, NULL); |
713 | } | 684 | |
714 | mutex_unlock(&acpi_link_lock); | 685 | mutex_unlock(&acpi_link_lock); |
715 | return (link->irq.active); | 686 | return (link->irq.active); |
716 | } | 687 | } |
@@ -721,15 +692,11 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
721 | 692 | ||
722 | static int acpi_pci_link_add(struct acpi_device *device) | 693 | static int acpi_pci_link_add(struct acpi_device *device) |
723 | { | 694 | { |
724 | int result = 0; | 695 | int result; |
725 | struct acpi_pci_link *link = NULL; | 696 | struct acpi_pci_link *link; |
726 | int i = 0; | 697 | int i; |
727 | int found = 0; | 698 | int found = 0; |
728 | 699 | ||
729 | |||
730 | if (!device) | ||
731 | return -EINVAL; | ||
732 | |||
733 | link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); | 700 | link = kzalloc(sizeof(struct acpi_pci_link), GFP_KERNEL); |
734 | if (!link) | 701 | if (!link) |
735 | return -ENOMEM; | 702 | return -ENOMEM; |
@@ -767,9 +734,7 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
767 | 734 | ||
768 | printk("\n"); | 735 | printk("\n"); |
769 | 736 | ||
770 | /* TBD: Acquire/release lock */ | 737 | list_add_tail(&link->list, &acpi_link_list); |
771 | list_add_tail(&link->node, &acpi_link.entries); | ||
772 | acpi_link.count++; | ||
773 | 738 | ||
774 | end: | 739 | end: |
775 | /* disable all links -- to be activated on use */ | 740 | /* disable all links -- to be activated on use */ |
@@ -784,24 +749,17 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
784 | 749 | ||
785 | static int acpi_pci_link_resume(struct acpi_pci_link *link) | 750 | static int acpi_pci_link_resume(struct acpi_pci_link *link) |
786 | { | 751 | { |
787 | |||
788 | if (link->refcnt && link->irq.active && link->irq.initialized) | 752 | if (link->refcnt && link->irq.active && link->irq.initialized) |
789 | return (acpi_pci_link_set(link, link->irq.active)); | 753 | return (acpi_pci_link_set(link, link->irq.active)); |
790 | else | 754 | |
791 | return 0; | 755 | return 0; |
792 | } | 756 | } |
793 | 757 | ||
794 | static int irqrouter_resume(struct sys_device *dev) | 758 | static int irqrouter_resume(struct sys_device *dev) |
795 | { | 759 | { |
796 | struct list_head *node = NULL; | 760 | struct acpi_pci_link *link; |
797 | struct acpi_pci_link *link = NULL; | ||
798 | 761 | ||
799 | list_for_each(node, &acpi_link.entries) { | 762 | list_for_each_entry(link, &acpi_link_list, list) { |
800 | link = list_entry(node, struct acpi_pci_link, node); | ||
801 | if (!link) { | ||
802 | printk(KERN_ERR PREFIX "Invalid link context\n"); | ||
803 | continue; | ||
804 | } | ||
805 | acpi_pci_link_resume(link); | 763 | acpi_pci_link_resume(link); |
806 | } | 764 | } |
807 | return 0; | 765 | return 0; |
@@ -809,20 +767,15 @@ static int irqrouter_resume(struct sys_device *dev) | |||
809 | 767 | ||
810 | static int acpi_pci_link_remove(struct acpi_device *device, int type) | 768 | static int acpi_pci_link_remove(struct acpi_device *device, int type) |
811 | { | 769 | { |
812 | struct acpi_pci_link *link = NULL; | 770 | struct acpi_pci_link *link; |
813 | |||
814 | |||
815 | if (!device || !acpi_driver_data(device)) | ||
816 | return -EINVAL; | ||
817 | 771 | ||
818 | link = acpi_driver_data(device); | 772 | link = acpi_driver_data(device); |
819 | 773 | ||
820 | mutex_lock(&acpi_link_lock); | 774 | mutex_lock(&acpi_link_lock); |
821 | list_del(&link->node); | 775 | list_del(&link->list); |
822 | mutex_unlock(&acpi_link_lock); | 776 | mutex_unlock(&acpi_link_lock); |
823 | 777 | ||
824 | kfree(link); | 778 | kfree(link); |
825 | |||
826 | return 0; | 779 | return 0; |
827 | } | 780 | } |
828 | 781 | ||
@@ -931,7 +884,6 @@ static int __init irqrouter_init_sysfs(void) | |||
931 | { | 884 | { |
932 | int error; | 885 | int error; |
933 | 886 | ||
934 | |||
935 | if (acpi_disabled || acpi_noirq) | 887 | if (acpi_disabled || acpi_noirq) |
936 | return 0; | 888 | return 0; |
937 | 889 | ||
@@ -957,9 +909,6 @@ static int __init acpi_pci_link_init(void) | |||
957 | acpi_irq_balance = 0; | 909 | acpi_irq_balance = 0; |
958 | } | 910 | } |
959 | 911 | ||
960 | acpi_link.count = 0; | ||
961 | INIT_LIST_HEAD(&acpi_link.entries); | ||
962 | |||
963 | if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) | 912 | if (acpi_bus_register_driver(&acpi_pci_link_driver) < 0) |
964 | return -ENODEV; | 913 | return -ENODEV; |
965 | 914 | ||