diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:52:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:52:36 -0400 |
commit | 37224470c8c6d90a4062e76a08d4dc1fcf91fc89 (patch) | |
tree | 627f537177bf8e951c12bec04c4a85f0125f5ece | |
parent | e83319510b04dd51a60da8a0b4ccf8b92b3ab1ad (diff) | |
parent | ae6c859b7dcd708efadf1c76279c33db213e3506 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (65 commits)
ACPI: suppress power button event on S3 resume
ACPI: resolve merge conflict between sem2mutex and processor_perflib.c
ACPI: use for_each_possible_cpu() instead of for_each_cpu()
ACPI: delete newly added debugging macros in processor_perflib.c
ACPI: UP build fix for bugzilla-5737
Enable P-state software coordination via _PDC
P-state software coordination for speedstep-centrino
P-state software coordination for acpi-cpufreq
P-state software coordination for ACPI core
ACPI: create acpi_thermal_resume()
ACPI: create acpi_fan_suspend()/acpi_fan_resume()
ACPI: pass pm_message_t from acpi_device_suspend() to root_suspend()
ACPI: create acpi_device_suspend()/acpi_device_resume()
ACPI: replace spin_lock_irq with mutex for ec poll mode
ACPI: Allow a WAN module enable/disable on a Thinkpad X60.
sem2mutex: acpi, acpi_link_lock
ACPI: delete unused acpi_bus_drivers_lock
sem2mutex: drivers/acpi/processor_perflib.c
ACPI add ia64 exports to build acpi_memhotplug as a module
ACPI: asus_acpi_init(): propagate correct return value
...
Manual resolve of conflicts in:
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
include/acpi/processor.h
177 files changed, 6369 insertions, 5048 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index a9d3a1794b23..bca6f389da66 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -147,6 +147,9 @@ running once the system is up. | |||
147 | acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA | 147 | acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA |
148 | Format: <irq>,<irq>... | 148 | Format: <irq>,<irq>... |
149 | 149 | ||
150 | acpi_os_name= [HW,ACPI] Tell ACPI BIOS the name of the OS | ||
151 | Format: To spoof as Windows 98: ="Microsoft Windows" | ||
152 | |||
150 | acpi_osi= [HW,ACPI] empty param disables _OSI | 153 | acpi_osi= [HW,ACPI] empty param disables _OSI |
151 | 154 | ||
152 | acpi_serialize [HW,ACPI] force serialization of AML methods | 155 | acpi_serialize [HW,ACPI] force serialization of AML methods |
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c index fbe93084244c..97ca17189af5 100644 --- a/arch/i386/kernel/acpi/boot.c +++ b/arch/i386/kernel/acpi/boot.c | |||
@@ -217,7 +217,7 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) | |||
217 | { | 217 | { |
218 | struct acpi_table_madt *madt = NULL; | 218 | struct acpi_table_madt *madt = NULL; |
219 | 219 | ||
220 | if (!phys_addr || !size) | 220 | if (!phys_addr || !size || !cpu_has_apic) |
221 | return -EINVAL; | 221 | return -EINVAL; |
222 | 222 | ||
223 | madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); | 223 | madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size); |
@@ -623,9 +623,9 @@ extern u32 pmtmr_ioport; | |||
623 | 623 | ||
624 | static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) | 624 | static int __init acpi_parse_fadt(unsigned long phys, unsigned long size) |
625 | { | 625 | { |
626 | struct fadt_descriptor_rev2 *fadt = NULL; | 626 | struct fadt_descriptor *fadt = NULL; |
627 | 627 | ||
628 | fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size); | 628 | fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size); |
629 | if (!fadt) { | 629 | if (!fadt) { |
630 | printk(KERN_WARNING PREFIX "Unable to map FADT\n"); | 630 | printk(KERN_WARNING PREFIX "Unable to map FADT\n"); |
631 | return 0; | 631 | return 0; |
@@ -756,7 +756,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) | |||
756 | return -ENODEV; | 756 | return -ENODEV; |
757 | } | 757 | } |
758 | 758 | ||
759 | if (!cpu_has_apic) | 759 | if (!cpu_has_apic) |
760 | return -ENODEV; | 760 | return -ENODEV; |
761 | 761 | ||
762 | /* | 762 | /* |
diff --git a/arch/i386/kernel/acpi/processor.c b/arch/i386/kernel/acpi/processor.c index 9f4cc02717ec..b54fded49834 100644 --- a/arch/i386/kernel/acpi/processor.c +++ b/arch/i386/kernel/acpi/processor.c | |||
@@ -47,7 +47,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) | |||
47 | buf[2] = ACPI_PDC_C_CAPABILITY_SMP; | 47 | buf[2] = ACPI_PDC_C_CAPABILITY_SMP; |
48 | 48 | ||
49 | if (cpu_has(c, X86_FEATURE_EST)) | 49 | if (cpu_has(c, X86_FEATURE_EST)) |
50 | buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP; | 50 | buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; |
51 | 51 | ||
52 | obj->type = ACPI_TYPE_BUFFER; | 52 | obj->type = ACPI_TYPE_BUFFER; |
53 | obj->buffer.length = 12; | 53 | obj->buffer.length = 12; |
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c index 1a7bdcef1926..05668e3598c0 100644 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -48,12 +48,13 @@ MODULE_LICENSE("GPL"); | |||
48 | 48 | ||
49 | 49 | ||
50 | struct cpufreq_acpi_io { | 50 | struct cpufreq_acpi_io { |
51 | struct acpi_processor_performance acpi_data; | 51 | struct acpi_processor_performance *acpi_data; |
52 | struct cpufreq_frequency_table *freq_table; | 52 | struct cpufreq_frequency_table *freq_table; |
53 | unsigned int resume; | 53 | unsigned int resume; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; | 56 | static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; |
57 | static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; | ||
57 | 58 | ||
58 | static struct cpufreq_driver acpi_cpufreq_driver; | 59 | static struct cpufreq_driver acpi_cpufreq_driver; |
59 | 60 | ||
@@ -104,64 +105,43 @@ acpi_processor_set_performance ( | |||
104 | { | 105 | { |
105 | u16 port = 0; | 106 | u16 port = 0; |
106 | u8 bit_width = 0; | 107 | u8 bit_width = 0; |
107 | int ret; | ||
108 | u32 value = 0; | ||
109 | int i = 0; | 108 | int i = 0; |
110 | struct cpufreq_freqs cpufreq_freqs; | 109 | int ret = 0; |
111 | cpumask_t saved_mask; | 110 | u32 value = 0; |
112 | int retval; | 111 | int retval; |
112 | struct acpi_processor_performance *perf; | ||
113 | 113 | ||
114 | dprintk("acpi_processor_set_performance\n"); | 114 | dprintk("acpi_processor_set_performance\n"); |
115 | 115 | ||
116 | /* | 116 | retval = 0; |
117 | * TBD: Use something other than set_cpus_allowed. | 117 | perf = data->acpi_data; |
118 | * As set_cpus_allowed is a bit racy, | 118 | if (state == perf->state) { |
119 | * with any other set_cpus_allowed for this process. | ||
120 | */ | ||
121 | saved_mask = current->cpus_allowed; | ||
122 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
123 | if (smp_processor_id() != cpu) { | ||
124 | return (-EAGAIN); | ||
125 | } | ||
126 | |||
127 | if (state == data->acpi_data.state) { | ||
128 | if (unlikely(data->resume)) { | 119 | if (unlikely(data->resume)) { |
129 | dprintk("Called after resume, resetting to P%d\n", state); | 120 | dprintk("Called after resume, resetting to P%d\n", state); |
130 | data->resume = 0; | 121 | data->resume = 0; |
131 | } else { | 122 | } else { |
132 | dprintk("Already at target state (P%d)\n", state); | 123 | dprintk("Already at target state (P%d)\n", state); |
133 | retval = 0; | 124 | return (retval); |
134 | goto migrate_end; | ||
135 | } | 125 | } |
136 | } | 126 | } |
137 | 127 | ||
138 | dprintk("Transitioning from P%d to P%d\n", | 128 | dprintk("Transitioning from P%d to P%d\n", perf->state, state); |
139 | data->acpi_data.state, state); | ||
140 | |||
141 | /* cpufreq frequency struct */ | ||
142 | cpufreq_freqs.cpu = cpu; | ||
143 | cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency; | ||
144 | cpufreq_freqs.new = data->freq_table[state].frequency; | ||
145 | |||
146 | /* notify cpufreq */ | ||
147 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | ||
148 | 129 | ||
149 | /* | 130 | /* |
150 | * First we write the target state's 'control' value to the | 131 | * First we write the target state's 'control' value to the |
151 | * control_register. | 132 | * control_register. |
152 | */ | 133 | */ |
153 | 134 | ||
154 | port = data->acpi_data.control_register.address; | 135 | port = perf->control_register.address; |
155 | bit_width = data->acpi_data.control_register.bit_width; | 136 | bit_width = perf->control_register.bit_width; |
156 | value = (u32) data->acpi_data.states[state].control; | 137 | value = (u32) perf->states[state].control; |
157 | 138 | ||
158 | dprintk("Writing 0x%08x to port 0x%04x\n", value, port); | 139 | dprintk("Writing 0x%08x to port 0x%04x\n", value, port); |
159 | 140 | ||
160 | ret = acpi_processor_write_port(port, bit_width, value); | 141 | ret = acpi_processor_write_port(port, bit_width, value); |
161 | if (ret) { | 142 | if (ret) { |
162 | dprintk("Invalid port width 0x%04x\n", bit_width); | 143 | dprintk("Invalid port width 0x%04x\n", bit_width); |
163 | retval = ret; | 144 | return (ret); |
164 | goto migrate_end; | ||
165 | } | 145 | } |
166 | 146 | ||
167 | /* | 147 | /* |
@@ -177,48 +157,35 @@ acpi_processor_set_performance ( | |||
177 | * before giving up. | 157 | * before giving up. |
178 | */ | 158 | */ |
179 | 159 | ||
180 | port = data->acpi_data.status_register.address; | 160 | port = perf->status_register.address; |
181 | bit_width = data->acpi_data.status_register.bit_width; | 161 | bit_width = perf->status_register.bit_width; |
182 | 162 | ||
183 | dprintk("Looking for 0x%08x from port 0x%04x\n", | 163 | dprintk("Looking for 0x%08x from port 0x%04x\n", |
184 | (u32) data->acpi_data.states[state].status, port); | 164 | (u32) perf->states[state].status, port); |
185 | 165 | ||
186 | for (i=0; i<100; i++) { | 166 | for (i = 0; i < 100; i++) { |
187 | ret = acpi_processor_read_port(port, bit_width, &value); | 167 | ret = acpi_processor_read_port(port, bit_width, &value); |
188 | if (ret) { | 168 | if (ret) { |
189 | dprintk("Invalid port width 0x%04x\n", bit_width); | 169 | dprintk("Invalid port width 0x%04x\n", bit_width); |
190 | retval = ret; | 170 | return (ret); |
191 | goto migrate_end; | ||
192 | } | 171 | } |
193 | if (value == (u32) data->acpi_data.states[state].status) | 172 | if (value == (u32) perf->states[state].status) |
194 | break; | 173 | break; |
195 | udelay(10); | 174 | udelay(10); |
196 | } | 175 | } |
197 | } else { | 176 | } else { |
198 | value = (u32) data->acpi_data.states[state].status; | 177 | value = (u32) perf->states[state].status; |
199 | } | 178 | } |
200 | 179 | ||
201 | /* notify cpufreq */ | 180 | if (unlikely(value != (u32) perf->states[state].status)) { |
202 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | ||
203 | |||
204 | if (unlikely(value != (u32) data->acpi_data.states[state].status)) { | ||
205 | unsigned int tmp = cpufreq_freqs.new; | ||
206 | cpufreq_freqs.new = cpufreq_freqs.old; | ||
207 | cpufreq_freqs.old = tmp; | ||
208 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | ||
209 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | ||
210 | printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); | 181 | printk(KERN_WARNING "acpi-cpufreq: Transition failed\n"); |
211 | retval = -ENODEV; | 182 | retval = -ENODEV; |
212 | goto migrate_end; | 183 | return (retval); |
213 | } | 184 | } |
214 | 185 | ||
215 | dprintk("Transition successful after %d microseconds\n", i * 10); | 186 | dprintk("Transition successful after %d microseconds\n", i * 10); |
216 | 187 | ||
217 | data->acpi_data.state = state; | 188 | perf->state = state; |
218 | |||
219 | retval = 0; | ||
220 | migrate_end: | ||
221 | set_cpus_allowed(current, saved_mask); | ||
222 | return (retval); | 189 | return (retval); |
223 | } | 190 | } |
224 | 191 | ||
@@ -230,8 +197,17 @@ acpi_cpufreq_target ( | |||
230 | unsigned int relation) | 197 | unsigned int relation) |
231 | { | 198 | { |
232 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | 199 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; |
200 | struct acpi_processor_performance *perf; | ||
201 | struct cpufreq_freqs freqs; | ||
202 | cpumask_t online_policy_cpus; | ||
203 | cpumask_t saved_mask; | ||
204 | cpumask_t set_mask; | ||
205 | cpumask_t covered_cpus; | ||
206 | unsigned int cur_state = 0; | ||
233 | unsigned int next_state = 0; | 207 | unsigned int next_state = 0; |
234 | unsigned int result = 0; | 208 | unsigned int result = 0; |
209 | unsigned int j; | ||
210 | unsigned int tmp; | ||
235 | 211 | ||
236 | dprintk("acpi_cpufreq_setpolicy\n"); | 212 | dprintk("acpi_cpufreq_setpolicy\n"); |
237 | 213 | ||
@@ -240,11 +216,95 @@ acpi_cpufreq_target ( | |||
240 | target_freq, | 216 | target_freq, |
241 | relation, | 217 | relation, |
242 | &next_state); | 218 | &next_state); |
243 | if (result) | 219 | if (unlikely(result)) |
244 | return (result); | 220 | return (result); |
245 | 221 | ||
246 | result = acpi_processor_set_performance (data, policy->cpu, next_state); | 222 | perf = data->acpi_data; |
223 | cur_state = perf->state; | ||
224 | freqs.old = data->freq_table[cur_state].frequency; | ||
225 | freqs.new = data->freq_table[next_state].frequency; | ||
226 | |||
227 | #ifdef CONFIG_HOTPLUG_CPU | ||
228 | /* cpufreq holds the hotplug lock, so we are safe from here on */ | ||
229 | cpus_and(online_policy_cpus, cpu_online_map, policy->cpus); | ||
230 | #else | ||
231 | online_policy_cpus = policy->cpus; | ||
232 | #endif | ||
233 | |||
234 | for_each_cpu_mask(j, online_policy_cpus) { | ||
235 | freqs.cpu = j; | ||
236 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
237 | } | ||
238 | |||
239 | /* | ||
240 | * We need to call driver->target() on all or any CPU in | ||
241 | * policy->cpus, depending on policy->shared_type. | ||
242 | */ | ||
243 | saved_mask = current->cpus_allowed; | ||
244 | cpus_clear(covered_cpus); | ||
245 | for_each_cpu_mask(j, online_policy_cpus) { | ||
246 | /* | ||
247 | * Support for SMP systems. | ||
248 | * Make sure we are running on CPU that wants to change freq | ||
249 | */ | ||
250 | cpus_clear(set_mask); | ||
251 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | ||
252 | cpus_or(set_mask, set_mask, online_policy_cpus); | ||
253 | else | ||
254 | cpu_set(j, set_mask); | ||
255 | |||
256 | set_cpus_allowed(current, set_mask); | ||
257 | if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { | ||
258 | dprintk("couldn't limit to CPUs in this domain\n"); | ||
259 | result = -EAGAIN; | ||
260 | break; | ||
261 | } | ||
262 | |||
263 | result = acpi_processor_set_performance (data, j, next_state); | ||
264 | if (result) { | ||
265 | result = -EAGAIN; | ||
266 | break; | ||
267 | } | ||
268 | |||
269 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | ||
270 | break; | ||
271 | |||
272 | cpu_set(j, covered_cpus); | ||
273 | } | ||
274 | |||
275 | for_each_cpu_mask(j, online_policy_cpus) { | ||
276 | freqs.cpu = j; | ||
277 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
278 | } | ||
247 | 279 | ||
280 | if (unlikely(result)) { | ||
281 | /* | ||
282 | * We have failed halfway through the frequency change. | ||
283 | * We have sent callbacks to online_policy_cpus and | ||
284 | * acpi_processor_set_performance() has been called on | ||
285 | * coverd_cpus. Best effort undo.. | ||
286 | */ | ||
287 | |||
288 | if (!cpus_empty(covered_cpus)) { | ||
289 | for_each_cpu_mask(j, covered_cpus) { | ||
290 | policy->cpu = j; | ||
291 | acpi_processor_set_performance (data, | ||
292 | j, | ||
293 | cur_state); | ||
294 | } | ||
295 | } | ||
296 | |||
297 | tmp = freqs.new; | ||
298 | freqs.new = freqs.old; | ||
299 | freqs.old = tmp; | ||
300 | for_each_cpu_mask(j, online_policy_cpus) { | ||
301 | freqs.cpu = j; | ||
302 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
303 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | set_cpus_allowed(current, saved_mask); | ||
248 | return (result); | 308 | return (result); |
249 | } | 309 | } |
250 | 310 | ||
@@ -270,30 +330,65 @@ acpi_cpufreq_guess_freq ( | |||
270 | struct cpufreq_acpi_io *data, | 330 | struct cpufreq_acpi_io *data, |
271 | unsigned int cpu) | 331 | unsigned int cpu) |
272 | { | 332 | { |
333 | struct acpi_processor_performance *perf = data->acpi_data; | ||
334 | |||
273 | if (cpu_khz) { | 335 | if (cpu_khz) { |
274 | /* search the closest match to cpu_khz */ | 336 | /* search the closest match to cpu_khz */ |
275 | unsigned int i; | 337 | unsigned int i; |
276 | unsigned long freq; | 338 | unsigned long freq; |
277 | unsigned long freqn = data->acpi_data.states[0].core_frequency * 1000; | 339 | unsigned long freqn = perf->states[0].core_frequency * 1000; |
278 | 340 | ||
279 | for (i=0; i < (data->acpi_data.state_count - 1); i++) { | 341 | for (i = 0; i < (perf->state_count - 1); i++) { |
280 | freq = freqn; | 342 | freq = freqn; |
281 | freqn = data->acpi_data.states[i+1].core_frequency * 1000; | 343 | freqn = perf->states[i+1].core_frequency * 1000; |
282 | if ((2 * cpu_khz) > (freqn + freq)) { | 344 | if ((2 * cpu_khz) > (freqn + freq)) { |
283 | data->acpi_data.state = i; | 345 | perf->state = i; |
284 | return (freq); | 346 | return (freq); |
285 | } | 347 | } |
286 | } | 348 | } |
287 | data->acpi_data.state = data->acpi_data.state_count - 1; | 349 | perf->state = perf->state_count - 1; |
288 | return (freqn); | 350 | return (freqn); |
289 | } else | 351 | } else { |
290 | /* assume CPU is at P0... */ | 352 | /* assume CPU is at P0... */ |
291 | data->acpi_data.state = 0; | 353 | perf->state = 0; |
292 | return data->acpi_data.states[0].core_frequency * 1000; | 354 | return perf->states[0].core_frequency * 1000; |
293 | 355 | } | |
294 | } | 356 | } |
295 | 357 | ||
296 | 358 | ||
359 | /* | ||
360 | * acpi_cpufreq_early_init - initialize ACPI P-States library | ||
361 | * | ||
362 | * Initialize the ACPI P-States library (drivers/acpi/processor_perflib.c) | ||
363 | * in order to determine correct frequency and voltage pairings. We can | ||
364 | * do _PDC and _PSD and find out the processor dependency for the | ||
365 | * actual init that will happen later... | ||
366 | */ | ||
367 | static int acpi_cpufreq_early_init_acpi(void) | ||
368 | { | ||
369 | struct acpi_processor_performance *data; | ||
370 | unsigned int i, j; | ||
371 | |||
372 | dprintk("acpi_cpufreq_early_init\n"); | ||
373 | |||
374 | for_each_cpu(i) { | ||
375 | data = kzalloc(sizeof(struct acpi_processor_performance), | ||
376 | GFP_KERNEL); | ||
377 | if (!data) { | ||
378 | for_each_cpu(j) { | ||
379 | kfree(acpi_perf_data[j]); | ||
380 | acpi_perf_data[j] = NULL; | ||
381 | } | ||
382 | return (-ENOMEM); | ||
383 | } | ||
384 | acpi_perf_data[i] = data; | ||
385 | } | ||
386 | |||
387 | /* Do initialization in ACPI core */ | ||
388 | acpi_processor_preregister_performance(acpi_perf_data); | ||
389 | return 0; | ||
390 | } | ||
391 | |||
297 | static int | 392 | static int |
298 | acpi_cpufreq_cpu_init ( | 393 | acpi_cpufreq_cpu_init ( |
299 | struct cpufreq_policy *policy) | 394 | struct cpufreq_policy *policy) |
@@ -303,41 +398,51 @@ acpi_cpufreq_cpu_init ( | |||
303 | struct cpufreq_acpi_io *data; | 398 | struct cpufreq_acpi_io *data; |
304 | unsigned int result = 0; | 399 | unsigned int result = 0; |
305 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; | 400 | struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; |
401 | struct acpi_processor_performance *perf; | ||
306 | 402 | ||
307 | dprintk("acpi_cpufreq_cpu_init\n"); | 403 | dprintk("acpi_cpufreq_cpu_init\n"); |
308 | 404 | ||
405 | if (!acpi_perf_data[cpu]) | ||
406 | return (-ENODEV); | ||
407 | |||
309 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); | 408 | data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); |
310 | if (!data) | 409 | if (!data) |
311 | return (-ENOMEM); | 410 | return (-ENOMEM); |
312 | 411 | ||
412 | data->acpi_data = acpi_perf_data[cpu]; | ||
313 | acpi_io_data[cpu] = data; | 413 | acpi_io_data[cpu] = data; |
314 | 414 | ||
315 | result = acpi_processor_register_performance(&data->acpi_data, cpu); | 415 | result = acpi_processor_register_performance(data->acpi_data, cpu); |
316 | 416 | ||
317 | if (result) | 417 | if (result) |
318 | goto err_free; | 418 | goto err_free; |
319 | 419 | ||
420 | perf = data->acpi_data; | ||
421 | policy->cpus = perf->shared_cpu_map; | ||
422 | policy->shared_type = perf->shared_type; | ||
423 | |||
320 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { | 424 | if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) { |
321 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; | 425 | acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; |
322 | } | 426 | } |
323 | 427 | ||
324 | /* capability check */ | 428 | /* capability check */ |
325 | if (data->acpi_data.state_count <= 1) { | 429 | if (perf->state_count <= 1) { |
326 | dprintk("No P-States\n"); | 430 | dprintk("No P-States\n"); |
327 | result = -ENODEV; | 431 | result = -ENODEV; |
328 | goto err_unreg; | 432 | goto err_unreg; |
329 | } | 433 | } |
330 | if ((data->acpi_data.control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || | 434 | |
331 | (data->acpi_data.status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { | 435 | if ((perf->control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) || |
436 | (perf->status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) { | ||
332 | dprintk("Unsupported address space [%d, %d]\n", | 437 | dprintk("Unsupported address space [%d, %d]\n", |
333 | (u32) (data->acpi_data.control_register.space_id), | 438 | (u32) (perf->control_register.space_id), |
334 | (u32) (data->acpi_data.status_register.space_id)); | 439 | (u32) (perf->status_register.space_id)); |
335 | result = -ENODEV; | 440 | result = -ENODEV; |
336 | goto err_unreg; | 441 | goto err_unreg; |
337 | } | 442 | } |
338 | 443 | ||
339 | /* alloc freq_table */ | 444 | /* alloc freq_table */ |
340 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (data->acpi_data.state_count + 1), GFP_KERNEL); | 445 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (perf->state_count + 1), GFP_KERNEL); |
341 | if (!data->freq_table) { | 446 | if (!data->freq_table) { |
342 | result = -ENOMEM; | 447 | result = -ENOMEM; |
343 | goto err_unreg; | 448 | goto err_unreg; |
@@ -345,9 +450,9 @@ acpi_cpufreq_cpu_init ( | |||
345 | 450 | ||
346 | /* detect transition latency */ | 451 | /* detect transition latency */ |
347 | policy->cpuinfo.transition_latency = 0; | 452 | policy->cpuinfo.transition_latency = 0; |
348 | for (i=0; i<data->acpi_data.state_count; i++) { | 453 | for (i=0; i<perf->state_count; i++) { |
349 | if ((data->acpi_data.states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) | 454 | if ((perf->states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency) |
350 | policy->cpuinfo.transition_latency = data->acpi_data.states[i].transition_latency * 1000; | 455 | policy->cpuinfo.transition_latency = perf->states[i].transition_latency * 1000; |
351 | } | 456 | } |
352 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 457 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
353 | 458 | ||
@@ -355,11 +460,11 @@ acpi_cpufreq_cpu_init ( | |||
355 | policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); | 460 | policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu); |
356 | 461 | ||
357 | /* table init */ | 462 | /* table init */ |
358 | for (i=0; i<=data->acpi_data.state_count; i++) | 463 | for (i=0; i<=perf->state_count; i++) |
359 | { | 464 | { |
360 | data->freq_table[i].index = i; | 465 | data->freq_table[i].index = i; |
361 | if (i<data->acpi_data.state_count) | 466 | if (i<perf->state_count) |
362 | data->freq_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000; | 467 | data->freq_table[i].frequency = perf->states[i].core_frequency * 1000; |
363 | else | 468 | else |
364 | data->freq_table[i].frequency = CPUFREQ_TABLE_END; | 469 | data->freq_table[i].frequency = CPUFREQ_TABLE_END; |
365 | } | 470 | } |
@@ -374,12 +479,12 @@ acpi_cpufreq_cpu_init ( | |||
374 | 479 | ||
375 | printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", | 480 | printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n", |
376 | cpu); | 481 | cpu); |
377 | for (i = 0; i < data->acpi_data.state_count; i++) | 482 | for (i = 0; i < perf->state_count; i++) |
378 | dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", | 483 | dprintk(" %cP%d: %d MHz, %d mW, %d uS\n", |
379 | (i == data->acpi_data.state?'*':' '), i, | 484 | (i == perf->state?'*':' '), i, |
380 | (u32) data->acpi_data.states[i].core_frequency, | 485 | (u32) perf->states[i].core_frequency, |
381 | (u32) data->acpi_data.states[i].power, | 486 | (u32) perf->states[i].power, |
382 | (u32) data->acpi_data.states[i].transition_latency); | 487 | (u32) perf->states[i].transition_latency); |
383 | 488 | ||
384 | cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); | 489 | cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); |
385 | 490 | ||
@@ -394,7 +499,7 @@ acpi_cpufreq_cpu_init ( | |||
394 | err_freqfree: | 499 | err_freqfree: |
395 | kfree(data->freq_table); | 500 | kfree(data->freq_table); |
396 | err_unreg: | 501 | err_unreg: |
397 | acpi_processor_unregister_performance(&data->acpi_data, cpu); | 502 | acpi_processor_unregister_performance(perf, cpu); |
398 | err_free: | 503 | err_free: |
399 | kfree(data); | 504 | kfree(data); |
400 | acpi_io_data[cpu] = NULL; | 505 | acpi_io_data[cpu] = NULL; |
@@ -415,7 +520,7 @@ acpi_cpufreq_cpu_exit ( | |||
415 | if (data) { | 520 | if (data) { |
416 | cpufreq_frequency_table_put_attr(policy->cpu); | 521 | cpufreq_frequency_table_put_attr(policy->cpu); |
417 | acpi_io_data[policy->cpu] = NULL; | 522 | acpi_io_data[policy->cpu] = NULL; |
418 | acpi_processor_unregister_performance(&data->acpi_data, policy->cpu); | 523 | acpi_processor_unregister_performance(data->acpi_data, policy->cpu); |
419 | kfree(data); | 524 | kfree(data); |
420 | } | 525 | } |
421 | 526 | ||
@@ -462,7 +567,10 @@ acpi_cpufreq_init (void) | |||
462 | 567 | ||
463 | dprintk("acpi_cpufreq_init\n"); | 568 | dprintk("acpi_cpufreq_init\n"); |
464 | 569 | ||
465 | result = cpufreq_register_driver(&acpi_cpufreq_driver); | 570 | result = acpi_cpufreq_early_init_acpi(); |
571 | |||
572 | if (!result) | ||
573 | result = cpufreq_register_driver(&acpi_cpufreq_driver); | ||
466 | 574 | ||
467 | return (result); | 575 | return (result); |
468 | } | 576 | } |
@@ -471,10 +579,15 @@ acpi_cpufreq_init (void) | |||
471 | static void __exit | 579 | static void __exit |
472 | acpi_cpufreq_exit (void) | 580 | acpi_cpufreq_exit (void) |
473 | { | 581 | { |
582 | unsigned int i; | ||
474 | dprintk("acpi_cpufreq_exit\n"); | 583 | dprintk("acpi_cpufreq_exit\n"); |
475 | 584 | ||
476 | cpufreq_unregister_driver(&acpi_cpufreq_driver); | 585 | cpufreq_unregister_driver(&acpi_cpufreq_driver); |
477 | 586 | ||
587 | for_each_cpu(i) { | ||
588 | kfree(acpi_perf_data[i]); | ||
589 | acpi_perf_data[i] = NULL; | ||
590 | } | ||
478 | return; | 591 | return; |
479 | } | 592 | } |
480 | 593 | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index f1a82c5de1ba..31c3a5baaa7f 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
@@ -347,7 +347,36 @@ static unsigned int get_cur_freq(unsigned int cpu) | |||
347 | 347 | ||
348 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | 348 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI |
349 | 349 | ||
350 | static struct acpi_processor_performance p; | 350 | static struct acpi_processor_performance *acpi_perf_data[NR_CPUS]; |
351 | |||
352 | /* | ||
353 | * centrino_cpu_early_init_acpi - Do the preregistering with ACPI P-States | ||
354 | * library | ||
355 | * | ||
356 | * Before doing the actual init, we need to do _PSD related setup whenever | ||
357 | * supported by the BIOS. These are handled by this early_init routine. | ||
358 | */ | ||
359 | static int centrino_cpu_early_init_acpi(void) | ||
360 | { | ||
361 | unsigned int i, j; | ||
362 | struct acpi_processor_performance *data; | ||
363 | |||
364 | for_each_cpu(i) { | ||
365 | data = kzalloc(sizeof(struct acpi_processor_performance), | ||
366 | GFP_KERNEL); | ||
367 | if (!data) { | ||
368 | for_each_cpu(j) { | ||
369 | kfree(acpi_perf_data[j]); | ||
370 | acpi_perf_data[j] = NULL; | ||
371 | } | ||
372 | return (-ENOMEM); | ||
373 | } | ||
374 | acpi_perf_data[i] = data; | ||
375 | } | ||
376 | |||
377 | acpi_processor_preregister_performance(acpi_perf_data); | ||
378 | return 0; | ||
379 | } | ||
351 | 380 | ||
352 | /* | 381 | /* |
353 | * centrino_cpu_init_acpi - register with ACPI P-States library | 382 | * centrino_cpu_init_acpi - register with ACPI P-States library |
@@ -361,46 +390,51 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
361 | unsigned long cur_freq; | 390 | unsigned long cur_freq; |
362 | int result = 0, i; | 391 | int result = 0, i; |
363 | unsigned int cpu = policy->cpu; | 392 | unsigned int cpu = policy->cpu; |
393 | struct acpi_processor_performance *p; | ||
394 | |||
395 | p = acpi_perf_data[cpu]; | ||
364 | 396 | ||
365 | /* register with ACPI core */ | 397 | /* register with ACPI core */ |
366 | if (acpi_processor_register_performance(&p, cpu)) { | 398 | if (acpi_processor_register_performance(p, cpu)) { |
367 | dprintk("obtaining ACPI data failed\n"); | 399 | dprintk(PFX "obtaining ACPI data failed\n"); |
368 | return -EIO; | 400 | return -EIO; |
369 | } | 401 | } |
402 | policy->cpus = p->shared_cpu_map; | ||
403 | policy->shared_type = p->shared_type; | ||
370 | 404 | ||
371 | /* verify the acpi_data */ | 405 | /* verify the acpi_data */ |
372 | if (p.state_count <= 1) { | 406 | if (p->state_count <= 1) { |
373 | dprintk("No P-States\n"); | 407 | dprintk("No P-States\n"); |
374 | result = -ENODEV; | 408 | result = -ENODEV; |
375 | goto err_unreg; | 409 | goto err_unreg; |
376 | } | 410 | } |
377 | 411 | ||
378 | if ((p.control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || | 412 | if ((p->control_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE) || |
379 | (p.status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { | 413 | (p->status_register.space_id != ACPI_ADR_SPACE_FIXED_HARDWARE)) { |
380 | dprintk("Invalid control/status registers (%x - %x)\n", | 414 | dprintk("Invalid control/status registers (%x - %x)\n", |
381 | p.control_register.space_id, p.status_register.space_id); | 415 | p->control_register.space_id, p->status_register.space_id); |
382 | result = -EIO; | 416 | result = -EIO; |
383 | goto err_unreg; | 417 | goto err_unreg; |
384 | } | 418 | } |
385 | 419 | ||
386 | for (i=0; i<p.state_count; i++) { | 420 | for (i=0; i<p->state_count; i++) { |
387 | if (p.states[i].control != p.states[i].status) { | 421 | if (p->states[i].control != p->states[i].status) { |
388 | dprintk("Different control (%llu) and status values (%llu)\n", | 422 | dprintk("Different control (%llu) and status values (%llu)\n", |
389 | p.states[i].control, p.states[i].status); | 423 | p->states[i].control, p->states[i].status); |
390 | result = -EINVAL; | 424 | result = -EINVAL; |
391 | goto err_unreg; | 425 | goto err_unreg; |
392 | } | 426 | } |
393 | 427 | ||
394 | if (!p.states[i].core_frequency) { | 428 | if (!p->states[i].core_frequency) { |
395 | dprintk("Zero core frequency for state %u\n", i); | 429 | dprintk("Zero core frequency for state %u\n", i); |
396 | result = -EINVAL; | 430 | result = -EINVAL; |
397 | goto err_unreg; | 431 | goto err_unreg; |
398 | } | 432 | } |
399 | 433 | ||
400 | if (p.states[i].core_frequency > p.states[0].core_frequency) { | 434 | if (p->states[i].core_frequency > p->states[0].core_frequency) { |
401 | dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i, | 435 | dprintk("P%u has larger frequency (%llu) than P0 (%llu), skipping\n", i, |
402 | p.states[i].core_frequency, p.states[0].core_frequency); | 436 | p->states[i].core_frequency, p->states[0].core_frequency); |
403 | p.states[i].core_frequency = 0; | 437 | p->states[i].core_frequency = 0; |
404 | continue; | 438 | continue; |
405 | } | 439 | } |
406 | } | 440 | } |
@@ -412,26 +446,26 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
412 | } | 446 | } |
413 | 447 | ||
414 | centrino_model[cpu]->model_name=NULL; | 448 | centrino_model[cpu]->model_name=NULL; |
415 | centrino_model[cpu]->max_freq = p.states[0].core_frequency * 1000; | 449 | centrino_model[cpu]->max_freq = p->states[0].core_frequency * 1000; |
416 | centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) * | 450 | centrino_model[cpu]->op_points = kmalloc(sizeof(struct cpufreq_frequency_table) * |
417 | (p.state_count + 1), GFP_KERNEL); | 451 | (p->state_count + 1), GFP_KERNEL); |
418 | if (!centrino_model[cpu]->op_points) { | 452 | if (!centrino_model[cpu]->op_points) { |
419 | result = -ENOMEM; | 453 | result = -ENOMEM; |
420 | goto err_kfree; | 454 | goto err_kfree; |
421 | } | 455 | } |
422 | 456 | ||
423 | for (i=0; i<p.state_count; i++) { | 457 | for (i=0; i<p->state_count; i++) { |
424 | centrino_model[cpu]->op_points[i].index = p.states[i].control; | 458 | centrino_model[cpu]->op_points[i].index = p->states[i].control; |
425 | centrino_model[cpu]->op_points[i].frequency = p.states[i].core_frequency * 1000; | 459 | centrino_model[cpu]->op_points[i].frequency = p->states[i].core_frequency * 1000; |
426 | dprintk("adding state %i with frequency %u and control value %04x\n", | 460 | dprintk("adding state %i with frequency %u and control value %04x\n", |
427 | i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); | 461 | i, centrino_model[cpu]->op_points[i].frequency, centrino_model[cpu]->op_points[i].index); |
428 | } | 462 | } |
429 | centrino_model[cpu]->op_points[p.state_count].frequency = CPUFREQ_TABLE_END; | 463 | centrino_model[cpu]->op_points[p->state_count].frequency = CPUFREQ_TABLE_END; |
430 | 464 | ||
431 | cur_freq = get_cur_freq(cpu); | 465 | cur_freq = get_cur_freq(cpu); |
432 | 466 | ||
433 | for (i=0; i<p.state_count; i++) { | 467 | for (i=0; i<p->state_count; i++) { |
434 | if (!p.states[i].core_frequency) { | 468 | if (!p->states[i].core_frequency) { |
435 | dprintk("skipping state %u\n", i); | 469 | dprintk("skipping state %u\n", i); |
436 | centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID; | 470 | centrino_model[cpu]->op_points[i].frequency = CPUFREQ_ENTRY_INVALID; |
437 | continue; | 471 | continue; |
@@ -447,7 +481,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
447 | } | 481 | } |
448 | 482 | ||
449 | if (cur_freq == centrino_model[cpu]->op_points[i].frequency) | 483 | if (cur_freq == centrino_model[cpu]->op_points[i].frequency) |
450 | p.state = i; | 484 | p->state = i; |
451 | } | 485 | } |
452 | 486 | ||
453 | /* notify BIOS that we exist */ | 487 | /* notify BIOS that we exist */ |
@@ -460,12 +494,13 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) | |||
460 | err_kfree: | 494 | err_kfree: |
461 | kfree(centrino_model[cpu]); | 495 | kfree(centrino_model[cpu]); |
462 | err_unreg: | 496 | err_unreg: |
463 | acpi_processor_unregister_performance(&p, cpu); | 497 | acpi_processor_unregister_performance(p, cpu); |
464 | dprintk("invalid ACPI data\n"); | 498 | dprintk(PFX "invalid ACPI data\n"); |
465 | return (result); | 499 | return (result); |
466 | } | 500 | } |
467 | #else | 501 | #else |
468 | static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; } | 502 | static inline int centrino_cpu_init_acpi(struct cpufreq_policy *policy) { return -ENODEV; } |
503 | static inline int centrino_cpu_early_init_acpi(void) { return 0; } | ||
469 | #endif | 504 | #endif |
470 | 505 | ||
471 | static int centrino_cpu_init(struct cpufreq_policy *policy) | 506 | static int centrino_cpu_init(struct cpufreq_policy *policy) |
@@ -551,10 +586,15 @@ static int centrino_cpu_exit(struct cpufreq_policy *policy) | |||
551 | 586 | ||
552 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | 587 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI |
553 | if (!centrino_model[cpu]->model_name) { | 588 | if (!centrino_model[cpu]->model_name) { |
554 | dprintk("unregistering and freeing ACPI data\n"); | 589 | static struct acpi_processor_performance *p; |
555 | acpi_processor_unregister_performance(&p, cpu); | 590 | |
556 | kfree(centrino_model[cpu]->op_points); | 591 | if (acpi_perf_data[cpu]) { |
557 | kfree(centrino_model[cpu]); | 592 | p = acpi_perf_data[cpu]; |
593 | dprintk("unregistering and freeing ACPI data\n"); | ||
594 | acpi_processor_unregister_performance(p, cpu); | ||
595 | kfree(centrino_model[cpu]->op_points); | ||
596 | kfree(centrino_model[cpu]); | ||
597 | } | ||
558 | } | 598 | } |
559 | #endif | 599 | #endif |
560 | 600 | ||
@@ -588,63 +628,128 @@ static int centrino_target (struct cpufreq_policy *policy, | |||
588 | unsigned int relation) | 628 | unsigned int relation) |
589 | { | 629 | { |
590 | unsigned int newstate = 0; | 630 | unsigned int newstate = 0; |
591 | unsigned int msr, oldmsr, h, cpu = policy->cpu; | 631 | unsigned int msr, oldmsr = 0, h = 0, cpu = policy->cpu; |
592 | struct cpufreq_freqs freqs; | 632 | struct cpufreq_freqs freqs; |
633 | cpumask_t online_policy_cpus; | ||
593 | cpumask_t saved_mask; | 634 | cpumask_t saved_mask; |
594 | int retval; | 635 | cpumask_t set_mask; |
636 | cpumask_t covered_cpus; | ||
637 | int retval = 0; | ||
638 | unsigned int j, k, first_cpu, tmp; | ||
595 | 639 | ||
596 | if (centrino_model[cpu] == NULL) | 640 | if (unlikely(centrino_model[cpu] == NULL)) |
597 | return -ENODEV; | 641 | return -ENODEV; |
598 | 642 | ||
599 | /* | 643 | if (unlikely(cpufreq_frequency_table_target(policy, |
600 | * Support for SMP systems. | 644 | centrino_model[cpu]->op_points, |
601 | * Make sure we are running on the CPU that wants to change frequency | 645 | target_freq, |
602 | */ | 646 | relation, |
603 | saved_mask = current->cpus_allowed; | 647 | &newstate))) { |
604 | set_cpus_allowed(current, policy->cpus); | 648 | return -EINVAL; |
605 | if (!cpu_isset(smp_processor_id(), policy->cpus)) { | ||
606 | dprintk("couldn't limit to CPUs in this domain\n"); | ||
607 | return(-EAGAIN); | ||
608 | } | 649 | } |
609 | 650 | ||
610 | if (cpufreq_frequency_table_target(policy, centrino_model[cpu]->op_points, target_freq, | 651 | #ifdef CONFIG_HOTPLUG_CPU |
611 | relation, &newstate)) { | 652 | /* cpufreq holds the hotplug lock, so we are safe from here on */ |
612 | retval = -EINVAL; | 653 | cpus_and(online_policy_cpus, cpu_online_map, policy->cpus); |
613 | goto migrate_end; | 654 | #else |
614 | } | 655 | online_policy_cpus = policy->cpus; |
656 | #endif | ||
615 | 657 | ||
616 | msr = centrino_model[cpu]->op_points[newstate].index; | 658 | saved_mask = current->cpus_allowed; |
617 | rdmsr(MSR_IA32_PERF_CTL, oldmsr, h); | 659 | first_cpu = 1; |
660 | cpus_clear(covered_cpus); | ||
661 | for_each_cpu_mask(j, online_policy_cpus) { | ||
662 | /* | ||
663 | * Support for SMP systems. | ||
664 | * Make sure we are running on CPU that wants to change freq | ||
665 | */ | ||
666 | cpus_clear(set_mask); | ||
667 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) | ||
668 | cpus_or(set_mask, set_mask, online_policy_cpus); | ||
669 | else | ||
670 | cpu_set(j, set_mask); | ||
671 | |||
672 | set_cpus_allowed(current, set_mask); | ||
673 | if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { | ||
674 | dprintk("couldn't limit to CPUs in this domain\n"); | ||
675 | retval = -EAGAIN; | ||
676 | if (first_cpu) { | ||
677 | /* We haven't started the transition yet. */ | ||
678 | goto migrate_end; | ||
679 | } | ||
680 | break; | ||
681 | } | ||
618 | 682 | ||
619 | if (msr == (oldmsr & 0xffff)) { | 683 | msr = centrino_model[cpu]->op_points[newstate].index; |
620 | retval = 0; | 684 | |
621 | dprintk("no change needed - msr was and needs to be %x\n", oldmsr); | 685 | if (first_cpu) { |
622 | goto migrate_end; | 686 | rdmsr(MSR_IA32_PERF_CTL, oldmsr, h); |
623 | } | 687 | if (msr == (oldmsr & 0xffff)) { |
688 | dprintk("no change needed - msr was and needs " | ||
689 | "to be %x\n", oldmsr); | ||
690 | retval = 0; | ||
691 | goto migrate_end; | ||
692 | } | ||
693 | |||
694 | freqs.old = extract_clock(oldmsr, cpu, 0); | ||
695 | freqs.new = extract_clock(msr, cpu, 0); | ||
696 | |||
697 | dprintk("target=%dkHz old=%d new=%d msr=%04x\n", | ||
698 | target_freq, freqs.old, freqs.new, msr); | ||
699 | |||
700 | for_each_cpu_mask(k, online_policy_cpus) { | ||
701 | freqs.cpu = k; | ||
702 | cpufreq_notify_transition(&freqs, | ||
703 | CPUFREQ_PRECHANGE); | ||
704 | } | ||
705 | |||
706 | first_cpu = 0; | ||
707 | /* all but 16 LSB are reserved, treat them with care */ | ||
708 | oldmsr &= ~0xffff; | ||
709 | msr &= 0xffff; | ||
710 | oldmsr |= msr; | ||
711 | } | ||
624 | 712 | ||
625 | freqs.cpu = cpu; | 713 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); |
626 | freqs.old = extract_clock(oldmsr, cpu, 0); | 714 | if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) |
627 | freqs.new = extract_clock(msr, cpu, 0); | 715 | break; |
628 | 716 | ||
629 | dprintk("target=%dkHz old=%d new=%d msr=%04x\n", | 717 | cpu_set(j, covered_cpus); |
630 | target_freq, freqs.old, freqs.new, msr); | 718 | } |
631 | 719 | ||
632 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 720 | for_each_cpu_mask(k, online_policy_cpus) { |
721 | freqs.cpu = k; | ||
722 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
723 | } | ||
633 | 724 | ||
634 | /* all but 16 LSB are "reserved", so treat them with | 725 | if (unlikely(retval)) { |
635 | care */ | 726 | /* |
636 | oldmsr &= ~0xffff; | 727 | * We have failed halfway through the frequency change. |
637 | msr &= 0xffff; | 728 | * We have sent callbacks to policy->cpus and |
638 | oldmsr |= msr; | 729 | * MSRs have already been written on coverd_cpus. |
730 | * Best effort undo.. | ||
731 | */ | ||
639 | 732 | ||
640 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); | 733 | if (!cpus_empty(covered_cpus)) { |
734 | for_each_cpu_mask(j, covered_cpus) { | ||
735 | set_cpus_allowed(current, cpumask_of_cpu(j)); | ||
736 | wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); | ||
737 | } | ||
738 | } | ||
641 | 739 | ||
642 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 740 | tmp = freqs.new; |
741 | freqs.new = freqs.old; | ||
742 | freqs.old = tmp; | ||
743 | for_each_cpu_mask(j, online_policy_cpus) { | ||
744 | freqs.cpu = j; | ||
745 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
746 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
747 | } | ||
748 | } | ||
643 | 749 | ||
644 | retval = 0; | ||
645 | migrate_end: | 750 | migrate_end: |
646 | set_cpus_allowed(current, saved_mask); | 751 | set_cpus_allowed(current, saved_mask); |
647 | return (retval); | 752 | return 0; |
648 | } | 753 | } |
649 | 754 | ||
650 | static struct freq_attr* centrino_attr[] = { | 755 | static struct freq_attr* centrino_attr[] = { |
@@ -686,12 +791,25 @@ static int __init centrino_init(void) | |||
686 | if (!cpu_has(cpu, X86_FEATURE_EST)) | 791 | if (!cpu_has(cpu, X86_FEATURE_EST)) |
687 | return -ENODEV; | 792 | return -ENODEV; |
688 | 793 | ||
794 | centrino_cpu_early_init_acpi(); | ||
795 | |||
689 | return cpufreq_register_driver(¢rino_driver); | 796 | return cpufreq_register_driver(¢rino_driver); |
690 | } | 797 | } |
691 | 798 | ||
692 | static void __exit centrino_exit(void) | 799 | static void __exit centrino_exit(void) |
693 | { | 800 | { |
801 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
802 | unsigned int j; | ||
803 | #endif | ||
804 | |||
694 | cpufreq_unregister_driver(¢rino_driver); | 805 | cpufreq_unregister_driver(¢rino_driver); |
806 | |||
807 | #ifdef CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI | ||
808 | for_each_cpu(j) { | ||
809 | kfree(acpi_perf_data[j]); | ||
810 | acpi_perf_data[j] = NULL; | ||
811 | } | ||
812 | #endif | ||
695 | } | 813 | } |
696 | 814 | ||
697 | MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); | 815 | MODULE_AUTHOR ("Jeremy Fitzhardinge <jeremy@goop.org>"); |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index c1c9b4224081..fbb25b00629b 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -77,6 +77,7 @@ choice | |||
77 | config IA64_GENERIC | 77 | config IA64_GENERIC |
78 | bool "generic" | 78 | bool "generic" |
79 | select ACPI | 79 | select ACPI |
80 | select PCI | ||
80 | select NUMA | 81 | select NUMA |
81 | select ACPI_NUMA | 82 | select ACPI_NUMA |
82 | help | 83 | help |
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c index 3ce443e6c016..5825ddee58d6 100644 --- a/arch/ia64/hp/common/sba_iommu.c +++ b/arch/ia64/hp/common/sba_iommu.c | |||
@@ -1999,7 +1999,7 @@ acpi_sba_ioc_add(struct acpi_device *device) | |||
1999 | if (!iovp_shift) | 1999 | if (!iovp_shift) |
2000 | iovp_shift = min(PAGE_SHIFT, 16); | 2000 | iovp_shift = min(PAGE_SHIFT, 16); |
2001 | } | 2001 | } |
2002 | ACPI_MEM_FREE(dev_info); | 2002 | kfree(dev_info); |
2003 | 2003 | ||
2004 | /* | 2004 | /* |
2005 | * default anything not caught above or specified on cmdline to 4k | 2005 | * default anything not caught above or specified on cmdline to 4k |
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index d1c52cf67882..6ea642beaaee 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -68,8 +68,6 @@ EXPORT_SYMBOL(pm_power_off); | |||
68 | unsigned char acpi_kbd_controller_present = 1; | 68 | unsigned char acpi_kbd_controller_present = 1; |
69 | unsigned char acpi_legacy_devices; | 69 | unsigned char acpi_legacy_devices; |
70 | 70 | ||
71 | static unsigned int __initdata acpi_madt_rev; | ||
72 | |||
73 | unsigned int acpi_cpei_override; | 71 | unsigned int acpi_cpei_override; |
74 | unsigned int acpi_cpei_phys_cpuid; | 72 | unsigned int acpi_cpei_phys_cpuid; |
75 | 73 | ||
@@ -243,6 +241,8 @@ acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end) | |||
243 | return iosapic_init(iosapic->address, iosapic->global_irq_base); | 241 | return iosapic_init(iosapic->address, iosapic->global_irq_base); |
244 | } | 242 | } |
245 | 243 | ||
244 | static unsigned int __initdata acpi_madt_rev; | ||
245 | |||
246 | static int __init | 246 | static int __init |
247 | acpi_parse_plat_int_src(acpi_table_entry_header * header, | 247 | acpi_parse_plat_int_src(acpi_table_entry_header * header, |
248 | const unsigned long end) | 248 | const unsigned long end) |
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index cafa8776a53d..11f08001f8c2 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c | |||
@@ -671,9 +671,11 @@ int add_memory(u64 start, u64 size) | |||
671 | 671 | ||
672 | return ret; | 672 | return ret; |
673 | } | 673 | } |
674 | EXPORT_SYMBOL_GPL(add_memory); | ||
674 | 675 | ||
675 | int remove_memory(u64 start, u64 size) | 676 | int remove_memory(u64 start, u64 size) |
676 | { | 677 | { |
677 | return -EINVAL; | 678 | return -EINVAL; |
678 | } | 679 | } |
680 | EXPORT_SYMBOL_GPL(remove_memory); | ||
679 | #endif | 681 | #endif |
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 7d3bc5ac5db0..af44130f0d65 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -299,6 +299,7 @@ config X86_64_ACPI_NUMA | |||
299 | bool "ACPI NUMA detection" | 299 | bool "ACPI NUMA detection" |
300 | depends on NUMA | 300 | depends on NUMA |
301 | select ACPI | 301 | select ACPI |
302 | select PCI | ||
302 | select ACPI_NUMA | 303 | select ACPI_NUMA |
303 | default y | 304 | default y |
304 | help | 305 | help |
diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile index 4fe97071f297..080b9963f1bc 100644 --- a/arch/x86_64/kernel/acpi/Makefile +++ b/arch/x86_64/kernel/acpi/Makefile | |||
@@ -4,5 +4,6 @@ obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o | |||
4 | 4 | ||
5 | ifneq ($(CONFIG_ACPI_PROCESSOR),) | 5 | ifneq ($(CONFIG_ACPI_PROCESSOR),) |
6 | obj-y += processor.o | 6 | obj-y += processor.o |
7 | processor-y := ../../../i386/kernel/acpi/processor.o ../../../i386/kernel/acpi/cstate.o | ||
7 | endif | 8 | endif |
8 | 9 | ||
diff --git a/arch/x86_64/kernel/acpi/processor.c b/arch/x86_64/kernel/acpi/processor.c deleted file mode 100644 index 3bdc2baa5bb1..000000000000 --- a/arch/x86_64/kernel/acpi/processor.c +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | * arch/x86_64/kernel/acpi/processor.c | ||
3 | * | ||
4 | * Copyright (C) 2005 Intel Corporation | ||
5 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
6 | * - Added _PDC for platforms with Intel CPUs | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/acpi.h> | ||
13 | |||
14 | #include <acpi/processor.h> | ||
15 | #include <asm/acpi.h> | ||
16 | |||
17 | static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) | ||
18 | { | ||
19 | struct acpi_object_list *obj_list; | ||
20 | union acpi_object *obj; | ||
21 | u32 *buf; | ||
22 | |||
23 | /* allocate and initialize pdc. It will be used later. */ | ||
24 | obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL); | ||
25 | if (!obj_list) { | ||
26 | printk(KERN_ERR "Memory allocation error\n"); | ||
27 | return; | ||
28 | } | ||
29 | |||
30 | obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL); | ||
31 | if (!obj) { | ||
32 | printk(KERN_ERR "Memory allocation error\n"); | ||
33 | kfree(obj_list); | ||
34 | return; | ||
35 | } | ||
36 | |||
37 | buf = kmalloc(12, GFP_KERNEL); | ||
38 | if (!buf) { | ||
39 | printk(KERN_ERR "Memory allocation error\n"); | ||
40 | kfree(obj); | ||
41 | kfree(obj_list); | ||
42 | return; | ||
43 | } | ||
44 | |||
45 | buf[0] = ACPI_PDC_REVISION_ID; | ||
46 | buf[1] = 1; | ||
47 | buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; | ||
48 | |||
49 | obj->type = ACPI_TYPE_BUFFER; | ||
50 | obj->buffer.length = 12; | ||
51 | obj->buffer.pointer = (u8 *) buf; | ||
52 | obj_list->count = 1; | ||
53 | obj_list->pointer = obj; | ||
54 | pr->pdc = obj_list; | ||
55 | |||
56 | return; | ||
57 | } | ||
58 | |||
59 | /* Initialize _PDC data based on the CPU vendor */ | ||
60 | void arch_acpi_processor_init_pdc(struct acpi_processor *pr) | ||
61 | { | ||
62 | unsigned int cpu = pr->id; | ||
63 | struct cpuinfo_x86 *c = cpu_data + cpu; | ||
64 | |||
65 | pr->pdc = NULL; | ||
66 | if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST)) | ||
67 | init_intel_pdc(pr, c); | ||
68 | |||
69 | return; | ||
70 | } | ||
71 | |||
72 | EXPORT_SYMBOL(arch_acpi_processor_init_pdc); | ||
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 230c53852231..94b8d820c512 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -10,9 +10,8 @@ menu "ACPI (Advanced Configuration and Power Interface) Support" | |||
10 | config ACPI | 10 | config ACPI |
11 | bool "ACPI Support" | 11 | bool "ACPI Support" |
12 | depends on IA64 || X86 | 12 | depends on IA64 || X86 |
13 | depends on PCI | ||
13 | select PM | 14 | select PM |
14 | select PCI | ||
15 | |||
16 | default y | 15 | default y |
17 | ---help--- | 16 | ---help--- |
18 | Advanced Configuration and Power Interface (ACPI) support for | 17 | Advanced Configuration and Power Interface (ACPI) support for |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index d882bf87fa96..e0a95ba72371 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -74,7 +74,7 @@ struct acpi_memory_device { | |||
74 | unsigned short caching; /* memory cache attribute */ | 74 | unsigned short caching; /* memory cache attribute */ |
75 | unsigned short write_protect; /* memory read/write attribute */ | 75 | unsigned short write_protect; /* memory read/write attribute */ |
76 | u64 start_addr; /* Memory Range start physical addr */ | 76 | u64 start_addr; /* Memory Range start physical addr */ |
77 | u64 end_addr; /* Memory Range end physical addr */ | 77 | u64 length; /* Memory Range length */ |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static int | 80 | static int |
@@ -97,12 +97,11 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
97 | if (ACPI_SUCCESS(status)) { | 97 | if (ACPI_SUCCESS(status)) { |
98 | if (address64.resource_type == ACPI_MEMORY_RANGE) { | 98 | if (address64.resource_type == ACPI_MEMORY_RANGE) { |
99 | /* Populate the structure */ | 99 | /* Populate the structure */ |
100 | mem_device->caching = | 100 | mem_device->caching = address64.info.mem.caching; |
101 | address64.info.mem.caching; | ||
102 | mem_device->write_protect = | 101 | mem_device->write_protect = |
103 | address64.info.mem.write_protect; | 102 | address64.info.mem.write_protect; |
104 | mem_device->start_addr = address64.minimum; | 103 | mem_device->start_addr = address64.minimum; |
105 | mem_device->end_addr = address64.maximum; | 104 | mem_device->length = address64.address_length; |
106 | } | 105 | } |
107 | } | 106 | } |
108 | 107 | ||
@@ -199,8 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
199 | * Tell the VM there is more memory here... | 198 | * Tell the VM there is more memory here... |
200 | * Note: Assume that this function returns zero on success | 199 | * Note: Assume that this function returns zero on success |
201 | */ | 200 | */ |
202 | result = add_memory(mem_device->start_addr, | 201 | result = add_memory(mem_device->start_addr, mem_device->length); |
203 | (mem_device->end_addr - mem_device->start_addr) + 1); | ||
204 | if (result) { | 202 | if (result) { |
205 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); | 203 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); |
206 | mem_device->state = MEMORY_INVALID_STATE; | 204 | mem_device->state = MEMORY_INVALID_STATE; |
@@ -249,7 +247,7 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) | |||
249 | { | 247 | { |
250 | int result; | 248 | int result; |
251 | u64 start = mem_device->start_addr; | 249 | u64 start = mem_device->start_addr; |
252 | u64 len = mem_device->end_addr - start + 1; | 250 | u64 len = mem_device->length; |
253 | 251 | ||
254 | ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); | 252 | ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); |
255 | 253 | ||
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index f4c87750dbf2..839f423d738d 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -817,7 +817,7 @@ typedef int (proc_writefunc) (struct file * file, const char __user * buffer, | |||
817 | unsigned long count, void *data); | 817 | unsigned long count, void *data); |
818 | 818 | ||
819 | static int | 819 | static int |
820 | __init asus_proc_add(char *name, proc_writefunc * writefunc, | 820 | asus_proc_add(char *name, proc_writefunc * writefunc, |
821 | proc_readfunc * readfunc, mode_t mode, | 821 | proc_readfunc * readfunc, mode_t mode, |
822 | struct acpi_device *device) | 822 | struct acpi_device *device) |
823 | { | 823 | { |
@@ -836,7 +836,7 @@ __init asus_proc_add(char *name, proc_writefunc * writefunc, | |||
836 | return 0; | 836 | return 0; |
837 | } | 837 | } |
838 | 838 | ||
839 | static int __init asus_hotk_add_fs(struct acpi_device *device) | 839 | static int asus_hotk_add_fs(struct acpi_device *device) |
840 | { | 840 | { |
841 | struct proc_dir_entry *proc; | 841 | struct proc_dir_entry *proc; |
842 | mode_t mode; | 842 | mode_t mode; |
@@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) | |||
954 | * This function is used to initialize the hotk with right values. In this | 954 | * This function is used to initialize the hotk with right values. In this |
955 | * method, we can make all the detection we want, and modify the hotk struct | 955 | * method, we can make all the detection we want, and modify the hotk struct |
956 | */ | 956 | */ |
957 | static int __init asus_hotk_get_info(void) | 957 | static int asus_hotk_get_info(void) |
958 | { | 958 | { |
959 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 959 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
960 | struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; | 960 | struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; |
@@ -970,7 +970,7 @@ static int __init asus_hotk_get_info(void) | |||
970 | * HID), this bit will be moved. A global variable asus_info contains | 970 | * HID), this bit will be moved. A global variable asus_info contains |
971 | * the DSDT header. | 971 | * the DSDT header. |
972 | */ | 972 | */ |
973 | status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); | 973 | status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); |
974 | if (ACPI_FAILURE(status)) | 974 | if (ACPI_FAILURE(status)) |
975 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); | 975 | printk(KERN_WARNING " Couldn't get the DSDT table header\n"); |
976 | else | 976 | else |
@@ -1101,7 +1101,7 @@ static int __init asus_hotk_get_info(void) | |||
1101 | return AE_OK; | 1101 | return AE_OK; |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | static int __init asus_hotk_check(void) | 1104 | static int asus_hotk_check(void) |
1105 | { | 1105 | { |
1106 | int result = 0; | 1106 | int result = 0; |
1107 | 1107 | ||
@@ -1119,7 +1119,9 @@ static int __init asus_hotk_check(void) | |||
1119 | return result; | 1119 | return result; |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | static int __init asus_hotk_add(struct acpi_device *device) | 1122 | static int asus_hotk_found; |
1123 | |||
1124 | static int asus_hotk_add(struct acpi_device *device) | ||
1123 | { | 1125 | { |
1124 | acpi_status status = AE_OK; | 1126 | acpi_status status = AE_OK; |
1125 | int result; | 1127 | int result; |
@@ -1180,6 +1182,8 @@ static int __init asus_hotk_add(struct acpi_device *device) | |||
1180 | } | 1182 | } |
1181 | } | 1183 | } |
1182 | 1184 | ||
1185 | asus_hotk_found = 1; | ||
1186 | |||
1183 | end: | 1187 | end: |
1184 | if (result) { | 1188 | if (result) { |
1185 | kfree(hotk); | 1189 | kfree(hotk); |
@@ -1226,12 +1230,24 @@ static int __init asus_acpi_init(void) | |||
1226 | asus_proc_dir->owner = THIS_MODULE; | 1230 | asus_proc_dir->owner = THIS_MODULE; |
1227 | 1231 | ||
1228 | result = acpi_bus_register_driver(&asus_hotk_driver); | 1232 | result = acpi_bus_register_driver(&asus_hotk_driver); |
1229 | if (result < 1) { | 1233 | if (result < 0) { |
1230 | acpi_bus_unregister_driver(&asus_hotk_driver); | ||
1231 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | 1234 | remove_proc_entry(PROC_ASUS, acpi_root_dir); |
1232 | return -ENODEV; | 1235 | return -ENODEV; |
1233 | } | 1236 | } |
1234 | 1237 | ||
1238 | /* | ||
1239 | * This is a bit of a kludge. We only want this module loaded | ||
1240 | * for ASUS systems, but there's currently no way to probe the | ||
1241 | * ACPI namespace for ASUS HIDs. So we just return failure if | ||
1242 | * we didn't find one, which will cause the module to be | ||
1243 | * unloaded. | ||
1244 | */ | ||
1245 | if (!asus_hotk_found) { | ||
1246 | acpi_bus_unregister_driver(&asus_hotk_driver); | ||
1247 | remove_proc_entry(PROC_ASUS, acpi_root_dir); | ||
1248 | return result; | ||
1249 | } | ||
1250 | |||
1235 | return 0; | 1251 | return 0; |
1236 | } | 1252 | } |
1237 | 1253 | ||
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 606f8733a776..dd3983cece92 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME("acpi_bus") | |||
43 | extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); | 43 | extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger); |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | FADT_DESCRIPTOR acpi_fadt; | 46 | struct fadt_descriptor acpi_fadt; |
47 | EXPORT_SYMBOL(acpi_fadt); | 47 | EXPORT_SYMBOL(acpi_fadt); |
48 | 48 | ||
49 | struct acpi_device *acpi_root; | 49 | struct acpi_device *acpi_root; |
@@ -205,12 +205,14 @@ int acpi_bus_set_power(acpi_handle handle, int state) | |||
205 | * Get device's current power state if it's unknown | 205 | * Get device's current power state if it's unknown |
206 | * This means device power state isn't initialized or previous setting failed | 206 | * This means device power state isn't initialized or previous setting failed |
207 | */ | 207 | */ |
208 | if (device->power.state == ACPI_STATE_UNKNOWN) | 208 | if (!device->flags.force_power_state) { |
209 | acpi_bus_get_power(device->handle, &device->power.state); | 209 | if (device->power.state == ACPI_STATE_UNKNOWN) |
210 | if (state == device->power.state) { | 210 | acpi_bus_get_power(device->handle, &device->power.state); |
211 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", | 211 | if (state == device->power.state) { |
212 | state)); | 212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", |
213 | return_VALUE(0); | 213 | state)); |
214 | return_VALUE(0); | ||
215 | } | ||
214 | } | 216 | } |
215 | if (!device->power.states[state].flags.valid) { | 217 | if (!device->power.states[state].flags.valid) { |
216 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", | 218 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", |
@@ -596,6 +598,8 @@ void __init acpi_early_init(void) | |||
596 | if (acpi_disabled) | 598 | if (acpi_disabled) |
597 | return_VOID; | 599 | return_VOID; |
598 | 600 | ||
601 | printk(KERN_INFO PREFIX "Core revision %08x\n", ACPI_CA_VERSION); | ||
602 | |||
599 | /* enable workarounds, unless strict ACPI spec. compliance */ | 603 | /* enable workarounds, unless strict ACPI spec. compliance */ |
600 | if (!acpi_strict) | 604 | if (!acpi_strict) |
601 | acpi_gbl_enable_interpreter_slack = TRUE; | 605 | acpi_gbl_enable_interpreter_slack = TRUE; |
@@ -617,7 +621,7 @@ void __init acpi_early_init(void) | |||
617 | /* | 621 | /* |
618 | * Get a separate copy of the FADT for use by other drivers. | 622 | * Get a separate copy of the FADT for use by other drivers. |
619 | */ | 623 | */ |
620 | status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer); | 624 | status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &buffer); |
621 | if (ACPI_FAILURE(status)) { | 625 | if (ACPI_FAILURE(status)) { |
622 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); | 626 | printk(KERN_ERR PREFIX "Unable to get the FADT\n"); |
623 | goto error0; | 627 | goto error0; |
@@ -743,8 +747,6 @@ static int __init acpi_init(void) | |||
743 | 747 | ||
744 | ACPI_FUNCTION_TRACE("acpi_init"); | 748 | ACPI_FUNCTION_TRACE("acpi_init"); |
745 | 749 | ||
746 | printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION); | ||
747 | |||
748 | if (acpi_disabled) { | 750 | if (acpi_disabled) { |
749 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); | 751 | printk(KERN_INFO PREFIX "Interpreter disabled.\n"); |
750 | return_VALUE(-ENODEV); | 752 | return_VALUE(-ENODEV); |
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index 76bc0463f6de..a6d77efb41a0 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
@@ -87,7 +87,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
87 | union acpi_operand_object *second_desc = NULL; | 87 | union acpi_operand_object *second_desc = NULL; |
88 | u32 flags; | 88 | u32 flags; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ds_create_buffer_field"); | 90 | ACPI_FUNCTION_TRACE(ds_create_buffer_field); |
91 | 91 | ||
92 | /* Get the name_string argument */ | 92 | /* Get the name_string argument */ |
93 | 93 | ||
@@ -210,7 +210,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
210 | acpi_status status; | 210 | acpi_status status; |
211 | acpi_integer position; | 211 | acpi_integer position; |
212 | 212 | ||
213 | ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info); | 213 | ACPI_FUNCTION_TRACE_PTR(ds_get_field_names, info); |
214 | 214 | ||
215 | /* First field starts at bit zero */ | 215 | /* First field starts at bit zero */ |
216 | 216 | ||
@@ -342,7 +342,7 @@ acpi_ds_create_field(union acpi_parse_object *op, | |||
342 | union acpi_parse_object *arg; | 342 | union acpi_parse_object *arg; |
343 | struct acpi_create_field_info info; | 343 | struct acpi_create_field_info info; |
344 | 344 | ||
345 | ACPI_FUNCTION_TRACE_PTR("ds_create_field", op); | 345 | ACPI_FUNCTION_TRACE_PTR(ds_create_field, op); |
346 | 346 | ||
347 | /* First arg is the name of the parent op_region (must already exist) */ | 347 | /* First arg is the name of the parent op_region (must already exist) */ |
348 | 348 | ||
@@ -399,7 +399,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
399 | struct acpi_namespace_node *node; | 399 | struct acpi_namespace_node *node; |
400 | u8 type = 0; | 400 | u8 type = 0; |
401 | 401 | ||
402 | ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); |
403 | 403 | ||
404 | switch (walk_state->opcode) { | 404 | switch (walk_state->opcode) { |
405 | case AML_FIELD_OP: | 405 | case AML_FIELD_OP: |
@@ -425,6 +425,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
425 | * Walk the list of entries in the field_list | 425 | * Walk the list of entries in the field_list |
426 | */ | 426 | */ |
427 | while (arg) { | 427 | while (arg) { |
428 | |||
428 | /* Ignore OFFSET and ACCESSAS terms here */ | 429 | /* Ignore OFFSET and ACCESSAS terms here */ |
429 | 430 | ||
430 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { | 431 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { |
@@ -481,7 +482,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
481 | union acpi_parse_object *arg; | 482 | union acpi_parse_object *arg; |
482 | struct acpi_create_field_info info; | 483 | struct acpi_create_field_info info; |
483 | 484 | ||
484 | ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op); | 485 | ACPI_FUNCTION_TRACE_PTR(ds_create_bank_field, op); |
485 | 486 | ||
486 | /* First arg is the name of the parent op_region (must already exist) */ | 487 | /* First arg is the name of the parent op_region (must already exist) */ |
487 | 488 | ||
@@ -554,7 +555,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op, | |||
554 | union acpi_parse_object *arg; | 555 | union acpi_parse_object *arg; |
555 | struct acpi_create_field_info info; | 556 | struct acpi_create_field_info info; |
556 | 557 | ||
557 | ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op); | 558 | ACPI_FUNCTION_TRACE_PTR(ds_create_index_field, op); |
558 | 559 | ||
559 | /* First arg is the name of the Index register (must already exist) */ | 560 | /* First arg is the name of the Index register (must already exist) */ |
560 | 561 | ||
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index e65a07ad2422..bbdf990e9f65 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -184,7 +184,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle, | |||
184 | * | 184 | * |
185 | * RETURN: Status | 185 | * RETURN: Status |
186 | * | 186 | * |
187 | * DESCRIPTION: Walk the namespace starting at "start_node" and perform any | 187 | * DESCRIPTION: Walk the namespace starting at "StartNode" and perform any |
188 | * necessary initialization on the objects found therein | 188 | * necessary initialization on the objects found therein |
189 | * | 189 | * |
190 | ******************************************************************************/ | 190 | ******************************************************************************/ |
@@ -196,7 +196,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
196 | acpi_status status; | 196 | acpi_status status; |
197 | struct acpi_init_walk_info info; | 197 | struct acpi_init_walk_info info; |
198 | 198 | ||
199 | ACPI_FUNCTION_TRACE("ds_initialize_objects"); | 199 | ACPI_FUNCTION_TRACE(ds_initialize_objects); |
200 | 200 | ||
201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
202 | "**** Starting initialization of namespace objects ****\n")); | 202 | "**** Starting initialization of namespace objects ****\n")); |
@@ -213,7 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc, | |||
213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, | 213 | status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, |
214 | acpi_ds_init_one_object, &info, NULL); | 214 | acpi_ds_init_one_object, &info, NULL); |
215 | if (ACPI_FAILURE(status)) { | 215 | if (ACPI_FAILURE(status)) { |
216 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 216 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
217 | } | 217 | } |
218 | 218 | ||
219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 219 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index c475546535b6..bc9aca4e7401 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -81,6 +81,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
81 | /* Invoke the global exception handler */ | 81 | /* Invoke the global exception handler */ |
82 | 82 | ||
83 | if (acpi_gbl_exception_handler) { | 83 | if (acpi_gbl_exception_handler) { |
84 | |||
84 | /* Exit the interpreter, allow handler to execute methods */ | 85 | /* Exit the interpreter, allow handler to execute methods */ |
85 | 86 | ||
86 | acpi_ex_exit_interpreter(); | 87 | acpi_ex_exit_interpreter(); |
@@ -100,6 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
100 | } | 101 | } |
101 | #ifdef ACPI_DISASSEMBLER | 102 | #ifdef ACPI_DISASSEMBLER |
102 | if (ACPI_FAILURE(status)) { | 103 | if (ACPI_FAILURE(status)) { |
104 | |||
103 | /* Display method locals/args if disassembler is present */ | 105 | /* Display method locals/args if disassembler is present */ |
104 | 106 | ||
105 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); | 107 | acpi_dm_dump_method_info(status, walk_state, walk_state->op); |
@@ -132,7 +134,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
132 | { | 134 | { |
133 | acpi_status status = AE_OK; | 135 | acpi_status status = AE_OK; |
134 | 136 | ||
135 | ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node); | 137 | ACPI_FUNCTION_TRACE_PTR(ds_begin_method_execution, method_node); |
136 | 138 | ||
137 | if (!method_node) { | 139 | if (!method_node) { |
138 | return_ACPI_STATUS(AE_NULL_ENTRY); | 140 | return_ACPI_STATUS(AE_NULL_ENTRY); |
@@ -168,11 +170,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
168 | 170 | ||
169 | /* | 171 | /* |
170 | * Get a unit from the method semaphore. This releases the | 172 | * Get a unit from the method semaphore. This releases the |
171 | * interpreter if we block | 173 | * interpreter if we block (then reacquires it) |
172 | */ | 174 | */ |
173 | status = | 175 | status = |
174 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, | 176 | acpi_ex_system_wait_semaphore(obj_desc->method.semaphore, |
175 | ACPI_WAIT_FOREVER); | 177 | ACPI_WAIT_FOREVER); |
178 | if (ACPI_FAILURE(status)) { | ||
179 | return_ACPI_STATUS(status); | ||
180 | } | ||
176 | } | 181 | } |
177 | 182 | ||
178 | /* | 183 | /* |
@@ -183,7 +188,7 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
183 | if (!obj_desc->method.owner_id) { | 188 | if (!obj_desc->method.owner_id) { |
184 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); | 189 | status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id); |
185 | if (ACPI_FAILURE(status)) { | 190 | if (ACPI_FAILURE(status)) { |
186 | return_ACPI_STATUS(status); | 191 | goto cleanup; |
187 | } | 192 | } |
188 | } | 193 | } |
189 | 194 | ||
@@ -193,6 +198,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node, | |||
193 | */ | 198 | */ |
194 | obj_desc->method.thread_count++; | 199 | obj_desc->method.thread_count++; |
195 | return_ACPI_STATUS(status); | 200 | return_ACPI_STATUS(status); |
201 | |||
202 | cleanup: | ||
203 | /* On error, must signal the method semaphore if present */ | ||
204 | |||
205 | if (obj_desc->method.semaphore) { | ||
206 | (void)acpi_os_signal_semaphore(obj_desc->method.semaphore, 1); | ||
207 | } | ||
208 | return_ACPI_STATUS(status); | ||
196 | } | 209 | } |
197 | 210 | ||
198 | /******************************************************************************* | 211 | /******************************************************************************* |
@@ -218,10 +231,10 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
218 | struct acpi_namespace_node *method_node; | 231 | struct acpi_namespace_node *method_node; |
219 | struct acpi_walk_state *next_walk_state = NULL; | 232 | struct acpi_walk_state *next_walk_state = NULL; |
220 | union acpi_operand_object *obj_desc; | 233 | union acpi_operand_object *obj_desc; |
221 | struct acpi_parameter_info info; | 234 | struct acpi_evaluate_info *info; |
222 | u32 i; | 235 | u32 i; |
223 | 236 | ||
224 | ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state); | 237 | ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state); |
225 | 238 | ||
226 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 239 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
227 | "Execute method %p, currentstate=%p\n", | 240 | "Execute method %p, currentstate=%p\n", |
@@ -240,25 +253,31 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
240 | return_ACPI_STATUS(AE_NULL_OBJECT); | 253 | return_ACPI_STATUS(AE_NULL_OBJECT); |
241 | } | 254 | } |
242 | 255 | ||
243 | /* Init for new method, wait on concurrency semaphore */ | 256 | /* Init for new method, possibly wait on concurrency semaphore */ |
244 | 257 | ||
245 | status = acpi_ds_begin_method_execution(method_node, obj_desc, | 258 | status = acpi_ds_begin_method_execution(method_node, obj_desc, |
246 | this_walk_state->method_node); | 259 | this_walk_state->method_node); |
247 | if (ACPI_FAILURE(status)) { | 260 | if (ACPI_FAILURE(status)) { |
248 | goto cleanup; | 261 | return_ACPI_STATUS(status); |
249 | } | 262 | } |
250 | 263 | ||
264 | /* | ||
265 | * 1) Parse the method. All "normal" methods are parsed for each execution. | ||
266 | * Internal methods (_OSI, etc.) do not require parsing. | ||
267 | */ | ||
251 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { | 268 | if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) { |
252 | /* 1) Parse: Create a new walk state for the preempting walk */ | 269 | |
270 | /* Create a new walk state for the parse */ | ||
253 | 271 | ||
254 | next_walk_state = | 272 | next_walk_state = |
255 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, | 273 | acpi_ds_create_walk_state(obj_desc->method.owner_id, op, |
256 | obj_desc, NULL); | 274 | obj_desc, NULL); |
257 | if (!next_walk_state) { | 275 | if (!next_walk_state) { |
258 | return_ACPI_STATUS(AE_NO_MEMORY); | 276 | status = AE_NO_MEMORY; |
277 | goto cleanup; | ||
259 | } | 278 | } |
260 | 279 | ||
261 | /* Create and init a Root Node */ | 280 | /* Create and init a parse tree root */ |
262 | 281 | ||
263 | op = acpi_ps_create_scope_op(); | 282 | op = acpi_ps_create_scope_op(); |
264 | if (!op) { | 283 | if (!op) { |
@@ -271,17 +290,20 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
271 | obj_desc->method.aml_length, | 290 | obj_desc->method.aml_length, |
272 | NULL, 1); | 291 | NULL, 1); |
273 | if (ACPI_FAILURE(status)) { | 292 | if (ACPI_FAILURE(status)) { |
274 | acpi_ds_delete_walk_state(next_walk_state); | 293 | acpi_ps_delete_parse_tree(op); |
275 | goto cleanup; | 294 | goto cleanup; |
276 | } | 295 | } |
277 | 296 | ||
278 | /* Begin AML parse */ | 297 | /* Begin AML parse (deletes next_walk_state) */ |
279 | 298 | ||
280 | status = acpi_ps_parse_aml(next_walk_state); | 299 | status = acpi_ps_parse_aml(next_walk_state); |
281 | acpi_ps_delete_parse_tree(op); | 300 | acpi_ps_delete_parse_tree(op); |
301 | if (ACPI_FAILURE(status)) { | ||
302 | goto cleanup; | ||
303 | } | ||
282 | } | 304 | } |
283 | 305 | ||
284 | /* 2) Execute: Create a new state for the preempting walk */ | 306 | /* 2) Begin method execution. Create a new walk state */ |
285 | 307 | ||
286 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, | 308 | next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, |
287 | NULL, obj_desc, thread); | 309 | NULL, obj_desc, thread); |
@@ -289,6 +311,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
289 | status = AE_NO_MEMORY; | 311 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 312 | goto cleanup; |
291 | } | 313 | } |
314 | |||
292 | /* | 315 | /* |
293 | * The resolved arguments were put on the previous walk state's operand | 316 | * The resolved arguments were put on the previous walk state's operand |
294 | * stack. Operands on the previous walk state stack always | 317 | * stack. Operands on the previous walk state stack always |
@@ -296,12 +319,24 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
296 | */ | 319 | */ |
297 | this_walk_state->operands[this_walk_state->num_operands] = NULL; | 320 | this_walk_state->operands[this_walk_state->num_operands] = NULL; |
298 | 321 | ||
299 | info.parameters = &this_walk_state->operands[0]; | 322 | /* |
300 | info.parameter_type = ACPI_PARAM_ARGS; | 323 | * Allocate and initialize the evaluation information block |
324 | * TBD: this is somewhat inefficient, should change interface to | ||
325 | * ds_init_aml_walk. For now, keeps this struct off the CPU stack | ||
326 | */ | ||
327 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
328 | if (!info) { | ||
329 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
330 | } | ||
331 | |||
332 | info->parameters = &this_walk_state->operands[0]; | ||
333 | info->parameter_type = ACPI_PARAM_ARGS; | ||
301 | 334 | ||
302 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, | 335 | status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node, |
303 | obj_desc->method.aml_start, | 336 | obj_desc->method.aml_start, |
304 | obj_desc->method.aml_length, &info, 3); | 337 | obj_desc->method.aml_length, info, 3); |
338 | |||
339 | ACPI_FREE(info); | ||
305 | if (ACPI_FAILURE(status)) { | 340 | if (ACPI_FAILURE(status)) { |
306 | goto cleanup; | 341 | goto cleanup; |
307 | } | 342 | } |
@@ -323,6 +358,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
323 | "Starting nested execution, newstate=%p\n", | 358 | "Starting nested execution, newstate=%p\n", |
324 | next_walk_state)); | 359 | next_walk_state)); |
325 | 360 | ||
361 | /* Invoke an internal method if necessary */ | ||
362 | |||
326 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { | 363 | if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) { |
327 | status = obj_desc->method.implementation(next_walk_state); | 364 | status = obj_desc->method.implementation(next_walk_state); |
328 | } | 365 | } |
@@ -330,16 +367,14 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, | |||
330 | return_ACPI_STATUS(status); | 367 | return_ACPI_STATUS(status); |
331 | 368 | ||
332 | cleanup: | 369 | cleanup: |
333 | /* Decrement the thread count on the method parse tree */ | ||
334 | 370 | ||
335 | if (next_walk_state && (next_walk_state->method_desc)) { | 371 | /* On error, we must terminate the method properly */ |
336 | next_walk_state->method_desc->method.thread_count--; | ||
337 | } | ||
338 | 372 | ||
339 | /* On error, we must delete the new walk state */ | 373 | acpi_ds_terminate_control_method(obj_desc, next_walk_state); |
374 | if (next_walk_state) { | ||
375 | acpi_ds_delete_walk_state(next_walk_state); | ||
376 | } | ||
340 | 377 | ||
341 | acpi_ds_terminate_control_method(next_walk_state); | ||
342 | acpi_ds_delete_walk_state(next_walk_state); | ||
343 | return_ACPI_STATUS(status); | 378 | return_ACPI_STATUS(status); |
344 | } | 379 | } |
345 | 380 | ||
@@ -362,25 +397,33 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
362 | union acpi_operand_object *return_desc) | 397 | union acpi_operand_object *return_desc) |
363 | { | 398 | { |
364 | acpi_status status; | 399 | acpi_status status; |
400 | int same_as_implicit_return; | ||
365 | 401 | ||
366 | ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state); | 402 | ACPI_FUNCTION_TRACE_PTR(ds_restart_control_method, walk_state); |
367 | 403 | ||
368 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 404 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
369 | "****Restart [%4.4s] Op %p return_value_from_callee %p\n", | 405 | "****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n", |
370 | (char *)&walk_state->method_node->name, | 406 | (char *)&walk_state->method_node->name, |
371 | walk_state->method_call_op, return_desc)); | 407 | walk_state->method_call_op, return_desc)); |
372 | 408 | ||
373 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 409 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
374 | " return_from_this_method_used?=%X res_stack %p Walk %p\n", | 410 | " ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n", |
375 | walk_state->return_used, | 411 | walk_state->return_used, |
376 | walk_state->results, walk_state)); | 412 | walk_state->results, walk_state)); |
377 | 413 | ||
378 | /* Did the called method return a value? */ | 414 | /* Did the called method return a value? */ |
379 | 415 | ||
380 | if (return_desc) { | 416 | if (return_desc) { |
417 | |||
418 | /* Is the implicit return object the same as the return desc? */ | ||
419 | |||
420 | same_as_implicit_return = | ||
421 | (walk_state->implicit_return_obj == return_desc); | ||
422 | |||
381 | /* Are we actually going to use the return value? */ | 423 | /* Are we actually going to use the return value? */ |
382 | 424 | ||
383 | if (walk_state->return_used) { | 425 | if (walk_state->return_used) { |
426 | |||
384 | /* Save the return value from the previous method */ | 427 | /* Save the return value from the previous method */ |
385 | 428 | ||
386 | status = acpi_ds_result_push(return_desc, walk_state); | 429 | status = acpi_ds_result_push(return_desc, walk_state); |
@@ -397,18 +440,23 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
397 | } | 440 | } |
398 | 441 | ||
399 | /* | 442 | /* |
400 | * The following code is the | 443 | * The following code is the optional support for the so-called |
401 | * optional support for a so-called "implicit return". Some AML code | 444 | * "implicit return". Some AML code assumes that the last value of the |
402 | * assumes that the last value of the method is "implicitly" returned | 445 | * method is "implicitly" returned to the caller, in the absence of an |
403 | * to the caller. Just save the last result as the return value. | 446 | * explicit return value. |
447 | * | ||
448 | * Just save the last result of the method as the return value. | ||
449 | * | ||
404 | * NOTE: this is optional because the ASL language does not actually | 450 | * NOTE: this is optional because the ASL language does not actually |
405 | * support this behavior. | 451 | * support this behavior. |
406 | */ | 452 | */ |
407 | else if (!acpi_ds_do_implicit_return | 453 | else if (!acpi_ds_do_implicit_return |
408 | (return_desc, walk_state, FALSE)) { | 454 | (return_desc, walk_state, FALSE) |
455 | || same_as_implicit_return) { | ||
409 | /* | 456 | /* |
410 | * Delete the return value if it will not be used by the | 457 | * Delete the return value if it will not be used by the |
411 | * calling method | 458 | * calling method or remove one reference if the explicit return |
459 | * is the same as the implicit return value. | ||
412 | */ | 460 | */ |
413 | acpi_ut_remove_reference(return_desc); | 461 | acpi_ut_remove_reference(return_desc); |
414 | } | 462 | } |
@@ -421,7 +469,8 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
421 | * | 469 | * |
422 | * FUNCTION: acpi_ds_terminate_control_method | 470 | * FUNCTION: acpi_ds_terminate_control_method |
423 | * | 471 | * |
424 | * PARAMETERS: walk_state - State of the method | 472 | * PARAMETERS: method_desc - Method object |
473 | * walk_state - State associated with the method | ||
425 | * | 474 | * |
426 | * RETURN: None | 475 | * RETURN: None |
427 | * | 476 | * |
@@ -431,95 +480,100 @@ acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | |||
431 | * | 480 | * |
432 | ******************************************************************************/ | 481 | ******************************************************************************/ |
433 | 482 | ||
434 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | 483 | void |
484 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
485 | struct acpi_walk_state *walk_state) | ||
435 | { | 486 | { |
436 | union acpi_operand_object *obj_desc; | ||
437 | struct acpi_namespace_node *method_node; | 487 | struct acpi_namespace_node *method_node; |
438 | acpi_status status; | 488 | acpi_status status; |
439 | 489 | ||
440 | ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state); | 490 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); |
441 | 491 | ||
442 | if (!walk_state) { | 492 | /* method_desc is required, walk_state is optional */ |
443 | return_VOID; | ||
444 | } | ||
445 | 493 | ||
446 | /* The current method object was saved in the walk state */ | 494 | if (!method_desc) { |
447 | |||
448 | obj_desc = walk_state->method_desc; | ||
449 | if (!obj_desc) { | ||
450 | return_VOID; | 495 | return_VOID; |
451 | } | 496 | } |
452 | 497 | ||
453 | /* Delete all arguments and locals */ | 498 | if (walk_state) { |
454 | 499 | ||
455 | acpi_ds_method_data_delete_all(walk_state); | 500 | /* Delete all arguments and locals */ |
501 | |||
502 | acpi_ds_method_data_delete_all(walk_state); | ||
503 | } | ||
456 | 504 | ||
457 | /* | 505 | /* |
458 | * Lock the parser while we terminate this method. | 506 | * Lock the parser while we terminate this method. |
459 | * If this is the last thread executing the method, | 507 | * If this is the last thread executing the method, |
460 | * we have additional cleanup to perform | 508 | * we have additional cleanup to perform |
461 | */ | 509 | */ |
462 | status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER); | 510 | status = acpi_ut_acquire_mutex(ACPI_MTX_CONTROL_METHOD); |
463 | if (ACPI_FAILURE(status)) { | 511 | if (ACPI_FAILURE(status)) { |
464 | return_VOID; | 512 | return_VOID; |
465 | } | 513 | } |
466 | 514 | ||
467 | /* Signal completion of the execution of this method if necessary */ | 515 | /* Signal completion of the execution of this method if necessary */ |
468 | 516 | ||
469 | if (walk_state->method_desc->method.semaphore) { | 517 | if (method_desc->method.semaphore) { |
470 | status = | 518 | status = |
471 | acpi_os_signal_semaphore(walk_state->method_desc->method. | 519 | acpi_os_signal_semaphore(method_desc->method.semaphore, 1); |
472 | semaphore, 1); | ||
473 | if (ACPI_FAILURE(status)) { | 520 | if (ACPI_FAILURE(status)) { |
474 | ACPI_ERROR((AE_INFO, | ||
475 | "Could not signal method semaphore")); | ||
476 | 521 | ||
477 | /* Ignore error and continue cleanup */ | 522 | /* Ignore error and continue */ |
523 | |||
524 | ACPI_EXCEPTION((AE_INFO, status, | ||
525 | "Could not signal method semaphore")); | ||
478 | } | 526 | } |
479 | } | 527 | } |
480 | 528 | ||
481 | /* | 529 | if (walk_state) { |
482 | * There are no more threads executing this method. Perform | 530 | /* |
483 | * additional cleanup. | 531 | * Delete any objects created by this method during execution. |
484 | * | 532 | * The method Node is stored in the walk state |
485 | * The method Node is stored in the walk state | 533 | */ |
486 | */ | 534 | method_node = walk_state->method_node; |
487 | method_node = walk_state->method_node; | ||
488 | 535 | ||
489 | /* Lock namespace for possible update */ | 536 | /* Lock namespace for possible update */ |
490 | 537 | ||
491 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 538 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
492 | if (ACPI_FAILURE(status)) { | 539 | if (ACPI_FAILURE(status)) { |
493 | goto exit; | 540 | goto exit; |
494 | } | 541 | } |
495 | 542 | ||
496 | /* | 543 | /* |
497 | * Delete any namespace entries created immediately underneath | 544 | * Delete any namespace entries created immediately underneath |
498 | * the method | 545 | * the method |
499 | */ | 546 | */ |
500 | if (method_node->child) { | 547 | if (method_node && method_node->child) { |
501 | acpi_ns_delete_namespace_subtree(method_node); | 548 | acpi_ns_delete_namespace_subtree(method_node); |
549 | } | ||
550 | |||
551 | /* | ||
552 | * Delete any namespace entries created anywhere else within | ||
553 | * the namespace by the execution of this method | ||
554 | */ | ||
555 | acpi_ns_delete_namespace_by_owner(method_desc->method.owner_id); | ||
556 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
502 | } | 557 | } |
503 | 558 | ||
504 | /* | 559 | /* Decrement the thread count on the method */ |
505 | * Delete any namespace entries created anywhere else within | 560 | |
506 | * the namespace by the execution of this method | 561 | if (method_desc->method.thread_count) { |
507 | */ | 562 | method_desc->method.thread_count--; |
508 | acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method. | 563 | } else { |
509 | owner_id); | 564 | ACPI_ERROR((AE_INFO, "Invalid zero thread count in method")); |
510 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 565 | } |
511 | 566 | ||
512 | /* Are there any other threads currently executing this method? */ | 567 | /* Are there any other threads currently executing this method? */ |
513 | 568 | ||
514 | if (walk_state->method_desc->method.thread_count) { | 569 | if (method_desc->method.thread_count) { |
515 | /* | 570 | /* |
516 | * Additional threads. Do not release the owner_id in this case, | 571 | * Additional threads. Do not release the owner_id in this case, |
517 | * we immediately reuse it for the next thread executing this method | 572 | * we immediately reuse it for the next thread executing this method |
518 | */ | 573 | */ |
519 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 574 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
520 | "*** Completed execution of one thread, %d threads remaining\n", | 575 | "*** Completed execution of one thread, %d threads remaining\n", |
521 | walk_state->method_desc->method. | 576 | method_desc->method.thread_count)); |
522 | thread_count)); | ||
523 | } else { | 577 | } else { |
524 | /* This is the only executing thread for this method */ | 578 | /* This is the only executing thread for this method */ |
525 | 579 | ||
@@ -533,22 +587,20 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state) | |||
533 | * This code is here because we must wait until the last thread exits | 587 | * This code is here because we must wait until the last thread exits |
534 | * before creating the synchronization semaphore. | 588 | * before creating the synchronization semaphore. |
535 | */ | 589 | */ |
536 | if ((walk_state->method_desc->method.concurrency == 1) && | 590 | if ((method_desc->method.concurrency == 1) && |
537 | (!walk_state->method_desc->method.semaphore)) { | 591 | (!method_desc->method.semaphore)) { |
538 | status = acpi_os_create_semaphore(1, 1, | 592 | status = acpi_os_create_semaphore(1, 1, |
539 | &walk_state-> | 593 | &method_desc->method. |
540 | method_desc->method. | ||
541 | semaphore); | 594 | semaphore); |
542 | } | 595 | } |
543 | 596 | ||
544 | /* No more threads, we can free the owner_id */ | 597 | /* No more threads, we can free the owner_id */ |
545 | 598 | ||
546 | acpi_ut_release_owner_id(&walk_state->method_desc->method. | 599 | acpi_ut_release_owner_id(&method_desc->method.owner_id); |
547 | owner_id); | ||
548 | } | 600 | } |
549 | 601 | ||
550 | exit: | 602 | exit: |
551 | (void)acpi_ut_release_mutex(ACPI_MTX_PARSER); | 603 | (void)acpi_ut_release_mutex(ACPI_MTX_CONTROL_METHOD); |
552 | return_VOID; | 604 | return_VOID; |
553 | } | 605 | } |
554 | 606 | ||
@@ -581,7 +633,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
581 | union acpi_parse_object *op; | 633 | union acpi_parse_object *op; |
582 | struct acpi_walk_state *walk_state; | 634 | struct acpi_walk_state *walk_state; |
583 | 635 | ||
584 | ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); | 636 | ACPI_FUNCTION_TRACE_PTR(ds_parse_method, node); |
585 | 637 | ||
586 | /* Parameter Validation */ | 638 | /* Parameter Validation */ |
587 | 639 | ||
@@ -590,7 +642,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
590 | } | 642 | } |
591 | 643 | ||
592 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 644 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
593 | "**** Parsing [%4.4s] **** named_obj=%p\n", | 645 | "**** Parsing [%4.4s] **** NamedObj=%p\n", |
594 | acpi_ut_get_node_name(node), node)); | 646 | acpi_ut_get_node_name(node), node)); |
595 | 647 | ||
596 | /* Extract the method object from the method Node */ | 648 | /* Extract the method object from the method Node */ |
@@ -669,7 +721,7 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) | |||
669 | } | 721 | } |
670 | 722 | ||
671 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 723 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
672 | "**** [%4.4s] Parsed **** named_obj=%p Op=%p\n", | 724 | "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", |
673 | acpi_ut_get_node_name(node), node, op)); | 725 | acpi_ut_get_node_name(node), node, op)); |
674 | 726 | ||
675 | /* | 727 | /* |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index c025674f938b..459160ff9058 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -81,7 +81,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
81 | * special data types. | 81 | * special data types. |
82 | * | 82 | * |
83 | * NOTES: walk_state fields are initialized to zero by the | 83 | * NOTES: walk_state fields are initialized to zero by the |
84 | * ACPI_MEM_CALLOCATE(). | 84 | * ACPI_ALLOCATE_ZEROED(). |
85 | * | 85 | * |
86 | * A pseudo-Namespace Node is assigned to each argument and local | 86 | * A pseudo-Namespace Node is assigned to each argument and local |
87 | * so that ref_of() can return a pointer to the Node. | 87 | * so that ref_of() can return a pointer to the Node. |
@@ -92,7 +92,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
92 | { | 92 | { |
93 | u32 i; | 93 | u32 i; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE("ds_method_data_init"); | 95 | ACPI_FUNCTION_TRACE(ds_method_data_init); |
96 | 96 | ||
97 | /* Init the method arguments */ | 97 | /* Init the method arguments */ |
98 | 98 | ||
@@ -100,10 +100,10 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, | 100 | ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, |
101 | NAMEOF_ARG_NTE); | 101 | NAMEOF_ARG_NTE); |
102 | walk_state->arguments[i].name.integer |= (i << 24); | 102 | walk_state->arguments[i].name.integer |= (i << 24); |
103 | walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; | 103 | walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; |
104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; | 104 | walk_state->arguments[i].type = ACPI_TYPE_ANY; |
105 | walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | | 105 | walk_state->arguments[i].flags = |
106 | ANOBJ_METHOD_ARG; | 106 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; |
107 | } | 107 | } |
108 | 108 | ||
109 | /* Init the method locals */ | 109 | /* Init the method locals */ |
@@ -113,11 +113,11 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) | |||
113 | NAMEOF_LOCAL_NTE); | 113 | NAMEOF_LOCAL_NTE); |
114 | 114 | ||
115 | walk_state->local_variables[i].name.integer |= (i << 24); | 115 | walk_state->local_variables[i].name.integer |= (i << 24); |
116 | walk_state->local_variables[i].descriptor = | 116 | walk_state->local_variables[i].descriptor_type = |
117 | ACPI_DESC_TYPE_NAMED; | 117 | ACPI_DESC_TYPE_NAMED; |
118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; | 118 | walk_state->local_variables[i].type = ACPI_TYPE_ANY; |
119 | walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | | 119 | walk_state->local_variables[i].flags = |
120 | ANOBJ_METHOD_LOCAL; | 120 | ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; |
121 | } | 121 | } |
122 | 122 | ||
123 | return_VOID; | 123 | return_VOID; |
@@ -140,7 +140,7 @@ void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state) | |||
140 | { | 140 | { |
141 | u32 index; | 141 | u32 index; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE("ds_method_data_delete_all"); | 143 | ACPI_FUNCTION_TRACE(ds_method_data_delete_all); |
144 | 144 | ||
145 | /* Detach the locals */ | 145 | /* Detach the locals */ |
146 | 146 | ||
@@ -199,7 +199,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, | |||
199 | acpi_status status; | 199 | acpi_status status; |
200 | u32 index = 0; | 200 | u32 index = 0; |
201 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params); | 202 | ACPI_FUNCTION_TRACE_PTR(ds_method_data_init_args, params); |
203 | 203 | ||
204 | if (!params) { | 204 | if (!params) { |
205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -251,7 +251,7 @@ acpi_ds_method_data_get_node(u16 opcode, | |||
251 | struct acpi_walk_state *walk_state, | 251 | struct acpi_walk_state *walk_state, |
252 | struct acpi_namespace_node **node) | 252 | struct acpi_namespace_node **node) |
253 | { | 253 | { |
254 | ACPI_FUNCTION_TRACE("ds_method_data_get_node"); | 254 | ACPI_FUNCTION_TRACE(ds_method_data_get_node); |
255 | 255 | ||
256 | /* | 256 | /* |
257 | * Method Locals and Arguments are supported | 257 | * Method Locals and Arguments are supported |
@@ -318,10 +318,10 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
318 | acpi_status status; | 318 | acpi_status status; |
319 | struct acpi_namespace_node *node; | 319 | struct acpi_namespace_node *node; |
320 | 320 | ||
321 | ACPI_FUNCTION_TRACE("ds_method_data_set_value"); | 321 | ACPI_FUNCTION_TRACE(ds_method_data_set_value); |
322 | 322 | ||
323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 323 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
324 | "new_obj %p Opcode %X, Refs=%d [%s]\n", object, | 324 | "NewObj %p Opcode %X, Refs=%d [%s]\n", object, |
325 | opcode, object->common.reference_count, | 325 | opcode, object->common.reference_count, |
326 | acpi_ut_get_type_name(object->common.type))); | 326 | acpi_ut_get_type_name(object->common.type))); |
327 | 327 | ||
@@ -336,7 +336,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
336 | * Increment ref count so object can't be deleted while installed. | 336 | * Increment ref count so object can't be deleted while installed. |
337 | * NOTE: We do not copy the object in order to preserve the call by | 337 | * NOTE: We do not copy the object in order to preserve the call by |
338 | * reference semantics of ACPI Control Method invocation. | 338 | * reference semantics of ACPI Control Method invocation. |
339 | * (See ACPI specification 2.0_c) | 339 | * (See ACPI Specification 2.0_c) |
340 | */ | 340 | */ |
341 | acpi_ut_add_reference(object); | 341 | acpi_ut_add_reference(object); |
342 | 342 | ||
@@ -351,7 +351,7 @@ acpi_ds_method_data_set_value(u16 opcode, | |||
351 | * FUNCTION: acpi_ds_method_data_get_value | 351 | * FUNCTION: acpi_ds_method_data_get_value |
352 | * | 352 | * |
353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 353 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
354 | * Index - which local_var or argument to get | 354 | * Index - Which local_var or argument to get |
355 | * walk_state - Current walk state object | 355 | * walk_state - Current walk state object |
356 | * dest_desc - Where Arg or Local value is returned | 356 | * dest_desc - Where Arg or Local value is returned |
357 | * | 357 | * |
@@ -372,7 +372,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
372 | struct acpi_namespace_node *node; | 372 | struct acpi_namespace_node *node; |
373 | union acpi_operand_object *object; | 373 | union acpi_operand_object *object; |
374 | 374 | ||
375 | ACPI_FUNCTION_TRACE("ds_method_data_get_value"); | 375 | ACPI_FUNCTION_TRACE(ds_method_data_get_value); |
376 | 376 | ||
377 | /* Validate the object descriptor */ | 377 | /* Validate the object descriptor */ |
378 | 378 | ||
@@ -459,7 +459,7 @@ acpi_ds_method_data_get_value(u16 opcode, | |||
459 | * FUNCTION: acpi_ds_method_data_delete_value | 459 | * FUNCTION: acpi_ds_method_data_delete_value |
460 | * | 460 | * |
461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP | 461 | * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP |
462 | * Index - which local_var or argument to delete | 462 | * Index - Which local_var or argument to delete |
463 | * walk_state - Current walk state object | 463 | * walk_state - Current walk state object |
464 | * | 464 | * |
465 | * RETURN: None | 465 | * RETURN: None |
@@ -477,7 +477,7 @@ acpi_ds_method_data_delete_value(u16 opcode, | |||
477 | struct acpi_namespace_node *node; | 477 | struct acpi_namespace_node *node; |
478 | union acpi_operand_object *object; | 478 | union acpi_operand_object *object; |
479 | 479 | ||
480 | ACPI_FUNCTION_TRACE("ds_method_data_delete_value"); | 480 | ACPI_FUNCTION_TRACE(ds_method_data_delete_value); |
481 | 481 | ||
482 | /* Get the namespace node for the arg/local */ | 482 | /* Get the namespace node for the arg/local */ |
483 | 483 | ||
@@ -538,7 +538,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
538 | union acpi_operand_object *current_obj_desc; | 538 | union acpi_operand_object *current_obj_desc; |
539 | union acpi_operand_object *new_obj_desc; | 539 | union acpi_operand_object *new_obj_desc; |
540 | 540 | ||
541 | ACPI_FUNCTION_TRACE("ds_store_object_to_local"); | 541 | ACPI_FUNCTION_TRACE(ds_store_object_to_local); |
542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", | 542 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n", |
543 | opcode, index, obj_desc)); | 543 | opcode, index, obj_desc)); |
544 | 544 | ||
@@ -614,7 +614,7 @@ acpi_ds_store_object_to_local(u16 opcode, | |||
614 | && (current_obj_desc->reference.opcode == | 614 | && (current_obj_desc->reference.opcode == |
615 | AML_REF_OF_OP)) { | 615 | AML_REF_OF_OP)) { |
616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 616 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
617 | "Arg (%p) is an obj_ref(Node), storing in node %p\n", | 617 | "Arg (%p) is an ObjRef(Node), storing in node %p\n", |
618 | new_obj_desc, | 618 | new_obj_desc, |
619 | current_obj_desc)); | 619 | current_obj_desc)); |
620 | 620 | ||
@@ -688,7 +688,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
688 | struct acpi_namespace_node *node; | 688 | struct acpi_namespace_node *node; |
689 | union acpi_operand_object *object; | 689 | union acpi_operand_object *object; |
690 | 690 | ||
691 | ACPI_FUNCTION_TRACE("ds_method_data_get_type"); | 691 | ACPI_FUNCTION_TRACE(ds_method_data_get_type); |
692 | 692 | ||
693 | /* Get the namespace node for the arg/local */ | 693 | /* Get the namespace node for the arg/local */ |
694 | 694 | ||
@@ -701,6 +701,7 @@ acpi_ds_method_data_get_type(u16 opcode, | |||
701 | 701 | ||
702 | object = acpi_ns_get_attached_object(node); | 702 | object = acpi_ns_get_attached_object(node); |
703 | if (!object) { | 703 | if (!object) { |
704 | |||
704 | /* Uninitialized local/arg, return TYPE_ANY */ | 705 | /* Uninitialized local/arg, return TYPE_ANY */ |
705 | 706 | ||
706 | return_VALUE(ACPI_TYPE_ANY); | 707 | return_VALUE(ACPI_TYPE_ANY); |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 8b21f0f9e517..72190abb1d59 100644 --- a/drivers/acpi/dispatcher/dsobject.c +++ b/drivers/acpi/dispatcher/dsobject.c | |||
@@ -81,7 +81,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
81 | union acpi_operand_object *obj_desc; | 81 | union acpi_operand_object *obj_desc; |
82 | acpi_status status; | 82 | acpi_status status; |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("ds_build_internal_object"); | 84 | ACPI_FUNCTION_TRACE(ds_build_internal_object); |
85 | 85 | ||
86 | *obj_desc_ptr = NULL; | 86 | *obj_desc_ptr = NULL; |
87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 87 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
@@ -103,6 +103,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
103 | common. | 103 | common. |
104 | node))); | 104 | node))); |
105 | if (ACPI_FAILURE(status)) { | 105 | if (ACPI_FAILURE(status)) { |
106 | |||
106 | /* Check if we are resolving a named reference within a package */ | 107 | /* Check if we are resolving a named reference within a package */ |
107 | 108 | ||
108 | if ((status == AE_NOT_FOUND) | 109 | if ((status == AE_NOT_FOUND) |
@@ -186,7 +187,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
186 | union acpi_parse_object *byte_list; | 187 | union acpi_parse_object *byte_list; |
187 | u32 byte_list_length = 0; | 188 | u32 byte_list_length = 0; |
188 | 189 | ||
189 | ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); | 190 | ACPI_FUNCTION_TRACE(ds_build_internal_buffer_obj); |
190 | 191 | ||
191 | /* | 192 | /* |
192 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". | 193 | * If we are evaluating a Named buffer object "Name (xxxx, Buffer)". |
@@ -195,6 +196,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
195 | */ | 196 | */ |
196 | obj_desc = *obj_desc_ptr; | 197 | obj_desc = *obj_desc_ptr; |
197 | if (!obj_desc) { | 198 | if (!obj_desc) { |
199 | |||
198 | /* Create a new buffer object */ | 200 | /* Create a new buffer object */ |
199 | 201 | ||
200 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 202 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
@@ -243,7 +245,7 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state, | |||
243 | "Buffer defined with zero length in AML, creating\n")); | 245 | "Buffer defined with zero length in AML, creating\n")); |
244 | } else { | 246 | } else { |
245 | obj_desc->buffer.pointer = | 247 | obj_desc->buffer.pointer = |
246 | ACPI_MEM_CALLOCATE(obj_desc->buffer.length); | 248 | ACPI_ALLOCATE_ZEROED(obj_desc->buffer.length); |
247 | if (!obj_desc->buffer.pointer) { | 249 | if (!obj_desc->buffer.pointer) { |
248 | acpi_ut_delete_object_desc(obj_desc); | 250 | acpi_ut_delete_object_desc(obj_desc); |
249 | return_ACPI_STATUS(AE_NO_MEMORY); | 251 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -291,7 +293,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
291 | acpi_status status = AE_OK; | 293 | acpi_status status = AE_OK; |
292 | acpi_native_uint i; | 294 | acpi_native_uint i; |
293 | 295 | ||
294 | ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); | 296 | ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); |
295 | 297 | ||
296 | /* Find the parent of a possibly nested package */ | 298 | /* Find the parent of a possibly nested package */ |
297 | 299 | ||
@@ -339,9 +341,10 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
339 | * individual objects). Add an extra pointer slot so | 341 | * individual objects). Add an extra pointer slot so |
340 | * that the list is always null terminated. | 342 | * that the list is always null terminated. |
341 | */ | 343 | */ |
342 | obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc-> | 344 | obj_desc->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
343 | package.count + | 345 | obj_desc->package. |
344 | 1) * sizeof(void *)); | 346 | count + |
347 | 1) * sizeof(void *)); | ||
345 | 348 | ||
346 | if (!obj_desc->package.elements) { | 349 | if (!obj_desc->package.elements) { |
347 | acpi_ut_delete_object_desc(obj_desc); | 350 | acpi_ut_delete_object_desc(obj_desc); |
@@ -355,6 +358,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
355 | arg = arg->common.next; | 358 | arg = arg->common.next; |
356 | for (i = 0; arg; i++) { | 359 | for (i = 0; arg; i++) { |
357 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 360 | if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
361 | |||
358 | /* Object (package or buffer) is already built */ | 362 | /* Object (package or buffer) is already built */ |
359 | 363 | ||
360 | obj_desc->package.elements[i] = | 364 | obj_desc->package.elements[i] = |
@@ -396,7 +400,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
396 | acpi_status status; | 400 | acpi_status status; |
397 | union acpi_operand_object *obj_desc; | 401 | union acpi_operand_object *obj_desc; |
398 | 402 | ||
399 | ACPI_FUNCTION_TRACE_PTR("ds_create_node", op); | 403 | ACPI_FUNCTION_TRACE_PTR(ds_create_node, op); |
400 | 404 | ||
401 | /* | 405 | /* |
402 | * Because of the execution pass through the non-control-method | 406 | * Because of the execution pass through the non-control-method |
@@ -408,6 +412,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, | |||
408 | } | 412 | } |
409 | 413 | ||
410 | if (!op->common.value.arg) { | 414 | if (!op->common.value.arg) { |
415 | |||
411 | /* No arguments, there is nothing to do */ | 416 | /* No arguments, there is nothing to do */ |
412 | 417 | ||
413 | return_ACPI_STATUS(AE_OK); | 418 | return_ACPI_STATUS(AE_OK); |
@@ -464,11 +469,12 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
464 | union acpi_operand_object *obj_desc; | 469 | union acpi_operand_object *obj_desc; |
465 | acpi_status status = AE_OK; | 470 | acpi_status status = AE_OK; |
466 | 471 | ||
467 | ACPI_FUNCTION_TRACE("ds_init_object_from_op"); | 472 | ACPI_FUNCTION_TRACE(ds_init_object_from_op); |
468 | 473 | ||
469 | obj_desc = *ret_obj_desc; | 474 | obj_desc = *ret_obj_desc; |
470 | op_info = acpi_ps_get_opcode_info(opcode); | 475 | op_info = acpi_ps_get_opcode_info(opcode); |
471 | if (op_info->class == AML_CLASS_UNKNOWN) { | 476 | if (op_info->class == AML_CLASS_UNKNOWN) { |
477 | |||
472 | /* Unknown opcode */ | 478 | /* Unknown opcode */ |
473 | 479 | ||
474 | return_ACPI_STATUS(AE_TYPE); | 480 | return_ACPI_STATUS(AE_TYPE); |
@@ -626,6 +632,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
626 | default: /* Other literals, etc.. */ | 632 | default: /* Other literals, etc.. */ |
627 | 633 | ||
628 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 634 | if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { |
635 | |||
629 | /* Node was saved in Op */ | 636 | /* Node was saved in Op */ |
630 | 637 | ||
631 | obj_desc->reference.node = op->common.node; | 638 | obj_desc->reference.node = op->common.node; |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index 6229c10674e1..5b974a8fe614 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -91,7 +91,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node, | |||
91 | union acpi_parse_object *op; | 91 | union acpi_parse_object *op; |
92 | struct acpi_walk_state *walk_state; | 92 | struct acpi_walk_state *walk_state; |
93 | 93 | ||
94 | ACPI_FUNCTION_TRACE("ds_execute_arguments"); | 94 | ACPI_FUNCTION_TRACE(ds_execute_arguments); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Allocate a new parser op to be the root of the parsed tree | 97 | * Allocate a new parser op to be the root of the parsed tree |
@@ -193,7 +193,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
193 | struct acpi_namespace_node *node; | 193 | struct acpi_namespace_node *node; |
194 | acpi_status status; | 194 | acpi_status status; |
195 | 195 | ||
196 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); |
197 | 197 | ||
198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 198 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
199 | return_ACPI_STATUS(AE_OK); | 199 | return_ACPI_STATUS(AE_OK); |
@@ -206,7 +206,7 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
206 | 206 | ||
207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 207 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); | 208 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); |
209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n", | 209 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", |
210 | acpi_ut_get_node_name(node))); | 210 | acpi_ut_get_node_name(node))); |
211 | 211 | ||
212 | /* Execute the AML code for the term_arg arguments */ | 212 | /* Execute the AML code for the term_arg arguments */ |
@@ -235,7 +235,7 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) | |||
235 | struct acpi_namespace_node *node; | 235 | struct acpi_namespace_node *node; |
236 | acpi_status status; | 236 | acpi_status status; |
237 | 237 | ||
238 | ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc); | 238 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); |
239 | 239 | ||
240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 240 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
241 | return_ACPI_STATUS(AE_OK); | 241 | return_ACPI_STATUS(AE_OK); |
@@ -279,7 +279,7 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) | |||
279 | struct acpi_namespace_node *node; | 279 | struct acpi_namespace_node *node; |
280 | acpi_status status; | 280 | acpi_status status; |
281 | 281 | ||
282 | ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc); | 282 | ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); |
283 | 283 | ||
284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | 284 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { |
285 | return_ACPI_STATUS(AE_OK); | 285 | return_ACPI_STATUS(AE_OK); |
@@ -324,7 +324,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
324 | acpi_status status; | 324 | acpi_status status; |
325 | union acpi_operand_object *extra_desc; | 325 | union acpi_operand_object *extra_desc; |
326 | 326 | ||
327 | ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc); | 327 | ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); |
328 | 328 | ||
329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 329 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
330 | return_ACPI_STATUS(AE_OK); | 330 | return_ACPI_STATUS(AE_OK); |
@@ -342,8 +342,7 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 342 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
343 | (ACPI_TYPE_REGION, node, NULL)); | 343 | (ACPI_TYPE_REGION, node, NULL)); |
344 | 344 | ||
345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 345 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", |
346 | "[%4.4s] op_region Arg Init at AML %p\n", | ||
347 | acpi_ut_get_node_name(node), | 346 | acpi_ut_get_node_name(node), |
348 | extra_desc->extra.aml_start)); | 347 | extra_desc->extra.aml_start)); |
349 | 348 | ||
@@ -352,6 +351,28 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | |||
352 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | 351 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), |
353 | extra_desc->extra.aml_length, | 352 | extra_desc->extra.aml_length, |
354 | extra_desc->extra.aml_start); | 353 | extra_desc->extra.aml_start); |
354 | if (ACPI_FAILURE(status)) { | ||
355 | return_ACPI_STATUS(status); | ||
356 | } | ||
357 | |||
358 | /* Validate the region address/length via the host OS */ | ||
359 | |||
360 | status = acpi_os_validate_address(obj_desc->region.space_id, | ||
361 | obj_desc->region.address, | ||
362 | (acpi_size) obj_desc->region.length); | ||
363 | if (ACPI_FAILURE(status)) { | ||
364 | /* | ||
365 | * Invalid address/length. We will emit an error message and mark | ||
366 | * the region as invalid, so that it will cause an additional error if | ||
367 | * it is ever used. Then return AE_OK. | ||
368 | */ | ||
369 | ACPI_EXCEPTION((AE_INFO, status, | ||
370 | "During address validation of OpRegion [%4.4s]", | ||
371 | node->name.ascii)); | ||
372 | obj_desc->common.flags |= AOPOBJ_INVALID; | ||
373 | status = AE_OK; | ||
374 | } | ||
375 | |||
355 | return_ACPI_STATUS(status); | 376 | return_ACPI_STATUS(status); |
356 | } | 377 | } |
357 | 378 | ||
@@ -411,7 +432,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
411 | u8 field_flags; | 432 | u8 field_flags; |
412 | acpi_status status; | 433 | acpi_status status; |
413 | 434 | ||
414 | ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc); | 435 | ACPI_FUNCTION_TRACE_PTR(ds_init_buffer_field, obj_desc); |
415 | 436 | ||
416 | /* Host object must be a Buffer */ | 437 | /* Host object must be a Buffer */ |
417 | 438 | ||
@@ -457,7 +478,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
457 | 478 | ||
458 | if (bit_count == 0) { | 479 | if (bit_count == 0) { |
459 | ACPI_ERROR((AE_INFO, | 480 | ACPI_ERROR((AE_INFO, |
460 | "Attempt to create_field of length zero")); | 481 | "Attempt to CreateField of length zero")); |
461 | status = AE_AML_OPERAND_VALUE; | 482 | status = AE_AML_OPERAND_VALUE; |
462 | goto cleanup; | 483 | goto cleanup; |
463 | } | 484 | } |
@@ -595,7 +616,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
595 | struct acpi_namespace_node *node; | 616 | struct acpi_namespace_node *node; |
596 | union acpi_parse_object *next_op; | 617 | union acpi_parse_object *next_op; |
597 | 618 | ||
598 | ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op); | 619 | ACPI_FUNCTION_TRACE_PTR(ds_eval_buffer_field_operands, op); |
599 | 620 | ||
600 | /* | 621 | /* |
601 | * This is where we evaluate the address and length fields of the | 622 | * This is where we evaluate the address and length fields of the |
@@ -627,7 +648,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
627 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 648 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
628 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 649 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
629 | walk_state->num_operands, | 650 | walk_state->num_operands, |
630 | "after acpi_ex_resolve_operands"); | 651 | "after AcpiExResolveOperands"); |
631 | 652 | ||
632 | if (ACPI_FAILURE(status)) { | 653 | if (ACPI_FAILURE(status)) { |
633 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", | 654 | ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)", |
@@ -640,6 +661,7 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | |||
640 | /* Initialize the Buffer Field */ | 661 | /* Initialize the Buffer Field */ |
641 | 662 | ||
642 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 663 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
664 | |||
643 | /* NOTE: Slightly different operands for this opcode */ | 665 | /* NOTE: Slightly different operands for this opcode */ |
644 | 666 | ||
645 | status = | 667 | status = |
@@ -685,7 +707,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
685 | struct acpi_namespace_node *node; | 707 | struct acpi_namespace_node *node; |
686 | union acpi_parse_object *next_op; | 708 | union acpi_parse_object *next_op; |
687 | 709 | ||
688 | ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op); | 710 | ACPI_FUNCTION_TRACE_PTR(ds_eval_region_operands, op); |
689 | 711 | ||
690 | /* | 712 | /* |
691 | * This is where we evaluate the address and length fields of the | 713 | * This is where we evaluate the address and length fields of the |
@@ -718,7 +740,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
718 | 740 | ||
719 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | 741 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, |
720 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 742 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
721 | 1, "after acpi_ex_resolve_operands"); | 743 | 1, "after AcpiExResolveOperands"); |
722 | 744 | ||
723 | obj_desc = acpi_ns_get_attached_object(node); | 745 | obj_desc = acpi_ns_get_attached_object(node); |
724 | if (!obj_desc) { | 746 | if (!obj_desc) { |
@@ -744,7 +766,7 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
744 | operand_desc->integer.value; | 766 | operand_desc->integer.value; |
745 | acpi_ut_remove_reference(operand_desc); | 767 | acpi_ut_remove_reference(operand_desc); |
746 | 768 | ||
747 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", | 769 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
748 | obj_desc, | 770 | obj_desc, |
749 | ACPI_FORMAT_UINT64(obj_desc->region.address), | 771 | ACPI_FORMAT_UINT64(obj_desc->region.address), |
750 | obj_desc->region.length)); | 772 | obj_desc->region.length)); |
@@ -780,7 +802,7 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
780 | union acpi_operand_object *arg_desc; | 802 | union acpi_operand_object *arg_desc; |
781 | u32 length; | 803 | u32 length; |
782 | 804 | ||
783 | ACPI_FUNCTION_TRACE("ds_eval_data_object_operands"); | 805 | ACPI_FUNCTION_TRACE(ds_eval_data_object_operands); |
784 | 806 | ||
785 | /* The first operand (for all of these data objects) is the length */ | 807 | /* The first operand (for all of these data objects) is the length */ |
786 | 808 | ||
@@ -874,7 +896,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | |||
874 | acpi_status status = AE_OK; | 896 | acpi_status status = AE_OK; |
875 | union acpi_generic_state *control_state; | 897 | union acpi_generic_state *control_state; |
876 | 898 | ||
877 | ACPI_FUNCTION_NAME("ds_exec_begin_control_op"); | 899 | ACPI_FUNCTION_NAME(ds_exec_begin_control_op); |
878 | 900 | ||
879 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, | 901 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, |
880 | op->common.aml_opcode, walk_state)); | 902 | op->common.aml_opcode, walk_state)); |
@@ -952,7 +974,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
952 | acpi_status status = AE_OK; | 974 | acpi_status status = AE_OK; |
953 | union acpi_generic_state *control_state; | 975 | union acpi_generic_state *control_state; |
954 | 976 | ||
955 | ACPI_FUNCTION_NAME("ds_exec_end_control_op"); | 977 | ACPI_FUNCTION_NAME(ds_exec_end_control_op); |
956 | 978 | ||
957 | switch (op->common.aml_opcode) { | 979 | switch (op->common.aml_opcode) { |
958 | case AML_IF_OP: | 980 | case AML_IF_OP: |
@@ -984,6 +1006,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
984 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | 1006 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); |
985 | 1007 | ||
986 | if (walk_state->control_state->common.value) { | 1008 | if (walk_state->control_state->common.value) { |
1009 | |||
987 | /* Predicate was true, go back and evaluate it again! */ | 1010 | /* Predicate was true, go back and evaluate it again! */ |
988 | 1011 | ||
989 | status = AE_CTRL_PENDING; | 1012 | status = AE_CTRL_PENDING; |
@@ -1014,6 +1037,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1014 | * has been bubbled up the tree | 1037 | * has been bubbled up the tree |
1015 | */ | 1038 | */ |
1016 | if (op->common.value.arg) { | 1039 | if (op->common.value.arg) { |
1040 | |||
1017 | /* Since we have a real Return(), delete any implicit return */ | 1041 | /* Since we have a real Return(), delete any implicit return */ |
1018 | 1042 | ||
1019 | acpi_ds_clear_implicit_return(walk_state); | 1043 | acpi_ds_clear_implicit_return(walk_state); |
@@ -1047,6 +1071,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1047 | walk_state->return_desc = walk_state->operands[0]; | 1071 | walk_state->return_desc = walk_state->operands[0]; |
1048 | } else if ((walk_state->results) && | 1072 | } else if ((walk_state->results) && |
1049 | (walk_state->results->results.num_results > 0)) { | 1073 | (walk_state->results->results.num_results > 0)) { |
1074 | |||
1050 | /* Since we have a real Return(), delete any implicit return */ | 1075 | /* Since we have a real Return(), delete any implicit return */ |
1051 | 1076 | ||
1052 | acpi_ds_clear_implicit_return(walk_state); | 1077 | acpi_ds_clear_implicit_return(walk_state); |
@@ -1095,7 +1120,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1095 | } | 1120 | } |
1096 | 1121 | ||
1097 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1122 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1098 | "Completed RETURN_OP State=%p, ret_val=%p\n", | 1123 | "Completed RETURN_OP State=%p, RetVal=%p\n", |
1099 | walk_state, walk_state->return_desc)); | 1124 | walk_state, walk_state->return_desc)); |
1100 | 1125 | ||
1101 | /* End the control method execution right now */ | 1126 | /* End the control method execution right now */ |
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 53356a591ac1..05230baf5de8 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -68,7 +68,7 @@ ACPI_MODULE_NAME("dsutils") | |||
68 | ******************************************************************************/ | 68 | ******************************************************************************/ |
69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) | 69 | void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state) |
70 | { | 70 | { |
71 | ACPI_FUNCTION_NAME("ds_clear_implicit_return"); | 71 | ACPI_FUNCTION_NAME(ds_clear_implicit_return); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Slack must be enabled for this feature | 74 | * Slack must be enabled for this feature |
@@ -115,7 +115,7 @@ u8 | |||
115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, | 115 | acpi_ds_do_implicit_return(union acpi_operand_object *return_desc, |
116 | struct acpi_walk_state *walk_state, u8 add_reference) | 116 | struct acpi_walk_state *walk_state, u8 add_reference) |
117 | { | 117 | { |
118 | ACPI_FUNCTION_NAME("ds_do_implicit_return"); | 118 | ACPI_FUNCTION_NAME(ds_do_implicit_return); |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * Slack must be enabled for this feature, and we must | 121 | * Slack must be enabled for this feature, and we must |
@@ -171,7 +171,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
171 | { | 171 | { |
172 | const struct acpi_opcode_info *parent_info; | 172 | const struct acpi_opcode_info *parent_info; |
173 | 173 | ||
174 | ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op); | 174 | ACPI_FUNCTION_TRACE_PTR(ds_is_result_used, op); |
175 | 175 | ||
176 | /* Must have both an Op and a Result Object */ | 176 | /* Must have both an Op and a Result Object */ |
177 | 177 | ||
@@ -202,6 +202,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
202 | */ | 202 | */ |
203 | if ((!op->common.parent) || | 203 | if ((!op->common.parent) || |
204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { | 204 | (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { |
205 | |||
205 | /* No parent, the return value cannot possibly be used */ | 206 | /* No parent, the return value cannot possibly be used */ |
206 | 207 | ||
207 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 208 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
@@ -340,7 +341,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
340 | union acpi_operand_object *obj_desc; | 341 | union acpi_operand_object *obj_desc; |
341 | acpi_status status; | 342 | acpi_status status; |
342 | 343 | ||
343 | ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); | 344 | ACPI_FUNCTION_TRACE_PTR(ds_delete_result_if_not_used, result_obj); |
344 | 345 | ||
345 | if (!op) { | 346 | if (!op) { |
346 | ACPI_ERROR((AE_INFO, "Null Op")); | 347 | ACPI_ERROR((AE_INFO, "Null Op")); |
@@ -352,6 +353,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op, | |||
352 | } | 353 | } |
353 | 354 | ||
354 | if (!acpi_ds_is_result_used(op, walk_state)) { | 355 | if (!acpi_ds_is_result_used(op, walk_state)) { |
356 | |||
355 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ | 357 | /* Must pop the result stack (obj_desc should be equal to result_obj) */ |
356 | 358 | ||
357 | status = acpi_ds_result_pop(&obj_desc, walk_state); | 359 | status = acpi_ds_result_pop(&obj_desc, walk_state); |
@@ -382,7 +384,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state) | |||
382 | u32 i; | 384 | u32 i; |
383 | acpi_status status = AE_OK; | 385 | acpi_status status = AE_OK; |
384 | 386 | ||
385 | ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state); | 387 | ACPI_FUNCTION_TRACE_PTR(ds_resolve_operands, walk_state); |
386 | 388 | ||
387 | /* | 389 | /* |
388 | * Attempt to resolve each of the valid operands | 390 | * Attempt to resolve each of the valid operands |
@@ -417,7 +419,7 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state) | |||
417 | { | 419 | { |
418 | u32 i; | 420 | u32 i; |
419 | 421 | ||
420 | ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state); | 422 | ACPI_FUNCTION_TRACE_PTR(ds_clear_operands, walk_state); |
421 | 423 | ||
422 | /* Remove a reference on each operand on the stack */ | 424 | /* Remove a reference on each operand on the stack */ |
423 | 425 | ||
@@ -465,7 +467,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
465 | acpi_interpreter_mode interpreter_mode; | 467 | acpi_interpreter_mode interpreter_mode; |
466 | const struct acpi_opcode_info *op_info; | 468 | const struct acpi_opcode_info *op_info; |
467 | 469 | ||
468 | ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg); | 470 | ACPI_FUNCTION_TRACE_PTR(ds_create_operand, arg); |
469 | 471 | ||
470 | /* A valid name must be looked up in the namespace */ | 472 | /* A valid name must be looked up in the namespace */ |
471 | 473 | ||
@@ -498,7 +500,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
498 | */ | 500 | */ |
499 | if ((walk_state->deferred_node) && | 501 | if ((walk_state->deferred_node) && |
500 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) | 502 | (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) |
501 | && (arg_index != 0)) { | 503 | && (arg_index == |
504 | (u32) ((walk_state->opcode == | ||
505 | AML_CREATE_FIELD_OP) ? 3 : 2))) { | ||
502 | obj_desc = | 506 | obj_desc = |
503 | ACPI_CAST_PTR(union acpi_operand_object, | 507 | ACPI_CAST_PTR(union acpi_operand_object, |
504 | walk_state->deferred_node); | 508 | walk_state->deferred_node); |
@@ -521,6 +525,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
521 | && (parent_op->common.aml_opcode != AML_REGION_OP) | 525 | && (parent_op->common.aml_opcode != AML_REGION_OP) |
522 | && (parent_op->common.aml_opcode != | 526 | && (parent_op->common.aml_opcode != |
523 | AML_INT_NAMEPATH_OP)) { | 527 | AML_INT_NAMEPATH_OP)) { |
528 | |||
524 | /* Enter name into namespace if not found */ | 529 | /* Enter name into namespace if not found */ |
525 | 530 | ||
526 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; | 531 | interpreter_mode = ACPI_IMODE_LOAD_PASS2; |
@@ -572,7 +577,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
572 | 577 | ||
573 | /* Free the namestring created above */ | 578 | /* Free the namestring created above */ |
574 | 579 | ||
575 | ACPI_MEM_FREE(name_string); | 580 | ACPI_FREE(name_string); |
576 | 581 | ||
577 | /* Check status from the lookup */ | 582 | /* Check status from the lookup */ |
578 | 583 | ||
@@ -696,7 +701,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
696 | union acpi_parse_object *arg; | 701 | union acpi_parse_object *arg; |
697 | u32 arg_count = 0; | 702 | u32 arg_count = 0; |
698 | 703 | ||
699 | ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg); | 704 | ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); |
700 | 705 | ||
701 | /* For all arguments in the list... */ | 706 | /* For all arguments in the list... */ |
702 | 707 | ||
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index f1af655ff113..3acbd9145d72 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <acpi/acinterp.h> | 49 | #include <acpi/acinterp.h> |
50 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acdebug.h> | 51 | #include <acpi/acdebug.h> |
52 | #include <acpi/acdisasm.h> | ||
53 | 52 | ||
54 | #define _COMPONENT ACPI_DISPATCHER | 53 | #define _COMPONENT ACPI_DISPATCHER |
55 | ACPI_MODULE_NAME("dswexec") | 54 | ACPI_MODULE_NAME("dswexec") |
@@ -93,7 +92,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
93 | union acpi_operand_object *obj_desc; | 92 | union acpi_operand_object *obj_desc; |
94 | union acpi_operand_object *local_obj_desc = NULL; | 93 | union acpi_operand_object *local_obj_desc = NULL; |
95 | 94 | ||
96 | ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state); | 95 | ACPI_FUNCTION_TRACE_PTR(ds_get_predicate_value, walk_state); |
97 | 96 | ||
98 | walk_state->control_state->common.state = 0; | 97 | walk_state->control_state->common.state = 0; |
99 | 98 | ||
@@ -123,7 +122,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
123 | 122 | ||
124 | if (!obj_desc) { | 123 | if (!obj_desc) { |
125 | ACPI_ERROR((AE_INFO, | 124 | ACPI_ERROR((AE_INFO, |
126 | "No predicate obj_desc=%p State=%p", | 125 | "No predicate ObjDesc=%p State=%p", |
127 | obj_desc, walk_state)); | 126 | obj_desc, walk_state)); |
128 | 127 | ||
129 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 128 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
@@ -140,7 +139,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, | |||
140 | 139 | ||
141 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { | 140 | if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { |
142 | ACPI_ERROR((AE_INFO, | 141 | ACPI_ERROR((AE_INFO, |
143 | "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X", | 142 | "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X", |
144 | obj_desc, walk_state, | 143 | obj_desc, walk_state, |
145 | ACPI_GET_OBJECT_TYPE(obj_desc))); | 144 | ACPI_GET_OBJECT_TYPE(obj_desc))); |
146 | 145 | ||
@@ -214,7 +213,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
214 | acpi_status status = AE_OK; | 213 | acpi_status status = AE_OK; |
215 | u32 opcode_class; | 214 | u32 opcode_class; |
216 | 215 | ||
217 | ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state); | 216 | ACPI_FUNCTION_TRACE_PTR(ds_exec_begin_op, walk_state); |
218 | 217 | ||
219 | op = walk_state->op; | 218 | op = walk_state->op; |
220 | if (!op) { | 219 | if (!op) { |
@@ -296,7 +295,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
296 | 295 | ||
297 | case AML_CLASS_NAMED_OBJECT: | 296 | case AML_CLASS_NAMED_OBJECT: |
298 | 297 | ||
299 | if (walk_state->walk_type == ACPI_WALK_METHOD) { | 298 | if (walk_state->walk_type & ACPI_WALK_METHOD) { |
300 | /* | 299 | /* |
301 | * Found a named object declaration during method execution; | 300 | * Found a named object declaration during method execution; |
302 | * we must enter this object into the namespace. The created | 301 | * we must enter this object into the namespace. The created |
@@ -354,7 +353,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
354 | union acpi_parse_object *next_op; | 353 | union acpi_parse_object *next_op; |
355 | union acpi_parse_object *first_arg; | 354 | union acpi_parse_object *first_arg; |
356 | 355 | ||
357 | ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state); | 356 | ACPI_FUNCTION_TRACE_PTR(ds_exec_end_op, walk_state); |
358 | 357 | ||
359 | op = walk_state->op; | 358 | op = walk_state->op; |
360 | op_type = walk_state->op_info->type; | 359 | op_type = walk_state->op_info->type; |
@@ -409,6 +408,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
409 | * being the object_type and size_of operators. | 408 | * being the object_type and size_of operators. |
410 | */ | 409 | */ |
411 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { | 410 | if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) { |
411 | |||
412 | /* Resolve all operands */ | 412 | /* Resolve all operands */ |
413 | 413 | ||
414 | status = acpi_ex_resolve_operands(walk_state->opcode, | 414 | status = acpi_ex_resolve_operands(walk_state->opcode, |
@@ -423,7 +423,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
423 | acpi_ps_get_opcode_name | 423 | acpi_ps_get_opcode_name |
424 | (walk_state->opcode), | 424 | (walk_state->opcode), |
425 | walk_state->num_operands, | 425 | walk_state->num_operands, |
426 | "after ex_resolve_operands"); | 426 | "after ExResolveOperands"); |
427 | } | 427 | } |
428 | } | 428 | } |
429 | 429 | ||
@@ -437,7 +437,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); | 437 | acpi_gbl_op_type_dispatch[op_type] (walk_state); |
438 | } else { | 438 | } else { |
439 | /* | 439 | /* |
440 | * Treat constructs of the form "Store(local_x,local_x)" as noops when the | 440 | * Treat constructs of the form "Store(LocalX,LocalX)" as noops when the |
441 | * Local is uninitialized. | 441 | * Local is uninitialized. |
442 | */ | 442 | */ |
443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && | 443 | if ((status == AE_AML_UNINITIALIZED_LOCAL) && |
@@ -548,6 +548,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
548 | */ | 548 | */ |
549 | status = acpi_ds_resolve_operands(walk_state); | 549 | status = acpi_ds_resolve_operands(walk_state); |
550 | if (ACPI_FAILURE(status)) { | 550 | if (ACPI_FAILURE(status)) { |
551 | |||
551 | /* On error, clear all resolved operands */ | 552 | /* On error, clear all resolved operands */ |
552 | 553 | ||
553 | acpi_ds_clear_operands(walk_state); | 554 | acpi_ds_clear_operands(walk_state); |
@@ -569,7 +570,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
569 | case AML_TYPE_CREATE_FIELD: | 570 | case AML_TYPE_CREATE_FIELD: |
570 | 571 | ||
571 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 572 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
572 | "Executing create_field Buffer/Index Op=%p\n", | 573 | "Executing CreateField Buffer/Index Op=%p\n", |
573 | op)); | 574 | op)); |
574 | 575 | ||
575 | status = acpi_ds_load2_end_op(walk_state); | 576 | status = acpi_ds_load2_end_op(walk_state); |
@@ -584,7 +585,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
584 | case AML_TYPE_CREATE_OBJECT: | 585 | case AML_TYPE_CREATE_OBJECT: |
585 | 586 | ||
586 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 587 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
587 | "Executing create_object (Buffer/Package) Op=%p\n", | 588 | "Executing CreateObject (Buffer/Package) Op=%p\n", |
588 | op)); | 589 | op)); |
589 | 590 | ||
590 | switch (op->common.parent->common.aml_opcode) { | 591 | switch (op->common.parent->common.aml_opcode) { |
@@ -657,7 +658,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
657 | 658 | ||
658 | if (op->common.aml_opcode == AML_REGION_OP) { | 659 | if (op->common.aml_opcode == AML_REGION_OP) { |
659 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 660 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
660 | "Executing op_region Address/Length Op=%p\n", | 661 | "Executing OpRegion Address/Length Op=%p\n", |
661 | op)); | 662 | op)); |
662 | 663 | ||
663 | status = | 664 | status = |
@@ -722,6 +723,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
722 | cleanup: | 723 | cleanup: |
723 | 724 | ||
724 | if (walk_state->result_obj) { | 725 | if (walk_state->result_obj) { |
726 | |||
725 | /* Break to debugger to display result */ | 727 | /* Break to debugger to display result */ |
726 | 728 | ||
727 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object | 729 | ACPI_DEBUGGER_EXEC(acpi_db_display_result_object |
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index d3d24da31c81..35074399c617 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
127 | char *path; | 127 | char *path; |
128 | u32 flags; | 128 | u32 flags; |
129 | 129 | ||
130 | ACPI_FUNCTION_TRACE("ds_load1_begin_op"); | 130 | ACPI_FUNCTION_TRACE(ds_load1_begin_op); |
131 | 131 | ||
132 | op = walk_state->op; | 132 | op = walk_state->op; |
133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -178,12 +178,12 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
178 | * Target of Scope() not found. Generate an External for it, and | 178 | * Target of Scope() not found. Generate an External for it, and |
179 | * insert the name into the namespace. | 179 | * insert the name into the namespace. |
180 | */ | 180 | */ |
181 | acpi_dm_add_to_external_list(path); | 181 | acpi_dm_add_to_external_list(path, ACPI_TYPE_DEVICE, 0); |
182 | status = | 182 | status = |
183 | acpi_ns_lookup(walk_state->scope_info, path, | 183 | acpi_ns_lookup(walk_state->scope_info, path, |
184 | object_type, ACPI_IMODE_LOAD_PASS1, | 184 | object_type, ACPI_IMODE_LOAD_PASS1, |
185 | ACPI_NS_SEARCH_PARENT, walk_state, | 185 | ACPI_NS_SEARCH_PARENT, walk_state, |
186 | &(node)); | 186 | &node); |
187 | } | 187 | } |
188 | #endif | 188 | #endif |
189 | if (ACPI_FAILURE(status)) { | 189 | if (ACPI_FAILURE(status)) { |
@@ -261,6 +261,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
261 | */ | 261 | */ |
262 | 262 | ||
263 | if (walk_state->deferred_node) { | 263 | if (walk_state->deferred_node) { |
264 | |||
264 | /* This name is already in the namespace, get the node */ | 265 | /* This name is already in the namespace, get the node */ |
265 | 266 | ||
266 | node = walk_state->deferred_node; | 267 | node = walk_state->deferred_node; |
@@ -300,10 +301,41 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
300 | status = | 301 | status = |
301 | acpi_ns_lookup(walk_state->scope_info, path, object_type, | 302 | acpi_ns_lookup(walk_state->scope_info, path, object_type, |
302 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, | 303 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, |
303 | &(node)); | 304 | &node); |
304 | if (ACPI_FAILURE(status)) { | 305 | if (ACPI_FAILURE(status)) { |
305 | ACPI_ERROR_NAMESPACE(path, status); | 306 | if (status == AE_ALREADY_EXISTS) { |
306 | return_ACPI_STATUS(status); | 307 | |
308 | /* The name already exists in this scope */ | ||
309 | |||
310 | if (node->flags & ANOBJ_IS_EXTERNAL) { | ||
311 | /* | ||
312 | * Allow one create on an object or segment that was | ||
313 | * previously declared External | ||
314 | */ | ||
315 | node->flags &= ~ANOBJ_IS_EXTERNAL; | ||
316 | node->type = (u8) object_type; | ||
317 | |||
318 | /* Just retyped a node, probably will need to open a scope */ | ||
319 | |||
320 | if (acpi_ns_opens_scope(object_type)) { | ||
321 | status = | ||
322 | acpi_ds_scope_stack_push | ||
323 | (node, object_type, | ||
324 | walk_state); | ||
325 | if (ACPI_FAILURE(status)) { | ||
326 | return_ACPI_STATUS | ||
327 | (status); | ||
328 | } | ||
329 | } | ||
330 | status = AE_OK; | ||
331 | } | ||
332 | } | ||
333 | |||
334 | if (ACPI_FAILURE(status)) { | ||
335 | |||
336 | ACPI_ERROR_NAMESPACE(path, status); | ||
337 | return_ACPI_STATUS(status); | ||
338 | } | ||
307 | } | 339 | } |
308 | break; | 340 | break; |
309 | } | 341 | } |
@@ -311,6 +343,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state, | |||
311 | /* Common exit */ | 343 | /* Common exit */ |
312 | 344 | ||
313 | if (!op) { | 345 | if (!op) { |
346 | |||
314 | /* Create a new op */ | 347 | /* Create a new op */ |
315 | 348 | ||
316 | op = acpi_ps_alloc_op(walk_state->opcode); | 349 | op = acpi_ps_alloc_op(walk_state->opcode); |
@@ -359,7 +392,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
359 | acpi_object_type object_type; | 392 | acpi_object_type object_type; |
360 | acpi_status status = AE_OK; | 393 | acpi_status status = AE_OK; |
361 | 394 | ||
362 | ACPI_FUNCTION_TRACE("ds_load1_end_op"); | 395 | ACPI_FUNCTION_TRACE(ds_load1_end_op); |
363 | 396 | ||
364 | op = walk_state->op; | 397 | op = walk_state->op; |
365 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 398 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -413,6 +446,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
413 | #endif | 446 | #endif |
414 | 447 | ||
415 | if (op->common.aml_opcode == AML_NAME_OP) { | 448 | if (op->common.aml_opcode == AML_NAME_OP) { |
449 | |||
416 | /* For Name opcode, get the object type from the argument */ | 450 | /* For Name opcode, get the object type from the argument */ |
417 | 451 | ||
418 | if (op->common.value.arg) { | 452 | if (op->common.value.arg) { |
@@ -445,7 +479,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
445 | * arguments.) | 479 | * arguments.) |
446 | */ | 480 | */ |
447 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 481 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
448 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 482 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
449 | walk_state, op, op->named.node)); | 483 | walk_state, op, op->named.node)); |
450 | 484 | ||
451 | if (!acpi_ns_get_attached_object(op->named.node)) { | 485 | if (!acpi_ns_get_attached_object(op->named.node)) { |
@@ -511,7 +545,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
511 | acpi_object_type object_type; | 545 | acpi_object_type object_type; |
512 | char *buffer_ptr; | 546 | char *buffer_ptr; |
513 | 547 | ||
514 | ACPI_FUNCTION_TRACE("ds_load2_begin_op"); | 548 | ACPI_FUNCTION_TRACE(ds_load2_begin_op); |
515 | 549 | ||
516 | op = walk_state->op; | 550 | op = walk_state->op; |
517 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | 551 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, |
@@ -521,6 +555,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
521 | if ((walk_state->control_state) && | 555 | if ((walk_state->control_state) && |
522 | (walk_state->control_state->common.state == | 556 | (walk_state->control_state->common.state == |
523 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | 557 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { |
558 | |||
524 | /* We are executing a while loop outside of a method */ | 559 | /* We are executing a while loop outside of a method */ |
525 | 560 | ||
526 | status = acpi_ds_exec_begin_op(walk_state, out_op); | 561 | status = acpi_ds_exec_begin_op(walk_state, out_op); |
@@ -554,10 +589,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
554 | /* Get the name we are going to enter or lookup in the namespace */ | 589 | /* Get the name we are going to enter or lookup in the namespace */ |
555 | 590 | ||
556 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | 591 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { |
592 | |||
557 | /* For Namepath op, get the path string */ | 593 | /* For Namepath op, get the path string */ |
558 | 594 | ||
559 | buffer_ptr = op->common.value.string; | 595 | buffer_ptr = op->common.value.string; |
560 | if (!buffer_ptr) { | 596 | if (!buffer_ptr) { |
597 | |||
561 | /* No name, just exit */ | 598 | /* No name, just exit */ |
562 | 599 | ||
563 | return_ACPI_STATUS(AE_OK); | 600 | return_ACPI_STATUS(AE_OK); |
@@ -680,6 +717,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
680 | /* All other opcodes */ | 717 | /* All other opcodes */ |
681 | 718 | ||
682 | if (op && op->common.node) { | 719 | if (op && op->common.node) { |
720 | |||
683 | /* This op/node was previously entered into the namespace */ | 721 | /* This op/node was previously entered into the namespace */ |
684 | 722 | ||
685 | node = op->common.node; | 723 | node = op->common.node; |
@@ -705,6 +743,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
705 | * Note: Name may already exist if we are executing a deferred opcode. | 743 | * Note: Name may already exist if we are executing a deferred opcode. |
706 | */ | 744 | */ |
707 | if (walk_state->deferred_node) { | 745 | if (walk_state->deferred_node) { |
746 | |||
708 | /* This name is already in the namespace, get the node */ | 747 | /* This name is already in the namespace, get the node */ |
709 | 748 | ||
710 | node = walk_state->deferred_node; | 749 | node = walk_state->deferred_node; |
@@ -727,6 +766,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
727 | } | 766 | } |
728 | 767 | ||
729 | if (!op) { | 768 | if (!op) { |
769 | |||
730 | /* Create a new op */ | 770 | /* Create a new op */ |
731 | 771 | ||
732 | op = acpi_ps_alloc_op(walk_state->opcode); | 772 | op = acpi_ps_alloc_op(walk_state->opcode); |
@@ -776,7 +816,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
776 | u32 i; | 816 | u32 i; |
777 | #endif | 817 | #endif |
778 | 818 | ||
779 | ACPI_FUNCTION_TRACE("ds_load2_end_op"); | 819 | ACPI_FUNCTION_TRACE(ds_load2_end_op); |
780 | 820 | ||
781 | op = walk_state->op; | 821 | op = walk_state->op; |
782 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", | 822 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", |
@@ -870,7 +910,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
870 | */ | 910 | */ |
871 | 911 | ||
872 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 912 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
873 | "Create-Load [%s] State=%p Op=%p named_obj=%p\n", | 913 | "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", |
874 | acpi_ps_get_opcode_name(op->common.aml_opcode), | 914 | acpi_ps_get_opcode_name(op->common.aml_opcode), |
875 | walk_state, op, node)); | 915 | walk_state, op, node)); |
876 | 916 | ||
@@ -1045,7 +1085,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1045 | * arguments.) | 1085 | * arguments.) |
1046 | */ | 1086 | */ |
1047 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1087 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1048 | "LOADING-Method: State=%p Op=%p named_obj=%p\n", | 1088 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
1049 | walk_state, op, op->named.node)); | 1089 | walk_state, op, op->named.node)); |
1050 | 1090 | ||
1051 | if (!acpi_ns_get_attached_object(op->named.node)) { | 1091 | if (!acpi_ns_get_attached_object(op->named.node)) { |
@@ -1090,7 +1130,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1090 | case AML_CLASS_METHOD_CALL: | 1130 | case AML_CLASS_METHOD_CALL: |
1091 | 1131 | ||
1092 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 1132 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
1093 | "RESOLVING-method_call: State=%p Op=%p named_obj=%p\n", | 1133 | "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", |
1094 | walk_state, op, node)); | 1134 | walk_state, op, node)); |
1095 | 1135 | ||
1096 | /* | 1136 | /* |
@@ -1104,7 +1144,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1104 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, | 1144 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, |
1105 | &(new_node)); | 1145 | &(new_node)); |
1106 | if (ACPI_SUCCESS(status)) { | 1146 | if (ACPI_SUCCESS(status)) { |
1107 | |||
1108 | /* | 1147 | /* |
1109 | * Make sure that what we found is indeed a method | 1148 | * Make sure that what we found is indeed a method |
1110 | * We didn't search for a method on purpose, to see if the name | 1149 | * We didn't search for a method on purpose, to see if the name |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index ada21ef4a174..c9228972f5f6 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -63,9 +63,10 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) | |||
63 | { | 63 | { |
64 | union acpi_generic_state *scope_info; | 64 | union acpi_generic_state *scope_info; |
65 | 65 | ||
66 | ACPI_FUNCTION_NAME("ds_scope_stack_clear"); | 66 | ACPI_FUNCTION_NAME(ds_scope_stack_clear); |
67 | 67 | ||
68 | while (walk_state->scope_info) { | 68 | while (walk_state->scope_info) { |
69 | |||
69 | /* Pop a scope off the stack */ | 70 | /* Pop a scope off the stack */ |
70 | 71 | ||
71 | scope_info = walk_state->scope_info; | 72 | scope_info = walk_state->scope_info; |
@@ -102,9 +103,10 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
102 | union acpi_generic_state *scope_info; | 103 | union acpi_generic_state *scope_info; |
103 | union acpi_generic_state *old_scope_info; | 104 | union acpi_generic_state *old_scope_info; |
104 | 105 | ||
105 | ACPI_FUNCTION_TRACE("ds_scope_stack_push"); | 106 | ACPI_FUNCTION_TRACE(ds_scope_stack_push); |
106 | 107 | ||
107 | if (!node) { | 108 | if (!node) { |
109 | |||
108 | /* Invalid scope */ | 110 | /* Invalid scope */ |
109 | 111 | ||
110 | ACPI_ERROR((AE_INFO, "Null scope parameter")); | 112 | ACPI_ERROR((AE_INFO, "Null scope parameter")); |
@@ -126,7 +128,7 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node, | |||
126 | 128 | ||
127 | /* Init new scope object */ | 129 | /* Init new scope object */ |
128 | 130 | ||
129 | scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE; | 131 | scope_info->common.descriptor_type = ACPI_DESC_TYPE_STATE_WSCOPE; |
130 | scope_info->scope.node = node; | 132 | scope_info->scope.node = node; |
131 | scope_info->common.value = (u16) type; | 133 | scope_info->common.value = (u16) type; |
132 | 134 | ||
@@ -176,7 +178,7 @@ acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state) | |||
176 | union acpi_generic_state *scope_info; | 178 | union acpi_generic_state *scope_info; |
177 | union acpi_generic_state *new_scope_info; | 179 | union acpi_generic_state *new_scope_info; |
178 | 180 | ||
179 | ACPI_FUNCTION_TRACE("ds_scope_stack_pop"); | 181 | ACPI_FUNCTION_TRACE(ds_scope_stack_pop); |
180 | 182 | ||
181 | /* | 183 | /* |
182 | * Pop scope info object off the stack. | 184 | * Pop scope info object off the stack. |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index fa78cb74ee36..7817e5522679 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -66,7 +66,6 @@ void *acpi_ds_obj_stack_get_value(u32 index, | |||
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | #ifdef ACPI_FUTURE_USAGE | 68 | #ifdef ACPI_FUTURE_USAGE |
69 | |||
70 | /******************************************************************************* | 69 | /******************************************************************************* |
71 | * | 70 | * |
72 | * FUNCTION: acpi_ds_result_remove | 71 | * FUNCTION: acpi_ds_result_remove |
@@ -88,7 +87,7 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
88 | { | 87 | { |
89 | union acpi_generic_state *state; | 88 | union acpi_generic_state *state; |
90 | 89 | ||
91 | ACPI_FUNCTION_NAME("ds_result_remove"); | 90 | ACPI_FUNCTION_NAME(ds_result_remove); |
92 | 91 | ||
93 | state = walk_state->results; | 92 | state = walk_state->results; |
94 | if (!state) { | 93 | if (!state) { |
@@ -128,7 +127,6 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
128 | 127 | ||
129 | return (AE_OK); | 128 | return (AE_OK); |
130 | } | 129 | } |
131 | |||
132 | #endif /* ACPI_FUTURE_USAGE */ | 130 | #endif /* ACPI_FUTURE_USAGE */ |
133 | 131 | ||
134 | /******************************************************************************* | 132 | /******************************************************************************* |
@@ -152,7 +150,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
152 | acpi_native_uint index; | 150 | acpi_native_uint index; |
153 | union acpi_generic_state *state; | 151 | union acpi_generic_state *state; |
154 | 152 | ||
155 | ACPI_FUNCTION_NAME("ds_result_pop"); | 153 | ACPI_FUNCTION_NAME(ds_result_pop); |
156 | 154 | ||
157 | state = walk_state->results; | 155 | state = walk_state->results; |
158 | if (!state) { | 156 | if (!state) { |
@@ -170,6 +168,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object, | |||
170 | state->results.num_results--; | 168 | state->results.num_results--; |
171 | 169 | ||
172 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { | 170 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { |
171 | |||
173 | /* Check for a valid result object */ | 172 | /* Check for a valid result object */ |
174 | 173 | ||
175 | if (state->results.obj_desc[index - 1]) { | 174 | if (state->results.obj_desc[index - 1]) { |
@@ -213,7 +212,7 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, | |||
213 | acpi_native_uint index; | 212 | acpi_native_uint index; |
214 | union acpi_generic_state *state; | 213 | union acpi_generic_state *state; |
215 | 214 | ||
216 | ACPI_FUNCTION_NAME("ds_result_pop_from_bottom"); | 215 | ACPI_FUNCTION_NAME(ds_result_pop_from_bottom); |
217 | 216 | ||
218 | state = walk_state->results; | 217 | state = walk_state->results; |
219 | if (!state) { | 218 | if (!state) { |
@@ -278,7 +277,7 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
278 | { | 277 | { |
279 | union acpi_generic_state *state; | 278 | union acpi_generic_state *state; |
280 | 279 | ||
281 | ACPI_FUNCTION_NAME("ds_result_push"); | 280 | ACPI_FUNCTION_NAME(ds_result_push); |
282 | 281 | ||
283 | state = walk_state->results; | 282 | state = walk_state->results; |
284 | if (!state) { | 283 | if (!state) { |
@@ -331,14 +330,14 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | |||
331 | { | 330 | { |
332 | union acpi_generic_state *state; | 331 | union acpi_generic_state *state; |
333 | 332 | ||
334 | ACPI_FUNCTION_NAME("ds_result_stack_push"); | 333 | ACPI_FUNCTION_NAME(ds_result_stack_push); |
335 | 334 | ||
336 | state = acpi_ut_create_generic_state(); | 335 | state = acpi_ut_create_generic_state(); |
337 | if (!state) { | 336 | if (!state) { |
338 | return (AE_NO_MEMORY); | 337 | return (AE_NO_MEMORY); |
339 | } | 338 | } |
340 | 339 | ||
341 | state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT; | 340 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; |
342 | acpi_ut_push_generic_state(&walk_state->results, state); | 341 | acpi_ut_push_generic_state(&walk_state->results, state); |
343 | 342 | ||
344 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", | 343 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", |
@@ -363,7 +362,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
363 | { | 362 | { |
364 | union acpi_generic_state *state; | 363 | union acpi_generic_state *state; |
365 | 364 | ||
366 | ACPI_FUNCTION_NAME("ds_result_stack_pop"); | 365 | ACPI_FUNCTION_NAME(ds_result_stack_pop); |
367 | 366 | ||
368 | /* Check for stack underflow */ | 367 | /* Check for stack underflow */ |
369 | 368 | ||
@@ -376,7 +375,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
376 | state = acpi_ut_pop_generic_state(&walk_state->results); | 375 | state = acpi_ut_pop_generic_state(&walk_state->results); |
377 | 376 | ||
378 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
379 | "Result=%p remaining_results=%X State=%p\n", | 378 | "Result=%p RemainingResults=%X State=%p\n", |
380 | state, state->results.num_results, walk_state)); | 379 | state, state->results.num_results, walk_state)); |
381 | 380 | ||
382 | acpi_ut_delete_generic_state(state); | 381 | acpi_ut_delete_generic_state(state); |
@@ -400,7 +399,7 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
400 | acpi_status | 399 | acpi_status |
401 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) | 400 | acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) |
402 | { | 401 | { |
403 | ACPI_FUNCTION_NAME("ds_obj_stack_push"); | 402 | ACPI_FUNCTION_NAME(ds_obj_stack_push); |
404 | 403 | ||
405 | /* Check for stack overflow */ | 404 | /* Check for stack overflow */ |
406 | 405 | ||
@@ -445,9 +444,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) | |||
445 | { | 444 | { |
446 | u32 i; | 445 | u32 i; |
447 | 446 | ||
448 | ACPI_FUNCTION_NAME("ds_obj_stack_pop"); | 447 | ACPI_FUNCTION_NAME(ds_obj_stack_pop); |
449 | 448 | ||
450 | for (i = 0; i < pop_count; i++) { | 449 | for (i = 0; i < pop_count; i++) { |
450 | |||
451 | /* Check for stack underflow */ | 451 | /* Check for stack underflow */ |
452 | 452 | ||
453 | if (walk_state->num_operands == 0) { | 453 | if (walk_state->num_operands == 0) { |
@@ -491,9 +491,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
491 | u32 i; | 491 | u32 i; |
492 | union acpi_operand_object *obj_desc; | 492 | union acpi_operand_object *obj_desc; |
493 | 493 | ||
494 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete"); | 494 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); |
495 | 495 | ||
496 | for (i = 0; i < pop_count; i++) { | 496 | for (i = 0; i < pop_count; i++) { |
497 | |||
497 | /* Check for stack underflow */ | 498 | /* Check for stack underflow */ |
498 | 499 | ||
499 | if (walk_state->num_operands == 0) { | 500 | if (walk_state->num_operands == 0) { |
@@ -538,13 +539,13 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | |||
538 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state | 539 | struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state |
539 | *thread) | 540 | *thread) |
540 | { | 541 | { |
541 | ACPI_FUNCTION_NAME("ds_get_current_walk_state"); | 542 | ACPI_FUNCTION_NAME(ds_get_current_walk_state); |
542 | 543 | ||
543 | if (!thread) { | 544 | if (!thread) { |
544 | return (NULL); | 545 | return (NULL); |
545 | } | 546 | } |
546 | 547 | ||
547 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current walk_state %p\n", | 548 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current WalkState %p\n", |
548 | thread->walk_state_list)); | 549 | thread->walk_state_list)); |
549 | 550 | ||
550 | return (thread->walk_state_list); | 551 | return (thread->walk_state_list); |
@@ -567,7 +568,7 @@ void | |||
567 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, | 568 | acpi_ds_push_walk_state(struct acpi_walk_state *walk_state, |
568 | struct acpi_thread_state *thread) | 569 | struct acpi_thread_state *thread) |
569 | { | 570 | { |
570 | ACPI_FUNCTION_TRACE("ds_push_walk_state"); | 571 | ACPI_FUNCTION_TRACE(ds_push_walk_state); |
571 | 572 | ||
572 | walk_state->next = thread->walk_state_list; | 573 | walk_state->next = thread->walk_state_list; |
573 | thread->walk_state_list = walk_state; | 574 | thread->walk_state_list = walk_state; |
@@ -593,11 +594,12 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
593 | { | 594 | { |
594 | struct acpi_walk_state *walk_state; | 595 | struct acpi_walk_state *walk_state; |
595 | 596 | ||
596 | ACPI_FUNCTION_TRACE("ds_pop_walk_state"); | 597 | ACPI_FUNCTION_TRACE(ds_pop_walk_state); |
597 | 598 | ||
598 | walk_state = thread->walk_state_list; | 599 | walk_state = thread->walk_state_list; |
599 | 600 | ||
600 | if (walk_state) { | 601 | if (walk_state) { |
602 | |||
601 | /* Next walk state becomes the current walk state */ | 603 | /* Next walk state becomes the current walk state */ |
602 | 604 | ||
603 | thread->walk_state_list = walk_state->next; | 605 | thread->walk_state_list = walk_state->next; |
@@ -618,7 +620,7 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread) | |||
618 | * | 620 | * |
619 | * PARAMETERS: owner_id - ID for object creation | 621 | * PARAMETERS: owner_id - ID for object creation |
620 | * Origin - Starting point for this walk | 622 | * Origin - Starting point for this walk |
621 | * mth_desc - Method object | 623 | * method_desc - Method object |
622 | * Thread - Current thread state | 624 | * Thread - Current thread state |
623 | * | 625 | * |
624 | * RETURN: Pointer to the new walk state. | 626 | * RETURN: Pointer to the new walk state. |
@@ -632,24 +634,24 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
632 | union acpi_parse_object | 634 | union acpi_parse_object |
633 | *origin, | 635 | *origin, |
634 | union acpi_operand_object | 636 | union acpi_operand_object |
635 | *mth_desc, | 637 | *method_desc, |
636 | struct acpi_thread_state | 638 | struct acpi_thread_state |
637 | *thread) | 639 | *thread) |
638 | { | 640 | { |
639 | struct acpi_walk_state *walk_state; | 641 | struct acpi_walk_state *walk_state; |
640 | acpi_status status; | 642 | acpi_status status; |
641 | 643 | ||
642 | ACPI_FUNCTION_TRACE("ds_create_walk_state"); | 644 | ACPI_FUNCTION_TRACE(ds_create_walk_state); |
643 | 645 | ||
644 | walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state)); | 646 | walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state)); |
645 | if (!walk_state) { | 647 | if (!walk_state) { |
646 | return_PTR(NULL); | 648 | return_PTR(NULL); |
647 | } | 649 | } |
648 | 650 | ||
649 | walk_state->data_type = ACPI_DESC_TYPE_WALK; | 651 | walk_state->descriptor_type = ACPI_DESC_TYPE_WALK; |
652 | walk_state->method_desc = method_desc; | ||
650 | walk_state->owner_id = owner_id; | 653 | walk_state->owner_id = owner_id; |
651 | walk_state->origin = origin; | 654 | walk_state->origin = origin; |
652 | walk_state->method_desc = mth_desc; | ||
653 | walk_state->thread = thread; | 655 | walk_state->thread = thread; |
654 | 656 | ||
655 | walk_state->parser_state.start_op = origin; | 657 | walk_state->parser_state.start_op = origin; |
@@ -664,7 +666,7 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, | |||
664 | 666 | ||
665 | status = acpi_ds_result_stack_push(walk_state); | 667 | status = acpi_ds_result_stack_push(walk_state); |
666 | if (ACPI_FAILURE(status)) { | 668 | if (ACPI_FAILURE(status)) { |
667 | ACPI_MEM_FREE(walk_state); | 669 | ACPI_FREE(walk_state); |
668 | return_PTR(NULL); | 670 | return_PTR(NULL); |
669 | } | 671 | } |
670 | 672 | ||
@@ -701,13 +703,13 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
701 | struct acpi_namespace_node *method_node, | 703 | struct acpi_namespace_node *method_node, |
702 | u8 * aml_start, | 704 | u8 * aml_start, |
703 | u32 aml_length, | 705 | u32 aml_length, |
704 | struct acpi_parameter_info *info, u8 pass_number) | 706 | struct acpi_evaluate_info *info, u8 pass_number) |
705 | { | 707 | { |
706 | acpi_status status; | 708 | acpi_status status; |
707 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 709 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
708 | union acpi_parse_object *extra_op; | 710 | union acpi_parse_object *extra_op; |
709 | 711 | ||
710 | ACPI_FUNCTION_TRACE("ds_init_aml_walk"); | 712 | ACPI_FUNCTION_TRACE(ds_init_aml_walk); |
711 | 713 | ||
712 | walk_state->parser_state.aml = | 714 | walk_state->parser_state.aml = |
713 | walk_state->parser_state.aml_start = aml_start; | 715 | walk_state->parser_state.aml_start = aml_start; |
@@ -778,6 +780,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
778 | } | 780 | } |
779 | 781 | ||
780 | if (parser_state->start_node) { | 782 | if (parser_state->start_node) { |
783 | |||
781 | /* Push start scope on scope stack and make it current */ | 784 | /* Push start scope on scope stack and make it current */ |
782 | 785 | ||
783 | status = | 786 | status = |
@@ -810,21 +813,24 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
810 | { | 813 | { |
811 | union acpi_generic_state *state; | 814 | union acpi_generic_state *state; |
812 | 815 | ||
813 | ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state); | 816 | ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state); |
814 | 817 | ||
815 | if (!walk_state) { | 818 | if (!walk_state) { |
816 | return; | 819 | return; |
817 | } | 820 | } |
818 | 821 | ||
819 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 822 | if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) { |
820 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", | 823 | ACPI_ERROR((AE_INFO, "%p is not a valid walk state", |
821 | walk_state)); | 824 | walk_state)); |
822 | return; | 825 | return; |
823 | } | 826 | } |
824 | 827 | ||
828 | /* There should not be any open scopes */ | ||
829 | |||
825 | if (walk_state->parser_state.scope) { | 830 | if (walk_state->parser_state.scope) { |
826 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", | 831 | ACPI_ERROR((AE_INFO, "%p walk still has a scope list", |
827 | walk_state)); | 832 | walk_state)); |
833 | acpi_ps_cleanup_scope(&walk_state->parser_state); | ||
828 | } | 834 | } |
829 | 835 | ||
830 | /* Always must free any linked control states */ | 836 | /* Always must free any linked control states */ |
@@ -854,7 +860,7 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
854 | acpi_ut_delete_generic_state(state); | 860 | acpi_ut_delete_generic_state(state); |
855 | } | 861 | } |
856 | 862 | ||
857 | ACPI_MEM_FREE(walk_state); | 863 | ACPI_FREE(walk_state); |
858 | return_VOID; | 864 | return_VOID; |
859 | } | 865 | } |
860 | 866 | ||
@@ -879,7 +885,7 @@ acpi_ds_result_insert(void *object, | |||
879 | { | 885 | { |
880 | union acpi_generic_state *state; | 886 | union acpi_generic_state *state; |
881 | 887 | ||
882 | ACPI_FUNCTION_NAME("ds_result_insert"); | 888 | ACPI_FUNCTION_NAME(ds_result_insert); |
883 | 889 | ||
884 | state = walk_state->results; | 890 | state = walk_state->results; |
885 | if (!state) { | 891 | if (!state) { |
@@ -937,7 +943,7 @@ acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) | |||
937 | { | 943 | { |
938 | u32 i; | 944 | u32 i; |
939 | 945 | ||
940 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state); | 946 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state); |
941 | 947 | ||
942 | /* The stack size is configurable, but fixed */ | 948 | /* The stack size is configurable, but fixed */ |
943 | 949 | ||
@@ -969,7 +975,7 @@ acpi_status | |||
969 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | 975 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, |
970 | struct acpi_walk_state *walk_state) | 976 | struct acpi_walk_state *walk_state) |
971 | { | 977 | { |
972 | ACPI_FUNCTION_NAME("ds_obj_stack_pop_object"); | 978 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_object); |
973 | 979 | ||
974 | /* Check for stack underflow */ | 980 | /* Check for stack underflow */ |
975 | 981 | ||
@@ -1025,7 +1031,7 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | |||
1025 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) | 1031 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) |
1026 | { | 1032 | { |
1027 | 1033 | ||
1028 | ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state); | 1034 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state); |
1029 | 1035 | ||
1030 | /* Can't do it if the stack is empty */ | 1036 | /* Can't do it if the stack is empty */ |
1031 | 1037 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index eee0864ba300..18b3ea9dace2 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -116,7 +116,7 @@ union acpi_ec { | |||
116 | struct acpi_generic_address command_addr; | 116 | struct acpi_generic_address command_addr; |
117 | struct acpi_generic_address data_addr; | 117 | struct acpi_generic_address data_addr; |
118 | unsigned long global_lock; | 118 | unsigned long global_lock; |
119 | spinlock_t lock; | 119 | struct semaphore sem; |
120 | } poll; | 120 | } poll; |
121 | }; | 121 | }; |
122 | 122 | ||
@@ -323,7 +323,6 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) | |||
323 | { | 323 | { |
324 | acpi_status status = AE_OK; | 324 | acpi_status status = AE_OK; |
325 | int result = 0; | 325 | int result = 0; |
326 | unsigned long flags = 0; | ||
327 | u32 glk = 0; | 326 | u32 glk = 0; |
328 | 327 | ||
329 | ACPI_FUNCTION_TRACE("acpi_ec_read"); | 328 | ACPI_FUNCTION_TRACE("acpi_ec_read"); |
@@ -339,8 +338,11 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) | |||
339 | return_VALUE(-ENODEV); | 338 | return_VALUE(-ENODEV); |
340 | } | 339 | } |
341 | 340 | ||
342 | spin_lock_irqsave(&ec->poll.lock, flags); | 341 | if (down_interruptible(&ec->poll.sem)) { |
343 | 342 | result = -ERESTARTSYS; | |
343 | goto end_nosem; | ||
344 | } | ||
345 | |||
344 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, | 346 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, |
345 | &ec->common.command_addr); | 347 | &ec->common.command_addr); |
346 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 348 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
@@ -358,8 +360,8 @@ static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data) | |||
358 | *data, address)); | 360 | *data, address)); |
359 | 361 | ||
360 | end: | 362 | end: |
361 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 363 | up(&ec->poll.sem); |
362 | 364 | end_nosem: | |
363 | if (ec->common.global_lock) | 365 | if (ec->common.global_lock) |
364 | acpi_release_global_lock(glk); | 366 | acpi_release_global_lock(glk); |
365 | 367 | ||
@@ -370,7 +372,6 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | |||
370 | { | 372 | { |
371 | int result = 0; | 373 | int result = 0; |
372 | acpi_status status = AE_OK; | 374 | acpi_status status = AE_OK; |
373 | unsigned long flags = 0; | ||
374 | u32 glk = 0; | 375 | u32 glk = 0; |
375 | 376 | ||
376 | ACPI_FUNCTION_TRACE("acpi_ec_write"); | 377 | ACPI_FUNCTION_TRACE("acpi_ec_write"); |
@@ -384,8 +385,11 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | |||
384 | return_VALUE(-ENODEV); | 385 | return_VALUE(-ENODEV); |
385 | } | 386 | } |
386 | 387 | ||
387 | spin_lock_irqsave(&ec->poll.lock, flags); | 388 | if (down_interruptible(&ec->poll.sem)) { |
388 | 389 | result = -ERESTARTSYS; | |
390 | goto end_nosem; | ||
391 | } | ||
392 | |||
389 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, | 393 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, |
390 | &ec->common.command_addr); | 394 | &ec->common.command_addr); |
391 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 395 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
@@ -406,8 +410,8 @@ static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data) | |||
406 | data, address)); | 410 | data, address)); |
407 | 411 | ||
408 | end: | 412 | end: |
409 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 413 | up(&ec->poll.sem); |
410 | 414 | end_nosem: | |
411 | if (ec->common.global_lock) | 415 | if (ec->common.global_lock) |
412 | acpi_release_global_lock(glk); | 416 | acpi_release_global_lock(glk); |
413 | 417 | ||
@@ -568,7 +572,6 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) | |||
568 | { | 572 | { |
569 | int result = 0; | 573 | int result = 0; |
570 | acpi_status status = AE_OK; | 574 | acpi_status status = AE_OK; |
571 | unsigned long flags = 0; | ||
572 | u32 glk = 0; | 575 | u32 glk = 0; |
573 | 576 | ||
574 | ACPI_FUNCTION_TRACE("acpi_ec_query"); | 577 | ACPI_FUNCTION_TRACE("acpi_ec_query"); |
@@ -589,8 +592,11 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) | |||
589 | * Note that successful completion of the query causes the ACPI_EC_SCI | 592 | * Note that successful completion of the query causes the ACPI_EC_SCI |
590 | * bit to be cleared (and thus clearing the interrupt source). | 593 | * bit to be cleared (and thus clearing the interrupt source). |
591 | */ | 594 | */ |
592 | spin_lock_irqsave(&ec->poll.lock, flags); | 595 | if (down_interruptible(&ec->poll.sem)) { |
593 | 596 | result = -ERESTARTSYS; | |
597 | goto end_nosem; | ||
598 | } | ||
599 | |||
594 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, | 600 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, |
595 | &ec->common.command_addr); | 601 | &ec->common.command_addr); |
596 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 602 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
@@ -602,8 +608,8 @@ static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data) | |||
602 | result = -ENODATA; | 608 | result = -ENODATA; |
603 | 609 | ||
604 | end: | 610 | end: |
605 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 611 | up(&ec->poll.sem); |
606 | 612 | end_nosem: | |
607 | if (ec->common.global_lock) | 613 | if (ec->common.global_lock) |
608 | acpi_release_global_lock(glk); | 614 | acpi_release_global_lock(glk); |
609 | 615 | ||
@@ -680,7 +686,6 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) | |||
680 | { | 686 | { |
681 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; | 687 | union acpi_ec *ec = (union acpi_ec *)ec_cxt; |
682 | u32 value = 0; | 688 | u32 value = 0; |
683 | unsigned long flags = 0; | ||
684 | static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; | 689 | static char object_name[5] = { '_', 'Q', '0', '0', '\0' }; |
685 | const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', | 690 | const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', |
686 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | 691 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' |
@@ -691,9 +696,11 @@ static void acpi_ec_gpe_poll_query(void *ec_cxt) | |||
691 | if (!ec_cxt) | 696 | if (!ec_cxt) |
692 | goto end; | 697 | goto end; |
693 | 698 | ||
694 | spin_lock_irqsave(&ec->poll.lock, flags); | 699 | if (down_interruptible (&ec->poll.sem)) { |
700 | return_VOID; | ||
701 | } | ||
695 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); | 702 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); |
696 | spin_unlock_irqrestore(&ec->poll.lock, flags); | 703 | up(&ec->poll.sem); |
697 | 704 | ||
698 | /* TBD: Implement asynch events! | 705 | /* TBD: Implement asynch events! |
699 | * NOTE: All we care about are EC-SCI's. Other EC events are | 706 | * NOTE: All we care about are EC-SCI's. Other EC events are |
@@ -763,8 +770,7 @@ static u32 acpi_ec_gpe_poll_handler(void *data) | |||
763 | 770 | ||
764 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | 771 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
765 | 772 | ||
766 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 773 | status = acpi_os_execute(OSL_EC_POLL_HANDLER, acpi_ec_gpe_query, ec); |
767 | acpi_ec_gpe_query, ec); | ||
768 | 774 | ||
769 | if (status == AE_OK) | 775 | if (status == AE_OK) |
770 | return ACPI_INTERRUPT_HANDLED; | 776 | return ACPI_INTERRUPT_HANDLED; |
@@ -799,7 +805,7 @@ static u32 acpi_ec_gpe_intr_handler(void *data) | |||
799 | 805 | ||
800 | if (value & ACPI_EC_FLAG_SCI) { | 806 | if (value & ACPI_EC_FLAG_SCI) { |
801 | atomic_add(1, &ec->intr.pending_gpe); | 807 | atomic_add(1, &ec->intr.pending_gpe); |
802 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 808 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
803 | acpi_ec_gpe_query, ec); | 809 | acpi_ec_gpe_query, ec); |
804 | return status == AE_OK ? | 810 | return status == AE_OK ? |
805 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 811 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
@@ -991,7 +997,6 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
991 | int result = 0; | 997 | int result = 0; |
992 | acpi_status status = AE_OK; | 998 | acpi_status status = AE_OK; |
993 | union acpi_ec *ec = NULL; | 999 | union acpi_ec *ec = NULL; |
994 | unsigned long uid; | ||
995 | 1000 | ||
996 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1001 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
997 | 1002 | ||
@@ -1005,7 +1010,7 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1005 | 1010 | ||
1006 | ec->common.handle = device->handle; | 1011 | ec->common.handle = device->handle; |
1007 | ec->common.uid = -1; | 1012 | ec->common.uid = -1; |
1008 | spin_lock_init(&ec->poll.lock); | 1013 | init_MUTEX(&ec->poll.sem); |
1009 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1014 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
1010 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1015 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
1011 | acpi_driver_data(device) = ec; | 1016 | acpi_driver_data(device) = ec; |
@@ -1014,10 +1019,9 @@ static int acpi_ec_poll_add(struct acpi_device *device) | |||
1014 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1019 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1015 | &ec->common.global_lock); | 1020 | &ec->common.global_lock); |
1016 | 1021 | ||
1017 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1022 | /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: |
1018 | we now have the *real* EC info, so kill the makeshift one. */ | 1023 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1019 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1024 | if (ec_ecdt) { |
1020 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1021 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1025 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1022 | ACPI_ADR_SPACE_EC, | 1026 | ACPI_ADR_SPACE_EC, |
1023 | &acpi_ec_space_handler); | 1027 | &acpi_ec_space_handler); |
@@ -1062,7 +1066,6 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1062 | int result = 0; | 1066 | int result = 0; |
1063 | acpi_status status = AE_OK; | 1067 | acpi_status status = AE_OK; |
1064 | union acpi_ec *ec = NULL; | 1068 | union acpi_ec *ec = NULL; |
1065 | unsigned long uid; | ||
1066 | 1069 | ||
1067 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1070 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
1068 | 1071 | ||
@@ -1088,10 +1091,9 @@ static int acpi_ec_intr_add(struct acpi_device *device) | |||
1088 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, | 1091 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, |
1089 | &ec->common.global_lock); | 1092 | &ec->common.global_lock); |
1090 | 1093 | ||
1091 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1094 | /* XXX we don't test uids, because on some boxes ecdt uid = 0, see: |
1092 | we now have the *real* EC info, so kill the makeshift one. */ | 1095 | http://bugzilla.kernel.org/show_bug.cgi?id=6111 */ |
1093 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | 1096 | if (ec_ecdt) { |
1094 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1095 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1097 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
1096 | ACPI_ADR_SPACE_EC, | 1098 | ACPI_ADR_SPACE_EC, |
1097 | &acpi_ec_space_handler); | 1099 | &acpi_ec_space_handler); |
@@ -1300,7 +1302,7 @@ acpi_fake_ecdt_poll_callback(acpi_handle handle, | |||
1300 | &ec_ecdt->common.gpe_bit); | 1302 | &ec_ecdt->common.gpe_bit); |
1301 | if (ACPI_FAILURE(status)) | 1303 | if (ACPI_FAILURE(status)) |
1302 | return status; | 1304 | return status; |
1303 | spin_lock_init(&ec_ecdt->poll.lock); | 1305 | init_MUTEX(&ec_ecdt->poll.sem); |
1304 | ec_ecdt->common.global_lock = TRUE; | 1306 | ec_ecdt->common.global_lock = TRUE; |
1305 | ec_ecdt->common.handle = handle; | 1307 | ec_ecdt->common.handle = handle; |
1306 | 1308 | ||
@@ -1416,7 +1418,7 @@ static int __init acpi_ec_poll_get_real_ecdt(void) | |||
1416 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | 1418 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; |
1417 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | 1419 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; |
1418 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; | 1420 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; |
1419 | spin_lock_init(&ec_ecdt->poll.lock); | 1421 | init_MUTEX(&ec_ecdt->poll.sem); |
1420 | /* use the GL just to be safe */ | 1422 | /* use the GL just to be safe */ |
1421 | ec_ecdt->common.global_lock = TRUE; | 1423 | ec_ecdt->common.global_lock = TRUE; |
1422 | ec_ecdt->common.uid = ecdt_ptr->uid; | 1424 | ec_ecdt->common.uid = ecdt_ptr->uid; |
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index c9ac05c4685f..919037d6acff 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -68,7 +68,7 @@ acpi_status acpi_ev_initialize_events(void) | |||
68 | { | 68 | { |
69 | acpi_status status; | 69 | acpi_status status; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ev_initialize_events"); | 71 | ACPI_FUNCTION_TRACE(ev_initialize_events); |
72 | 72 | ||
73 | /* Make sure we have ACPI tables */ | 73 | /* Make sure we have ACPI tables */ |
74 | 74 | ||
@@ -118,7 +118,7 @@ acpi_status acpi_ev_install_fadt_gpes(void) | |||
118 | { | 118 | { |
119 | acpi_status status; | 119 | acpi_status status; |
120 | 120 | ||
121 | ACPI_FUNCTION_TRACE("ev_install_fadt_gpes"); | 121 | ACPI_FUNCTION_TRACE(ev_install_fadt_gpes); |
122 | 122 | ||
123 | /* Namespace must be locked */ | 123 | /* Namespace must be locked */ |
124 | 124 | ||
@@ -157,7 +157,7 @@ acpi_status acpi_ev_install_xrupt_handlers(void) | |||
157 | { | 157 | { |
158 | acpi_status status; | 158 | acpi_status status; |
159 | 159 | ||
160 | ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers"); | 160 | ACPI_FUNCTION_TRACE(ev_install_xrupt_handlers); |
161 | 161 | ||
162 | /* Install the SCI handler */ | 162 | /* Install the SCI handler */ |
163 | 163 | ||
@@ -241,7 +241,7 @@ u32 acpi_ev_fixed_event_detect(void) | |||
241 | u32 fixed_enable; | 241 | u32 fixed_enable; |
242 | acpi_native_uint i; | 242 | acpi_native_uint i; |
243 | 243 | ||
244 | ACPI_FUNCTION_NAME("ev_fixed_event_detect"); | 244 | ACPI_FUNCTION_NAME(ev_fixed_event_detect); |
245 | 245 | ||
246 | /* | 246 | /* |
247 | * Read the fixed feature status and enable registers, as all the cases | 247 | * Read the fixed feature status and enable registers, as all the cases |
@@ -260,12 +260,14 @@ u32 acpi_ev_fixed_event_detect(void) | |||
260 | * Check for all possible Fixed Events and dispatch those that are active | 260 | * Check for all possible Fixed Events and dispatch those that are active |
261 | */ | 261 | */ |
262 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { | 262 | for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { |
263 | |||
263 | /* Both the status and enable bits must be on for this event */ | 264 | /* Both the status and enable bits must be on for this event */ |
264 | 265 | ||
265 | if ((fixed_status & acpi_gbl_fixed_event_info[i]. | 266 | if ((fixed_status & acpi_gbl_fixed_event_info[i]. |
266 | status_bit_mask) | 267 | status_bit_mask) |
267 | && (fixed_enable & acpi_gbl_fixed_event_info[i]. | 268 | && (fixed_enable & acpi_gbl_fixed_event_info[i]. |
268 | enable_bit_mask)) { | 269 | enable_bit_mask)) { |
270 | |||
269 | /* Found an active (signalled) event */ | 271 | /* Found an active (signalled) event */ |
270 | 272 | ||
271 | int_status |= acpi_ev_fixed_event_dispatch((u32) i); | 273 | int_status |= acpi_ev_fixed_event_dispatch((u32) i); |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index f64f977dd3d5..f01d339407f8 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -69,7 +69,7 @@ acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type) | |||
69 | { | 69 | { |
70 | acpi_status status; | 70 | acpi_status status; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ev_set_gpe_type"); | 72 | ACPI_FUNCTION_TRACE(ev_set_gpe_type); |
73 | 73 | ||
74 | /* Validate type and update register enable masks */ | 74 | /* Validate type and update register enable masks */ |
75 | 75 | ||
@@ -115,7 +115,7 @@ acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info, | |||
115 | struct acpi_gpe_register_info *gpe_register_info; | 115 | struct acpi_gpe_register_info *gpe_register_info; |
116 | u8 register_bit; | 116 | u8 register_bit; |
117 | 117 | ||
118 | ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks"); | 118 | ACPI_FUNCTION_TRACE(ev_update_gpe_enable_masks); |
119 | 119 | ||
120 | gpe_register_info = gpe_event_info->register_info; | 120 | gpe_register_info = gpe_event_info->register_info; |
121 | if (!gpe_register_info) { | 121 | if (!gpe_register_info) { |
@@ -178,7 +178,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | |||
178 | { | 178 | { |
179 | acpi_status status; | 179 | acpi_status status; |
180 | 180 | ||
181 | ACPI_FUNCTION_TRACE("ev_enable_gpe"); | 181 | ACPI_FUNCTION_TRACE(ev_enable_gpe); |
182 | 182 | ||
183 | /* Make sure HW enable masks are updated */ | 183 | /* Make sure HW enable masks are updated */ |
184 | 184 | ||
@@ -207,6 +207,7 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info, | |||
207 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); | 207 | ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED); |
208 | 208 | ||
209 | if (write_to_hardware) { | 209 | if (write_to_hardware) { |
210 | |||
210 | /* Clear the GPE (of stale events), then enable it */ | 211 | /* Clear the GPE (of stale events), then enable it */ |
211 | 212 | ||
212 | status = acpi_hw_clear_gpe(gpe_event_info); | 213 | status = acpi_hw_clear_gpe(gpe_event_info); |
@@ -243,7 +244,7 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
243 | { | 244 | { |
244 | acpi_status status; | 245 | acpi_status status; |
245 | 246 | ||
246 | ACPI_FUNCTION_TRACE("ev_disable_gpe"); | 247 | ACPI_FUNCTION_TRACE(ev_disable_gpe); |
247 | 248 | ||
248 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { | 249 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { |
249 | return_ACPI_STATUS(AE_OK); | 250 | return_ACPI_STATUS(AE_OK); |
@@ -313,6 +314,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
313 | /* A NULL gpe_block means use the FADT-defined GPE block(s) */ | 314 | /* A NULL gpe_block means use the FADT-defined GPE block(s) */ |
314 | 315 | ||
315 | if (!gpe_device) { | 316 | if (!gpe_device) { |
317 | |||
316 | /* Examine GPE Block 0 and 1 (These blocks are permanent) */ | 318 | /* Examine GPE Block 0 and 1 (These blocks are permanent) */ |
317 | 319 | ||
318 | for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { | 320 | for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) { |
@@ -380,10 +382,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
380 | u32 status_reg; | 382 | u32 status_reg; |
381 | u32 enable_reg; | 383 | u32 enable_reg; |
382 | acpi_cpu_flags flags; | 384 | acpi_cpu_flags flags; |
385 | acpi_cpu_flags hw_flags; | ||
383 | acpi_native_uint i; | 386 | acpi_native_uint i; |
384 | acpi_native_uint j; | 387 | acpi_native_uint j; |
385 | 388 | ||
386 | ACPI_FUNCTION_NAME("ev_gpe_detect"); | 389 | ACPI_FUNCTION_NAME(ev_gpe_detect); |
387 | 390 | ||
388 | /* Check for the case where there are no GPEs */ | 391 | /* Check for the case where there are no GPEs */ |
389 | 392 | ||
@@ -391,9 +394,12 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
391 | return (int_status); | 394 | return (int_status); |
392 | } | 395 | } |
393 | 396 | ||
394 | /* Examine all GPE blocks attached to this interrupt level */ | 397 | /* We need to hold the GPE lock now, hardware lock in the loop */ |
395 | 398 | ||
396 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 399 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
400 | |||
401 | /* Examine all GPE blocks attached to this interrupt level */ | ||
402 | |||
397 | gpe_block = gpe_xrupt_list->gpe_block_list_head; | 403 | gpe_block = gpe_xrupt_list->gpe_block_list_head; |
398 | while (gpe_block) { | 404 | while (gpe_block) { |
399 | /* | 405 | /* |
@@ -402,10 +408,13 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
402 | * Find all currently active GP events. | 408 | * Find all currently active GP events. |
403 | */ | 409 | */ |
404 | for (i = 0; i < gpe_block->register_count; i++) { | 410 | for (i = 0; i < gpe_block->register_count; i++) { |
411 | |||
405 | /* Get the next status/enable pair */ | 412 | /* Get the next status/enable pair */ |
406 | 413 | ||
407 | gpe_register_info = &gpe_block->register_info[i]; | 414 | gpe_register_info = &gpe_block->register_info[i]; |
408 | 415 | ||
416 | hw_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); | ||
417 | |||
409 | /* Read the Status Register */ | 418 | /* Read the Status Register */ |
410 | 419 | ||
411 | status = | 420 | status = |
@@ -414,6 +423,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
414 | &gpe_register_info-> | 423 | &gpe_register_info-> |
415 | status_address); | 424 | status_address); |
416 | if (ACPI_FAILURE(status)) { | 425 | if (ACPI_FAILURE(status)) { |
426 | acpi_os_release_lock(acpi_gbl_hardware_lock, | ||
427 | hw_flags); | ||
417 | goto unlock_and_exit; | 428 | goto unlock_and_exit; |
418 | } | 429 | } |
419 | 430 | ||
@@ -424,6 +435,8 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
424 | &enable_reg, | 435 | &enable_reg, |
425 | &gpe_register_info-> | 436 | &gpe_register_info-> |
426 | enable_address); | 437 | enable_address); |
438 | acpi_os_release_lock(acpi_gbl_hardware_lock, hw_flags); | ||
439 | |||
427 | if (ACPI_FAILURE(status)) { | 440 | if (ACPI_FAILURE(status)) { |
428 | goto unlock_and_exit; | 441 | goto unlock_and_exit; |
429 | } | 442 | } |
@@ -437,6 +450,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
437 | 450 | ||
438 | enabled_status_byte = (u8) (status_reg & enable_reg); | 451 | enabled_status_byte = (u8) (status_reg & enable_reg); |
439 | if (!enabled_status_byte) { | 452 | if (!enabled_status_byte) { |
453 | |||
440 | /* No active GPEs in this register, move on */ | 454 | /* No active GPEs in this register, move on */ |
441 | 455 | ||
442 | continue; | 456 | continue; |
@@ -445,6 +459,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
445 | /* Now look at the individual GPEs in this byte register */ | 459 | /* Now look at the individual GPEs in this byte register */ |
446 | 460 | ||
447 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 461 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
462 | |||
448 | /* Examine one GPE bit */ | 463 | /* Examine one GPE bit */ |
449 | 464 | ||
450 | if (enabled_status_byte & | 465 | if (enabled_status_byte & |
@@ -483,9 +498,9 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
483 | * | 498 | * |
484 | * RETURN: None | 499 | * RETURN: None |
485 | * | 500 | * |
486 | * DESCRIPTION: Perform the actual execution of a GPE control method. This | 501 | * DESCRIPTION: Perform the actual execution of a GPE control method. This |
487 | * function is called from an invocation of acpi_os_queue_for_execution | 502 | * function is called from an invocation of acpi_os_execute and |
488 | * (and therefore does NOT execute at interrupt level) so that | 503 | * therefore does NOT execute at interrupt level - so that |
489 | * the control method itself is not executed in the context of | 504 | * the control method itself is not executed in the context of |
490 | * an interrupt handler. | 505 | * an interrupt handler. |
491 | * | 506 | * |
@@ -494,12 +509,11 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
494 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | 509 | static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) |
495 | { | 510 | { |
496 | struct acpi_gpe_event_info *gpe_event_info = (void *)context; | 511 | struct acpi_gpe_event_info *gpe_event_info = (void *)context; |
497 | u32 gpe_number = 0; | ||
498 | acpi_status status; | 512 | acpi_status status; |
499 | struct acpi_gpe_event_info local_gpe_event_info; | 513 | struct acpi_gpe_event_info local_gpe_event_info; |
500 | struct acpi_parameter_info info; | 514 | struct acpi_evaluate_info *info; |
501 | 515 | ||
502 | ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method"); | 516 | ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); |
503 | 517 | ||
504 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 518 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
505 | if (ACPI_FAILURE(status)) { | 519 | if (ACPI_FAILURE(status)) { |
@@ -535,22 +549,35 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
535 | */ | 549 | */ |
536 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == | 550 | if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == |
537 | ACPI_GPE_DISPATCH_METHOD) { | 551 | ACPI_GPE_DISPATCH_METHOD) { |
538 | /* | ||
539 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | ||
540 | * control method that corresponds to this GPE | ||
541 | */ | ||
542 | info.node = local_gpe_event_info.dispatch.method_node; | ||
543 | info.parameters = | ||
544 | ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info); | ||
545 | info.parameter_type = ACPI_PARAM_GPE; | ||
546 | 552 | ||
547 | status = acpi_ns_evaluate_by_handle(&info); | 553 | /* Allocate the evaluation information block */ |
554 | |||
555 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
556 | if (!info) { | ||
557 | status = AE_NO_MEMORY; | ||
558 | } else { | ||
559 | /* | ||
560 | * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx | ||
561 | * control method that corresponds to this GPE | ||
562 | */ | ||
563 | info->prefix_node = | ||
564 | local_gpe_event_info.dispatch.method_node; | ||
565 | info->parameters = | ||
566 | ACPI_CAST_PTR(union acpi_operand_object *, | ||
567 | gpe_event_info); | ||
568 | info->parameter_type = ACPI_PARAM_GPE; | ||
569 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
570 | |||
571 | status = acpi_ns_evaluate(info); | ||
572 | ACPI_FREE(info); | ||
573 | } | ||
574 | |||
548 | if (ACPI_FAILURE(status)) { | 575 | if (ACPI_FAILURE(status)) { |
549 | ACPI_EXCEPTION((AE_INFO, status, | 576 | ACPI_EXCEPTION((AE_INFO, status, |
550 | "While evaluating method [%4.4s] for GPE[%2X]", | 577 | "While evaluating GPE method [%4.4s]", |
551 | acpi_ut_get_node_name | 578 | acpi_ut_get_node_name |
552 | (local_gpe_event_info.dispatch. | 579 | (local_gpe_event_info.dispatch. |
553 | method_node), gpe_number)); | 580 | method_node))); |
554 | } | 581 | } |
555 | } | 582 | } |
556 | 583 | ||
@@ -593,7 +620,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
593 | { | 620 | { |
594 | acpi_status status; | 621 | acpi_status status; |
595 | 622 | ||
596 | ACPI_FUNCTION_TRACE("ev_gpe_dispatch"); | 623 | ACPI_FUNCTION_TRACE(ev_gpe_dispatch); |
597 | 624 | ||
598 | /* | 625 | /* |
599 | * If edge-triggered, clear the GPE status bit now. Note that | 626 | * If edge-triggered, clear the GPE status bit now. Note that |
@@ -669,9 +696,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
669 | * Execute the method associated with the GPE | 696 | * Execute the method associated with the GPE |
670 | * NOTE: Level-triggered GPEs are cleared after the method completes. | 697 | * NOTE: Level-triggered GPEs are cleared after the method completes. |
671 | */ | 698 | */ |
672 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 699 | status = acpi_os_execute(OSL_GPE_HANDLER, |
673 | acpi_ev_asynch_execute_gpe_method, | 700 | acpi_ev_asynch_execute_gpe_method, |
674 | gpe_event_info); | 701 | gpe_event_info); |
675 | if (ACPI_FAILURE(status)) { | 702 | if (ACPI_FAILURE(status)) { |
676 | ACPI_EXCEPTION((AE_INFO, status, | 703 | ACPI_EXCEPTION((AE_INFO, status, |
677 | "Unable to queue handler for GPE[%2X] - event disabled", | 704 | "Unable to queue handler for GPE[%2X] - event disabled", |
@@ -716,7 +743,7 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number) | |||
716 | * | 743 | * |
717 | * DESCRIPTION: Determine if a a GPE is "wake-only". | 744 | * DESCRIPTION: Determine if a a GPE is "wake-only". |
718 | * | 745 | * |
719 | * Called from Notify() code in interpreter when a "device_wake" | 746 | * Called from Notify() code in interpreter when a "DeviceWake" |
720 | * Notify comes in. | 747 | * Notify comes in. |
721 | * | 748 | * |
722 | ******************************************************************************/ | 749 | ******************************************************************************/ |
@@ -726,7 +753,7 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
726 | { | 753 | { |
727 | acpi_status status; | 754 | acpi_status status; |
728 | 755 | ||
729 | ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe"); | 756 | ACPI_FUNCTION_TRACE(ev_check_for_wake_only_gpe); |
730 | 757 | ||
731 | if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ | 758 | if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */ |
732 | ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ | 759 | ((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */ |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 0fd00b5ad650..95ddeb48bc0f 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -131,14 +131,14 @@ u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info) | |||
131 | * | 131 | * |
132 | ******************************************************************************/ | 132 | ******************************************************************************/ |
133 | 133 | ||
134 | acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | 134 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback) |
135 | { | 135 | { |
136 | struct acpi_gpe_block_info *gpe_block; | 136 | struct acpi_gpe_block_info *gpe_block; |
137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 137 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
138 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
139 | acpi_cpu_flags flags; | 139 | acpi_cpu_flags flags; |
140 | 140 | ||
141 | ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); | 141 | ACPI_FUNCTION_TRACE(ev_walk_gpe_list); |
142 | 142 | ||
143 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); | 143 | flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); |
144 | 144 | ||
@@ -146,10 +146,12 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback) | |||
146 | 146 | ||
147 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; | 147 | gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; |
148 | while (gpe_xrupt_info) { | 148 | while (gpe_xrupt_info) { |
149 | |||
149 | /* Walk all Gpe Blocks attached to this interrupt level */ | 150 | /* Walk all Gpe Blocks attached to this interrupt level */ |
150 | 151 | ||
151 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | 152 | gpe_block = gpe_xrupt_info->gpe_block_list_head; |
152 | while (gpe_block) { | 153 | while (gpe_block) { |
154 | |||
153 | /* One callback per GPE block */ | 155 | /* One callback per GPE block */ |
154 | 156 | ||
155 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); | 157 | status = gpe_walk_callback(gpe_xrupt_info, gpe_block); |
@@ -190,11 +192,12 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
190 | acpi_native_uint i; | 192 | acpi_native_uint i; |
191 | acpi_native_uint j; | 193 | acpi_native_uint j; |
192 | 194 | ||
193 | ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers"); | 195 | ACPI_FUNCTION_TRACE(ev_delete_gpe_handlers); |
194 | 196 | ||
195 | /* Examine each GPE Register within the block */ | 197 | /* Examine each GPE Register within the block */ |
196 | 198 | ||
197 | for (i = 0; i < gpe_block->register_count; i++) { | 199 | for (i = 0; i < gpe_block->register_count; i++) { |
200 | |||
198 | /* Now look at the individual GPEs in this byte register */ | 201 | /* Now look at the individual GPEs in this byte register */ |
199 | 202 | ||
200 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { | 203 | for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { |
@@ -204,7 +207,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | |||
204 | 207 | ||
205 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 208 | if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == |
206 | ACPI_GPE_DISPATCH_HANDLER) { | 209 | ACPI_GPE_DISPATCH_HANDLER) { |
207 | ACPI_MEM_FREE(gpe_event_info->dispatch.handler); | 210 | ACPI_FREE(gpe_event_info->dispatch.handler); |
208 | gpe_event_info->dispatch.handler = NULL; | 211 | gpe_event_info->dispatch.handler = NULL; |
209 | gpe_event_info->flags &= | 212 | gpe_event_info->flags &= |
210 | ~ACPI_GPE_DISPATCH_MASK; | 213 | ~ACPI_GPE_DISPATCH_MASK; |
@@ -248,7 +251,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
248 | u8 type; | 251 | u8 type; |
249 | acpi_status status; | 252 | acpi_status status; |
250 | 253 | ||
251 | ACPI_FUNCTION_TRACE("ev_save_method_info"); | 254 | ACPI_FUNCTION_TRACE(ev_save_method_info); |
252 | 255 | ||
253 | /* | 256 | /* |
254 | * _Lxx and _Exx GPE method support | 257 | * _Lxx and _Exx GPE method support |
@@ -279,9 +282,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
279 | default: | 282 | default: |
280 | /* Unknown method type, just ignore it! */ | 283 | /* Unknown method type, just ignore it! */ |
281 | 284 | ||
282 | ACPI_ERROR((AE_INFO, | 285 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
283 | "Unknown GPE method type: %s (name not of form _Lxx or _Exx)", | 286 | "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)", |
284 | name)); | 287 | name)); |
285 | return_ACPI_STATUS(AE_OK); | 288 | return_ACPI_STATUS(AE_OK); |
286 | } | 289 | } |
287 | 290 | ||
@@ -289,11 +292,12 @@ acpi_ev_save_method_info(acpi_handle obj_handle, | |||
289 | 292 | ||
290 | gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); | 293 | gpe_number = ACPI_STRTOUL(&name[2], NULL, 16); |
291 | if (gpe_number == ACPI_UINT32_MAX) { | 294 | if (gpe_number == ACPI_UINT32_MAX) { |
295 | |||
292 | /* Conversion failed; invalid method, just ignore it */ | 296 | /* Conversion failed; invalid method, just ignore it */ |
293 | 297 | ||
294 | ACPI_ERROR((AE_INFO, | 298 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
295 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", | 299 | "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)", |
296 | name)); | 300 | name)); |
297 | return_ACPI_STATUS(AE_OK); | 301 | return_ACPI_STATUS(AE_OK); |
298 | } | 302 | } |
299 | 303 | ||
@@ -364,13 +368,14 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
364 | u32 gpe_number; | 368 | u32 gpe_number; |
365 | acpi_status status; | 369 | acpi_status status; |
366 | 370 | ||
367 | ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe"); | 371 | ACPI_FUNCTION_TRACE(ev_match_prw_and_gpe); |
368 | 372 | ||
369 | /* Check for a _PRW method under this device */ | 373 | /* Check for a _PRW method under this device */ |
370 | 374 | ||
371 | status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, | 375 | status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW, |
372 | ACPI_BTYPE_PACKAGE, &pkg_desc); | 376 | ACPI_BTYPE_PACKAGE, &pkg_desc); |
373 | if (ACPI_FAILURE(status)) { | 377 | if (ACPI_FAILURE(status)) { |
378 | |||
374 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ | 379 | /* Ignore all errors from _PRW, we don't want to abort the subsystem */ |
375 | 380 | ||
376 | return_ACPI_STATUS(AE_OK); | 381 | return_ACPI_STATUS(AE_OK); |
@@ -394,6 +399,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
394 | obj_desc = pkg_desc->package.elements[0]; | 399 | obj_desc = pkg_desc->package.elements[0]; |
395 | 400 | ||
396 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 401 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
402 | |||
397 | /* Use FADT-defined GPE device (from definition of _PRW) */ | 403 | /* Use FADT-defined GPE device (from definition of _PRW) */ |
398 | 404 | ||
399 | target_gpe_device = acpi_gbl_fadt_gpe_device; | 405 | target_gpe_device = acpi_gbl_fadt_gpe_device; |
@@ -402,6 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle, | |||
402 | 408 | ||
403 | gpe_number = (u32) obj_desc->integer.value; | 409 | gpe_number = (u32) obj_desc->integer.value; |
404 | } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 410 | } else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { |
411 | |||
405 | /* Package contains a GPE reference and GPE number within a GPE block */ | 412 | /* Package contains a GPE reference and GPE number within a GPE block */ |
406 | 413 | ||
407 | if ((obj_desc->package.count < 2) || | 414 | if ((obj_desc->package.count < 2) || |
@@ -482,7 +489,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
482 | acpi_status status; | 489 | acpi_status status; |
483 | acpi_cpu_flags flags; | 490 | acpi_cpu_flags flags; |
484 | 491 | ||
485 | ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); | 492 | ACPI_FUNCTION_TRACE(ev_get_gpe_xrupt_block); |
486 | 493 | ||
487 | /* No need for lock since we are not changing any list elements here */ | 494 | /* No need for lock since we are not changing any list elements here */ |
488 | 495 | ||
@@ -497,7 +504,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32 | |||
497 | 504 | ||
498 | /* Not found, must allocate a new xrupt descriptor */ | 505 | /* Not found, must allocate a new xrupt descriptor */ |
499 | 506 | ||
500 | gpe_xrupt = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_xrupt_info)); | 507 | gpe_xrupt = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_xrupt_info)); |
501 | if (!gpe_xrupt) { | 508 | if (!gpe_xrupt) { |
502 | return_PTR(NULL); | 509 | return_PTR(NULL); |
503 | } | 510 | } |
@@ -556,7 +563,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
556 | acpi_status status; | 563 | acpi_status status; |
557 | acpi_cpu_flags flags; | 564 | acpi_cpu_flags flags; |
558 | 565 | ||
559 | ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); | 566 | ACPI_FUNCTION_TRACE(ev_delete_gpe_xrupt); |
560 | 567 | ||
561 | /* We never want to remove the SCI interrupt handler */ | 568 | /* We never want to remove the SCI interrupt handler */ |
562 | 569 | ||
@@ -588,7 +595,7 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) | |||
588 | 595 | ||
589 | /* Free the block */ | 596 | /* Free the block */ |
590 | 597 | ||
591 | ACPI_MEM_FREE(gpe_xrupt); | 598 | ACPI_FREE(gpe_xrupt); |
592 | return_ACPI_STATUS(AE_OK); | 599 | return_ACPI_STATUS(AE_OK); |
593 | } | 600 | } |
594 | 601 | ||
@@ -614,7 +621,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, | |||
614 | acpi_status status; | 621 | acpi_status status; |
615 | acpi_cpu_flags flags; | 622 | acpi_cpu_flags flags; |
616 | 623 | ||
617 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 624 | ACPI_FUNCTION_TRACE(ev_install_gpe_block); |
618 | 625 | ||
619 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 626 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
620 | if (ACPI_FAILURE(status)) { | 627 | if (ACPI_FAILURE(status)) { |
@@ -667,7 +674,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
667 | acpi_status status; | 674 | acpi_status status; |
668 | acpi_cpu_flags flags; | 675 | acpi_cpu_flags flags; |
669 | 676 | ||
670 | ACPI_FUNCTION_TRACE("ev_install_gpe_block"); | 677 | ACPI_FUNCTION_TRACE(ev_install_gpe_block); |
671 | 678 | ||
672 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 679 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
673 | if (ACPI_FAILURE(status)) { | 680 | if (ACPI_FAILURE(status)) { |
@@ -679,6 +686,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
679 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); | 686 | status = acpi_hw_disable_gpe_block(gpe_block->xrupt_block, gpe_block); |
680 | 687 | ||
681 | if (!gpe_block->previous && !gpe_block->next) { | 688 | if (!gpe_block->previous && !gpe_block->next) { |
689 | |||
682 | /* This is the last gpe_block on this interrupt */ | 690 | /* This is the last gpe_block on this interrupt */ |
683 | 691 | ||
684 | status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); | 692 | status = acpi_ev_delete_gpe_xrupt(gpe_block->xrupt_block); |
@@ -704,9 +712,9 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) | |||
704 | 712 | ||
705 | /* Free the gpe_block */ | 713 | /* Free the gpe_block */ |
706 | 714 | ||
707 | ACPI_MEM_FREE(gpe_block->register_info); | 715 | ACPI_FREE(gpe_block->register_info); |
708 | ACPI_MEM_FREE(gpe_block->event_info); | 716 | ACPI_FREE(gpe_block->event_info); |
709 | ACPI_MEM_FREE(gpe_block); | 717 | ACPI_FREE(gpe_block); |
710 | 718 | ||
711 | unlock_and_exit: | 719 | unlock_and_exit: |
712 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 720 | status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
@@ -736,17 +744,17 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
736 | acpi_native_uint j; | 744 | acpi_native_uint j; |
737 | acpi_status status; | 745 | acpi_status status; |
738 | 746 | ||
739 | ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks"); | 747 | ACPI_FUNCTION_TRACE(ev_create_gpe_info_blocks); |
740 | 748 | ||
741 | /* Allocate the GPE register information block */ | 749 | /* Allocate the GPE register information block */ |
742 | 750 | ||
743 | gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block-> | 751 | gpe_register_info = ACPI_ALLOCATE_ZEROED((acpi_size) gpe_block-> |
744 | register_count * | 752 | register_count * |
745 | sizeof(struct | 753 | sizeof(struct |
746 | acpi_gpe_register_info)); | 754 | acpi_gpe_register_info)); |
747 | if (!gpe_register_info) { | 755 | if (!gpe_register_info) { |
748 | ACPI_ERROR((AE_INFO, | 756 | ACPI_ERROR((AE_INFO, |
749 | "Could not allocate the gpe_register_info table")); | 757 | "Could not allocate the GpeRegisterInfo table")); |
750 | return_ACPI_STATUS(AE_NO_MEMORY); | 758 | return_ACPI_STATUS(AE_NO_MEMORY); |
751 | } | 759 | } |
752 | 760 | ||
@@ -754,13 +762,14 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
754 | * Allocate the GPE event_info block. There are eight distinct GPEs | 762 | * Allocate the GPE event_info block. There are eight distinct GPEs |
755 | * per register. Initialization to zeros is sufficient. | 763 | * per register. Initialization to zeros is sufficient. |
756 | */ | 764 | */ |
757 | gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> | 765 | gpe_event_info = ACPI_ALLOCATE_ZEROED(((acpi_size) gpe_block-> |
758 | register_count * | 766 | register_count * |
759 | ACPI_GPE_REGISTER_WIDTH) * | 767 | ACPI_GPE_REGISTER_WIDTH) * |
760 | sizeof(struct acpi_gpe_event_info)); | 768 | sizeof(struct |
769 | acpi_gpe_event_info)); | ||
761 | if (!gpe_event_info) { | 770 | if (!gpe_event_info) { |
762 | ACPI_ERROR((AE_INFO, | 771 | ACPI_ERROR((AE_INFO, |
763 | "Could not allocate the gpe_event_info table")); | 772 | "Could not allocate the GpeEventInfo table")); |
764 | status = AE_NO_MEMORY; | 773 | status = AE_NO_MEMORY; |
765 | goto error_exit; | 774 | goto error_exit; |
766 | } | 775 | } |
@@ -780,6 +789,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
780 | this_event = gpe_event_info; | 789 | this_event = gpe_event_info; |
781 | 790 | ||
782 | for (i = 0; i < gpe_block->register_count; i++) { | 791 | for (i = 0; i < gpe_block->register_count; i++) { |
792 | |||
783 | /* Init the register_info for this GPE register (8 GPEs) */ | 793 | /* Init the register_info for this GPE register (8 GPEs) */ |
784 | 794 | ||
785 | this_register->base_gpe_number = | 795 | this_register->base_gpe_number = |
@@ -839,10 +849,10 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) | |||
839 | 849 | ||
840 | error_exit: | 850 | error_exit: |
841 | if (gpe_register_info) { | 851 | if (gpe_register_info) { |
842 | ACPI_MEM_FREE(gpe_register_info); | 852 | ACPI_FREE(gpe_register_info); |
843 | } | 853 | } |
844 | if (gpe_event_info) { | 854 | if (gpe_event_info) { |
845 | ACPI_MEM_FREE(gpe_event_info); | 855 | ACPI_FREE(gpe_event_info); |
846 | } | 856 | } |
847 | 857 | ||
848 | return_ACPI_STATUS(status); | 858 | return_ACPI_STATUS(status); |
@@ -878,7 +888,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
878 | acpi_status status; | 888 | acpi_status status; |
879 | struct acpi_gpe_block_info *gpe_block; | 889 | struct acpi_gpe_block_info *gpe_block; |
880 | 890 | ||
881 | ACPI_FUNCTION_TRACE("ev_create_gpe_block"); | 891 | ACPI_FUNCTION_TRACE(ev_create_gpe_block); |
882 | 892 | ||
883 | if (!register_count) { | 893 | if (!register_count) { |
884 | return_ACPI_STATUS(AE_OK); | 894 | return_ACPI_STATUS(AE_OK); |
@@ -886,7 +896,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
886 | 896 | ||
887 | /* Allocate a new GPE block */ | 897 | /* Allocate a new GPE block */ |
888 | 898 | ||
889 | gpe_block = ACPI_MEM_CALLOCATE(sizeof(struct acpi_gpe_block_info)); | 899 | gpe_block = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_gpe_block_info)); |
890 | if (!gpe_block) { | 900 | if (!gpe_block) { |
891 | return_ACPI_STATUS(AE_NO_MEMORY); | 901 | return_ACPI_STATUS(AE_NO_MEMORY); |
892 | } | 902 | } |
@@ -906,7 +916,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
906 | */ | 916 | */ |
907 | status = acpi_ev_create_gpe_info_blocks(gpe_block); | 917 | status = acpi_ev_create_gpe_info_blocks(gpe_block); |
908 | if (ACPI_FAILURE(status)) { | 918 | if (ACPI_FAILURE(status)) { |
909 | ACPI_MEM_FREE(gpe_block); | 919 | ACPI_FREE(gpe_block); |
910 | return_ACPI_STATUS(status); | 920 | return_ACPI_STATUS(status); |
911 | } | 921 | } |
912 | 922 | ||
@@ -914,7 +924,7 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device, | |||
914 | 924 | ||
915 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); | 925 | status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); |
916 | if (ACPI_FAILURE(status)) { | 926 | if (ACPI_FAILURE(status)) { |
917 | ACPI_MEM_FREE(gpe_block); | 927 | ACPI_FREE(gpe_block); |
918 | return_ACPI_STATUS(status); | 928 | return_ACPI_STATUS(status); |
919 | } | 929 | } |
920 | 930 | ||
@@ -971,7 +981,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
971 | acpi_native_uint i; | 981 | acpi_native_uint i; |
972 | acpi_native_uint j; | 982 | acpi_native_uint j; |
973 | 983 | ||
974 | ACPI_FUNCTION_TRACE("ev_initialize_gpe_block"); | 984 | ACPI_FUNCTION_TRACE(ev_initialize_gpe_block); |
975 | 985 | ||
976 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ | 986 | /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */ |
977 | 987 | ||
@@ -1013,6 +1023,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1013 | 1023 | ||
1014 | for (i = 0; i < gpe_block->register_count; i++) { | 1024 | for (i = 0; i < gpe_block->register_count; i++) { |
1015 | for (j = 0; j < 8; j++) { | 1025 | for (j = 0; j < 8; j++) { |
1026 | |||
1016 | /* Get the info block for this particular GPE */ | 1027 | /* Get the info block for this particular GPE */ |
1017 | 1028 | ||
1018 | gpe_event_info = | 1029 | gpe_event_info = |
@@ -1040,7 +1051,7 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device, | |||
1040 | 1051 | ||
1041 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); | 1052 | status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block); |
1042 | if (ACPI_FAILURE(status)) { | 1053 | if (ACPI_FAILURE(status)) { |
1043 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p", | 1054 | ACPI_ERROR((AE_INFO, "Could not enable GPEs in GpeBlock %p", |
1044 | gpe_block)); | 1055 | gpe_block)); |
1045 | } | 1056 | } |
1046 | 1057 | ||
@@ -1066,7 +1077,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1066 | u32 gpe_number_max = 0; | 1077 | u32 gpe_number_max = 0; |
1067 | acpi_status status; | 1078 | acpi_status status; |
1068 | 1079 | ||
1069 | ACPI_FUNCTION_TRACE("ev_gpe_initialize"); | 1080 | ACPI_FUNCTION_TRACE(ev_gpe_initialize); |
1070 | 1081 | ||
1071 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 1082 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
1072 | if (ACPI_FAILURE(status)) { | 1083 | if (ACPI_FAILURE(status)) { |
@@ -1099,6 +1110,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1099 | * particular block is not supported. | 1110 | * particular block is not supported. |
1100 | */ | 1111 | */ |
1101 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { | 1112 | if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) { |
1113 | |||
1102 | /* GPE block 0 exists (has both length and address > 0) */ | 1114 | /* GPE block 0 exists (has both length and address > 0) */ |
1103 | 1115 | ||
1104 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); | 1116 | register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2); |
@@ -1121,6 +1133,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1121 | } | 1133 | } |
1122 | 1134 | ||
1123 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { | 1135 | if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) { |
1136 | |||
1124 | /* GPE block 1 exists (has both length and address > 0) */ | 1137 | /* GPE block 1 exists (has both length and address > 0) */ |
1125 | 1138 | ||
1126 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); | 1139 | register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2); |
@@ -1168,6 +1181,7 @@ acpi_status acpi_ev_gpe_initialize(void) | |||
1168 | /* Exit if there are no GPE registers */ | 1181 | /* Exit if there are no GPE registers */ |
1169 | 1182 | ||
1170 | if ((register_count0 + register_count1) == 0) { | 1183 | if ((register_count0 + register_count1) == 0) { |
1184 | |||
1171 | /* GPEs are not required by ACPI, this is OK */ | 1185 | /* GPEs are not required by ACPI, this is OK */ |
1172 | 1186 | ||
1173 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, | 1187 | ACPI_DEBUG_PRINT((ACPI_DB_INIT, |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 0909ba69577e..6eef4efddcf6 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -49,12 +49,13 @@ | |||
49 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evmisc") | 50 | ACPI_MODULE_NAME("evmisc") |
51 | 51 | ||
52 | /* Names for Notify() values, used for debug output */ | ||
52 | #ifdef ACPI_DEBUG_OUTPUT | 53 | #ifdef ACPI_DEBUG_OUTPUT |
53 | static const char *acpi_notify_value_names[] = { | 54 | static const char *acpi_notify_value_names[] = { |
54 | "Bus Check", | 55 | "Bus Check", |
55 | "Device Check", | 56 | "Device Check", |
56 | "Device Wake", | 57 | "Device Wake", |
57 | "Eject request", | 58 | "Eject Request", |
58 | "Device Check Light", | 59 | "Device Check Light", |
59 | "Frequency Mismatch", | 60 | "Frequency Mismatch", |
60 | "Bus Mode Mismatch", | 61 | "Bus Mode Mismatch", |
@@ -124,7 +125,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
124 | union acpi_generic_state *notify_info; | 125 | union acpi_generic_state *notify_info; |
125 | acpi_status status = AE_OK; | 126 | acpi_status status = AE_OK; |
126 | 127 | ||
127 | ACPI_FUNCTION_NAME("ev_queue_notify_request"); | 128 | ACPI_FUNCTION_NAME(ev_queue_notify_request); |
128 | 129 | ||
129 | /* | 130 | /* |
130 | * For value 3 (Ejection Request), some device method may need to be run. | 131 | * For value 3 (Ejection Request), some device method may need to be run. |
@@ -150,6 +151,7 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
150 | 151 | ||
151 | obj_desc = acpi_ns_get_attached_object(node); | 152 | obj_desc = acpi_ns_get_attached_object(node); |
152 | if (obj_desc) { | 153 | if (obj_desc) { |
154 | |||
153 | /* We have the notify object, Get the right handler */ | 155 | /* We have the notify object, Get the right handler */ |
154 | 156 | ||
155 | switch (node->type) { | 157 | switch (node->type) { |
@@ -184,14 +186,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
184 | return (AE_NO_MEMORY); | 186 | return (AE_NO_MEMORY); |
185 | } | 187 | } |
186 | 188 | ||
187 | notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY; | 189 | notify_info->common.descriptor_type = |
190 | ACPI_DESC_TYPE_STATE_NOTIFY; | ||
188 | notify_info->notify.node = node; | 191 | notify_info->notify.node = node; |
189 | notify_info->notify.value = (u16) notify_value; | 192 | notify_info->notify.value = (u16) notify_value; |
190 | notify_info->notify.handler_obj = handler_obj; | 193 | notify_info->notify.handler_obj = handler_obj; |
191 | 194 | ||
192 | status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, | 195 | status = |
193 | acpi_ev_notify_dispatch, | 196 | acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, |
194 | notify_info); | 197 | notify_info); |
195 | if (ACPI_FAILURE(status)) { | 198 | if (ACPI_FAILURE(status)) { |
196 | acpi_ut_delete_generic_state(notify_info); | 199 | acpi_ut_delete_generic_state(notify_info); |
197 | } | 200 | } |
@@ -240,6 +243,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context) | |||
240 | * to the device. | 243 | * to the device. |
241 | */ | 244 | */ |
242 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { | 245 | if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) { |
246 | |||
243 | /* Global system notification handler */ | 247 | /* Global system notification handler */ |
244 | 248 | ||
245 | if (acpi_gbl_system_notify.handler) { | 249 | if (acpi_gbl_system_notify.handler) { |
@@ -297,6 +301,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context) | |||
297 | /* Signal threads that are waiting for the lock */ | 301 | /* Signal threads that are waiting for the lock */ |
298 | 302 | ||
299 | if (acpi_gbl_global_lock_thread_count) { | 303 | if (acpi_gbl_global_lock_thread_count) { |
304 | |||
300 | /* Send sufficient units to the semaphore */ | 305 | /* Send sufficient units to the semaphore */ |
301 | 306 | ||
302 | status = | 307 | status = |
@@ -335,15 +340,16 @@ static u32 acpi_ev_global_lock_handler(void *context) | |||
335 | */ | 340 | */ |
336 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 341 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); |
337 | if (acquired) { | 342 | if (acquired) { |
343 | |||
338 | /* Got the lock, now wake all threads waiting for it */ | 344 | /* Got the lock, now wake all threads waiting for it */ |
339 | 345 | ||
340 | acpi_gbl_global_lock_acquired = TRUE; | 346 | acpi_gbl_global_lock_acquired = TRUE; |
341 | 347 | ||
342 | /* Run the Global Lock thread which will signal all waiting threads */ | 348 | /* Run the Global Lock thread which will signal all waiting threads */ |
343 | 349 | ||
344 | status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH, | 350 | status = |
345 | acpi_ev_global_lock_thread, | 351 | acpi_os_execute(OSL_GLOBAL_LOCK_HANDLER, |
346 | context); | 352 | acpi_ev_global_lock_thread, context); |
347 | if (ACPI_FAILURE(status)) { | 353 | if (ACPI_FAILURE(status)) { |
348 | ACPI_EXCEPTION((AE_INFO, status, | 354 | ACPI_EXCEPTION((AE_INFO, status, |
349 | "Could not queue Global Lock thread")); | 355 | "Could not queue Global Lock thread")); |
@@ -371,7 +377,7 @@ acpi_status acpi_ev_init_global_lock_handler(void) | |||
371 | { | 377 | { |
372 | acpi_status status; | 378 | acpi_status status; |
373 | 379 | ||
374 | ACPI_FUNCTION_TRACE("ev_init_global_lock_handler"); | 380 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); |
375 | 381 | ||
376 | acpi_gbl_global_lock_present = TRUE; | 382 | acpi_gbl_global_lock_present = TRUE; |
377 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, | 383 | status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL, |
@@ -413,7 +419,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
413 | acpi_status status = AE_OK; | 419 | acpi_status status = AE_OK; |
414 | u8 acquired = FALSE; | 420 | u8 acquired = FALSE; |
415 | 421 | ||
416 | ACPI_FUNCTION_TRACE("ev_acquire_global_lock"); | 422 | ACPI_FUNCTION_TRACE(ev_acquire_global_lock); |
417 | 423 | ||
418 | #ifndef ACPI_APPLICATION | 424 | #ifndef ACPI_APPLICATION |
419 | /* Make sure that we actually have a global lock */ | 425 | /* Make sure that we actually have a global lock */ |
@@ -439,6 +445,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
439 | 445 | ||
440 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); | 446 | ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired); |
441 | if (acquired) { | 447 | if (acquired) { |
448 | |||
442 | /* We got the lock */ | 449 | /* We got the lock */ |
443 | 450 | ||
444 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 451 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -458,8 +465,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
458 | * Acquire the global lock semaphore first. | 465 | * Acquire the global lock semaphore first. |
459 | * Since this wait will block, we must release the interpreter | 466 | * Since this wait will block, we must release the interpreter |
460 | */ | 467 | */ |
461 | status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, | 468 | status = |
462 | timeout); | 469 | acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore, |
470 | timeout); | ||
463 | return_ACPI_STATUS(status); | 471 | return_ACPI_STATUS(status); |
464 | } | 472 | } |
465 | 473 | ||
@@ -480,7 +488,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
480 | u8 pending = FALSE; | 488 | u8 pending = FALSE; |
481 | acpi_status status = AE_OK; | 489 | acpi_status status = AE_OK; |
482 | 490 | ||
483 | ACPI_FUNCTION_TRACE("ev_release_global_lock"); | 491 | ACPI_FUNCTION_TRACE(ev_release_global_lock); |
484 | 492 | ||
485 | if (!acpi_gbl_global_lock_thread_count) { | 493 | if (!acpi_gbl_global_lock_thread_count) { |
486 | ACPI_WARNING((AE_INFO, | 494 | ACPI_WARNING((AE_INFO, |
@@ -492,6 +500,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
492 | 500 | ||
493 | acpi_gbl_global_lock_thread_count--; | 501 | acpi_gbl_global_lock_thread_count--; |
494 | if (acpi_gbl_global_lock_thread_count) { | 502 | if (acpi_gbl_global_lock_thread_count) { |
503 | |||
495 | /* There are still some threads holding the lock, cannot release */ | 504 | /* There are still some threads holding the lock, cannot release */ |
496 | 505 | ||
497 | return_ACPI_STATUS(AE_OK); | 506 | return_ACPI_STATUS(AE_OK); |
@@ -533,7 +542,7 @@ void acpi_ev_terminate(void) | |||
533 | acpi_native_uint i; | 542 | acpi_native_uint i; |
534 | acpi_status status; | 543 | acpi_status status; |
535 | 544 | ||
536 | ACPI_FUNCTION_TRACE("ev_terminate"); | 545 | ACPI_FUNCTION_TRACE(ev_terminate); |
537 | 546 | ||
538 | if (acpi_gbl_events_initialized) { | 547 | if (acpi_gbl_events_initialized) { |
539 | /* | 548 | /* |
@@ -573,7 +582,7 @@ void acpi_ev_terminate(void) | |||
573 | if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { | 582 | if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { |
574 | status = acpi_disable(); | 583 | status = acpi_disable(); |
575 | if (ACPI_FAILURE(status)) { | 584 | if (ACPI_FAILURE(status)) { |
576 | ACPI_WARNING((AE_INFO, "acpi_disable failed")); | 585 | ACPI_WARNING((AE_INFO, "AcpiDisable failed")); |
577 | } | 586 | } |
578 | } | 587 | } |
579 | return_VOID; | 588 | return_VOID; |
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 6da58e776413..094a17e4c86d 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -83,7 +83,7 @@ acpi_status acpi_ev_install_region_handlers(void) | |||
83 | acpi_status status; | 83 | acpi_status status; |
84 | acpi_native_uint i; | 84 | acpi_native_uint i; |
85 | 85 | ||
86 | ACPI_FUNCTION_TRACE("ev_install_region_handlers"); | 86 | ACPI_FUNCTION_TRACE(ev_install_region_handlers); |
87 | 87 | ||
88 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 88 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
89 | if (ACPI_FAILURE(status)) { | 89 | if (ACPI_FAILURE(status)) { |
@@ -153,7 +153,7 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
153 | acpi_status status; | 153 | acpi_status status; |
154 | acpi_native_uint i; | 154 | acpi_native_uint i; |
155 | 155 | ||
156 | ACPI_FUNCTION_TRACE("ev_initialize_op_regions"); | 156 | ACPI_FUNCTION_TRACE(ev_initialize_op_regions); |
157 | 157 | ||
158 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 158 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
159 | if (ACPI_FAILURE(status)) { | 159 | if (ACPI_FAILURE(status)) { |
@@ -164,6 +164,7 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
164 | * Run the _REG methods for op_regions in each default address space | 164 | * Run the _REG methods for op_regions in each default address space |
165 | */ | 165 | */ |
166 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { | 166 | for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) { |
167 | |||
167 | /* TBD: Make sure handler is the DEFAULT handler, otherwise | 168 | /* TBD: Make sure handler is the DEFAULT handler, otherwise |
168 | * _REG will have already been run. | 169 | * _REG will have already been run. |
169 | */ | 170 | */ |
@@ -192,12 +193,12 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
192 | acpi_status | 193 | acpi_status |
193 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | 194 | acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) |
194 | { | 195 | { |
195 | struct acpi_parameter_info info; | 196 | struct acpi_evaluate_info *info; |
196 | union acpi_operand_object *params[3]; | 197 | union acpi_operand_object *args[3]; |
197 | union acpi_operand_object *region_obj2; | 198 | union acpi_operand_object *region_obj2; |
198 | acpi_status status; | 199 | acpi_status status; |
199 | 200 | ||
200 | ACPI_FUNCTION_TRACE("ev_execute_reg_method"); | 201 | ACPI_FUNCTION_TRACE(ev_execute_reg_method); |
201 | 202 | ||
202 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 203 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
203 | if (!region_obj2) { | 204 | if (!region_obj2) { |
@@ -208,48 +209,60 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
208 | return_ACPI_STATUS(AE_OK); | 209 | return_ACPI_STATUS(AE_OK); |
209 | } | 210 | } |
210 | 211 | ||
212 | /* Allocate and initialize the evaluation information block */ | ||
213 | |||
214 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
215 | if (!info) { | ||
216 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
217 | } | ||
218 | |||
219 | info->prefix_node = region_obj2->extra.method_REG; | ||
220 | info->pathname = NULL; | ||
221 | info->parameters = args; | ||
222 | info->parameter_type = ACPI_PARAM_ARGS; | ||
223 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
224 | |||
211 | /* | 225 | /* |
212 | * The _REG method has two arguments: | 226 | * The _REG method has two arguments: |
213 | * | 227 | * |
214 | * Arg0, Integer: Operation region space ID | 228 | * Arg0 - Integer: |
215 | * Same value as region_obj->Region.space_id | 229 | * Operation region space ID Same value as region_obj->Region.space_id |
216 | * Arg1, Integer: connection status | 230 | * |
217 | * 1 for connecting the handler, | 231 | * Arg1 - Integer: |
218 | * 0 for disconnecting the handler | 232 | * connection status 1 for connecting the handler, 0 for disconnecting |
219 | * Passed as a parameter | 233 | * the handler (Passed as a parameter) |
220 | */ | 234 | */ |
221 | params[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 235 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
222 | if (!params[0]) { | 236 | if (!args[0]) { |
223 | return_ACPI_STATUS(AE_NO_MEMORY); | 237 | status = AE_NO_MEMORY; |
238 | goto cleanup1; | ||
224 | } | 239 | } |
225 | 240 | ||
226 | params[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 241 | args[1] = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
227 | if (!params[1]) { | 242 | if (!args[1]) { |
228 | status = AE_NO_MEMORY; | 243 | status = AE_NO_MEMORY; |
229 | goto cleanup; | 244 | goto cleanup2; |
230 | } | 245 | } |
231 | 246 | ||
232 | /* Setup the parameter objects */ | 247 | /* Setup the parameter objects */ |
233 | 248 | ||
234 | params[0]->integer.value = region_obj->region.space_id; | 249 | args[0]->integer.value = region_obj->region.space_id; |
235 | params[1]->integer.value = function; | 250 | args[1]->integer.value = function; |
236 | params[2] = NULL; | 251 | args[2] = NULL; |
237 | |||
238 | info.node = region_obj2->extra.method_REG; | ||
239 | info.parameters = params; | ||
240 | info.parameter_type = ACPI_PARAM_ARGS; | ||
241 | 252 | ||
242 | /* Execute the method, no return value */ | 253 | /* Execute the method, no return value */ |
243 | 254 | ||
244 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | 255 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
245 | (ACPI_TYPE_METHOD, info.node, NULL)); | 256 | (ACPI_TYPE_METHOD, info->prefix_node, NULL)); |
246 | status = acpi_ns_evaluate_by_handle(&info); | ||
247 | 257 | ||
248 | acpi_ut_remove_reference(params[1]); | 258 | status = acpi_ns_evaluate(info); |
259 | acpi_ut_remove_reference(args[1]); | ||
249 | 260 | ||
250 | cleanup: | 261 | cleanup2: |
251 | acpi_ut_remove_reference(params[0]); | 262 | acpi_ut_remove_reference(args[0]); |
252 | 263 | ||
264 | cleanup1: | ||
265 | ACPI_FREE(info); | ||
253 | return_ACPI_STATUS(status); | 266 | return_ACPI_STATUS(status); |
254 | } | 267 | } |
255 | 268 | ||
@@ -261,7 +274,8 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) | |||
261 | * Function - Read or Write operation | 274 | * Function - Read or Write operation |
262 | * Address - Where in the space to read or write | 275 | * Address - Where in the space to read or write |
263 | * bit_width - Field width in bits (8, 16, 32, or 64) | 276 | * bit_width - Field width in bits (8, 16, 32, or 64) |
264 | * Value - Pointer to in or out value | 277 | * Value - Pointer to in or out value, must be |
278 | * full 64-bit acpi_integer | ||
265 | * | 279 | * |
266 | * RETURN: Status | 280 | * RETURN: Status |
267 | * | 281 | * |
@@ -274,7 +288,7 @@ acpi_status | |||
274 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 288 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
275 | u32 function, | 289 | u32 function, |
276 | acpi_physical_address address, | 290 | acpi_physical_address address, |
277 | u32 bit_width, void *value) | 291 | u32 bit_width, acpi_integer * value) |
278 | { | 292 | { |
279 | acpi_status status; | 293 | acpi_status status; |
280 | acpi_status status2; | 294 | acpi_status status2; |
@@ -284,7 +298,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
284 | union acpi_operand_object *region_obj2; | 298 | union acpi_operand_object *region_obj2; |
285 | void *region_context = NULL; | 299 | void *region_context = NULL; |
286 | 300 | ||
287 | ACPI_FUNCTION_TRACE("ev_address_space_dispatch"); | 301 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); |
288 | 302 | ||
289 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 303 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
290 | if (!region_obj2) { | 304 | if (!region_obj2) { |
@@ -315,6 +329,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
315 | */ | 329 | */ |
316 | region_setup = handler_desc->address_space.setup; | 330 | region_setup = handler_desc->address_space.setup; |
317 | if (!region_setup) { | 331 | if (!region_setup) { |
332 | |||
318 | /* No initialization routine, exit with error */ | 333 | /* No initialization routine, exit with error */ |
319 | 334 | ||
320 | ACPI_ERROR((AE_INFO, | 335 | ACPI_ERROR((AE_INFO, |
@@ -361,9 +376,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
361 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; | 376 | region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; |
362 | 377 | ||
363 | if (region_obj2->extra.region_context) { | 378 | if (region_obj2->extra.region_context) { |
379 | |||
364 | /* The handler for this region was already installed */ | 380 | /* The handler for this region was already installed */ |
365 | 381 | ||
366 | ACPI_MEM_FREE(region_context); | 382 | ACPI_FREE(region_context); |
367 | } else { | 383 | } else { |
368 | /* | 384 | /* |
369 | * Save the returned context for use in all accesses to | 385 | * Save the returned context for use in all accesses to |
@@ -386,9 +402,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
386 | acpi_ut_get_region_name(region_obj->region. | 402 | acpi_ut_get_region_name(region_obj->region. |
387 | space_id))); | 403 | space_id))); |
388 | 404 | ||
389 | if (! | 405 | if (!(handler_desc->address_space.handler_flags & |
390 | (handler_desc->address_space. | 406 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
391 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
392 | /* | 407 | /* |
393 | * For handlers other than the default (supplied) handlers, we must | 408 | * For handlers other than the default (supplied) handlers, we must |
394 | * exit the interpreter because the handler *might* block -- we don't | 409 | * exit the interpreter because the handler *might* block -- we don't |
@@ -409,9 +424,8 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
409 | space_id))); | 424 | space_id))); |
410 | } | 425 | } |
411 | 426 | ||
412 | if (! | 427 | if (!(handler_desc->address_space.handler_flags & |
413 | (handler_desc->address_space. | 428 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
414 | hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | ||
415 | /* | 429 | /* |
416 | * We just returned from a non-default handler, we must re-enter the | 430 | * We just returned from a non-default handler, we must re-enter the |
417 | * interpreter | 431 | * interpreter |
@@ -451,7 +465,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
451 | union acpi_operand_object *region_obj2; | 465 | union acpi_operand_object *region_obj2; |
452 | acpi_status status; | 466 | acpi_status status; |
453 | 467 | ||
454 | ACPI_FUNCTION_TRACE("ev_detach_region"); | 468 | ACPI_FUNCTION_TRACE(ev_detach_region); |
455 | 469 | ||
456 | region_obj2 = acpi_ns_get_secondary_object(region_obj); | 470 | region_obj2 = acpi_ns_get_secondary_object(region_obj); |
457 | if (!region_obj2) { | 471 | if (!region_obj2) { |
@@ -463,6 +477,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
463 | 477 | ||
464 | handler_obj = region_obj->region.handler; | 478 | handler_obj = region_obj->region.handler; |
465 | if (!handler_obj) { | 479 | if (!handler_obj) { |
480 | |||
466 | /* This region has no handler, all done */ | 481 | /* This region has no handler, all done */ |
467 | 482 | ||
468 | return_VOID; | 483 | return_VOID; |
@@ -474,6 +489,7 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, | |||
474 | last_obj_ptr = &handler_obj->address_space.region_list; | 489 | last_obj_ptr = &handler_obj->address_space.region_list; |
475 | 490 | ||
476 | while (obj_desc) { | 491 | while (obj_desc) { |
492 | |||
477 | /* Is this the correct Region? */ | 493 | /* Is this the correct Region? */ |
478 | 494 | ||
479 | if (obj_desc == region_obj) { | 495 | if (obj_desc == region_obj) { |
@@ -583,7 +599,7 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, | |||
583 | u8 acpi_ns_is_locked) | 599 | u8 acpi_ns_is_locked) |
584 | { | 600 | { |
585 | 601 | ||
586 | ACPI_FUNCTION_TRACE("ev_attach_region"); | 602 | ACPI_FUNCTION_TRACE(ev_attach_region); |
587 | 603 | ||
588 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 604 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
589 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", | 605 | "Adding Region [%4.4s] %p to address handler %p [%s]\n", |
@@ -636,7 +652,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
636 | struct acpi_namespace_node *node; | 652 | struct acpi_namespace_node *node; |
637 | acpi_status status; | 653 | acpi_status status; |
638 | 654 | ||
639 | ACPI_FUNCTION_NAME("ev_install_handler"); | 655 | ACPI_FUNCTION_NAME(ev_install_handler); |
640 | 656 | ||
641 | handler_obj = (union acpi_operand_object *)context; | 657 | handler_obj = (union acpi_operand_object *)context; |
642 | 658 | ||
@@ -666,6 +682,7 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
666 | 682 | ||
667 | obj_desc = acpi_ns_get_attached_object(node); | 683 | obj_desc = acpi_ns_get_attached_object(node); |
668 | if (!obj_desc) { | 684 | if (!obj_desc) { |
685 | |||
669 | /* No object, just exit */ | 686 | /* No object, just exit */ |
670 | 687 | ||
671 | return (AE_OK); | 688 | return (AE_OK); |
@@ -674,10 +691,12 @@ acpi_ev_install_handler(acpi_handle obj_handle, | |||
674 | /* Devices are handled different than regions */ | 691 | /* Devices are handled different than regions */ |
675 | 692 | ||
676 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { | 693 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) { |
694 | |||
677 | /* Check if this Device already has a handler for this address space */ | 695 | /* Check if this Device already has a handler for this address space */ |
678 | 696 | ||
679 | next_handler_obj = obj_desc->device.handler; | 697 | next_handler_obj = obj_desc->device.handler; |
680 | while (next_handler_obj) { | 698 | while (next_handler_obj) { |
699 | |||
681 | /* Found a handler, is it for the same address space? */ | 700 | /* Found a handler, is it for the same address space? */ |
682 | 701 | ||
683 | if (next_handler_obj->address_space.space_id == | 702 | if (next_handler_obj->address_space.space_id == |
@@ -764,9 +783,9 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
764 | union acpi_operand_object *handler_obj; | 783 | union acpi_operand_object *handler_obj; |
765 | acpi_status status; | 784 | acpi_status status; |
766 | acpi_object_type type; | 785 | acpi_object_type type; |
767 | u16 flags = 0; | 786 | u8 flags = 0; |
768 | 787 | ||
769 | ACPI_FUNCTION_TRACE("ev_install_space_handler"); | 788 | ACPI_FUNCTION_TRACE(ev_install_space_handler); |
770 | 789 | ||
771 | /* | 790 | /* |
772 | * This registration is valid for only the types below | 791 | * This registration is valid for only the types below |
@@ -839,6 +858,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
839 | /* Walk the handler list for this device */ | 858 | /* Walk the handler list for this device */ |
840 | 859 | ||
841 | while (handler_obj) { | 860 | while (handler_obj) { |
861 | |||
842 | /* Same space_id indicates a handler already installed */ | 862 | /* Same space_id indicates a handler already installed */ |
843 | 863 | ||
844 | if (handler_obj->address_space.space_id == space_id) { | 864 | if (handler_obj->address_space.space_id == space_id) { |
@@ -921,7 +941,7 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, | |||
921 | /* Init handler obj */ | 941 | /* Init handler obj */ |
922 | 942 | ||
923 | handler_obj->address_space.space_id = (u8) space_id; | 943 | handler_obj->address_space.space_id = (u8) space_id; |
924 | handler_obj->address_space.hflags = flags; | 944 | handler_obj->address_space.handler_flags = flags; |
925 | handler_obj->address_space.region_list = NULL; | 945 | handler_obj->address_space.region_list = NULL; |
926 | handler_obj->address_space.node = node; | 946 | handler_obj->address_space.node = node; |
927 | handler_obj->address_space.handler = handler; | 947 | handler_obj->address_space.handler = handler; |
@@ -979,7 +999,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
979 | { | 999 | { |
980 | acpi_status status; | 1000 | acpi_status status; |
981 | 1001 | ||
982 | ACPI_FUNCTION_TRACE("ev_execute_reg_methods"); | 1002 | ACPI_FUNCTION_TRACE(ev_execute_reg_methods); |
983 | 1003 | ||
984 | /* | 1004 | /* |
985 | * Run all _REG methods for all Operation Regions for this | 1005 | * Run all _REG methods for all Operation Regions for this |
@@ -1001,7 +1021,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, | |||
1001 | * | 1021 | * |
1002 | * PARAMETERS: walk_namespace callback | 1022 | * PARAMETERS: walk_namespace callback |
1003 | * | 1023 | * |
1004 | * DESCRIPTION: Run _REg method for region objects of the requested space_iD | 1024 | * DESCRIPTION: Run _REG method for region objects of the requested space_iD |
1005 | * | 1025 | * |
1006 | ******************************************************************************/ | 1026 | ******************************************************************************/ |
1007 | 1027 | ||
@@ -1035,6 +1055,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, | |||
1035 | 1055 | ||
1036 | obj_desc = acpi_ns_get_attached_object(node); | 1056 | obj_desc = acpi_ns_get_attached_object(node); |
1037 | if (!obj_desc) { | 1057 | if (!obj_desc) { |
1058 | |||
1038 | /* No object, just exit */ | 1059 | /* No object, just exit */ |
1039 | 1060 | ||
1040 | return (AE_OK); | 1061 | return (AE_OK); |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index baed8c1a1b9f..5b3c7a85eb9a 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -71,11 +71,22 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
71 | (union acpi_operand_object *)handle; | 71 | (union acpi_operand_object *)handle; |
72 | struct acpi_mem_space_context *local_region_context; | 72 | struct acpi_mem_space_context *local_region_context; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE("ev_system_memory_region_setup"); | 74 | ACPI_FUNCTION_TRACE(ev_system_memory_region_setup); |
75 | 75 | ||
76 | if (function == ACPI_REGION_DEACTIVATE) { | 76 | if (function == ACPI_REGION_DEACTIVATE) { |
77 | if (*region_context) { | 77 | if (*region_context) { |
78 | ACPI_MEM_FREE(*region_context); | 78 | local_region_context = |
79 | (struct acpi_mem_space_context *)*region_context; | ||
80 | |||
81 | /* Delete a cached mapping if present */ | ||
82 | |||
83 | if (local_region_context->mapped_length) { | ||
84 | acpi_os_unmap_memory(local_region_context-> | ||
85 | mapped_logical_address, | ||
86 | local_region_context-> | ||
87 | mapped_length); | ||
88 | } | ||
89 | ACPI_FREE(local_region_context); | ||
79 | *region_context = NULL; | 90 | *region_context = NULL; |
80 | } | 91 | } |
81 | return_ACPI_STATUS(AE_OK); | 92 | return_ACPI_STATUS(AE_OK); |
@@ -84,7 +95,7 @@ acpi_ev_system_memory_region_setup(acpi_handle handle, | |||
84 | /* Create a new context */ | 95 | /* Create a new context */ |
85 | 96 | ||
86 | local_region_context = | 97 | local_region_context = |
87 | ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context)); | 98 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_mem_space_context)); |
88 | if (!(local_region_context)) { | 99 | if (!(local_region_context)) { |
89 | return_ACPI_STATUS(AE_NO_MEMORY); | 100 | return_ACPI_STATUS(AE_NO_MEMORY); |
90 | } | 101 | } |
@@ -118,7 +129,7 @@ acpi_ev_io_space_region_setup(acpi_handle handle, | |||
118 | u32 function, | 129 | u32 function, |
119 | void *handler_context, void **region_context) | 130 | void *handler_context, void **region_context) |
120 | { | 131 | { |
121 | ACPI_FUNCTION_TRACE("ev_io_space_region_setup"); | 132 | ACPI_FUNCTION_TRACE(ev_io_space_region_setup); |
122 | 133 | ||
123 | if (function == ACPI_REGION_DEACTIVATE) { | 134 | if (function == ACPI_REGION_DEACTIVATE) { |
124 | *region_context = NULL; | 135 | *region_context = NULL; |
@@ -161,7 +172,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
161 | (union acpi_operand_object *)handle; | 172 | (union acpi_operand_object *)handle; |
162 | struct acpi_device_id object_hID; | 173 | struct acpi_device_id object_hID; |
163 | 174 | ||
164 | ACPI_FUNCTION_TRACE("ev_pci_config_region_setup"); | 175 | ACPI_FUNCTION_TRACE(ev_pci_config_region_setup); |
165 | 176 | ||
166 | handler_obj = region_obj->region.handler; | 177 | handler_obj = region_obj->region.handler; |
167 | if (!handler_obj) { | 178 | if (!handler_obj) { |
@@ -178,7 +189,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
178 | *region_context = NULL; | 189 | *region_context = NULL; |
179 | if (function == ACPI_REGION_DEACTIVATE) { | 190 | if (function == ACPI_REGION_DEACTIVATE) { |
180 | if (pci_id) { | 191 | if (pci_id) { |
181 | ACPI_MEM_FREE(pci_id); | 192 | ACPI_FREE(pci_id); |
182 | } | 193 | } |
183 | return_ACPI_STATUS(status); | 194 | return_ACPI_STATUS(status); |
184 | } | 195 | } |
@@ -199,6 +210,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
199 | * handlers with that device. | 210 | * handlers with that device. |
200 | */ | 211 | */ |
201 | if (handler_obj->address_space.node == acpi_gbl_root_node) { | 212 | if (handler_obj->address_space.node == acpi_gbl_root_node) { |
213 | |||
202 | /* Start search from the parent object */ | 214 | /* Start search from the parent object */ |
203 | 215 | ||
204 | pci_root_node = parent_node; | 216 | pci_root_node = parent_node; |
@@ -220,6 +232,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
220 | PCI_EXPRESS_ROOT_HID_STRING, | 232 | PCI_EXPRESS_ROOT_HID_STRING, |
221 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) | 233 | sizeof(PCI_EXPRESS_ROOT_HID_STRING))))) |
222 | { | 234 | { |
235 | |||
223 | /* Install a handler for this PCI root bridge */ | 236 | /* Install a handler for this PCI root bridge */ |
224 | 237 | ||
225 | status = | 238 | status = |
@@ -235,7 +248,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
235 | } else { | 248 | } else { |
236 | ACPI_EXCEPTION((AE_INFO, | 249 | ACPI_EXCEPTION((AE_INFO, |
237 | status, | 250 | status, |
238 | "Could not install pci_config handler for Root Bridge %4.4s", | 251 | "Could not install PciConfig handler for Root Bridge %4.4s", |
239 | acpi_ut_get_node_name | 252 | acpi_ut_get_node_name |
240 | (pci_root_node))); | 253 | (pci_root_node))); |
241 | } | 254 | } |
@@ -262,7 +275,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle, | |||
262 | 275 | ||
263 | /* Region is still not initialized. Create a new context */ | 276 | /* Region is still not initialized. Create a new context */ |
264 | 277 | ||
265 | pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id)); | 278 | pci_id = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pci_id)); |
266 | if (!pci_id) { | 279 | if (!pci_id) { |
267 | return_ACPI_STATUS(AE_NO_MEMORY); | 280 | return_ACPI_STATUS(AE_NO_MEMORY); |
268 | } | 281 | } |
@@ -337,7 +350,7 @@ acpi_ev_pci_bar_region_setup(acpi_handle handle, | |||
337 | u32 function, | 350 | u32 function, |
338 | void *handler_context, void **region_context) | 351 | void *handler_context, void **region_context) |
339 | { | 352 | { |
340 | ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup"); | 353 | ACPI_FUNCTION_TRACE(ev_pci_bar_region_setup); |
341 | 354 | ||
342 | return_ACPI_STATUS(AE_OK); | 355 | return_ACPI_STATUS(AE_OK); |
343 | } | 356 | } |
@@ -364,7 +377,7 @@ acpi_ev_cmos_region_setup(acpi_handle handle, | |||
364 | u32 function, | 377 | u32 function, |
365 | void *handler_context, void **region_context) | 378 | void *handler_context, void **region_context) |
366 | { | 379 | { |
367 | ACPI_FUNCTION_TRACE("ev_cmos_region_setup"); | 380 | ACPI_FUNCTION_TRACE(ev_cmos_region_setup); |
368 | 381 | ||
369 | return_ACPI_STATUS(AE_OK); | 382 | return_ACPI_STATUS(AE_OK); |
370 | } | 383 | } |
@@ -389,7 +402,7 @@ acpi_ev_default_region_setup(acpi_handle handle, | |||
389 | u32 function, | 402 | u32 function, |
390 | void *handler_context, void **region_context) | 403 | void *handler_context, void **region_context) |
391 | { | 404 | { |
392 | ACPI_FUNCTION_TRACE("ev_default_region_setup"); | 405 | ACPI_FUNCTION_TRACE(ev_default_region_setup); |
393 | 406 | ||
394 | if (function == ACPI_REGION_DEACTIVATE) { | 407 | if (function == ACPI_REGION_DEACTIVATE) { |
395 | *region_context = NULL; | 408 | *region_context = NULL; |
@@ -435,7 +448,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
435 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; | 448 | acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; |
436 | union acpi_operand_object *region_obj2; | 449 | union acpi_operand_object *region_obj2; |
437 | 450 | ||
438 | ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked); | 451 | ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); |
439 | 452 | ||
440 | if (!region_obj) { | 453 | if (!region_obj) { |
441 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 454 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -462,8 +475,9 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
462 | 475 | ||
463 | /* Find any "_REG" method associated with this region definition */ | 476 | /* Find any "_REG" method associated with this region definition */ |
464 | 477 | ||
465 | status = acpi_ns_search_node(*reg_name_ptr, node, | 478 | status = |
466 | ACPI_TYPE_METHOD, &method_node); | 479 | acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, |
480 | &method_node); | ||
467 | if (ACPI_SUCCESS(status)) { | 481 | if (ACPI_SUCCESS(status)) { |
468 | /* | 482 | /* |
469 | * The _REG method is optional and there can be only one per region | 483 | * The _REG method is optional and there can be only one per region |
@@ -478,11 +492,13 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
478 | * ie: acpi_gbl_root_node->parent_entry being set to NULL | 492 | * ie: acpi_gbl_root_node->parent_entry being set to NULL |
479 | */ | 493 | */ |
480 | while (node) { | 494 | while (node) { |
495 | |||
481 | /* Check to see if a handler exists */ | 496 | /* Check to see if a handler exists */ |
482 | 497 | ||
483 | handler_obj = NULL; | 498 | handler_obj = NULL; |
484 | obj_desc = acpi_ns_get_attached_object(node); | 499 | obj_desc = acpi_ns_get_attached_object(node); |
485 | if (obj_desc) { | 500 | if (obj_desc) { |
501 | |||
486 | /* Can only be a handler if the object exists */ | 502 | /* Can only be a handler if the object exists */ |
487 | 503 | ||
488 | switch (node->type) { | 504 | switch (node->type) { |
@@ -507,10 +523,12 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
507 | } | 523 | } |
508 | 524 | ||
509 | while (handler_obj) { | 525 | while (handler_obj) { |
526 | |||
510 | /* Is this handler of the correct type? */ | 527 | /* Is this handler of the correct type? */ |
511 | 528 | ||
512 | if (handler_obj->address_space.space_id == | 529 | if (handler_obj->address_space.space_id == |
513 | space_id) { | 530 | space_id) { |
531 | |||
514 | /* Found correct handler */ | 532 | /* Found correct handler */ |
515 | 533 | ||
516 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 534 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -571,7 +589,7 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, | |||
571 | /* If we get here, there is no handler for this region */ | 589 | /* If we get here, there is no handler for this region */ |
572 | 590 | ||
573 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 591 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
574 | "No handler for region_type %s(%X) (region_obj %p)\n", | 592 | "No handler for RegionType %s(%X) (RegionObj %p)\n", |
575 | acpi_ut_get_region_name(space_id), space_id, | 593 | acpi_ut_get_region_name(space_id), space_id, |
576 | region_obj)); | 594 | region_obj)); |
577 | 595 | ||
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 9a622169008a..8106215ad554 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -69,7 +69,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) | |||
69 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; | 69 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; |
70 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; | 70 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler"); | 72 | ACPI_FUNCTION_TRACE(ev_sci_xrupt_handler); |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * We are guaranteed by the ACPI CA initialization/shutdown code that | 75 | * We are guaranteed by the ACPI CA initialization/shutdown code that |
@@ -108,7 +108,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) | |||
108 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; | 108 | struct acpi_gpe_xrupt_info *gpe_xrupt_list = context; |
109 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; | 109 | u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED; |
110 | 110 | ||
111 | ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler"); | 111 | ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler); |
112 | 112 | ||
113 | /* | 113 | /* |
114 | * We are guaranteed by the ACPI CA initialization/shutdown code that | 114 | * We are guaranteed by the ACPI CA initialization/shutdown code that |
@@ -140,7 +140,7 @@ u32 acpi_ev_install_sci_handler(void) | |||
140 | { | 140 | { |
141 | u32 status = AE_OK; | 141 | u32 status = AE_OK; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE("ev_install_sci_handler"); | 143 | ACPI_FUNCTION_TRACE(ev_install_sci_handler); |
144 | 144 | ||
145 | status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, | 145 | status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int, |
146 | acpi_ev_sci_xrupt_handler, | 146 | acpi_ev_sci_xrupt_handler, |
@@ -171,7 +171,7 @@ acpi_status acpi_ev_remove_sci_handler(void) | |||
171 | { | 171 | { |
172 | acpi_status status; | 172 | acpi_status status; |
173 | 173 | ||
174 | ACPI_FUNCTION_TRACE("ev_remove_sci_handler"); | 174 | ACPI_FUNCTION_TRACE(ev_remove_sci_handler); |
175 | 175 | ||
176 | /* Just let the OS remove the handler and disable the level */ | 176 | /* Just let the OS remove the handler and disable the level */ |
177 | 177 | ||
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index b38b39dde543..76c34a66e0e0 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acnamesp.h> | 45 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acevents.h> | 46 | #include <acpi/acevents.h> |
@@ -68,7 +66,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
68 | { | 66 | { |
69 | acpi_status status; | 67 | acpi_status status; |
70 | 68 | ||
71 | ACPI_FUNCTION_TRACE("acpi_install_exception_handler"); | 69 | ACPI_FUNCTION_TRACE(acpi_install_exception_handler); |
72 | 70 | ||
73 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | 71 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); |
74 | if (ACPI_FAILURE(status)) { | 72 | if (ACPI_FAILURE(status)) { |
@@ -90,6 +88,8 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
90 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 88 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
91 | return_ACPI_STATUS(status); | 89 | return_ACPI_STATUS(status); |
92 | } | 90 | } |
91 | |||
92 | ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) | ||
93 | #endif /* ACPI_FUTURE_USAGE */ | 93 | #endif /* ACPI_FUTURE_USAGE */ |
94 | 94 | ||
95 | /******************************************************************************* | 95 | /******************************************************************************* |
@@ -107,14 +107,13 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) | |||
107 | * event. | 107 | * event. |
108 | * | 108 | * |
109 | ******************************************************************************/ | 109 | ******************************************************************************/ |
110 | |||
111 | acpi_status | 110 | acpi_status |
112 | acpi_install_fixed_event_handler(u32 event, | 111 | acpi_install_fixed_event_handler(u32 event, |
113 | acpi_event_handler handler, void *context) | 112 | acpi_event_handler handler, void *context) |
114 | { | 113 | { |
115 | acpi_status status; | 114 | acpi_status status; |
116 | 115 | ||
117 | ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler"); | 116 | ACPI_FUNCTION_TRACE(acpi_install_fixed_event_handler); |
118 | 117 | ||
119 | /* Parameter validation */ | 118 | /* Parameter validation */ |
120 | 119 | ||
@@ -161,7 +160,7 @@ acpi_install_fixed_event_handler(u32 event, | |||
161 | return_ACPI_STATUS(status); | 160 | return_ACPI_STATUS(status); |
162 | } | 161 | } |
163 | 162 | ||
164 | EXPORT_SYMBOL(acpi_install_fixed_event_handler); | 163 | ACPI_EXPORT_SYMBOL(acpi_install_fixed_event_handler) |
165 | 164 | ||
166 | /******************************************************************************* | 165 | /******************************************************************************* |
167 | * | 166 | * |
@@ -175,13 +174,12 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler); | |||
175 | * DESCRIPTION: Disables the event and unregisters the event handler. | 174 | * DESCRIPTION: Disables the event and unregisters the event handler. |
176 | * | 175 | * |
177 | ******************************************************************************/ | 176 | ******************************************************************************/ |
178 | |||
179 | acpi_status | 177 | acpi_status |
180 | acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) | 178 | acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) |
181 | { | 179 | { |
182 | acpi_status status = AE_OK; | 180 | acpi_status status = AE_OK; |
183 | 181 | ||
184 | ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler"); | 182 | ACPI_FUNCTION_TRACE(acpi_remove_fixed_event_handler); |
185 | 183 | ||
186 | /* Parameter validation */ | 184 | /* Parameter validation */ |
187 | 185 | ||
@@ -216,7 +214,7 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler) | |||
216 | return_ACPI_STATUS(status); | 214 | return_ACPI_STATUS(status); |
217 | } | 215 | } |
218 | 216 | ||
219 | EXPORT_SYMBOL(acpi_remove_fixed_event_handler); | 217 | ACPI_EXPORT_SYMBOL(acpi_remove_fixed_event_handler) |
220 | 218 | ||
221 | /******************************************************************************* | 219 | /******************************************************************************* |
222 | * | 220 | * |
@@ -235,7 +233,6 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler); | |||
235 | * DESCRIPTION: Install a handler for notifies on an ACPI device | 233 | * DESCRIPTION: Install a handler for notifies on an ACPI device |
236 | * | 234 | * |
237 | ******************************************************************************/ | 235 | ******************************************************************************/ |
238 | |||
239 | acpi_status | 236 | acpi_status |
240 | acpi_install_notify_handler(acpi_handle device, | 237 | acpi_install_notify_handler(acpi_handle device, |
241 | u32 handler_type, | 238 | u32 handler_type, |
@@ -246,7 +243,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
246 | struct acpi_namespace_node *node; | 243 | struct acpi_namespace_node *node; |
247 | acpi_status status; | 244 | acpi_status status; |
248 | 245 | ||
249 | ACPI_FUNCTION_TRACE("acpi_install_notify_handler"); | 246 | ACPI_FUNCTION_TRACE(acpi_install_notify_handler); |
250 | 247 | ||
251 | /* Parameter validation */ | 248 | /* Parameter validation */ |
252 | 249 | ||
@@ -275,6 +272,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
275 | * only one <external> global handler can be regsitered (per notify type). | 272 | * only one <external> global handler can be regsitered (per notify type). |
276 | */ | 273 | */ |
277 | if (device == ACPI_ROOT_OBJECT) { | 274 | if (device == ACPI_ROOT_OBJECT) { |
275 | |||
278 | /* Make sure the handler is not already installed */ | 276 | /* Make sure the handler is not already installed */ |
279 | 277 | ||
280 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 278 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
@@ -317,6 +315,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
317 | 315 | ||
318 | obj_desc = acpi_ns_get_attached_object(node); | 316 | obj_desc = acpi_ns_get_attached_object(node); |
319 | if (obj_desc) { | 317 | if (obj_desc) { |
318 | |||
320 | /* Object exists - make sure there's no handler */ | 319 | /* Object exists - make sure there's no handler */ |
321 | 320 | ||
322 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && | 321 | if (((handler_type & ACPI_SYSTEM_NOTIFY) && |
@@ -370,6 +369,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
370 | } | 369 | } |
371 | 370 | ||
372 | if (handler_type == ACPI_ALL_NOTIFY) { | 371 | if (handler_type == ACPI_ALL_NOTIFY) { |
372 | |||
373 | /* Extra ref if installed in both */ | 373 | /* Extra ref if installed in both */ |
374 | 374 | ||
375 | acpi_ut_add_reference(notify_obj); | 375 | acpi_ut_add_reference(notify_obj); |
@@ -381,7 +381,7 @@ acpi_install_notify_handler(acpi_handle device, | |||
381 | return_ACPI_STATUS(status); | 381 | return_ACPI_STATUS(status); |
382 | } | 382 | } |
383 | 383 | ||
384 | EXPORT_SYMBOL(acpi_install_notify_handler); | 384 | ACPI_EXPORT_SYMBOL(acpi_install_notify_handler) |
385 | 385 | ||
386 | /******************************************************************************* | 386 | /******************************************************************************* |
387 | * | 387 | * |
@@ -399,7 +399,6 @@ EXPORT_SYMBOL(acpi_install_notify_handler); | |||
399 | * DESCRIPTION: Remove a handler for notifies on an ACPI device | 399 | * DESCRIPTION: Remove a handler for notifies on an ACPI device |
400 | * | 400 | * |
401 | ******************************************************************************/ | 401 | ******************************************************************************/ |
402 | |||
403 | acpi_status | 402 | acpi_status |
404 | acpi_remove_notify_handler(acpi_handle device, | 403 | acpi_remove_notify_handler(acpi_handle device, |
405 | u32 handler_type, acpi_notify_handler handler) | 404 | u32 handler_type, acpi_notify_handler handler) |
@@ -409,7 +408,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
409 | struct acpi_namespace_node *node; | 408 | struct acpi_namespace_node *node; |
410 | acpi_status status; | 409 | acpi_status status; |
411 | 410 | ||
412 | ACPI_FUNCTION_TRACE("acpi_remove_notify_handler"); | 411 | ACPI_FUNCTION_TRACE(acpi_remove_notify_handler); |
413 | 412 | ||
414 | /* Parameter validation */ | 413 | /* Parameter validation */ |
415 | 414 | ||
@@ -535,7 +534,7 @@ acpi_remove_notify_handler(acpi_handle device, | |||
535 | return_ACPI_STATUS(status); | 534 | return_ACPI_STATUS(status); |
536 | } | 535 | } |
537 | 536 | ||
538 | EXPORT_SYMBOL(acpi_remove_notify_handler); | 537 | ACPI_EXPORT_SYMBOL(acpi_remove_notify_handler) |
539 | 538 | ||
540 | /******************************************************************************* | 539 | /******************************************************************************* |
541 | * | 540 | * |
@@ -554,7 +553,6 @@ EXPORT_SYMBOL(acpi_remove_notify_handler); | |||
554 | * DESCRIPTION: Install a handler for a General Purpose Event. | 553 | * DESCRIPTION: Install a handler for a General Purpose Event. |
555 | * | 554 | * |
556 | ******************************************************************************/ | 555 | ******************************************************************************/ |
557 | |||
558 | acpi_status | 556 | acpi_status |
559 | acpi_install_gpe_handler(acpi_handle gpe_device, | 557 | acpi_install_gpe_handler(acpi_handle gpe_device, |
560 | u32 gpe_number, | 558 | u32 gpe_number, |
@@ -565,7 +563,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
565 | acpi_status status; | 563 | acpi_status status; |
566 | acpi_cpu_flags flags; | 564 | acpi_cpu_flags flags; |
567 | 565 | ||
568 | ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); | 566 | ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); |
569 | 567 | ||
570 | /* Parameter validation */ | 568 | /* Parameter validation */ |
571 | 569 | ||
@@ -596,7 +594,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
596 | 594 | ||
597 | /* Allocate and init handler object */ | 595 | /* Allocate and init handler object */ |
598 | 596 | ||
599 | handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info)); | 597 | handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info)); |
600 | if (!handler) { | 598 | if (!handler) { |
601 | status = AE_NO_MEMORY; | 599 | status = AE_NO_MEMORY; |
602 | goto unlock_and_exit; | 600 | goto unlock_and_exit; |
@@ -630,7 +628,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device, | |||
630 | return_ACPI_STATUS(status); | 628 | return_ACPI_STATUS(status); |
631 | } | 629 | } |
632 | 630 | ||
633 | EXPORT_SYMBOL(acpi_install_gpe_handler); | 631 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler) |
634 | 632 | ||
635 | /******************************************************************************* | 633 | /******************************************************************************* |
636 | * | 634 | * |
@@ -646,7 +644,6 @@ EXPORT_SYMBOL(acpi_install_gpe_handler); | |||
646 | * DESCRIPTION: Remove a handler for a General Purpose acpi_event. | 644 | * DESCRIPTION: Remove a handler for a General Purpose acpi_event. |
647 | * | 645 | * |
648 | ******************************************************************************/ | 646 | ******************************************************************************/ |
649 | |||
650 | acpi_status | 647 | acpi_status |
651 | acpi_remove_gpe_handler(acpi_handle gpe_device, | 648 | acpi_remove_gpe_handler(acpi_handle gpe_device, |
652 | u32 gpe_number, acpi_event_handler address) | 649 | u32 gpe_number, acpi_event_handler address) |
@@ -656,7 +653,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
656 | acpi_status status; | 653 | acpi_status status; |
657 | acpi_cpu_flags flags; | 654 | acpi_cpu_flags flags; |
658 | 655 | ||
659 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); | 656 | ACPI_FUNCTION_TRACE(acpi_remove_gpe_handler); |
660 | 657 | ||
661 | /* Parameter validation */ | 658 | /* Parameter validation */ |
662 | 659 | ||
@@ -724,14 +721,14 @@ acpi_remove_gpe_handler(acpi_handle gpe_device, | |||
724 | 721 | ||
725 | /* Now we can free the handler object */ | 722 | /* Now we can free the handler object */ |
726 | 723 | ||
727 | ACPI_MEM_FREE(handler); | 724 | ACPI_FREE(handler); |
728 | 725 | ||
729 | unlock_and_exit: | 726 | unlock_and_exit: |
730 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | 727 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); |
731 | return_ACPI_STATUS(status); | 728 | return_ACPI_STATUS(status); |
732 | } | 729 | } |
733 | 730 | ||
734 | EXPORT_SYMBOL(acpi_remove_gpe_handler); | 731 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) |
735 | 732 | ||
736 | /******************************************************************************* | 733 | /******************************************************************************* |
737 | * | 734 | * |
@@ -746,7 +743,6 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler); | |||
746 | * DESCRIPTION: Acquire the ACPI Global Lock | 743 | * DESCRIPTION: Acquire the ACPI Global Lock |
747 | * | 744 | * |
748 | ******************************************************************************/ | 745 | ******************************************************************************/ |
749 | |||
750 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | 746 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) |
751 | { | 747 | { |
752 | acpi_status status; | 748 | acpi_status status; |
@@ -771,7 +767,7 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
771 | return (status); | 767 | return (status); |
772 | } | 768 | } |
773 | 769 | ||
774 | EXPORT_SYMBOL(acpi_acquire_global_lock); | 770 | ACPI_EXPORT_SYMBOL(acpi_acquire_global_lock) |
775 | 771 | ||
776 | /******************************************************************************* | 772 | /******************************************************************************* |
777 | * | 773 | * |
@@ -784,7 +780,6 @@ EXPORT_SYMBOL(acpi_acquire_global_lock); | |||
784 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. | 780 | * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid. |
785 | * | 781 | * |
786 | ******************************************************************************/ | 782 | ******************************************************************************/ |
787 | |||
788 | acpi_status acpi_release_global_lock(u32 handle) | 783 | acpi_status acpi_release_global_lock(u32 handle) |
789 | { | 784 | { |
790 | acpi_status status; | 785 | acpi_status status; |
@@ -797,4 +792,4 @@ acpi_status acpi_release_global_lock(u32 handle) | |||
797 | return (status); | 792 | return (status); |
798 | } | 793 | } |
799 | 794 | ||
800 | EXPORT_SYMBOL(acpi_release_global_lock); | 795 | ACPI_EXPORT_SYMBOL(acpi_release_global_lock) |
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index ec9ce8429f15..7ebc2efac936 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acevents.h> | 45 | #include <acpi/acevents.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
@@ -65,7 +63,7 @@ acpi_status acpi_enable(void) | |||
65 | { | 63 | { |
66 | acpi_status status = AE_OK; | 64 | acpi_status status = AE_OK; |
67 | 65 | ||
68 | ACPI_FUNCTION_TRACE("acpi_enable"); | 66 | ACPI_FUNCTION_TRACE(acpi_enable); |
69 | 67 | ||
70 | /* Make sure we have the FADT */ | 68 | /* Make sure we have the FADT */ |
71 | 69 | ||
@@ -94,6 +92,8 @@ acpi_status acpi_enable(void) | |||
94 | return_ACPI_STATUS(status); | 92 | return_ACPI_STATUS(status); |
95 | } | 93 | } |
96 | 94 | ||
95 | ACPI_EXPORT_SYMBOL(acpi_enable) | ||
96 | |||
97 | /******************************************************************************* | 97 | /******************************************************************************* |
98 | * | 98 | * |
99 | * FUNCTION: acpi_disable | 99 | * FUNCTION: acpi_disable |
@@ -105,12 +105,11 @@ acpi_status acpi_enable(void) | |||
105 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. | 105 | * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode. |
106 | * | 106 | * |
107 | ******************************************************************************/ | 107 | ******************************************************************************/ |
108 | |||
109 | acpi_status acpi_disable(void) | 108 | acpi_status acpi_disable(void) |
110 | { | 109 | { |
111 | acpi_status status = AE_OK; | 110 | acpi_status status = AE_OK; |
112 | 111 | ||
113 | ACPI_FUNCTION_TRACE("acpi_disable"); | 112 | ACPI_FUNCTION_TRACE(acpi_disable); |
114 | 113 | ||
115 | if (!acpi_gbl_FADT) { | 114 | if (!acpi_gbl_FADT) { |
116 | ACPI_WARNING((AE_INFO, "No FADT information present!")); | 115 | ACPI_WARNING((AE_INFO, "No FADT information present!")); |
@@ -137,6 +136,8 @@ acpi_status acpi_disable(void) | |||
137 | return_ACPI_STATUS(status); | 136 | return_ACPI_STATUS(status); |
138 | } | 137 | } |
139 | 138 | ||
139 | ACPI_EXPORT_SYMBOL(acpi_disable) | ||
140 | |||
140 | /******************************************************************************* | 141 | /******************************************************************************* |
141 | * | 142 | * |
142 | * FUNCTION: acpi_enable_event | 143 | * FUNCTION: acpi_enable_event |
@@ -149,13 +150,12 @@ acpi_status acpi_disable(void) | |||
149 | * DESCRIPTION: Enable an ACPI event (fixed) | 150 | * DESCRIPTION: Enable an ACPI event (fixed) |
150 | * | 151 | * |
151 | ******************************************************************************/ | 152 | ******************************************************************************/ |
152 | |||
153 | acpi_status acpi_enable_event(u32 event, u32 flags) | 153 | acpi_status acpi_enable_event(u32 event, u32 flags) |
154 | { | 154 | { |
155 | acpi_status status = AE_OK; | 155 | acpi_status status = AE_OK; |
156 | u32 value; | 156 | u32 value; |
157 | 157 | ||
158 | ACPI_FUNCTION_TRACE("acpi_enable_event"); | 158 | ACPI_FUNCTION_TRACE(acpi_enable_event); |
159 | 159 | ||
160 | /* Decode the Fixed Event */ | 160 | /* Decode the Fixed Event */ |
161 | 161 | ||
@@ -193,7 +193,7 @@ acpi_status acpi_enable_event(u32 event, u32 flags) | |||
193 | return_ACPI_STATUS(status); | 193 | return_ACPI_STATUS(status); |
194 | } | 194 | } |
195 | 195 | ||
196 | EXPORT_SYMBOL(acpi_enable_event); | 196 | ACPI_EXPORT_SYMBOL(acpi_enable_event) |
197 | 197 | ||
198 | /******************************************************************************* | 198 | /******************************************************************************* |
199 | * | 199 | * |
@@ -208,13 +208,12 @@ EXPORT_SYMBOL(acpi_enable_event); | |||
208 | * DESCRIPTION: Set the type of an individual GPE | 208 | * DESCRIPTION: Set the type of an individual GPE |
209 | * | 209 | * |
210 | ******************************************************************************/ | 210 | ******************************************************************************/ |
211 | |||
212 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | 211 | acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) |
213 | { | 212 | { |
214 | acpi_status status = AE_OK; | 213 | acpi_status status = AE_OK; |
215 | struct acpi_gpe_event_info *gpe_event_info; | 214 | struct acpi_gpe_event_info *gpe_event_info; |
216 | 215 | ||
217 | ACPI_FUNCTION_TRACE("acpi_set_gpe_type"); | 216 | ACPI_FUNCTION_TRACE(acpi_set_gpe_type); |
218 | 217 | ||
219 | /* Ensure that we have a valid GPE number */ | 218 | /* Ensure that we have a valid GPE number */ |
220 | 219 | ||
@@ -236,7 +235,7 @@ acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type) | |||
236 | return_ACPI_STATUS(status); | 235 | return_ACPI_STATUS(status); |
237 | } | 236 | } |
238 | 237 | ||
239 | EXPORT_SYMBOL(acpi_set_gpe_type); | 238 | ACPI_EXPORT_SYMBOL(acpi_set_gpe_type) |
240 | 239 | ||
241 | /******************************************************************************* | 240 | /******************************************************************************* |
242 | * | 241 | * |
@@ -252,13 +251,12 @@ EXPORT_SYMBOL(acpi_set_gpe_type); | |||
252 | * DESCRIPTION: Enable an ACPI event (general purpose) | 251 | * DESCRIPTION: Enable an ACPI event (general purpose) |
253 | * | 252 | * |
254 | ******************************************************************************/ | 253 | ******************************************************************************/ |
255 | |||
256 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 254 | acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
257 | { | 255 | { |
258 | acpi_status status = AE_OK; | 256 | acpi_status status = AE_OK; |
259 | struct acpi_gpe_event_info *gpe_event_info; | 257 | struct acpi_gpe_event_info *gpe_event_info; |
260 | 258 | ||
261 | ACPI_FUNCTION_TRACE("acpi_enable_gpe"); | 259 | ACPI_FUNCTION_TRACE(acpi_enable_gpe); |
262 | 260 | ||
263 | /* Use semaphore lock if not executing at interrupt level */ | 261 | /* Use semaphore lock if not executing at interrupt level */ |
264 | 262 | ||
@@ -288,7 +286,7 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
288 | return_ACPI_STATUS(status); | 286 | return_ACPI_STATUS(status); |
289 | } | 287 | } |
290 | 288 | ||
291 | EXPORT_SYMBOL(acpi_enable_gpe); | 289 | ACPI_EXPORT_SYMBOL(acpi_enable_gpe) |
292 | 290 | ||
293 | /******************************************************************************* | 291 | /******************************************************************************* |
294 | * | 292 | * |
@@ -304,13 +302,12 @@ EXPORT_SYMBOL(acpi_enable_gpe); | |||
304 | * DESCRIPTION: Disable an ACPI event (general purpose) | 302 | * DESCRIPTION: Disable an ACPI event (general purpose) |
305 | * | 303 | * |
306 | ******************************************************************************/ | 304 | ******************************************************************************/ |
307 | |||
308 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 305 | acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
309 | { | 306 | { |
310 | acpi_status status = AE_OK; | 307 | acpi_status status = AE_OK; |
311 | struct acpi_gpe_event_info *gpe_event_info; | 308 | struct acpi_gpe_event_info *gpe_event_info; |
312 | 309 | ||
313 | ACPI_FUNCTION_TRACE("acpi_disable_gpe"); | 310 | ACPI_FUNCTION_TRACE(acpi_disable_gpe); |
314 | 311 | ||
315 | /* Use semaphore lock if not executing at interrupt level */ | 312 | /* Use semaphore lock if not executing at interrupt level */ |
316 | 313 | ||
@@ -338,6 +335,8 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
338 | return_ACPI_STATUS(status); | 335 | return_ACPI_STATUS(status); |
339 | } | 336 | } |
340 | 337 | ||
338 | ACPI_EXPORT_SYMBOL(acpi_disable_gpe) | ||
339 | |||
341 | /******************************************************************************* | 340 | /******************************************************************************* |
342 | * | 341 | * |
343 | * FUNCTION: acpi_disable_event | 342 | * FUNCTION: acpi_disable_event |
@@ -350,13 +349,12 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
350 | * DESCRIPTION: Disable an ACPI event (fixed) | 349 | * DESCRIPTION: Disable an ACPI event (fixed) |
351 | * | 350 | * |
352 | ******************************************************************************/ | 351 | ******************************************************************************/ |
353 | |||
354 | acpi_status acpi_disable_event(u32 event, u32 flags) | 352 | acpi_status acpi_disable_event(u32 event, u32 flags) |
355 | { | 353 | { |
356 | acpi_status status = AE_OK; | 354 | acpi_status status = AE_OK; |
357 | u32 value; | 355 | u32 value; |
358 | 356 | ||
359 | ACPI_FUNCTION_TRACE("acpi_disable_event"); | 357 | ACPI_FUNCTION_TRACE(acpi_disable_event); |
360 | 358 | ||
361 | /* Decode the Fixed Event */ | 359 | /* Decode the Fixed Event */ |
362 | 360 | ||
@@ -392,7 +390,7 @@ acpi_status acpi_disable_event(u32 event, u32 flags) | |||
392 | return_ACPI_STATUS(status); | 390 | return_ACPI_STATUS(status); |
393 | } | 391 | } |
394 | 392 | ||
395 | EXPORT_SYMBOL(acpi_disable_event); | 393 | ACPI_EXPORT_SYMBOL(acpi_disable_event) |
396 | 394 | ||
397 | /******************************************************************************* | 395 | /******************************************************************************* |
398 | * | 396 | * |
@@ -405,12 +403,11 @@ EXPORT_SYMBOL(acpi_disable_event); | |||
405 | * DESCRIPTION: Clear an ACPI event (fixed) | 403 | * DESCRIPTION: Clear an ACPI event (fixed) |
406 | * | 404 | * |
407 | ******************************************************************************/ | 405 | ******************************************************************************/ |
408 | |||
409 | acpi_status acpi_clear_event(u32 event) | 406 | acpi_status acpi_clear_event(u32 event) |
410 | { | 407 | { |
411 | acpi_status status = AE_OK; | 408 | acpi_status status = AE_OK; |
412 | 409 | ||
413 | ACPI_FUNCTION_TRACE("acpi_clear_event"); | 410 | ACPI_FUNCTION_TRACE(acpi_clear_event); |
414 | 411 | ||
415 | /* Decode the Fixed Event */ | 412 | /* Decode the Fixed Event */ |
416 | 413 | ||
@@ -429,7 +426,7 @@ acpi_status acpi_clear_event(u32 event) | |||
429 | return_ACPI_STATUS(status); | 426 | return_ACPI_STATUS(status); |
430 | } | 427 | } |
431 | 428 | ||
432 | EXPORT_SYMBOL(acpi_clear_event); | 429 | ACPI_EXPORT_SYMBOL(acpi_clear_event) |
433 | 430 | ||
434 | /******************************************************************************* | 431 | /******************************************************************************* |
435 | * | 432 | * |
@@ -444,13 +441,12 @@ EXPORT_SYMBOL(acpi_clear_event); | |||
444 | * DESCRIPTION: Clear an ACPI event (general purpose) | 441 | * DESCRIPTION: Clear an ACPI event (general purpose) |
445 | * | 442 | * |
446 | ******************************************************************************/ | 443 | ******************************************************************************/ |
447 | |||
448 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | 444 | acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) |
449 | { | 445 | { |
450 | acpi_status status = AE_OK; | 446 | acpi_status status = AE_OK; |
451 | struct acpi_gpe_event_info *gpe_event_info; | 447 | struct acpi_gpe_event_info *gpe_event_info; |
452 | 448 | ||
453 | ACPI_FUNCTION_TRACE("acpi_clear_gpe"); | 449 | ACPI_FUNCTION_TRACE(acpi_clear_gpe); |
454 | 450 | ||
455 | /* Use semaphore lock if not executing at interrupt level */ | 451 | /* Use semaphore lock if not executing at interrupt level */ |
456 | 452 | ||
@@ -478,6 +474,8 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
478 | return_ACPI_STATUS(status); | 474 | return_ACPI_STATUS(status); |
479 | } | 475 | } |
480 | 476 | ||
477 | ACPI_EXPORT_SYMBOL(acpi_clear_gpe) | ||
478 | |||
481 | #ifdef ACPI_FUTURE_USAGE | 479 | #ifdef ACPI_FUTURE_USAGE |
482 | /******************************************************************************* | 480 | /******************************************************************************* |
483 | * | 481 | * |
@@ -492,12 +490,11 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags) | |||
492 | * DESCRIPTION: Obtains and returns the current status of the event | 490 | * DESCRIPTION: Obtains and returns the current status of the event |
493 | * | 491 | * |
494 | ******************************************************************************/ | 492 | ******************************************************************************/ |
495 | |||
496 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | 493 | acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) |
497 | { | 494 | { |
498 | acpi_status status = AE_OK; | 495 | acpi_status status = AE_OK; |
499 | 496 | ||
500 | ACPI_FUNCTION_TRACE("acpi_get_event_status"); | 497 | ACPI_FUNCTION_TRACE(acpi_get_event_status); |
501 | 498 | ||
502 | if (!event_status) { | 499 | if (!event_status) { |
503 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 500 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -518,6 +515,8 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
518 | return_ACPI_STATUS(status); | 515 | return_ACPI_STATUS(status); |
519 | } | 516 | } |
520 | 517 | ||
518 | ACPI_EXPORT_SYMBOL(acpi_get_event_status) | ||
519 | |||
521 | /******************************************************************************* | 520 | /******************************************************************************* |
522 | * | 521 | * |
523 | * FUNCTION: acpi_get_gpe_status | 522 | * FUNCTION: acpi_get_gpe_status |
@@ -533,7 +532,6 @@ acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status) | |||
533 | * DESCRIPTION: Get status of an event (general purpose) | 532 | * DESCRIPTION: Get status of an event (general purpose) |
534 | * | 533 | * |
535 | ******************************************************************************/ | 534 | ******************************************************************************/ |
536 | |||
537 | acpi_status | 535 | acpi_status |
538 | acpi_get_gpe_status(acpi_handle gpe_device, | 536 | acpi_get_gpe_status(acpi_handle gpe_device, |
539 | u32 gpe_number, u32 flags, acpi_event_status * event_status) | 537 | u32 gpe_number, u32 flags, acpi_event_status * event_status) |
@@ -541,7 +539,7 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
541 | acpi_status status = AE_OK; | 539 | acpi_status status = AE_OK; |
542 | struct acpi_gpe_event_info *gpe_event_info; | 540 | struct acpi_gpe_event_info *gpe_event_info; |
543 | 541 | ||
544 | ACPI_FUNCTION_TRACE("acpi_get_gpe_status"); | 542 | ACPI_FUNCTION_TRACE(acpi_get_gpe_status); |
545 | 543 | ||
546 | /* Use semaphore lock if not executing at interrupt level */ | 544 | /* Use semaphore lock if not executing at interrupt level */ |
547 | 545 | ||
@@ -570,6 +568,8 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
570 | } | 568 | } |
571 | return_ACPI_STATUS(status); | 569 | return_ACPI_STATUS(status); |
572 | } | 570 | } |
571 | |||
572 | ACPI_EXPORT_SYMBOL(acpi_get_gpe_status) | ||
573 | #endif /* ACPI_FUTURE_USAGE */ | 573 | #endif /* ACPI_FUTURE_USAGE */ |
574 | 574 | ||
575 | /******************************************************************************* | 575 | /******************************************************************************* |
@@ -586,7 +586,6 @@ acpi_get_gpe_status(acpi_handle gpe_device, | |||
586 | * DESCRIPTION: Create and Install a block of GPE registers | 586 | * DESCRIPTION: Create and Install a block of GPE registers |
587 | * | 587 | * |
588 | ******************************************************************************/ | 588 | ******************************************************************************/ |
589 | |||
590 | acpi_status | 589 | acpi_status |
591 | acpi_install_gpe_block(acpi_handle gpe_device, | 590 | acpi_install_gpe_block(acpi_handle gpe_device, |
592 | struct acpi_generic_address *gpe_block_address, | 591 | struct acpi_generic_address *gpe_block_address, |
@@ -597,7 +596,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
597 | struct acpi_namespace_node *node; | 596 | struct acpi_namespace_node *node; |
598 | struct acpi_gpe_block_info *gpe_block; | 597 | struct acpi_gpe_block_info *gpe_block; |
599 | 598 | ||
600 | ACPI_FUNCTION_TRACE("acpi_install_gpe_block"); | 599 | ACPI_FUNCTION_TRACE(acpi_install_gpe_block); |
601 | 600 | ||
602 | if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { | 601 | if ((!gpe_device) || (!gpe_block_address) || (!register_count)) { |
603 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 602 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -636,6 +635,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
636 | 635 | ||
637 | obj_desc = acpi_ns_get_attached_object(node); | 636 | obj_desc = acpi_ns_get_attached_object(node); |
638 | if (!obj_desc) { | 637 | if (!obj_desc) { |
638 | |||
639 | /* No object, create a new one */ | 639 | /* No object, create a new one */ |
640 | 640 | ||
641 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); | 641 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE); |
@@ -665,7 +665,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, | |||
665 | return_ACPI_STATUS(status); | 665 | return_ACPI_STATUS(status); |
666 | } | 666 | } |
667 | 667 | ||
668 | EXPORT_SYMBOL(acpi_install_gpe_block); | 668 | ACPI_EXPORT_SYMBOL(acpi_install_gpe_block) |
669 | 669 | ||
670 | /******************************************************************************* | 670 | /******************************************************************************* |
671 | * | 671 | * |
@@ -678,14 +678,13 @@ EXPORT_SYMBOL(acpi_install_gpe_block); | |||
678 | * DESCRIPTION: Remove a previously installed block of GPE registers | 678 | * DESCRIPTION: Remove a previously installed block of GPE registers |
679 | * | 679 | * |
680 | ******************************************************************************/ | 680 | ******************************************************************************/ |
681 | |||
682 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | 681 | acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) |
683 | { | 682 | { |
684 | union acpi_operand_object *obj_desc; | 683 | union acpi_operand_object *obj_desc; |
685 | acpi_status status; | 684 | acpi_status status; |
686 | struct acpi_namespace_node *node; | 685 | struct acpi_namespace_node *node; |
687 | 686 | ||
688 | ACPI_FUNCTION_TRACE("acpi_remove_gpe_block"); | 687 | ACPI_FUNCTION_TRACE(acpi_remove_gpe_block); |
689 | 688 | ||
690 | if (!gpe_device) { | 689 | if (!gpe_device) { |
691 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 690 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -721,4 +720,4 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) | |||
721 | return_ACPI_STATUS(status); | 720 | return_ACPI_STATUS(status); |
722 | } | 721 | } |
723 | 722 | ||
724 | EXPORT_SYMBOL(acpi_remove_gpe_block); | 723 | ACPI_EXPORT_SYMBOL(acpi_remove_gpe_block) |
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index abf5caca9ae5..e8b86a0baad0 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acevents.h> | 47 | #include <acpi/acevents.h> |
@@ -75,7 +73,7 @@ acpi_install_address_space_handler(acpi_handle device, | |||
75 | struct acpi_namespace_node *node; | 73 | struct acpi_namespace_node *node; |
76 | acpi_status status; | 74 | acpi_status status; |
77 | 75 | ||
78 | ACPI_FUNCTION_TRACE("acpi_install_address_space_handler"); | 76 | ACPI_FUNCTION_TRACE(acpi_install_address_space_handler); |
79 | 77 | ||
80 | /* Parameter validation */ | 78 | /* Parameter validation */ |
81 | 79 | ||
@@ -114,7 +112,7 @@ acpi_install_address_space_handler(acpi_handle device, | |||
114 | return_ACPI_STATUS(status); | 112 | return_ACPI_STATUS(status); |
115 | } | 113 | } |
116 | 114 | ||
117 | EXPORT_SYMBOL(acpi_install_address_space_handler); | 115 | ACPI_EXPORT_SYMBOL(acpi_install_address_space_handler) |
118 | 116 | ||
119 | /******************************************************************************* | 117 | /******************************************************************************* |
120 | * | 118 | * |
@@ -129,7 +127,6 @@ EXPORT_SYMBOL(acpi_install_address_space_handler); | |||
129 | * DESCRIPTION: Remove a previously installed handler. | 127 | * DESCRIPTION: Remove a previously installed handler. |
130 | * | 128 | * |
131 | ******************************************************************************/ | 129 | ******************************************************************************/ |
132 | |||
133 | acpi_status | 130 | acpi_status |
134 | acpi_remove_address_space_handler(acpi_handle device, | 131 | acpi_remove_address_space_handler(acpi_handle device, |
135 | acpi_adr_space_type space_id, | 132 | acpi_adr_space_type space_id, |
@@ -142,7 +139,7 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
142 | struct acpi_namespace_node *node; | 139 | struct acpi_namespace_node *node; |
143 | acpi_status status; | 140 | acpi_status status; |
144 | 141 | ||
145 | ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler"); | 142 | ACPI_FUNCTION_TRACE(acpi_remove_address_space_handler); |
146 | 143 | ||
147 | /* Parameter validation */ | 144 | /* Parameter validation */ |
148 | 145 | ||
@@ -176,9 +173,11 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
176 | handler_obj = obj_desc->device.handler; | 173 | handler_obj = obj_desc->device.handler; |
177 | last_obj_ptr = &obj_desc->device.handler; | 174 | last_obj_ptr = &obj_desc->device.handler; |
178 | while (handler_obj) { | 175 | while (handler_obj) { |
176 | |||
179 | /* We have a handler, see if user requested this one */ | 177 | /* We have a handler, see if user requested this one */ |
180 | 178 | ||
181 | if (handler_obj->address_space.space_id == space_id) { | 179 | if (handler_obj->address_space.space_id == space_id) { |
180 | |||
182 | /* Matched space_id, first dereference this in the Regions */ | 181 | /* Matched space_id, first dereference this in the Regions */ |
183 | 182 | ||
184 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 183 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
@@ -229,7 +228,7 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
229 | /* The handler does not exist */ | 228 | /* The handler does not exist */ |
230 | 229 | ||
231 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 230 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
232 | "Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n", | 231 | "Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n", |
233 | handler, acpi_ut_get_region_name(space_id), space_id, | 232 | handler, acpi_ut_get_region_name(space_id), space_id, |
234 | node, obj_desc)); | 233 | node, obj_desc)); |
235 | 234 | ||
@@ -240,4 +239,4 @@ acpi_remove_address_space_handler(acpi_handle device, | |||
240 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
241 | } | 240 | } |
242 | 241 | ||
243 | EXPORT_SYMBOL(acpi_remove_address_space_handler); | 242 | ACPI_EXPORT_SYMBOL(acpi_remove_address_space_handler) |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index a29782fe3ecf..823352435e08 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -82,7 +82,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
82 | struct acpi_table_desc table_info; | 82 | struct acpi_table_desc table_info; |
83 | union acpi_operand_object *obj_desc; | 83 | union acpi_operand_object *obj_desc; |
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE("ex_add_table"); | 85 | ACPI_FUNCTION_TRACE(ex_add_table); |
86 | 86 | ||
87 | /* Create an object to be the table handle */ | 87 | /* Create an object to be the table handle */ |
88 | 88 | ||
@@ -100,7 +100,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
100 | 100 | ||
101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); | 101 | ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc)); |
102 | 102 | ||
103 | table_info.type = ACPI_TABLE_SSDT; | 103 | table_info.type = ACPI_TABLE_ID_SSDT; |
104 | table_info.pointer = table; | 104 | table_info.pointer = table; |
105 | table_info.length = (acpi_size) table->length; | 105 | table_info.length = (acpi_size) table->length; |
106 | table_info.allocation = ACPI_MEM_ALLOCATED; | 106 | table_info.allocation = ACPI_MEM_ALLOCATED; |
@@ -110,6 +110,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
110 | 110 | ||
111 | if (ACPI_FAILURE(status)) { | 111 | if (ACPI_FAILURE(status)) { |
112 | if (status == AE_ALREADY_EXISTS) { | 112 | if (status == AE_ALREADY_EXISTS) { |
113 | |||
113 | /* Table already exists, just return the handle */ | 114 | /* Table already exists, just return the handle */ |
114 | 115 | ||
115 | return_ACPI_STATUS(AE_OK); | 116 | return_ACPI_STATUS(AE_OK); |
@@ -121,6 +122,7 @@ acpi_ex_add_table(struct acpi_table_header *table, | |||
121 | 122 | ||
122 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); | 123 | status = acpi_ns_load_table(table_info.installed_desc, parent_node); |
123 | if (ACPI_FAILURE(status)) { | 124 | if (ACPI_FAILURE(status)) { |
125 | |||
124 | /* Uninstall table on error */ | 126 | /* Uninstall table on error */ |
125 | 127 | ||
126 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | 128 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
@@ -160,7 +162,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
160 | struct acpi_namespace_node *parameter_node = NULL; | 162 | struct acpi_namespace_node *parameter_node = NULL; |
161 | union acpi_operand_object *ddb_handle; | 163 | union acpi_operand_object *ddb_handle; |
162 | 164 | ||
163 | ACPI_FUNCTION_TRACE("ex_load_table_op"); | 165 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
164 | 166 | ||
165 | #if 0 | 167 | #if 0 |
166 | /* | 168 | /* |
@@ -169,6 +171,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
169 | */ | 171 | */ |
170 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); | 172 | status = acpi_tb_match_signature(operand[0]->string.pointer, NULL); |
171 | if (status == AE_OK) { | 173 | if (status == AE_OK) { |
174 | |||
172 | /* Signature matched -- don't allow override */ | 175 | /* Signature matched -- don't allow override */ |
173 | 176 | ||
174 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 177 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
@@ -211,9 +214,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
211 | * location within the namespace where the table will be loaded. | 214 | * location within the namespace where the table will be loaded. |
212 | */ | 215 | */ |
213 | status = | 216 | status = |
214 | acpi_ns_get_node_by_path(operand[3]->string.pointer, | 217 | acpi_ns_get_node(start_node, operand[3]->string.pointer, |
215 | start_node, ACPI_NS_SEARCH_PARENT, | 218 | ACPI_NS_SEARCH_PARENT, &parent_node); |
216 | &parent_node); | ||
217 | if (ACPI_FAILURE(status)) { | 219 | if (ACPI_FAILURE(status)) { |
218 | return_ACPI_STATUS(status); | 220 | return_ACPI_STATUS(status); |
219 | } | 221 | } |
@@ -234,9 +236,8 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
234 | /* Find the node referenced by the parameter_path_string */ | 236 | /* Find the node referenced by the parameter_path_string */ |
235 | 237 | ||
236 | status = | 238 | status = |
237 | acpi_ns_get_node_by_path(operand[4]->string.pointer, | 239 | acpi_ns_get_node(start_node, operand[4]->string.pointer, |
238 | start_node, ACPI_NS_SEARCH_PARENT, | 240 | ACPI_NS_SEARCH_PARENT, ¶meter_node); |
239 | ¶meter_node); | ||
240 | if (ACPI_FAILURE(status)) { | 241 | if (ACPI_FAILURE(status)) { |
241 | return_ACPI_STATUS(status); | 242 | return_ACPI_STATUS(status); |
242 | } | 243 | } |
@@ -252,6 +253,7 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
252 | /* Parameter Data (optional) */ | 253 | /* Parameter Data (optional) */ |
253 | 254 | ||
254 | if (parameter_node) { | 255 | if (parameter_node) { |
256 | |||
255 | /* Store the parameter data into the optional parameter object */ | 257 | /* Store the parameter data into the optional parameter object */ |
256 | 258 | ||
257 | status = acpi_ex_store(operand[5], | 259 | status = acpi_ex_store(operand[5], |
@@ -294,9 +296,10 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
294 | struct acpi_table_header *table_ptr = NULL; | 296 | struct acpi_table_header *table_ptr = NULL; |
295 | acpi_physical_address address; | 297 | acpi_physical_address address; |
296 | struct acpi_table_header table_header; | 298 | struct acpi_table_header table_header; |
299 | acpi_integer temp; | ||
297 | u32 i; | 300 | u32 i; |
298 | 301 | ||
299 | ACPI_FUNCTION_TRACE("ex_load_op"); | 302 | ACPI_FUNCTION_TRACE(ex_load_op); |
300 | 303 | ||
301 | /* Object can be either an op_region or a Field */ | 304 | /* Object can be either an op_region or a Field */ |
302 | 305 | ||
@@ -322,7 +325,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
322 | 325 | ||
323 | address = obj_desc->region.address; | 326 | address = obj_desc->region.address; |
324 | 327 | ||
325 | /* Get the table length from the table header */ | 328 | /* Get part of the table header to get the table length */ |
326 | 329 | ||
327 | table_header.length = 0; | 330 | table_header.length = 0; |
328 | for (i = 0; i < 8; i++) { | 331 | for (i = 0; i < 8; i++) { |
@@ -330,11 +333,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
330 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 333 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
331 | (acpi_physical_address) | 334 | (acpi_physical_address) |
332 | (i + address), 8, | 335 | (i + address), 8, |
333 | ((u8 *) & | 336 | &temp); |
334 | table_header) + i); | ||
335 | if (ACPI_FAILURE(status)) { | 337 | if (ACPI_FAILURE(status)) { |
336 | return_ACPI_STATUS(status); | 338 | return_ACPI_STATUS(status); |
337 | } | 339 | } |
340 | |||
341 | /* Get the one valid byte of the returned 64-bit value */ | ||
342 | |||
343 | ACPI_CAST_PTR(u8, &table_header)[i] = (u8) temp; | ||
338 | } | 344 | } |
339 | 345 | ||
340 | /* Sanity check the table length */ | 346 | /* Sanity check the table length */ |
@@ -345,7 +351,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
345 | 351 | ||
346 | /* Allocate a buffer for the entire table */ | 352 | /* Allocate a buffer for the entire table */ |
347 | 353 | ||
348 | table_ptr = ACPI_MEM_ALLOCATE(table_header.length); | 354 | table_ptr = ACPI_ALLOCATE(table_header.length); |
349 | if (!table_ptr) { | 355 | if (!table_ptr) { |
350 | return_ACPI_STATUS(AE_NO_MEMORY); | 356 | return_ACPI_STATUS(AE_NO_MEMORY); |
351 | } | 357 | } |
@@ -357,11 +363,14 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
357 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, | 363 | acpi_ev_address_space_dispatch(obj_desc, ACPI_READ, |
358 | (acpi_physical_address) | 364 | (acpi_physical_address) |
359 | (i + address), 8, | 365 | (i + address), 8, |
360 | ((u8 *) table_ptr + | 366 | &temp); |
361 | i)); | ||
362 | if (ACPI_FAILURE(status)) { | 367 | if (ACPI_FAILURE(status)) { |
363 | goto cleanup; | 368 | goto cleanup; |
364 | } | 369 | } |
370 | |||
371 | /* Get the one valid byte of the returned 64-bit value */ | ||
372 | |||
373 | ACPI_CAST_PTR(u8, table_ptr)[i] = (u8) temp; | ||
365 | } | 374 | } |
366 | break; | 375 | break; |
367 | 376 | ||
@@ -407,12 +416,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
407 | 416 | ||
408 | /* The table must be either an SSDT or a PSDT */ | 417 | /* The table must be either an SSDT or a PSDT */ |
409 | 418 | ||
410 | if ((!ACPI_STRNCMP(table_ptr->signature, | 419 | if ((!ACPI_COMPARE_NAME(table_ptr->signature, PSDT_SIG)) && |
411 | acpi_gbl_table_data[ACPI_TABLE_PSDT].signature, | 420 | (!ACPI_COMPARE_NAME(table_ptr->signature, SSDT_SIG))) { |
412 | acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) && | ||
413 | (!ACPI_STRNCMP(table_ptr->signature, | ||
414 | acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, | ||
415 | acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { | ||
416 | ACPI_ERROR((AE_INFO, | 421 | ACPI_ERROR((AE_INFO, |
417 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", | 422 | "Table has invalid signature [%4.4s], must be SSDT or PSDT", |
418 | table_ptr->signature)); | 423 | table_ptr->signature)); |
@@ -424,6 +429,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
424 | 429 | ||
425 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); | 430 | status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle); |
426 | if (ACPI_FAILURE(status)) { | 431 | if (ACPI_FAILURE(status)) { |
432 | |||
427 | /* On error, table_ptr was deallocated above */ | 433 | /* On error, table_ptr was deallocated above */ |
428 | 434 | ||
429 | return_ACPI_STATUS(status); | 435 | return_ACPI_STATUS(status); |
@@ -442,7 +448,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
442 | 448 | ||
443 | cleanup: | 449 | cleanup: |
444 | if (ACPI_FAILURE(status)) { | 450 | if (ACPI_FAILURE(status)) { |
445 | ACPI_MEM_FREE(table_ptr); | 451 | ACPI_FREE(table_ptr); |
446 | } | 452 | } |
447 | return_ACPI_STATUS(status); | 453 | return_ACPI_STATUS(status); |
448 | } | 454 | } |
@@ -465,7 +471,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
465 | union acpi_operand_object *table_desc = ddb_handle; | 471 | union acpi_operand_object *table_desc = ddb_handle; |
466 | struct acpi_table_desc *table_info; | 472 | struct acpi_table_desc *table_info; |
467 | 473 | ||
468 | ACPI_FUNCTION_TRACE("ex_unload_table"); | 474 | ACPI_FUNCTION_TRACE(ex_unload_table); |
469 | 475 | ||
470 | /* | 476 | /* |
471 | * Validate the handle | 477 | * Validate the handle |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index e6d52e12d77a..b732e399b1ef 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -79,7 +79,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc, | |||
79 | u32 count; | 79 | u32 count; |
80 | acpi_status status; | 80 | acpi_status status; |
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc); | 82 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc); |
83 | 83 | ||
84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 84 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
85 | case ACPI_TYPE_INTEGER: | 85 | case ACPI_TYPE_INTEGER: |
@@ -199,7 +199,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, | |||
199 | union acpi_operand_object *return_desc; | 199 | union acpi_operand_object *return_desc; |
200 | u8 *new_buf; | 200 | u8 *new_buf; |
201 | 201 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc); | 202 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc); |
203 | 203 | ||
204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 204 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
205 | case ACPI_TYPE_BUFFER: | 205 | case ACPI_TYPE_BUFFER: |
@@ -319,6 +319,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
319 | remainder = 0; | 319 | remainder = 0; |
320 | 320 | ||
321 | for (i = decimal_length; i > 0; i--) { | 321 | for (i = decimal_length; i > 0; i--) { |
322 | |||
322 | /* Divide by nth factor of 10 */ | 323 | /* Divide by nth factor of 10 */ |
323 | 324 | ||
324 | digit = integer; | 325 | digit = integer; |
@@ -346,6 +347,7 @@ acpi_ex_convert_to_ascii(acpi_integer integer, | |||
346 | 347 | ||
347 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); | 348 | hex_length = (acpi_native_uint) ACPI_MUL_2(data_width); |
348 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { | 349 | for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) { |
350 | |||
349 | /* Get one hex digit, most significant digits first */ | 351 | /* Get one hex digit, most significant digits first */ |
350 | 352 | ||
351 | string[k] = | 353 | string[k] = |
@@ -400,7 +402,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc, | |||
400 | u16 base = 16; | 402 | u16 base = 16; |
401 | u8 separator = ','; | 403 | u8 separator = ','; |
402 | 404 | ||
403 | ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc); | 405 | ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc); |
404 | 406 | ||
405 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 407 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
406 | case ACPI_TYPE_STRING: | 408 | case ACPI_TYPE_STRING: |
@@ -567,7 +569,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
567 | { | 569 | { |
568 | acpi_status status = AE_OK; | 570 | acpi_status status = AE_OK; |
569 | 571 | ||
570 | ACPI_FUNCTION_TRACE("ex_convert_to_target_type"); | 572 | ACPI_FUNCTION_TRACE(ex_convert_to_target_type); |
571 | 573 | ||
572 | /* Default behavior */ | 574 | /* Default behavior */ |
573 | 575 | ||
@@ -657,7 +659,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type, | |||
657 | 659 | ||
658 | default: | 660 | default: |
659 | ACPI_ERROR((AE_INFO, | 661 | ACPI_ERROR((AE_INFO, |
660 | "Unknown Target type ID 0x%X aml_opcode %X dest_type %s", | 662 | "Unknown Target type ID 0x%X AmlOpcode %X DestType %s", |
661 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> | 663 | GET_CURRENT_ARG_TYPE(walk_state->op_info-> |
662 | runtime_args), | 664 | runtime_args), |
663 | walk_state->opcode, | 665 | walk_state->opcode, |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 680575402835..106dc7219df7 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -69,7 +69,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
69 | struct acpi_namespace_node *alias_node; | 69 | struct acpi_namespace_node *alias_node; |
70 | acpi_status status = AE_OK; | 70 | acpi_status status = AE_OK; |
71 | 71 | ||
72 | ACPI_FUNCTION_TRACE("ex_create_alias"); | 72 | ACPI_FUNCTION_TRACE(ex_create_alias); |
73 | 73 | ||
74 | /* Get the source/alias operands (both namespace nodes) */ | 74 | /* Get the source/alias operands (both namespace nodes) */ |
75 | 75 | ||
@@ -164,7 +164,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) | |||
164 | acpi_status status; | 164 | acpi_status status; |
165 | union acpi_operand_object *obj_desc; | 165 | union acpi_operand_object *obj_desc; |
166 | 166 | ||
167 | ACPI_FUNCTION_TRACE("ex_create_event"); | 167 | ACPI_FUNCTION_TRACE(ex_create_event); |
168 | 168 | ||
169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); | 169 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT); |
170 | if (!obj_desc) { | 170 | if (!obj_desc) { |
@@ -216,7 +216,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) | |||
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | union acpi_operand_object *obj_desc; | 217 | union acpi_operand_object *obj_desc; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS); | 219 | ACPI_FUNCTION_TRACE_PTR(ex_create_mutex, ACPI_WALK_OPERANDS); |
220 | 220 | ||
221 | /* Create the new mutex object */ | 221 | /* Create the new mutex object */ |
222 | 222 | ||
@@ -243,8 +243,9 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) | |||
243 | obj_desc->mutex.node = | 243 | obj_desc->mutex.node = |
244 | (struct acpi_namespace_node *)walk_state->operands[0]; | 244 | (struct acpi_namespace_node *)walk_state->operands[0]; |
245 | 245 | ||
246 | status = acpi_ns_attach_object(obj_desc->mutex.node, | 246 | status = |
247 | obj_desc, ACPI_TYPE_MUTEX); | 247 | acpi_ns_attach_object(obj_desc->mutex.node, obj_desc, |
248 | ACPI_TYPE_MUTEX); | ||
248 | 249 | ||
249 | cleanup: | 250 | cleanup: |
250 | /* | 251 | /* |
@@ -280,7 +281,7 @@ acpi_ex_create_region(u8 * aml_start, | |||
280 | struct acpi_namespace_node *node; | 281 | struct acpi_namespace_node *node; |
281 | union acpi_operand_object *region_obj2; | 282 | union acpi_operand_object *region_obj2; |
282 | 283 | ||
283 | ACPI_FUNCTION_TRACE("ex_create_region"); | 284 | ACPI_FUNCTION_TRACE(ex_create_region); |
284 | 285 | ||
285 | /* Get the Namespace Node */ | 286 | /* Get the Namespace Node */ |
286 | 287 | ||
@@ -300,7 +301,7 @@ acpi_ex_create_region(u8 * aml_start, | |||
300 | */ | 301 | */ |
301 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && | 302 | if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && |
302 | (region_space < ACPI_USER_REGION_BEGIN)) { | 303 | (region_space < ACPI_USER_REGION_BEGIN)) { |
303 | ACPI_ERROR((AE_INFO, "Invalid address_space type %X", | 304 | ACPI_ERROR((AE_INFO, "Invalid AddressSpace type %X", |
304 | region_space)); | 305 | region_space)); |
305 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); | 306 | return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); |
306 | } | 307 | } |
@@ -364,7 +365,7 @@ acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) | |||
364 | struct acpi_table_header *table; | 365 | struct acpi_table_header *table; |
365 | union acpi_operand_object *region_obj2; | 366 | union acpi_operand_object *region_obj2; |
366 | 367 | ||
367 | ACPI_FUNCTION_TRACE("ex_create_table_region"); | 368 | ACPI_FUNCTION_TRACE(ex_create_table_region); |
368 | 369 | ||
369 | /* Get the Node from the object stack */ | 370 | /* Get the Node from the object stack */ |
370 | 371 | ||
@@ -452,7 +453,7 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) | |||
452 | union acpi_operand_object *obj_desc; | 453 | union acpi_operand_object *obj_desc; |
453 | acpi_status status; | 454 | acpi_status status; |
454 | 455 | ||
455 | ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state); | 456 | ACPI_FUNCTION_TRACE_PTR(ex_create_processor, walk_state); |
456 | 457 | ||
457 | /* Create the processor object */ | 458 | /* Create the processor object */ |
458 | 459 | ||
@@ -464,9 +465,9 @@ acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state) | |||
464 | /* Initialize the processor object from the operands */ | 465 | /* Initialize the processor object from the operands */ |
465 | 466 | ||
466 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; | 467 | obj_desc->processor.proc_id = (u8) operand[1]->integer.value; |
468 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
467 | obj_desc->processor.address = | 469 | obj_desc->processor.address = |
468 | (acpi_io_address) operand[2]->integer.value; | 470 | (acpi_io_address) operand[2]->integer.value; |
469 | obj_desc->processor.length = (u8) operand[3]->integer.value; | ||
470 | 471 | ||
471 | /* Install the processor object in the parent Node */ | 472 | /* Install the processor object in the parent Node */ |
472 | 473 | ||
@@ -499,7 +500,7 @@ acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state) | |||
499 | acpi_status status; | 500 | acpi_status status; |
500 | union acpi_operand_object *obj_desc; | 501 | union acpi_operand_object *obj_desc; |
501 | 502 | ||
502 | ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state); | 503 | ACPI_FUNCTION_TRACE_PTR(ex_create_power_resource, walk_state); |
503 | 504 | ||
504 | /* Create the power resource object */ | 505 | /* Create the power resource object */ |
505 | 506 | ||
@@ -549,7 +550,7 @@ acpi_ex_create_method(u8 * aml_start, | |||
549 | acpi_status status; | 550 | acpi_status status; |
550 | u8 method_flags; | 551 | u8 method_flags; |
551 | 552 | ||
552 | ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state); | 553 | ACPI_FUNCTION_TRACE_PTR(ex_create_method, walk_state); |
553 | 554 | ||
554 | /* Create a new method object */ | 555 | /* Create a new method object */ |
555 | 556 | ||
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index a7cca8d4f855..7b9718e976bf 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -61,6 +61,10 @@ static void acpi_ex_out_pointer(char *title, void *value); | |||
61 | 61 | ||
62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); | 62 | static void acpi_ex_out_address(char *title, acpi_physical_address value); |
63 | 63 | ||
64 | static void | ||
65 | acpi_ex_dump_object(union acpi_operand_object *obj_desc, | ||
66 | struct acpi_exdump_info *info); | ||
67 | |||
64 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); | 68 | static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc); |
65 | 69 | ||
66 | static void | 70 | static void |
@@ -119,7 +123,7 @@ static struct acpi_exdump_info acpi_ex_dump_event[2] = { | |||
119 | 123 | ||
120 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { | 124 | static struct acpi_exdump_info acpi_ex_dump_method[8] = { |
121 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, | 125 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL}, |
122 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"}, | 126 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "ParamCount"}, |
123 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, | 127 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"}, |
124 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, | 128 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"}, |
125 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, | 129 | {ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"}, |
@@ -263,12 +267,10 @@ static struct acpi_exdump_info acpi_ex_dump_field_common[7] = { | |||
263 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} | 267 | {ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"} |
264 | }; | 268 | }; |
265 | 269 | ||
266 | static struct acpi_exdump_info acpi_ex_dump_node[6] = { | 270 | static struct acpi_exdump_info acpi_ex_dump_node[5] = { |
267 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, | 271 | {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL}, |
268 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, | 272 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"}, |
269 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, | 273 | {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"}, |
270 | {ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count), | ||
271 | "Reference Count"}, | ||
272 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, | 274 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"}, |
273 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} | 275 | {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"} |
274 | }; | 276 | }; |
@@ -330,7 +332,7 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, | |||
330 | 332 | ||
331 | if (!info) { | 333 | if (!info) { |
332 | acpi_os_printf | 334 | acpi_os_printf |
333 | ("ex_dump_object: Display not implemented for object type %s\n", | 335 | ("ExDumpObject: Display not implemented for object type %s\n", |
334 | acpi_ut_get_object_type_name(obj_desc)); | 336 | acpi_ut_get_object_type_name(obj_desc)); |
335 | return; | 337 | return; |
336 | } | 338 | } |
@@ -454,7 +456,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
454 | u32 length; | 456 | u32 length; |
455 | u32 index; | 457 | u32 index; |
456 | 458 | ||
457 | ACPI_FUNCTION_NAME("ex_dump_operand") | 459 | ACPI_FUNCTION_NAME(ex_dump_operand) |
458 | 460 | ||
459 | if (! | 461 | if (! |
460 | ((ACPI_LV_EXEC & acpi_dbg_level) | 462 | ((ACPI_LV_EXEC & acpi_dbg_level) |
@@ -463,6 +465,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
463 | } | 465 | } |
464 | 466 | ||
465 | if (!obj_desc) { | 467 | if (!obj_desc) { |
468 | |||
466 | /* This could be a null element of a package */ | 469 | /* This could be a null element of a package */ |
467 | 470 | ||
468 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); | 471 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); |
@@ -522,7 +525,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
522 | 525 | ||
523 | case AML_REF_OF_OP: | 526 | case AML_REF_OF_OP: |
524 | 527 | ||
525 | acpi_os_printf("Reference: (ref_of) %p\n", | 528 | acpi_os_printf("Reference: (RefOf) %p\n", |
526 | obj_desc->reference.object); | 529 | obj_desc->reference.object); |
527 | break; | 530 | break; |
528 | 531 | ||
@@ -532,6 +535,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
532 | obj_desc->reference.offset); | 535 | obj_desc->reference.offset); |
533 | 536 | ||
534 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 537 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
538 | |||
535 | /* Value is an Integer */ | 539 | /* Value is an Integer */ |
536 | 540 | ||
537 | acpi_os_printf(" value is [%8.8X%8.8x]", | 541 | acpi_os_printf(" value is [%8.8X%8.8x]", |
@@ -610,7 +614,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
610 | 614 | ||
611 | case ACPI_TYPE_PACKAGE: | 615 | case ACPI_TYPE_PACKAGE: |
612 | 616 | ||
613 | acpi_os_printf("Package [Len %X] element_array %p\n", | 617 | acpi_os_printf("Package [Len %X] ElementArray %p\n", |
614 | obj_desc->package.count, | 618 | obj_desc->package.count, |
615 | obj_desc->package.elements); | 619 | obj_desc->package.elements); |
616 | 620 | ||
@@ -662,13 +666,13 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
662 | 666 | ||
663 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 667 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
664 | 668 | ||
665 | acpi_os_printf("bank_field\n"); | 669 | acpi_os_printf("BankField\n"); |
666 | break; | 670 | break; |
667 | 671 | ||
668 | case ACPI_TYPE_LOCAL_REGION_FIELD: | 672 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
669 | 673 | ||
670 | acpi_os_printf | 674 | acpi_os_printf |
671 | ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", | 675 | ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", |
672 | obj_desc->field.bit_length, | 676 | obj_desc->field.bit_length, |
673 | obj_desc->field.access_byte_width, | 677 | obj_desc->field.access_byte_width, |
674 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, | 678 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, |
@@ -681,12 +685,12 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
681 | 685 | ||
682 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 686 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
683 | 687 | ||
684 | acpi_os_printf("index_field\n"); | 688 | acpi_os_printf("IndexField\n"); |
685 | break; | 689 | break; |
686 | 690 | ||
687 | case ACPI_TYPE_BUFFER_FIELD: | 691 | case ACPI_TYPE_BUFFER_FIELD: |
688 | 692 | ||
689 | acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n", | 693 | acpi_os_printf("BufferField: %X bits at byte %X bit %X of\n", |
690 | obj_desc->buffer_field.bit_length, | 694 | obj_desc->buffer_field.bit_length, |
691 | obj_desc->buffer_field.base_byte_offset, | 695 | obj_desc->buffer_field.base_byte_offset, |
692 | obj_desc->buffer_field.start_field_bit_offset); | 696 | obj_desc->buffer_field.start_field_bit_offset); |
@@ -777,7 +781,7 @@ acpi_ex_dump_operands(union acpi_operand_object **operands, | |||
777 | { | 781 | { |
778 | acpi_native_uint i; | 782 | acpi_native_uint i; |
779 | 783 | ||
780 | ACPI_FUNCTION_NAME("ex_dump_operands"); | 784 | ACPI_FUNCTION_NAME(ex_dump_operands); |
781 | 785 | ||
782 | if (!ident) { | 786 | if (!ident) { |
783 | ident = "?"; | 787 | ident = "?"; |
@@ -901,7 +905,7 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) | |||
901 | acpi_os_printf("Could not convert name to pathname\n"); | 905 | acpi_os_printf("Could not convert name to pathname\n"); |
902 | } else { | 906 | } else { |
903 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); | 907 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); |
904 | ACPI_MEM_FREE(ret_buf.pointer); | 908 | ACPI_FREE(ret_buf.pointer); |
905 | } | 909 | } |
906 | } else if (obj_desc->reference.object) { | 910 | } else if (obj_desc->reference.object) { |
907 | acpi_os_printf("\nReferenced Object: %p\n", | 911 | acpi_os_printf("\nReferenced Object: %p\n", |
@@ -1017,7 +1021,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
1017 | void | 1021 | void |
1018 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | 1022 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) |
1019 | { | 1023 | { |
1020 | ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); | 1024 | ACPI_FUNCTION_TRACE(ex_dump_object_descriptor); |
1021 | 1025 | ||
1022 | if (!obj_desc) { | 1026 | if (!obj_desc) { |
1023 | return_VOID; | 1027 | return_VOID; |
@@ -1046,7 +1050,7 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) | |||
1046 | 1050 | ||
1047 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { | 1051 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
1048 | acpi_os_printf | 1052 | acpi_os_printf |
1049 | ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", | 1053 | ("ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", |
1050 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); | 1054 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); |
1051 | return_VOID; | 1055 | return_VOID; |
1052 | } | 1056 | } |
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index e259201ce9a0..9ea9c3a67ca9 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -73,7 +73,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
73 | void *buffer; | 73 | void *buffer; |
74 | u8 locked; | 74 | u8 locked; |
75 | 75 | ||
76 | ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc); | 76 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); |
77 | 77 | ||
78 | /* Parameter validation */ | 78 | /* Parameter validation */ |
79 | 79 | ||
@@ -142,6 +142,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
142 | length = | 142 | length = |
143 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); | 143 | (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); |
144 | if (length > acpi_gbl_integer_byte_width) { | 144 | if (length > acpi_gbl_integer_byte_width) { |
145 | |||
145 | /* Field is too large for an Integer, create a Buffer instead */ | 146 | /* Field is too large for an Integer, create a Buffer instead */ |
146 | 147 | ||
147 | buffer_desc = acpi_ut_create_buffer_object(length); | 148 | buffer_desc = acpi_ut_create_buffer_object(length); |
@@ -163,11 +164,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
163 | } | 164 | } |
164 | 165 | ||
165 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 166 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
166 | "field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n", | 167 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", |
167 | obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, | 168 | obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer, |
168 | (u32) length)); | 169 | (u32) length)); |
169 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 170 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
170 | "field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n", | 171 | "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", |
171 | obj_desc->common_field.bit_length, | 172 | obj_desc->common_field.bit_length, |
172 | obj_desc->common_field.start_field_bit_offset, | 173 | obj_desc->common_field.start_field_bit_offset, |
173 | obj_desc->common_field.base_byte_offset)); | 174 | obj_desc->common_field.base_byte_offset)); |
@@ -219,7 +220,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
219 | u8 locked; | 220 | u8 locked; |
220 | union acpi_operand_object *buffer_desc; | 221 | union acpi_operand_object *buffer_desc; |
221 | 222 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc); | 223 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); |
223 | 224 | ||
224 | /* Parameter validation */ | 225 | /* Parameter validation */ |
225 | 226 | ||
@@ -329,9 +330,10 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
329 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); | 330 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); |
330 | 331 | ||
331 | if (length < required_length) { | 332 | if (length < required_length) { |
333 | |||
332 | /* We need to create a new buffer */ | 334 | /* We need to create a new buffer */ |
333 | 335 | ||
334 | new_buffer = ACPI_MEM_CALLOCATE(required_length); | 336 | new_buffer = ACPI_ALLOCATE_ZEROED(required_length); |
335 | if (!new_buffer) { | 337 | if (!new_buffer) { |
336 | return_ACPI_STATUS(AE_NO_MEMORY); | 338 | return_ACPI_STATUS(AE_NO_MEMORY); |
337 | } | 339 | } |
@@ -347,14 +349,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
347 | } | 349 | } |
348 | 350 | ||
349 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 351 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
350 | "field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n", | 352 | "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", |
351 | source_desc, | 353 | source_desc, |
352 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE | 354 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE |
353 | (source_desc)), | 355 | (source_desc)), |
354 | ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); | 356 | ACPI_GET_OBJECT_TYPE(source_desc), buffer, length)); |
355 | 357 | ||
356 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 358 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
357 | "field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", | 359 | "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", |
358 | obj_desc, | 360 | obj_desc, |
359 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), | 361 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)), |
360 | ACPI_GET_OBJECT_TYPE(obj_desc), | 362 | ACPI_GET_OBJECT_TYPE(obj_desc), |
@@ -375,7 +377,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
375 | /* Free temporary buffer if we used one */ | 377 | /* Free temporary buffer if we used one */ |
376 | 378 | ||
377 | if (new_buffer) { | 379 | if (new_buffer) { |
378 | ACPI_MEM_FREE(new_buffer); | 380 | ACPI_FREE(new_buffer); |
379 | } | 381 | } |
380 | 382 | ||
381 | return_ACPI_STATUS(status); | 383 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index bd1af35f7fcf..051053f7cccb 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -87,7 +87,7 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
87 | acpi_status status = AE_OK; | 87 | acpi_status status = AE_OK; |
88 | union acpi_operand_object *rgn_desc; | 88 | union acpi_operand_object *rgn_desc; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset); | 90 | ACPI_FUNCTION_TRACE_U32(ex_setup_region, field_datum_byte_offset); |
91 | 91 | ||
92 | rgn_desc = obj_desc->common_field.region_obj; | 92 | rgn_desc = obj_desc->common_field.region_obj; |
93 | 93 | ||
@@ -112,7 +112,18 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /* Exit if Address/Length have been disallowed by the host OS */ | ||
116 | |||
117 | if (rgn_desc->common.flags & AOPOBJ_INVALID) { | ||
118 | return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * Exit now for SMBus address space, it has a non-linear address space | ||
123 | * and the request cannot be directly validated | ||
124 | */ | ||
115 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { | 125 | if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) { |
126 | |||
116 | /* SMBus has a non-linear address space */ | 127 | /* SMBus has a non-linear address space */ |
117 | 128 | ||
118 | return_ACPI_STATUS(AE_OK); | 129 | return_ACPI_STATUS(AE_OK); |
@@ -134,10 +145,10 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, | |||
134 | * length of one field datum (access width) must fit within the region. | 145 | * length of one field datum (access width) must fit within the region. |
135 | * (Region length is specified in bytes) | 146 | * (Region length is specified in bytes) |
136 | */ | 147 | */ |
137 | if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset + | 148 | if (rgn_desc->region.length < |
138 | field_datum_byte_offset + | 149 | (obj_desc->common_field.base_byte_offset + |
139 | obj_desc->common_field. | 150 | field_datum_byte_offset + |
140 | access_byte_width)) { | 151 | obj_desc->common_field.access_byte_width)) { |
141 | if (acpi_gbl_enable_interpreter_slack) { | 152 | if (acpi_gbl_enable_interpreter_slack) { |
142 | /* | 153 | /* |
143 | * Slack mode only: We will go ahead and allow access to this | 154 | * Slack mode only: We will go ahead and allow access to this |
@@ -217,7 +228,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
217 | union acpi_operand_object *rgn_desc; | 228 | union acpi_operand_object *rgn_desc; |
218 | acpi_physical_address address; | 229 | acpi_physical_address address; |
219 | 230 | ||
220 | ACPI_FUNCTION_TRACE("ex_access_region"); | 231 | ACPI_FUNCTION_TRACE(ex_access_region); |
221 | 232 | ||
222 | /* | 233 | /* |
223 | * Ensure that the region operands are fully evaluated and verify | 234 | * Ensure that the region operands are fully evaluated and verify |
@@ -246,7 +257,7 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
246 | } | 257 | } |
247 | 258 | ||
248 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, | 259 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD, |
249 | " Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n", | 260 | " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n", |
250 | acpi_ut_get_region_name(rgn_desc->region. | 261 | acpi_ut_get_region_name(rgn_desc->region. |
251 | space_id), | 262 | space_id), |
252 | rgn_desc->region.space_id, | 263 | rgn_desc->region.space_id, |
@@ -352,7 +363,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
352 | acpi_status status; | 363 | acpi_status status; |
353 | acpi_integer local_value; | 364 | acpi_integer local_value; |
354 | 365 | ||
355 | ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset); | 366 | ACPI_FUNCTION_TRACE_U32(ex_field_datum_io, field_datum_byte_offset); |
356 | 367 | ||
357 | if (read_write == ACPI_READ) { | 368 | if (read_write == ACPI_READ) { |
358 | if (!value) { | 369 | if (!value) { |
@@ -487,10 +498,11 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc, | |||
487 | } | 498 | } |
488 | 499 | ||
489 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 500 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
490 | "I/O to Data Register: value_ptr %p\n", | 501 | "I/O to Data Register: ValuePtr %p\n", |
491 | value)); | 502 | value)); |
492 | 503 | ||
493 | if (read_write == ACPI_READ) { | 504 | if (read_write == ACPI_READ) { |
505 | |||
494 | /* Read the datum from the data_register */ | 506 | /* Read the datum from the data_register */ |
495 | 507 | ||
496 | status = | 508 | status = |
@@ -559,7 +571,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
559 | acpi_integer merged_value; | 571 | acpi_integer merged_value; |
560 | acpi_integer current_value; | 572 | acpi_integer current_value; |
561 | 573 | ||
562 | ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask); | 574 | ACPI_FUNCTION_TRACE_U32(ex_write_with_update_rule, mask); |
563 | 575 | ||
564 | /* Start with the new bits */ | 576 | /* Start with the new bits */ |
565 | 577 | ||
@@ -568,6 +580,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
568 | /* If the mask is all ones, we don't need to worry about the update rule */ | 580 | /* If the mask is all ones, we don't need to worry about the update rule */ |
569 | 581 | ||
570 | if (mask != ACPI_INTEGER_MAX) { | 582 | if (mask != ACPI_INTEGER_MAX) { |
583 | |||
571 | /* Decode the update rule */ | 584 | /* Decode the update rule */ |
572 | 585 | ||
573 | switch (obj_desc->common_field. | 586 | switch (obj_desc->common_field. |
@@ -614,7 +627,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
614 | default: | 627 | default: |
615 | 628 | ||
616 | ACPI_ERROR((AE_INFO, | 629 | ACPI_ERROR((AE_INFO, |
617 | "Unknown update_rule value: %X", | 630 | "Unknown UpdateRule value: %X", |
618 | (obj_desc->common_field. | 631 | (obj_desc->common_field. |
619 | field_flags & | 632 | field_flags & |
620 | AML_FIELD_UPDATE_RULE_MASK))); | 633 | AML_FIELD_UPDATE_RULE_MASK))); |
@@ -623,7 +636,7 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, | |||
623 | } | 636 | } |
624 | 637 | ||
625 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 638 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
626 | "Mask %8.8X%8.8X, datum_offset %X, Width %X, Value %8.8X%8.8X, merged_value %8.8X%8.8X\n", | 639 | "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", |
627 | ACPI_FORMAT_UINT64(mask), | 640 | ACPI_FORMAT_UINT64(mask), |
628 | field_datum_byte_offset, | 641 | field_datum_byte_offset, |
629 | obj_desc->common_field.access_byte_width, | 642 | obj_desc->common_field.access_byte_width, |
@@ -666,7 +679,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
666 | u32 field_datum_count; | 679 | u32 field_datum_count; |
667 | u32 i; | 680 | u32 i; |
668 | 681 | ||
669 | ACPI_FUNCTION_TRACE("ex_extract_from_field"); | 682 | ACPI_FUNCTION_TRACE(ex_extract_from_field); |
670 | 683 | ||
671 | /* Validate target buffer and clear it */ | 684 | /* Validate target buffer and clear it */ |
672 | 685 | ||
@@ -704,6 +717,7 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, | |||
704 | /* Read the rest of the field */ | 717 | /* Read the rest of the field */ |
705 | 718 | ||
706 | for (i = 1; i < field_datum_count; i++) { | 719 | for (i = 1; i < field_datum_count; i++) { |
720 | |||
707 | /* Get next input datum from the field */ | 721 | /* Get next input datum from the field */ |
708 | 722 | ||
709 | field_offset += obj_desc->common_field.access_byte_width; | 723 | field_offset += obj_desc->common_field.access_byte_width; |
@@ -771,6 +785,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
771 | { | 785 | { |
772 | acpi_status status; | 786 | acpi_status status; |
773 | acpi_integer mask; | 787 | acpi_integer mask; |
788 | acpi_integer width_mask; | ||
774 | acpi_integer merged_datum; | 789 | acpi_integer merged_datum; |
775 | acpi_integer raw_datum = 0; | 790 | acpi_integer raw_datum = 0; |
776 | u32 field_offset = 0; | 791 | u32 field_offset = 0; |
@@ -780,7 +795,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
780 | u32 field_datum_count; | 795 | u32 field_datum_count; |
781 | u32 i; | 796 | u32 i; |
782 | 797 | ||
783 | ACPI_FUNCTION_TRACE("ex_insert_into_field"); | 798 | ACPI_FUNCTION_TRACE(ex_insert_into_field); |
784 | 799 | ||
785 | /* Validate input buffer */ | 800 | /* Validate input buffer */ |
786 | 801 | ||
@@ -795,15 +810,20 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
795 | 810 | ||
796 | /* Compute the number of datums (access width data items) */ | 811 | /* Compute the number of datums (access width data items) */ |
797 | 812 | ||
813 | width_mask = | ||
814 | ACPI_MASK_BITS_ABOVE(obj_desc->common_field.access_bit_width); | ||
798 | mask = | 815 | mask = |
799 | ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset); | 816 | width_mask & ACPI_MASK_BITS_BELOW(obj_desc->common_field. |
800 | datum_count = | 817 | start_field_bit_offset); |
801 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, | 818 | |
802 | obj_desc->common_field.access_bit_width); | 819 | datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length, |
803 | field_datum_count = | 820 | obj_desc->common_field.access_bit_width); |
804 | ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + | 821 | |
805 | obj_desc->common_field.start_field_bit_offset, | 822 | field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length + |
806 | obj_desc->common_field.access_bit_width); | 823 | obj_desc->common_field. |
824 | start_field_bit_offset, | ||
825 | obj_desc->common_field. | ||
826 | access_bit_width); | ||
807 | 827 | ||
808 | /* Get initial Datum from the input buffer */ | 828 | /* Get initial Datum from the input buffer */ |
809 | 829 | ||
@@ -817,6 +837,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
817 | /* Write the entire field */ | 837 | /* Write the entire field */ |
818 | 838 | ||
819 | for (i = 1; i < field_datum_count; i++) { | 839 | for (i = 1; i < field_datum_count; i++) { |
840 | |||
820 | /* Write merged datum to the target field */ | 841 | /* Write merged datum to the target field */ |
821 | 842 | ||
822 | merged_datum &= mask; | 843 | merged_datum &= mask; |
@@ -833,7 +854,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
833 | merged_datum = raw_datum >> | 854 | merged_datum = raw_datum >> |
834 | (obj_desc->common_field.access_bit_width - | 855 | (obj_desc->common_field.access_bit_width - |
835 | obj_desc->common_field.start_field_bit_offset); | 856 | obj_desc->common_field.start_field_bit_offset); |
836 | mask = ACPI_INTEGER_MAX; | 857 | mask = width_mask; |
837 | 858 | ||
838 | if (i == datum_count) { | 859 | if (i == datum_count) { |
839 | break; | 860 | break; |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index 48c18d29222a..bd98aab017cf 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -72,7 +72,7 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, | |||
72 | union acpi_operand_object *reference_obj; | 72 | union acpi_operand_object *reference_obj; |
73 | union acpi_operand_object *referenced_obj; | 73 | union acpi_operand_object *referenced_obj; |
74 | 74 | ||
75 | ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc); | 75 | ACPI_FUNCTION_TRACE_PTR(ex_get_object_reference, obj_desc); |
76 | 76 | ||
77 | *return_desc = NULL; | 77 | *return_desc = NULL; |
78 | 78 | ||
@@ -168,7 +168,7 @@ acpi_ex_concat_template(union acpi_operand_object *operand0, | |||
168 | acpi_size length1; | 168 | acpi_size length1; |
169 | acpi_size new_length; | 169 | acpi_size new_length; |
170 | 170 | ||
171 | ACPI_FUNCTION_TRACE("ex_concat_template"); | 171 | ACPI_FUNCTION_TRACE(ex_concat_template); |
172 | 172 | ||
173 | /* | 173 | /* |
174 | * Find the end_tag descriptor in each resource template. | 174 | * Find the end_tag descriptor in each resource template. |
@@ -250,7 +250,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, | |||
250 | char *new_buf; | 250 | char *new_buf; |
251 | acpi_status status; | 251 | acpi_status status; |
252 | 252 | ||
253 | ACPI_FUNCTION_TRACE("ex_do_concatenate"); | 253 | ACPI_FUNCTION_TRACE(ex_do_concatenate); |
254 | 254 | ||
255 | /* | 255 | /* |
256 | * Convert the second operand if necessary. The first operand | 256 | * Convert the second operand if necessary. The first operand |
@@ -445,10 +445,24 @@ acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1) | |||
445 | 445 | ||
446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ | 446 | case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */ |
447 | 447 | ||
448 | /* | ||
449 | * We need to check if the shiftcount is larger than the integer bit | ||
450 | * width since the behavior of this is not well-defined in the C language. | ||
451 | */ | ||
452 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
453 | return (0); | ||
454 | } | ||
448 | return (integer0 << integer1); | 455 | return (integer0 << integer1); |
449 | 456 | ||
450 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ | 457 | case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */ |
451 | 458 | ||
459 | /* | ||
460 | * We need to check if the shiftcount is larger than the integer bit | ||
461 | * width since the behavior of this is not well-defined in the C language. | ||
462 | */ | ||
463 | if (integer1 >= acpi_gbl_integer_bit_width) { | ||
464 | return (0); | ||
465 | } | ||
452 | return (integer0 >> integer1); | 466 | return (integer0 >> integer1); |
453 | 467 | ||
454 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ | 468 | case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */ |
@@ -489,7 +503,7 @@ acpi_ex_do_logical_numeric_op(u16 opcode, | |||
489 | acpi_status status = AE_OK; | 503 | acpi_status status = AE_OK; |
490 | u8 local_result = FALSE; | 504 | u8 local_result = FALSE; |
491 | 505 | ||
492 | ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op"); | 506 | ACPI_FUNCTION_TRACE(ex_do_logical_numeric_op); |
493 | 507 | ||
494 | switch (opcode) { | 508 | switch (opcode) { |
495 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ | 509 | case AML_LAND_OP: /* LAnd (Integer0, Integer1) */ |
@@ -557,7 +571,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
557 | u8 local_result = FALSE; | 571 | u8 local_result = FALSE; |
558 | int compare; | 572 | int compare; |
559 | 573 | ||
560 | ACPI_FUNCTION_TRACE("ex_do_logical_op"); | 574 | ACPI_FUNCTION_TRACE(ex_do_logical_op); |
561 | 575 | ||
562 | /* | 576 | /* |
563 | * Convert the second operand if necessary. The first operand | 577 | * Convert the second operand if necessary. The first operand |
@@ -649,6 +663,7 @@ acpi_ex_do_logical_op(u16 opcode, | |||
649 | /* Length and all bytes must be equal */ | 663 | /* Length and all bytes must be equal */ |
650 | 664 | ||
651 | if ((length0 == length1) && (compare == 0)) { | 665 | if ((length0 == length1) && (compare == 0)) { |
666 | |||
652 | /* Length and all bytes match ==> TRUE */ | 667 | /* Length and all bytes match ==> TRUE */ |
653 | 668 | ||
654 | local_result = TRUE; | 669 | local_result = TRUE; |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index f843b22e20b9..93098d68cadf 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -61,7 +61,7 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
61 | * | 61 | * |
62 | * RETURN: None | 62 | * RETURN: None |
63 | * | 63 | * |
64 | * DESCRIPTION: Remove a mutex from the "acquired_mutex" list | 64 | * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list |
65 | * | 65 | * |
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | 67 | ||
@@ -95,7 +95,7 @@ void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc) | |||
95 | * | 95 | * |
96 | * RETURN: None | 96 | * RETURN: None |
97 | * | 97 | * |
98 | * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk | 98 | * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk |
99 | * | 99 | * |
100 | ******************************************************************************/ | 100 | ******************************************************************************/ |
101 | 101 | ||
@@ -144,7 +144,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
144 | { | 144 | { |
145 | acpi_status status; | 145 | acpi_status status; |
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc); | 147 | ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex, obj_desc); |
148 | 148 | ||
149 | if (!obj_desc) { | 149 | if (!obj_desc) { |
150 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 150 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -165,7 +165,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
165 | */ | 165 | */ |
166 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 166 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
167 | ACPI_ERROR((AE_INFO, | 167 | ACPI_ERROR((AE_INFO, |
168 | "Cannot acquire Mutex [%4.4s], incorrect sync_level", | 168 | "Cannot acquire Mutex [%4.4s], incorrect SyncLevel", |
169 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 169 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
170 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 170 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
171 | } | 171 | } |
@@ -173,6 +173,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
173 | /* Support for multiple acquires by the owning thread */ | 173 | /* Support for multiple acquires by the owning thread */ |
174 | 174 | ||
175 | if (obj_desc->mutex.owner_thread) { | 175 | if (obj_desc->mutex.owner_thread) { |
176 | |||
176 | /* Special case for Global Lock, allow all threads */ | 177 | /* Special case for Global Lock, allow all threads */ |
177 | 178 | ||
178 | if ((obj_desc->mutex.owner_thread->thread_id == | 179 | if ((obj_desc->mutex.owner_thread->thread_id == |
@@ -192,6 +193,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
192 | 193 | ||
193 | status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); | 194 | status = acpi_ex_system_acquire_mutex(time_desc, obj_desc); |
194 | if (ACPI_FAILURE(status)) { | 195 | if (ACPI_FAILURE(status)) { |
196 | |||
195 | /* Includes failure from a timeout on time_desc */ | 197 | /* Includes failure from a timeout on time_desc */ |
196 | 198 | ||
197 | return_ACPI_STATUS(status); | 199 | return_ACPI_STATUS(status); |
@@ -232,7 +234,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
232 | { | 234 | { |
233 | acpi_status status; | 235 | acpi_status status; |
234 | 236 | ||
235 | ACPI_FUNCTION_TRACE("ex_release_mutex"); | 237 | ACPI_FUNCTION_TRACE(ex_release_mutex); |
236 | 238 | ||
237 | if (!obj_desc) { | 239 | if (!obj_desc) { |
238 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 240 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -277,7 +279,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
277 | */ | 279 | */ |
278 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 280 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
279 | ACPI_ERROR((AE_INFO, | 281 | ACPI_ERROR((AE_INFO, |
280 | "Cannot release Mutex [%4.4s], incorrect sync_level", | 282 | "Cannot release Mutex [%4.4s], incorrect SyncLevel", |
281 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 283 | acpi_ut_get_node_name(obj_desc->mutex.node))); |
282 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 284 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
283 | } | 285 | } |
@@ -286,6 +288,7 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
286 | 288 | ||
287 | obj_desc->mutex.acquisition_depth--; | 289 | obj_desc->mutex.acquisition_depth--; |
288 | if (obj_desc->mutex.acquisition_depth != 0) { | 290 | if (obj_desc->mutex.acquisition_depth != 0) { |
291 | |||
289 | /* Just decrement the depth and return */ | 292 | /* Just decrement the depth and return */ |
290 | 293 | ||
291 | return_ACPI_STATUS(AE_OK); | 294 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 054fe5e1a314..d3d70364626c 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -77,7 +77,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
77 | char *name_string; | 77 | char *name_string; |
78 | u32 size_needed; | 78 | u32 size_needed; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ex_allocate_name_string"); | 80 | ACPI_FUNCTION_TRACE(ex_allocate_name_string); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. | 83 | * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix. |
@@ -85,6 +85,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
85 | * This may actually be somewhat longer than needed. | 85 | * This may actually be somewhat longer than needed. |
86 | */ | 86 | */ |
87 | if (prefix_count == ACPI_UINT32_MAX) { | 87 | if (prefix_count == ACPI_UINT32_MAX) { |
88 | |||
88 | /* Special case for root */ | 89 | /* Special case for root */ |
89 | 90 | ||
90 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; | 91 | size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1; |
@@ -97,7 +98,7 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
97 | * Allocate a buffer for the name. | 98 | * Allocate a buffer for the name. |
98 | * This buffer must be deleted by the caller! | 99 | * This buffer must be deleted by the caller! |
99 | */ | 100 | */ |
100 | name_string = ACPI_MEM_ALLOCATE(size_needed); | 101 | name_string = ACPI_ALLOCATE(size_needed); |
101 | if (!name_string) { | 102 | if (!name_string) { |
102 | ACPI_ERROR((AE_INFO, | 103 | ACPI_ERROR((AE_INFO, |
103 | "Could not allocate size %d", size_needed)); | 104 | "Could not allocate size %d", size_needed)); |
@@ -119,11 +120,13 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs) | |||
119 | /* Set up Dual or Multi prefixes if needed */ | 120 | /* Set up Dual or Multi prefixes if needed */ |
120 | 121 | ||
121 | if (num_name_segs > 2) { | 122 | if (num_name_segs > 2) { |
123 | |||
122 | /* Set up multi prefixes */ | 124 | /* Set up multi prefixes */ |
123 | 125 | ||
124 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; | 126 | *temp_ptr++ = AML_MULTI_NAME_PREFIX_OP; |
125 | *temp_ptr++ = (char)num_name_segs; | 127 | *temp_ptr++ = (char)num_name_segs; |
126 | } else if (2 == num_name_segs) { | 128 | } else if (2 == num_name_segs) { |
129 | |||
127 | /* Set up dual prefixes */ | 130 | /* Set up dual prefixes */ |
128 | 131 | ||
129 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; | 132 | *temp_ptr++ = AML_DUAL_NAME_PREFIX; |
@@ -159,7 +162,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
159 | u32 index; | 162 | u32 index; |
160 | char char_buf[5]; | 163 | char char_buf[5]; |
161 | 164 | ||
162 | ACPI_FUNCTION_TRACE("ex_name_segment"); | 165 | ACPI_FUNCTION_TRACE(ex_name_segment); |
163 | 166 | ||
164 | /* | 167 | /* |
165 | * If first character is a digit, then we know that we aren't looking at a | 168 | * If first character is a digit, then we know that we aren't looking at a |
@@ -176,7 +179,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
176 | 179 | ||
177 | for (index = 0; | 180 | for (index = 0; |
178 | (index < ACPI_NAME_SIZE) | 181 | (index < ACPI_NAME_SIZE) |
179 | && (acpi_ut_valid_acpi_character(*aml_address)); index++) { | 182 | && (acpi_ut_valid_acpi_char(*aml_address, 0)); index++) { |
180 | char_buf[index] = *aml_address++; | 183 | char_buf[index] = *aml_address++; |
181 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); | 184 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index])); |
182 | } | 185 | } |
@@ -184,6 +187,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) | |||
184 | /* Valid name segment */ | 187 | /* Valid name segment */ |
185 | 188 | ||
186 | if (index == 4) { | 189 | if (index == 4) { |
190 | |||
187 | /* Found 4 valid characters */ | 191 | /* Found 4 valid characters */ |
188 | 192 | ||
189 | char_buf[4] = '\0'; | 193 | char_buf[4] = '\0'; |
@@ -249,11 +253,12 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
249 | u32 prefix_count = 0; | 253 | u32 prefix_count = 0; |
250 | u8 has_prefix = FALSE; | 254 | u8 has_prefix = FALSE; |
251 | 255 | ||
252 | ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address); | 256 | ACPI_FUNCTION_TRACE_PTR(ex_get_name_string, aml_address); |
253 | 257 | ||
254 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || | 258 | if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type || |
255 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || | 259 | ACPI_TYPE_LOCAL_BANK_FIELD == data_type || |
256 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { | 260 | ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) { |
261 | |||
257 | /* Disallow prefixes for types associated with field_unit names */ | 262 | /* Disallow prefixes for types associated with field_unit names */ |
258 | 263 | ||
259 | name_string = acpi_ex_allocate_name_string(0, 1); | 264 | name_string = acpi_ex_allocate_name_string(0, 1); |
@@ -272,7 +277,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
272 | case AML_ROOT_PREFIX: | 277 | case AML_ROOT_PREFIX: |
273 | 278 | ||
274 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 279 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
275 | "root_prefix(\\) at %p\n", | 280 | "RootPrefix(\\) at %p\n", |
276 | aml_address)); | 281 | aml_address)); |
277 | 282 | ||
278 | /* | 283 | /* |
@@ -290,7 +295,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
290 | 295 | ||
291 | do { | 296 | do { |
292 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 297 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
293 | "parent_prefix (^) at %p\n", | 298 | "ParentPrefix (^) at %p\n", |
294 | aml_address)); | 299 | aml_address)); |
295 | 300 | ||
296 | aml_address++; | 301 | aml_address++; |
@@ -314,7 +319,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
314 | case AML_DUAL_NAME_PREFIX: | 319 | case AML_DUAL_NAME_PREFIX: |
315 | 320 | ||
316 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 321 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
317 | "dual_name_prefix at %p\n", | 322 | "DualNamePrefix at %p\n", |
318 | aml_address)); | 323 | aml_address)); |
319 | 324 | ||
320 | aml_address++; | 325 | aml_address++; |
@@ -341,7 +346,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
341 | case AML_MULTI_NAME_PREFIX_OP: | 346 | case AML_MULTI_NAME_PREFIX_OP: |
342 | 347 | ||
343 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, | 348 | ACPI_DEBUG_PRINT((ACPI_DB_LOAD, |
344 | "multi_name_prefix at %p\n", | 349 | "MultiNamePrefix at %p\n", |
345 | aml_address)); | 350 | aml_address)); |
346 | 351 | ||
347 | /* Fetch count of segments remaining in name path */ | 352 | /* Fetch count of segments remaining in name path */ |
@@ -377,7 +382,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
377 | 382 | ||
378 | if (prefix_count == ACPI_UINT32_MAX) { | 383 | if (prefix_count == ACPI_UINT32_MAX) { |
379 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 384 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
380 | "name_seg is \"\\\" followed by NULL\n")); | 385 | "NameSeg is \"\\\" followed by NULL\n")); |
381 | } | 386 | } |
382 | 387 | ||
383 | /* Consume the NULL byte */ | 388 | /* Consume the NULL byte */ |
@@ -410,6 +415,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
410 | } | 415 | } |
411 | 416 | ||
412 | if (AE_CTRL_PENDING == status && has_prefix) { | 417 | if (AE_CTRL_PENDING == status && has_prefix) { |
418 | |||
413 | /* Ran out of segments after processing a prefix */ | 419 | /* Ran out of segments after processing a prefix */ |
414 | 420 | ||
415 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); | 421 | ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string)); |
@@ -418,7 +424,7 @@ acpi_ex_get_name_string(acpi_object_type data_type, | |||
418 | 424 | ||
419 | if (ACPI_FAILURE(status)) { | 425 | if (ACPI_FAILURE(status)) { |
420 | if (name_string) { | 426 | if (name_string) { |
421 | ACPI_MEM_FREE(name_string); | 427 | ACPI_FREE(name_string); |
422 | } | 428 | } |
423 | return_ACPI_STATUS(status); | 429 | return_ACPI_STATUS(status); |
424 | } | 430 | } |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 23d0823bcd5e..6374d8be88e0 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -89,7 +89,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |||
89 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
90 | union acpi_operand_object *return_desc = NULL; | 90 | union acpi_operand_object *return_desc = NULL; |
91 | 91 | ||
92 | ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R", | 92 | ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R, |
93 | acpi_ps_get_opcode_name(walk_state->opcode)); | 93 | acpi_ps_get_opcode_name(walk_state->opcode)); |
94 | 94 | ||
95 | /* Examine the AML opcode */ | 95 | /* Examine the AML opcode */ |
@@ -150,7 +150,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state) | |||
150 | union acpi_operand_object **operand = &walk_state->operands[0]; | 150 | union acpi_operand_object **operand = &walk_state->operands[0]; |
151 | acpi_status status = AE_OK; | 151 | acpi_status status = AE_OK; |
152 | 152 | ||
153 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R", | 153 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R, |
154 | acpi_ps_get_opcode_name(walk_state->opcode)); | 154 | acpi_ps_get_opcode_name(walk_state->opcode)); |
155 | 155 | ||
156 | /* Examine the AML opcode */ | 156 | /* Examine the AML opcode */ |
@@ -216,7 +216,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) | |||
216 | acpi_status status = AE_OK; | 216 | acpi_status status = AE_OK; |
217 | union acpi_operand_object **operand = &walk_state->operands[0]; | 217 | union acpi_operand_object **operand = &walk_state->operands[0]; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R", | 219 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R, |
220 | acpi_ps_get_opcode_name(walk_state->opcode)); | 220 | acpi_ps_get_opcode_name(walk_state->opcode)); |
221 | 221 | ||
222 | /* Examine the AML opcode */ | 222 | /* Examine the AML opcode */ |
@@ -264,7 +264,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
264 | acpi_integer power_of_ten; | 264 | acpi_integer power_of_ten; |
265 | acpi_integer digit; | 265 | acpi_integer digit; |
266 | 266 | ||
267 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R", | 267 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R, |
268 | acpi_ps_get_opcode_name(walk_state->opcode)); | 268 | acpi_ps_get_opcode_name(walk_state->opcode)); |
269 | 269 | ||
270 | /* Examine the AML opcode */ | 270 | /* Examine the AML opcode */ |
@@ -322,8 +322,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
322 | 322 | ||
323 | /* Since the bit position is one-based, subtract from 33 (65) */ | 323 | /* Since the bit position is one-based, subtract from 33 (65) */ |
324 | 324 | ||
325 | return_desc->integer.value = temp32 == 0 ? 0 : | 325 | return_desc->integer.value = |
326 | (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | 326 | temp32 == |
327 | 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - temp32; | ||
327 | break; | 328 | break; |
328 | 329 | ||
329 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ | 330 | case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */ |
@@ -342,6 +343,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
342 | for (i = 0; | 343 | for (i = 0; |
343 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); | 344 | (i < acpi_gbl_integer_nybble_width) && (digit > 0); |
344 | i++) { | 345 | i++) { |
346 | |||
345 | /* Get the least significant 4-bit BCD digit */ | 347 | /* Get the least significant 4-bit BCD digit */ |
346 | 348 | ||
347 | temp32 = ((u32) digit) & 0xF; | 349 | temp32 = ((u32) digit) & 0xF; |
@@ -487,6 +489,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
487 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 489 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
488 | ACPI_EXPLICIT_CONVERT_DECIMAL); | 490 | ACPI_EXPLICIT_CONVERT_DECIMAL); |
489 | if (return_desc == operand[0]) { | 491 | if (return_desc == operand[0]) { |
492 | |||
490 | /* No conversion performed, add ref to handle return value */ | 493 | /* No conversion performed, add ref to handle return value */ |
491 | acpi_ut_add_reference(return_desc); | 494 | acpi_ut_add_reference(return_desc); |
492 | } | 495 | } |
@@ -497,6 +500,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
497 | status = acpi_ex_convert_to_string(operand[0], &return_desc, | 500 | status = acpi_ex_convert_to_string(operand[0], &return_desc, |
498 | ACPI_EXPLICIT_CONVERT_HEX); | 501 | ACPI_EXPLICIT_CONVERT_HEX); |
499 | if (return_desc == operand[0]) { | 502 | if (return_desc == operand[0]) { |
503 | |||
500 | /* No conversion performed, add ref to handle return value */ | 504 | /* No conversion performed, add ref to handle return value */ |
501 | acpi_ut_add_reference(return_desc); | 505 | acpi_ut_add_reference(return_desc); |
502 | } | 506 | } |
@@ -506,6 +510,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
506 | 510 | ||
507 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); | 511 | status = acpi_ex_convert_to_buffer(operand[0], &return_desc); |
508 | if (return_desc == operand[0]) { | 512 | if (return_desc == operand[0]) { |
513 | |||
509 | /* No conversion performed, add ref to handle return value */ | 514 | /* No conversion performed, add ref to handle return value */ |
510 | acpi_ut_add_reference(return_desc); | 515 | acpi_ut_add_reference(return_desc); |
511 | } | 516 | } |
@@ -516,6 +521,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
516 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, | 521 | status = acpi_ex_convert_to_integer(operand[0], &return_desc, |
517 | ACPI_ANY_BASE); | 522 | ACPI_ANY_BASE); |
518 | if (return_desc == operand[0]) { | 523 | if (return_desc == operand[0]) { |
524 | |||
519 | /* No conversion performed, add ref to handle return value */ | 525 | /* No conversion performed, add ref to handle return value */ |
520 | acpi_ut_add_reference(return_desc); | 526 | acpi_ut_add_reference(return_desc); |
521 | } | 527 | } |
@@ -541,6 +547,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
541 | } | 547 | } |
542 | 548 | ||
543 | if (ACPI_SUCCESS(status)) { | 549 | if (ACPI_SUCCESS(status)) { |
550 | |||
544 | /* Store the return value computed above into the target object */ | 551 | /* Store the return value computed above into the target object */ |
545 | 552 | ||
546 | status = acpi_ex_store(return_desc, operand[1], walk_state); | 553 | status = acpi_ex_store(return_desc, operand[1], walk_state); |
@@ -548,16 +555,18 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) | |||
548 | 555 | ||
549 | cleanup: | 556 | cleanup: |
550 | 557 | ||
551 | if (!walk_state->result_obj) { | ||
552 | walk_state->result_obj = return_desc; | ||
553 | } | ||
554 | |||
555 | /* Delete return object on error */ | 558 | /* Delete return object on error */ |
556 | 559 | ||
557 | if (ACPI_FAILURE(status)) { | 560 | if (ACPI_FAILURE(status)) { |
558 | acpi_ut_remove_reference(return_desc); | 561 | acpi_ut_remove_reference(return_desc); |
559 | } | 562 | } |
560 | 563 | ||
564 | /* Save return object on success */ | ||
565 | |||
566 | else if (!walk_state->result_obj) { | ||
567 | walk_state->result_obj = return_desc; | ||
568 | } | ||
569 | |||
561 | return_ACPI_STATUS(status); | 570 | return_ACPI_STATUS(status); |
562 | } | 571 | } |
563 | 572 | ||
@@ -582,7 +591,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
582 | u32 type; | 591 | u32 type; |
583 | acpi_integer value; | 592 | acpi_integer value; |
584 | 593 | ||
585 | ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R", | 594 | ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R, |
586 | acpi_ps_get_opcode_name(walk_state->opcode)); | 595 | acpi_ps_get_opcode_name(walk_state->opcode)); |
587 | 596 | ||
588 | /* Examine the AML opcode */ | 597 | /* Examine the AML opcode */ |
@@ -625,6 +634,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
625 | temp_desc = operand[0]; | 634 | temp_desc = operand[0]; |
626 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == | 635 | if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) == |
627 | ACPI_DESC_TYPE_OPERAND) { | 636 | ACPI_DESC_TYPE_OPERAND) { |
637 | |||
628 | /* Internal reference object - prevent deletion */ | 638 | /* Internal reference object - prevent deletion */ |
629 | 639 | ||
630 | acpi_ut_add_reference(temp_desc); | 640 | acpi_ut_add_reference(temp_desc); |
@@ -689,6 +699,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
689 | if (ACPI_FAILURE(status)) { | 699 | if (ACPI_FAILURE(status)) { |
690 | goto cleanup; | 700 | goto cleanup; |
691 | } | 701 | } |
702 | |||
692 | /* Allocate a descriptor to hold the type. */ | 703 | /* Allocate a descriptor to hold the type. */ |
693 | 704 | ||
694 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 705 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
@@ -777,8 +788,25 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
777 | 788 | ||
778 | /* Check for a method local or argument, or standalone String */ | 789 | /* Check for a method local or argument, or standalone String */ |
779 | 790 | ||
780 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | 791 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) == |
781 | ACPI_DESC_TYPE_NAMED) { | 792 | ACPI_DESC_TYPE_NAMED) { |
793 | temp_desc = | ||
794 | acpi_ns_get_attached_object((struct | ||
795 | acpi_namespace_node *) | ||
796 | operand[0]); | ||
797 | if (temp_desc | ||
798 | && | ||
799 | ((ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
800 | ACPI_TYPE_STRING) | ||
801 | || (ACPI_GET_OBJECT_TYPE(temp_desc) == | ||
802 | ACPI_TYPE_LOCAL_REFERENCE))) { | ||
803 | operand[0] = temp_desc; | ||
804 | acpi_ut_add_reference(temp_desc); | ||
805 | } else { | ||
806 | status = AE_AML_OPERAND_TYPE; | ||
807 | goto cleanup; | ||
808 | } | ||
809 | } else { | ||
782 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | 810 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { |
783 | case ACPI_TYPE_LOCAL_REFERENCE: | 811 | case ACPI_TYPE_LOCAL_REFERENCE: |
784 | /* | 812 | /* |
@@ -827,26 +855,35 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
827 | break; | 855 | break; |
828 | 856 | ||
829 | case ACPI_TYPE_STRING: | 857 | case ACPI_TYPE_STRING: |
858 | break; | ||
830 | 859 | ||
860 | default: | ||
861 | status = AE_AML_OPERAND_TYPE; | ||
862 | goto cleanup; | ||
863 | } | ||
864 | } | ||
865 | |||
866 | if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) != | ||
867 | ACPI_DESC_TYPE_NAMED) { | ||
868 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == | ||
869 | ACPI_TYPE_STRING) { | ||
831 | /* | 870 | /* |
832 | * This is a deref_of (String). The string is a reference | 871 | * This is a deref_of (String). The string is a reference |
833 | * to a named ACPI object. | 872 | * to a named ACPI object. |
834 | * | 873 | * |
835 | * 1) Find the owning Node | 874 | * 1) Find the owning Node |
836 | * 2) Dereference the node to an actual object. Could be a | 875 | * 2) Dereference the node to an actual object. Could be a |
837 | * Field, so we need to resolve the node to a value. | 876 | * Field, so we need to resolve the node to a value. |
838 | */ | 877 | */ |
839 | status = | 878 | status = |
840 | acpi_ns_get_node_by_path(operand[0]->string. | 879 | acpi_ns_get_node(walk_state->scope_info-> |
841 | pointer, | 880 | scope.node, |
842 | walk_state-> | 881 | operand[0]->string.pointer, |
843 | scope_info->scope. | 882 | ACPI_NS_SEARCH_PARENT, |
844 | node, | 883 | ACPI_CAST_INDIRECT_PTR |
845 | ACPI_NS_SEARCH_PARENT, | 884 | (struct |
846 | ACPI_CAST_INDIRECT_PTR | 885 | acpi_namespace_node, |
847 | (struct | 886 | &return_desc)); |
848 | acpi_namespace_node, | ||
849 | &return_desc)); | ||
850 | if (ACPI_FAILURE(status)) { | 887 | if (ACPI_FAILURE(status)) { |
851 | goto cleanup; | 888 | goto cleanup; |
852 | } | 889 | } |
@@ -857,11 +894,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
857 | (struct acpi_namespace_node, &return_desc), | 894 | (struct acpi_namespace_node, &return_desc), |
858 | walk_state); | 895 | walk_state); |
859 | goto cleanup; | 896 | goto cleanup; |
860 | |||
861 | default: | ||
862 | |||
863 | status = AE_AML_OPERAND_TYPE; | ||
864 | goto cleanup; | ||
865 | } | 897 | } |
866 | } | 898 | } |
867 | 899 | ||
@@ -937,13 +969,12 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
937 | acpi_ut_add_reference | 969 | acpi_ut_add_reference |
938 | (return_desc); | 970 | (return_desc); |
939 | } | 971 | } |
940 | |||
941 | break; | 972 | break; |
942 | 973 | ||
943 | default: | 974 | default: |
944 | 975 | ||
945 | ACPI_ERROR((AE_INFO, | 976 | ACPI_ERROR((AE_INFO, |
946 | "Unknown Index target_type %X in obj %p", | 977 | "Unknown Index TargetType %X in obj %p", |
947 | operand[0]->reference. | 978 | operand[0]->reference. |
948 | target_type, operand[0])); | 979 | target_type, operand[0])); |
949 | status = AE_AML_OPERAND_TYPE; | 980 | status = AE_AML_OPERAND_TYPE; |
@@ -957,7 +988,6 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
957 | 988 | ||
958 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == | 989 | if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) == |
959 | ACPI_DESC_TYPE_NAMED) { | 990 | ACPI_DESC_TYPE_NAMED) { |
960 | |||
961 | return_desc = | 991 | return_desc = |
962 | acpi_ns_get_attached_object((struct | 992 | acpi_ns_get_attached_object((struct |
963 | acpi_namespace_node | 993 | acpi_namespace_node |
@@ -972,7 +1002,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
972 | 1002 | ||
973 | default: | 1003 | default: |
974 | ACPI_ERROR((AE_INFO, | 1004 | ACPI_ERROR((AE_INFO, |
975 | "Unknown opcode in ref(%p) - %X", | 1005 | "Unknown opcode in reference(%p) - %X", |
976 | operand[0], | 1006 | operand[0], |
977 | operand[0]->reference.opcode)); | 1007 | operand[0]->reference.opcode)); |
978 | 1008 | ||
@@ -998,6 +1028,11 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
998 | acpi_ut_remove_reference(return_desc); | 1028 | acpi_ut_remove_reference(return_desc); |
999 | } | 1029 | } |
1000 | 1030 | ||
1001 | walk_state->result_obj = return_desc; | 1031 | /* Save return object on success */ |
1032 | |||
1033 | else { | ||
1034 | walk_state->result_obj = return_desc; | ||
1035 | } | ||
1036 | |||
1002 | return_ACPI_STATUS(status); | 1037 | return_ACPI_STATUS(status); |
1003 | } | 1038 | } |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index e263a5ddd405..7d2cbc113160 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -92,7 +92,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
92 | u32 value; | 92 | u32 value; |
93 | acpi_status status = AE_OK; | 93 | acpi_status status = AE_OK; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R", | 95 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_0R, |
96 | acpi_ps_get_opcode_name(walk_state->opcode)); | 96 | acpi_ps_get_opcode_name(walk_state->opcode)); |
97 | 97 | ||
98 | /* Examine the opcode */ | 98 | /* Examine the opcode */ |
@@ -121,7 +121,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
121 | #ifdef ACPI_GPE_NOTIFY_CHECK | 121 | #ifdef ACPI_GPE_NOTIFY_CHECK |
122 | /* | 122 | /* |
123 | * GPE method wake/notify check. Here, we want to ensure that we | 123 | * GPE method wake/notify check. Here, we want to ensure that we |
124 | * don't receive any "device_wake" Notifies from a GPE _Lxx or _Exx | 124 | * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx |
125 | * GPE method during system runtime. If we do, the GPE is marked | 125 | * GPE method during system runtime. If we do, the GPE is marked |
126 | * as "wake-only" and disabled. | 126 | * as "wake-only" and disabled. |
127 | * | 127 | * |
@@ -138,6 +138,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state) | |||
138 | acpi_ev_check_for_wake_only_gpe(walk_state-> | 138 | acpi_ev_check_for_wake_only_gpe(walk_state-> |
139 | gpe_event_info); | 139 | gpe_event_info); |
140 | if (ACPI_FAILURE(status)) { | 140 | if (ACPI_FAILURE(status)) { |
141 | |||
141 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ | 142 | /* AE_WAKE_ONLY_GPE only error, means ignore this notify */ |
142 | 143 | ||
143 | return_ACPI_STATUS(AE_OK) | 144 | return_ACPI_STATUS(AE_OK) |
@@ -185,7 +186,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
185 | union acpi_operand_object *return_desc2 = NULL; | 186 | union acpi_operand_object *return_desc2 = NULL; |
186 | acpi_status status; | 187 | acpi_status status; |
187 | 188 | ||
188 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R", | 189 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_2T_1R, |
189 | acpi_ps_get_opcode_name(walk_state->opcode)); | 190 | acpi_ps_get_opcode_name(walk_state->opcode)); |
190 | 191 | ||
191 | /* Execute the opcode */ | 192 | /* Execute the opcode */ |
@@ -252,6 +253,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
252 | acpi_ut_remove_reference(return_desc2); | 253 | acpi_ut_remove_reference(return_desc2); |
253 | 254 | ||
254 | if (ACPI_FAILURE(status)) { | 255 | if (ACPI_FAILURE(status)) { |
256 | |||
255 | /* Delete the return object */ | 257 | /* Delete the return object */ |
256 | 258 | ||
257 | acpi_ut_remove_reference(return_desc1); | 259 | acpi_ut_remove_reference(return_desc1); |
@@ -281,12 +283,13 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
281 | acpi_status status = AE_OK; | 283 | acpi_status status = AE_OK; |
282 | acpi_size length; | 284 | acpi_size length; |
283 | 285 | ||
284 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R", | 286 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R, |
285 | acpi_ps_get_opcode_name(walk_state->opcode)); | 287 | acpi_ps_get_opcode_name(walk_state->opcode)); |
286 | 288 | ||
287 | /* Execute the opcode */ | 289 | /* Execute the opcode */ |
288 | 290 | ||
289 | if (walk_state->op_info->flags & AML_MATH) { | 291 | if (walk_state->op_info->flags & AML_MATH) { |
292 | |||
290 | /* All simple math opcodes (add, etc.) */ | 293 | /* All simple math opcodes (add, etc.) */ |
291 | 294 | ||
292 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 295 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
@@ -383,54 +386,70 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
383 | goto cleanup; | 386 | goto cleanup; |
384 | } | 387 | } |
385 | 388 | ||
389 | /* Initialize the Index reference object */ | ||
390 | |||
386 | index = operand[1]->integer.value; | 391 | index = operand[1]->integer.value; |
392 | return_desc->reference.offset = (u32) index; | ||
393 | return_desc->reference.opcode = AML_INDEX_OP; | ||
387 | 394 | ||
388 | /* At this point, the Source operand is a Package, Buffer, or String */ | 395 | /* |
396 | * At this point, the Source operand is a String, Buffer, or Package. | ||
397 | * Verify that the index is within range. | ||
398 | */ | ||
399 | switch (ACPI_GET_OBJECT_TYPE(operand[0])) { | ||
400 | case ACPI_TYPE_STRING: | ||
389 | 401 | ||
390 | if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) { | 402 | if (index >= operand[0]->string.length) { |
391 | /* Object to be indexed is a Package */ | 403 | status = AE_AML_STRING_LIMIT; |
404 | } | ||
405 | |||
406 | return_desc->reference.target_type = | ||
407 | ACPI_TYPE_BUFFER_FIELD; | ||
408 | break; | ||
409 | |||
410 | case ACPI_TYPE_BUFFER: | ||
411 | |||
412 | if (index >= operand[0]->buffer.length) { | ||
413 | status = AE_AML_BUFFER_LIMIT; | ||
414 | } | ||
415 | |||
416 | return_desc->reference.target_type = | ||
417 | ACPI_TYPE_BUFFER_FIELD; | ||
418 | break; | ||
419 | |||
420 | case ACPI_TYPE_PACKAGE: | ||
392 | 421 | ||
393 | if (index >= operand[0]->package.count) { | 422 | if (index >= operand[0]->package.count) { |
394 | ACPI_ERROR((AE_INFO, | ||
395 | "Index value (%X%8.8X) beyond package end (%X)", | ||
396 | ACPI_FORMAT_UINT64(index), | ||
397 | operand[0]->package.count)); | ||
398 | status = AE_AML_PACKAGE_LIMIT; | 423 | status = AE_AML_PACKAGE_LIMIT; |
399 | goto cleanup; | ||
400 | } | 424 | } |
401 | 425 | ||
402 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; | 426 | return_desc->reference.target_type = ACPI_TYPE_PACKAGE; |
403 | return_desc->reference.object = operand[0]; | ||
404 | return_desc->reference.where = | 427 | return_desc->reference.where = |
405 | &operand[0]->package.elements[index]; | 428 | &operand[0]->package.elements[index]; |
406 | } else { | 429 | break; |
407 | /* Object to be indexed is a Buffer/String */ | ||
408 | 430 | ||
409 | if (index >= operand[0]->buffer.length) { | 431 | default: |
410 | ACPI_ERROR((AE_INFO, | ||
411 | "Index value (%X%8.8X) beyond end of buffer (%X)", | ||
412 | ACPI_FORMAT_UINT64(index), | ||
413 | operand[0]->buffer.length)); | ||
414 | status = AE_AML_BUFFER_LIMIT; | ||
415 | goto cleanup; | ||
416 | } | ||
417 | 432 | ||
418 | return_desc->reference.target_type = | 433 | status = AE_AML_INTERNAL; |
419 | ACPI_TYPE_BUFFER_FIELD; | 434 | goto cleanup; |
420 | return_desc->reference.object = operand[0]; | 435 | } |
436 | |||
437 | /* Failure means that the Index was beyond the end of the object */ | ||
438 | |||
439 | if (ACPI_FAILURE(status)) { | ||
440 | ACPI_EXCEPTION((AE_INFO, status, | ||
441 | "Index (%X%8.8X) is beyond end of object", | ||
442 | ACPI_FORMAT_UINT64(index))); | ||
443 | goto cleanup; | ||
421 | } | 444 | } |
422 | 445 | ||
423 | /* | 446 | /* |
424 | * Add a reference to the target package/buffer/string for the life | 447 | * Save the target object and add a reference to it for the life |
425 | * of the index. | 448 | * of the index |
426 | */ | 449 | */ |
450 | return_desc->reference.object = operand[0]; | ||
427 | acpi_ut_add_reference(operand[0]); | 451 | acpi_ut_add_reference(operand[0]); |
428 | 452 | ||
429 | /* Complete the Index reference object */ | ||
430 | |||
431 | return_desc->reference.opcode = AML_INDEX_OP; | ||
432 | return_desc->reference.offset = (u32) index; | ||
433 | |||
434 | /* Store the reference to the Target */ | 453 | /* Store the reference to the Target */ |
435 | 454 | ||
436 | status = acpi_ex_store(return_desc, operand[2], walk_state); | 455 | status = acpi_ex_store(return_desc, operand[2], walk_state); |
@@ -495,7 +514,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
495 | acpi_status status = AE_OK; | 514 | acpi_status status = AE_OK; |
496 | u8 logical_result = FALSE; | 515 | u8 logical_result = FALSE; |
497 | 516 | ||
498 | ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R", | 517 | ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_1R, |
499 | acpi_ps_get_opcode_name(walk_state->opcode)); | 518 | acpi_ps_get_opcode_name(walk_state->opcode)); |
500 | 519 | ||
501 | /* Create the internal return object */ | 520 | /* Create the internal return object */ |
@@ -509,6 +528,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
509 | /* Execute the Opcode */ | 528 | /* Execute the Opcode */ |
510 | 529 | ||
511 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { | 530 | if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) { |
531 | |||
512 | /* logical_op (Operand0, Operand1) */ | 532 | /* logical_op (Operand0, Operand1) */ |
513 | 533 | ||
514 | status = acpi_ex_do_logical_numeric_op(walk_state->opcode, | 534 | status = acpi_ex_do_logical_numeric_op(walk_state->opcode, |
@@ -518,6 +538,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
518 | value, &logical_result); | 538 | value, &logical_result); |
519 | goto store_logical_result; | 539 | goto store_logical_result; |
520 | } else if (walk_state->op_info->flags & AML_LOGICAL) { | 540 | } else if (walk_state->op_info->flags & AML_LOGICAL) { |
541 | |||
521 | /* logical_op (Operand0, Operand1) */ | 542 | /* logical_op (Operand0, Operand1) */ |
522 | 543 | ||
523 | status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], | 544 | status = acpi_ex_do_logical_op(walk_state->opcode, operand[0], |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 6a3a883cb8a3..e2d945dfd509 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -88,20 +88,19 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
88 | struct acpi_signal_fatal_info *fatal; | 88 | struct acpi_signal_fatal_info *fatal; |
89 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
90 | 90 | ||
91 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R", | 91 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_0T_0R, |
92 | acpi_ps_get_opcode_name(walk_state->opcode)); | 92 | acpi_ps_get_opcode_name(walk_state->opcode)); |
93 | 93 | ||
94 | switch (walk_state->opcode) { | 94 | switch (walk_state->opcode) { |
95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ | 95 | case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ |
96 | 96 | ||
97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 97 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
98 | "fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", | 98 | "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", |
99 | (u32) operand[0]->integer.value, | 99 | (u32) operand[0]->integer.value, |
100 | (u32) operand[1]->integer.value, | 100 | (u32) operand[1]->integer.value, |
101 | (u32) operand[2]->integer.value)); | 101 | (u32) operand[2]->integer.value)); |
102 | 102 | ||
103 | fatal = | 103 | fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); |
104 | ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); | ||
105 | if (fatal) { | 104 | if (fatal) { |
106 | fatal->type = (u32) operand[0]->integer.value; | 105 | fatal->type = (u32) operand[0]->integer.value; |
107 | fatal->code = (u32) operand[1]->integer.value; | 106 | fatal->code = (u32) operand[1]->integer.value; |
@@ -114,7 +113,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) | |||
114 | 113 | ||
115 | /* Might return while OS is shutting down, just continue */ | 114 | /* Might return while OS is shutting down, just continue */ |
116 | 115 | ||
117 | ACPI_MEM_FREE(fatal); | 116 | ACPI_FREE(fatal); |
118 | break; | 117 | break; |
119 | 118 | ||
120 | default: | 119 | default: |
@@ -151,7 +150,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
151 | acpi_integer index; | 150 | acpi_integer index; |
152 | acpi_size length; | 151 | acpi_size length; |
153 | 152 | ||
154 | ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R", | 153 | ACPI_FUNCTION_TRACE_STR(ex_opcode_3A_1T_1R, |
155 | acpi_ps_get_opcode_name(walk_state->opcode)); | 154 | acpi_ps_get_opcode_name(walk_state->opcode)); |
156 | 155 | ||
157 | switch (walk_state->opcode) { | 156 | switch (walk_state->opcode) { |
@@ -196,7 +195,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
196 | 195 | ||
197 | /* Always allocate a new buffer for the String */ | 196 | /* Always allocate a new buffer for the String */ |
198 | 197 | ||
199 | buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1); | 198 | buffer = ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); |
200 | if (!buffer) { | 199 | if (!buffer) { |
201 | status = AE_NO_MEMORY; | 200 | status = AE_NO_MEMORY; |
202 | goto cleanup; | 201 | goto cleanup; |
@@ -208,9 +207,10 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
208 | /* If the requested length is zero, don't allocate a buffer */ | 207 | /* If the requested length is zero, don't allocate a buffer */ |
209 | 208 | ||
210 | if (length > 0) { | 209 | if (length > 0) { |
210 | |||
211 | /* Allocate a new buffer for the Buffer */ | 211 | /* Allocate a new buffer for the Buffer */ |
212 | 212 | ||
213 | buffer = ACPI_MEM_CALLOCATE(length); | 213 | buffer = ACPI_ALLOCATE_ZEROED(length); |
214 | if (!buffer) { | 214 | if (!buffer) { |
215 | status = AE_NO_MEMORY; | 215 | status = AE_NO_MEMORY; |
216 | goto cleanup; | 216 | goto cleanup; |
@@ -225,6 +225,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
225 | } | 225 | } |
226 | 226 | ||
227 | if (buffer) { | 227 | if (buffer) { |
228 | |||
228 | /* We have a buffer, copy the portion requested */ | 229 | /* We have a buffer, copy the portion requested */ |
229 | 230 | ||
230 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, | 231 | ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index e043d924444f..f0c0ba6eb408 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -220,7 +220,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
220 | acpi_integer index; | 220 | acpi_integer index; |
221 | union acpi_operand_object *this_element; | 221 | union acpi_operand_object *this_element; |
222 | 222 | ||
223 | ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R", | 223 | ACPI_FUNCTION_TRACE_STR(ex_opcode_6A_0T_1R, |
224 | acpi_ps_get_opcode_name(walk_state->opcode)); | 224 | acpi_ps_get_opcode_name(walk_state->opcode)); |
225 | 225 | ||
226 | switch (walk_state->opcode) { | 226 | switch (walk_state->opcode) { |
@@ -276,6 +276,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
276 | * match was found. | 276 | * match was found. |
277 | */ | 277 | */ |
278 | for (; index < operand[0]->package.count; index++) { | 278 | for (; index < operand[0]->package.count; index++) { |
279 | |||
279 | /* Get the current package element */ | 280 | /* Get the current package element */ |
280 | 281 | ||
281 | this_element = operand[0]->package.elements[index]; | 282 | this_element = operand[0]->package.elements[index]; |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index 7719ae5d4f16..44d064f427b9 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -97,7 +97,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
97 | u32 minimum_accesses = 0xFFFFFFFF; | 97 | u32 minimum_accesses = 0xFFFFFFFF; |
98 | u32 accesses; | 98 | u32 accesses; |
99 | 99 | ||
100 | ACPI_FUNCTION_TRACE("ex_generate_access"); | 100 | ACPI_FUNCTION_TRACE(ex_generate_access); |
101 | 101 | ||
102 | /* Round Field start offset and length to "minimal" byte boundaries */ | 102 | /* Round Field start offset and length to "minimal" byte boundaries */ |
103 | 103 | ||
@@ -146,7 +146,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
146 | accesses = field_end_offset - field_start_offset; | 146 | accesses = field_end_offset - field_start_offset; |
147 | 147 | ||
148 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 148 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
149 | "access_width %d end is within region\n", | 149 | "AccessWidth %d end is within region\n", |
150 | access_byte_width)); | 150 | access_byte_width)); |
151 | 151 | ||
152 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 152 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
@@ -173,7 +173,7 @@ acpi_ex_generate_access(u32 field_bit_offset, | |||
173 | } | 173 | } |
174 | } else { | 174 | } else { |
175 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 175 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
176 | "access_width %d end is NOT within region\n", | 176 | "AccessWidth %d end is NOT within region\n", |
177 | access_byte_width)); | 177 | access_byte_width)); |
178 | if (access_byte_width == 1) { | 178 | if (access_byte_width == 1) { |
179 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 179 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
@@ -228,7 +228,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, | |||
228 | u32 byte_alignment; | 228 | u32 byte_alignment; |
229 | u32 bit_length; | 229 | u32 bit_length; |
230 | 230 | ||
231 | ACPI_FUNCTION_TRACE("ex_decode_field_access"); | 231 | ACPI_FUNCTION_TRACE(ex_decode_field_access); |
232 | 232 | ||
233 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); | 233 | access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK); |
234 | 234 | ||
@@ -322,7 +322,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
322 | u32 byte_alignment; | 322 | u32 byte_alignment; |
323 | u32 nearest_byte_address; | 323 | u32 nearest_byte_address; |
324 | 324 | ||
325 | ACPI_FUNCTION_TRACE("ex_prep_common_field_object"); | 325 | ACPI_FUNCTION_TRACE(ex_prep_common_field_object); |
326 | 326 | ||
327 | /* | 327 | /* |
328 | * Note: the structure being initialized is the | 328 | * Note: the structure being initialized is the |
@@ -415,13 +415,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
415 | u32 type; | 415 | u32 type; |
416 | acpi_status status; | 416 | acpi_status status; |
417 | 417 | ||
418 | ACPI_FUNCTION_TRACE("ex_prep_field_value"); | 418 | ACPI_FUNCTION_TRACE(ex_prep_field_value); |
419 | 419 | ||
420 | /* Parameter validation */ | 420 | /* Parameter validation */ |
421 | 421 | ||
422 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { | 422 | if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { |
423 | if (!info->region_node) { | 423 | if (!info->region_node) { |
424 | ACPI_ERROR((AE_INFO, "Null region_node")); | 424 | ACPI_ERROR((AE_INFO, "Null RegionNode")); |
425 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | 425 | return_ACPI_STATUS(AE_AML_NO_OPERAND); |
426 | } | 426 | } |
427 | 427 | ||
@@ -467,7 +467,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
467 | acpi_ut_add_reference(obj_desc->field.region_obj); | 467 | acpi_ut_add_reference(obj_desc->field.region_obj); |
468 | 468 | ||
469 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 469 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
470 | "region_field: bit_off %X, Off %X, Gran %X, Region %p\n", | 470 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
471 | obj_desc->field.start_field_bit_offset, | 471 | obj_desc->field.start_field_bit_offset, |
472 | obj_desc->field.base_byte_offset, | 472 | obj_desc->field.base_byte_offset, |
473 | obj_desc->field.access_byte_width, | 473 | obj_desc->field.access_byte_width, |
@@ -488,7 +488,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
488 | acpi_ut_add_reference(obj_desc->bank_field.bank_obj); | 488 | acpi_ut_add_reference(obj_desc->bank_field.bank_obj); |
489 | 489 | ||
490 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 490 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
491 | "Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n", | 491 | "Bank Field: BitOff %X, Off %X, Gran %X, Region %p, BankReg %p\n", |
492 | obj_desc->bank_field.start_field_bit_offset, | 492 | obj_desc->bank_field.start_field_bit_offset, |
493 | obj_desc->bank_field.base_byte_offset, | 493 | obj_desc->bank_field.base_byte_offset, |
494 | obj_desc->field.access_byte_width, | 494 | obj_desc->field.access_byte_width, |
@@ -519,16 +519,29 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
519 | acpi_ut_add_reference(obj_desc->index_field.index_obj); | 519 | acpi_ut_add_reference(obj_desc->index_field.index_obj); |
520 | 520 | ||
521 | /* | 521 | /* |
522 | * April 2006: Changed to match MS behavior | ||
523 | * | ||
522 | * The value written to the Index register is the byte offset of the | 524 | * The value written to the Index register is the byte offset of the |
523 | * target field | 525 | * target field in units of the granularity of the index_field |
524 | * Note: may change code to: ACPI_DIV_8 (Info->field_bit_position) | 526 | * |
527 | * Previously, the value was calculated as an index in terms of the | ||
528 | * width of the Data register, as below: | ||
529 | * | ||
530 | * obj_desc->index_field.Value = (u32) | ||
531 | * (Info->field_bit_position / ACPI_MUL_8 ( | ||
532 | * obj_desc->Field.access_byte_width)); | ||
533 | * | ||
534 | * February 2006: Tried value as a byte offset: | ||
535 | * obj_desc->index_field.Value = (u32) | ||
536 | * ACPI_DIV_8 (Info->field_bit_position); | ||
525 | */ | 537 | */ |
526 | obj_desc->index_field.value = (u32) | 538 | obj_desc->index_field.value = |
527 | (info->field_bit_position / | 539 | (u32) ACPI_ROUND_DOWN(ACPI_DIV_8(info->field_bit_position), |
528 | ACPI_MUL_8(obj_desc->field.access_byte_width)); | 540 | obj_desc->index_field. |
541 | access_byte_width); | ||
529 | 542 | ||
530 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 543 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
531 | "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", | 544 | "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", |
532 | obj_desc->index_field.start_field_bit_offset, | 545 | obj_desc->index_field.start_field_bit_offset, |
533 | obj_desc->index_field.base_byte_offset, | 546 | obj_desc->index_field.base_byte_offset, |
534 | obj_desc->index_field.value, | 547 | obj_desc->index_field.value, |
@@ -550,7 +563,7 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
550 | acpi_ns_get_type(info->field_node)); | 563 | acpi_ns_get_type(info->field_node)); |
551 | 564 | ||
552 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 565 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
553 | "Set named_obj %p [%4.4s], obj_desc %p\n", | 566 | "Set NamedObj %p [%4.4s], ObjDesc %p\n", |
554 | info->field_node, | 567 | info->field_node, |
555 | acpi_ut_get_node_name(info->field_node), obj_desc)); | 568 | acpi_ut_get_node_name(info->field_node), obj_desc)); |
556 | 569 | ||
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 6a4cfdff606d..3cc97ba48b36 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -81,7 +81,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
81 | u32 remainder; | 81 | u32 remainder; |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("ex_system_memory_space_handler"); | 84 | ACPI_FUNCTION_TRACE(ex_system_memory_space_handler); |
85 | 85 | ||
86 | /* Validate and translate the bit width */ | 86 | /* Validate and translate the bit width */ |
87 | 87 | ||
@@ -103,7 +103,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
103 | break; | 103 | break; |
104 | 104 | ||
105 | default: | 105 | default: |
106 | ACPI_ERROR((AE_INFO, "Invalid system_memory width %d", | 106 | ACPI_ERROR((AE_INFO, "Invalid SystemMemory width %d", |
107 | bit_width)); | 107 | bit_width)); |
108 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); | 108 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
109 | } | 109 | } |
@@ -135,6 +135,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
135 | * Delete the existing mapping and create a new one. | 135 | * Delete the existing mapping and create a new one. |
136 | */ | 136 | */ |
137 | if (mem_info->mapped_length) { | 137 | if (mem_info->mapped_length) { |
138 | |||
138 | /* Valid mapping, delete it */ | 139 | /* Valid mapping, delete it */ |
139 | 140 | ||
140 | acpi_os_unmap_memory(mem_info->mapped_logical_address, | 141 | acpi_os_unmap_memory(mem_info->mapped_logical_address, |
@@ -181,8 +182,8 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
181 | (acpi_integer) mem_info->mapped_physical_address); | 182 | (acpi_integer) mem_info->mapped_physical_address); |
182 | 183 | ||
183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 184 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
184 | "system_memory %d (%d width) Address=%8.8X%8.8X\n", | 185 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", |
185 | function, bit_width, ACPI_FORMAT_UINT64(address))); | 186 | bit_width, function, ACPI_FORMAT_UINT64(address))); |
186 | 187 | ||
187 | /* | 188 | /* |
188 | * Perform the memory read or write | 189 | * Perform the memory read or write |
@@ -283,11 +284,11 @@ acpi_ex_system_io_space_handler(u32 function, | |||
283 | acpi_status status = AE_OK; | 284 | acpi_status status = AE_OK; |
284 | u32 value32; | 285 | u32 value32; |
285 | 286 | ||
286 | ACPI_FUNCTION_TRACE("ex_system_io_space_handler"); | 287 | ACPI_FUNCTION_TRACE(ex_system_io_space_handler); |
287 | 288 | ||
288 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 289 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
289 | "system_iO %d (%d width) Address=%8.8X%8.8X\n", | 290 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", |
290 | function, bit_width, ACPI_FORMAT_UINT64(address))); | 291 | bit_width, function, ACPI_FORMAT_UINT64(address))); |
291 | 292 | ||
292 | /* Decode the function parameter */ | 293 | /* Decode the function parameter */ |
293 | 294 | ||
@@ -342,7 +343,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
342 | struct acpi_pci_id *pci_id; | 343 | struct acpi_pci_id *pci_id; |
343 | u16 pci_register; | 344 | u16 pci_register; |
344 | 345 | ||
345 | ACPI_FUNCTION_TRACE("ex_pci_config_space_handler"); | 346 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); |
346 | 347 | ||
347 | /* | 348 | /* |
348 | * The arguments to acpi_os(Read|Write)pci_configuration are: | 349 | * The arguments to acpi_os(Read|Write)pci_configuration are: |
@@ -360,7 +361,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
360 | pci_register = (u16) (u32) address; | 361 | pci_register = (u16) (u32) address; |
361 | 362 | ||
362 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 363 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
363 | "pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", | 364 | "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", |
364 | function, bit_width, pci_id->segment, pci_id->bus, | 365 | function, bit_width, pci_id->segment, pci_id->bus, |
365 | pci_id->device, pci_id->function, pci_register)); | 366 | pci_id->device, pci_id->function, pci_register)); |
366 | 367 | ||
@@ -414,7 +415,7 @@ acpi_ex_cmos_space_handler(u32 function, | |||
414 | { | 415 | { |
415 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
416 | 417 | ||
417 | ACPI_FUNCTION_TRACE("ex_cmos_space_handler"); | 418 | ACPI_FUNCTION_TRACE(ex_cmos_space_handler); |
418 | 419 | ||
419 | return_ACPI_STATUS(status); | 420 | return_ACPI_STATUS(status); |
420 | } | 421 | } |
@@ -446,7 +447,7 @@ acpi_ex_pci_bar_space_handler(u32 function, | |||
446 | { | 447 | { |
447 | acpi_status status = AE_OK; | 448 | acpi_status status = AE_OK; |
448 | 449 | ||
449 | ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler"); | 450 | ACPI_FUNCTION_TRACE(ex_pci_bar_space_handler); |
450 | 451 | ||
451 | return_ACPI_STATUS(status); | 452 | return_ACPI_STATUS(status); |
452 | } | 453 | } |
@@ -476,23 +477,16 @@ acpi_ex_data_table_space_handler(u32 function, | |||
476 | acpi_integer * value, | 477 | acpi_integer * value, |
477 | void *handler_context, void *region_context) | 478 | void *handler_context, void *region_context) |
478 | { | 479 | { |
479 | acpi_status status = AE_OK; | 480 | ACPI_FUNCTION_TRACE(ex_data_table_space_handler); |
480 | u32 byte_width = ACPI_DIV_8(bit_width); | ||
481 | u32 i; | ||
482 | char *logical_addr_ptr; | ||
483 | |||
484 | ACPI_FUNCTION_TRACE("ex_data_table_space_handler"); | ||
485 | |||
486 | logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address); | ||
487 | 481 | ||
488 | /* Perform the memory read or write */ | 482 | /* Perform the memory read or write */ |
489 | 483 | ||
490 | switch (function) { | 484 | switch (function) { |
491 | case ACPI_READ: | 485 | case ACPI_READ: |
492 | 486 | ||
493 | for (i = 0; i < byte_width; i++) { | 487 | ACPI_MEMCPY(ACPI_CAST_PTR(char, value), |
494 | ((char *)value)[i] = logical_addr_ptr[i]; | 488 | ACPI_PHYSADDR_TO_PTR(address), |
495 | } | 489 | ACPI_DIV_8(bit_width)); |
496 | break; | 490 | break; |
497 | 491 | ||
498 | case ACPI_WRITE: | 492 | case ACPI_WRITE: |
@@ -501,5 +495,5 @@ acpi_ex_data_table_space_handler(u32 function, | |||
501 | return_ACPI_STATUS(AE_SUPPORT); | 495 | return_ACPI_STATUS(AE_SUPPORT); |
502 | } | 496 | } |
503 | 497 | ||
504 | return_ACPI_STATUS(status); | 498 | return_ACPI_STATUS(AE_OK); |
505 | } | 499 | } |
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 01b26c80d22b..3089b05a1368 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -87,7 +87,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
87 | struct acpi_namespace_node *node; | 87 | struct acpi_namespace_node *node; |
88 | acpi_object_type entry_type; | 88 | acpi_object_type entry_type; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_resolve_node_to_value"); | 90 | ACPI_FUNCTION_TRACE(ex_resolve_node_to_value); |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the | 93 | * The stack pointer points to a struct acpi_namespace_node (Node). Get the |
@@ -97,12 +97,13 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
97 | source_desc = acpi_ns_get_attached_object(node); | 97 | source_desc = acpi_ns_get_attached_object(node); |
98 | entry_type = acpi_ns_get_type((acpi_handle) node); | 98 | entry_type = acpi_ns_get_type((acpi_handle) node); |
99 | 99 | ||
100 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n", | 100 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p SourceDesc=%p [%s]\n", |
101 | node, source_desc, | 101 | node, source_desc, |
102 | acpi_ut_get_type_name(entry_type))); | 102 | acpi_ut_get_type_name(entry_type))); |
103 | 103 | ||
104 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || | 104 | if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) || |
105 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { | 105 | (entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) { |
106 | |||
106 | /* There is always exactly one level of indirection */ | 107 | /* There is always exactly one level of indirection */ |
107 | 108 | ||
108 | node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); | 109 | node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object); |
@@ -113,10 +114,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
113 | 114 | ||
114 | /* | 115 | /* |
115 | * Several object types require no further processing: | 116 | * Several object types require no further processing: |
116 | * 1) Devices rarely have an attached object, return the Node | 117 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node |
117 | * 2) Method locals and arguments have a pseudo-Node | 118 | * 2) Method locals and arguments have a pseudo-Node |
118 | */ | 119 | */ |
119 | if (entry_type == ACPI_TYPE_DEVICE || | 120 | if ((entry_type == ACPI_TYPE_DEVICE) || |
121 | (entry_type == ACPI_TYPE_THERMAL) || | ||
120 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { | 122 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { |
121 | return_ACPI_STATUS(AE_OK); | 123 | return_ACPI_STATUS(AE_OK); |
122 | } | 124 | } |
@@ -141,6 +143,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
141 | 143 | ||
142 | status = acpi_ds_get_package_arguments(source_desc); | 144 | status = acpi_ds_get_package_arguments(source_desc); |
143 | if (ACPI_SUCCESS(status)) { | 145 | if (ACPI_SUCCESS(status)) { |
146 | |||
144 | /* Return an additional reference to the object */ | 147 | /* Return an additional reference to the object */ |
145 | 148 | ||
146 | obj_desc = source_desc; | 149 | obj_desc = source_desc; |
@@ -158,6 +161,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
158 | 161 | ||
159 | status = acpi_ds_get_buffer_arguments(source_desc); | 162 | status = acpi_ds_get_buffer_arguments(source_desc); |
160 | if (ACPI_SUCCESS(status)) { | 163 | if (ACPI_SUCCESS(status)) { |
164 | |||
161 | /* Return an additional reference to the object */ | 165 | /* Return an additional reference to the object */ |
162 | 166 | ||
163 | obj_desc = source_desc; | 167 | obj_desc = source_desc; |
@@ -199,7 +203,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
199 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 203 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
200 | 204 | ||
201 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 205 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
202 | "field_read Node=%p source_desc=%p Type=%X\n", | 206 | "FieldRead Node=%p SourceDesc=%p Type=%X\n", |
203 | node, source_desc, entry_type)); | 207 | node, source_desc, entry_type)); |
204 | 208 | ||
205 | status = | 209 | status = |
@@ -213,7 +217,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
213 | case ACPI_TYPE_METHOD: | 217 | case ACPI_TYPE_METHOD: |
214 | case ACPI_TYPE_POWER: | 218 | case ACPI_TYPE_POWER: |
215 | case ACPI_TYPE_PROCESSOR: | 219 | case ACPI_TYPE_PROCESSOR: |
216 | case ACPI_TYPE_THERMAL: | ||
217 | case ACPI_TYPE_EVENT: | 220 | case ACPI_TYPE_EVENT: |
218 | case ACPI_TYPE_REGION: | 221 | case ACPI_TYPE_REGION: |
219 | 222 | ||
@@ -240,6 +243,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
240 | /* This is a ddb_handle */ | 243 | /* This is a ddb_handle */ |
241 | /* Return an additional reference to the object */ | 244 | /* Return an additional reference to the object */ |
242 | 245 | ||
246 | case AML_REF_OF_OP: | ||
247 | |||
243 | obj_desc = source_desc; | 248 | obj_desc = source_desc; |
244 | acpi_ut_add_reference(obj_desc); | 249 | acpi_ut_add_reference(obj_desc); |
245 | break; | 250 | break; |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 1deed492fe88..6499de878017 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -78,7 +78,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr, | |||
78 | { | 78 | { |
79 | acpi_status status; | 79 | acpi_status status; |
80 | 80 | ||
81 | ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); | 81 | ACPI_FUNCTION_TRACE_PTR(ex_resolve_to_value, stack_ptr); |
82 | 82 | ||
83 | if (!stack_ptr || !*stack_ptr) { | 83 | if (!stack_ptr || !*stack_ptr) { |
84 | ACPI_ERROR((AE_INFO, "Internal - null pointer")); | 84 | ACPI_ERROR((AE_INFO, "Internal - null pointer")); |
@@ -144,7 +144,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
144 | union acpi_operand_object *obj_desc; | 144 | union acpi_operand_object *obj_desc; |
145 | u16 opcode; | 145 | u16 opcode; |
146 | 146 | ||
147 | ACPI_FUNCTION_TRACE("ex_resolve_object_to_value"); | 147 | ACPI_FUNCTION_TRACE(ex_resolve_object_to_value); |
148 | 148 | ||
149 | stack_desc = *stack_ptr; | 149 | stack_desc = *stack_ptr; |
150 | 150 | ||
@@ -190,7 +190,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
190 | } | 190 | } |
191 | 191 | ||
192 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 192 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
193 | "[Arg/Local %X] value_obj is %p\n", | 193 | "[Arg/Local %X] ValueObj is %p\n", |
194 | stack_desc->reference.offset, | 194 | stack_desc->reference.offset, |
195 | obj_desc)); | 195 | obj_desc)); |
196 | 196 | ||
@@ -239,7 +239,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
239 | /* Invalid reference object */ | 239 | /* Invalid reference object */ |
240 | 240 | ||
241 | ACPI_ERROR((AE_INFO, | 241 | ACPI_ERROR((AE_INFO, |
242 | "Unknown target_type %X in Index/Reference obj %p", | 242 | "Unknown TargetType %X in Index/Reference obj %p", |
243 | stack_desc->reference.target_type, | 243 | stack_desc->reference.target_type, |
244 | stack_desc)); | 244 | stack_desc)); |
245 | status = AE_AML_INTERNAL; | 245 | status = AE_AML_INTERNAL; |
@@ -257,10 +257,24 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
257 | 257 | ||
258 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ | 258 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
259 | 259 | ||
260 | /* Get the object pointed to by the namespace node */ | 260 | /* Dereference the name */ |
261 | |||
262 | if ((stack_desc->reference.node->type == | ||
263 | ACPI_TYPE_DEVICE) | ||
264 | || (stack_desc->reference.node->type == | ||
265 | ACPI_TYPE_THERMAL)) { | ||
266 | |||
267 | /* These node types do not have 'real' subobjects */ | ||
268 | |||
269 | *stack_ptr = (void *)stack_desc->reference.node; | ||
270 | } else { | ||
271 | /* Get the object pointed to by the namespace node */ | ||
272 | |||
273 | *stack_ptr = | ||
274 | (stack_desc->reference.node)->object; | ||
275 | acpi_ut_add_reference(*stack_ptr); | ||
276 | } | ||
261 | 277 | ||
262 | *stack_ptr = (stack_desc->reference.node)->object; | ||
263 | acpi_ut_add_reference(*stack_ptr); | ||
264 | acpi_ut_remove_reference(stack_desc); | 278 | acpi_ut_remove_reference(stack_desc); |
265 | break; | 279 | break; |
266 | 280 | ||
@@ -293,7 +307,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
293 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 307 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
294 | 308 | ||
295 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 309 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
296 | "field_read source_desc=%p Type=%X\n", | 310 | "FieldRead SourceDesc=%p Type=%X\n", |
297 | stack_desc, | 311 | stack_desc, |
298 | ACPI_GET_OBJECT_TYPE(stack_desc))); | 312 | ACPI_GET_OBJECT_TYPE(stack_desc))); |
299 | 313 | ||
@@ -337,7 +351,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
337 | acpi_object_type type; | 351 | acpi_object_type type; |
338 | acpi_status status; | 352 | acpi_status status; |
339 | 353 | ||
340 | ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple"); | 354 | ACPI_FUNCTION_TRACE(acpi_ex_resolve_multiple); |
341 | 355 | ||
342 | /* Operand can be either a namespace node or an operand descriptor */ | 356 | /* Operand can be either a namespace node or an operand descriptor */ |
343 | 357 | ||
@@ -382,10 +396,16 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
382 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 396 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { |
383 | switch (obj_desc->reference.opcode) { | 397 | switch (obj_desc->reference.opcode) { |
384 | case AML_REF_OF_OP: | 398 | case AML_REF_OF_OP: |
399 | case AML_INT_NAMEPATH_OP: | ||
385 | 400 | ||
386 | /* Dereference the reference pointer */ | 401 | /* Dereference the reference pointer */ |
387 | 402 | ||
388 | node = obj_desc->reference.object; | 403 | if (obj_desc->reference.opcode == AML_REF_OF_OP) { |
404 | node = obj_desc->reference.object; | ||
405 | } else { /* AML_INT_NAMEPATH_OP */ | ||
406 | |||
407 | node = obj_desc->reference.node; | ||
408 | } | ||
389 | 409 | ||
390 | /* All "References" point to a NS node */ | 410 | /* All "References" point to a NS node */ |
391 | 411 | ||
@@ -401,6 +421,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
401 | 421 | ||
402 | obj_desc = acpi_ns_get_attached_object(node); | 422 | obj_desc = acpi_ns_get_attached_object(node); |
403 | if (!obj_desc) { | 423 | if (!obj_desc) { |
424 | |||
404 | /* No object, use the NS node type */ | 425 | /* No object, use the NS node type */ |
405 | 426 | ||
406 | type = acpi_ns_get_type(node); | 427 | type = acpi_ns_get_type(node); |
@@ -432,6 +453,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
432 | */ | 453 | */ |
433 | obj_desc = *(obj_desc->reference.where); | 454 | obj_desc = *(obj_desc->reference.where); |
434 | if (!obj_desc) { | 455 | if (!obj_desc) { |
456 | |||
435 | /* NULL package elements are allowed */ | 457 | /* NULL package elements are allowed */ |
436 | 458 | ||
437 | type = 0; /* Uninitialized */ | 459 | type = 0; /* Uninitialized */ |
@@ -439,39 +461,6 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
439 | } | 461 | } |
440 | break; | 462 | break; |
441 | 463 | ||
442 | case AML_INT_NAMEPATH_OP: | ||
443 | |||
444 | /* Dereference the reference pointer */ | ||
445 | |||
446 | node = obj_desc->reference.node; | ||
447 | |||
448 | /* All "References" point to a NS node */ | ||
449 | |||
450 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != | ||
451 | ACPI_DESC_TYPE_NAMED) { | ||
452 | ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]", | ||
453 | node, | ||
454 | acpi_ut_get_descriptor_name(node))); | ||
455 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
456 | } | ||
457 | |||
458 | /* Get the attached object */ | ||
459 | |||
460 | obj_desc = acpi_ns_get_attached_object(node); | ||
461 | if (!obj_desc) { | ||
462 | /* No object, use the NS node type */ | ||
463 | |||
464 | type = acpi_ns_get_type(node); | ||
465 | goto exit; | ||
466 | } | ||
467 | |||
468 | /* Check for circular references */ | ||
469 | |||
470 | if (obj_desc == operand) { | ||
471 | return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE); | ||
472 | } | ||
473 | break; | ||
474 | |||
475 | case AML_LOCAL_OP: | 464 | case AML_LOCAL_OP: |
476 | case AML_ARG_OP: | 465 | case AML_ARG_OP: |
477 | 466 | ||
@@ -513,7 +502,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
513 | 502 | ||
514 | case AML_DEBUG_OP: | 503 | case AML_DEBUG_OP: |
515 | 504 | ||
516 | /* The Debug Object is of type "debug_object" */ | 505 | /* The Debug Object is of type "DebugObject" */ |
517 | 506 | ||
518 | type = ACPI_TYPE_DEBUG_OBJECT; | 507 | type = ACPI_TYPE_DEBUG_OBJECT; |
519 | goto exit; | 508 | goto exit; |
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index a1c000f5a415..4c93d0972333 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -77,6 +77,7 @@ acpi_ex_check_object_type(acpi_object_type type_needed, | |||
77 | ACPI_FUNCTION_ENTRY(); | 77 | ACPI_FUNCTION_ENTRY(); |
78 | 78 | ||
79 | if (type_needed == ACPI_TYPE_ANY) { | 79 | if (type_needed == ACPI_TYPE_ANY) { |
80 | |||
80 | /* All types OK, so we don't perform any typechecks */ | 81 | /* All types OK, so we don't perform any typechecks */ |
81 | 82 | ||
82 | return (AE_OK); | 83 | return (AE_OK); |
@@ -143,7 +144,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
143 | acpi_object_type type_needed; | 144 | acpi_object_type type_needed; |
144 | u16 target_op = 0; | 145 | u16 target_op = 0; |
145 | 146 | ||
146 | ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); | 147 | ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode); |
147 | 148 | ||
148 | op_info = acpi_ps_get_opcode_info(opcode); | 149 | op_info = acpi_ps_get_opcode_info(opcode); |
149 | if (op_info->class == AML_CLASS_UNKNOWN) { | 150 | if (op_info->class == AML_CLASS_UNKNOWN) { |
@@ -158,7 +159,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
158 | } | 159 | } |
159 | 160 | ||
160 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 161 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
161 | "Opcode %X [%s] required_operand_types=%8.8X\n", | 162 | "Opcode %X [%s] RequiredOperandTypes=%8.8X\n", |
162 | opcode, op_info->name, arg_types)); | 163 | opcode, op_info->name, arg_types)); |
163 | 164 | ||
164 | /* | 165 | /* |
@@ -224,6 +225,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
224 | } | 225 | } |
225 | 226 | ||
226 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { | 227 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
228 | |||
227 | /* Decode the Reference */ | 229 | /* Decode the Reference */ |
228 | 230 | ||
229 | op_info = acpi_ps_get_opcode_info(opcode); | 231 | op_info = acpi_ps_get_opcode_info(opcode); |
@@ -247,7 +249,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
247 | 249 | ||
248 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT | 250 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT |
249 | ((ACPI_DB_EXEC, | 251 | ((ACPI_DB_EXEC, |
250 | "Operand is a Reference, ref_opcode [%s]\n", | 252 | "Operand is a Reference, RefOpcode [%s]\n", |
251 | (acpi_ps_get_opcode_info | 253 | (acpi_ps_get_opcode_info |
252 | (obj_desc-> | 254 | (obj_desc-> |
253 | reference. | 255 | reference. |
@@ -332,6 +334,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
332 | } | 334 | } |
333 | 335 | ||
334 | if (obj_desc->reference.opcode == AML_NAME_OP) { | 336 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
337 | |||
335 | /* Convert a named reference to the actual named object */ | 338 | /* Convert a named reference to the actual named object */ |
336 | 339 | ||
337 | temp_node = obj_desc->reference.object; | 340 | temp_node = obj_desc->reference.object; |
@@ -623,7 +626,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
623 | 626 | ||
624 | default: | 627 | default: |
625 | ACPI_ERROR((AE_INFO, | 628 | ACPI_ERROR((AE_INFO, |
626 | "Needed [Region/region_field], found [%s] %p", | 629 | "Needed [Region/RegionField], found [%s] %p", |
627 | acpi_ut_get_object_type_name | 630 | acpi_ut_get_object_type_name |
628 | (obj_desc), obj_desc)); | 631 | (obj_desc), obj_desc)); |
629 | 632 | ||
@@ -662,6 +665,7 @@ acpi_ex_resolve_operands(u16 opcode, | |||
662 | } | 665 | } |
663 | 666 | ||
664 | if (target_op == AML_DEBUG_OP) { | 667 | if (target_op == AML_DEBUG_OP) { |
668 | |||
665 | /* Allow store of any object to the Debug object */ | 669 | /* Allow store of any object to the Debug object */ |
666 | 670 | ||
667 | break; | 671 | break; |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index 3f020c0e2b95..0456405ba019 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -82,7 +82,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
82 | { | 82 | { |
83 | u32 i; | 83 | u32 i; |
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc); | 85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); |
86 | 86 | ||
87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | 87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", |
88 | level, " ")); | 88 | level, " ")); |
@@ -245,7 +245,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
245 | acpi_status status = AE_OK; | 245 | acpi_status status = AE_OK; |
246 | union acpi_operand_object *ref_desc = dest_desc; | 246 | union acpi_operand_object *ref_desc = dest_desc; |
247 | 247 | ||
248 | ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc); | 248 | ACPI_FUNCTION_TRACE_PTR(ex_store, dest_desc); |
249 | 249 | ||
250 | /* Validate parameters */ | 250 | /* Validate parameters */ |
251 | 251 | ||
@@ -297,7 +297,7 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
297 | 297 | ||
298 | ACPI_DUMP_STACK_ENTRY(source_desc); | 298 | ACPI_DUMP_STACK_ENTRY(source_desc); |
299 | ACPI_DUMP_STACK_ENTRY(dest_desc); | 299 | ACPI_DUMP_STACK_ENTRY(dest_desc); |
300 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store", | 300 | ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ExStore", |
301 | 2, | 301 | 2, |
302 | "Target is not a Reference or Constant object"); | 302 | "Target is not a Reference or Constant object"); |
303 | 303 | ||
@@ -396,7 +396,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
396 | u8 value = 0; | 396 | u8 value = 0; |
397 | u32 i; | 397 | u32 i; |
398 | 398 | ||
399 | ACPI_FUNCTION_TRACE("ex_store_object_to_index"); | 399 | ACPI_FUNCTION_TRACE(ex_store_object_to_index); |
400 | 400 | ||
401 | /* | 401 | /* |
402 | * Destination must be a reference pointer, and | 402 | * Destination must be a reference pointer, and |
@@ -423,6 +423,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
423 | } | 423 | } |
424 | 424 | ||
425 | if (obj_desc) { | 425 | if (obj_desc) { |
426 | |||
426 | /* Decrement reference count by the ref count of the parent package */ | 427 | /* Decrement reference count by the ref count of the parent package */ |
427 | 428 | ||
428 | for (i = 0; i < ((union acpi_operand_object *) | 429 | for (i = 0; i < ((union acpi_operand_object *) |
@@ -502,8 +503,7 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
502 | break; | 503 | break; |
503 | 504 | ||
504 | default: | 505 | default: |
505 | ACPI_ERROR((AE_INFO, | 506 | ACPI_ERROR((AE_INFO, "Target is not a Package or BufferField")); |
506 | "Target is not a Package or buffer_field")); | ||
507 | status = AE_AML_OPERAND_TYPE; | 507 | status = AE_AML_OPERAND_TYPE; |
508 | break; | 508 | break; |
509 | } | 509 | } |
@@ -548,7 +548,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
548 | union acpi_operand_object *new_desc; | 548 | union acpi_operand_object *new_desc; |
549 | acpi_object_type target_type; | 549 | acpi_object_type target_type; |
550 | 550 | ||
551 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc); | 551 | ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_node, source_desc); |
552 | 552 | ||
553 | /* Get current type of the node, and object attached to Node */ | 553 | /* Get current type of the node, and object attached to Node */ |
554 | 554 | ||
@@ -572,6 +572,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
572 | /* If no implicit conversion, drop into the default case below */ | 572 | /* If no implicit conversion, drop into the default case below */ |
573 | 573 | ||
574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { | 574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { |
575 | |||
575 | /* Force execution of default (no implicit conversion) */ | 576 | /* Force execution of default (no implicit conversion) */ |
576 | 577 | ||
577 | target_type = ACPI_TYPE_ANY; | 578 | target_type = ACPI_TYPE_ANY; |
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 42967baf760d..591aaf0e18b3 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -72,7 +72,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
72 | union acpi_operand_object *source_desc = *source_desc_ptr; | 72 | union acpi_operand_object *source_desc = *source_desc_ptr; |
73 | acpi_status status = AE_OK; | 73 | acpi_status status = AE_OK; |
74 | 74 | ||
75 | ACPI_FUNCTION_TRACE("ex_resolve_object"); | 75 | ACPI_FUNCTION_TRACE(ex_resolve_object); |
76 | 76 | ||
77 | /* Ensure we have a Target that can be stored to */ | 77 | /* Ensure we have a Target that can be stored to */ |
78 | 78 | ||
@@ -97,6 +97,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
97 | */ | 97 | */ |
98 | if (ACPI_GET_OBJECT_TYPE(source_desc) == | 98 | if (ACPI_GET_OBJECT_TYPE(source_desc) == |
99 | ACPI_TYPE_LOCAL_REFERENCE) { | 99 | ACPI_TYPE_LOCAL_REFERENCE) { |
100 | |||
100 | /* Resolve a reference object first */ | 101 | /* Resolve a reference object first */ |
101 | 102 | ||
102 | status = | 103 | status = |
@@ -121,6 +122,7 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr, | |||
121 | !((ACPI_GET_OBJECT_TYPE(source_desc) == | 122 | !((ACPI_GET_OBJECT_TYPE(source_desc) == |
122 | ACPI_TYPE_LOCAL_REFERENCE) | 123 | ACPI_TYPE_LOCAL_REFERENCE) |
123 | && (source_desc->reference.opcode == AML_LOAD_OP))) { | 124 | && (source_desc->reference.opcode == AML_LOAD_OP))) { |
125 | |||
124 | /* Conversion successful but still not a valid type */ | 126 | /* Conversion successful but still not a valid type */ |
125 | 127 | ||
126 | ACPI_ERROR((AE_INFO, | 128 | ACPI_ERROR((AE_INFO, |
@@ -199,7 +201,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
199 | union acpi_operand_object *actual_src_desc; | 201 | union acpi_operand_object *actual_src_desc; |
200 | acpi_status status = AE_OK; | 202 | acpi_status status = AE_OK; |
201 | 203 | ||
202 | ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc); | 204 | ACPI_FUNCTION_TRACE_PTR(ex_store_object_to_object, source_desc); |
203 | 205 | ||
204 | actual_src_desc = source_desc; | 206 | actual_src_desc = source_desc; |
205 | if (!dest_desc) { | 207 | if (!dest_desc) { |
@@ -289,6 +291,7 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc, | |||
289 | } | 291 | } |
290 | 292 | ||
291 | if (actual_src_desc != source_desc) { | 293 | if (actual_src_desc != source_desc) { |
294 | |||
292 | /* Delete the intermediate (temporary) source object */ | 295 | /* Delete the intermediate (temporary) source object */ |
293 | 296 | ||
294 | acpi_ut_remove_reference(actual_src_desc); | 297 | acpi_ut_remove_reference(actual_src_desc); |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 6ab707087750..99ebe5adfcda 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -67,7 +67,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
67 | u32 length; | 67 | u32 length; |
68 | u8 *buffer; | 68 | u8 *buffer; |
69 | 69 | ||
70 | ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc); | 70 | ACPI_FUNCTION_TRACE_PTR(ex_store_buffer_to_buffer, source_desc); |
71 | 71 | ||
72 | /* We know that source_desc is a buffer by now */ | 72 | /* We know that source_desc is a buffer by now */ |
73 | 73 | ||
@@ -80,7 +80,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
80 | */ | 80 | */ |
81 | if ((target_desc->buffer.length == 0) || | 81 | if ((target_desc->buffer.length == 0) || |
82 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { | 82 | (target_desc->common.flags & AOPOBJ_STATIC_POINTER)) { |
83 | target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length); | 83 | target_desc->buffer.pointer = ACPI_ALLOCATE(length); |
84 | if (!target_desc->buffer.pointer) { | 84 | if (!target_desc->buffer.pointer) { |
85 | return_ACPI_STATUS(AE_NO_MEMORY); | 85 | return_ACPI_STATUS(AE_NO_MEMORY); |
86 | } | 86 | } |
@@ -91,6 +91,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
91 | /* Copy source buffer to target buffer */ | 91 | /* Copy source buffer to target buffer */ |
92 | 92 | ||
93 | if (length <= target_desc->buffer.length) { | 93 | if (length <= target_desc->buffer.length) { |
94 | |||
94 | /* Clear existing buffer and copy in the new one */ | 95 | /* Clear existing buffer and copy in the new one */ |
95 | 96 | ||
96 | ACPI_MEMSET(target_desc->buffer.pointer, 0, | 97 | ACPI_MEMSET(target_desc->buffer.pointer, 0, |
@@ -102,7 +103,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
102 | * NOTE: ACPI versions up to 3.0 specified that the buffer must be | 103 | * NOTE: ACPI versions up to 3.0 specified that the buffer must be |
103 | * truncated if the string is smaller than the buffer. However, "other" | 104 | * truncated if the string is smaller than the buffer. However, "other" |
104 | * implementations of ACPI never did this and thus became the defacto | 105 | * implementations of ACPI never did this and thus became the defacto |
105 | * standard. ACPi 3.0_a changes this behavior such that the buffer | 106 | * standard. ACPI 3.0_a changes this behavior such that the buffer |
106 | * is no longer truncated. | 107 | * is no longer truncated. |
107 | */ | 108 | */ |
108 | 109 | ||
@@ -113,6 +114,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc, | |||
113 | * copy must not truncate the original buffer. | 114 | * copy must not truncate the original buffer. |
114 | */ | 115 | */ |
115 | if (original_src_type == ACPI_TYPE_STRING) { | 116 | if (original_src_type == ACPI_TYPE_STRING) { |
117 | |||
116 | /* Set the new length of the target */ | 118 | /* Set the new length of the target */ |
117 | 119 | ||
118 | target_desc->buffer.length = length; | 120 | target_desc->buffer.length = length; |
@@ -156,7 +158,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
156 | u32 length; | 158 | u32 length; |
157 | u8 *buffer; | 159 | u8 *buffer; |
158 | 160 | ||
159 | ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc); | 161 | ACPI_FUNCTION_TRACE_PTR(ex_store_string_to_string, source_desc); |
160 | 162 | ||
161 | /* We know that source_desc is a string by now */ | 163 | /* We know that source_desc is a string by now */ |
162 | 164 | ||
@@ -183,13 +185,14 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, | |||
183 | */ | 185 | */ |
184 | if (target_desc->string.pointer && | 186 | if (target_desc->string.pointer && |
185 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { | 187 | (!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) { |
188 | |||
186 | /* Only free if not a pointer into the DSDT */ | 189 | /* Only free if not a pointer into the DSDT */ |
187 | 190 | ||
188 | ACPI_MEM_FREE(target_desc->string.pointer); | 191 | ACPI_FREE(target_desc->string.pointer); |
189 | } | 192 | } |
190 | 193 | ||
191 | target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size) | 194 | target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size) |
192 | length + 1); | 195 | length + 1); |
193 | if (!target_desc->string.pointer) { | 196 | if (!target_desc->string.pointer) { |
194 | return_ACPI_STATUS(AE_NO_MEMORY); | 197 | return_ACPI_STATUS(AE_NO_MEMORY); |
195 | } | 198 | } |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index ea9144f42e1f..52beee3674a0 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -68,7 +68,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
68 | acpi_status status; | 68 | acpi_status status; |
69 | acpi_status status2; | 69 | acpi_status status2; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ex_system_wait_semaphore"); | 71 | ACPI_FUNCTION_TRACE(ex_system_wait_semaphore); |
72 | 72 | ||
73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); | 73 | status = acpi_os_wait_semaphore(semaphore, 1, 0); |
74 | if (ACPI_SUCCESS(status)) { | 74 | if (ACPI_SUCCESS(status)) { |
@@ -76,6 +76,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | if (status == AE_TIME) { | 78 | if (status == AE_TIME) { |
79 | |||
79 | /* We must wait, so unlock the interpreter */ | 80 | /* We must wait, so unlock the interpreter */ |
80 | 81 | ||
81 | acpi_ex_exit_interpreter(); | 82 | acpi_ex_exit_interpreter(); |
@@ -90,6 +91,7 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout) | |||
90 | 91 | ||
91 | status2 = acpi_ex_enter_interpreter(); | 92 | status2 = acpi_ex_enter_interpreter(); |
92 | if (ACPI_FAILURE(status2)) { | 93 | if (ACPI_FAILURE(status2)) { |
94 | |||
93 | /* Report fatal error, could not acquire interpreter */ | 95 | /* Report fatal error, could not acquire interpreter */ |
94 | 96 | ||
95 | return_ACPI_STATUS(status2); | 97 | return_ACPI_STATUS(status2); |
@@ -191,7 +193,7 @@ acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc, | |||
191 | { | 193 | { |
192 | acpi_status status = AE_OK; | 194 | acpi_status status = AE_OK; |
193 | 195 | ||
194 | ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc); | 196 | ACPI_FUNCTION_TRACE_PTR(ex_system_acquire_mutex, obj_desc); |
195 | 197 | ||
196 | if (!obj_desc) { | 198 | if (!obj_desc) { |
197 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 199 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -229,7 +231,7 @@ acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc) | |||
229 | { | 231 | { |
230 | acpi_status status = AE_OK; | 232 | acpi_status status = AE_OK; |
231 | 233 | ||
232 | ACPI_FUNCTION_TRACE("ex_system_release_mutex"); | 234 | ACPI_FUNCTION_TRACE(ex_system_release_mutex); |
233 | 235 | ||
234 | if (!obj_desc) { | 236 | if (!obj_desc) { |
235 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 237 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -263,7 +265,7 @@ acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc) | |||
263 | { | 265 | { |
264 | acpi_status status = AE_OK; | 266 | acpi_status status = AE_OK; |
265 | 267 | ||
266 | ACPI_FUNCTION_TRACE("ex_system_signal_event"); | 268 | ACPI_FUNCTION_TRACE(ex_system_signal_event); |
267 | 269 | ||
268 | if (obj_desc) { | 270 | if (obj_desc) { |
269 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); | 271 | status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1); |
@@ -293,7 +295,7 @@ acpi_ex_system_wait_event(union acpi_operand_object *time_desc, | |||
293 | { | 295 | { |
294 | acpi_status status = AE_OK; | 296 | acpi_status status = AE_OK; |
295 | 297 | ||
296 | ACPI_FUNCTION_TRACE("ex_system_wait_event"); | 298 | ACPI_FUNCTION_TRACE(ex_system_wait_event); |
297 | 299 | ||
298 | if (obj_desc) { | 300 | if (obj_desc) { |
299 | status = | 301 | status = |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index f73a61aeb7ec..982c8b65876f 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -87,9 +87,9 @@ acpi_status acpi_ex_enter_interpreter(void) | |||
87 | { | 87 | { |
88 | acpi_status status; | 88 | acpi_status status; |
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE("ex_enter_interpreter"); | 90 | ACPI_FUNCTION_TRACE(ex_enter_interpreter); |
91 | 91 | ||
92 | status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); | 92 | status = acpi_ut_acquire_mutex(ACPI_MTX_INTERPRETER); |
93 | if (ACPI_FAILURE(status)) { | 93 | if (ACPI_FAILURE(status)) { |
94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); | 94 | ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex")); |
95 | } | 95 | } |
@@ -123,9 +123,9 @@ void acpi_ex_exit_interpreter(void) | |||
123 | { | 123 | { |
124 | acpi_status status; | 124 | acpi_status status; |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ex_exit_interpreter"); | 126 | ACPI_FUNCTION_TRACE(ex_exit_interpreter); |
127 | 127 | ||
128 | status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); | 128 | status = acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); |
129 | if (ACPI_FAILURE(status)) { | 129 | if (ACPI_FAILURE(status)) { |
130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); | 130 | ACPI_ERROR((AE_INFO, "Could not release interpreter mutex")); |
131 | } | 131 | } |
@@ -189,11 +189,12 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags) | |||
189 | u8 locked = FALSE; | 189 | u8 locked = FALSE; |
190 | acpi_status status; | 190 | acpi_status status; |
191 | 191 | ||
192 | ACPI_FUNCTION_TRACE("ex_acquire_global_lock"); | 192 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); |
193 | 193 | ||
194 | /* Only attempt lock if the always_lock bit is set */ | 194 | /* Only attempt lock if the always_lock bit is set */ |
195 | 195 | ||
196 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { | 196 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { |
197 | |||
197 | /* We should attempt to get the lock, wait forever */ | 198 | /* We should attempt to get the lock, wait forever */ |
198 | 199 | ||
199 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); | 200 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); |
@@ -225,15 +226,17 @@ void acpi_ex_release_global_lock(u8 locked_by_me) | |||
225 | { | 226 | { |
226 | acpi_status status; | 227 | acpi_status status; |
227 | 228 | ||
228 | ACPI_FUNCTION_TRACE("ex_release_global_lock"); | 229 | ACPI_FUNCTION_TRACE(ex_release_global_lock); |
229 | 230 | ||
230 | /* Only attempt unlock if the caller locked it */ | 231 | /* Only attempt unlock if the caller locked it */ |
231 | 232 | ||
232 | if (locked_by_me) { | 233 | if (locked_by_me) { |
234 | |||
233 | /* OK, now release the lock */ | 235 | /* OK, now release the lock */ |
234 | 236 | ||
235 | status = acpi_ev_release_global_lock(); | 237 | status = acpi_ev_release_global_lock(); |
236 | if (ACPI_FAILURE(status)) { | 238 | if (ACPI_FAILURE(status)) { |
239 | |||
237 | /* Report the error, but there isn't much else we can do */ | 240 | /* Report the error, but there isn't much else we can do */ |
238 | 241 | ||
239 | ACPI_EXCEPTION((AE_INFO, status, | 242 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -263,7 +266,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
263 | u32 num_digits; | 266 | u32 num_digits; |
264 | acpi_integer current_value; | 267 | acpi_integer current_value; |
265 | 268 | ||
266 | ACPI_FUNCTION_TRACE("ex_digits_needed"); | 269 | ACPI_FUNCTION_TRACE(ex_digits_needed); |
267 | 270 | ||
268 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ | 271 | /* acpi_integer is unsigned, so we don't worry about a '-' prefix */ |
269 | 272 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index e8165c4f162a..1cd25784b7a4 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -48,6 +48,8 @@ MODULE_LICENSE("GPL"); | |||
48 | 48 | ||
49 | static int acpi_fan_add(struct acpi_device *device); | 49 | static int acpi_fan_add(struct acpi_device *device); |
50 | static int acpi_fan_remove(struct acpi_device *device, int type); | 50 | static int acpi_fan_remove(struct acpi_device *device, int type); |
51 | static int acpi_fan_suspend(struct acpi_device *device, int state); | ||
52 | static int acpi_fan_resume(struct acpi_device *device, int state); | ||
51 | 53 | ||
52 | static struct acpi_driver acpi_fan_driver = { | 54 | static struct acpi_driver acpi_fan_driver = { |
53 | .name = ACPI_FAN_DRIVER_NAME, | 55 | .name = ACPI_FAN_DRIVER_NAME, |
@@ -56,6 +58,8 @@ static struct acpi_driver acpi_fan_driver = { | |||
56 | .ops = { | 58 | .ops = { |
57 | .add = acpi_fan_add, | 59 | .add = acpi_fan_add, |
58 | .remove = acpi_fan_remove, | 60 | .remove = acpi_fan_remove, |
61 | .suspend = acpi_fan_suspend, | ||
62 | .resume = acpi_fan_resume, | ||
59 | }, | 63 | }, |
60 | }; | 64 | }; |
61 | 65 | ||
@@ -206,6 +210,10 @@ static int acpi_fan_add(struct acpi_device *device) | |||
206 | goto end; | 210 | goto end; |
207 | } | 211 | } |
208 | 212 | ||
213 | device->flags.force_power_state = 1; | ||
214 | acpi_bus_set_power(device->handle, state); | ||
215 | device->flags.force_power_state = 0; | ||
216 | |||
209 | result = acpi_fan_add_fs(device); | 217 | result = acpi_fan_add_fs(device); |
210 | if (result) | 218 | if (result) |
211 | goto end; | 219 | goto end; |
@@ -239,6 +247,38 @@ static int acpi_fan_remove(struct acpi_device *device, int type) | |||
239 | return_VALUE(0); | 247 | return_VALUE(0); |
240 | } | 248 | } |
241 | 249 | ||
250 | static int acpi_fan_suspend(struct acpi_device *device, int state) | ||
251 | { | ||
252 | if (!device) | ||
253 | return -EINVAL; | ||
254 | |||
255 | acpi_bus_set_power(device->handle, ACPI_STATE_D0); | ||
256 | |||
257 | return AE_OK; | ||
258 | } | ||
259 | |||
260 | static int acpi_fan_resume(struct acpi_device *device, int state) | ||
261 | { | ||
262 | int result = 0; | ||
263 | int power_state = 0; | ||
264 | |||
265 | if (!device) | ||
266 | return -EINVAL; | ||
267 | |||
268 | result = acpi_bus_get_power(device->handle, &power_state); | ||
269 | if (result) { | ||
270 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
271 | "Error reading fan power state\n")); | ||
272 | return result; | ||
273 | } | ||
274 | |||
275 | device->flags.force_power_state = 1; | ||
276 | acpi_bus_set_power(device->handle, power_state); | ||
277 | device->flags.force_power_state = 0; | ||
278 | |||
279 | return result; | ||
280 | } | ||
281 | |||
242 | static int __init acpi_fan_init(void) | 282 | static int __init acpi_fan_init(void) |
243 | { | 283 | { |
244 | int result = 0; | 284 | int result = 0; |
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index ea2f13271ff1..de50fab2a910 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -63,7 +63,7 @@ acpi_status acpi_hw_initialize(void) | |||
63 | { | 63 | { |
64 | acpi_status status; | 64 | acpi_status status; |
65 | 65 | ||
66 | ACPI_FUNCTION_TRACE("hw_initialize"); | 66 | ACPI_FUNCTION_TRACE(hw_initialize); |
67 | 67 | ||
68 | /* We must have the ACPI tables by the time we get here */ | 68 | /* We must have the ACPI tables by the time we get here */ |
69 | 69 | ||
@@ -100,7 +100,7 @@ acpi_status acpi_hw_set_mode(u32 mode) | |||
100 | acpi_status status; | 100 | acpi_status status; |
101 | u32 retry; | 101 | u32 retry; |
102 | 102 | ||
103 | ACPI_FUNCTION_TRACE("hw_set_mode"); | 103 | ACPI_FUNCTION_TRACE(hw_set_mode); |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 106 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
@@ -198,7 +198,7 @@ u32 acpi_hw_get_mode(void) | |||
198 | acpi_status status; | 198 | acpi_status status; |
199 | u32 value; | 199 | u32 value; |
200 | 200 | ||
201 | ACPI_FUNCTION_TRACE("hw_get_mode"); | 201 | ACPI_FUNCTION_TRACE(hw_get_mode); |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, | 204 | * ACPI 2.0 clarified that if SMI_CMD in FADT is zero, |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index d84942d22dd5..608a3a60ee11 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -214,6 +214,7 @@ acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
214 | /* Examine each GPE Register within the block */ | 214 | /* Examine each GPE Register within the block */ |
215 | 215 | ||
216 | for (i = 0; i < gpe_block->register_count; i++) { | 216 | for (i = 0; i < gpe_block->register_count; i++) { |
217 | |||
217 | /* Disable all GPEs in this register */ | 218 | /* Disable all GPEs in this register */ |
218 | 219 | ||
219 | status = acpi_hw_low_level_write(8, 0x00, | 220 | status = acpi_hw_low_level_write(8, 0x00, |
@@ -250,6 +251,7 @@ acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info, | |||
250 | /* Examine each GPE Register within the block */ | 251 | /* Examine each GPE Register within the block */ |
251 | 252 | ||
252 | for (i = 0; i < gpe_block->register_count; i++) { | 253 | for (i = 0; i < gpe_block->register_count; i++) { |
254 | |||
253 | /* Clear status on all GPEs in this register */ | 255 | /* Clear status on all GPEs in this register */ |
254 | 256 | ||
255 | status = acpi_hw_low_level_write(8, 0xFF, | 257 | status = acpi_hw_low_level_write(8, 0xFF, |
@@ -368,7 +370,7 @@ acpi_status acpi_hw_disable_all_gpes(void) | |||
368 | { | 370 | { |
369 | acpi_status status; | 371 | acpi_status status; |
370 | 372 | ||
371 | ACPI_FUNCTION_TRACE("hw_disable_all_gpes"); | 373 | ACPI_FUNCTION_TRACE(hw_disable_all_gpes); |
372 | 374 | ||
373 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); | 375 | status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block); |
374 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 376 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
@@ -391,7 +393,7 @@ acpi_status acpi_hw_enable_all_runtime_gpes(void) | |||
391 | { | 393 | { |
392 | acpi_status status; | 394 | acpi_status status; |
393 | 395 | ||
394 | ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes"); | 396 | ACPI_FUNCTION_TRACE(hw_enable_all_runtime_gpes); |
395 | 397 | ||
396 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); | 398 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block); |
397 | return_ACPI_STATUS(status); | 399 | return_ACPI_STATUS(status); |
@@ -413,7 +415,7 @@ acpi_status acpi_hw_enable_all_wakeup_gpes(void) | |||
413 | { | 415 | { |
414 | acpi_status status; | 416 | acpi_status status; |
415 | 417 | ||
416 | ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes"); | 418 | ACPI_FUNCTION_TRACE(hw_enable_all_wakeup_gpes); |
417 | 419 | ||
418 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); | 420 | status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block); |
419 | return_ACPI_STATUS(status); | 421 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index e1fe75498415..ae142de19507 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -43,8 +43,6 @@ | |||
43 | * POSSIBILITY OF SUCH DAMAGES. | 43 | * POSSIBILITY OF SUCH DAMAGES. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | #include <linux/module.h> | ||
47 | |||
48 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
49 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
50 | #include <acpi/acevents.h> | 48 | #include <acpi/acevents.h> |
@@ -63,23 +61,21 @@ ACPI_MODULE_NAME("hwregs") | |||
63 | * DESCRIPTION: Clears all fixed and general purpose status bits | 61 | * DESCRIPTION: Clears all fixed and general purpose status bits |
64 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 62 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
65 | * | 63 | * |
64 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
65 | * | ||
66 | ******************************************************************************/ | 66 | ******************************************************************************/ |
67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) | 67 | acpi_status acpi_hw_clear_acpi_status(u32 flags) |
68 | { | 68 | { |
69 | acpi_status status; | 69 | acpi_status status; |
70 | acpi_cpu_flags lock_flags = 0; | ||
70 | 71 | ||
71 | ACPI_FUNCTION_TRACE("hw_clear_acpi_status"); | 72 | ACPI_FUNCTION_TRACE(hw_clear_acpi_status); |
72 | 73 | ||
73 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", | 74 | ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n", |
74 | ACPI_BITMASK_ALL_FIXED_STATUS, | 75 | ACPI_BITMASK_ALL_FIXED_STATUS, |
75 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); | 76 | (u16) acpi_gbl_FADT->xpm1a_evt_blk.address)); |
76 | 77 | ||
77 | if (flags & ACPI_MTX_LOCK) { | 78 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
78 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
79 | if (ACPI_FAILURE(status)) { | ||
80 | return_ACPI_STATUS(status); | ||
81 | } | ||
82 | } | ||
83 | 79 | ||
84 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, | 80 | status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK, |
85 | ACPI_REGISTER_PM1_STATUS, | 81 | ACPI_REGISTER_PM1_STATUS, |
@@ -104,9 +100,7 @@ acpi_status acpi_hw_clear_acpi_status(u32 flags) | |||
104 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); | 100 | status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block); |
105 | 101 | ||
106 | unlock_and_exit: | 102 | unlock_and_exit: |
107 | if (flags & ACPI_MTX_LOCK) { | 103 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
108 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
109 | } | ||
110 | return_ACPI_STATUS(status); | 104 | return_ACPI_STATUS(status); |
111 | } | 105 | } |
112 | 106 | ||
@@ -129,10 +123,9 @@ acpi_status | |||
129 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | 123 | acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) |
130 | { | 124 | { |
131 | acpi_status status = AE_OK; | 125 | acpi_status status = AE_OK; |
132 | struct acpi_parameter_info info; | 126 | struct acpi_evaluate_info *info; |
133 | char *sleep_state_name; | ||
134 | 127 | ||
135 | ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data"); | 128 | ACPI_FUNCTION_TRACE(acpi_get_sleep_type_data); |
136 | 129 | ||
137 | /* Validate parameters */ | 130 | /* Validate parameters */ |
138 | 131 | ||
@@ -140,34 +133,39 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
140 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 133 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
141 | } | 134 | } |
142 | 135 | ||
143 | /* Evaluate the namespace object containing the values for this state */ | 136 | /* Allocate the evaluation information block */ |
137 | |||
138 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
139 | if (!info) { | ||
140 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
141 | } | ||
144 | 142 | ||
145 | info.parameters = NULL; | 143 | info->pathname = |
146 | info.return_object = NULL; | ||
147 | sleep_state_name = | ||
148 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); | 144 | ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); |
149 | 145 | ||
150 | status = acpi_ns_evaluate_by_name(sleep_state_name, &info); | 146 | /* Evaluate the namespace object containing the values for this state */ |
147 | |||
148 | status = acpi_ns_evaluate(info); | ||
151 | if (ACPI_FAILURE(status)) { | 149 | if (ACPI_FAILURE(status)) { |
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 150 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
153 | "%s while evaluating sleep_state [%s]\n", | 151 | "%s while evaluating SleepState [%s]\n", |
154 | acpi_format_exception(status), | 152 | acpi_format_exception(status), |
155 | sleep_state_name)); | 153 | info->pathname)); |
156 | 154 | ||
157 | return_ACPI_STATUS(status); | 155 | goto cleanup; |
158 | } | 156 | } |
159 | 157 | ||
160 | /* Must have a return object */ | 158 | /* Must have a return object */ |
161 | 159 | ||
162 | if (!info.return_object) { | 160 | if (!info->return_object) { |
163 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", | 161 | ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", |
164 | sleep_state_name)); | 162 | info->pathname)); |
165 | status = AE_NOT_EXIST; | 163 | status = AE_NOT_EXIST; |
166 | } | 164 | } |
167 | 165 | ||
168 | /* It must be of type Package */ | 166 | /* It must be of type Package */ |
169 | 167 | ||
170 | else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) { | 168 | else if (ACPI_GET_OBJECT_TYPE(info->return_object) != ACPI_TYPE_PACKAGE) { |
171 | ACPI_ERROR((AE_INFO, | 169 | ACPI_ERROR((AE_INFO, |
172 | "Sleep State return object is not a Package")); | 170 | "Sleep State return object is not a Package")); |
173 | status = AE_AML_OPERAND_TYPE; | 171 | status = AE_AML_OPERAND_TYPE; |
@@ -180,7 +178,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
180 | * by BIOS vendors seems to be to have 2 or more elements, at least | 178 | * by BIOS vendors seems to be to have 2 or more elements, at least |
181 | * one per sleep type (A/B). | 179 | * one per sleep type (A/B). |
182 | */ | 180 | */ |
183 | else if (info.return_object->package.count < 2) { | 181 | else if (info->return_object->package.count < 2) { |
184 | ACPI_ERROR((AE_INFO, | 182 | ACPI_ERROR((AE_INFO, |
185 | "Sleep State return package does not have at least two elements")); | 183 | "Sleep State return package does not have at least two elements")); |
186 | status = AE_AML_NO_OPERAND; | 184 | status = AE_AML_NO_OPERAND; |
@@ -188,39 +186,42 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b) | |||
188 | 186 | ||
189 | /* The first two elements must both be of type Integer */ | 187 | /* The first two elements must both be of type Integer */ |
190 | 188 | ||
191 | else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0]) | 189 | else if ((ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[0]) |
192 | != ACPI_TYPE_INTEGER) || | 190 | != ACPI_TYPE_INTEGER) || |
193 | (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) | 191 | (ACPI_GET_OBJECT_TYPE(info->return_object->package.elements[1]) |
194 | != ACPI_TYPE_INTEGER)) { | 192 | != ACPI_TYPE_INTEGER)) { |
195 | ACPI_ERROR((AE_INFO, | 193 | ACPI_ERROR((AE_INFO, |
196 | "Sleep State return package elements are not both Integers (%s, %s)", | 194 | "Sleep State return package elements are not both Integers (%s, %s)", |
197 | acpi_ut_get_object_type_name(info.return_object-> | 195 | acpi_ut_get_object_type_name(info->return_object-> |
198 | package.elements[0]), | 196 | package.elements[0]), |
199 | acpi_ut_get_object_type_name(info.return_object-> | 197 | acpi_ut_get_object_type_name(info->return_object-> |
200 | package.elements[1]))); | 198 | package.elements[1]))); |
201 | status = AE_AML_OPERAND_TYPE; | 199 | status = AE_AML_OPERAND_TYPE; |
202 | } else { | 200 | } else { |
203 | /* Valid _Sx_ package size, type, and value */ | 201 | /* Valid _Sx_ package size, type, and value */ |
204 | 202 | ||
205 | *sleep_type_a = (u8) | 203 | *sleep_type_a = (u8) |
206 | (info.return_object->package.elements[0])->integer.value; | 204 | (info->return_object->package.elements[0])->integer.value; |
207 | *sleep_type_b = (u8) | 205 | *sleep_type_b = (u8) |
208 | (info.return_object->package.elements[1])->integer.value; | 206 | (info->return_object->package.elements[1])->integer.value; |
209 | } | 207 | } |
210 | 208 | ||
211 | if (ACPI_FAILURE(status)) { | 209 | if (ACPI_FAILURE(status)) { |
212 | ACPI_EXCEPTION((AE_INFO, status, | 210 | ACPI_EXCEPTION((AE_INFO, status, |
213 | "While evaluating sleep_state [%s], bad Sleep object %p type %s", | 211 | "While evaluating SleepState [%s], bad Sleep object %p type %s", |
214 | sleep_state_name, info.return_object, | 212 | info->pathname, info->return_object, |
215 | acpi_ut_get_object_type_name(info. | 213 | acpi_ut_get_object_type_name(info-> |
216 | return_object))); | 214 | return_object))); |
217 | } | 215 | } |
218 | 216 | ||
219 | acpi_ut_remove_reference(info.return_object); | 217 | acpi_ut_remove_reference(info->return_object); |
218 | |||
219 | cleanup: | ||
220 | ACPI_FREE(info); | ||
220 | return_ACPI_STATUS(status); | 221 | return_ACPI_STATUS(status); |
221 | } | 222 | } |
222 | 223 | ||
223 | EXPORT_SYMBOL(acpi_get_sleep_type_data); | 224 | ACPI_EXPORT_SYMBOL(acpi_get_sleep_type_data) |
224 | 225 | ||
225 | /******************************************************************************* | 226 | /******************************************************************************* |
226 | * | 227 | * |
@@ -233,13 +234,12 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data); | |||
233 | * DESCRIPTION: Map register_id into a register bitmask. | 234 | * DESCRIPTION: Map register_id into a register bitmask. |
234 | * | 235 | * |
235 | ******************************************************************************/ | 236 | ******************************************************************************/ |
236 | |||
237 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | 237 | struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) |
238 | { | 238 | { |
239 | ACPI_FUNCTION_ENTRY(); | 239 | ACPI_FUNCTION_ENTRY(); |
240 | 240 | ||
241 | if (register_id > ACPI_BITREG_MAX) { | 241 | if (register_id > ACPI_BITREG_MAX) { |
242 | ACPI_ERROR((AE_INFO, "Invalid bit_register ID: %X", | 242 | ACPI_ERROR((AE_INFO, "Invalid BitRegister ID: %X", |
243 | register_id)); | 243 | register_id)); |
244 | return (NULL); | 244 | return (NULL); |
245 | } | 245 | } |
@@ -260,6 +260,8 @@ struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) | |||
260 | * | 260 | * |
261 | * DESCRIPTION: ACPI bit_register read function. | 261 | * DESCRIPTION: ACPI bit_register read function. |
262 | * | 262 | * |
263 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
264 | * | ||
263 | ******************************************************************************/ | 265 | ******************************************************************************/ |
264 | 266 | ||
265 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | 267 | acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) |
@@ -268,7 +270,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
268 | struct acpi_bit_register_info *bit_reg_info; | 270 | struct acpi_bit_register_info *bit_reg_info; |
269 | acpi_status status; | 271 | acpi_status status; |
270 | 272 | ||
271 | ACPI_FUNCTION_TRACE("acpi_get_register"); | 273 | ACPI_FUNCTION_TRACE(acpi_get_register); |
272 | 274 | ||
273 | /* Get the info structure corresponding to the requested ACPI Register */ | 275 | /* Get the info structure corresponding to the requested ACPI Register */ |
274 | 276 | ||
@@ -277,24 +279,14 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
277 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 279 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
278 | } | 280 | } |
279 | 281 | ||
280 | if (flags & ACPI_MTX_LOCK) { | ||
281 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
282 | if (ACPI_FAILURE(status)) { | ||
283 | return_ACPI_STATUS(status); | ||
284 | } | ||
285 | } | ||
286 | |||
287 | /* Read from the register */ | 282 | /* Read from the register */ |
288 | 283 | ||
289 | status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK, | 284 | status = acpi_hw_register_read(ACPI_MTX_LOCK, |
290 | bit_reg_info->parent_register, | 285 | bit_reg_info->parent_register, |
291 | ®ister_value); | 286 | ®ister_value); |
292 | 287 | ||
293 | if (flags & ACPI_MTX_LOCK) { | ||
294 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
295 | } | ||
296 | |||
297 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
289 | |||
298 | /* Normalize the value that was read */ | 290 | /* Normalize the value that was read */ |
299 | 291 | ||
300 | register_value = | 292 | register_value = |
@@ -311,7 +303,7 @@ acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags) | |||
311 | return_ACPI_STATUS(status); | 303 | return_ACPI_STATUS(status); |
312 | } | 304 | } |
313 | 305 | ||
314 | EXPORT_SYMBOL(acpi_get_register); | 306 | ACPI_EXPORT_SYMBOL(acpi_get_register) |
315 | 307 | ||
316 | /******************************************************************************* | 308 | /******************************************************************************* |
317 | * | 309 | * |
@@ -326,31 +318,28 @@ EXPORT_SYMBOL(acpi_get_register); | |||
326 | * | 318 | * |
327 | * DESCRIPTION: ACPI Bit Register write function. | 319 | * DESCRIPTION: ACPI Bit Register write function. |
328 | * | 320 | * |
321 | * NOTE: TBD: Flags parameter is obsolete, to be removed | ||
322 | * | ||
329 | ******************************************************************************/ | 323 | ******************************************************************************/ |
330 | |||
331 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | 324 | acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) |
332 | { | 325 | { |
333 | u32 register_value = 0; | 326 | u32 register_value = 0; |
334 | struct acpi_bit_register_info *bit_reg_info; | 327 | struct acpi_bit_register_info *bit_reg_info; |
335 | acpi_status status; | 328 | acpi_status status; |
329 | acpi_cpu_flags lock_flags; | ||
336 | 330 | ||
337 | ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id); | 331 | ACPI_FUNCTION_TRACE_U32(acpi_set_register, register_id); |
338 | 332 | ||
339 | /* Get the info structure corresponding to the requested ACPI Register */ | 333 | /* Get the info structure corresponding to the requested ACPI Register */ |
340 | 334 | ||
341 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); | 335 | bit_reg_info = acpi_hw_get_bit_register_info(register_id); |
342 | if (!bit_reg_info) { | 336 | if (!bit_reg_info) { |
343 | ACPI_ERROR((AE_INFO, "Bad ACPI HW register_id: %X", | 337 | ACPI_ERROR((AE_INFO, "Bad ACPI HW RegisterId: %X", |
344 | register_id)); | 338 | register_id)); |
345 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 339 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
346 | } | 340 | } |
347 | 341 | ||
348 | if (flags & ACPI_MTX_LOCK) { | 342 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
349 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | ||
350 | if (ACPI_FAILURE(status)) { | ||
351 | return_ACPI_STATUS(status); | ||
352 | } | ||
353 | } | ||
354 | 343 | ||
355 | /* Always do a register read first so we can insert the new bits */ | 344 | /* Always do a register read first so we can insert the new bits */ |
356 | 345 | ||
@@ -458,9 +447,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
458 | 447 | ||
459 | unlock_and_exit: | 448 | unlock_and_exit: |
460 | 449 | ||
461 | if (flags & ACPI_MTX_LOCK) { | 450 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
462 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | ||
463 | } | ||
464 | 451 | ||
465 | /* Normalize the value that was read */ | 452 | /* Normalize the value that was read */ |
466 | 453 | ||
@@ -474,7 +461,7 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags) | |||
474 | return_ACPI_STATUS(status); | 461 | return_ACPI_STATUS(status); |
475 | } | 462 | } |
476 | 463 | ||
477 | EXPORT_SYMBOL(acpi_set_register); | 464 | ACPI_EXPORT_SYMBOL(acpi_set_register) |
478 | 465 | ||
479 | /****************************************************************************** | 466 | /****************************************************************************** |
480 | * | 467 | * |
@@ -490,21 +477,18 @@ EXPORT_SYMBOL(acpi_set_register); | |||
490 | * given offset. | 477 | * given offset. |
491 | * | 478 | * |
492 | ******************************************************************************/ | 479 | ******************************************************************************/ |
493 | |||
494 | acpi_status | 480 | acpi_status |
495 | acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | 481 | acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) |
496 | { | 482 | { |
497 | u32 value1 = 0; | 483 | u32 value1 = 0; |
498 | u32 value2 = 0; | 484 | u32 value2 = 0; |
499 | acpi_status status; | 485 | acpi_status status; |
486 | acpi_cpu_flags lock_flags = 0; | ||
500 | 487 | ||
501 | ACPI_FUNCTION_TRACE("hw_register_read"); | 488 | ACPI_FUNCTION_TRACE(hw_register_read); |
502 | 489 | ||
503 | if (ACPI_MTX_LOCK == use_lock) { | 490 | if (ACPI_MTX_LOCK == use_lock) { |
504 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 491 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
505 | if (ACPI_FAILURE(status)) { | ||
506 | return_ACPI_STATUS(status); | ||
507 | } | ||
508 | } | 492 | } |
509 | 493 | ||
510 | switch (register_id) { | 494 | switch (register_id) { |
@@ -582,7 +566,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
582 | 566 | ||
583 | unlock_and_exit: | 567 | unlock_and_exit: |
584 | if (ACPI_MTX_LOCK == use_lock) { | 568 | if (ACPI_MTX_LOCK == use_lock) { |
585 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 569 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
586 | } | 570 | } |
587 | 571 | ||
588 | if (ACPI_SUCCESS(status)) { | 572 | if (ACPI_SUCCESS(status)) { |
@@ -610,14 +594,12 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value) | |||
610 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | 594 | acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) |
611 | { | 595 | { |
612 | acpi_status status; | 596 | acpi_status status; |
597 | acpi_cpu_flags lock_flags = 0; | ||
613 | 598 | ||
614 | ACPI_FUNCTION_TRACE("hw_register_write"); | 599 | ACPI_FUNCTION_TRACE(hw_register_write); |
615 | 600 | ||
616 | if (ACPI_MTX_LOCK == use_lock) { | 601 | if (ACPI_MTX_LOCK == use_lock) { |
617 | status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE); | 602 | lock_flags = acpi_os_acquire_lock(acpi_gbl_hardware_lock); |
618 | if (ACPI_FAILURE(status)) { | ||
619 | return_ACPI_STATUS(status); | ||
620 | } | ||
621 | } | 603 | } |
622 | 604 | ||
623 | switch (register_id) { | 605 | switch (register_id) { |
@@ -707,7 +689,7 @@ acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value) | |||
707 | 689 | ||
708 | unlock_and_exit: | 690 | unlock_and_exit: |
709 | if (ACPI_MTX_LOCK == use_lock) { | 691 | if (ACPI_MTX_LOCK == use_lock) { |
710 | (void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE); | 692 | acpi_os_release_lock(acpi_gbl_hardware_lock, lock_flags); |
711 | } | 693 | } |
712 | 694 | ||
713 | return_ACPI_STATUS(status); | 695 | return_ACPI_STATUS(status); |
@@ -733,7 +715,7 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg) | |||
733 | u64 address; | 715 | u64 address; |
734 | acpi_status status; | 716 | acpi_status status; |
735 | 717 | ||
736 | ACPI_FUNCTION_NAME("hw_low_level_read"); | 718 | ACPI_FUNCTION_NAME(hw_low_level_read); |
737 | 719 | ||
738 | /* | 720 | /* |
739 | * Must have a valid pointer to a GAS structure, and | 721 | * Must have a valid pointer to a GAS structure, and |
@@ -805,7 +787,7 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg) | |||
805 | u64 address; | 787 | u64 address; |
806 | acpi_status status; | 788 | acpi_status status; |
807 | 789 | ||
808 | ACPI_FUNCTION_NAME("hw_low_level_write"); | 790 | ACPI_FUNCTION_NAME(hw_low_level_write); |
809 | 791 | ||
810 | /* | 792 | /* |
811 | * Must have a valid pointer to a GAS structure, and | 793 | * Must have a valid pointer to a GAS structure, and |
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 89269272fd62..8bb43cae60c2 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | 46 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 47 | #define _COMPONENT ACPI_HARDWARE |
@@ -64,7 +63,7 @@ acpi_status | |||
64 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | 63 | acpi_set_firmware_waking_vector(acpi_physical_address physical_address) |
65 | { | 64 | { |
66 | 65 | ||
67 | ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector"); | 66 | ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); |
68 | 67 | ||
69 | /* Set the vector */ | 68 | /* Set the vector */ |
70 | 69 | ||
@@ -79,6 +78,8 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | |||
79 | return_ACPI_STATUS(AE_OK); | 78 | return_ACPI_STATUS(AE_OK); |
80 | } | 79 | } |
81 | 80 | ||
81 | ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) | ||
82 | |||
82 | /******************************************************************************* | 83 | /******************************************************************************* |
83 | * | 84 | * |
84 | * FUNCTION: acpi_get_firmware_waking_vector | 85 | * FUNCTION: acpi_get_firmware_waking_vector |
@@ -92,13 +93,12 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | |||
92 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS | 93 | * DESCRIPTION: Access function for the firmware_waking_vector field in FACS |
93 | * | 94 | * |
94 | ******************************************************************************/ | 95 | ******************************************************************************/ |
95 | |||
96 | #ifdef ACPI_FUTURE_USAGE | 96 | #ifdef ACPI_FUTURE_USAGE |
97 | acpi_status | 97 | acpi_status |
98 | acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | 98 | acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) |
99 | { | 99 | { |
100 | 100 | ||
101 | ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector"); | 101 | ACPI_FUNCTION_TRACE(acpi_get_firmware_waking_vector); |
102 | 102 | ||
103 | if (!physical_address) { | 103 | if (!physical_address) { |
104 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 104 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -118,6 +118,8 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
118 | 118 | ||
119 | return_ACPI_STATUS(AE_OK); | 119 | return_ACPI_STATUS(AE_OK); |
120 | } | 120 | } |
121 | |||
122 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_waking_vector) | ||
121 | #endif | 123 | #endif |
122 | 124 | ||
123 | /******************************************************************************* | 125 | /******************************************************************************* |
@@ -134,14 +136,13 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
134 | * various OS-specific tasks between the two steps. | 136 | * various OS-specific tasks between the two steps. |
135 | * | 137 | * |
136 | ******************************************************************************/ | 138 | ******************************************************************************/ |
137 | |||
138 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | 139 | acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) |
139 | { | 140 | { |
140 | acpi_status status; | 141 | acpi_status status; |
141 | struct acpi_object_list arg_list; | 142 | struct acpi_object_list arg_list; |
142 | union acpi_object arg; | 143 | union acpi_object arg; |
143 | 144 | ||
144 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep"); | 145 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_prep); |
145 | 146 | ||
146 | /* | 147 | /* |
147 | * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. | 148 | * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. |
@@ -206,6 +207,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
206 | return_ACPI_STATUS(AE_OK); | 207 | return_ACPI_STATUS(AE_OK); |
207 | } | 208 | } |
208 | 209 | ||
210 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) | ||
211 | |||
209 | /******************************************************************************* | 212 | /******************************************************************************* |
210 | * | 213 | * |
211 | * FUNCTION: acpi_enter_sleep_state | 214 | * FUNCTION: acpi_enter_sleep_state |
@@ -218,7 +221,6 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state) | |||
218 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 221 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
219 | * | 222 | * |
220 | ******************************************************************************/ | 223 | ******************************************************************************/ |
221 | |||
222 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | 224 | acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) |
223 | { | 225 | { |
224 | u32 PM1Acontrol; | 226 | u32 PM1Acontrol; |
@@ -228,7 +230,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
228 | u32 in_value; | 230 | u32 in_value; |
229 | acpi_status status; | 231 | acpi_status status; |
230 | 232 | ||
231 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state"); | 233 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state); |
232 | 234 | ||
233 | if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || | 235 | if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || |
234 | (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { | 236 | (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { |
@@ -378,7 +380,7 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) | |||
378 | return_ACPI_STATUS(AE_OK); | 380 | return_ACPI_STATUS(AE_OK); |
379 | } | 381 | } |
380 | 382 | ||
381 | EXPORT_SYMBOL(acpi_enter_sleep_state); | 383 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state) |
382 | 384 | ||
383 | /******************************************************************************* | 385 | /******************************************************************************* |
384 | * | 386 | * |
@@ -392,13 +394,12 @@ EXPORT_SYMBOL(acpi_enter_sleep_state); | |||
392 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED | 394 | * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED |
393 | * | 395 | * |
394 | ******************************************************************************/ | 396 | ******************************************************************************/ |
395 | |||
396 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) | 397 | acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) |
397 | { | 398 | { |
398 | u32 in_value; | 399 | u32 in_value; |
399 | acpi_status status; | 400 | acpi_status status; |
400 | 401 | ||
401 | ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios"); | 402 | ACPI_FUNCTION_TRACE(acpi_enter_sleep_state_s4bios); |
402 | 403 | ||
403 | status = | 404 | status = |
404 | acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); | 405 | acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK); |
@@ -443,7 +444,7 @@ acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) | |||
443 | return_ACPI_STATUS(AE_OK); | 444 | return_ACPI_STATUS(AE_OK); |
444 | } | 445 | } |
445 | 446 | ||
446 | EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | 447 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) |
447 | 448 | ||
448 | /******************************************************************************* | 449 | /******************************************************************************* |
449 | * | 450 | * |
@@ -457,7 +458,6 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); | |||
457 | * Called with interrupts ENABLED. | 458 | * Called with interrupts ENABLED. |
458 | * | 459 | * |
459 | ******************************************************************************/ | 460 | ******************************************************************************/ |
460 | |||
461 | acpi_status acpi_leave_sleep_state(u8 sleep_state) | 461 | acpi_status acpi_leave_sleep_state(u8 sleep_state) |
462 | { | 462 | { |
463 | struct acpi_object_list arg_list; | 463 | struct acpi_object_list arg_list; |
@@ -468,7 +468,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
468 | u32 PM1Acontrol; | 468 | u32 PM1Acontrol; |
469 | u32 PM1Bcontrol; | 469 | u32 PM1Bcontrol; |
470 | 470 | ||
471 | ACPI_FUNCTION_TRACE("acpi_leave_sleep_state"); | 471 | ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); |
472 | 472 | ||
473 | /* | 473 | /* |
474 | * Set SLP_TYPE and SLP_EN to state S0. | 474 | * Set SLP_TYPE and SLP_EN to state S0. |
@@ -490,6 +490,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
490 | ACPI_REGISTER_PM1_CONTROL, | 490 | ACPI_REGISTER_PM1_CONTROL, |
491 | &PM1Acontrol); | 491 | &PM1Acontrol); |
492 | if (ACPI_SUCCESS(status)) { | 492 | if (ACPI_SUCCESS(status)) { |
493 | |||
493 | /* Clear SLP_EN and SLP_TYP fields */ | 494 | /* Clear SLP_EN and SLP_TYP fields */ |
494 | 495 | ||
495 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | | 496 | PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | |
@@ -583,3 +584,5 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state) | |||
583 | 584 | ||
584 | return_ACPI_STATUS(status); | 585 | return_ACPI_STATUS(status); |
585 | } | 586 | } |
587 | |||
588 | ACPI_EXPORT_SYMBOL(acpi_leave_sleep_state) | ||
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index fc10b7cb456f..c4ec47c939fd 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c | |||
@@ -42,7 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
47 | 46 | ||
48 | #define _COMPONENT ACPI_HARDWARE | 47 | #define _COMPONENT ACPI_HARDWARE |
@@ -61,13 +60,13 @@ ACPI_MODULE_NAME("hwtimer") | |||
61 | ******************************************************************************/ | 60 | ******************************************************************************/ |
62 | acpi_status acpi_get_timer_resolution(u32 * resolution) | 61 | acpi_status acpi_get_timer_resolution(u32 * resolution) |
63 | { | 62 | { |
64 | ACPI_FUNCTION_TRACE("acpi_get_timer_resolution"); | 63 | ACPI_FUNCTION_TRACE(acpi_get_timer_resolution); |
65 | 64 | ||
66 | if (!resolution) { | 65 | if (!resolution) { |
67 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 66 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
68 | } | 67 | } |
69 | 68 | ||
70 | if (0 == acpi_gbl_FADT->tmr_val_ext) { | 69 | if (acpi_gbl_FADT->tmr_val_ext == 0) { |
71 | *resolution = 24; | 70 | *resolution = 24; |
72 | } else { | 71 | } else { |
73 | *resolution = 32; | 72 | *resolution = 32; |
@@ -76,6 +75,8 @@ acpi_status acpi_get_timer_resolution(u32 * resolution) | |||
76 | return_ACPI_STATUS(AE_OK); | 75 | return_ACPI_STATUS(AE_OK); |
77 | } | 76 | } |
78 | 77 | ||
78 | ACPI_EXPORT_SYMBOL(acpi_get_timer_resolution) | ||
79 | |||
79 | /****************************************************************************** | 80 | /****************************************************************************** |
80 | * | 81 | * |
81 | * FUNCTION: acpi_get_timer | 82 | * FUNCTION: acpi_get_timer |
@@ -87,12 +88,11 @@ acpi_status acpi_get_timer_resolution(u32 * resolution) | |||
87 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). | 88 | * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). |
88 | * | 89 | * |
89 | ******************************************************************************/ | 90 | ******************************************************************************/ |
90 | |||
91 | acpi_status acpi_get_timer(u32 * ticks) | 91 | acpi_status acpi_get_timer(u32 * ticks) |
92 | { | 92 | { |
93 | acpi_status status; | 93 | acpi_status status; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE("acpi_get_timer"); | 95 | ACPI_FUNCTION_TRACE(acpi_get_timer); |
96 | 96 | ||
97 | if (!ticks) { | 97 | if (!ticks) { |
98 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 98 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -103,7 +103,7 @@ acpi_status acpi_get_timer(u32 * ticks) | |||
103 | return_ACPI_STATUS(status); | 103 | return_ACPI_STATUS(status); |
104 | } | 104 | } |
105 | 105 | ||
106 | EXPORT_SYMBOL(acpi_get_timer); | 106 | ACPI_EXPORT_SYMBOL(acpi_get_timer) |
107 | 107 | ||
108 | /****************************************************************************** | 108 | /****************************************************************************** |
109 | * | 109 | * |
@@ -133,7 +133,6 @@ EXPORT_SYMBOL(acpi_get_timer); | |||
133 | * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes | 133 | * 2**32 Ticks / 3,600,000 Ticks/Sec = 1193 sec or 19.88 minutes |
134 | * | 134 | * |
135 | ******************************************************************************/ | 135 | ******************************************************************************/ |
136 | |||
137 | acpi_status | 136 | acpi_status |
138 | acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | 137 | acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) |
139 | { | 138 | { |
@@ -141,7 +140,7 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
141 | u32 delta_ticks; | 140 | u32 delta_ticks; |
142 | acpi_integer quotient; | 141 | acpi_integer quotient; |
143 | 142 | ||
144 | ACPI_FUNCTION_TRACE("acpi_get_timer_duration"); | 143 | ACPI_FUNCTION_TRACE(acpi_get_timer_duration); |
145 | 144 | ||
146 | if (!time_elapsed) { | 145 | if (!time_elapsed) { |
147 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 146 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -154,7 +153,8 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
154 | if (start_ticks < end_ticks) { | 153 | if (start_ticks < end_ticks) { |
155 | delta_ticks = end_ticks - start_ticks; | 154 | delta_ticks = end_ticks - start_ticks; |
156 | } else if (start_ticks > end_ticks) { | 155 | } else if (start_ticks > end_ticks) { |
157 | if (0 == acpi_gbl_FADT->tmr_val_ext) { | 156 | if (acpi_gbl_FADT->tmr_val_ext == 0) { |
157 | |||
158 | /* 24-bit Timer */ | 158 | /* 24-bit Timer */ |
159 | 159 | ||
160 | delta_ticks = | 160 | delta_ticks = |
@@ -183,4 +183,4 @@ acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed) | |||
183 | return_ACPI_STATUS(status); | 183 | return_ACPI_STATUS(status); |
184 | } | 184 | } |
185 | 185 | ||
186 | EXPORT_SYMBOL(acpi_get_timer_duration); | 186 | ACPI_EXPORT_SYMBOL(acpi_get_timer_duration) |
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index 2e2e4051dfa7..c25b2b92edcf 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c | |||
@@ -723,6 +723,8 @@ get_parms(char *config_record, | |||
723 | goto do_fail; | 723 | goto do_fail; |
724 | count = tmp1 - tmp; | 724 | count = tmp1 - tmp; |
725 | *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); | 725 | *action_handle = (char *)kmalloc(count + 1, GFP_KERNEL); |
726 | if (!*action_handle) | ||
727 | goto do_fail; | ||
726 | strncpy(*action_handle, tmp, count); | 728 | strncpy(*action_handle, tmp, count); |
727 | *(*action_handle + count) = 0; | 729 | *(*action_handle + count) = 0; |
728 | 730 | ||
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index 262b1f41335a..15fc12482ba0 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -567,6 +567,69 @@ static int bluetooth_write(char *buf) | |||
567 | return 0; | 567 | return 0; |
568 | } | 568 | } |
569 | 569 | ||
570 | static int wan_supported; | ||
571 | |||
572 | static int wan_init(void) | ||
573 | { | ||
574 | wan_supported = hkey_handle && | ||
575 | acpi_evalf(hkey_handle, NULL, "GWAN", "qv"); | ||
576 | |||
577 | return 0; | ||
578 | } | ||
579 | |||
580 | static int wan_status(void) | ||
581 | { | ||
582 | int status; | ||
583 | |||
584 | if (!wan_supported || | ||
585 | !acpi_evalf(hkey_handle, &status, "GWAN", "d")) | ||
586 | status = 0; | ||
587 | |||
588 | return status; | ||
589 | } | ||
590 | |||
591 | static int wan_read(char *p) | ||
592 | { | ||
593 | int len = 0; | ||
594 | int status = wan_status(); | ||
595 | |||
596 | if (!wan_supported) | ||
597 | len += sprintf(p + len, "status:\t\tnot supported\n"); | ||
598 | else if (!(status & 1)) | ||
599 | len += sprintf(p + len, "status:\t\tnot installed\n"); | ||
600 | else { | ||
601 | len += sprintf(p + len, "status:\t\t%s\n", enabled(status, 1)); | ||
602 | len += sprintf(p + len, "commands:\tenable, disable\n"); | ||
603 | } | ||
604 | |||
605 | return len; | ||
606 | } | ||
607 | |||
608 | static int wan_write(char *buf) | ||
609 | { | ||
610 | int status = wan_status(); | ||
611 | char *cmd; | ||
612 | int do_cmd = 0; | ||
613 | |||
614 | if (!wan_supported) | ||
615 | return -ENODEV; | ||
616 | |||
617 | while ((cmd = next_cmd(&buf))) { | ||
618 | if (strlencmp(cmd, "enable") == 0) { | ||
619 | status |= 2; | ||
620 | } else if (strlencmp(cmd, "disable") == 0) { | ||
621 | status &= ~2; | ||
622 | } else | ||
623 | return -EINVAL; | ||
624 | do_cmd = 1; | ||
625 | } | ||
626 | |||
627 | if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status)) | ||
628 | return -EIO; | ||
629 | |||
630 | return 0; | ||
631 | } | ||
632 | |||
570 | static int video_supported; | 633 | static int video_supported; |
571 | static int video_orig_autosw; | 634 | static int video_orig_autosw; |
572 | 635 | ||
@@ -1563,6 +1626,13 @@ static struct ibm_struct ibms[] = { | |||
1563 | .write = bluetooth_write, | 1626 | .write = bluetooth_write, |
1564 | }, | 1627 | }, |
1565 | { | 1628 | { |
1629 | .name = "wan", | ||
1630 | .init = wan_init, | ||
1631 | .read = wan_read, | ||
1632 | .write = wan_write, | ||
1633 | .experimental = 1, | ||
1634 | }, | ||
1635 | { | ||
1566 | .name = "video", | 1636 | .name = "video", |
1567 | .init = video_init, | 1637 | .init = video_init, |
1568 | .read = video_read, | 1638 | .read = video_read, |
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index 468244147ec1..d51d68f5dd8d 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c | |||
@@ -37,7 +37,7 @@ ACPI_MODULE_NAME("acpi_motherboard") | |||
37 | #define ACPI_MB_HID2 "PNP0C02" | 37 | #define ACPI_MB_HID2 "PNP0C02" |
38 | /** | 38 | /** |
39 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved | 39 | * Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved |
40 | * Doesn't care about the failure of 'request_region', since other may reserve | 40 | * Doesn't care about the failure of 'request_region', since other may reserve |
41 | * the io ports as well | 41 | * the io ports as well |
42 | */ | 42 | */ |
43 | #define IS_RESERVED_ADDR(base, len) \ | 43 | #define IS_RESERVED_ADDR(base, len) \ |
@@ -46,7 +46,7 @@ ACPI_MODULE_NAME("acpi_motherboard") | |||
46 | /* | 46 | /* |
47 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use | 47 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use |
48 | * the io ports if they really know they can use it, while | 48 | * the io ports if they really know they can use it, while |
49 | * still preventing hotplug PCI devices from using it. | 49 | * still preventing hotplug PCI devices from using it. |
50 | */ | 50 | */ |
51 | static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) | 51 | static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data) |
52 | { | 52 | { |
@@ -123,49 +123,54 @@ static struct acpi_driver acpi_motherboard_driver2 = { | |||
123 | }, | 123 | }, |
124 | }; | 124 | }; |
125 | 125 | ||
126 | static void __init acpi_request_region (struct acpi_generic_address *addr, | ||
127 | unsigned int length, char *desc) | ||
128 | { | ||
129 | if (!addr->address || !length) | ||
130 | return; | ||
131 | |||
132 | if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_IO) | ||
133 | request_region(addr->address, length, desc); | ||
134 | else if (addr->address_space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) | ||
135 | request_mem_region(addr->address, length, desc); | ||
136 | } | ||
137 | |||
126 | static void __init acpi_reserve_resources(void) | 138 | static void __init acpi_reserve_resources(void) |
127 | { | 139 | { |
128 | if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 140 | acpi_request_region(&acpi_gbl_FADT->xpm1a_evt_blk, |
129 | request_region(acpi_gbl_FADT->xpm1a_evt_blk.address, | 141 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1a_EVT_BLK"); |
130 | acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK"); | ||
131 | 142 | ||
132 | if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len) | 143 | acpi_request_region(&acpi_gbl_FADT->xpm1b_evt_blk, |
133 | request_region(acpi_gbl_FADT->xpm1b_evt_blk.address, | 144 | acpi_gbl_FADT->pm1_evt_len, "ACPI PM1b_EVT_BLK"); |
134 | acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK"); | ||
135 | 145 | ||
136 | if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 146 | acpi_request_region(&acpi_gbl_FADT->xpm1a_cnt_blk, |
137 | request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address, | 147 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1a_CNT_BLK"); |
138 | acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK"); | ||
139 | 148 | ||
140 | if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len) | 149 | acpi_request_region(&acpi_gbl_FADT->xpm1b_cnt_blk, |
141 | request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address, | 150 | acpi_gbl_FADT->pm1_cnt_len, "ACPI PM1b_CNT_BLK"); |
142 | acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK"); | ||
143 | 151 | ||
144 | if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4) | 152 | if (acpi_gbl_FADT->pm_tm_len == 4) |
145 | request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR"); | 153 | acpi_request_region(&acpi_gbl_FADT->xpm_tmr_blk, 4, "ACPI PM_TMR"); |
146 | 154 | ||
147 | if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len) | 155 | acpi_request_region(&acpi_gbl_FADT->xpm2_cnt_blk, |
148 | request_region(acpi_gbl_FADT->xpm2_cnt_blk.address, | 156 | acpi_gbl_FADT->pm2_cnt_len, "ACPI PM2_CNT_BLK"); |
149 | acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK"); | ||
150 | 157 | ||
151 | /* Length of GPE blocks must be a non-negative multiple of 2 */ | 158 | /* Length of GPE blocks must be a non-negative multiple of 2 */ |
152 | 159 | ||
153 | if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len && | 160 | if (!(acpi_gbl_FADT->gpe0_blk_len & 0x1)) |
154 | !(acpi_gbl_FADT->gpe0_blk_len & 0x1)) | 161 | acpi_request_region(&acpi_gbl_FADT->xgpe0_blk, |
155 | request_region(acpi_gbl_FADT->xgpe0_blk.address, | 162 | acpi_gbl_FADT->gpe0_blk_len, "ACPI GPE0_BLK"); |
156 | acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK"); | ||
157 | 163 | ||
158 | if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len && | 164 | if (!(acpi_gbl_FADT->gpe1_blk_len & 0x1)) |
159 | !(acpi_gbl_FADT->gpe1_blk_len & 0x1)) | 165 | acpi_request_region(&acpi_gbl_FADT->xgpe1_blk, |
160 | request_region(acpi_gbl_FADT->xgpe1_blk.address, | 166 | acpi_gbl_FADT->gpe1_blk_len, "ACPI GPE1_BLK"); |
161 | acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK"); | ||
162 | } | 167 | } |
163 | 168 | ||
164 | static int __init acpi_motherboard_init(void) | 169 | static int __init acpi_motherboard_init(void) |
165 | { | 170 | { |
166 | acpi_bus_register_driver(&acpi_motherboard_driver1); | 171 | acpi_bus_register_driver(&acpi_motherboard_driver1); |
167 | acpi_bus_register_driver(&acpi_motherboard_driver2); | 172 | acpi_bus_register_driver(&acpi_motherboard_driver2); |
168 | /* | 173 | /* |
169 | * Guarantee motherboard IO reservation first | 174 | * Guarantee motherboard IO reservation first |
170 | * This module must run after scan.c | 175 | * This module must run after scan.c |
171 | */ | 176 | */ |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 1149bc18fb35..48fadade52e2 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -70,7 +70,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
70 | union acpi_operand_object *obj_desc; | 70 | union acpi_operand_object *obj_desc; |
71 | acpi_string val = NULL; | 71 | acpi_string val = NULL; |
72 | 72 | ||
73 | ACPI_FUNCTION_TRACE("ns_root_initialize"); | 73 | ACPI_FUNCTION_TRACE(ns_root_initialize); |
74 | 74 | ||
75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 75 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); |
76 | if (ACPI_FAILURE(status)) { | 76 | if (ACPI_FAILURE(status)) { |
@@ -98,6 +98,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
98 | "Entering predefined entries into namespace\n")); | 98 | "Entering predefined entries into namespace\n")); |
99 | 99 | ||
100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { | 100 | for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) { |
101 | |||
101 | /* _OSI is optional for now, will be permanent later */ | 102 | /* _OSI is optional for now, will be permanent later */ |
102 | 103 | ||
103 | if (!ACPI_STRCMP(init_val->name, "_OSI") | 104 | if (!ACPI_STRCMP(init_val->name, "_OSI") |
@@ -156,7 +157,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
156 | 157 | ||
157 | #if defined (ACPI_ASL_COMPILER) | 158 | #if defined (ACPI_ASL_COMPILER) |
158 | 159 | ||
159 | /* save the parameter count for the i_aSL compiler */ | 160 | /* Save the parameter count for the i_aSL compiler */ |
160 | 161 | ||
161 | new_node->value = obj_desc->method.param_count; | 162 | new_node->value = obj_desc->method.param_count; |
162 | #else | 163 | #else |
@@ -258,10 +259,8 @@ acpi_status acpi_ns_root_initialize(void) | |||
258 | /* Save a handle to "_GPE", it is always present */ | 259 | /* Save a handle to "_GPE", it is always present */ |
259 | 260 | ||
260 | if (ACPI_SUCCESS(status)) { | 261 | if (ACPI_SUCCESS(status)) { |
261 | status = | 262 | status = acpi_ns_get_node(NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH, |
262 | acpi_ns_get_node_by_path("\\_GPE", NULL, | 263 | &acpi_gbl_fadt_gpe_device); |
263 | ACPI_NS_NO_UPSEARCH, | ||
264 | &acpi_gbl_fadt_gpe_device); | ||
265 | } | 264 | } |
266 | 265 | ||
267 | return_ACPI_STATUS(status); | 266 | return_ACPI_STATUS(status); |
@@ -310,17 +309,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
310 | acpi_object_type type_to_check_for; | 309 | acpi_object_type type_to_check_for; |
311 | acpi_object_type this_search_type; | 310 | acpi_object_type this_search_type; |
312 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; | 311 | u32 search_parent_flag = ACPI_NS_SEARCH_PARENT; |
313 | u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | | 312 | u32 local_flags; |
314 | ACPI_NS_SEARCH_PARENT); | ||
315 | 313 | ||
316 | ACPI_FUNCTION_TRACE("ns_lookup"); | 314 | ACPI_FUNCTION_TRACE(ns_lookup); |
317 | 315 | ||
318 | if (!return_node) { | 316 | if (!return_node) { |
319 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 317 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
320 | } | 318 | } |
321 | 319 | ||
322 | acpi_gbl_ns_lookup_count++; | 320 | local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT); |
323 | *return_node = ACPI_ENTRY_NOT_FOUND; | 321 | *return_node = ACPI_ENTRY_NOT_FOUND; |
322 | acpi_gbl_ns_lookup_count++; | ||
324 | 323 | ||
325 | if (!acpi_gbl_root_node) { | 324 | if (!acpi_gbl_root_node) { |
326 | return_ACPI_STATUS(AE_NO_NAMESPACE); | 325 | return_ACPI_STATUS(AE_NO_NAMESPACE); |
@@ -346,14 +345,17 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
346 | return_ACPI_STATUS(AE_AML_INTERNAL); | 345 | return_ACPI_STATUS(AE_AML_INTERNAL); |
347 | } | 346 | } |
348 | 347 | ||
349 | /* | 348 | if (!(flags & ACPI_NS_PREFIX_IS_SCOPE)) { |
350 | * This node might not be a actual "scope" node (such as a | 349 | /* |
351 | * Device/Method, etc.) It could be a Package or other object node. | 350 | * This node might not be a actual "scope" node (such as a |
352 | * Backup up the tree to find the containing scope node. | 351 | * Device/Method, etc.) It could be a Package or other object node. |
353 | */ | 352 | * Backup up the tree to find the containing scope node. |
354 | while (!acpi_ns_opens_scope(prefix_node->type) && | 353 | */ |
355 | prefix_node->type != ACPI_TYPE_ANY) { | 354 | while (!acpi_ns_opens_scope(prefix_node->type) && |
356 | prefix_node = acpi_ns_get_parent_node(prefix_node); | 355 | prefix_node->type != ACPI_TYPE_ANY) { |
356 | prefix_node = | ||
357 | acpi_ns_get_parent_node(prefix_node); | ||
358 | } | ||
357 | } | 359 | } |
358 | } | 360 | } |
359 | 361 | ||
@@ -365,6 +367,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
365 | * Begin examination of the actual pathname | 367 | * Begin examination of the actual pathname |
366 | */ | 368 | */ |
367 | if (!pathname) { | 369 | if (!pathname) { |
370 | |||
368 | /* A Null name_path is allowed and refers to the root */ | 371 | /* A Null name_path is allowed and refers to the root */ |
369 | 372 | ||
370 | num_segments = 0; | 373 | num_segments = 0; |
@@ -389,6 +392,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
389 | * to the current scope). | 392 | * to the current scope). |
390 | */ | 393 | */ |
391 | if (*path == (u8) AML_ROOT_PREFIX) { | 394 | if (*path == (u8) AML_ROOT_PREFIX) { |
395 | |||
392 | /* Pathname is fully qualified, start from the root */ | 396 | /* Pathname is fully qualified, start from the root */ |
393 | 397 | ||
394 | this_node = acpi_gbl_root_node; | 398 | this_node = acpi_gbl_root_node; |
@@ -416,6 +420,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
416 | this_node = prefix_node; | 420 | this_node = prefix_node; |
417 | num_carats = 0; | 421 | num_carats = 0; |
418 | while (*path == (u8) AML_PARENT_PREFIX) { | 422 | while (*path == (u8) AML_PARENT_PREFIX) { |
423 | |||
419 | /* Name is fully qualified, no search rules apply */ | 424 | /* Name is fully qualified, no search rules apply */ |
420 | 425 | ||
421 | search_parent_flag = ACPI_NS_NO_UPSEARCH; | 426 | search_parent_flag = ACPI_NS_NO_UPSEARCH; |
@@ -430,6 +435,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
430 | num_carats++; | 435 | num_carats++; |
431 | this_node = acpi_ns_get_parent_node(this_node); | 436 | this_node = acpi_ns_get_parent_node(this_node); |
432 | if (!this_node) { | 437 | if (!this_node) { |
438 | |||
433 | /* Current scope has no parent scope */ | 439 | /* Current scope has no parent scope */ |
434 | 440 | ||
435 | ACPI_ERROR((AE_INFO, | 441 | ACPI_ERROR((AE_INFO, |
@@ -569,6 +575,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
569 | &this_node); | 575 | &this_node); |
570 | if (ACPI_FAILURE(status)) { | 576 | if (ACPI_FAILURE(status)) { |
571 | if (status == AE_NOT_FOUND) { | 577 | if (status == AE_NOT_FOUND) { |
578 | |||
572 | /* Name not found in ACPI namespace */ | 579 | /* Name not found in ACPI namespace */ |
573 | 580 | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 581 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
@@ -602,10 +609,11 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
602 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && | 609 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && |
603 | (this_node->type != ACPI_TYPE_ANY) && | 610 | (this_node->type != ACPI_TYPE_ANY) && |
604 | (this_node->type != type_to_check_for)) { | 611 | (this_node->type != type_to_check_for)) { |
612 | |||
605 | /* Complain about a type mismatch */ | 613 | /* Complain about a type mismatch */ |
606 | 614 | ||
607 | ACPI_WARNING((AE_INFO, | 615 | ACPI_WARNING((AE_INFO, |
608 | "ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)", | 616 | "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", |
609 | ACPI_CAST_PTR(char, &simple_name), | 617 | ACPI_CAST_PTR(char, &simple_name), |
610 | acpi_ut_get_type_name(this_node->type), | 618 | acpi_ut_get_type_name(this_node->type), |
611 | acpi_ut_get_type_name | 619 | acpi_ut_get_type_name |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 9b871f38b61b..dc3f0739a46b 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -47,9 +47,6 @@ | |||
47 | #define _COMPONENT ACPI_NAMESPACE | 47 | #define _COMPONENT ACPI_NAMESPACE |
48 | ACPI_MODULE_NAME("nsalloc") | 48 | ACPI_MODULE_NAME("nsalloc") |
49 | 49 | ||
50 | /* Local prototypes */ | ||
51 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | ||
52 | |||
53 | /******************************************************************************* | 50 | /******************************************************************************* |
54 | * | 51 | * |
55 | * FUNCTION: acpi_ns_create_node | 52 | * FUNCTION: acpi_ns_create_node |
@@ -61,14 +58,13 @@ static void acpi_ns_remove_reference(struct acpi_namespace_node *node); | |||
61 | * DESCRIPTION: Create a namespace node | 58 | * DESCRIPTION: Create a namespace node |
62 | * | 59 | * |
63 | ******************************************************************************/ | 60 | ******************************************************************************/ |
64 | |||
65 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) | 61 | struct acpi_namespace_node *acpi_ns_create_node(u32 name) |
66 | { | 62 | { |
67 | struct acpi_namespace_node *node; | 63 | struct acpi_namespace_node *node; |
68 | 64 | ||
69 | ACPI_FUNCTION_TRACE("ns_create_node"); | 65 | ACPI_FUNCTION_TRACE(ns_create_node); |
70 | 66 | ||
71 | node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node)); | 67 | node = acpi_os_acquire_object(acpi_gbl_namespace_cache); |
72 | if (!node) { | 68 | if (!node) { |
73 | return_PTR(NULL); | 69 | return_PTR(NULL); |
74 | } | 70 | } |
@@ -76,9 +72,7 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) | |||
76 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); | 72 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++); |
77 | 73 | ||
78 | node->name.integer = name; | 74 | node->name.integer = name; |
79 | node->reference_count = 1; | ||
80 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); | 75 | ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED); |
81 | |||
82 | return_PTR(node); | 76 | return_PTR(node); |
83 | } | 77 | } |
84 | 78 | ||
@@ -100,7 +94,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
100 | struct acpi_namespace_node *prev_node; | 94 | struct acpi_namespace_node *prev_node; |
101 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *next_node; |
102 | 96 | ||
103 | ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node); | 97 | ACPI_FUNCTION_TRACE_PTR(ns_delete_node, node); |
104 | 98 | ||
105 | parent_node = acpi_ns_get_parent_node(node); | 99 | parent_node = acpi_ns_get_parent_node(node); |
106 | 100 | ||
@@ -115,6 +109,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
115 | } | 109 | } |
116 | 110 | ||
117 | if (prev_node) { | 111 | if (prev_node) { |
112 | |||
118 | /* Node is not first child, unlink it */ | 113 | /* Node is not first child, unlink it */ |
119 | 114 | ||
120 | prev_node->peer = next_node->peer; | 115 | prev_node->peer = next_node->peer; |
@@ -125,6 +120,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
125 | /* Node is first child (has no previous peer) */ | 120 | /* Node is first child (has no previous peer) */ |
126 | 121 | ||
127 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 122 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { |
123 | |||
128 | /* No peers at all */ | 124 | /* No peers at all */ |
129 | 125 | ||
130 | parent_node->child = NULL; | 126 | parent_node->child = NULL; |
@@ -137,10 +133,10 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) | |||
137 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); | 133 | ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++); |
138 | 134 | ||
139 | /* | 135 | /* |
140 | * Detach an object if there is one then delete the node | 136 | * Detach an object if there is one, then delete the node |
141 | */ | 137 | */ |
142 | acpi_ns_detach_object(node); | 138 | acpi_ns_detach_object(node); |
143 | ACPI_MEM_FREE(node); | 139 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, node); |
144 | return_VOID; | 140 | return_VOID; |
145 | } | 141 | } |
146 | 142 | ||
@@ -171,7 +167,7 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
171 | acpi_owner_id owner_id = 0; | 167 | acpi_owner_id owner_id = 0; |
172 | struct acpi_namespace_node *child_node; | 168 | struct acpi_namespace_node *child_node; |
173 | 169 | ||
174 | ACPI_FUNCTION_TRACE("ns_install_node"); | 170 | ACPI_FUNCTION_TRACE(ns_install_node); |
175 | 171 | ||
176 | /* | 172 | /* |
177 | * Get the owner ID from the Walk state | 173 | * Get the owner ID from the Walk state |
@@ -216,14 +212,6 @@ void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namesp | |||
216 | acpi_ut_get_type_name(parent_node->type), | 212 | acpi_ut_get_type_name(parent_node->type), |
217 | parent_node)); | 213 | parent_node)); |
218 | 214 | ||
219 | /* | ||
220 | * Increment the reference count(s) of all parents up to | ||
221 | * the root! | ||
222 | */ | ||
223 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
224 | node->reference_count++; | ||
225 | } | ||
226 | |||
227 | return_VOID; | 215 | return_VOID; |
228 | } | 216 | } |
229 | 217 | ||
@@ -244,10 +232,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
244 | { | 232 | { |
245 | struct acpi_namespace_node *child_node; | 233 | struct acpi_namespace_node *child_node; |
246 | struct acpi_namespace_node *next_node; | 234 | struct acpi_namespace_node *next_node; |
247 | struct acpi_namespace_node *node; | ||
248 | u8 flags; | 235 | u8 flags; |
249 | 236 | ||
250 | ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node); | 237 | ACPI_FUNCTION_TRACE_PTR(ns_delete_children, parent_node); |
251 | 238 | ||
252 | if (!parent_node) { | 239 | if (!parent_node) { |
253 | return_VOID; | 240 | return_VOID; |
@@ -264,6 +251,7 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
264 | * Deallocate all children at this level | 251 | * Deallocate all children at this level |
265 | */ | 252 | */ |
266 | do { | 253 | do { |
254 | |||
267 | /* Get the things we need */ | 255 | /* Get the things we need */ |
268 | 256 | ||
269 | next_node = child_node->peer; | 257 | next_node = child_node->peer; |
@@ -289,26 +277,10 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node) | |||
289 | */ | 277 | */ |
290 | acpi_ns_detach_object(child_node); | 278 | acpi_ns_detach_object(child_node); |
291 | 279 | ||
292 | /* | ||
293 | * Decrement the reference count(s) of all parents up to | ||
294 | * the root! (counts were incremented when the node was created) | ||
295 | */ | ||
296 | node = child_node; | ||
297 | while ((node = acpi_ns_get_parent_node(node)) != NULL) { | ||
298 | node->reference_count--; | ||
299 | } | ||
300 | |||
301 | /* There should be only one reference remaining on this node */ | ||
302 | |||
303 | if (child_node->reference_count != 1) { | ||
304 | ACPI_WARNING((AE_INFO, | ||
305 | "Existing references (%d) on node being deleted (%p)", | ||
306 | child_node->reference_count, child_node)); | ||
307 | } | ||
308 | |||
309 | /* Now we can delete the node */ | 280 | /* Now we can delete the node */ |
310 | 281 | ||
311 | ACPI_MEM_FREE(child_node); | 282 | (void)acpi_os_release_object(acpi_gbl_namespace_cache, |
283 | child_node); | ||
312 | 284 | ||
313 | /* And move on to the next child in the list */ | 285 | /* And move on to the next child in the list */ |
314 | 286 | ||
@@ -341,7 +313,7 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
341 | struct acpi_namespace_node *child_node = NULL; | 313 | struct acpi_namespace_node *child_node = NULL; |
342 | u32 level = 1; | 314 | u32 level = 1; |
343 | 315 | ||
344 | ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree"); | 316 | ACPI_FUNCTION_TRACE(ns_delete_namespace_subtree); |
345 | 317 | ||
346 | if (!parent_node) { | 318 | if (!parent_node) { |
347 | return_VOID; | 319 | return_VOID; |
@@ -352,11 +324,14 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
352 | * to where we started. | 324 | * to where we started. |
353 | */ | 325 | */ |
354 | while (level > 0) { | 326 | while (level > 0) { |
327 | |||
355 | /* Get the next node in this scope (NULL if none) */ | 328 | /* Get the next node in this scope (NULL if none) */ |
356 | 329 | ||
357 | child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, | 330 | child_node = |
358 | child_node); | 331 | acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node, |
332 | child_node); | ||
359 | if (child_node) { | 333 | if (child_node) { |
334 | |||
360 | /* Found a child node - detach any attached object */ | 335 | /* Found a child node - detach any attached object */ |
361 | 336 | ||
362 | acpi_ns_detach_object(child_node); | 337 | acpi_ns_detach_object(child_node); |
@@ -401,55 +376,6 @@ void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node) | |||
401 | 376 | ||
402 | /******************************************************************************* | 377 | /******************************************************************************* |
403 | * | 378 | * |
404 | * FUNCTION: acpi_ns_remove_reference | ||
405 | * | ||
406 | * PARAMETERS: Node - Named node whose reference count is to be | ||
407 | * decremented | ||
408 | * | ||
409 | * RETURN: None. | ||
410 | * | ||
411 | * DESCRIPTION: Remove a Node reference. Decrements the reference count | ||
412 | * of all parent Nodes up to the root. Any node along | ||
413 | * the way that reaches zero references is freed. | ||
414 | * | ||
415 | ******************************************************************************/ | ||
416 | |||
417 | static void acpi_ns_remove_reference(struct acpi_namespace_node *node) | ||
418 | { | ||
419 | struct acpi_namespace_node *parent_node; | ||
420 | struct acpi_namespace_node *this_node; | ||
421 | |||
422 | ACPI_FUNCTION_ENTRY(); | ||
423 | |||
424 | /* | ||
425 | * Decrement the reference count(s) of this node and all | ||
426 | * nodes up to the root, Delete anything with zero remaining references. | ||
427 | */ | ||
428 | this_node = node; | ||
429 | while (this_node) { | ||
430 | /* Prepare to move up to parent */ | ||
431 | |||
432 | parent_node = acpi_ns_get_parent_node(this_node); | ||
433 | |||
434 | /* Decrement the reference count on this node */ | ||
435 | |||
436 | this_node->reference_count--; | ||
437 | |||
438 | /* Delete the node if no more references */ | ||
439 | |||
440 | if (!this_node->reference_count) { | ||
441 | /* Delete all children and delete the node */ | ||
442 | |||
443 | acpi_ns_delete_children(this_node); | ||
444 | acpi_ns_delete_node(this_node); | ||
445 | } | ||
446 | |||
447 | this_node = parent_node; | ||
448 | } | ||
449 | } | ||
450 | |||
451 | /******************************************************************************* | ||
452 | * | ||
453 | * FUNCTION: acpi_ns_delete_namespace_by_owner | 379 | * FUNCTION: acpi_ns_delete_namespace_by_owner |
454 | * | 380 | * |
455 | * PARAMETERS: owner_id - All nodes with this owner will be deleted | 381 | * PARAMETERS: owner_id - All nodes with this owner will be deleted |
@@ -469,15 +395,15 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
469 | u32 level; | 395 | u32 level; |
470 | struct acpi_namespace_node *parent_node; | 396 | struct acpi_namespace_node *parent_node; |
471 | 397 | ||
472 | ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id); | 398 | ACPI_FUNCTION_TRACE_U32(ns_delete_namespace_by_owner, owner_id); |
473 | 399 | ||
474 | if (owner_id == 0) { | 400 | if (owner_id == 0) { |
475 | return_VOID; | 401 | return_VOID; |
476 | } | 402 | } |
477 | 403 | ||
404 | deletion_node = NULL; | ||
478 | parent_node = acpi_gbl_root_node; | 405 | parent_node = acpi_gbl_root_node; |
479 | child_node = NULL; | 406 | child_node = NULL; |
480 | deletion_node = NULL; | ||
481 | level = 1; | 407 | level = 1; |
482 | 408 | ||
483 | /* | 409 | /* |
@@ -494,12 +420,14 @@ void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id) | |||
494 | child_node); | 420 | child_node); |
495 | 421 | ||
496 | if (deletion_node) { | 422 | if (deletion_node) { |
497 | acpi_ns_remove_reference(deletion_node); | 423 | acpi_ns_delete_children(deletion_node); |
424 | acpi_ns_delete_node(deletion_node); | ||
498 | deletion_node = NULL; | 425 | deletion_node = NULL; |
499 | } | 426 | } |
500 | 427 | ||
501 | if (child_node) { | 428 | if (child_node) { |
502 | if (child_node->owner_id == owner_id) { | 429 | if (child_node->owner_id == owner_id) { |
430 | |||
503 | /* Found a matching child node - detach any attached object */ | 431 | /* Found a matching child node - detach any attached object */ |
504 | 432 | ||
505 | acpi_ns_detach_object(child_node); | 433 | acpi_ns_detach_object(child_node); |
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index a2807317a84b..d72df66aa965 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -75,7 +75,7 @@ void acpi_ns_print_pathname(u32 num_segments, char *pathname) | |||
75 | { | 75 | { |
76 | acpi_native_uint i; | 76 | acpi_native_uint i; |
77 | 77 | ||
78 | ACPI_FUNCTION_NAME("ns_print_pathname"); | 78 | ACPI_FUNCTION_NAME(ns_print_pathname); |
79 | 79 | ||
80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) | 80 | if (!(acpi_dbg_level & ACPI_LV_NAMES) |
81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { | 81 | || !(acpi_dbg_layer & ACPI_NAMESPACE)) { |
@@ -123,7 +123,7 @@ void | |||
123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) | 123 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) |
124 | { | 124 | { |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ns_dump_pathname"); | 126 | ACPI_FUNCTION_TRACE(ns_dump_pathname); |
127 | 127 | ||
128 | /* Do this only if the requested debug level and component are enabled */ | 128 | /* Do this only if the requested debug level and component are enabled */ |
129 | 129 | ||
@@ -167,7 +167,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
167 | u32 dbg_level; | 167 | u32 dbg_level; |
168 | u32 i; | 168 | u32 i; |
169 | 169 | ||
170 | ACPI_FUNCTION_NAME("ns_dump_one_object"); | 170 | ACPI_FUNCTION_NAME(ns_dump_one_object); |
171 | 171 | ||
172 | /* Is output enabled? */ | 172 | /* Is output enabled? */ |
173 | 173 | ||
@@ -191,6 +191,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
191 | } | 191 | } |
192 | 192 | ||
193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { | 193 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { |
194 | |||
194 | /* Indent the object according to the level */ | 195 | /* Indent the object according to the level */ |
195 | 196 | ||
196 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); | 197 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); |
@@ -203,6 +204,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
203 | } | 204 | } |
204 | 205 | ||
205 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { | 206 | if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { |
207 | this_node->name.integer = | ||
208 | acpi_ut_repair_name(this_node->name.integer); | ||
209 | |||
206 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", | 210 | ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X", |
207 | this_node->name.integer)); | 211 | this_node->name.integer)); |
208 | } | 212 | } |
@@ -226,6 +230,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
226 | case ACPI_DISPLAY_SUMMARY: | 230 | case ACPI_DISPLAY_SUMMARY: |
227 | 231 | ||
228 | if (!obj_desc) { | 232 | if (!obj_desc) { |
233 | |||
229 | /* No attached object, we are done */ | 234 | /* No attached object, we are done */ |
230 | 235 | ||
231 | acpi_os_printf("\n"); | 236 | acpi_os_printf("\n"); |
@@ -419,6 +424,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
419 | 424 | ||
420 | acpi_os_printf("O:%p", obj_desc); | 425 | acpi_os_printf("O:%p", obj_desc); |
421 | if (!obj_desc) { | 426 | if (!obj_desc) { |
427 | |||
422 | /* No attached object, we are done */ | 428 | /* No attached object, we are done */ |
423 | 429 | ||
424 | acpi_os_printf("\n"); | 430 | acpi_os_printf("\n"); |
@@ -669,7 +675,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
669 | { | 675 | { |
670 | acpi_handle search_handle = search_base; | 676 | acpi_handle search_handle = search_base; |
671 | 677 | ||
672 | ACPI_FUNCTION_TRACE("ns_dump_tables"); | 678 | ACPI_FUNCTION_TRACE(ns_dump_tables); |
673 | 679 | ||
674 | if (!acpi_gbl_root_node) { | 680 | if (!acpi_gbl_root_node) { |
675 | /* | 681 | /* |
@@ -682,6 +688,7 @@ void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) | |||
682 | } | 688 | } |
683 | 689 | ||
684 | if (ACPI_NS_ALL == search_base) { | 690 | if (ACPI_NS_ALL == search_base) { |
691 | |||
685 | /* Entire namespace */ | 692 | /* Entire namespace */ |
686 | 693 | ||
687 | search_handle = acpi_gbl_root_node; | 694 | search_handle = acpi_gbl_root_node; |
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index aff899a935e3..c6bf5d30fca3 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -74,7 +74,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
74 | acpi_status status; | 74 | acpi_status status; |
75 | u32 i; | 75 | u32 i; |
76 | 76 | ||
77 | ACPI_FUNCTION_NAME("ns_dump_one_device"); | 77 | ACPI_FUNCTION_NAME(ns_dump_one_device); |
78 | 78 | ||
79 | status = | 79 | status = |
80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); | 80 | acpi_ns_dump_one_object(obj_handle, level, context, return_value); |
@@ -92,7 +92,7 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, | |||
92 | info->hardware_id.value, | 92 | info->hardware_id.value, |
93 | ACPI_FORMAT_UINT64(info->address), | 93 | ACPI_FORMAT_UINT64(info->address), |
94 | info->current_status)); | 94 | info->current_status)); |
95 | ACPI_MEM_FREE(info); | 95 | ACPI_FREE(info); |
96 | } | 96 | } |
97 | 97 | ||
98 | return (status); | 98 | return (status); |
@@ -115,7 +115,7 @@ void acpi_ns_dump_root_devices(void) | |||
115 | acpi_handle sys_bus_handle; | 115 | acpi_handle sys_bus_handle; |
116 | acpi_status status; | 116 | acpi_status status; |
117 | 117 | ||
118 | ACPI_FUNCTION_NAME("ns_dump_root_devices"); | 118 | ACPI_FUNCTION_NAME(ns_dump_root_devices); |
119 | 119 | ||
120 | /* Only dump the table if tracing is enabled */ | 120 | /* Only dump the table if tracing is enabled */ |
121 | 121 | ||
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 19d7b94d40c3..4b0a4a8c9843 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /******************************************************************************* | 1 | /******************************************************************************* |
2 | * | 2 | * |
3 | * Module Name: nseval - Object evaluation interfaces -- includes control | 3 | * Module Name: nseval - Object evaluation, includes control method execution |
4 | * method lookup and execution. | ||
5 | * | 4 | * |
6 | ******************************************************************************/ | 5 | ******************************************************************************/ |
7 | 6 | ||
@@ -50,196 +49,14 @@ | |||
50 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
51 | ACPI_MODULE_NAME("nseval") | 50 | ACPI_MODULE_NAME("nseval") |
52 | 51 | ||
53 | /* Local prototypes */ | ||
54 | static acpi_status | ||
55 | acpi_ns_execute_control_method(struct acpi_parameter_info *info); | ||
56 | |||
57 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info); | ||
58 | |||
59 | /******************************************************************************* | ||
60 | * | ||
61 | * FUNCTION: acpi_ns_evaluate_relative | ||
62 | * | ||
63 | * PARAMETERS: Pathname - Name of method to execute, If NULL, the | ||
64 | * handle is the object to execute | ||
65 | * Info - Method info block, contains: | ||
66 | * return_object - Where to put method's return value (if | ||
67 | * any). If NULL, no value is returned. | ||
68 | * Params - List of parameters to pass to the method, | ||
69 | * terminated by NULL. Params itself may be | ||
70 | * NULL if no parameters are being passed. | ||
71 | * | ||
72 | * RETURN: Status | ||
73 | * | ||
74 | * DESCRIPTION: Evaluate the object or find and execute the requested method | ||
75 | * | ||
76 | * MUTEX: Locks Namespace | ||
77 | * | ||
78 | ******************************************************************************/ | ||
79 | |||
80 | acpi_status | ||
81 | acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info) | ||
82 | { | ||
83 | acpi_status status; | ||
84 | struct acpi_namespace_node *node = NULL; | ||
85 | union acpi_generic_state *scope_info; | ||
86 | char *internal_path = NULL; | ||
87 | |||
88 | ACPI_FUNCTION_TRACE("ns_evaluate_relative"); | ||
89 | |||
90 | /* | ||
91 | * Must have a valid object handle | ||
92 | */ | ||
93 | if (!info || !info->node) { | ||
94 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
95 | } | ||
96 | |||
97 | /* Build an internal name string for the method */ | ||
98 | |||
99 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
100 | if (ACPI_FAILURE(status)) { | ||
101 | return_ACPI_STATUS(status); | ||
102 | } | ||
103 | |||
104 | scope_info = acpi_ut_create_generic_state(); | ||
105 | if (!scope_info) { | ||
106 | goto cleanup1; | ||
107 | } | ||
108 | |||
109 | /* Get the prefix handle and Node */ | ||
110 | |||
111 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
112 | if (ACPI_FAILURE(status)) { | ||
113 | goto cleanup; | ||
114 | } | ||
115 | |||
116 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
117 | if (!info->node) { | ||
118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
119 | status = AE_BAD_PARAMETER; | ||
120 | goto cleanup; | ||
121 | } | ||
122 | |||
123 | /* Lookup the name in the namespace */ | ||
124 | |||
125 | scope_info->scope.node = info->node; | ||
126 | status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY, | ||
127 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
128 | &node); | ||
129 | |||
130 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
131 | |||
132 | if (ACPI_FAILURE(status)) { | ||
133 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n", | ||
134 | pathname, acpi_format_exception(status))); | ||
135 | goto cleanup; | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
140 | */ | ||
141 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
142 | pathname, node, acpi_ns_get_attached_object(node))); | ||
143 | |||
144 | info->node = node; | ||
145 | status = acpi_ns_evaluate_by_handle(info); | ||
146 | |||
147 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
148 | "*** Completed eval of object %s ***\n", pathname)); | ||
149 | |||
150 | cleanup: | ||
151 | acpi_ut_delete_generic_state(scope_info); | ||
152 | |||
153 | cleanup1: | ||
154 | ACPI_MEM_FREE(internal_path); | ||
155 | return_ACPI_STATUS(status); | ||
156 | } | ||
157 | |||
158 | /******************************************************************************* | 52 | /******************************************************************************* |
159 | * | 53 | * |
160 | * FUNCTION: acpi_ns_evaluate_by_name | 54 | * FUNCTION: acpi_ns_evaluate |
161 | * | 55 | * |
162 | * PARAMETERS: Pathname - Fully qualified pathname to the object | 56 | * PARAMETERS: Info - Evaluation info block, contains: |
163 | * Info - Method info block, contains: | 57 | * prefix_node - Prefix or Method/Object Node to execute |
164 | * return_object - Where to put method's return value (if | 58 | * Pathname - Name of method to execute, If NULL, the |
165 | * any). If NULL, no value is returned. | 59 | * Node is the object to execute |
166 | * Params - List of parameters to pass to the method, | ||
167 | * terminated by NULL. Params itself may be | ||
168 | * NULL if no parameters are being passed. | ||
169 | * | ||
170 | * RETURN: Status | ||
171 | * | ||
172 | * DESCRIPTION: Evaluate the object or rind and execute the requested method | ||
173 | * passing the given parameters | ||
174 | * | ||
175 | * MUTEX: Locks Namespace | ||
176 | * | ||
177 | ******************************************************************************/ | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | ||
181 | { | ||
182 | acpi_status status; | ||
183 | char *internal_path = NULL; | ||
184 | |||
185 | ACPI_FUNCTION_TRACE("ns_evaluate_by_name"); | ||
186 | |||
187 | /* Build an internal name string for the method */ | ||
188 | |||
189 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
190 | if (ACPI_FAILURE(status)) { | ||
191 | return_ACPI_STATUS(status); | ||
192 | } | ||
193 | |||
194 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | ||
195 | if (ACPI_FAILURE(status)) { | ||
196 | goto cleanup; | ||
197 | } | ||
198 | |||
199 | /* Lookup the name in the namespace */ | ||
200 | |||
201 | status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY, | ||
202 | ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL, | ||
203 | &info->node); | ||
204 | |||
205 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
206 | |||
207 | if (ACPI_FAILURE(status)) { | ||
208 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
209 | "Object at [%s] was not found, status=%.4X\n", | ||
210 | pathname, status)); | ||
211 | goto cleanup; | ||
212 | } | ||
213 | |||
214 | /* | ||
215 | * Now that we have a handle to the object, we can attempt to evaluate it. | ||
216 | */ | ||
217 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", | ||
218 | pathname, info->node, | ||
219 | acpi_ns_get_attached_object(info->node))); | ||
220 | |||
221 | status = acpi_ns_evaluate_by_handle(info); | ||
222 | |||
223 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
224 | "*** Completed eval of object %s ***\n", pathname)); | ||
225 | |||
226 | cleanup: | ||
227 | |||
228 | /* Cleanup */ | ||
229 | |||
230 | if (internal_path) { | ||
231 | ACPI_MEM_FREE(internal_path); | ||
232 | } | ||
233 | |||
234 | return_ACPI_STATUS(status); | ||
235 | } | ||
236 | |||
237 | /******************************************************************************* | ||
238 | * | ||
239 | * FUNCTION: acpi_ns_evaluate_by_handle | ||
240 | * | ||
241 | * PARAMETERS: Info - Method info block, contains: | ||
242 | * Node - Method/Object Node to execute | ||
243 | * Parameters - List of parameters to pass to the method, | 60 | * Parameters - List of parameters to pass to the method, |
244 | * terminated by NULL. Params itself may be | 61 | * terminated by NULL. Params itself may be |
245 | * NULL if no parameters are being passed. | 62 | * NULL if no parameters are being passed. |
@@ -248,29 +65,21 @@ acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info) | |||
248 | * parameter_type - Type of Parameter list | 65 | * parameter_type - Type of Parameter list |
249 | * return_object - Where to put method's return value (if | 66 | * return_object - Where to put method's return value (if |
250 | * any). If NULL, no value is returned. | 67 | * any). If NULL, no value is returned. |
68 | * Flags - ACPI_IGNORE_RETURN_VALUE to delete return | ||
251 | * | 69 | * |
252 | * RETURN: Status | 70 | * RETURN: Status |
253 | * | 71 | * |
254 | * DESCRIPTION: Evaluate object or execute the requested method passing the | 72 | * DESCRIPTION: Execute a control method or return the current value of an |
255 | * given parameters | 73 | * ACPI namespace object. |
256 | * | 74 | * |
257 | * MUTEX: Locks Namespace | 75 | * MUTEX: Locks interpreter |
258 | * | 76 | * |
259 | ******************************************************************************/ | 77 | ******************************************************************************/ |
260 | 78 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) | |
261 | acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | ||
262 | { | 79 | { |
263 | acpi_status status; | 80 | acpi_status status; |
264 | 81 | ||
265 | ACPI_FUNCTION_TRACE("ns_evaluate_by_handle"); | 82 | ACPI_FUNCTION_TRACE(ns_evaluate); |
266 | |||
267 | /* Check if namespace has been initialized */ | ||
268 | |||
269 | if (!acpi_gbl_root_node) { | ||
270 | return_ACPI_STATUS(AE_NO_NAMESPACE); | ||
271 | } | ||
272 | |||
273 | /* Parameter Validation */ | ||
274 | 83 | ||
275 | if (!info) { | 84 | if (!info) { |
276 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 85 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -280,202 +89,120 @@ acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info) | |||
280 | 89 | ||
281 | info->return_object = NULL; | 90 | info->return_object = NULL; |
282 | 91 | ||
283 | /* Get the prefix handle and Node */ | 92 | /* |
284 | 93 | * Get the actual namespace node for the target object. Handles these cases: | |
285 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 94 | * |
95 | * 1) Null node, Pathname (absolute path) | ||
96 | * 2) Node, Pathname (path relative to Node) | ||
97 | * 3) Node, Null Pathname | ||
98 | */ | ||
99 | status = acpi_ns_get_node(info->prefix_node, info->pathname, | ||
100 | ACPI_NS_NO_UPSEARCH, &info->resolved_node); | ||
286 | if (ACPI_FAILURE(status)) { | 101 | if (ACPI_FAILURE(status)) { |
287 | return_ACPI_STATUS(status); | 102 | return_ACPI_STATUS(status); |
288 | } | 103 | } |
289 | 104 | ||
290 | info->node = acpi_ns_map_handle_to_node(info->node); | ||
291 | if (!info->node) { | ||
292 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
293 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
294 | } | ||
295 | |||
296 | /* | 105 | /* |
297 | * For a method alias, we must grab the actual method node so that proper | 106 | * For a method alias, we must grab the actual method node so that proper |
298 | * scoping context will be established before execution. | 107 | * scoping context will be established before execution. |
299 | */ | 108 | */ |
300 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 109 | if (acpi_ns_get_type(info->resolved_node) == |
301 | info->node = | 110 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
111 | info->resolved_node = | ||
302 | ACPI_CAST_PTR(struct acpi_namespace_node, | 112 | ACPI_CAST_PTR(struct acpi_namespace_node, |
303 | info->node->object); | 113 | info->resolved_node->object); |
304 | } | 114 | } |
305 | 115 | ||
116 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n", info->pathname, | ||
117 | info->resolved_node, | ||
118 | acpi_ns_get_attached_object(info->resolved_node))); | ||
119 | |||
306 | /* | 120 | /* |
307 | * Two major cases here: | 121 | * Two major cases here: |
308 | * 1) The object is an actual control method -- execute it. | ||
309 | * 2) The object is not a method -- just return it's current value | ||
310 | * | 122 | * |
311 | * In both cases, the namespace is unlocked by the acpi_ns* procedure | 123 | * 1) The object is a control method -- execute it |
124 | * 2) The object is not a method -- just return it's current value | ||
312 | */ | 125 | */ |
313 | if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) { | 126 | if (acpi_ns_get_type(info->resolved_node) == ACPI_TYPE_METHOD) { |
314 | /* | ||
315 | * Case 1) We have an actual control method to execute | ||
316 | */ | ||
317 | status = acpi_ns_execute_control_method(info); | ||
318 | } else { | ||
319 | /* | 127 | /* |
320 | * Case 2) Object is NOT a method, just return its current value | 128 | * 1) Object is a control method - execute it |
321 | */ | 129 | */ |
322 | status = acpi_ns_get_object_value(info); | ||
323 | } | ||
324 | |||
325 | /* | ||
326 | * Check if there is a return value on the stack that must be dealt with | ||
327 | */ | ||
328 | if (status == AE_CTRL_RETURN_VALUE) { | ||
329 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
330 | |||
331 | status = AE_OK; | ||
332 | } | ||
333 | |||
334 | /* | ||
335 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
336 | * just return | ||
337 | */ | ||
338 | return_ACPI_STATUS(status); | ||
339 | } | ||
340 | |||
341 | /******************************************************************************* | ||
342 | * | ||
343 | * FUNCTION: acpi_ns_execute_control_method | ||
344 | * | ||
345 | * PARAMETERS: Info - Method info block, contains: | ||
346 | * Node - Method Node to execute | ||
347 | * obj_desc - Method object | ||
348 | * Parameters - List of parameters to pass to the method, | ||
349 | * terminated by NULL. Params itself may be | ||
350 | * NULL if no parameters are being passed. | ||
351 | * return_object - Where to put method's return value (if | ||
352 | * any). If NULL, no value is returned. | ||
353 | * parameter_type - Type of Parameter list | ||
354 | * return_object - Where to put method's return value (if | ||
355 | * any). If NULL, no value is returned. | ||
356 | * | ||
357 | * RETURN: Status | ||
358 | * | ||
359 | * DESCRIPTION: Execute the requested method passing the given parameters | ||
360 | * | ||
361 | * MUTEX: Assumes namespace is locked | ||
362 | * | ||
363 | ******************************************************************************/ | ||
364 | |||
365 | static acpi_status | ||
366 | acpi_ns_execute_control_method(struct acpi_parameter_info *info) | ||
367 | { | ||
368 | acpi_status status; | ||
369 | |||
370 | ACPI_FUNCTION_TRACE("ns_execute_control_method"); | ||
371 | |||
372 | /* Verify that there is a method associated with this object */ | ||
373 | |||
374 | info->obj_desc = acpi_ns_get_attached_object(info->node); | ||
375 | if (!info->obj_desc) { | ||
376 | ACPI_ERROR((AE_INFO, "No attached method object")); | ||
377 | 130 | ||
378 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 131 | /* Verify that there is a method object associated with this node */ |
379 | return_ACPI_STATUS(AE_NULL_OBJECT); | ||
380 | } | ||
381 | |||
382 | ACPI_DUMP_PATHNAME(info->node, "Execute Method:", | ||
383 | ACPI_LV_INFO, _COMPONENT); | ||
384 | |||
385 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", | ||
386 | info->obj_desc->method.aml_start + 1, | ||
387 | info->obj_desc->method.aml_length - 1)); | ||
388 | |||
389 | /* | ||
390 | * Unlock the namespace before execution. This allows namespace access | ||
391 | * via the external Acpi* interfaces while a method is being executed. | ||
392 | * However, any namespace deletion must acquire both the namespace and | ||
393 | * interpreter locks to ensure that no thread is using the portion of the | ||
394 | * namespace that is being deleted. | ||
395 | */ | ||
396 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
397 | if (ACPI_FAILURE(status)) { | ||
398 | return_ACPI_STATUS(status); | ||
399 | } | ||
400 | 132 | ||
401 | /* | 133 | info->obj_desc = |
402 | * Execute the method via the interpreter. The interpreter is locked | 134 | acpi_ns_get_attached_object(info->resolved_node); |
403 | * here before calling into the AML parser | 135 | if (!info->obj_desc) { |
404 | */ | 136 | ACPI_ERROR((AE_INFO, |
405 | status = acpi_ex_enter_interpreter(); | 137 | "Control method has no attached sub-object")); |
406 | if (ACPI_FAILURE(status)) { | 138 | return_ACPI_STATUS(AE_NULL_OBJECT); |
407 | return_ACPI_STATUS(status); | 139 | } |
408 | } | ||
409 | 140 | ||
410 | status = acpi_ps_execute_method(info); | 141 | ACPI_DUMP_PATHNAME(info->resolved_node, "Execute Method:", |
411 | acpi_ex_exit_interpreter(); | 142 | ACPI_LV_INFO, _COMPONENT); |
412 | 143 | ||
413 | return_ACPI_STATUS(status); | 144 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
414 | } | 145 | "Method at AML address %p Length %X\n", |
146 | info->obj_desc->method.aml_start + 1, | ||
147 | info->obj_desc->method.aml_length - 1)); | ||
415 | 148 | ||
416 | /******************************************************************************* | 149 | /* |
417 | * | 150 | * Any namespace deletion must acquire both the namespace and |
418 | * FUNCTION: acpi_ns_get_object_value | 151 | * interpreter locks to ensure that no thread is using the portion of |
419 | * | 152 | * the namespace that is being deleted. |
420 | * PARAMETERS: Info - Method info block, contains: | 153 | * |
421 | * Node - Object's NS node | 154 | * Execute the method via the interpreter. The interpreter is locked |
422 | * return_object - Where to put object value (if | 155 | * here before calling into the AML parser |
423 | * any). If NULL, no value is returned. | 156 | */ |
424 | * | 157 | status = acpi_ex_enter_interpreter(); |
425 | * RETURN: Status | 158 | if (ACPI_FAILURE(status)) { |
426 | * | 159 | return_ACPI_STATUS(status); |
427 | * DESCRIPTION: Return the current value of the object | 160 | } |
428 | * | ||
429 | * MUTEX: Assumes namespace is locked, leaves namespace unlocked | ||
430 | * | ||
431 | ******************************************************************************/ | ||
432 | 161 | ||
433 | static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | 162 | status = acpi_ps_execute_method(info); |
434 | { | 163 | acpi_ex_exit_interpreter(); |
435 | acpi_status status = AE_OK; | 164 | } else { |
436 | struct acpi_namespace_node *resolved_node = info->node; | 165 | /* |
166 | * 2) Object is not a method, return its current value | ||
167 | */ | ||
437 | 168 | ||
438 | ACPI_FUNCTION_TRACE("ns_get_object_value"); | 169 | /* |
170 | * Objects require additional resolution steps (e.g., the Node may be | ||
171 | * a field that must be read, etc.) -- we can't just grab the object | ||
172 | * out of the node. | ||
173 | * | ||
174 | * Use resolve_node_to_value() to get the associated value. | ||
175 | * | ||
176 | * NOTE: we can get away with passing in NULL for a walk state because | ||
177 | * resolved_node is guaranteed to not be a reference to either a method | ||
178 | * local or a method argument (because this interface is never called | ||
179 | * from a running method.) | ||
180 | * | ||
181 | * Even though we do not directly invoke the interpreter for object | ||
182 | * resolution, we must lock it because we could access an opregion. | ||
183 | * The opregion access code assumes that the interpreter is locked. | ||
184 | */ | ||
185 | status = acpi_ex_enter_interpreter(); | ||
186 | if (ACPI_FAILURE(status)) { | ||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
439 | 189 | ||
440 | /* | 190 | /* Function has a strange interface */ |
441 | * Objects require additional resolution steps (e.g., the Node may be a | ||
442 | * field that must be read, etc.) -- we can't just grab the object out of | ||
443 | * the node. | ||
444 | */ | ||
445 | 191 | ||
446 | /* | 192 | status = |
447 | * Use resolve_node_to_value() to get the associated value. This call always | 193 | acpi_ex_resolve_node_to_value(&info->resolved_node, NULL); |
448 | * deletes obj_desc (allocated above). | 194 | acpi_ex_exit_interpreter(); |
449 | * | ||
450 | * NOTE: we can get away with passing in NULL for a walk state because | ||
451 | * obj_desc is guaranteed to not be a reference to either a method local or | ||
452 | * a method argument (because this interface can only be called from the | ||
453 | * acpi_evaluate external interface, never called from a running method.) | ||
454 | * | ||
455 | * Even though we do not directly invoke the interpreter for this, we must | ||
456 | * enter it because we could access an opregion. The opregion access code | ||
457 | * assumes that the interpreter is locked. | ||
458 | * | ||
459 | * We must release the namespace lock before entering the intepreter. | ||
460 | */ | ||
461 | status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | ||
462 | if (ACPI_FAILURE(status)) { | ||
463 | return_ACPI_STATUS(status); | ||
464 | } | ||
465 | 195 | ||
466 | status = acpi_ex_enter_interpreter(); | ||
467 | if (ACPI_SUCCESS(status)) { | ||
468 | status = acpi_ex_resolve_node_to_value(&resolved_node, NULL); | ||
469 | /* | 196 | /* |
470 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed | 197 | * If acpi_ex_resolve_node_to_value() succeeded, the return value was placed |
471 | * in resolved_node. | 198 | * in resolved_node. |
472 | */ | 199 | */ |
473 | acpi_ex_exit_interpreter(); | ||
474 | |||
475 | if (ACPI_SUCCESS(status)) { | 200 | if (ACPI_SUCCESS(status)) { |
476 | status = AE_CTRL_RETURN_VALUE; | 201 | status = AE_CTRL_RETURN_VALUE; |
477 | info->return_object = ACPI_CAST_PTR | 202 | info->return_object = |
478 | (union acpi_operand_object, resolved_node); | 203 | ACPI_CAST_PTR(union acpi_operand_object, |
204 | info->resolved_node); | ||
205 | |||
479 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
480 | "Returning object %p [%s]\n", | 207 | "Returning object %p [%s]\n", |
481 | info->return_object, | 208 | info->return_object, |
@@ -484,7 +211,30 @@ static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info) | |||
484 | } | 211 | } |
485 | } | 212 | } |
486 | 213 | ||
487 | /* Namespace is unlocked */ | 214 | /* |
215 | * Check if there is a return value that must be dealt with | ||
216 | */ | ||
217 | if (status == AE_CTRL_RETURN_VALUE) { | ||
218 | |||
219 | /* If caller does not want the return value, delete it */ | ||
488 | 220 | ||
221 | if (info->flags & ACPI_IGNORE_RETURN_VALUE) { | ||
222 | acpi_ut_remove_reference(info->return_object); | ||
223 | info->return_object = NULL; | ||
224 | } | ||
225 | |||
226 | /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ | ||
227 | |||
228 | status = AE_OK; | ||
229 | } | ||
230 | |||
231 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | ||
232 | "*** Completed evaluation of object %s ***\n", | ||
233 | info->pathname)); | ||
234 | |||
235 | /* | ||
236 | * Namespace was unlocked by the handling acpi_ns* function, so we | ||
237 | * just return | ||
238 | */ | ||
489 | return_ACPI_STATUS(status); | 239 | return_ACPI_STATUS(status); |
490 | } | 240 | } |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 9f929e479fd8..aec8488c0019 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -58,6 +58,10 @@ static acpi_status | |||
58 | acpi_ns_init_one_device(acpi_handle obj_handle, | 58 | acpi_ns_init_one_device(acpi_handle obj_handle, |
59 | u32 nesting_level, void *context, void **return_value); | 59 | u32 nesting_level, void *context, void **return_value); |
60 | 60 | ||
61 | static acpi_status | ||
62 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
63 | u32 nesting_level, void *context, void **return_value); | ||
64 | |||
61 | /******************************************************************************* | 65 | /******************************************************************************* |
62 | * | 66 | * |
63 | * FUNCTION: acpi_ns_initialize_objects | 67 | * FUNCTION: acpi_ns_initialize_objects |
@@ -76,7 +80,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
76 | acpi_status status; | 80 | acpi_status status; |
77 | struct acpi_init_walk_info info; | 81 | struct acpi_init_walk_info info; |
78 | 82 | ||
79 | ACPI_FUNCTION_TRACE("ns_initialize_objects"); | 83 | ACPI_FUNCTION_TRACE(ns_initialize_objects); |
80 | 84 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 85 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
82 | "**** Starting initialization of namespace objects ****\n")); | 86 | "**** Starting initialization of namespace objects ****\n")); |
@@ -93,7 +97,7 @@ acpi_status acpi_ns_initialize_objects(void) | |||
93 | ACPI_UINT32_MAX, acpi_ns_init_one_object, | 97 | ACPI_UINT32_MAX, acpi_ns_init_one_object, |
94 | &info, NULL); | 98 | &info, NULL); |
95 | if (ACPI_FAILURE(status)) { | 99 | if (ACPI_FAILURE(status)) { |
96 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 100 | ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace")); |
97 | } | 101 | } |
98 | 102 | ||
99 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 103 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
@@ -133,7 +137,7 @@ acpi_status acpi_ns_initialize_devices(void) | |||
133 | acpi_status status; | 137 | acpi_status status; |
134 | struct acpi_device_walk_info info; | 138 | struct acpi_device_walk_info info; |
135 | 139 | ||
136 | ACPI_FUNCTION_TRACE("ns_initialize_devices"); | 140 | ACPI_FUNCTION_TRACE(ns_initialize_devices); |
137 | 141 | ||
138 | /* Init counters */ | 142 | /* Init counters */ |
139 | 143 | ||
@@ -142,30 +146,46 @@ acpi_status acpi_ns_initialize_devices(void) | |||
142 | info.num_INI = 0; | 146 | info.num_INI = 0; |
143 | 147 | ||
144 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 148 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
145 | "Executing all Device _STA and_INI methods:")); | 149 | "Initializing Device/Processor/Thermal objects by executing _INI methods:")); |
150 | |||
151 | /* Tree analysis: find all subtrees that contain _INI methods */ | ||
146 | 152 | ||
147 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | 153 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
154 | ACPI_UINT32_MAX, FALSE, | ||
155 | acpi_ns_find_ini_methods, &info, NULL); | ||
148 | if (ACPI_FAILURE(status)) { | 156 | if (ACPI_FAILURE(status)) { |
149 | return_ACPI_STATUS(status); | 157 | goto error_exit; |
150 | } | 158 | } |
151 | 159 | ||
152 | /* Walk namespace for all objects */ | 160 | /* Allocate the evaluation information block */ |
161 | |||
162 | info.evaluate_info = | ||
163 | ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
164 | if (!info.evaluate_info) { | ||
165 | status = AE_NO_MEMORY; | ||
166 | goto error_exit; | ||
167 | } | ||
168 | |||
169 | /* Walk namespace to execute all _INIs on present devices */ | ||
153 | 170 | ||
154 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, | 171 | status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
155 | ACPI_UINT32_MAX, TRUE, | 172 | ACPI_UINT32_MAX, FALSE, |
156 | acpi_ns_init_one_device, &info, NULL); | 173 | acpi_ns_init_one_device, &info, NULL); |
157 | 174 | ||
158 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 175 | ACPI_FREE(info.evaluate_info); |
159 | |||
160 | if (ACPI_FAILURE(status)) { | 176 | if (ACPI_FAILURE(status)) { |
161 | ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace")); | 177 | goto error_exit; |
162 | } | 178 | } |
163 | 179 | ||
164 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 180 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
165 | "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n", | 181 | "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n", |
166 | info.device_count, info.num_STA, info.num_INI)); | 182 | info.num_INI, info.num_STA, info.device_count)); |
167 | 183 | ||
168 | return_ACPI_STATUS(status); | 184 | return_ACPI_STATUS(status); |
185 | |||
186 | error_exit: | ||
187 | ACPI_EXCEPTION((AE_INFO, status, "During device initialization")); | ||
188 | return_ACPI_STATUS(status); | ||
169 | } | 189 | } |
170 | 190 | ||
171 | /******************************************************************************* | 191 | /******************************************************************************* |
@@ -200,7 +220,7 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
200 | (struct acpi_namespace_node *)obj_handle; | 220 | (struct acpi_namespace_node *)obj_handle; |
201 | union acpi_operand_object *obj_desc; | 221 | union acpi_operand_object *obj_desc; |
202 | 222 | ||
203 | ACPI_FUNCTION_NAME("ns_init_one_object"); | 223 | ACPI_FUNCTION_NAME(ns_init_one_object); |
204 | 224 | ||
205 | info->object_count++; | 225 | info->object_count++; |
206 | 226 | ||
@@ -311,6 +331,72 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
311 | 331 | ||
312 | /******************************************************************************* | 332 | /******************************************************************************* |
313 | * | 333 | * |
334 | * FUNCTION: acpi_ns_find_ini_methods | ||
335 | * | ||
336 | * PARAMETERS: acpi_walk_callback | ||
337 | * | ||
338 | * RETURN: acpi_status | ||
339 | * | ||
340 | * DESCRIPTION: Called during namespace walk. Finds objects named _INI under | ||
341 | * device/processor/thermal objects, and marks the entire subtree | ||
342 | * with a SUBTREE_HAS_INI flag. This flag is used during the | ||
343 | * subsequent device initialization walk to avoid entire subtrees | ||
344 | * that do not contain an _INI. | ||
345 | * | ||
346 | ******************************************************************************/ | ||
347 | |||
348 | static acpi_status | ||
349 | acpi_ns_find_ini_methods(acpi_handle obj_handle, | ||
350 | u32 nesting_level, void *context, void **return_value) | ||
351 | { | ||
352 | struct acpi_device_walk_info *info = | ||
353 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); | ||
354 | struct acpi_namespace_node *node; | ||
355 | struct acpi_namespace_node *parent_node; | ||
356 | |||
357 | /* Keep count of device/processor/thermal objects */ | ||
358 | |||
359 | node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); | ||
360 | if ((node->type == ACPI_TYPE_DEVICE) || | ||
361 | (node->type == ACPI_TYPE_PROCESSOR) || | ||
362 | (node->type == ACPI_TYPE_THERMAL)) { | ||
363 | info->device_count++; | ||
364 | return (AE_OK); | ||
365 | } | ||
366 | |||
367 | /* We are only looking for methods named _INI */ | ||
368 | |||
369 | if (!ACPI_COMPARE_NAME(node->name.ascii, METHOD_NAME__INI)) { | ||
370 | return (AE_OK); | ||
371 | } | ||
372 | |||
373 | /* | ||
374 | * The only _INI methods that we care about are those that are | ||
375 | * present under Device, Processor, and Thermal objects. | ||
376 | */ | ||
377 | parent_node = acpi_ns_get_parent_node(node); | ||
378 | switch (parent_node->type) { | ||
379 | case ACPI_TYPE_DEVICE: | ||
380 | case ACPI_TYPE_PROCESSOR: | ||
381 | case ACPI_TYPE_THERMAL: | ||
382 | |||
383 | /* Mark parent and bubble up the INI present flag to the root */ | ||
384 | |||
385 | while (parent_node) { | ||
386 | parent_node->flags |= ANOBJ_SUBTREE_HAS_INI; | ||
387 | parent_node = acpi_ns_get_parent_node(parent_node); | ||
388 | } | ||
389 | break; | ||
390 | |||
391 | default: | ||
392 | break; | ||
393 | } | ||
394 | |||
395 | return (AE_OK); | ||
396 | } | ||
397 | |||
398 | /******************************************************************************* | ||
399 | * | ||
314 | * FUNCTION: acpi_ns_init_one_device | 400 | * FUNCTION: acpi_ns_init_one_device |
315 | * | 401 | * |
316 | * PARAMETERS: acpi_walk_callback | 402 | * PARAMETERS: acpi_walk_callback |
@@ -327,119 +413,165 @@ static acpi_status | |||
327 | acpi_ns_init_one_device(acpi_handle obj_handle, | 413 | acpi_ns_init_one_device(acpi_handle obj_handle, |
328 | u32 nesting_level, void *context, void **return_value) | 414 | u32 nesting_level, void *context, void **return_value) |
329 | { | 415 | { |
330 | struct acpi_device_walk_info *info = | 416 | struct acpi_device_walk_info *walk_info = |
331 | (struct acpi_device_walk_info *)context; | 417 | ACPI_CAST_PTR(struct acpi_device_walk_info, context); |
332 | struct acpi_parameter_info pinfo; | 418 | struct acpi_evaluate_info *info = walk_info->evaluate_info; |
333 | u32 flags; | 419 | u32 flags; |
334 | acpi_status status; | 420 | acpi_status status; |
335 | struct acpi_namespace_node *ini_node; | ||
336 | struct acpi_namespace_node *device_node; | 421 | struct acpi_namespace_node *device_node; |
337 | 422 | ||
338 | ACPI_FUNCTION_TRACE("ns_init_one_device"); | 423 | ACPI_FUNCTION_TRACE(ns_init_one_device); |
339 | 424 | ||
340 | device_node = acpi_ns_map_handle_to_node(obj_handle); | 425 | /* We are interested in Devices, Processors and thermal_zones only */ |
341 | if (!device_node) { | ||
342 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
343 | } | ||
344 | 426 | ||
345 | /* | 427 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); |
346 | * We will run _STA/_INI on Devices, Processors and thermal_zones only | ||
347 | */ | ||
348 | if ((device_node->type != ACPI_TYPE_DEVICE) && | 428 | if ((device_node->type != ACPI_TYPE_DEVICE) && |
349 | (device_node->type != ACPI_TYPE_PROCESSOR) && | 429 | (device_node->type != ACPI_TYPE_PROCESSOR) && |
350 | (device_node->type != ACPI_TYPE_THERMAL)) { | 430 | (device_node->type != ACPI_TYPE_THERMAL)) { |
351 | return_ACPI_STATUS(AE_OK); | 431 | return_ACPI_STATUS(AE_OK); |
352 | } | 432 | } |
353 | 433 | ||
354 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
355 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
356 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
357 | } | ||
358 | |||
359 | info->device_count++; | ||
360 | |||
361 | /* | 434 | /* |
362 | * Check if the _INI method exists for this device - | 435 | * Because of an earlier namespace analysis, all subtrees that contain an |
363 | * if _INI does not exist, there is no need to run _STA | 436 | * _INI method are tagged. |
364 | * No _INI means device requires no initialization | 437 | * |
438 | * If this device subtree does not contain any _INI methods, we | ||
439 | * can exit now and stop traversing this entire subtree. | ||
365 | */ | 440 | */ |
366 | status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI), | 441 | if (!(device_node->flags & ANOBJ_SUBTREE_HAS_INI)) { |
367 | device_node, ACPI_TYPE_METHOD, &ini_node); | 442 | return_ACPI_STATUS(AE_CTRL_DEPTH); |
368 | if (ACPI_FAILURE(status)) { | ||
369 | /* No _INI method found - move on to next device */ | ||
370 | |||
371 | return_ACPI_STATUS(AE_OK); | ||
372 | } | 443 | } |
373 | 444 | ||
374 | /* | 445 | /* |
375 | * Run _STA to determine if we can run _INI on the device - | 446 | * Run _STA to determine if this device is present and functioning. We |
376 | * the device must be present before _INI can be run. | 447 | * must know this information for two important reasons (from ACPI spec): |
377 | * However, _STA is not required - assume device present if no _STA | 448 | * |
449 | * 1) We can only run _INI if the device is present. | ||
450 | * 2) We must abort the device tree walk on this subtree if the device is | ||
451 | * not present and is not functional (we will not examine the children) | ||
452 | * | ||
453 | * The _STA method is not required to be present under the device, we | ||
454 | * assume the device is present if _STA does not exist. | ||
378 | */ | 455 | */ |
379 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 456 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
380 | device_node, | 457 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__STA)); |
381 | METHOD_NAME__STA)); | ||
382 | |||
383 | pinfo.node = device_node; | ||
384 | pinfo.parameters = NULL; | ||
385 | pinfo.parameter_type = ACPI_PARAM_ARGS; | ||
386 | 458 | ||
387 | status = acpi_ut_execute_STA(pinfo.node, &flags); | 459 | status = acpi_ut_execute_STA(device_node, &flags); |
388 | if (ACPI_FAILURE(status)) { | 460 | if (ACPI_FAILURE(status)) { |
461 | |||
389 | /* Ignore error and move on to next device */ | 462 | /* Ignore error and move on to next device */ |
390 | 463 | ||
391 | return_ACPI_STATUS(AE_OK); | 464 | return_ACPI_STATUS(AE_OK); |
392 | } | 465 | } |
393 | 466 | ||
467 | /* | ||
468 | * Flags == -1 means that _STA was not found. In this case, we assume that | ||
469 | * the device is both present and functional. | ||
470 | * | ||
471 | * From the ACPI spec, description of _STA: | ||
472 | * | ||
473 | * "If a device object (including the processor object) does not have an | ||
474 | * _STA object, then OSPM assumes that all of the above bits are set (in | ||
475 | * other words, the device is present, ..., and functioning)" | ||
476 | */ | ||
394 | if (flags != ACPI_UINT32_MAX) { | 477 | if (flags != ACPI_UINT32_MAX) { |
395 | info->num_STA++; | 478 | walk_info->num_STA++; |
396 | } | 479 | } |
397 | 480 | ||
481 | /* | ||
482 | * Examine the PRESENT and FUNCTIONING status bits | ||
483 | * | ||
484 | * Note: ACPI spec does not seem to specify behavior for the present but | ||
485 | * not functioning case, so we assume functioning if present. | ||
486 | */ | ||
398 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 487 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
399 | /* Don't look at children of a not present device */ | ||
400 | 488 | ||
401 | return_ACPI_STATUS(AE_CTRL_DEPTH); | 489 | /* Device is not present, we must examine the Functioning bit */ |
490 | |||
491 | if (flags & ACPI_STA_DEVICE_FUNCTIONING) { | ||
492 | /* | ||
493 | * Device is not present but is "functioning". In this case, | ||
494 | * we will not run _INI, but we continue to examine the children | ||
495 | * of this device. | ||
496 | * | ||
497 | * From the ACPI spec, description of _STA: (Note - no mention | ||
498 | * of whether to run _INI or not on the device in question) | ||
499 | * | ||
500 | * "_STA may return bit 0 clear (not present) with bit 3 set | ||
501 | * (device is functional). This case is used to indicate a valid | ||
502 | * device for which no device driver should be loaded (for example, | ||
503 | * a bridge device.) Children of this device may be present and | ||
504 | * valid. OSPM should continue enumeration below a device whose | ||
505 | * _STA returns this bit combination" | ||
506 | */ | ||
507 | return_ACPI_STATUS(AE_OK); | ||
508 | } else { | ||
509 | /* | ||
510 | * Device is not present and is not functioning. We must abort the | ||
511 | * walk of this subtree immediately -- don't look at the children | ||
512 | * of such a device. | ||
513 | * | ||
514 | * From the ACPI spec, description of _INI: | ||
515 | * | ||
516 | * "If the _STA method indicates that the device is not present, | ||
517 | * OSPM will not run the _INI and will not examine the children | ||
518 | * of the device for _INI methods" | ||
519 | */ | ||
520 | return_ACPI_STATUS(AE_CTRL_DEPTH); | ||
521 | } | ||
402 | } | 522 | } |
403 | 523 | ||
404 | /* | 524 | /* |
405 | * The device is present and _INI exists. Run the _INI method. | 525 | * The device is present or is assumed present if no _STA exists. |
406 | * (We already have the _INI node from above) | 526 | * Run the _INI if it exists (not required to exist) |
527 | * | ||
528 | * Note: We know there is an _INI within this subtree, but it may not be | ||
529 | * under this particular device, it may be lower in the branch. | ||
407 | */ | 530 | */ |
408 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, | 531 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname |
409 | pinfo.node, | 532 | (ACPI_TYPE_METHOD, device_node, METHOD_NAME__INI)); |
410 | METHOD_NAME__INI)); | 533 | |
534 | info->prefix_node = device_node; | ||
535 | info->pathname = METHOD_NAME__INI; | ||
536 | info->parameters = NULL; | ||
537 | info->parameter_type = ACPI_PARAM_ARGS; | ||
538 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
539 | |||
540 | status = acpi_ns_evaluate(info); | ||
541 | if (ACPI_SUCCESS(status)) { | ||
542 | walk_info->num_INI++; | ||
543 | |||
544 | if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) && | ||
545 | (!(acpi_dbg_level & ACPI_LV_INFO))) { | ||
546 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ".")); | ||
547 | } | ||
548 | } | ||
549 | #ifdef ACPI_DEBUG_OUTPUT | ||
550 | else if (status != AE_NOT_FOUND) { | ||
411 | 551 | ||
412 | pinfo.node = ini_node; | ||
413 | status = acpi_ns_evaluate_by_handle(&pinfo); | ||
414 | if (ACPI_FAILURE(status)) { | ||
415 | /* Ignore error and move on to next device */ | 552 | /* Ignore error and move on to next device */ |
416 | 553 | ||
417 | #ifdef ACPI_DEBUG_OUTPUT | 554 | char *scope_name = |
418 | char *scope_name = acpi_ns_get_external_pathname(ini_node); | 555 | acpi_ns_get_external_pathname(info->resolved_node); |
419 | |||
420 | ACPI_WARNING((AE_INFO, "%s._INI failed: %s", | ||
421 | scope_name, acpi_format_exception(status))); | ||
422 | 556 | ||
423 | ACPI_MEM_FREE(scope_name); | 557 | ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", |
558 | scope_name)); | ||
559 | ACPI_FREE(scope_name); | ||
560 | } | ||
424 | #endif | 561 | #endif |
425 | } else { | ||
426 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
427 | 562 | ||
428 | if (pinfo.return_object) { | 563 | /* Ignore errors from above */ |
429 | acpi_ut_remove_reference(pinfo.return_object); | ||
430 | } | ||
431 | 564 | ||
432 | /* Count of successful INIs */ | 565 | status = AE_OK; |
433 | |||
434 | info->num_INI++; | ||
435 | } | ||
436 | 566 | ||
567 | /* | ||
568 | * The _INI method has been run if present; call the Global Initialization | ||
569 | * Handler for this device. | ||
570 | */ | ||
437 | if (acpi_gbl_init_handler) { | 571 | if (acpi_gbl_init_handler) { |
438 | /* External initialization handler is present, call it */ | ||
439 | |||
440 | status = | 572 | status = |
441 | acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); | 573 | acpi_gbl_init_handler(device_node, ACPI_INIT_DEVICE_INI); |
442 | } | 574 | } |
443 | 575 | ||
444 | return_ACPI_STATUS(AE_OK); | 576 | return_ACPI_STATUS(status); |
445 | } | 577 | } |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index 4e0b0524c188..fe75d888e183 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -77,13 +77,14 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc, | |||
77 | { | 77 | { |
78 | acpi_status status; | 78 | acpi_status status; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ns_load_table"); | 80 | ACPI_FUNCTION_TRACE(ns_load_table); |
81 | 81 | ||
82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ | 82 | /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */ |
83 | 83 | ||
84 | if (! | 84 | if (! |
85 | (acpi_gbl_table_data[table_desc->type]. | 85 | (acpi_gbl_table_data[table_desc->type]. |
86 | flags & ACPI_TABLE_EXECUTABLE)) { | 86 | flags & ACPI_TABLE_EXECUTABLE)) { |
87 | |||
87 | /* Just ignore this table */ | 88 | /* Just ignore this table */ |
88 | 89 | ||
89 | return_ACPI_STATUS(AE_OK); | 90 | return_ACPI_STATUS(AE_OK); |
@@ -168,7 +169,7 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
168 | acpi_status status; | 169 | acpi_status status; |
169 | struct acpi_table_desc *table_desc; | 170 | struct acpi_table_desc *table_desc; |
170 | 171 | ||
171 | ACPI_FUNCTION_TRACE("ns_load_table_by_type"); | 172 | ACPI_FUNCTION_TRACE(ns_load_table_by_type); |
172 | 173 | ||
173 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); | 174 | status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES); |
174 | if (ACPI_FAILURE(status)) { | 175 | if (ACPI_FAILURE(status)) { |
@@ -180,11 +181,11 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
180 | * DSDT (one), SSDT/PSDT (multiple) | 181 | * DSDT (one), SSDT/PSDT (multiple) |
181 | */ | 182 | */ |
182 | switch (table_type) { | 183 | switch (table_type) { |
183 | case ACPI_TABLE_DSDT: | 184 | case ACPI_TABLE_ID_DSDT: |
184 | 185 | ||
185 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); | 186 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n")); |
186 | 187 | ||
187 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next; | 188 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_DSDT].next; |
188 | 189 | ||
189 | /* If table already loaded into namespace, just return */ | 190 | /* If table already loaded into namespace, just return */ |
190 | 191 | ||
@@ -200,8 +201,8 @@ static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type) | |||
200 | } | 201 | } |
201 | break; | 202 | break; |
202 | 203 | ||
203 | case ACPI_TABLE_SSDT: | 204 | case ACPI_TABLE_ID_SSDT: |
204 | case ACPI_TABLE_PSDT: | 205 | case ACPI_TABLE_ID_PSDT: |
205 | 206 | ||
206 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 207 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
207 | "Namespace load: %d SSDT or PSDTs\n", | 208 | "Namespace load: %d SSDT or PSDTs\n", |
@@ -258,7 +259,7 @@ acpi_status acpi_ns_load_namespace(void) | |||
258 | { | 259 | { |
259 | acpi_status status; | 260 | acpi_status status; |
260 | 261 | ||
261 | ACPI_FUNCTION_TRACE("acpi_load_name_space"); | 262 | ACPI_FUNCTION_TRACE(acpi_load_name_space); |
262 | 263 | ||
263 | /* There must be at least a DSDT installed */ | 264 | /* There must be at least a DSDT installed */ |
264 | 265 | ||
@@ -271,15 +272,15 @@ acpi_status acpi_ns_load_namespace(void) | |||
271 | * Load the namespace. The DSDT is required, | 272 | * Load the namespace. The DSDT is required, |
272 | * but the SSDT and PSDT tables are optional. | 273 | * but the SSDT and PSDT tables are optional. |
273 | */ | 274 | */ |
274 | status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT); | 275 | status = acpi_ns_load_table_by_type(ACPI_TABLE_ID_DSDT); |
275 | if (ACPI_FAILURE(status)) { | 276 | if (ACPI_FAILURE(status)) { |
276 | return_ACPI_STATUS(status); | 277 | return_ACPI_STATUS(status); |
277 | } | 278 | } |
278 | 279 | ||
279 | /* Ignore exceptions from these */ | 280 | /* Ignore exceptions from these */ |
280 | 281 | ||
281 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT); | 282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_SSDT); |
282 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT); | 283 | (void)acpi_ns_load_table_by_type(ACPI_TABLE_ID_PSDT); |
283 | 284 | ||
284 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, | 285 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, |
285 | "ACPI Namespace successfully loaded at root %p\n", | 286 | "ACPI Namespace successfully loaded at root %p\n", |
@@ -314,7 +315,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
314 | acpi_handle dummy; | 315 | acpi_handle dummy; |
315 | u32 level; | 316 | u32 level; |
316 | 317 | ||
317 | ACPI_FUNCTION_TRACE("ns_delete_subtree"); | 318 | ACPI_FUNCTION_TRACE(ns_delete_subtree); |
318 | 319 | ||
319 | parent_handle = start_handle; | 320 | parent_handle = start_handle; |
320 | child_handle = NULL; | 321 | child_handle = NULL; |
@@ -325,6 +326,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
325 | * to where we started. | 326 | * to where we started. |
326 | */ | 327 | */ |
327 | while (level > 0) { | 328 | while (level > 0) { |
329 | |||
328 | /* Attempt to get the next object in this scope */ | 330 | /* Attempt to get the next object in this scope */ |
329 | 331 | ||
330 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, | 332 | status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle, |
@@ -335,6 +337,7 @@ static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle) | |||
335 | /* Did we get a new object? */ | 337 | /* Did we get a new object? */ |
336 | 338 | ||
337 | if (ACPI_SUCCESS(status)) { | 339 | if (ACPI_SUCCESS(status)) { |
340 | |||
338 | /* Check if this object has any children */ | 341 | /* Check if this object has any children */ |
339 | 342 | ||
340 | if (ACPI_SUCCESS | 343 | if (ACPI_SUCCESS |
@@ -392,7 +395,7 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle) | |||
392 | { | 395 | { |
393 | acpi_status status; | 396 | acpi_status status; |
394 | 397 | ||
395 | ACPI_FUNCTION_TRACE("ns_unload_name_space"); | 398 | ACPI_FUNCTION_TRACE(ns_unload_name_space); |
396 | 399 | ||
397 | /* Parameter validation */ | 400 | /* Parameter validation */ |
398 | 401 | ||
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index 639f653b4b6b..97b8332c9746 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #define _COMPONENT ACPI_NAMESPACE | 48 | #define _COMPONENT ACPI_NAMESPACE |
49 | ACPI_MODULE_NAME("nsnames") | 49 | ACPI_MODULE_NAME("nsnames") |
50 | 50 | ||
51 | /* Local prototypes */ | ||
52 | static void | ||
53 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | ||
54 | acpi_size size, char *name_buffer); | ||
55 | |||
56 | /******************************************************************************* | 51 | /******************************************************************************* |
57 | * | 52 | * |
58 | * FUNCTION: acpi_ns_build_external_path | 53 | * FUNCTION: acpi_ns_build_external_path |
@@ -67,8 +62,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node, | |||
67 | * DESCRIPTION: Generate a full pathaname | 62 | * DESCRIPTION: Generate a full pathaname |
68 | * | 63 | * |
69 | ******************************************************************************/ | 64 | ******************************************************************************/ |
70 | 65 | void | |
71 | static void | ||
72 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | 66 | acpi_ns_build_external_path(struct acpi_namespace_node *node, |
73 | acpi_size size, char *name_buffer) | 67 | acpi_size size, char *name_buffer) |
74 | { | 68 | { |
@@ -138,7 +132,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
138 | char *name_buffer; | 132 | char *name_buffer; |
139 | acpi_size size; | 133 | acpi_size size; |
140 | 134 | ||
141 | ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node); | 135 | ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); |
142 | 136 | ||
143 | /* Calculate required buffer size based on depth below root */ | 137 | /* Calculate required buffer size based on depth below root */ |
144 | 138 | ||
@@ -146,7 +140,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) | |||
146 | 140 | ||
147 | /* Allocate a buffer to be returned to caller */ | 141 | /* Allocate a buffer to be returned to caller */ |
148 | 142 | ||
149 | name_buffer = ACPI_MEM_CALLOCATE(size); | 143 | name_buffer = ACPI_ALLOCATE_ZEROED(size); |
150 | if (!name_buffer) { | 144 | if (!name_buffer) { |
151 | ACPI_ERROR((AE_INFO, "Allocation failure")); | 145 | ACPI_ERROR((AE_INFO, "Allocation failure")); |
152 | return_PTR(NULL); | 146 | return_PTR(NULL); |
@@ -219,7 +213,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle, | |||
219 | struct acpi_namespace_node *node; | 213 | struct acpi_namespace_node *node; |
220 | acpi_size required_size; | 214 | acpi_size required_size; |
221 | 215 | ||
222 | ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle); | 216 | ACPI_FUNCTION_TRACE_PTR(ns_handle_to_pathname, target_handle); |
223 | 217 | ||
224 | node = acpi_ns_map_handle_to_node(target_handle); | 218 | node = acpi_ns_map_handle_to_node(target_handle); |
225 | if (!node) { | 219 | if (!node) { |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index 10ae6292bca4..aabe8794b908 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -76,19 +76,21 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
76 | union acpi_operand_object *last_obj_desc; | 76 | union acpi_operand_object *last_obj_desc; |
77 | acpi_object_type object_type = ACPI_TYPE_ANY; | 77 | acpi_object_type object_type = ACPI_TYPE_ANY; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE("ns_attach_object"); | 79 | ACPI_FUNCTION_TRACE(ns_attach_object); |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * Parameter validation | 82 | * Parameter validation |
83 | */ | 83 | */ |
84 | if (!node) { | 84 | if (!node) { |
85 | |||
85 | /* Invalid handle */ | 86 | /* Invalid handle */ |
86 | 87 | ||
87 | ACPI_ERROR((AE_INFO, "Null named_obj handle")); | 88 | ACPI_ERROR((AE_INFO, "Null NamedObj handle")); |
88 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 89 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
89 | } | 90 | } |
90 | 91 | ||
91 | if (!object && (ACPI_TYPE_ANY != type)) { | 92 | if (!object && (ACPI_TYPE_ANY != type)) { |
93 | |||
92 | /* Null object */ | 94 | /* Null object */ |
93 | 95 | ||
94 | ACPI_ERROR((AE_INFO, | 96 | ACPI_ERROR((AE_INFO, |
@@ -97,6 +99,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
97 | } | 99 | } |
98 | 100 | ||
99 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { | 101 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
102 | |||
100 | /* Not a name handle */ | 103 | /* Not a name handle */ |
101 | 104 | ||
102 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", | 105 | ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]", |
@@ -108,7 +111,7 @@ acpi_ns_attach_object(struct acpi_namespace_node *node, | |||
108 | 111 | ||
109 | if (node->object == object) { | 112 | if (node->object == object) { |
110 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 113 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
111 | "Obj %p already installed in name_obj %p\n", | 114 | "Obj %p already installed in NameObj %p\n", |
112 | object, node)); | 115 | object, node)); |
113 | 116 | ||
114 | return_ACPI_STATUS(AE_OK); | 117 | return_ACPI_STATUS(AE_OK); |
@@ -201,7 +204,7 @@ void acpi_ns_detach_object(struct acpi_namespace_node *node) | |||
201 | { | 204 | { |
202 | union acpi_operand_object *obj_desc; | 205 | union acpi_operand_object *obj_desc; |
203 | 206 | ||
204 | ACPI_FUNCTION_TRACE("ns_detach_object"); | 207 | ACPI_FUNCTION_TRACE(ns_detach_object); |
205 | 208 | ||
206 | obj_desc = node->object; | 209 | obj_desc = node->object; |
207 | 210 | ||
@@ -252,7 +255,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct | |||
252 | acpi_namespace_node | 255 | acpi_namespace_node |
253 | *node) | 256 | *node) |
254 | { | 257 | { |
255 | ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); | 258 | ACPI_FUNCTION_TRACE_PTR(ns_get_attached_object, node); |
256 | 259 | ||
257 | if (!node) { | 260 | if (!node) { |
258 | ACPI_WARNING((AE_INFO, "Null Node ptr")); | 261 | ACPI_WARNING((AE_INFO, "Null Node ptr")); |
@@ -287,7 +290,7 @@ union acpi_operand_object *acpi_ns_get_secondary_object(union | |||
287 | acpi_operand_object | 290 | acpi_operand_object |
288 | *obj_desc) | 291 | *obj_desc) |
289 | { | 292 | { |
290 | ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc); | 293 | ACPI_FUNCTION_TRACE_PTR(ns_get_secondary_object, obj_desc); |
291 | 294 | ||
292 | if ((!obj_desc) || | 295 | if ((!obj_desc) || |
293 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || | 296 | (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) || |
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index 232be4303653..155505a4ef69 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -62,13 +62,13 @@ ACPI_MODULE_NAME("nsparse") | |||
62 | * | 62 | * |
63 | ******************************************************************************/ | 63 | ******************************************************************************/ |
64 | acpi_status | 64 | acpi_status |
65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc) | 65 | acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc *table_desc) |
66 | { | 66 | { |
67 | union acpi_parse_object *parse_root; | 67 | union acpi_parse_object *parse_root; |
68 | acpi_status status; | 68 | acpi_status status; |
69 | struct acpi_walk_state *walk_state; | 69 | struct acpi_walk_state *walk_state; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ns_one_complete_parse"); | 71 | ACPI_FUNCTION_TRACE(ns_one_complete_parse); |
72 | 72 | ||
73 | /* Create and init a Root Node */ | 73 | /* Create and init a Root Node */ |
74 | 74 | ||
@@ -124,7 +124,7 @@ acpi_ns_parse_table(struct acpi_table_desc *table_desc, | |||
124 | { | 124 | { |
125 | acpi_status status; | 125 | acpi_status status; |
126 | 126 | ||
127 | ACPI_FUNCTION_TRACE("ns_parse_table"); | 127 | ACPI_FUNCTION_TRACE(ns_parse_table); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * AML Parse, pass 1 | 130 | * AML Parse, pass 1 |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index d64b78952f24..500e2bbcfaf7 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -56,16 +56,16 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
56 | 56 | ||
57 | /******************************************************************************* | 57 | /******************************************************************************* |
58 | * | 58 | * |
59 | * FUNCTION: acpi_ns_search_node | 59 | * FUNCTION: acpi_ns_search_one_scope |
60 | * | 60 | * |
61 | * PARAMETERS: target_name - Ascii ACPI name to search for | 61 | * PARAMETERS: target_name - Ascii ACPI name to search for |
62 | * Node - Starting node where search will begin | 62 | * parent_node - Starting node where search will begin |
63 | * Type - Object type to match | 63 | * Type - Object type to match |
64 | * return_node - Where the matched Named obj is returned | 64 | * return_node - Where the matched Named obj is returned |
65 | * | 65 | * |
66 | * RETURN: Status | 66 | * RETURN: Status |
67 | * | 67 | * |
68 | * DESCRIPTION: Search a single level of the namespace. Performs a | 68 | * DESCRIPTION: Search a single level of the namespace. Performs a |
69 | * simple search of the specified level, and does not add | 69 | * simple search of the specified level, and does not add |
70 | * entries or search parents. | 70 | * entries or search parents. |
71 | * | 71 | * |
@@ -75,35 +75,40 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
75 | * | 75 | * |
76 | * All namespace searching is linear in this implementation, but | 76 | * All namespace searching is linear in this implementation, but |
77 | * could be easily modified to support any improved search | 77 | * could be easily modified to support any improved search |
78 | * algorithm. However, the linear search was chosen for simplicity | 78 | * algorithm. However, the linear search was chosen for simplicity |
79 | * and because the trees are small and the other interpreter | 79 | * and because the trees are small and the other interpreter |
80 | * execution overhead is relatively high. | 80 | * execution overhead is relatively high. |
81 | * | 81 | * |
82 | * Note: CPU execution analysis has shown that the AML interpreter spends | ||
83 | * a very small percentage of its time searching the namespace. Therefore, | ||
84 | * the linear search seems to be sufficient, as there would seem to be | ||
85 | * little value in improving the search. | ||
86 | * | ||
82 | ******************************************************************************/ | 87 | ******************************************************************************/ |
83 | 88 | ||
84 | acpi_status | 89 | acpi_status |
85 | acpi_ns_search_node(u32 target_name, | 90 | acpi_ns_search_one_scope(u32 target_name, |
86 | struct acpi_namespace_node *node, | 91 | struct acpi_namespace_node *parent_node, |
87 | acpi_object_type type, | 92 | acpi_object_type type, |
88 | struct acpi_namespace_node **return_node) | 93 | struct acpi_namespace_node **return_node) |
89 | { | 94 | { |
90 | struct acpi_namespace_node *next_node; | 95 | struct acpi_namespace_node *node; |
91 | 96 | ||
92 | ACPI_FUNCTION_TRACE("ns_search_node"); | 97 | ACPI_FUNCTION_TRACE(ns_search_one_scope); |
93 | 98 | ||
94 | #ifdef ACPI_DEBUG_OUTPUT | 99 | #ifdef ACPI_DEBUG_OUTPUT |
95 | if (ACPI_LV_NAMES & acpi_dbg_level) { | 100 | if (ACPI_LV_NAMES & acpi_dbg_level) { |
96 | char *scope_name; | 101 | char *scope_name; |
97 | 102 | ||
98 | scope_name = acpi_ns_get_external_pathname(node); | 103 | scope_name = acpi_ns_get_external_pathname(parent_node); |
99 | if (scope_name) { | 104 | if (scope_name) { |
100 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 105 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
101 | "Searching %s (%p) For [%4.4s] (%s)\n", | 106 | "Searching %s (%p) For [%4.4s] (%s)\n", |
102 | scope_name, node, ACPI_CAST_PTR(char, | 107 | scope_name, parent_node, |
103 | &target_name), | 108 | ACPI_CAST_PTR(char, &target_name), |
104 | acpi_ut_get_type_name(type))); | 109 | acpi_ut_get_type_name(type))); |
105 | 110 | ||
106 | ACPI_MEM_FREE(scope_name); | 111 | ACPI_FREE(scope_name); |
107 | } | 112 | } |
108 | } | 113 | } |
109 | #endif | 114 | #endif |
@@ -112,32 +117,33 @@ acpi_ns_search_node(u32 target_name, | |||
112 | * Search for name at this namespace level, which is to say that we | 117 | * Search for name at this namespace level, which is to say that we |
113 | * must search for the name among the children of this object | 118 | * must search for the name among the children of this object |
114 | */ | 119 | */ |
115 | next_node = node->child; | 120 | node = parent_node->child; |
116 | while (next_node) { | 121 | while (node) { |
122 | |||
117 | /* Check for match against the name */ | 123 | /* Check for match against the name */ |
118 | 124 | ||
119 | if (next_node->name.integer == target_name) { | 125 | if (node->name.integer == target_name) { |
126 | |||
120 | /* Resolve a control method alias if any */ | 127 | /* Resolve a control method alias if any */ |
121 | 128 | ||
122 | if (acpi_ns_get_type(next_node) == | 129 | if (acpi_ns_get_type(node) == |
123 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { | 130 | ACPI_TYPE_LOCAL_METHOD_ALIAS) { |
124 | next_node = | 131 | node = |
125 | ACPI_CAST_PTR(struct acpi_namespace_node, | 132 | ACPI_CAST_PTR(struct acpi_namespace_node, |
126 | next_node->object); | 133 | node->object); |
127 | } | 134 | } |
128 | 135 | ||
129 | /* | 136 | /* Found matching entry */ |
130 | * Found matching entry. | 137 | |
131 | */ | ||
132 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 138 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
133 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", | 139 | "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", |
134 | ACPI_CAST_PTR(char, &target_name), | 140 | ACPI_CAST_PTR(char, &target_name), |
135 | acpi_ut_get_type_name(next_node-> | 141 | acpi_ut_get_type_name(node->type), |
136 | type), | 142 | node, |
137 | next_node, | 143 | acpi_ut_get_node_name(parent_node), |
138 | acpi_ut_get_node_name(node), node)); | 144 | parent_node)); |
139 | 145 | ||
140 | *return_node = next_node; | 146 | *return_node = node; |
141 | return_ACPI_STATUS(AE_OK); | 147 | return_ACPI_STATUS(AE_OK); |
142 | } | 148 | } |
143 | 149 | ||
@@ -145,7 +151,8 @@ acpi_ns_search_node(u32 target_name, | |||
145 | * The last entry in the list points back to the parent, | 151 | * The last entry in the list points back to the parent, |
146 | * so a flag is used to indicate the end-of-list | 152 | * so a flag is used to indicate the end-of-list |
147 | */ | 153 | */ |
148 | if (next_node->flags & ANOBJ_END_OF_PEER_LIST) { | 154 | if (node->flags & ANOBJ_END_OF_PEER_LIST) { |
155 | |||
149 | /* Searched entire list, we are done */ | 156 | /* Searched entire list, we are done */ |
150 | 157 | ||
151 | break; | 158 | break; |
@@ -153,7 +160,7 @@ acpi_ns_search_node(u32 target_name, | |||
153 | 160 | ||
154 | /* Didn't match name, move on to the next peer object */ | 161 | /* Didn't match name, move on to the next peer object */ |
155 | 162 | ||
156 | next_node = next_node->peer; | 163 | node = node->peer; |
157 | } | 164 | } |
158 | 165 | ||
159 | /* Searched entire namespace level, not found */ | 166 | /* Searched entire namespace level, not found */ |
@@ -162,7 +169,8 @@ acpi_ns_search_node(u32 target_name, | |||
162 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", | 169 | "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", |
163 | ACPI_CAST_PTR(char, &target_name), | 170 | ACPI_CAST_PTR(char, &target_name), |
164 | acpi_ut_get_type_name(type), | 171 | acpi_ut_get_type_name(type), |
165 | acpi_ut_get_node_name(node), node, node->child)); | 172 | acpi_ut_get_node_name(parent_node), parent_node, |
173 | parent_node->child)); | ||
166 | 174 | ||
167 | return_ACPI_STATUS(AE_NOT_FOUND); | 175 | return_ACPI_STATUS(AE_NOT_FOUND); |
168 | } | 176 | } |
@@ -179,14 +187,14 @@ acpi_ns_search_node(u32 target_name, | |||
179 | * RETURN: Status | 187 | * RETURN: Status |
180 | * | 188 | * |
181 | * DESCRIPTION: Called when a name has not been found in the current namespace | 189 | * DESCRIPTION: Called when a name has not been found in the current namespace |
182 | * level. Before adding it or giving up, ACPI scope rules require | 190 | * level. Before adding it or giving up, ACPI scope rules require |
183 | * searching enclosing scopes in cases identified by acpi_ns_local(). | 191 | * searching enclosing scopes in cases identified by acpi_ns_local(). |
184 | * | 192 | * |
185 | * "A name is located by finding the matching name in the current | 193 | * "A name is located by finding the matching name in the current |
186 | * name space, and then in the parent name space. If the parent | 194 | * name space, and then in the parent name space. If the parent |
187 | * name space does not contain the name, the search continues | 195 | * name space does not contain the name, the search continues |
188 | * recursively until either the name is found or the name space | 196 | * recursively until either the name is found or the name space |
189 | * does not have a parent (the root of the name space). This | 197 | * does not have a parent (the root of the name space). This |
190 | * indicates that the name is not found" (From ACPI Specification, | 198 | * indicates that the name is not found" (From ACPI Specification, |
191 | * section 5.3) | 199 | * section 5.3) |
192 | * | 200 | * |
@@ -201,7 +209,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
201 | acpi_status status; | 209 | acpi_status status; |
202 | struct acpi_namespace_node *parent_node; | 210 | struct acpi_namespace_node *parent_node; |
203 | 211 | ||
204 | ACPI_FUNCTION_TRACE("ns_search_parent_tree"); | 212 | ACPI_FUNCTION_TRACE(ns_search_parent_tree); |
205 | 213 | ||
206 | parent_node = acpi_ns_get_parent_node(node); | 214 | parent_node = acpi_ns_get_parent_node(node); |
207 | 215 | ||
@@ -235,20 +243,19 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
235 | */ | 243 | */ |
236 | while (parent_node) { | 244 | while (parent_node) { |
237 | /* | 245 | /* |
238 | * Search parent scope. Use TYPE_ANY because we don't care about the | 246 | * Search parent scope. Use TYPE_ANY because we don't care about the |
239 | * object type at this point, we only care about the existence of | 247 | * object type at this point, we only care about the existence of |
240 | * the actual name we are searching for. Typechecking comes later. | 248 | * the actual name we are searching for. Typechecking comes later. |
241 | */ | 249 | */ |
242 | status = acpi_ns_search_node(target_name, parent_node, | 250 | status = |
251 | acpi_ns_search_one_scope(target_name, parent_node, | ||
243 | ACPI_TYPE_ANY, return_node); | 252 | ACPI_TYPE_ANY, return_node); |
244 | if (ACPI_SUCCESS(status)) { | 253 | if (ACPI_SUCCESS(status)) { |
245 | return_ACPI_STATUS(status); | 254 | return_ACPI_STATUS(status); |
246 | } | 255 | } |
247 | 256 | ||
248 | /* | 257 | /* Not found here, go up another level (until we reach the root) */ |
249 | * Not found here, go up another level | 258 | |
250 | * (until we reach the root) | ||
251 | */ | ||
252 | parent_node = acpi_ns_get_parent_node(parent_node); | 259 | parent_node = acpi_ns_get_parent_node(parent_node); |
253 | } | 260 | } |
254 | 261 | ||
@@ -273,7 +280,7 @@ acpi_ns_search_parent_tree(u32 target_name, | |||
273 | * RETURN: Status | 280 | * RETURN: Status |
274 | * | 281 | * |
275 | * DESCRIPTION: Search for a name segment in a single namespace level, | 282 | * DESCRIPTION: Search for a name segment in a single namespace level, |
276 | * optionally adding it if it is not found. If the passed | 283 | * optionally adding it if it is not found. If the passed |
277 | * Type is not Any and the type previously stored in the | 284 | * Type is not Any and the type previously stored in the |
278 | * entry was Any (i.e. unknown), update the stored type. | 285 | * entry was Any (i.e. unknown), update the stored type. |
279 | * | 286 | * |
@@ -293,29 +300,46 @@ acpi_ns_search_and_enter(u32 target_name, | |||
293 | acpi_status status; | 300 | acpi_status status; |
294 | struct acpi_namespace_node *new_node; | 301 | struct acpi_namespace_node *new_node; |
295 | 302 | ||
296 | ACPI_FUNCTION_TRACE("ns_search_and_enter"); | 303 | ACPI_FUNCTION_TRACE(ns_search_and_enter); |
297 | 304 | ||
298 | /* Parameter validation */ | 305 | /* Parameter validation */ |
299 | 306 | ||
300 | if (!node || !target_name || !return_node) { | 307 | if (!node || !target_name || !return_node) { |
301 | ACPI_ERROR((AE_INFO, | 308 | ACPI_ERROR((AE_INFO, |
302 | "Null param: Node %p Name %X return_node %p", | 309 | "Null parameter: Node %p Name %X ReturnNode %p", |
303 | node, target_name, return_node)); | 310 | node, target_name, return_node)); |
304 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 311 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
305 | } | 312 | } |
306 | 313 | ||
307 | /* Name must consist of printable characters */ | 314 | /* |
308 | 315 | * Name must consist of valid ACPI characters. We will repair the name if | |
316 | * necessary because we don't want to abort because of this, but we want | ||
317 | * all namespace names to be printable. A warning message is appropriate. | ||
318 | * | ||
319 | * This issue came up because there are in fact machines that exhibit | ||
320 | * this problem, and we want to be able to enable ACPI support for them, | ||
321 | * even though there are a few bad names. | ||
322 | */ | ||
309 | if (!acpi_ut_valid_acpi_name(target_name)) { | 323 | if (!acpi_ut_valid_acpi_name(target_name)) { |
310 | ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X", | 324 | target_name = acpi_ut_repair_name(target_name); |
311 | target_name)); | 325 | |
312 | return_ACPI_STATUS(AE_BAD_CHARACTER); | 326 | /* Report warning only if in strict mode or debug mode */ |
327 | |||
328 | if (!acpi_gbl_enable_interpreter_slack) { | ||
329 | ACPI_WARNING((AE_INFO, | ||
330 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
331 | ACPI_CAST_PTR(char, &target_name))); | ||
332 | } else { | ||
333 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | ||
334 | "Found bad character(s) in name, repaired: [%4.4s]\n", | ||
335 | ACPI_CAST_PTR(char, &target_name))); | ||
336 | } | ||
313 | } | 337 | } |
314 | 338 | ||
315 | /* Try to find the name in the namespace level specified by the caller */ | 339 | /* Try to find the name in the namespace level specified by the caller */ |
316 | 340 | ||
317 | *return_node = ACPI_ENTRY_NOT_FOUND; | 341 | *return_node = ACPI_ENTRY_NOT_FOUND; |
318 | status = acpi_ns_search_node(target_name, node, type, return_node); | 342 | status = acpi_ns_search_one_scope(target_name, node, type, return_node); |
319 | if (status != AE_NOT_FOUND) { | 343 | if (status != AE_NOT_FOUND) { |
320 | /* | 344 | /* |
321 | * If we found it AND the request specifies that a find is an error, | 345 | * If we found it AND the request specifies that a find is an error, |
@@ -325,18 +349,16 @@ acpi_ns_search_and_enter(u32 target_name, | |||
325 | status = AE_ALREADY_EXISTS; | 349 | status = AE_ALREADY_EXISTS; |
326 | } | 350 | } |
327 | 351 | ||
328 | /* | 352 | /* Either found it or there was an error: finished either way */ |
329 | * Either found it or there was an error | 353 | |
330 | * -- finished either way | ||
331 | */ | ||
332 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
333 | } | 355 | } |
334 | 356 | ||
335 | /* | 357 | /* |
336 | * The name was not found. If we are NOT performing the first pass | 358 | * The name was not found. If we are NOT performing the first pass |
337 | * (name entry) of loading the namespace, search the parent tree (all the | 359 | * (name entry) of loading the namespace, search the parent tree (all the |
338 | * way to the root if necessary.) We don't want to perform the parent | 360 | * way to the root if necessary.) We don't want to perform the parent |
339 | * search when the namespace is actually being loaded. We want to perform | 361 | * search when the namespace is actually being loaded. We want to perform |
340 | * the search when namespace references are being resolved (load pass 2) | 362 | * the search when namespace references are being resolved (load pass 2) |
341 | * and during the execution phase. | 363 | * and during the execution phase. |
342 | */ | 364 | */ |
@@ -354,9 +376,8 @@ acpi_ns_search_and_enter(u32 target_name, | |||
354 | } | 376 | } |
355 | } | 377 | } |
356 | 378 | ||
357 | /* | 379 | /* In execute mode, just search, never add names. Exit now */ |
358 | * In execute mode, just search, never add names. Exit now. | 380 | |
359 | */ | ||
360 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { | 381 | if (interpreter_mode == ACPI_IMODE_EXECUTE) { |
361 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, | 382 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, |
362 | "%4.4s Not found in %p [Not adding]\n", | 383 | "%4.4s Not found in %p [Not adding]\n", |
@@ -371,11 +392,18 @@ acpi_ns_search_and_enter(u32 target_name, | |||
371 | if (!new_node) { | 392 | if (!new_node) { |
372 | return_ACPI_STATUS(AE_NO_MEMORY); | 393 | return_ACPI_STATUS(AE_NO_MEMORY); |
373 | } | 394 | } |
395 | #ifdef ACPI_ASL_COMPILER | ||
396 | /* | ||
397 | * Node is an object defined by an External() statement | ||
398 | */ | ||
399 | if (flags & ACPI_NS_EXTERNAL) { | ||
400 | new_node->flags |= ANOBJ_IS_EXTERNAL; | ||
401 | } | ||
402 | #endif | ||
374 | 403 | ||
375 | /* Install the new object into the parent's list of children */ | 404 | /* Install the new object into the parent's list of children */ |
376 | 405 | ||
377 | acpi_ns_install_node(walk_state, node, new_node, type); | 406 | acpi_ns_install_node(walk_state, node, new_node, type); |
378 | *return_node = new_node; | 407 | *return_node = new_node; |
379 | |||
380 | return_ACPI_STATUS(AE_OK); | 408 | return_ACPI_STATUS(AE_OK); |
381 | } | 409 | } |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 3e7cad549a38..aa4e799d9a8c 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -78,15 +78,17 @@ acpi_ns_report_error(char *module_name, | |||
78 | char *internal_name, acpi_status lookup_status) | 78 | char *internal_name, acpi_status lookup_status) |
79 | { | 79 | { |
80 | acpi_status status; | 80 | acpi_status status; |
81 | u32 bad_name; | ||
81 | char *name = NULL; | 82 | char *name = NULL; |
82 | 83 | ||
83 | acpi_ut_report_error(module_name, line_number); | 84 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
84 | 85 | ||
85 | if (lookup_status == AE_BAD_CHARACTER) { | 86 | if (lookup_status == AE_BAD_CHARACTER) { |
87 | |||
86 | /* There is a non-ascii character in the name */ | 88 | /* There is a non-ascii character in the name */ |
87 | 89 | ||
88 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", | 90 | ACPI_MOVE_32_TO_32(&bad_name, internal_name); |
89 | *(ACPI_CAST_PTR(u32, internal_name))); | 91 | acpi_os_printf("[0x%4.4X] (NON-ASCII)", bad_name); |
90 | } else { | 92 | } else { |
91 | /* Convert path to external format */ | 93 | /* Convert path to external format */ |
92 | 94 | ||
@@ -102,7 +104,7 @@ acpi_ns_report_error(char *module_name, | |||
102 | } | 104 | } |
103 | 105 | ||
104 | if (name) { | 106 | if (name) { |
105 | ACPI_MEM_FREE(name); | 107 | ACPI_FREE(name); |
106 | } | 108 | } |
107 | } | 109 | } |
108 | 110 | ||
@@ -137,11 +139,12 @@ acpi_ns_report_method_error(char *module_name, | |||
137 | acpi_status status; | 139 | acpi_status status; |
138 | struct acpi_namespace_node *node = prefix_node; | 140 | struct acpi_namespace_node *node = prefix_node; |
139 | 141 | ||
140 | acpi_ut_report_error(module_name, line_number); | 142 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); |
141 | 143 | ||
142 | if (path) { | 144 | if (path) { |
143 | status = acpi_ns_get_node_by_path(path, prefix_node, | 145 | status = |
144 | ACPI_NS_NO_UPSEARCH, &node); | 146 | acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, |
147 | &node); | ||
145 | if (ACPI_FAILURE(status)) { | 148 | if (ACPI_FAILURE(status)) { |
146 | acpi_os_printf("[Could not get node by pathname]"); | 149 | acpi_os_printf("[Could not get node by pathname]"); |
147 | } | 150 | } |
@@ -185,7 +188,7 @@ acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message) | |||
185 | } | 188 | } |
186 | 189 | ||
187 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); | 190 | acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node); |
188 | ACPI_MEM_FREE(buffer.pointer); | 191 | ACPI_FREE(buffer.pointer); |
189 | } | 192 | } |
190 | } | 193 | } |
191 | 194 | ||
@@ -239,7 +242,7 @@ static u8 acpi_ns_valid_path_separator(char sep) | |||
239 | 242 | ||
240 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | 243 | acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) |
241 | { | 244 | { |
242 | ACPI_FUNCTION_TRACE("ns_get_type"); | 245 | ACPI_FUNCTION_TRACE(ns_get_type); |
243 | 246 | ||
244 | if (!node) { | 247 | if (!node) { |
245 | ACPI_WARNING((AE_INFO, "Null Node parameter")); | 248 | ACPI_WARNING((AE_INFO, "Null Node parameter")); |
@@ -264,9 +267,10 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node) | |||
264 | 267 | ||
265 | u32 acpi_ns_local(acpi_object_type type) | 268 | u32 acpi_ns_local(acpi_object_type type) |
266 | { | 269 | { |
267 | ACPI_FUNCTION_TRACE("ns_local"); | 270 | ACPI_FUNCTION_TRACE(ns_local); |
268 | 271 | ||
269 | if (!acpi_ut_valid_object_type(type)) { | 272 | if (!acpi_ut_valid_object_type(type)) { |
273 | |||
270 | /* Type code out of range */ | 274 | /* Type code out of range */ |
271 | 275 | ||
272 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 276 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -363,7 +367,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
363 | char *result = NULL; | 367 | char *result = NULL; |
364 | acpi_native_uint i; | 368 | acpi_native_uint i; |
365 | 369 | ||
366 | ACPI_FUNCTION_TRACE("ns_build_internal_name"); | 370 | ACPI_FUNCTION_TRACE(ns_build_internal_name); |
367 | 371 | ||
368 | /* Setup the correct prefixes, counts, and pointers */ | 372 | /* Setup the correct prefixes, counts, and pointers */ |
369 | 373 | ||
@@ -411,6 +415,7 @@ acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info) | |||
411 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 415 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
412 | if (acpi_ns_valid_path_separator(*external_name) || | 416 | if (acpi_ns_valid_path_separator(*external_name) || |
413 | (*external_name == 0)) { | 417 | (*external_name == 0)) { |
418 | |||
414 | /* Pad the segment with underscore(s) if segment is short */ | 419 | /* Pad the segment with underscore(s) if segment is short */ |
415 | 420 | ||
416 | result[i] = '_'; | 421 | result[i] = '_'; |
@@ -473,7 +478,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
473 | struct acpi_namestring_info info; | 478 | struct acpi_namestring_info info; |
474 | acpi_status status; | 479 | acpi_status status; |
475 | 480 | ||
476 | ACPI_FUNCTION_TRACE("ns_internalize_name"); | 481 | ACPI_FUNCTION_TRACE(ns_internalize_name); |
477 | 482 | ||
478 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { | 483 | if ((!external_name) || (*external_name == 0) || (!converted_name)) { |
479 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 484 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -486,7 +491,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
486 | 491 | ||
487 | /* We need a segment to store the internal name */ | 492 | /* We need a segment to store the internal name */ |
488 | 493 | ||
489 | internal_name = ACPI_MEM_CALLOCATE(info.length); | 494 | internal_name = ACPI_ALLOCATE_ZEROED(info.length); |
490 | if (!internal_name) { | 495 | if (!internal_name) { |
491 | return_ACPI_STATUS(AE_NO_MEMORY); | 496 | return_ACPI_STATUS(AE_NO_MEMORY); |
492 | } | 497 | } |
@@ -496,7 +501,7 @@ acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name) | |||
496 | info.internal_name = internal_name; | 501 | info.internal_name = internal_name; |
497 | status = acpi_ns_build_internal_name(&info); | 502 | status = acpi_ns_build_internal_name(&info); |
498 | if (ACPI_FAILURE(status)) { | 503 | if (ACPI_FAILURE(status)) { |
499 | ACPI_MEM_FREE(internal_name); | 504 | ACPI_FREE(internal_name); |
500 | return_ACPI_STATUS(status); | 505 | return_ACPI_STATUS(status); |
501 | } | 506 | } |
502 | 507 | ||
@@ -533,7 +538,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
533 | acpi_native_uint i = 0; | 538 | acpi_native_uint i = 0; |
534 | acpi_native_uint j = 0; | 539 | acpi_native_uint j = 0; |
535 | 540 | ||
536 | ACPI_FUNCTION_TRACE("ns_externalize_name"); | 541 | ACPI_FUNCTION_TRACE(ns_externalize_name); |
537 | 542 | ||
538 | if (!internal_name_length || !internal_name || !converted_name) { | 543 | if (!internal_name_length || !internal_name || !converted_name) { |
539 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 544 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -628,7 +633,7 @@ acpi_ns_externalize_name(u32 internal_name_length, | |||
628 | /* | 633 | /* |
629 | * Build converted_name | 634 | * Build converted_name |
630 | */ | 635 | */ |
631 | *converted_name = ACPI_MEM_CALLOCATE(required_length); | 636 | *converted_name = ACPI_ALLOCATE_ZEROED(required_length); |
632 | if (!(*converted_name)) { | 637 | if (!(*converted_name)) { |
633 | return_ACPI_STATUS(AE_NO_MEMORY); | 638 | return_ACPI_STATUS(AE_NO_MEMORY); |
634 | } | 639 | } |
@@ -681,13 +686,9 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
681 | ACPI_FUNCTION_ENTRY(); | 686 | ACPI_FUNCTION_ENTRY(); |
682 | 687 | ||
683 | /* | 688 | /* |
684 | * Simple implementation. | 689 | * Simple implementation |
685 | */ | 690 | */ |
686 | if (!handle) { | 691 | if ((!handle) || (handle == ACPI_ROOT_OBJECT)) { |
687 | return (NULL); | ||
688 | } | ||
689 | |||
690 | if (handle == ACPI_ROOT_OBJECT) { | ||
691 | return (acpi_gbl_root_node); | 692 | return (acpi_gbl_root_node); |
692 | } | 693 | } |
693 | 694 | ||
@@ -697,7 +698,7 @@ struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle) | |||
697 | return (NULL); | 698 | return (NULL); |
698 | } | 699 | } |
699 | 700 | ||
700 | return ((struct acpi_namespace_node *)handle); | 701 | return (ACPI_CAST_PTR(struct acpi_namespace_node, handle)); |
701 | } | 702 | } |
702 | 703 | ||
703 | /******************************************************************************* | 704 | /******************************************************************************* |
@@ -752,7 +753,7 @@ void acpi_ns_terminate(void) | |||
752 | { | 753 | { |
753 | union acpi_operand_object *obj_desc; | 754 | union acpi_operand_object *obj_desc; |
754 | 755 | ||
755 | ACPI_FUNCTION_TRACE("ns_terminate"); | 756 | ACPI_FUNCTION_TRACE(ns_terminate); |
756 | 757 | ||
757 | /* | 758 | /* |
758 | * 1) Free the entire namespace -- all nodes and objects | 759 | * 1) Free the entire namespace -- all nodes and objects |
@@ -792,9 +793,10 @@ void acpi_ns_terminate(void) | |||
792 | 793 | ||
793 | u32 acpi_ns_opens_scope(acpi_object_type type) | 794 | u32 acpi_ns_opens_scope(acpi_object_type type) |
794 | { | 795 | { |
795 | ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type)); | 796 | ACPI_FUNCTION_TRACE_STR(ns_opens_scope, acpi_ut_get_type_name(type)); |
796 | 797 | ||
797 | if (!acpi_ut_valid_object_type(type)) { | 798 | if (!acpi_ut_valid_object_type(type)) { |
799 | |||
798 | /* type code out of range */ | 800 | /* type code out of range */ |
799 | 801 | ||
800 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); | 802 | ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type)); |
@@ -806,12 +808,12 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
806 | 808 | ||
807 | /******************************************************************************* | 809 | /******************************************************************************* |
808 | * | 810 | * |
809 | * FUNCTION: acpi_ns_get_node_by_path | 811 | * FUNCTION: acpi_ns_get_node |
810 | * | 812 | * |
811 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The | 813 | * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The |
812 | * \ (backslash) and ^ (carat) prefixes, and the | 814 | * \ (backslash) and ^ (carat) prefixes, and the |
813 | * . (period) to separate segments are supported. | 815 | * . (period) to separate segments are supported. |
814 | * start_node - Root of subtree to be searched, or NS_ALL for the | 816 | * prefix_node - Root of subtree to be searched, or NS_ALL for the |
815 | * root of the name space. If Name is fully | 817 | * root of the name space. If Name is fully |
816 | * qualified (first s8 is '\'), the passed value | 818 | * qualified (first s8 is '\'), the passed value |
817 | * of Scope will not be accessed. | 819 | * of Scope will not be accessed. |
@@ -827,23 +829,29 @@ u32 acpi_ns_opens_scope(acpi_object_type type) | |||
827 | ******************************************************************************/ | 829 | ******************************************************************************/ |
828 | 830 | ||
829 | acpi_status | 831 | acpi_status |
830 | acpi_ns_get_node_by_path(char *pathname, | 832 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
831 | struct acpi_namespace_node *start_node, | 833 | char *pathname, |
832 | u32 flags, struct acpi_namespace_node **return_node) | 834 | u32 flags, struct acpi_namespace_node **return_node) |
833 | { | 835 | { |
834 | union acpi_generic_state scope_info; | 836 | union acpi_generic_state scope_info; |
835 | acpi_status status; | 837 | acpi_status status; |
836 | char *internal_path = NULL; | 838 | char *internal_path; |
837 | |||
838 | ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname); | ||
839 | 839 | ||
840 | if (pathname) { | 840 | ACPI_FUNCTION_TRACE_PTR(ns_get_node, pathname); |
841 | /* Convert path to internal representation */ | ||
842 | 841 | ||
843 | status = acpi_ns_internalize_name(pathname, &internal_path); | 842 | if (!pathname) { |
844 | if (ACPI_FAILURE(status)) { | 843 | *return_node = prefix_node; |
845 | return_ACPI_STATUS(status); | 844 | if (!prefix_node) { |
845 | *return_node = acpi_gbl_root_node; | ||
846 | } | 846 | } |
847 | return_ACPI_STATUS(AE_OK); | ||
848 | } | ||
849 | |||
850 | /* Convert path to internal representation */ | ||
851 | |||
852 | status = acpi_ns_internalize_name(pathname, &internal_path); | ||
853 | if (ACPI_FAILURE(status)) { | ||
854 | return_ACPI_STATUS(status); | ||
847 | } | 855 | } |
848 | 856 | ||
849 | /* Must lock namespace during lookup */ | 857 | /* Must lock namespace during lookup */ |
@@ -855,26 +863,23 @@ acpi_ns_get_node_by_path(char *pathname, | |||
855 | 863 | ||
856 | /* Setup lookup scope (search starting point) */ | 864 | /* Setup lookup scope (search starting point) */ |
857 | 865 | ||
858 | scope_info.scope.node = start_node; | 866 | scope_info.scope.node = prefix_node; |
859 | 867 | ||
860 | /* Lookup the name in the namespace */ | 868 | /* Lookup the name in the namespace */ |
861 | 869 | ||
862 | status = acpi_ns_lookup(&scope_info, internal_path, | 870 | status = acpi_ns_lookup(&scope_info, internal_path, ACPI_TYPE_ANY, |
863 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 871 | ACPI_IMODE_EXECUTE, |
864 | (flags | ACPI_NS_DONT_OPEN_SCOPE), | 872 | (flags | ACPI_NS_DONT_OPEN_SCOPE), NULL, |
865 | NULL, return_node); | 873 | return_node); |
866 | if (ACPI_FAILURE(status)) { | 874 | if (ACPI_FAILURE(status)) { |
867 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", | 875 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n", |
868 | internal_path, | 876 | pathname, acpi_format_exception(status))); |
869 | acpi_format_exception(status))); | ||
870 | } | 877 | } |
871 | 878 | ||
872 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 879 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
873 | 880 | ||
874 | cleanup: | 881 | cleanup: |
875 | if (internal_path) { | 882 | ACPI_FREE(internal_path); |
876 | ACPI_MEM_FREE(internal_path); | ||
877 | } | ||
878 | return_ACPI_STATUS(status); | 883 | return_ACPI_STATUS(status); |
879 | } | 884 | } |
880 | 885 | ||
@@ -960,9 +965,10 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node) | |||
960 | { | 965 | { |
961 | struct acpi_namespace_node *parent_node; | 966 | struct acpi_namespace_node *parent_node; |
962 | 967 | ||
963 | ACPI_FUNCTION_TRACE("ns_find_parent_name"); | 968 | ACPI_FUNCTION_TRACE(ns_find_parent_name); |
964 | 969 | ||
965 | if (child_node) { | 970 | if (child_node) { |
971 | |||
966 | /* Valid entry. Get the parent Node */ | 972 | /* Valid entry. Get the parent Node */ |
967 | 973 | ||
968 | parent_node = acpi_ns_get_parent_node(child_node); | 974 | parent_node = acpi_ns_get_parent_node(child_node); |
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index fcab1e784b81..c8f6bef16ed0 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -76,6 +76,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
76 | ACPI_FUNCTION_ENTRY(); | 76 | ACPI_FUNCTION_ENTRY(); |
77 | 77 | ||
78 | if (!child_node) { | 78 | if (!child_node) { |
79 | |||
79 | /* It's really the parent's _scope_ that we want */ | 80 | /* It's really the parent's _scope_ that we want */ |
80 | 81 | ||
81 | if (parent_node->child) { | 82 | if (parent_node->child) { |
@@ -92,6 +93,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
92 | /* If any type is OK, we are done */ | 93 | /* If any type is OK, we are done */ |
93 | 94 | ||
94 | if (type == ACPI_TYPE_ANY) { | 95 | if (type == ACPI_TYPE_ANY) { |
96 | |||
95 | /* next_node is NULL if we are at the end-of-list */ | 97 | /* next_node is NULL if we are at the end-of-list */ |
96 | 98 | ||
97 | return (next_node); | 99 | return (next_node); |
@@ -100,6 +102,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, | |||
100 | /* Must search for the node -- but within this scope only */ | 102 | /* Must search for the node -- but within this scope only */ |
101 | 103 | ||
102 | while (next_node) { | 104 | while (next_node) { |
105 | |||
103 | /* If type matches, we are done */ | 106 | /* If type matches, we are done */ |
104 | 107 | ||
105 | if (next_node->type == type) { | 108 | if (next_node->type == type) { |
@@ -161,7 +164,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
161 | acpi_object_type child_type; | 164 | acpi_object_type child_type; |
162 | u32 level; | 165 | u32 level; |
163 | 166 | ||
164 | ACPI_FUNCTION_TRACE("ns_walk_namespace"); | 167 | ACPI_FUNCTION_TRACE(ns_walk_namespace); |
165 | 168 | ||
166 | /* Special case for the namespace Root Node */ | 169 | /* Special case for the namespace Root Node */ |
167 | 170 | ||
@@ -182,6 +185,7 @@ acpi_ns_walk_namespace(acpi_object_type type, | |||
182 | * bubbled up to (and passed) the original parent handle (start_entry) | 185 | * bubbled up to (and passed) the original parent handle (start_entry) |
183 | */ | 186 | */ |
184 | while (level > 0) { | 187 | while (level > 0) { |
188 | |||
185 | /* Get the next node in this scope. Null if not found */ | 189 | /* Get the next node in this scope. Null if not found */ |
186 | 190 | ||
187 | status = AE_OK; | 191 | status = AE_OK; |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index a95f636dc35d..6d9bd45af30a 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -51,6 +49,7 @@ | |||
51 | #define _COMPONENT ACPI_NAMESPACE | 49 | #define _COMPONENT ACPI_NAMESPACE |
52 | ACPI_MODULE_NAME("nsxfeval") | 50 | ACPI_MODULE_NAME("nsxfeval") |
53 | 51 | ||
52 | #ifdef ACPI_FUTURE_USAGE | ||
54 | /******************************************************************************* | 53 | /******************************************************************************* |
55 | * | 54 | * |
56 | * FUNCTION: acpi_evaluate_object_typed | 55 | * FUNCTION: acpi_evaluate_object_typed |
@@ -71,18 +70,17 @@ ACPI_MODULE_NAME("nsxfeval") | |||
71 | * be valid (non-null) | 70 | * be valid (non-null) |
72 | * | 71 | * |
73 | ******************************************************************************/ | 72 | ******************************************************************************/ |
74 | #ifdef ACPI_FUTURE_USAGE | ||
75 | acpi_status | 73 | acpi_status |
76 | acpi_evaluate_object_typed(acpi_handle handle, | 74 | acpi_evaluate_object_typed(acpi_handle handle, |
77 | acpi_string pathname, | 75 | acpi_string pathname, |
78 | struct acpi_object_list *external_params, | 76 | struct acpi_object_list * external_params, |
79 | struct acpi_buffer *return_buffer, | 77 | struct acpi_buffer * return_buffer, |
80 | acpi_object_type return_type) | 78 | acpi_object_type return_type) |
81 | { | 79 | { |
82 | acpi_status status; | 80 | acpi_status status; |
83 | u8 must_free = FALSE; | 81 | u8 must_free = FALSE; |
84 | 82 | ||
85 | ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed"); | 83 | ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); |
86 | 84 | ||
87 | /* Return buffer must be valid */ | 85 | /* Return buffer must be valid */ |
88 | 86 | ||
@@ -110,6 +108,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
110 | } | 108 | } |
111 | 109 | ||
112 | if (return_buffer->length == 0) { | 110 | if (return_buffer->length == 0) { |
111 | |||
113 | /* Error because caller specifically asked for a return value */ | 112 | /* Error because caller specifically asked for a return value */ |
114 | 113 | ||
115 | ACPI_ERROR((AE_INFO, "No return value")); | 114 | ACPI_ERROR((AE_INFO, "No return value")); |
@@ -131,6 +130,7 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
131 | acpi_ut_get_type_name(return_type))); | 130 | acpi_ut_get_type_name(return_type))); |
132 | 131 | ||
133 | if (must_free) { | 132 | if (must_free) { |
133 | |||
134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ | 134 | /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ |
135 | 135 | ||
136 | acpi_os_free(return_buffer->pointer); | 136 | acpi_os_free(return_buffer->pointer); |
@@ -140,6 +140,8 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
140 | return_buffer->length = 0; | 140 | return_buffer->length = 0; |
141 | return_ACPI_STATUS(AE_TYPE); | 141 | return_ACPI_STATUS(AE_TYPE); |
142 | } | 142 | } |
143 | |||
144 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) | ||
143 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
144 | 146 | ||
145 | /******************************************************************************* | 147 | /******************************************************************************* |
@@ -161,7 +163,6 @@ acpi_evaluate_object_typed(acpi_handle handle, | |||
161 | * be valid (non-null) | 163 | * be valid (non-null) |
162 | * | 164 | * |
163 | ******************************************************************************/ | 165 | ******************************************************************************/ |
164 | |||
165 | acpi_status | 166 | acpi_status |
166 | acpi_evaluate_object(acpi_handle handle, | 167 | acpi_evaluate_object(acpi_handle handle, |
167 | acpi_string pathname, | 168 | acpi_string pathname, |
@@ -170,51 +171,61 @@ acpi_evaluate_object(acpi_handle handle, | |||
170 | { | 171 | { |
171 | acpi_status status; | 172 | acpi_status status; |
172 | acpi_status status2; | 173 | acpi_status status2; |
173 | struct acpi_parameter_info info; | 174 | struct acpi_evaluate_info *info; |
174 | acpi_size buffer_space_needed; | 175 | acpi_size buffer_space_needed; |
175 | u32 i; | 176 | u32 i; |
176 | 177 | ||
177 | ACPI_FUNCTION_TRACE("acpi_evaluate_object"); | 178 | ACPI_FUNCTION_TRACE(acpi_evaluate_object); |
178 | 179 | ||
179 | info.node = handle; | 180 | /* Allocate and initialize the evaluation information block */ |
180 | info.parameters = NULL; | 181 | |
181 | info.return_object = NULL; | 182 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
182 | info.parameter_type = ACPI_PARAM_ARGS; | 183 | if (!info) { |
184 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
185 | } | ||
186 | |||
187 | info->pathname = pathname; | ||
188 | info->parameter_type = ACPI_PARAM_ARGS; | ||
189 | |||
190 | /* Convert and validate the device handle */ | ||
191 | |||
192 | info->prefix_node = acpi_ns_map_handle_to_node(handle); | ||
193 | if (!info->prefix_node) { | ||
194 | status = AE_BAD_PARAMETER; | ||
195 | goto cleanup; | ||
196 | } | ||
183 | 197 | ||
184 | /* | 198 | /* |
185 | * If there are parameters to be passed to the object | 199 | * If there are parameters to be passed to a control method, the external |
186 | * (which must be a control method), the external objects | 200 | * objects must all be converted to internal objects |
187 | * must be converted to internal objects | ||
188 | */ | 201 | */ |
189 | if (external_params && external_params->count) { | 202 | if (external_params && external_params->count) { |
190 | /* | 203 | /* |
191 | * Allocate a new parameter block for the internal objects | 204 | * Allocate a new parameter block for the internal objects |
192 | * Add 1 to count to allow for null terminated internal list | 205 | * Add 1 to count to allow for null terminated internal list |
193 | */ | 206 | */ |
194 | info.parameters = ACPI_MEM_CALLOCATE(((acpi_size) | 207 | info->parameters = ACPI_ALLOCATE_ZEROED(((acpi_size) |
195 | external_params->count + | 208 | external_params-> |
196 | 1) * sizeof(void *)); | 209 | count + |
197 | if (!info.parameters) { | 210 | 1) * sizeof(void *)); |
198 | return_ACPI_STATUS(AE_NO_MEMORY); | 211 | if (!info->parameters) { |
212 | status = AE_NO_MEMORY; | ||
213 | goto cleanup; | ||
199 | } | 214 | } |
200 | 215 | ||
201 | /* | 216 | /* Convert each external object in the list to an internal object */ |
202 | * Convert each external object in the list to an | 217 | |
203 | * internal object | ||
204 | */ | ||
205 | for (i = 0; i < external_params->count; i++) { | 218 | for (i = 0; i < external_params->count; i++) { |
206 | status = | 219 | status = |
207 | acpi_ut_copy_eobject_to_iobject(&external_params-> | 220 | acpi_ut_copy_eobject_to_iobject(&external_params-> |
208 | pointer[i], | 221 | pointer[i], |
209 | &info. | 222 | &info-> |
210 | parameters[i]); | 223 | parameters[i]); |
211 | if (ACPI_FAILURE(status)) { | 224 | if (ACPI_FAILURE(status)) { |
212 | acpi_ut_delete_internal_object_list(info. | 225 | goto cleanup; |
213 | parameters); | ||
214 | return_ACPI_STATUS(status); | ||
215 | } | 226 | } |
216 | } | 227 | } |
217 | info.parameters[external_params->count] = NULL; | 228 | info->parameters[external_params->count] = NULL; |
218 | } | 229 | } |
219 | 230 | ||
220 | /* | 231 | /* |
@@ -224,43 +235,31 @@ acpi_evaluate_object(acpi_handle handle, | |||
224 | * 3) Valid handle | 235 | * 3) Valid handle |
225 | */ | 236 | */ |
226 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { | 237 | if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) { |
227 | /* | 238 | |
228 | * The path is fully qualified, just evaluate by name | 239 | /* The path is fully qualified, just evaluate by name */ |
229 | */ | 240 | |
230 | status = acpi_ns_evaluate_by_name(pathname, &info); | 241 | info->prefix_node = NULL; |
242 | status = acpi_ns_evaluate(info); | ||
231 | } else if (!handle) { | 243 | } else if (!handle) { |
232 | /* | 244 | /* |
233 | * A handle is optional iff a fully qualified pathname | 245 | * A handle is optional iff a fully qualified pathname is specified. |
234 | * is specified. Since we've already handled fully | 246 | * Since we've already handled fully qualified names above, this is |
235 | * qualified names above, this is an error | 247 | * an error |
236 | */ | 248 | */ |
237 | if (!pathname) { | 249 | if (!pathname) { |
238 | ACPI_ERROR((AE_INFO, | 250 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
239 | "Both Handle and Pathname are NULL")); | 251 | "Both Handle and Pathname are NULL")); |
240 | } else { | 252 | } else { |
241 | ACPI_ERROR((AE_INFO, | 253 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
242 | "Handle is NULL and Pathname is relative")); | 254 | "Null Handle with relative pathname [%s]", |
255 | pathname)); | ||
243 | } | 256 | } |
244 | 257 | ||
245 | status = AE_BAD_PARAMETER; | 258 | status = AE_BAD_PARAMETER; |
246 | } else { | 259 | } else { |
247 | /* | 260 | /* We have a namespace a node and a possible relative path */ |
248 | * We get here if we have a handle -- and if we have a | 261 | |
249 | * pathname it is relative. The handle will be validated | 262 | status = acpi_ns_evaluate(info); |
250 | * in the lower procedures | ||
251 | */ | ||
252 | if (!pathname) { | ||
253 | /* | ||
254 | * The null pathname case means the handle is for | ||
255 | * the actual object to be evaluated | ||
256 | */ | ||
257 | status = acpi_ns_evaluate_by_handle(&info); | ||
258 | } else { | ||
259 | /* | ||
260 | * Both a Handle and a relative Pathname | ||
261 | */ | ||
262 | status = acpi_ns_evaluate_relative(pathname, &info); | ||
263 | } | ||
264 | } | 263 | } |
265 | 264 | ||
266 | /* | 265 | /* |
@@ -268,10 +267,10 @@ acpi_evaluate_object(acpi_handle handle, | |||
268 | * copy the return value to an external object. | 267 | * copy the return value to an external object. |
269 | */ | 268 | */ |
270 | if (return_buffer) { | 269 | if (return_buffer) { |
271 | if (!info.return_object) { | 270 | if (!info->return_object) { |
272 | return_buffer->length = 0; | 271 | return_buffer->length = 0; |
273 | } else { | 272 | } else { |
274 | if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) == | 273 | if (ACPI_GET_DESCRIPTOR_TYPE(info->return_object) == |
275 | ACPI_DESC_TYPE_NAMED) { | 274 | ACPI_DESC_TYPE_NAMED) { |
276 | /* | 275 | /* |
277 | * If we received a NS Node as a return object, this means that | 276 | * If we received a NS Node as a return object, this means that |
@@ -282,19 +281,19 @@ acpi_evaluate_object(acpi_handle handle, | |||
282 | * support for various types at a later date if necessary. | 281 | * support for various types at a later date if necessary. |
283 | */ | 282 | */ |
284 | status = AE_TYPE; | 283 | status = AE_TYPE; |
285 | info.return_object = NULL; /* No need to delete a NS Node */ | 284 | info->return_object = NULL; /* No need to delete a NS Node */ |
286 | return_buffer->length = 0; | 285 | return_buffer->length = 0; |
287 | } | 286 | } |
288 | 287 | ||
289 | if (ACPI_SUCCESS(status)) { | 288 | if (ACPI_SUCCESS(status)) { |
290 | /* | 289 | |
291 | * Find out how large a buffer is needed | 290 | /* Get the size of the returned object */ |
292 | * to contain the returned object | 291 | |
293 | */ | ||
294 | status = | 292 | status = |
295 | acpi_ut_get_object_size(info.return_object, | 293 | acpi_ut_get_object_size(info->return_object, |
296 | &buffer_space_needed); | 294 | &buffer_space_needed); |
297 | if (ACPI_SUCCESS(status)) { | 295 | if (ACPI_SUCCESS(status)) { |
296 | |||
298 | /* Validate/Allocate/Clear caller buffer */ | 297 | /* Validate/Allocate/Clear caller buffer */ |
299 | 298 | ||
300 | status = | 299 | status = |
@@ -303,7 +302,8 @@ acpi_evaluate_object(acpi_handle handle, | |||
303 | buffer_space_needed); | 302 | buffer_space_needed); |
304 | if (ACPI_FAILURE(status)) { | 303 | if (ACPI_FAILURE(status)) { |
305 | /* | 304 | /* |
306 | * Caller's buffer is too small or a new one can't be allocated | 305 | * Caller's buffer is too small or a new one can't |
306 | * be allocated | ||
307 | */ | 307 | */ |
308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 308 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
309 | "Needed buffer size %X, %s\n", | 309 | "Needed buffer size %X, %s\n", |
@@ -312,12 +312,11 @@ acpi_evaluate_object(acpi_handle handle, | |||
312 | acpi_format_exception | 312 | acpi_format_exception |
313 | (status))); | 313 | (status))); |
314 | } else { | 314 | } else { |
315 | /* | 315 | /* We have enough space for the object, build it */ |
316 | * We have enough space for the object, build it | 316 | |
317 | */ | ||
318 | status = | 317 | status = |
319 | acpi_ut_copy_iobject_to_eobject | 318 | acpi_ut_copy_iobject_to_eobject |
320 | (info.return_object, | 319 | (info->return_object, |
321 | return_buffer); | 320 | return_buffer); |
322 | } | 321 | } |
323 | } | 322 | } |
@@ -325,35 +324,37 @@ acpi_evaluate_object(acpi_handle handle, | |||
325 | } | 324 | } |
326 | } | 325 | } |
327 | 326 | ||
328 | if (info.return_object) { | 327 | if (info->return_object) { |
329 | /* | 328 | /* |
330 | * Delete the internal return object. NOTE: Interpreter | 329 | * Delete the internal return object. NOTE: Interpreter must be |
331 | * must be locked to avoid race condition. | 330 | * locked to avoid race condition. |
332 | */ | 331 | */ |
333 | status2 = acpi_ex_enter_interpreter(); | 332 | status2 = acpi_ex_enter_interpreter(); |
334 | if (ACPI_SUCCESS(status2)) { | 333 | if (ACPI_SUCCESS(status2)) { |
335 | /* | 334 | |
336 | * Delete the internal return object. (Or at least | 335 | /* Remove one reference on the return object (should delete it) */ |
337 | * decrement the reference count by one) | 336 | |
338 | */ | 337 | acpi_ut_remove_reference(info->return_object); |
339 | acpi_ut_remove_reference(info.return_object); | ||
340 | acpi_ex_exit_interpreter(); | 338 | acpi_ex_exit_interpreter(); |
341 | } | 339 | } |
342 | } | 340 | } |
343 | 341 | ||
344 | /* | 342 | cleanup: |
345 | * Free the input parameter list (if we created one), | 343 | |
346 | */ | 344 | /* Free the input parameter list (if we created one) */ |
347 | if (info.parameters) { | 345 | |
346 | if (info->parameters) { | ||
347 | |||
348 | /* Free the allocated parameter block */ | 348 | /* Free the allocated parameter block */ |
349 | 349 | ||
350 | acpi_ut_delete_internal_object_list(info.parameters); | 350 | acpi_ut_delete_internal_object_list(info->parameters); |
351 | } | 351 | } |
352 | 352 | ||
353 | ACPI_FREE(info); | ||
353 | return_ACPI_STATUS(status); | 354 | return_ACPI_STATUS(status); |
354 | } | 355 | } |
355 | 356 | ||
356 | EXPORT_SYMBOL(acpi_evaluate_object); | 357 | ACPI_EXPORT_SYMBOL(acpi_evaluate_object) |
357 | 358 | ||
358 | /******************************************************************************* | 359 | /******************************************************************************* |
359 | * | 360 | * |
@@ -384,7 +385,6 @@ EXPORT_SYMBOL(acpi_evaluate_object); | |||
384 | * function, etc. | 385 | * function, etc. |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status | 388 | acpi_status |
389 | acpi_walk_namespace(acpi_object_type type, | 389 | acpi_walk_namespace(acpi_object_type type, |
390 | acpi_handle start_object, | 390 | acpi_handle start_object, |
@@ -394,7 +394,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
394 | { | 394 | { |
395 | acpi_status status; | 395 | acpi_status status; |
396 | 396 | ||
397 | ACPI_FUNCTION_TRACE("acpi_walk_namespace"); | 397 | ACPI_FUNCTION_TRACE(acpi_walk_namespace); |
398 | 398 | ||
399 | /* Parameter validation */ | 399 | /* Parameter validation */ |
400 | 400 | ||
@@ -421,7 +421,7 @@ acpi_walk_namespace(acpi_object_type type, | |||
421 | return_ACPI_STATUS(status); | 421 | return_ACPI_STATUS(status); |
422 | } | 422 | } |
423 | 423 | ||
424 | EXPORT_SYMBOL(acpi_walk_namespace); | 424 | ACPI_EXPORT_SYMBOL(acpi_walk_namespace) |
425 | 425 | ||
426 | /******************************************************************************* | 426 | /******************************************************************************* |
427 | * | 427 | * |
@@ -436,7 +436,6 @@ EXPORT_SYMBOL(acpi_walk_namespace); | |||
436 | * on that. | 436 | * on that. |
437 | * | 437 | * |
438 | ******************************************************************************/ | 438 | ******************************************************************************/ |
439 | |||
440 | static acpi_status | 439 | static acpi_status |
441 | acpi_ns_get_device_callback(acpi_handle obj_handle, | 440 | acpi_ns_get_device_callback(acpi_handle obj_handle, |
442 | u32 nesting_level, | 441 | u32 nesting_level, |
@@ -473,6 +472,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
473 | } | 472 | } |
474 | 473 | ||
475 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 474 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { |
475 | |||
476 | /* Don't examine children of the device if not present */ | 476 | /* Don't examine children of the device if not present */ |
477 | 477 | ||
478 | return (AE_CTRL_DEPTH); | 478 | return (AE_CTRL_DEPTH); |
@@ -489,6 +489,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
489 | } | 489 | } |
490 | 490 | ||
491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { | 491 | if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) { |
492 | |||
492 | /* Get the list of Compatible IDs */ | 493 | /* Get the list of Compatible IDs */ |
493 | 494 | ||
494 | status = acpi_ut_execute_CID(node, &cid); | 495 | status = acpi_ut_execute_CID(node, &cid); |
@@ -505,11 +506,11 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
505 | sizeof(struct | 506 | sizeof(struct |
506 | acpi_compatible_id)) != | 507 | acpi_compatible_id)) != |
507 | 0) { | 508 | 0) { |
508 | ACPI_MEM_FREE(cid); | 509 | ACPI_FREE(cid); |
509 | return (AE_OK); | 510 | return (AE_OK); |
510 | } | 511 | } |
511 | } | 512 | } |
512 | ACPI_MEM_FREE(cid); | 513 | ACPI_FREE(cid); |
513 | } | 514 | } |
514 | } | 515 | } |
515 | 516 | ||
@@ -551,7 +552,7 @@ acpi_get_devices(char *HID, | |||
551 | acpi_status status; | 552 | acpi_status status; |
552 | struct acpi_get_devices_info info; | 553 | struct acpi_get_devices_info info; |
553 | 554 | ||
554 | ACPI_FUNCTION_TRACE("acpi_get_devices"); | 555 | ACPI_FUNCTION_TRACE(acpi_get_devices); |
555 | 556 | ||
556 | /* Parameter validation */ | 557 | /* Parameter validation */ |
557 | 558 | ||
@@ -563,9 +564,9 @@ acpi_get_devices(char *HID, | |||
563 | * We're going to call their callback from OUR callback, so we need | 564 | * We're going to call their callback from OUR callback, so we need |
564 | * to know what it is, and their context parameter. | 565 | * to know what it is, and their context parameter. |
565 | */ | 566 | */ |
567 | info.hid = HID; | ||
566 | info.context = context; | 568 | info.context = context; |
567 | info.user_function = user_function; | 569 | info.user_function = user_function; |
568 | info.hid = HID; | ||
569 | 570 | ||
570 | /* | 571 | /* |
571 | * Lock the namespace around the walk. | 572 | * Lock the namespace around the walk. |
@@ -578,9 +579,8 @@ acpi_get_devices(char *HID, | |||
578 | return_ACPI_STATUS(status); | 579 | return_ACPI_STATUS(status); |
579 | } | 580 | } |
580 | 581 | ||
581 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, | 582 | status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
582 | ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, | 583 | ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, |
583 | ACPI_NS_WALK_UNLOCK, | ||
584 | acpi_ns_get_device_callback, &info, | 584 | acpi_ns_get_device_callback, &info, |
585 | return_value); | 585 | return_value); |
586 | 586 | ||
@@ -588,7 +588,7 @@ acpi_get_devices(char *HID, | |||
588 | return_ACPI_STATUS(status); | 588 | return_ACPI_STATUS(status); |
589 | } | 589 | } |
590 | 590 | ||
591 | EXPORT_SYMBOL(acpi_get_devices); | 591 | ACPI_EXPORT_SYMBOL(acpi_get_devices) |
592 | 592 | ||
593 | /******************************************************************************* | 593 | /******************************************************************************* |
594 | * | 594 | * |
@@ -603,7 +603,6 @@ EXPORT_SYMBOL(acpi_get_devices); | |||
603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. | 603 | * DESCRIPTION: Attach arbitrary data and handler to a namespace node. |
604 | * | 604 | * |
605 | ******************************************************************************/ | 605 | ******************************************************************************/ |
606 | |||
607 | acpi_status | 606 | acpi_status |
608 | acpi_attach_data(acpi_handle obj_handle, | 607 | acpi_attach_data(acpi_handle obj_handle, |
609 | acpi_object_handler handler, void *data) | 608 | acpi_object_handler handler, void *data) |
@@ -637,6 +636,8 @@ acpi_attach_data(acpi_handle obj_handle, | |||
637 | return (status); | 636 | return (status); |
638 | } | 637 | } |
639 | 638 | ||
639 | ACPI_EXPORT_SYMBOL(acpi_attach_data) | ||
640 | |||
640 | /******************************************************************************* | 641 | /******************************************************************************* |
641 | * | 642 | * |
642 | * FUNCTION: acpi_detach_data | 643 | * FUNCTION: acpi_detach_data |
@@ -649,7 +650,6 @@ acpi_attach_data(acpi_handle obj_handle, | |||
649 | * DESCRIPTION: Remove data that was previously attached to a node. | 650 | * DESCRIPTION: Remove data that was previously attached to a node. |
650 | * | 651 | * |
651 | ******************************************************************************/ | 652 | ******************************************************************************/ |
652 | |||
653 | acpi_status | 653 | acpi_status |
654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | 654 | acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) |
655 | { | 655 | { |
@@ -682,6 +682,8 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
682 | return (status); | 682 | return (status); |
683 | } | 683 | } |
684 | 684 | ||
685 | ACPI_EXPORT_SYMBOL(acpi_detach_data) | ||
686 | |||
685 | /******************************************************************************* | 687 | /******************************************************************************* |
686 | * | 688 | * |
687 | * FUNCTION: acpi_get_data | 689 | * FUNCTION: acpi_get_data |
@@ -695,7 +697,6 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) | |||
695 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. | 697 | * DESCRIPTION: Retrieve data that was previously attached to a namespace node. |
696 | * | 698 | * |
697 | ******************************************************************************/ | 699 | ******************************************************************************/ |
698 | |||
699 | acpi_status | 700 | acpi_status |
700 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | 701 | acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) |
701 | { | 702 | { |
@@ -727,3 +728,5 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) | |||
727 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 728 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
728 | return (status); | 729 | return (status); |
729 | } | 730 | } |
731 | |||
732 | ACPI_EXPORT_SYMBOL(acpi_get_data) | ||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index 8cd8675a47c0..978213a6c19f 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -114,9 +112,8 @@ acpi_get_handle(acpi_handle parent, | |||
114 | /* | 112 | /* |
115 | * Find the Node and convert to a handle | 113 | * Find the Node and convert to a handle |
116 | */ | 114 | */ |
117 | status = | 115 | status = acpi_ns_get_node(prefix_node, pathname, ACPI_NS_NO_UPSEARCH, |
118 | acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH, | 116 | &node); |
119 | &node); | ||
120 | 117 | ||
121 | *ret_handle = NULL; | 118 | *ret_handle = NULL; |
122 | if (ACPI_SUCCESS(status)) { | 119 | if (ACPI_SUCCESS(status)) { |
@@ -126,7 +123,7 @@ acpi_get_handle(acpi_handle parent, | |||
126 | return (status); | 123 | return (status); |
127 | } | 124 | } |
128 | 125 | ||
129 | EXPORT_SYMBOL(acpi_get_handle); | 126 | ACPI_EXPORT_SYMBOL(acpi_get_handle) |
130 | 127 | ||
131 | /****************************************************************************** | 128 | /****************************************************************************** |
132 | * | 129 | * |
@@ -143,7 +140,6 @@ EXPORT_SYMBOL(acpi_get_handle); | |||
143 | * complementary functions. | 140 | * complementary functions. |
144 | * | 141 | * |
145 | ******************************************************************************/ | 142 | ******************************************************************************/ |
146 | |||
147 | acpi_status | 143 | acpi_status |
148 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | 144 | acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) |
149 | { | 145 | { |
@@ -162,6 +158,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
162 | } | 158 | } |
163 | 159 | ||
164 | if (name_type == ACPI_FULL_PATHNAME) { | 160 | if (name_type == ACPI_FULL_PATHNAME) { |
161 | |||
165 | /* Get the full pathname (From the namespace root) */ | 162 | /* Get the full pathname (From the namespace root) */ |
166 | 163 | ||
167 | status = acpi_ns_handle_to_pathname(handle, buffer); | 164 | status = acpi_ns_handle_to_pathname(handle, buffer); |
@@ -203,7 +200,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) | |||
203 | return (status); | 200 | return (status); |
204 | } | 201 | } |
205 | 202 | ||
206 | EXPORT_SYMBOL(acpi_get_name); | 203 | ACPI_EXPORT_SYMBOL(acpi_get_name) |
207 | 204 | ||
208 | /****************************************************************************** | 205 | /****************************************************************************** |
209 | * | 206 | * |
@@ -219,7 +216,6 @@ EXPORT_SYMBOL(acpi_get_name); | |||
219 | * control methods (Such as in the case of a device.) | 216 | * control methods (Such as in the case of a device.) |
220 | * | 217 | * |
221 | ******************************************************************************/ | 218 | ******************************************************************************/ |
222 | |||
223 | acpi_status | 219 | acpi_status |
224 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | 220 | acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) |
225 | { | 221 | { |
@@ -241,7 +237,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
241 | return (status); | 237 | return (status); |
242 | } | 238 | } |
243 | 239 | ||
244 | info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info)); | 240 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_device_info)); |
245 | if (!info) { | 241 | if (!info) { |
246 | return (AE_NO_MEMORY); | 242 | return (AE_NO_MEMORY); |
247 | } | 243 | } |
@@ -345,11 +341,11 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer) | |||
345 | } | 341 | } |
346 | 342 | ||
347 | cleanup: | 343 | cleanup: |
348 | ACPI_MEM_FREE(info); | 344 | ACPI_FREE(info); |
349 | if (cid_list) { | 345 | if (cid_list) { |
350 | ACPI_MEM_FREE(cid_list); | 346 | ACPI_FREE(cid_list); |
351 | } | 347 | } |
352 | return (status); | 348 | return (status); |
353 | } | 349 | } |
354 | 350 | ||
355 | EXPORT_SYMBOL(acpi_get_object_info); | 351 | ACPI_EXPORT_SYMBOL(acpi_get_object_info) |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index a0332595677a..a163e1d3708d 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | 47 | ||
@@ -101,7 +99,7 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) | |||
101 | return (status); | 99 | return (status); |
102 | } | 100 | } |
103 | 101 | ||
104 | EXPORT_SYMBOL(acpi_get_type); | 102 | ACPI_EXPORT_SYMBOL(acpi_get_type) |
105 | 103 | ||
106 | /******************************************************************************* | 104 | /******************************************************************************* |
107 | * | 105 | * |
@@ -116,7 +114,6 @@ EXPORT_SYMBOL(acpi_get_type); | |||
116 | * Handle. | 114 | * Handle. |
117 | * | 115 | * |
118 | ******************************************************************************/ | 116 | ******************************************************************************/ |
119 | |||
120 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | 117 | acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) |
121 | { | 118 | { |
122 | struct acpi_namespace_node *node; | 119 | struct acpi_namespace_node *node; |
@@ -162,7 +159,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) | |||
162 | return (status); | 159 | return (status); |
163 | } | 160 | } |
164 | 161 | ||
165 | EXPORT_SYMBOL(acpi_get_parent); | 162 | ACPI_EXPORT_SYMBOL(acpi_get_parent) |
166 | 163 | ||
167 | /******************************************************************************* | 164 | /******************************************************************************* |
168 | * | 165 | * |
@@ -181,7 +178,6 @@ EXPORT_SYMBOL(acpi_get_parent); | |||
181 | * Scope is returned. | 178 | * Scope is returned. |
182 | * | 179 | * |
183 | ******************************************************************************/ | 180 | ******************************************************************************/ |
184 | |||
185 | acpi_status | 181 | acpi_status |
186 | acpi_get_next_object(acpi_object_type type, | 182 | acpi_get_next_object(acpi_object_type type, |
187 | acpi_handle parent, | 183 | acpi_handle parent, |
@@ -206,6 +202,7 @@ acpi_get_next_object(acpi_object_type type, | |||
206 | /* If null handle, use the parent */ | 202 | /* If null handle, use the parent */ |
207 | 203 | ||
208 | if (!child) { | 204 | if (!child) { |
205 | |||
209 | /* Start search at the beginning of the specified scope */ | 206 | /* Start search at the beginning of the specified scope */ |
210 | 207 | ||
211 | parent_node = acpi_ns_map_handle_to_node(parent); | 208 | parent_node = acpi_ns_map_handle_to_node(parent); |
@@ -242,4 +239,4 @@ acpi_get_next_object(acpi_object_type type, | |||
242 | return (status); | 239 | return (status); |
243 | } | 240 | } |
244 | 241 | ||
245 | EXPORT_SYMBOL(acpi_get_next_object); | 242 | ACPI_EXPORT_SYMBOL(acpi_get_next_object) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 13b5fd5854a8..1bb558adee66 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
38 | #include <linux/workqueue.h> | 38 | #include <linux/workqueue.h> |
39 | #include <linux/nmi.h> | 39 | #include <linux/nmi.h> |
40 | #include <linux/kthread.h> | ||
40 | #include <acpi/acpi.h> | 41 | #include <acpi/acpi.h> |
41 | #include <asm/io.h> | 42 | #include <asm/io.h> |
42 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
@@ -600,23 +601,41 @@ static void acpi_os_execute_deferred(void *context) | |||
600 | return_VOID; | 601 | return_VOID; |
601 | } | 602 | } |
602 | 603 | ||
603 | acpi_status | 604 | static int acpi_os_execute_thread(void *context) |
604 | acpi_os_queue_for_execution(u32 priority, | 605 | { |
606 | struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; | ||
607 | if (dpc) { | ||
608 | dpc->function(dpc->context); | ||
609 | kfree(dpc); | ||
610 | } | ||
611 | do_exit(0); | ||
612 | } | ||
613 | |||
614 | /******************************************************************************* | ||
615 | * | ||
616 | * FUNCTION: acpi_os_execute | ||
617 | * | ||
618 | * PARAMETERS: Type - Type of the callback | ||
619 | * Function - Function to be executed | ||
620 | * Context - Function parameters | ||
621 | * | ||
622 | * RETURN: Status | ||
623 | * | ||
624 | * DESCRIPTION: Depending on type, either queues function for deferred execution or | ||
625 | * immediately executes function on a separate thread. | ||
626 | * | ||
627 | ******************************************************************************/ | ||
628 | |||
629 | acpi_status acpi_os_execute(acpi_execute_type type, | ||
605 | acpi_osd_exec_callback function, void *context) | 630 | acpi_osd_exec_callback function, void *context) |
606 | { | 631 | { |
607 | acpi_status status = AE_OK; | 632 | acpi_status status = AE_OK; |
608 | struct acpi_os_dpc *dpc; | 633 | struct acpi_os_dpc *dpc; |
609 | struct work_struct *task; | 634 | struct work_struct *task; |
610 | 635 | struct task_struct *p; | |
611 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
612 | |||
613 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
614 | "Scheduling function [%p(%p)] for deferred execution.\n", | ||
615 | function, context)); | ||
616 | 636 | ||
617 | if (!function) | 637 | if (!function) |
618 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 638 | return AE_BAD_PARAMETER; |
619 | |||
620 | /* | 639 | /* |
621 | * Allocate/initialize DPC structure. Note that this memory will be | 640 | * Allocate/initialize DPC structure. Note that this memory will be |
622 | * freed by the callee. The kernel handles the tq_struct list in a | 641 | * freed by the callee. The kernel handles the tq_struct list in a |
@@ -627,30 +646,37 @@ acpi_os_queue_for_execution(u32 priority, | |||
627 | * We can save time and code by allocating the DPC and tq_structs | 646 | * We can save time and code by allocating the DPC and tq_structs |
628 | * from the same memory. | 647 | * from the same memory. |
629 | */ | 648 | */ |
630 | 649 | if (type == OSL_NOTIFY_HANDLER) { | |
631 | dpc = | 650 | dpc = kmalloc(sizeof(struct acpi_os_dpc), GFP_KERNEL); |
632 | kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), | 651 | } else { |
633 | GFP_ATOMIC); | 652 | dpc = kmalloc(sizeof(struct acpi_os_dpc) + |
653 | sizeof(struct work_struct), GFP_ATOMIC); | ||
654 | } | ||
634 | if (!dpc) | 655 | if (!dpc) |
635 | return_ACPI_STATUS(AE_NO_MEMORY); | 656 | return AE_NO_MEMORY; |
636 | |||
637 | dpc->function = function; | 657 | dpc->function = function; |
638 | dpc->context = context; | 658 | dpc->context = context; |
639 | 659 | ||
640 | task = (void *)(dpc + 1); | 660 | if (type == OSL_NOTIFY_HANDLER) { |
641 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | 661 | p = kthread_create(acpi_os_execute_thread, dpc, "kacpid_notify"); |
642 | 662 | if (!IS_ERR(p)) { | |
643 | if (!queue_work(kacpid_wq, task)) { | 663 | wake_up_process(p); |
644 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 664 | } else { |
645 | "Call to queue_work() failed.\n")); | 665 | status = AE_NO_MEMORY; |
646 | kfree(dpc); | 666 | kfree(dpc); |
647 | status = AE_ERROR; | 667 | } |
668 | } else { | ||
669 | task = (void *)(dpc + 1); | ||
670 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | ||
671 | if (!queue_work(kacpid_wq, task)) { | ||
672 | status = AE_ERROR; | ||
673 | kfree(dpc); | ||
674 | } | ||
648 | } | 675 | } |
649 | 676 | return status; | |
650 | return_ACPI_STATUS(status); | ||
651 | } | 677 | } |
652 | 678 | ||
653 | EXPORT_SYMBOL(acpi_os_queue_for_execution); | 679 | EXPORT_SYMBOL(acpi_os_execute); |
654 | 680 | ||
655 | void acpi_os_wait_events_complete(void *context) | 681 | void acpi_os_wait_events_complete(void *context) |
656 | { | 682 | { |
@@ -769,9 +795,6 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout) | |||
769 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", | 795 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", |
770 | handle, units, timeout)); | 796 | handle, units, timeout)); |
771 | 797 | ||
772 | if (in_atomic()) | ||
773 | timeout = 0; | ||
774 | |||
775 | switch (timeout) { | 798 | switch (timeout) { |
776 | /* | 799 | /* |
777 | * No Wait: | 800 | * No Wait: |
@@ -896,14 +919,6 @@ u8 acpi_os_writable(void *ptr, acpi_size len) | |||
896 | } | 919 | } |
897 | #endif | 920 | #endif |
898 | 921 | ||
899 | u32 acpi_os_get_thread_id(void) | ||
900 | { | ||
901 | if (!in_atomic()) | ||
902 | return current->pid; | ||
903 | |||
904 | return 0; | ||
905 | } | ||
906 | |||
907 | acpi_status acpi_os_signal(u32 function, void *info) | 922 | acpi_status acpi_os_signal(u32 function, void *info) |
908 | { | 923 | { |
909 | switch (function) { | 924 | switch (function) { |
@@ -1050,12 +1065,12 @@ void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags) | |||
1050 | * | 1065 | * |
1051 | * FUNCTION: acpi_os_create_cache | 1066 | * FUNCTION: acpi_os_create_cache |
1052 | * | 1067 | * |
1053 | * PARAMETERS: CacheName - Ascii name for the cache | 1068 | * PARAMETERS: name - Ascii name for the cache |
1054 | * ObjectSize - Size of each cached object | 1069 | * size - Size of each cached object |
1055 | * MaxDepth - Maximum depth of the cache (in objects) | 1070 | * depth - Maximum depth of the cache (in objects) <ignored> |
1056 | * ReturnCache - Where the new cache object is returned | 1071 | * cache - Where the new cache object is returned |
1057 | * | 1072 | * |
1058 | * RETURN: Status | 1073 | * RETURN: status |
1059 | * | 1074 | * |
1060 | * DESCRIPTION: Create a cache object | 1075 | * DESCRIPTION: Create a cache object |
1061 | * | 1076 | * |
@@ -1065,7 +1080,10 @@ acpi_status | |||
1065 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) | 1080 | acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) |
1066 | { | 1081 | { |
1067 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); | 1082 | *cache = kmem_cache_create(name, size, 0, 0, NULL, NULL); |
1068 | return AE_OK; | 1083 | if (cache == NULL) |
1084 | return AE_ERROR; | ||
1085 | else | ||
1086 | return AE_OK; | ||
1069 | } | 1087 | } |
1070 | 1088 | ||
1071 | /******************************************************************************* | 1089 | /******************************************************************************* |
@@ -1134,16 +1152,63 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object) | |||
1134 | * | 1152 | * |
1135 | * RETURN: Status | 1153 | * RETURN: Status |
1136 | * | 1154 | * |
1137 | * DESCRIPTION: Get an object from the specified cache. If cache is empty, | 1155 | * DESCRIPTION: Return a zero-filled object. |
1138 | * the object is allocated. | ||
1139 | * | 1156 | * |
1140 | ******************************************************************************/ | 1157 | ******************************************************************************/ |
1141 | 1158 | ||
1142 | void *acpi_os_acquire_object(acpi_cache_t * cache) | 1159 | void *acpi_os_acquire_object(acpi_cache_t * cache) |
1143 | { | 1160 | { |
1144 | void *object = kmem_cache_alloc(cache, GFP_KERNEL); | 1161 | void *object = kmem_cache_zalloc(cache, GFP_KERNEL); |
1145 | WARN_ON(!object); | 1162 | WARN_ON(!object); |
1146 | return object; | 1163 | return object; |
1147 | } | 1164 | } |
1148 | 1165 | ||
1166 | /****************************************************************************** | ||
1167 | * | ||
1168 | * FUNCTION: acpi_os_validate_interface | ||
1169 | * | ||
1170 | * PARAMETERS: interface - Requested interface to be validated | ||
1171 | * | ||
1172 | * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise | ||
1173 | * | ||
1174 | * DESCRIPTION: Match an interface string to the interfaces supported by the | ||
1175 | * host. Strings originate from an AML call to the _OSI method. | ||
1176 | * | ||
1177 | *****************************************************************************/ | ||
1178 | |||
1179 | acpi_status | ||
1180 | acpi_os_validate_interface (char *interface) | ||
1181 | { | ||
1182 | |||
1183 | return AE_SUPPORT; | ||
1184 | } | ||
1185 | |||
1186 | |||
1187 | /****************************************************************************** | ||
1188 | * | ||
1189 | * FUNCTION: acpi_os_validate_address | ||
1190 | * | ||
1191 | * PARAMETERS: space_id - ACPI space ID | ||
1192 | * address - Physical address | ||
1193 | * length - Address length | ||
1194 | * | ||
1195 | * RETURN: AE_OK if address/length is valid for the space_id. Otherwise, | ||
1196 | * should return AE_AML_ILLEGAL_ADDRESS. | ||
1197 | * | ||
1198 | * DESCRIPTION: Validate a system address via the host OS. Used to validate | ||
1199 | * the addresses accessed by AML operation regions. | ||
1200 | * | ||
1201 | *****************************************************************************/ | ||
1202 | |||
1203 | acpi_status | ||
1204 | acpi_os_validate_address ( | ||
1205 | u8 space_id, | ||
1206 | acpi_physical_address address, | ||
1207 | acpi_size length) | ||
1208 | { | ||
1209 | |||
1210 | return AE_OK; | ||
1211 | } | ||
1212 | |||
1213 | |||
1149 | #endif | 1214 | #endif |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index de573be52718..bf88e076c3e9 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -79,7 +79,7 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) | |||
79 | acpi_native_uint byte_count; | 79 | acpi_native_uint byte_count; |
80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ | 80 | u8 byte_zero_mask = 0x3F; /* Default [0:5] */ |
81 | 81 | ||
82 | ACPI_FUNCTION_TRACE("ps_get_next_package_length"); | 82 | ACPI_FUNCTION_TRACE(ps_get_next_package_length); |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * Byte 0 bits [6:7] contain the number of additional bytes | 85 | * Byte 0 bits [6:7] contain the number of additional bytes |
@@ -128,7 +128,7 @@ u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) | |||
128 | u8 *start = parser_state->aml; | 128 | u8 *start = parser_state->aml; |
129 | u32 package_length; | 129 | u32 package_length; |
130 | 130 | ||
131 | ACPI_FUNCTION_TRACE("ps_get_next_package_end"); | 131 | ACPI_FUNCTION_TRACE(ps_get_next_package_end); |
132 | 132 | ||
133 | /* Function below updates parser_state->Aml */ | 133 | /* Function below updates parser_state->Aml */ |
134 | 134 | ||
@@ -157,7 +157,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state) | |||
157 | u8 *start = parser_state->aml; | 157 | u8 *start = parser_state->aml; |
158 | u8 *end = parser_state->aml; | 158 | u8 *end = parser_state->aml; |
159 | 159 | ||
160 | ACPI_FUNCTION_TRACE("ps_get_next_namestring"); | 160 | ACPI_FUNCTION_TRACE(ps_get_next_namestring); |
161 | 161 | ||
162 | /* Point past any namestring prefix characters (backslash or carat) */ | 162 | /* Point past any namestring prefix characters (backslash or carat) */ |
163 | 163 | ||
@@ -237,7 +237,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
237 | struct acpi_namespace_node *node; | 237 | struct acpi_namespace_node *node; |
238 | union acpi_generic_state scope_info; | 238 | union acpi_generic_state scope_info; |
239 | 239 | ||
240 | ACPI_FUNCTION_TRACE("ps_get_next_namepath"); | 240 | ACPI_FUNCTION_TRACE(ps_get_next_namepath); |
241 | 241 | ||
242 | path = acpi_ps_get_next_namestring(parser_state); | 242 | path = acpi_ps_get_next_namestring(parser_state); |
243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); | 243 | acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); |
@@ -275,6 +275,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
275 | */ | 275 | */ |
276 | if (ACPI_SUCCESS(status) && | 276 | if (ACPI_SUCCESS(status) && |
277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { | 277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { |
278 | |||
278 | /* This name is actually a control method invocation */ | 279 | /* This name is actually a control method invocation */ |
279 | 280 | ||
280 | method_desc = acpi_ns_get_attached_object(node); | 281 | method_desc = acpi_ns_get_attached_object(node); |
@@ -319,6 +320,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
319 | * some not_found cases are allowed | 320 | * some not_found cases are allowed |
320 | */ | 321 | */ |
321 | if (status == AE_NOT_FOUND) { | 322 | if (status == AE_NOT_FOUND) { |
323 | |||
322 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ | 324 | /* 1) not_found is ok during load pass 1/2 (allow forward references) */ |
323 | 325 | ||
324 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != | 326 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) != |
@@ -354,6 +356,7 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
354 | 356 | ||
355 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 357 | if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
356 | ACPI_PARSE_EXECUTE) { | 358 | ACPI_PARSE_EXECUTE) { |
359 | |||
357 | /* Report a control method execution error */ | 360 | /* Report a control method execution error */ |
358 | 361 | ||
359 | status = acpi_ds_method_error(status, walk_state); | 362 | status = acpi_ds_method_error(status, walk_state); |
@@ -388,7 +391,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
388 | u16 opcode; | 391 | u16 opcode; |
389 | u8 *aml = parser_state->aml; | 392 | u8 *aml = parser_state->aml; |
390 | 393 | ||
391 | ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); | 394 | ACPI_FUNCTION_TRACE_U32(ps_get_next_simple_arg, arg_type); |
392 | 395 | ||
393 | switch (arg_type) { | 396 | switch (arg_type) { |
394 | case ARGP_BYTEDATA: | 397 | case ARGP_BYTEDATA: |
@@ -453,7 +456,7 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, | |||
453 | 456 | ||
454 | default: | 457 | default: |
455 | 458 | ||
456 | ACPI_ERROR((AE_INFO, "Invalid arg_type %X", arg_type)); | 459 | ACPI_ERROR((AE_INFO, "Invalid ArgType %X", arg_type)); |
457 | return_VOID; | 460 | return_VOID; |
458 | } | 461 | } |
459 | 462 | ||
@@ -484,7 +487,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state | |||
484 | u16 opcode; | 487 | u16 opcode; |
485 | u32 name; | 488 | u32 name; |
486 | 489 | ||
487 | ACPI_FUNCTION_TRACE("ps_get_next_field"); | 490 | ACPI_FUNCTION_TRACE(ps_get_next_field); |
488 | 491 | ||
489 | /* Determine field type */ | 492 | /* Determine field type */ |
490 | 493 | ||
@@ -590,7 +593,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
590 | u32 subop; | 593 | u32 subop; |
591 | acpi_status status = AE_OK; | 594 | acpi_status status = AE_OK; |
592 | 595 | ||
593 | ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state); | 596 | ACPI_FUNCTION_TRACE_PTR(ps_get_next_arg, parser_state); |
594 | 597 | ||
595 | switch (arg_type) { | 598 | switch (arg_type) { |
596 | case ARGP_BYTEDATA: | 599 | case ARGP_BYTEDATA: |
@@ -620,6 +623,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
620 | case ARGP_FIELDLIST: | 623 | case ARGP_FIELDLIST: |
621 | 624 | ||
622 | if (parser_state->aml < parser_state->pkg_end) { | 625 | if (parser_state->aml < parser_state->pkg_end) { |
626 | |||
623 | /* Non-empty list */ | 627 | /* Non-empty list */ |
624 | 628 | ||
625 | while (parser_state->aml < parser_state->pkg_end) { | 629 | while (parser_state->aml < parser_state->pkg_end) { |
@@ -645,6 +649,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
645 | case ARGP_BYTELIST: | 649 | case ARGP_BYTELIST: |
646 | 650 | ||
647 | if (parser_state->aml < parser_state->pkg_end) { | 651 | if (parser_state->aml < parser_state->pkg_end) { |
652 | |||
648 | /* Non-empty list */ | 653 | /* Non-empty list */ |
649 | 654 | ||
650 | arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); | 655 | arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP); |
@@ -673,6 +678,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
673 | if (subop == 0 || | 678 | if (subop == 0 || |
674 | acpi_ps_is_leading_char(subop) || | 679 | acpi_ps_is_leading_char(subop) || |
675 | acpi_ps_is_prefix_char(subop)) { | 680 | acpi_ps_is_prefix_char(subop)) { |
681 | |||
676 | /* null_name or name_string */ | 682 | /* null_name or name_string */ |
677 | 683 | ||
678 | arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); | 684 | arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP); |
@@ -703,6 +709,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
703 | case ARGP_OBJLIST: | 709 | case ARGP_OBJLIST: |
704 | 710 | ||
705 | if (parser_state->aml < parser_state->pkg_end) { | 711 | if (parser_state->aml < parser_state->pkg_end) { |
712 | |||
706 | /* Non-empty list of variable arguments, nothing returned */ | 713 | /* Non-empty list of variable arguments, nothing returned */ |
707 | 714 | ||
708 | walk_state->arg_count = ACPI_VAR_ARGS; | 715 | walk_state->arg_count = ACPI_VAR_ARGS; |
@@ -711,7 +718,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
711 | 718 | ||
712 | default: | 719 | default: |
713 | 720 | ||
714 | ACPI_ERROR((AE_INFO, "Invalid arg_type: %X", arg_type)); | 721 | ACPI_ERROR((AE_INFO, "Invalid ArgType: %X", arg_type)); |
715 | status = AE_AML_OPERAND_TYPE; | 722 | status = AE_AML_OPERAND_TYPE; |
716 | break; | 723 | break; |
717 | } | 724 | } |
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 00b072e15d19..e1541db3753a 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -83,7 +83,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
83 | struct acpi_parse_state *parser_state; | 83 | struct acpi_parse_state *parser_state; |
84 | u8 *aml_op_start = NULL; | 84 | u8 *aml_op_start = NULL; |
85 | 85 | ||
86 | ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state); | 86 | ACPI_FUNCTION_TRACE_PTR(ps_parse_loop, walk_state); |
87 | 87 | ||
88 | if (walk_state->descending_callback == NULL) { | 88 | if (walk_state->descending_callback == NULL) { |
89 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 89 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -95,6 +95,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
95 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) | 95 | #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) |
96 | 96 | ||
97 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { | 97 | if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { |
98 | |||
98 | /* We are restarting a preempted control method */ | 99 | /* We are restarting a preempted control method */ |
99 | 100 | ||
100 | if (acpi_ps_has_completed_scope(parser_state)) { | 101 | if (acpi_ps_has_completed_scope(parser_state)) { |
@@ -128,7 +129,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
128 | 129 | ||
129 | } | 130 | } |
130 | ACPI_EXCEPTION((AE_INFO, status, | 131 | ACPI_EXCEPTION((AE_INFO, status, |
131 | "get_predicate Failed")); | 132 | "GetPredicate Failed")); |
132 | return_ACPI_STATUS(status); | 133 | return_ACPI_STATUS(status); |
133 | } | 134 | } |
134 | 135 | ||
@@ -143,6 +144,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
143 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 144 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
144 | "Popped scope, Op=%p\n", op)); | 145 | "Popped scope, Op=%p\n", op)); |
145 | } else if (walk_state->prev_op) { | 146 | } else if (walk_state->prev_op) { |
147 | |||
146 | /* We were in the middle of an op */ | 148 | /* We were in the middle of an op */ |
147 | 149 | ||
148 | op = walk_state->prev_op; | 150 | op = walk_state->prev_op; |
@@ -156,6 +158,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
156 | while ((parser_state->aml < parser_state->aml_end) || (op)) { | 158 | while ((parser_state->aml < parser_state->aml_end) || (op)) { |
157 | aml_op_start = parser_state->aml; | 159 | aml_op_start = parser_state->aml; |
158 | if (!op) { | 160 | if (!op) { |
161 | |||
159 | /* Get the next opcode from the AML stream */ | 162 | /* Get the next opcode from the AML stream */ |
160 | 163 | ||
161 | walk_state->aml_offset = | 164 | walk_state->aml_offset = |
@@ -213,6 +216,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
213 | /* Create Op structure and append to parent's argument list */ | 216 | /* Create Op structure and append to parent's argument list */ |
214 | 217 | ||
215 | if (walk_state->op_info->flags & AML_NAMED) { | 218 | if (walk_state->op_info->flags & AML_NAMED) { |
219 | |||
216 | /* Allocate a new pre_op if necessary */ | 220 | /* Allocate a new pre_op if necessary */ |
217 | 221 | ||
218 | if (!pre_op) { | 222 | if (!pre_op) { |
@@ -371,7 +375,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
371 | 375 | ||
372 | if (walk_state->op_info) { | 376 | if (walk_state->op_info) { |
373 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
374 | "Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n", | 378 | "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", |
375 | (u32) op->common.aml_opcode, | 379 | (u32) op->common.aml_opcode, |
376 | walk_state->op_info->name, op, | 380 | walk_state->op_info->name, op, |
377 | parser_state->aml, | 381 | parser_state->aml, |
@@ -388,6 +392,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
388 | /* Are there any arguments that must be processed? */ | 392 | /* Are there any arguments that must be processed? */ |
389 | 393 | ||
390 | if (walk_state->arg_types) { | 394 | if (walk_state->arg_types) { |
395 | |||
391 | /* Get arguments */ | 396 | /* Get arguments */ |
392 | 397 | ||
393 | switch (op->common.aml_opcode) { | 398 | switch (op->common.aml_opcode) { |
@@ -742,7 +747,19 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
742 | if (ACPI_FAILURE(status2)) { | 747 | if (ACPI_FAILURE(status2)) { |
743 | return_ACPI_STATUS(status2); | 748 | return_ACPI_STATUS(status2); |
744 | } | 749 | } |
750 | |||
751 | status2 = | ||
752 | acpi_ds_result_stack_pop | ||
753 | (walk_state); | ||
754 | if (ACPI_FAILURE(status2)) { | ||
755 | return_ACPI_STATUS(status2); | ||
756 | } | ||
757 | |||
758 | acpi_ut_delete_generic_state | ||
759 | (acpi_ut_pop_generic_state | ||
760 | (&walk_state->control_state)); | ||
745 | } | 761 | } |
762 | |||
746 | acpi_ps_pop_scope(parser_state, &op, | 763 | acpi_ps_pop_scope(parser_state, &op, |
747 | &walk_state->arg_types, | 764 | &walk_state->arg_types, |
748 | &walk_state->arg_count); | 765 | &walk_state->arg_count); |
@@ -762,6 +779,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
762 | return_ACPI_STATUS(status2); | 779 | return_ACPI_STATUS(status2); |
763 | } | 780 | } |
764 | } | 781 | } |
782 | |||
765 | acpi_ps_pop_scope(parser_state, &op, | 783 | acpi_ps_pop_scope(parser_state, &op, |
766 | &walk_state->arg_types, | 784 | &walk_state->arg_types, |
767 | &walk_state->arg_count); | 785 | &walk_state->arg_count); |
@@ -853,6 +871,7 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
853 | } | 871 | } |
854 | 872 | ||
855 | else if (ACPI_FAILURE(status)) { | 873 | else if (ACPI_FAILURE(status)) { |
874 | |||
856 | /* First error is most important */ | 875 | /* First error is most important */ |
857 | 876 | ||
858 | (void) | 877 | (void) |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 11d6351ab8b2..4bd25e32769f 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c | |||
@@ -725,12 +725,13 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = { | |||
725 | 725 | ||
726 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | 726 | const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) |
727 | { | 727 | { |
728 | ACPI_FUNCTION_NAME("ps_get_opcode_info"); | 728 | ACPI_FUNCTION_NAME(ps_get_opcode_info); |
729 | 729 | ||
730 | /* | 730 | /* |
731 | * Detect normal 8-bit opcode or extended 16-bit opcode | 731 | * Detect normal 8-bit opcode or extended 16-bit opcode |
732 | */ | 732 | */ |
733 | if (!(opcode & 0xFF00)) { | 733 | if (!(opcode & 0xFF00)) { |
734 | |||
734 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ | 735 | /* Simple (8-bit) opcode: 0-255, can't index beyond table */ |
735 | 736 | ||
736 | return (&acpi_gbl_aml_op_info | 737 | return (&acpi_gbl_aml_op_info |
@@ -739,6 +740,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode) | |||
739 | 740 | ||
740 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && | 741 | if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) && |
741 | (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { | 742 | (((u8) opcode) <= MAX_EXTENDED_OPCODE)) { |
743 | |||
742 | /* Valid extended (16-bit) opcode */ | 744 | /* Valid extended (16-bit) opcode */ |
743 | 745 | ||
744 | return (&acpi_gbl_aml_op_info | 746 | return (&acpi_gbl_aml_op_info |
@@ -779,7 +781,7 @@ char *acpi_ps_get_opcode_name(u16 opcode) | |||
779 | return (op->name); | 781 | return (op->name); |
780 | 782 | ||
781 | #else | 783 | #else |
782 | return ("AE_NOT_CONFIGURED"); | 784 | return ("OpcodeName unavailable"); |
783 | 785 | ||
784 | #endif | 786 | #endif |
785 | } | 787 | } |
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index a9f3229f4106..7ee2f2e77525 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -106,6 +106,7 @@ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state) | |||
106 | opcode = (u16) ACPI_GET8(aml); | 106 | opcode = (u16) ACPI_GET8(aml); |
107 | 107 | ||
108 | if (opcode == AML_EXTENDED_OP_PREFIX) { | 108 | if (opcode == AML_EXTENDED_OP_PREFIX) { |
109 | |||
109 | /* Extended opcode, get the second opcode byte */ | 110 | /* Extended opcode, get the second opcode byte */ |
110 | 111 | ||
111 | aml++; | 112 | aml++; |
@@ -137,7 +138,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
137 | const struct acpi_opcode_info *parent_info; | 138 | const struct acpi_opcode_info *parent_info; |
138 | union acpi_parse_object *replacement_op = NULL; | 139 | union acpi_parse_object *replacement_op = NULL; |
139 | 140 | ||
140 | ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op); | 141 | ACPI_FUNCTION_TRACE_PTR(ps_complete_this_op, op); |
141 | 142 | ||
142 | /* Check for null Op, can happen if AML code is corrupt */ | 143 | /* Check for null Op, can happen if AML code is corrupt */ |
143 | 144 | ||
@@ -158,6 +159,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
158 | if (op->common.parent) { | 159 | if (op->common.parent) { |
159 | prev = op->common.parent->common.value.arg; | 160 | prev = op->common.parent->common.value.arg; |
160 | if (!prev) { | 161 | if (!prev) { |
162 | |||
161 | /* Nothing more to do */ | 163 | /* Nothing more to do */ |
162 | 164 | ||
163 | goto cleanup; | 165 | goto cleanup; |
@@ -245,6 +247,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
245 | /* We must unlink this op from the parent tree */ | 247 | /* We must unlink this op from the parent tree */ |
246 | 248 | ||
247 | if (prev == op) { | 249 | if (prev == op) { |
250 | |||
248 | /* This op is the first in the list */ | 251 | /* This op is the first in the list */ |
249 | 252 | ||
250 | if (replacement_op) { | 253 | if (replacement_op) { |
@@ -265,6 +268,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
265 | 268 | ||
266 | else | 269 | else |
267 | while (prev) { | 270 | while (prev) { |
271 | |||
268 | /* Traverse all siblings in the parent's argument list */ | 272 | /* Traverse all siblings in the parent's argument list */ |
269 | 273 | ||
270 | next = prev->common.next; | 274 | next = prev->common.next; |
@@ -329,7 +333,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
329 | struct acpi_parse_state *parser_state = &walk_state->parser_state; | 333 | struct acpi_parse_state *parser_state = &walk_state->parser_state; |
330 | acpi_status status = AE_CTRL_PENDING; | 334 | acpi_status status = AE_CTRL_PENDING; |
331 | 335 | ||
332 | ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op); | 336 | ACPI_FUNCTION_TRACE_PTR(ps_next_parse_state, op); |
333 | 337 | ||
334 | switch (callback_status) { | 338 | switch (callback_status) { |
335 | case AE_CTRL_TERMINATE: | 339 | case AE_CTRL_TERMINATE: |
@@ -449,10 +453,10 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
449 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; | 453 | struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list; |
450 | struct acpi_walk_state *previous_walk_state; | 454 | struct acpi_walk_state *previous_walk_state; |
451 | 455 | ||
452 | ACPI_FUNCTION_TRACE("ps_parse_aml"); | 456 | ACPI_FUNCTION_TRACE(ps_parse_aml); |
453 | 457 | ||
454 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 458 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
455 | "Entered with walk_state=%p Aml=%p size=%X\n", | 459 | "Entered with WalkState=%p Aml=%p size=%X\n", |
456 | walk_state, walk_state->parser_state.aml, | 460 | walk_state, walk_state->parser_state.aml, |
457 | walk_state->parser_state.aml_size)); | 461 | walk_state->parser_state.aml_size)); |
458 | 462 | ||
@@ -460,6 +464,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
460 | 464 | ||
461 | thread = acpi_ut_create_thread_state(); | 465 | thread = acpi_ut_create_thread_state(); |
462 | if (!thread) { | 466 | if (!thread) { |
467 | acpi_ds_delete_walk_state(walk_state); | ||
463 | return_ACPI_STATUS(AE_NO_MEMORY); | 468 | return_ACPI_STATUS(AE_NO_MEMORY); |
464 | } | 469 | } |
465 | 470 | ||
@@ -510,6 +515,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
510 | } else if (status == AE_CTRL_TERMINATE) { | 515 | } else if (status == AE_CTRL_TERMINATE) { |
511 | status = AE_OK; | 516 | status = AE_OK; |
512 | } else if ((status != AE_OK) && (walk_state->method_desc)) { | 517 | } else if ((status != AE_OK) && (walk_state->method_desc)) { |
518 | |||
513 | /* Either the method parse or actual execution failed */ | 519 | /* Either the method parse or actual execution failed */ |
514 | 520 | ||
515 | ACPI_ERROR_METHOD("Method parse/execution failed", | 521 | ACPI_ERROR_METHOD("Method parse/execution failed", |
@@ -550,20 +556,9 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
550 | */ | 556 | */ |
551 | if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == | 557 | if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == |
552 | ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { | 558 | ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) { |
553 | if (walk_state->method_desc) { | 559 | acpi_ds_terminate_control_method(walk_state-> |
554 | /* Decrement the thread count on the method parse tree */ | 560 | method_desc, |
555 | 561 | walk_state); | |
556 | if (walk_state->method_desc->method. | ||
557 | thread_count) { | ||
558 | walk_state->method_desc->method. | ||
559 | thread_count--; | ||
560 | } else { | ||
561 | ACPI_ERROR((AE_INFO, | ||
562 | "Invalid zero thread count in method")); | ||
563 | } | ||
564 | } | ||
565 | |||
566 | acpi_ds_terminate_control_method(walk_state); | ||
567 | } | 562 | } |
568 | 563 | ||
569 | /* Delete this walk state and all linked control states */ | 564 | /* Delete this walk state and all linked control states */ |
@@ -572,7 +567,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
572 | previous_walk_state = walk_state; | 567 | previous_walk_state = walk_state; |
573 | 568 | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 569 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
575 | "return_value=%p, implicit_value=%p State=%p\n", | 570 | "ReturnValue=%p, ImplicitValue=%p State=%p\n", |
576 | walk_state->return_desc, | 571 | walk_state->return_desc, |
577 | walk_state->implicit_return_obj, walk_state)); | 572 | walk_state->implicit_return_obj, walk_state)); |
578 | 573 | ||
@@ -633,12 +628,14 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
633 | } | 628 | } |
634 | } else { | 629 | } else { |
635 | if (previous_walk_state->return_desc) { | 630 | if (previous_walk_state->return_desc) { |
631 | |||
636 | /* Caller doesn't want it, must delete it */ | 632 | /* Caller doesn't want it, must delete it */ |
637 | 633 | ||
638 | acpi_ut_remove_reference(previous_walk_state-> | 634 | acpi_ut_remove_reference(previous_walk_state-> |
639 | return_desc); | 635 | return_desc); |
640 | } | 636 | } |
641 | if (previous_walk_state->implicit_return_obj) { | 637 | if (previous_walk_state->implicit_return_obj) { |
638 | |||
642 | /* Caller doesn't want it, must delete it */ | 639 | /* Caller doesn't want it, must delete it */ |
643 | 640 | ||
644 | acpi_ut_remove_reference(previous_walk_state-> | 641 | acpi_ut_remove_reference(previous_walk_state-> |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index bc6047caccd9..a3e0314de24d 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -106,14 +106,14 @@ acpi_ps_init_scope(struct acpi_parse_state * parser_state, | |||
106 | { | 106 | { |
107 | union acpi_generic_state *scope; | 107 | union acpi_generic_state *scope; |
108 | 108 | ||
109 | ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op); | 109 | ACPI_FUNCTION_TRACE_PTR(ps_init_scope, root_op); |
110 | 110 | ||
111 | scope = acpi_ut_create_generic_state(); | 111 | scope = acpi_ut_create_generic_state(); |
112 | if (!scope) { | 112 | if (!scope) { |
113 | return_ACPI_STATUS(AE_NO_MEMORY); | 113 | return_ACPI_STATUS(AE_NO_MEMORY); |
114 | } | 114 | } |
115 | 115 | ||
116 | scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE; | 116 | scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_RPSCOPE; |
117 | scope->parse_scope.op = root_op; | 117 | scope->parse_scope.op = root_op; |
118 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; | 118 | scope->parse_scope.arg_count = ACPI_VAR_ARGS; |
119 | scope->parse_scope.arg_end = parser_state->aml_end; | 119 | scope->parse_scope.arg_end = parser_state->aml_end; |
@@ -147,14 +147,14 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
147 | { | 147 | { |
148 | union acpi_generic_state *scope; | 148 | union acpi_generic_state *scope; |
149 | 149 | ||
150 | ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op); | 150 | ACPI_FUNCTION_TRACE_PTR(ps_push_scope, op); |
151 | 151 | ||
152 | scope = acpi_ut_create_generic_state(); | 152 | scope = acpi_ut_create_generic_state(); |
153 | if (!scope) { | 153 | if (!scope) { |
154 | return_ACPI_STATUS(AE_NO_MEMORY); | 154 | return_ACPI_STATUS(AE_NO_MEMORY); |
155 | } | 155 | } |
156 | 156 | ||
157 | scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE; | 157 | scope->common.descriptor_type = ACPI_DESC_TYPE_STATE_PSCOPE; |
158 | scope->parse_scope.op = op; | 158 | scope->parse_scope.op = op; |
159 | scope->parse_scope.arg_list = remaining_args; | 159 | scope->parse_scope.arg_list = remaining_args; |
160 | scope->parse_scope.arg_count = arg_count; | 160 | scope->parse_scope.arg_count = arg_count; |
@@ -165,6 +165,7 @@ acpi_ps_push_scope(struct acpi_parse_state *parser_state, | |||
165 | acpi_ut_push_generic_state(&parser_state->scope, scope); | 165 | acpi_ut_push_generic_state(&parser_state->scope, scope); |
166 | 166 | ||
167 | if (arg_count == ACPI_VAR_ARGS) { | 167 | if (arg_count == ACPI_VAR_ARGS) { |
168 | |||
168 | /* Multiple arguments */ | 169 | /* Multiple arguments */ |
169 | 170 | ||
170 | scope->parse_scope.arg_end = parser_state->pkg_end; | 171 | scope->parse_scope.arg_end = parser_state->pkg_end; |
@@ -199,14 +200,14 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
199 | { | 200 | { |
200 | union acpi_generic_state *scope = parser_state->scope; | 201 | union acpi_generic_state *scope = parser_state->scope; |
201 | 202 | ||
202 | ACPI_FUNCTION_TRACE("ps_pop_scope"); | 203 | ACPI_FUNCTION_TRACE(ps_pop_scope); |
203 | 204 | ||
204 | /* Only pop the scope if there is in fact a next scope */ | 205 | /* Only pop the scope if there is in fact a next scope */ |
205 | 206 | ||
206 | if (scope->common.next) { | 207 | if (scope->common.next) { |
207 | scope = acpi_ut_pop_generic_state(&parser_state->scope); | 208 | scope = acpi_ut_pop_generic_state(&parser_state->scope); |
208 | 209 | ||
209 | /* return to parsing previous op */ | 210 | /* Return to parsing previous op */ |
210 | 211 | ||
211 | *op = scope->parse_scope.op; | 212 | *op = scope->parse_scope.op; |
212 | *arg_list = scope->parse_scope.arg_list; | 213 | *arg_list = scope->parse_scope.arg_list; |
@@ -217,7 +218,7 @@ acpi_ps_pop_scope(struct acpi_parse_state *parser_state, | |||
217 | 218 | ||
218 | acpi_ut_delete_generic_state(scope); | 219 | acpi_ut_delete_generic_state(scope); |
219 | } else { | 220 | } else { |
220 | /* empty parse stack, prepare to fetch next opcode */ | 221 | /* Empty parse stack, prepare to fetch next opcode */ |
221 | 222 | ||
222 | *op = NULL; | 223 | *op = NULL; |
223 | *arg_list = 0; | 224 | *arg_list = 0; |
@@ -246,7 +247,7 @@ void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state) | |||
246 | { | 247 | { |
247 | union acpi_generic_state *scope; | 248 | union acpi_generic_state *scope; |
248 | 249 | ||
249 | ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state); | 250 | ACPI_FUNCTION_TRACE_PTR(ps_cleanup_scope, parser_state); |
250 | 251 | ||
251 | if (!parser_state) { | 252 | if (!parser_state) { |
252 | return_VOID; | 253 | return_VOID; |
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index dd6f16726fc4..0015717ef096 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c | |||
@@ -77,6 +77,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) | |||
77 | 77 | ||
78 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); | 78 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); |
79 | if (op_info->class == AML_CLASS_UNKNOWN) { | 79 | if (op_info->class == AML_CLASS_UNKNOWN) { |
80 | |||
80 | /* Invalid opcode or ASCII character */ | 81 | /* Invalid opcode or ASCII character */ |
81 | 82 | ||
82 | return (NULL); | 83 | return (NULL); |
@@ -85,6 +86,7 @@ union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn) | |||
85 | /* Check if this opcode requires argument sub-objects */ | 86 | /* Check if this opcode requires argument sub-objects */ |
86 | 87 | ||
87 | if (!(op_info->flags & AML_HAS_ARGS)) { | 88 | if (!(op_info->flags & AML_HAS_ARGS)) { |
89 | |||
88 | /* Has no linked argument objects */ | 90 | /* Has no linked argument objects */ |
89 | 91 | ||
90 | return (NULL); | 92 | return (NULL); |
@@ -130,6 +132,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
130 | 132 | ||
131 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); | 133 | op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); |
132 | if (op_info->class == AML_CLASS_UNKNOWN) { | 134 | if (op_info->class == AML_CLASS_UNKNOWN) { |
135 | |||
133 | /* Invalid opcode */ | 136 | /* Invalid opcode */ |
134 | 137 | ||
135 | ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", | 138 | ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X", |
@@ -140,6 +143,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
140 | /* Check if this opcode requires argument sub-objects */ | 143 | /* Check if this opcode requires argument sub-objects */ |
141 | 144 | ||
142 | if (!(op_info->flags & AML_HAS_ARGS)) { | 145 | if (!(op_info->flags & AML_HAS_ARGS)) { |
146 | |||
143 | /* Has no linked argument objects */ | 147 | /* Has no linked argument objects */ |
144 | 148 | ||
145 | return; | 149 | return; |
@@ -148,6 +152,7 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
148 | /* Append the argument to the linked argument list */ | 152 | /* Append the argument to the linked argument list */ |
149 | 153 | ||
150 | if (op->common.value.arg) { | 154 | if (op->common.value.arg) { |
155 | |||
151 | /* Append to existing argument list */ | 156 | /* Append to existing argument list */ |
152 | 157 | ||
153 | prev_arg = op->common.value.arg; | 158 | prev_arg = op->common.value.arg; |
@@ -222,12 +227,14 @@ union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin, | |||
222 | } | 227 | } |
223 | 228 | ||
224 | if (arg == origin) { | 229 | if (arg == origin) { |
230 | |||
225 | /* Reached parent of origin, end search */ | 231 | /* Reached parent of origin, end search */ |
226 | 232 | ||
227 | return (NULL); | 233 | return (NULL); |
228 | } | 234 | } |
229 | 235 | ||
230 | if (parent->common.next) { | 236 | if (parent->common.next) { |
237 | |||
231 | /* Found sibling of parent */ | 238 | /* Found sibling of parent */ |
232 | 239 | ||
233 | return (parent->common.next); | 240 | return (parent->common.next); |
@@ -299,5 +306,4 @@ union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op) | |||
299 | return (child); | 306 | return (child); |
300 | } | 307 | } |
301 | #endif | 308 | #endif |
302 | |||
303 | #endif /* ACPI_FUTURE_USAGE */ | 309 | #endif /* ACPI_FUTURE_USAGE */ |
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 3e07cb9cb748..182474ae8ce9 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -89,7 +89,7 @@ void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode) | |||
89 | { | 89 | { |
90 | ACPI_FUNCTION_ENTRY(); | 90 | ACPI_FUNCTION_ENTRY(); |
91 | 91 | ||
92 | op->common.data_type = ACPI_DESC_TYPE_PARSER; | 92 | op->common.descriptor_type = ACPI_DESC_TYPE_PARSER; |
93 | op->common.aml_opcode = opcode; | 93 | op->common.aml_opcode = opcode; |
94 | 94 | ||
95 | ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, | 95 | ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name, |
@@ -135,6 +135,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) | |||
135 | /* Allocate the minimum required size object */ | 135 | /* Allocate the minimum required size object */ |
136 | 136 | ||
137 | if (flags == ACPI_PARSEOP_GENERIC) { | 137 | if (flags == ACPI_PARSEOP_GENERIC) { |
138 | |||
138 | /* The generic op (default) is by far the most common (16 to 1) */ | 139 | /* The generic op (default) is by far the most common (16 to 1) */ |
139 | 140 | ||
140 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); | 141 | op = acpi_os_acquire_object(acpi_gbl_ps_node_cache); |
@@ -171,7 +172,7 @@ union acpi_parse_object *acpi_ps_alloc_op(u16 opcode) | |||
171 | 172 | ||
172 | void acpi_ps_free_op(union acpi_parse_object *op) | 173 | void acpi_ps_free_op(union acpi_parse_object *op) |
173 | { | 174 | { |
174 | ACPI_FUNCTION_NAME("ps_free_op"); | 175 | ACPI_FUNCTION_NAME(ps_free_op); |
175 | 176 | ||
176 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { | 177 | if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { |
177 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", | 178 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", |
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 06f05bfd7612..a84a547a0f1b 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c | |||
@@ -64,18 +64,21 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) | |||
64 | union acpi_parse_object *next = NULL; | 64 | union acpi_parse_object *next = NULL; |
65 | union acpi_parse_object *parent = NULL; | 65 | union acpi_parse_object *parent = NULL; |
66 | 66 | ||
67 | ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root); | 67 | ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root); |
68 | 68 | ||
69 | /* Visit all nodes in the subtree */ | 69 | /* Visit all nodes in the subtree */ |
70 | 70 | ||
71 | while (op) { | 71 | while (op) { |
72 | |||
72 | /* Check if we are not ascending */ | 73 | /* Check if we are not ascending */ |
73 | 74 | ||
74 | if (op != parent) { | 75 | if (op != parent) { |
76 | |||
75 | /* Look for an argument or child of the current op */ | 77 | /* Look for an argument or child of the current op */ |
76 | 78 | ||
77 | next = acpi_ps_get_arg(op, 0); | 79 | next = acpi_ps_get_arg(op, 0); |
78 | if (next) { | 80 | if (next) { |
81 | |||
79 | /* Still going downward in tree (Op is not completed yet) */ | 82 | /* Still going downward in tree (Op is not completed yet) */ |
80 | 83 | ||
81 | op = next; | 84 | op = next; |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 2dd48cbb7c02..5d996c1140af 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -50,14 +50,14 @@ | |||
50 | ACPI_MODULE_NAME("psxface") | 50 | ACPI_MODULE_NAME("psxface") |
51 | 51 | ||
52 | /* Local Prototypes */ | 52 | /* Local Prototypes */ |
53 | static void acpi_ps_start_trace(struct acpi_parameter_info *info); | 53 | static void acpi_ps_start_trace(struct acpi_evaluate_info *info); |
54 | 54 | ||
55 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info); | 55 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info); |
56 | 56 | ||
57 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); | 57 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info); |
58 | 58 | ||
59 | static void | 59 | static void |
60 | acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); | 60 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action); |
61 | 61 | ||
62 | /******************************************************************************* | 62 | /******************************************************************************* |
63 | * | 63 | * |
@@ -113,7 +113,7 @@ acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags) | |||
113 | * | 113 | * |
114 | ******************************************************************************/ | 114 | ******************************************************************************/ |
115 | 115 | ||
116 | static void acpi_ps_start_trace(struct acpi_parameter_info *info) | 116 | static void acpi_ps_start_trace(struct acpi_evaluate_info *info) |
117 | { | 117 | { |
118 | acpi_status status; | 118 | acpi_status status; |
119 | 119 | ||
@@ -125,7 +125,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info) | |||
125 | } | 125 | } |
126 | 126 | ||
127 | if ((!acpi_gbl_trace_method_name) || | 127 | if ((!acpi_gbl_trace_method_name) || |
128 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | 128 | (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { |
129 | goto exit; | 129 | goto exit; |
130 | } | 130 | } |
131 | 131 | ||
@@ -158,7 +158,7 @@ static void acpi_ps_start_trace(struct acpi_parameter_info *info) | |||
158 | * | 158 | * |
159 | ******************************************************************************/ | 159 | ******************************************************************************/ |
160 | 160 | ||
161 | static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | 161 | static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) |
162 | { | 162 | { |
163 | acpi_status status; | 163 | acpi_status status; |
164 | 164 | ||
@@ -170,7 +170,7 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | if ((!acpi_gbl_trace_method_name) || | 172 | if ((!acpi_gbl_trace_method_name) || |
173 | (acpi_gbl_trace_method_name != info->node->name.integer)) { | 173 | (acpi_gbl_trace_method_name != info->resolved_node->name.integer)) { |
174 | goto exit; | 174 | goto exit; |
175 | } | 175 | } |
176 | 176 | ||
@@ -212,22 +212,23 @@ static void acpi_ps_stop_trace(struct acpi_parameter_info *info) | |||
212 | * | 212 | * |
213 | ******************************************************************************/ | 213 | ******************************************************************************/ |
214 | 214 | ||
215 | acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | 215 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) |
216 | { | 216 | { |
217 | acpi_status status; | 217 | acpi_status status; |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE("ps_execute_method"); | 219 | ACPI_FUNCTION_TRACE(ps_execute_method); |
220 | 220 | ||
221 | /* Validate the Info and method Node */ | 221 | /* Validate the Info and method Node */ |
222 | 222 | ||
223 | if (!info || !info->node) { | 223 | if (!info || !info->resolved_node) { |
224 | return_ACPI_STATUS(AE_NULL_ENTRY); | 224 | return_ACPI_STATUS(AE_NULL_ENTRY); |
225 | } | 225 | } |
226 | 226 | ||
227 | /* Init for new method, wait on concurrency semaphore */ | 227 | /* Init for new method, wait on concurrency semaphore */ |
228 | 228 | ||
229 | status = | 229 | status = |
230 | acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL); | 230 | acpi_ds_begin_method_execution(info->resolved_node, info->obj_desc, |
231 | NULL); | ||
231 | if (ACPI_FAILURE(status)) { | 232 | if (ACPI_FAILURE(status)) { |
232 | return_ACPI_STATUS(status); | 233 | return_ACPI_STATUS(status); |
233 | } | 234 | } |
@@ -248,7 +249,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
248 | */ | 249 | */ |
249 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 250 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
250 | "**** Begin Method Parse **** Entry=%p obj=%p\n", | 251 | "**** Begin Method Parse **** Entry=%p obj=%p\n", |
251 | info->node, info->obj_desc)); | 252 | info->resolved_node, info->obj_desc)); |
252 | 253 | ||
253 | info->pass_number = 1; | 254 | info->pass_number = 1; |
254 | status = acpi_ps_execute_pass(info); | 255 | status = acpi_ps_execute_pass(info); |
@@ -261,7 +262,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
261 | */ | 262 | */ |
262 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 263 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, |
263 | "**** Begin Method Execution **** Entry=%p obj=%p\n", | 264 | "**** Begin Method Execution **** Entry=%p obj=%p\n", |
264 | info->node, info->obj_desc)); | 265 | info->resolved_node, info->obj_desc)); |
265 | 266 | ||
266 | info->pass_number = 3; | 267 | info->pass_number = 3; |
267 | status = acpi_ps_execute_pass(info); | 268 | status = acpi_ps_execute_pass(info); |
@@ -286,8 +287,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
286 | * a control exception code | 287 | * a control exception code |
287 | */ | 288 | */ |
288 | if (info->return_object) { | 289 | if (info->return_object) { |
289 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, | 290 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Method returned ObjDesc=%p\n", |
290 | "Method returned obj_desc=%p\n", | ||
291 | info->return_object)); | 291 | info->return_object)); |
292 | ACPI_DUMP_STACK_ENTRY(info->return_object); | 292 | ACPI_DUMP_STACK_ENTRY(info->return_object); |
293 | 293 | ||
@@ -301,7 +301,7 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
301 | * | 301 | * |
302 | * FUNCTION: acpi_ps_update_parameter_list | 302 | * FUNCTION: acpi_ps_update_parameter_list |
303 | * | 303 | * |
304 | * PARAMETERS: Info - See struct acpi_parameter_info | 304 | * PARAMETERS: Info - See struct acpi_evaluate_info |
305 | * (Used: parameter_type and Parameters) | 305 | * (Used: parameter_type and Parameters) |
306 | * Action - Add or Remove reference | 306 | * Action - Add or Remove reference |
307 | * | 307 | * |
@@ -312,14 +312,16 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info) | |||
312 | ******************************************************************************/ | 312 | ******************************************************************************/ |
313 | 313 | ||
314 | static void | 314 | static void |
315 | acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | 315 | acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action) |
316 | { | 316 | { |
317 | acpi_native_uint i; | 317 | acpi_native_uint i; |
318 | 318 | ||
319 | if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { | 319 | if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) { |
320 | |||
320 | /* Update reference count for each parameter */ | 321 | /* Update reference count for each parameter */ |
321 | 322 | ||
322 | for (i = 0; info->parameters[i]; i++) { | 323 | for (i = 0; info->parameters[i]; i++) { |
324 | |||
323 | /* Ignore errors, just do them all */ | 325 | /* Ignore errors, just do them all */ |
324 | 326 | ||
325 | (void)acpi_ut_update_object_reference(info-> | 327 | (void)acpi_ut_update_object_reference(info-> |
@@ -333,7 +335,7 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | |||
333 | * | 335 | * |
334 | * FUNCTION: acpi_ps_execute_pass | 336 | * FUNCTION: acpi_ps_execute_pass |
335 | * | 337 | * |
336 | * PARAMETERS: Info - See struct acpi_parameter_info | 338 | * PARAMETERS: Info - See struct acpi_evaluate_info |
337 | * (Used: pass_number, Node, and obj_desc) | 339 | * (Used: pass_number, Node, and obj_desc) |
338 | * | 340 | * |
339 | * RETURN: Status | 341 | * RETURN: Status |
@@ -342,13 +344,13 @@ acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action) | |||
342 | * | 344 | * |
343 | ******************************************************************************/ | 345 | ******************************************************************************/ |
344 | 346 | ||
345 | static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) | 347 | static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info) |
346 | { | 348 | { |
347 | acpi_status status; | 349 | acpi_status status; |
348 | union acpi_parse_object *op; | 350 | union acpi_parse_object *op; |
349 | struct acpi_walk_state *walk_state; | 351 | struct acpi_walk_state *walk_state; |
350 | 352 | ||
351 | ACPI_FUNCTION_TRACE("ps_execute_pass"); | 353 | ACPI_FUNCTION_TRACE(ps_execute_pass); |
352 | 354 | ||
353 | /* Create and init a Root Node */ | 355 | /* Create and init a Root Node */ |
354 | 356 | ||
@@ -367,7 +369,7 @@ static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info) | |||
367 | goto cleanup; | 369 | goto cleanup; |
368 | } | 370 | } |
369 | 371 | ||
370 | status = acpi_ds_init_aml_walk(walk_state, op, info->node, | 372 | status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node, |
371 | info->obj_desc->method.aml_start, | 373 | info->obj_desc->method.aml_start, |
372 | info->obj_desc->method.aml_length, | 374 | info->obj_desc->method.aml_length, |
373 | info->pass_number == 1 ? NULL : info, | 375 | info->pass_number == 1 ? NULL : info, |
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 8920e8c6e246..228bdb626502 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/spinlock.h> | 38 | #include <linux/spinlock.h> |
39 | #include <linux/pm.h> | 39 | #include <linux/pm.h> |
40 | #include <linux/pci.h> | 40 | #include <linux/pci.h> |
41 | #include <linux/mutex.h> | ||
41 | 42 | ||
42 | #include <acpi/acpi_bus.h> | 43 | #include <acpi/acpi_bus.h> |
43 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
@@ -91,7 +92,7 @@ static struct { | |||
91 | int count; | 92 | int count; |
92 | struct list_head entries; | 93 | struct list_head entries; |
93 | } acpi_link; | 94 | } acpi_link; |
94 | DECLARE_MUTEX(acpi_link_lock); | 95 | DEFINE_MUTEX(acpi_link_lock); |
95 | 96 | ||
96 | /* -------------------------------------------------------------------------- | 97 | /* -------------------------------------------------------------------------- |
97 | PCI Link Device Management | 98 | PCI Link Device Management |
@@ -641,19 +642,19 @@ acpi_pci_link_allocate_irq(acpi_handle handle, | |||
641 | return_VALUE(-1); | 642 | return_VALUE(-1); |
642 | } | 643 | } |
643 | 644 | ||
644 | down(&acpi_link_lock); | 645 | mutex_lock(&acpi_link_lock); |
645 | if (acpi_pci_link_allocate(link)) { | 646 | if (acpi_pci_link_allocate(link)) { |
646 | up(&acpi_link_lock); | 647 | mutex_unlock(&acpi_link_lock); |
647 | return_VALUE(-1); | 648 | return_VALUE(-1); |
648 | } | 649 | } |
649 | 650 | ||
650 | if (!link->irq.active) { | 651 | if (!link->irq.active) { |
651 | up(&acpi_link_lock); | 652 | mutex_unlock(&acpi_link_lock); |
652 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); | 653 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); |
653 | return_VALUE(-1); | 654 | return_VALUE(-1); |
654 | } | 655 | } |
655 | link->refcnt++; | 656 | link->refcnt++; |
656 | up(&acpi_link_lock); | 657 | mutex_unlock(&acpi_link_lock); |
657 | 658 | ||
658 | if (triggering) | 659 | if (triggering) |
659 | *triggering = link->irq.triggering; | 660 | *triggering = link->irq.triggering; |
@@ -691,9 +692,9 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
691 | return_VALUE(-1); | 692 | return_VALUE(-1); |
692 | } | 693 | } |
693 | 694 | ||
694 | down(&acpi_link_lock); | 695 | mutex_lock(&acpi_link_lock); |
695 | if (!link->irq.initialized) { | 696 | if (!link->irq.initialized) { |
696 | up(&acpi_link_lock); | 697 | mutex_unlock(&acpi_link_lock); |
697 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); | 698 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); |
698 | return_VALUE(-1); | 699 | return_VALUE(-1); |
699 | } | 700 | } |
@@ -716,7 +717,7 @@ int acpi_pci_link_free_irq(acpi_handle handle) | |||
716 | if (link->refcnt == 0) { | 717 | if (link->refcnt == 0) { |
717 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 718 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
718 | } | 719 | } |
719 | up(&acpi_link_lock); | 720 | mutex_unlock(&acpi_link_lock); |
720 | return_VALUE(link->irq.active); | 721 | return_VALUE(link->irq.active); |
721 | } | 722 | } |
722 | 723 | ||
@@ -747,7 +748,7 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
747 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); | 748 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); |
748 | acpi_driver_data(device) = link; | 749 | acpi_driver_data(device) = link; |
749 | 750 | ||
750 | down(&acpi_link_lock); | 751 | mutex_lock(&acpi_link_lock); |
751 | result = acpi_pci_link_get_possible(link); | 752 | result = acpi_pci_link_get_possible(link); |
752 | if (result) | 753 | if (result) |
753 | goto end; | 754 | goto end; |
@@ -782,7 +783,7 @@ static int acpi_pci_link_add(struct acpi_device *device) | |||
782 | end: | 783 | end: |
783 | /* disable all links -- to be activated on use */ | 784 | /* disable all links -- to be activated on use */ |
784 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 785 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
785 | up(&acpi_link_lock); | 786 | mutex_unlock(&acpi_link_lock); |
786 | 787 | ||
787 | if (result) | 788 | if (result) |
788 | kfree(link); | 789 | kfree(link); |
@@ -840,9 +841,9 @@ static int acpi_pci_link_remove(struct acpi_device *device, int type) | |||
840 | 841 | ||
841 | link = (struct acpi_pci_link *)acpi_driver_data(device); | 842 | link = (struct acpi_pci_link *)acpi_driver_data(device); |
842 | 843 | ||
843 | down(&acpi_link_lock); | 844 | mutex_lock(&acpi_link_lock); |
844 | list_del(&link->node); | 845 | list_del(&link->node); |
845 | up(&acpi_link_lock); | 846 | mutex_unlock(&acpi_link_lock); |
846 | 847 | ||
847 | kfree(link); | 848 | kfree(link); |
848 | 849 | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index ab00afec26f7..decaebb4cbe9 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -388,7 +388,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
388 | 388 | ||
389 | /* Use the acpiid in MADT to map cpus in case of SMP */ | 389 | /* Use the acpiid in MADT to map cpus in case of SMP */ |
390 | #ifndef CONFIG_SMP | 390 | #ifndef CONFIG_SMP |
391 | #define convert_acpiid_to_cpu(acpi_id) (0xff) | 391 | #define convert_acpiid_to_cpu(acpi_id) (-1) |
392 | #else | 392 | #else |
393 | 393 | ||
394 | #ifdef CONFIG_IA64 | 394 | #ifdef CONFIG_IA64 |
@@ -401,7 +401,7 @@ static int acpi_processor_remove_fs(struct acpi_device *device) | |||
401 | #define ARCH_BAD_APICID (0xff) | 401 | #define ARCH_BAD_APICID (0xff) |
402 | #endif | 402 | #endif |
403 | 403 | ||
404 | static u8 convert_acpiid_to_cpu(u8 acpi_id) | 404 | static int convert_acpiid_to_cpu(u8 acpi_id) |
405 | { | 405 | { |
406 | u16 apic_id; | 406 | u16 apic_id; |
407 | int i; | 407 | int i; |
@@ -427,7 +427,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
427 | acpi_status status = 0; | 427 | acpi_status status = 0; |
428 | union acpi_object object = { 0 }; | 428 | union acpi_object object = { 0 }; |
429 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; | 429 | struct acpi_buffer buffer = { sizeof(union acpi_object), &object }; |
430 | u8 cpu_index; | 430 | int cpu_index; |
431 | static int cpu0_initialized; | 431 | static int cpu0_initialized; |
432 | 432 | ||
433 | ACPI_FUNCTION_TRACE("acpi_processor_get_info"); | 433 | ACPI_FUNCTION_TRACE("acpi_processor_get_info"); |
@@ -473,7 +473,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
473 | cpu_index = convert_acpiid_to_cpu(pr->acpi_id); | 473 | cpu_index = convert_acpiid_to_cpu(pr->acpi_id); |
474 | 474 | ||
475 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ | 475 | /* Handle UP system running SMP kernel, with no LAPIC in MADT */ |
476 | if (!cpu0_initialized && (cpu_index == 0xff) && | 476 | if (!cpu0_initialized && (cpu_index == -1) && |
477 | (num_online_cpus() == 1)) { | 477 | (num_online_cpus() == 1)) { |
478 | cpu_index = 0; | 478 | cpu_index = 0; |
479 | } | 479 | } |
@@ -487,7 +487,7 @@ static int acpi_processor_get_info(struct acpi_processor *pr) | |||
487 | * less than the max # of CPUs. They should be ignored _iff | 487 | * less than the max # of CPUs. They should be ignored _iff |
488 | * they are physically not present. | 488 | * they are physically not present. |
489 | */ | 489 | */ |
490 | if (cpu_index >= NR_CPUS) { | 490 | if (cpu_index == -1) { |
491 | if (ACPI_FAILURE | 491 | if (ACPI_FAILURE |
492 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { | 492 | (acpi_processor_hotadd_init(pr->handle, &pr->id))) { |
493 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 493 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -558,8 +558,8 @@ static int acpi_processor_start(struct acpi_device *device) | |||
558 | */ | 558 | */ |
559 | if (processor_device_array[pr->id] != NULL && | 559 | if (processor_device_array[pr->id] != NULL && |
560 | processor_device_array[pr->id] != (void *)device) { | 560 | processor_device_array[pr->id] != (void *)device) { |
561 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "BIOS reporting wrong ACPI id" | 561 | printk(KERN_WARNING "BIOS reported wrong ACPI id" |
562 | "for the processor\n")); | 562 | "for the processor\n"); |
563 | return_VALUE(-ENODEV); | 563 | return_VALUE(-ENODEV); |
564 | } | 564 | } |
565 | processor_device_array[pr->id] = (void *)device; | 565 | processor_device_array[pr->id] = (void *)device; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 80fa43471f48..3b97a5eae9e8 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -54,10 +54,10 @@ ACPI_MODULE_NAME("acpi_processor") | |||
54 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) | 54 | #define US_TO_PM_TIMER_TICKS(t) ((t * (PM_TIMER_FREQUENCY/1000)) / 1000) |
55 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 55 | #define C2_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
56 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ | 56 | #define C3_OVERHEAD 4 /* 1us (3.579 ticks per us) */ |
57 | static void (*pm_idle_save) (void); | 57 | static void (*pm_idle_save) (void) __read_mostly; |
58 | module_param(max_cstate, uint, 0644); | 58 | module_param(max_cstate, uint, 0644); |
59 | 59 | ||
60 | static unsigned int nocst = 0; | 60 | static unsigned int nocst __read_mostly; |
61 | module_param(nocst, uint, 0000); | 61 | module_param(nocst, uint, 0000); |
62 | 62 | ||
63 | /* | 63 | /* |
@@ -67,7 +67,7 @@ module_param(nocst, uint, 0000); | |||
67 | * 100 HZ: 0x0000000F: 4 jiffies = 40ms | 67 | * 100 HZ: 0x0000000F: 4 jiffies = 40ms |
68 | * reduce history for more aggressive entry into C3 | 68 | * reduce history for more aggressive entry into C3 |
69 | */ | 69 | */ |
70 | static unsigned int bm_history = | 70 | static unsigned int bm_history __read_mostly = |
71 | (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); | 71 | (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1)); |
72 | module_param(bm_history, uint, 0644); | 72 | module_param(bm_history, uint, 0644); |
73 | /* -------------------------------------------------------------------------- | 73 | /* -------------------------------------------------------------------------- |
@@ -1081,7 +1081,7 @@ int acpi_processor_power_init(struct acpi_processor *pr, | |||
1081 | struct acpi_device *device) | 1081 | struct acpi_device *device) |
1082 | { | 1082 | { |
1083 | acpi_status status = 0; | 1083 | acpi_status status = 0; |
1084 | static int first_run = 0; | 1084 | static int first_run; |
1085 | struct proc_dir_entry *entry = NULL; | 1085 | struct proc_dir_entry *entry = NULL; |
1086 | unsigned int i; | 1086 | unsigned int i; |
1087 | 1087 | ||
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index f36db22ce1ae..41aaaba74b19 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF | 34 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF |
35 | #include <linux/proc_fs.h> | 35 | #include <linux/proc_fs.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <linux/mutex.h> | ||
37 | 38 | ||
38 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
39 | #endif | 40 | #endif |
@@ -48,7 +49,7 @@ | |||
48 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 49 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
49 | ACPI_MODULE_NAME("acpi_processor") | 50 | ACPI_MODULE_NAME("acpi_processor") |
50 | 51 | ||
51 | static DECLARE_MUTEX(performance_sem); | 52 | static DEFINE_MUTEX(performance_mutex); |
52 | 53 | ||
53 | /* | 54 | /* |
54 | * _PPC support is implemented as a CPUfreq policy notifier: | 55 | * _PPC support is implemented as a CPUfreq policy notifier: |
@@ -72,7 +73,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
72 | struct acpi_processor *pr; | 73 | struct acpi_processor *pr; |
73 | unsigned int ppc = 0; | 74 | unsigned int ppc = 0; |
74 | 75 | ||
75 | down(&performance_sem); | 76 | mutex_lock(&performance_mutex); |
76 | 77 | ||
77 | if (event != CPUFREQ_INCOMPATIBLE) | 78 | if (event != CPUFREQ_INCOMPATIBLE) |
78 | goto out; | 79 | goto out; |
@@ -93,7 +94,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
93 | core_frequency * 1000); | 94 | core_frequency * 1000); |
94 | 95 | ||
95 | out: | 96 | out: |
96 | up(&performance_sem); | 97 | mutex_unlock(&performance_mutex); |
97 | 98 | ||
98 | return 0; | 99 | return 0; |
99 | } | 100 | } |
@@ -553,6 +554,230 @@ static void acpi_cpufreq_remove_file(struct acpi_processor *pr) | |||
553 | } | 554 | } |
554 | #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ | 555 | #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ |
555 | 556 | ||
557 | static int acpi_processor_get_psd(struct acpi_processor *pr) | ||
558 | { | ||
559 | int result = 0; | ||
560 | acpi_status status = AE_OK; | ||
561 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | ||
562 | struct acpi_buffer format = {sizeof("NNNNN"), "NNNNN"}; | ||
563 | struct acpi_buffer state = {0, NULL}; | ||
564 | union acpi_object *psd = NULL; | ||
565 | struct acpi_psd_package *pdomain; | ||
566 | |||
567 | status = acpi_evaluate_object(pr->handle, "_PSD", NULL, &buffer); | ||
568 | if (ACPI_FAILURE(status)) { | ||
569 | return -ENODEV; | ||
570 | } | ||
571 | |||
572 | psd = (union acpi_object *) buffer.pointer; | ||
573 | if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) { | ||
574 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | ||
575 | result = -EFAULT; | ||
576 | goto end; | ||
577 | } | ||
578 | |||
579 | if (psd->package.count != 1) { | ||
580 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | ||
581 | result = -EFAULT; | ||
582 | goto end; | ||
583 | } | ||
584 | |||
585 | pdomain = &(pr->performance->domain_info); | ||
586 | |||
587 | state.length = sizeof(struct acpi_psd_package); | ||
588 | state.pointer = pdomain; | ||
589 | |||
590 | status = acpi_extract_package(&(psd->package.elements[0]), | ||
591 | &format, &state); | ||
592 | if (ACPI_FAILURE(status)) { | ||
593 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSD data\n")); | ||
594 | result = -EFAULT; | ||
595 | goto end; | ||
596 | } | ||
597 | |||
598 | if (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES) { | ||
599 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:num_entries\n")); | ||
600 | result = -EFAULT; | ||
601 | goto end; | ||
602 | } | ||
603 | |||
604 | if (pdomain->revision != ACPI_PSD_REV0_REVISION) { | ||
605 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown _PSD:revision\n")); | ||
606 | result = -EFAULT; | ||
607 | goto end; | ||
608 | } | ||
609 | |||
610 | end: | ||
611 | acpi_os_free(buffer.pointer); | ||
612 | return result; | ||
613 | } | ||
614 | |||
615 | int acpi_processor_preregister_performance( | ||
616 | struct acpi_processor_performance **performance) | ||
617 | { | ||
618 | int count, count_target; | ||
619 | int retval = 0; | ||
620 | unsigned int i, j; | ||
621 | cpumask_t covered_cpus; | ||
622 | struct acpi_processor *pr; | ||
623 | struct acpi_psd_package *pdomain; | ||
624 | struct acpi_processor *match_pr; | ||
625 | struct acpi_psd_package *match_pdomain; | ||
626 | |||
627 | mutex_lock(&performance_mutex); | ||
628 | |||
629 | retval = 0; | ||
630 | |||
631 | /* Call _PSD for all CPUs */ | ||
632 | for_each_possible_cpu(i) { | ||
633 | pr = processors[i]; | ||
634 | if (!pr) { | ||
635 | /* Look only at processors in ACPI namespace */ | ||
636 | continue; | ||
637 | } | ||
638 | |||
639 | if (pr->performance) { | ||
640 | retval = -EBUSY; | ||
641 | continue; | ||
642 | } | ||
643 | |||
644 | if (!performance || !performance[i]) { | ||
645 | retval = -EINVAL; | ||
646 | continue; | ||
647 | } | ||
648 | |||
649 | pr->performance = performance[i]; | ||
650 | cpu_set(i, pr->performance->shared_cpu_map); | ||
651 | if (acpi_processor_get_psd(pr)) { | ||
652 | retval = -EINVAL; | ||
653 | continue; | ||
654 | } | ||
655 | } | ||
656 | if (retval) | ||
657 | goto err_ret; | ||
658 | |||
659 | /* | ||
660 | * Now that we have _PSD data from all CPUs, lets setup P-state | ||
661 | * domain info. | ||
662 | */ | ||
663 | for_each_possible_cpu(i) { | ||
664 | pr = processors[i]; | ||
665 | if (!pr) | ||
666 | continue; | ||
667 | |||
668 | /* Basic validity check for domain info */ | ||
669 | pdomain = &(pr->performance->domain_info); | ||
670 | if ((pdomain->revision != ACPI_PSD_REV0_REVISION) || | ||
671 | (pdomain->num_entries != ACPI_PSD_REV0_ENTRIES)) { | ||
672 | retval = -EINVAL; | ||
673 | goto err_ret; | ||
674 | } | ||
675 | if (pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ALL && | ||
676 | pdomain->coord_type != DOMAIN_COORD_TYPE_SW_ANY && | ||
677 | pdomain->coord_type != DOMAIN_COORD_TYPE_HW_ALL) { | ||
678 | retval = -EINVAL; | ||
679 | goto err_ret; | ||
680 | } | ||
681 | } | ||
682 | |||
683 | cpus_clear(covered_cpus); | ||
684 | for_each_possible_cpu(i) { | ||
685 | pr = processors[i]; | ||
686 | if (!pr) | ||
687 | continue; | ||
688 | |||
689 | if (cpu_isset(i, covered_cpus)) | ||
690 | continue; | ||
691 | |||
692 | pdomain = &(pr->performance->domain_info); | ||
693 | cpu_set(i, pr->performance->shared_cpu_map); | ||
694 | cpu_set(i, covered_cpus); | ||
695 | if (pdomain->num_processors <= 1) | ||
696 | continue; | ||
697 | |||
698 | /* Validate the Domain info */ | ||
699 | count_target = pdomain->num_processors; | ||
700 | count = 1; | ||
701 | if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL || | ||
702 | pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) { | ||
703 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; | ||
704 | } else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) { | ||
705 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ANY; | ||
706 | } | ||
707 | |||
708 | for_each_possible_cpu(j) { | ||
709 | if (i == j) | ||
710 | continue; | ||
711 | |||
712 | match_pr = processors[j]; | ||
713 | if (!match_pr) | ||
714 | continue; | ||
715 | |||
716 | match_pdomain = &(match_pr->performance->domain_info); | ||
717 | if (match_pdomain->domain != pdomain->domain) | ||
718 | continue; | ||
719 | |||
720 | /* Here i and j are in the same domain */ | ||
721 | |||
722 | if (match_pdomain->num_processors != count_target) { | ||
723 | retval = -EINVAL; | ||
724 | goto err_ret; | ||
725 | } | ||
726 | |||
727 | if (pdomain->coord_type != match_pdomain->coord_type) { | ||
728 | retval = -EINVAL; | ||
729 | goto err_ret; | ||
730 | } | ||
731 | |||
732 | cpu_set(j, covered_cpus); | ||
733 | cpu_set(j, pr->performance->shared_cpu_map); | ||
734 | count++; | ||
735 | } | ||
736 | |||
737 | for_each_possible_cpu(j) { | ||
738 | if (i == j) | ||
739 | continue; | ||
740 | |||
741 | match_pr = processors[j]; | ||
742 | if (!match_pr) | ||
743 | continue; | ||
744 | |||
745 | match_pdomain = &(match_pr->performance->domain_info); | ||
746 | if (match_pdomain->domain != pdomain->domain) | ||
747 | continue; | ||
748 | |||
749 | match_pr->performance->shared_type = | ||
750 | pr->performance->shared_type; | ||
751 | match_pr->performance->shared_cpu_map = | ||
752 | pr->performance->shared_cpu_map; | ||
753 | } | ||
754 | } | ||
755 | |||
756 | err_ret: | ||
757 | if (retval) { | ||
758 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error while parsing _PSD domain information. Assuming no coordination\n")); | ||
759 | } | ||
760 | |||
761 | for_each_possible_cpu(i) { | ||
762 | pr = processors[i]; | ||
763 | if (!pr || !pr->performance) | ||
764 | continue; | ||
765 | |||
766 | /* Assume no coordination on any error parsing domain info */ | ||
767 | if (retval) { | ||
768 | cpus_clear(pr->performance->shared_cpu_map); | ||
769 | cpu_set(i, pr->performance->shared_cpu_map); | ||
770 | pr->performance->shared_type = CPUFREQ_SHARED_TYPE_ALL; | ||
771 | } | ||
772 | pr->performance = NULL; /* Will be set for real in register */ | ||
773 | } | ||
774 | |||
775 | mutex_unlock(&performance_mutex); | ||
776 | return retval; | ||
777 | } | ||
778 | EXPORT_SYMBOL(acpi_processor_preregister_performance); | ||
779 | |||
780 | |||
556 | int | 781 | int |
557 | acpi_processor_register_performance(struct acpi_processor_performance | 782 | acpi_processor_register_performance(struct acpi_processor_performance |
558 | *performance, unsigned int cpu) | 783 | *performance, unsigned int cpu) |
@@ -564,16 +789,16 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
564 | if (!(acpi_processor_ppc_status & PPC_REGISTERED)) | 789 | if (!(acpi_processor_ppc_status & PPC_REGISTERED)) |
565 | return_VALUE(-EINVAL); | 790 | return_VALUE(-EINVAL); |
566 | 791 | ||
567 | down(&performance_sem); | 792 | mutex_lock(&performance_mutex); |
568 | 793 | ||
569 | pr = processors[cpu]; | 794 | pr = processors[cpu]; |
570 | if (!pr) { | 795 | if (!pr) { |
571 | up(&performance_sem); | 796 | mutex_unlock(&performance_mutex); |
572 | return_VALUE(-ENODEV); | 797 | return_VALUE(-ENODEV); |
573 | } | 798 | } |
574 | 799 | ||
575 | if (pr->performance) { | 800 | if (pr->performance) { |
576 | up(&performance_sem); | 801 | mutex_unlock(&performance_mutex); |
577 | return_VALUE(-EBUSY); | 802 | return_VALUE(-EBUSY); |
578 | } | 803 | } |
579 | 804 | ||
@@ -583,13 +808,13 @@ acpi_processor_register_performance(struct acpi_processor_performance | |||
583 | 808 | ||
584 | if (acpi_processor_get_performance_info(pr)) { | 809 | if (acpi_processor_get_performance_info(pr)) { |
585 | pr->performance = NULL; | 810 | pr->performance = NULL; |
586 | up(&performance_sem); | 811 | mutex_unlock(&performance_mutex); |
587 | return_VALUE(-EIO); | 812 | return_VALUE(-EIO); |
588 | } | 813 | } |
589 | 814 | ||
590 | acpi_cpufreq_add_file(pr); | 815 | acpi_cpufreq_add_file(pr); |
591 | 816 | ||
592 | up(&performance_sem); | 817 | mutex_unlock(&performance_mutex); |
593 | return_VALUE(0); | 818 | return_VALUE(0); |
594 | } | 819 | } |
595 | 820 | ||
@@ -603,11 +828,11 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
603 | 828 | ||
604 | ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); | 829 | ACPI_FUNCTION_TRACE("acpi_processor_unregister_performance"); |
605 | 830 | ||
606 | down(&performance_sem); | 831 | mutex_lock(&performance_mutex); |
607 | 832 | ||
608 | pr = processors[cpu]; | 833 | pr = processors[cpu]; |
609 | if (!pr) { | 834 | if (!pr) { |
610 | up(&performance_sem); | 835 | mutex_unlock(&performance_mutex); |
611 | return_VOID; | 836 | return_VOID; |
612 | } | 837 | } |
613 | 838 | ||
@@ -617,7 +842,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance | |||
617 | 842 | ||
618 | acpi_cpufreq_remove_file(pr); | 843 | acpi_cpufreq_remove_file(pr); |
619 | 844 | ||
620 | up(&performance_sem); | 845 | mutex_unlock(&performance_mutex); |
621 | 846 | ||
622 | return_VOID; | 847 | return_VOID; |
623 | } | 848 | } |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 4038dbfa63a0..cf87b0230026 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -78,6 +78,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) | |||
78 | ACPI_FUNCTION_ENTRY(); | 78 | ACPI_FUNCTION_ENTRY(); |
79 | 79 | ||
80 | for (bits_set = 0; bit_field; bits_set++) { | 80 | for (bits_set = 0; bit_field; bits_set++) { |
81 | |||
81 | /* Zero the least significant bit that is set */ | 82 | /* Zero the least significant bit that is set */ |
82 | 83 | ||
83 | bit_field &= (bit_field - 1); | 84 | bit_field &= (bit_field - 1); |
@@ -154,15 +155,18 @@ acpi_rs_stream_option_length(u32 resource_length, | |||
154 | * length, minus one byte for the resource_source_index itself. | 155 | * length, minus one byte for the resource_source_index itself. |
155 | */ | 156 | */ |
156 | if (resource_length > minimum_aml_resource_length) { | 157 | if (resource_length > minimum_aml_resource_length) { |
158 | |||
157 | /* Compute the length of the optional string */ | 159 | /* Compute the length of the optional string */ |
158 | 160 | ||
159 | string_length = | 161 | string_length = |
160 | resource_length - minimum_aml_resource_length - 1; | 162 | resource_length - minimum_aml_resource_length - 1; |
161 | } | 163 | } |
162 | 164 | ||
163 | /* Round up length to 32 bits for internal structure alignment */ | 165 | /* |
164 | 166 | * Round the length up to a multiple of the native word in order to | |
165 | return (ACPI_ROUND_UP_to_32_bITS(string_length)); | 167 | * guarantee that the entire resource descriptor is native word aligned |
168 | */ | ||
169 | return ((u32) ACPI_ROUND_UP_TO_NATIVE_WORD(string_length)); | ||
166 | } | 170 | } |
167 | 171 | ||
168 | /******************************************************************************* | 172 | /******************************************************************************* |
@@ -186,11 +190,12 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
186 | acpi_size aml_size_needed = 0; | 190 | acpi_size aml_size_needed = 0; |
187 | acpi_rs_length total_size; | 191 | acpi_rs_length total_size; |
188 | 192 | ||
189 | ACPI_FUNCTION_TRACE("rs_get_aml_length"); | 193 | ACPI_FUNCTION_TRACE(rs_get_aml_length); |
190 | 194 | ||
191 | /* Traverse entire list of internal resource descriptors */ | 195 | /* Traverse entire list of internal resource descriptors */ |
192 | 196 | ||
193 | while (resource) { | 197 | while (resource) { |
198 | |||
194 | /* Validate the descriptor type */ | 199 | /* Validate the descriptor type */ |
195 | 200 | ||
196 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 201 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
@@ -214,6 +219,7 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
214 | * is a Large Resource data type. | 219 | * is a Large Resource data type. |
215 | */ | 220 | */ |
216 | if (resource->data.vendor.byte_length > 7) { | 221 | if (resource->data.vendor.byte_length > 7) { |
222 | |||
217 | /* Base size of a Large resource descriptor */ | 223 | /* Base size of a Large resource descriptor */ |
218 | 224 | ||
219 | total_size = | 225 | total_size = |
@@ -332,20 +338,22 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
332 | acpi_status status; | 338 | acpi_status status; |
333 | u8 *end_aml; | 339 | u8 *end_aml; |
334 | u8 *buffer; | 340 | u8 *buffer; |
335 | u32 buffer_size = 0; | 341 | u32 buffer_size; |
336 | u16 temp16; | 342 | u16 temp16; |
337 | u16 resource_length; | 343 | u16 resource_length; |
338 | u32 extra_struct_bytes; | 344 | u32 extra_struct_bytes; |
339 | u8 resource_index; | 345 | u8 resource_index; |
340 | u8 minimum_aml_resource_length; | 346 | u8 minimum_aml_resource_length; |
341 | 347 | ||
342 | ACPI_FUNCTION_TRACE("rs_get_list_length"); | 348 | ACPI_FUNCTION_TRACE(rs_get_list_length); |
343 | 349 | ||
350 | *size_needed = 0; | ||
344 | end_aml = aml_buffer + aml_buffer_length; | 351 | end_aml = aml_buffer + aml_buffer_length; |
345 | 352 | ||
346 | /* Walk the list of AML resource descriptors */ | 353 | /* Walk the list of AML resource descriptors */ |
347 | 354 | ||
348 | while (aml_buffer < end_aml) { | 355 | while (aml_buffer < end_aml) { |
356 | |||
349 | /* Validate the Resource Type and Resource Length */ | 357 | /* Validate the Resource Type and Resource Length */ |
350 | 358 | ||
351 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); | 359 | status = acpi_ut_validate_resource(aml_buffer, &resource_index); |
@@ -386,35 +394,28 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
386 | break; | 394 | break; |
387 | 395 | ||
388 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: | 396 | case ACPI_RESOURCE_NAME_VENDOR_SMALL: |
397 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: | ||
389 | /* | 398 | /* |
390 | * Vendor Resource: | 399 | * Vendor Resource: |
391 | * Ensure a 32-bit boundary for the structure | 400 | * Get the number of vendor data bytes |
392 | */ | 401 | */ |
393 | extra_struct_bytes = | 402 | extra_struct_bytes = resource_length; |
394 | ACPI_ROUND_UP_to_32_bITS(resource_length); | ||
395 | break; | 403 | break; |
396 | 404 | ||
397 | case ACPI_RESOURCE_NAME_END_TAG: | 405 | case ACPI_RESOURCE_NAME_END_TAG: |
398 | /* | 406 | /* |
399 | * End Tag: This is the normal exit, add size of end_tag | 407 | * End Tag: |
408 | * This is the normal exit, add size of end_tag | ||
400 | */ | 409 | */ |
401 | *size_needed = buffer_size + ACPI_RS_SIZE_MIN; | 410 | *size_needed += ACPI_RS_SIZE_MIN; |
402 | return_ACPI_STATUS(AE_OK); | 411 | return_ACPI_STATUS(AE_OK); |
403 | 412 | ||
404 | case ACPI_RESOURCE_NAME_VENDOR_LARGE: | ||
405 | /* | ||
406 | * Vendor Resource: | ||
407 | * Add vendor data and ensure a 32-bit boundary for the structure | ||
408 | */ | ||
409 | extra_struct_bytes = | ||
410 | ACPI_ROUND_UP_to_32_bITS(resource_length); | ||
411 | break; | ||
412 | |||
413 | case ACPI_RESOURCE_NAME_ADDRESS32: | 413 | case ACPI_RESOURCE_NAME_ADDRESS32: |
414 | case ACPI_RESOURCE_NAME_ADDRESS16: | 414 | case ACPI_RESOURCE_NAME_ADDRESS16: |
415 | case ACPI_RESOURCE_NAME_ADDRESS64: | ||
415 | /* | 416 | /* |
416 | * 32-Bit or 16-bit Address Resource: | 417 | * Address Resource: |
417 | * Add the size of any optional data (resource_source) | 418 | * Add the size of the optional resource_source |
418 | */ | 419 | */ |
419 | extra_struct_bytes = | 420 | extra_struct_bytes = |
420 | acpi_rs_stream_option_length(resource_length, | 421 | acpi_rs_stream_option_length(resource_length, |
@@ -423,50 +424,46 @@ acpi_rs_get_list_length(u8 * aml_buffer, | |||
423 | 424 | ||
424 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: | 425 | case ACPI_RESOURCE_NAME_EXTENDED_IRQ: |
425 | /* | 426 | /* |
426 | * Extended IRQ: | 427 | * Extended IRQ Resource: |
427 | * Point past the interrupt_vector_flags to get the | 428 | * Using the interrupt_table_length, add 4 bytes for each additional |
428 | * interrupt_table_length. | 429 | * interrupt. Note: at least one interrupt is required and is |
430 | * included in the minimum descriptor size (reason for the -1) | ||
429 | */ | 431 | */ |
430 | buffer++; | 432 | extra_struct_bytes = (buffer[1] - 1) * sizeof(u32); |
431 | 433 | ||
432 | extra_struct_bytes = | 434 | /* Add the size of the optional resource_source */ |
433 | /* | 435 | |
434 | * Add 4 bytes for each additional interrupt. Note: at | 436 | extra_struct_bytes += |
435 | * least one interrupt is required and is included in | ||
436 | * the minimum descriptor size | ||
437 | */ | ||
438 | ((*buffer - 1) * sizeof(u32)) + | ||
439 | /* Add the size of any optional data (resource_source) */ | ||
440 | acpi_rs_stream_option_length(resource_length - | 437 | acpi_rs_stream_option_length(resource_length - |
441 | extra_struct_bytes, | 438 | extra_struct_bytes, |
442 | minimum_aml_resource_length); | 439 | minimum_aml_resource_length); |
443 | break; | 440 | break; |
444 | 441 | ||
445 | case ACPI_RESOURCE_NAME_ADDRESS64: | ||
446 | /* | ||
447 | * 64-Bit Address Resource: | ||
448 | * Add the size of any optional data (resource_source) | ||
449 | * Ensure a 64-bit boundary for the structure | ||
450 | */ | ||
451 | extra_struct_bytes = | ||
452 | ACPI_ROUND_UP_to_64_bITS | ||
453 | (acpi_rs_stream_option_length | ||
454 | (resource_length, minimum_aml_resource_length)); | ||
455 | break; | ||
456 | |||
457 | default: | 442 | default: |
458 | break; | 443 | break; |
459 | } | 444 | } |
460 | 445 | ||
461 | /* Update the required buffer size for the internal descriptor structs */ | 446 | /* |
447 | * Update the required buffer size for the internal descriptor structs | ||
448 | * | ||
449 | * Important: Round the size up for the appropriate alignment. This | ||
450 | * is a requirement on IA64. | ||
451 | */ | ||
452 | buffer_size = acpi_gbl_resource_struct_sizes[resource_index] + | ||
453 | extra_struct_bytes; | ||
454 | buffer_size = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); | ||
462 | 455 | ||
463 | temp16 = (u16) (acpi_gbl_resource_struct_sizes[resource_index] + | 456 | *size_needed += buffer_size; |
464 | extra_struct_bytes); | 457 | |
465 | buffer_size += (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(temp16); | 458 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
459 | "Type %.2X, AmlLength %.2X InternalLength %.2X\n", | ||
460 | acpi_ut_get_resource_type(aml_buffer), | ||
461 | acpi_ut_get_descriptor_length(aml_buffer), | ||
462 | buffer_size)); | ||
466 | 463 | ||
467 | /* | 464 | /* |
468 | * Point to the next resource within the stream | 465 | * Point to the next resource within the AML stream using the length |
469 | * using the size of the header plus the length contained in the header | 466 | * contained in the resource descriptor header |
470 | */ | 467 | */ |
471 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); | 468 | aml_buffer += acpi_ut_get_descriptor_length(aml_buffer); |
472 | } | 469 | } |
@@ -506,7 +503,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
506 | u8 name_found; | 503 | u8 name_found; |
507 | u32 table_index; | 504 | u32 table_index; |
508 | 505 | ||
509 | ACPI_FUNCTION_TRACE("rs_get_pci_routing_table_length"); | 506 | ACPI_FUNCTION_TRACE(rs_get_pci_routing_table_length); |
510 | 507 | ||
511 | number_of_elements = package_object->package.count; | 508 | number_of_elements = package_object->package.count; |
512 | 509 | ||
@@ -523,6 +520,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
523 | top_object_list = package_object->package.elements; | 520 | top_object_list = package_object->package.elements; |
524 | 521 | ||
525 | for (index = 0; index < number_of_elements; index++) { | 522 | for (index = 0; index < number_of_elements; index++) { |
523 | |||
526 | /* Dereference the sub-package */ | 524 | /* Dereference the sub-package */ |
527 | 525 | ||
528 | package_element = *top_object_list; | 526 | package_element = *top_object_list; |
@@ -581,7 +579,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
581 | 579 | ||
582 | /* Round up the size since each element must be aligned */ | 580 | /* Round up the size since each element must be aligned */ |
583 | 581 | ||
584 | temp_size_needed = ACPI_ROUND_UP_to_64_bITS(temp_size_needed); | 582 | temp_size_needed = ACPI_ROUND_UP_TO_64BIT(temp_size_needed); |
585 | 583 | ||
586 | /* Point to the next union acpi_operand_object */ | 584 | /* Point to the next union acpi_operand_object */ |
587 | 585 | ||
@@ -589,7 +587,7 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
589 | } | 587 | } |
590 | 588 | ||
591 | /* | 589 | /* |
592 | * Adding an extra element to the end of the list, essentially a | 590 | * Add an extra element to the end of the list, essentially a |
593 | * NULL terminator | 591 | * NULL terminator |
594 | */ | 592 | */ |
595 | *buffer_size_needed = | 593 | *buffer_size_needed = |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 8c128dea3252..008058acdd39 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -75,10 +75,11 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
75 | u8 *aml_start; | 75 | u8 *aml_start; |
76 | acpi_size list_size_needed = 0; | 76 | acpi_size list_size_needed = 0; |
77 | u32 aml_buffer_length; | 77 | u32 aml_buffer_length; |
78 | void *resource; | ||
78 | 79 | ||
79 | ACPI_FUNCTION_TRACE("rs_create_resource_list"); | 80 | ACPI_FUNCTION_TRACE(rs_create_resource_list); |
80 | 81 | ||
81 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_buffer = %p\n", aml_buffer)); | 82 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlBuffer = %p\n", aml_buffer)); |
82 | 83 | ||
83 | /* Params already validated, so we don't re-validate here */ | 84 | /* Params already validated, so we don't re-validate here */ |
84 | 85 | ||
@@ -92,7 +93,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
92 | status = acpi_rs_get_list_length(aml_start, aml_buffer_length, | 93 | status = acpi_rs_get_list_length(aml_start, aml_buffer_length, |
93 | &list_size_needed); | 94 | &list_size_needed); |
94 | 95 | ||
95 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X list_size_needed=%X\n", | 96 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", |
96 | status, (u32) list_size_needed)); | 97 | status, (u32) list_size_needed)); |
97 | if (ACPI_FAILURE(status)) { | 98 | if (ACPI_FAILURE(status)) { |
98 | return_ACPI_STATUS(status); | 99 | return_ACPI_STATUS(status); |
@@ -107,13 +108,15 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |||
107 | 108 | ||
108 | /* Do the conversion */ | 109 | /* Do the conversion */ |
109 | 110 | ||
110 | status = acpi_rs_convert_aml_to_resources(aml_start, aml_buffer_length, | 111 | resource = output_buffer->pointer; |
111 | output_buffer->pointer); | 112 | status = acpi_ut_walk_aml_resources(aml_start, aml_buffer_length, |
113 | acpi_rs_convert_aml_to_resources, | ||
114 | &resource); | ||
112 | if (ACPI_FAILURE(status)) { | 115 | if (ACPI_FAILURE(status)) { |
113 | return_ACPI_STATUS(status); | 116 | return_ACPI_STATUS(status); |
114 | } | 117 | } |
115 | 118 | ||
116 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 119 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
117 | output_buffer->pointer, (u32) output_buffer->length)); | 120 | output_buffer->pointer, (u32) output_buffer->length)); |
118 | return_ACPI_STATUS(AE_OK); | 121 | return_ACPI_STATUS(AE_OK); |
119 | } | 122 | } |
@@ -155,7 +158,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
155 | acpi_status status; | 158 | acpi_status status; |
156 | struct acpi_buffer path_buffer; | 159 | struct acpi_buffer path_buffer; |
157 | 160 | ||
158 | ACPI_FUNCTION_TRACE("rs_create_pci_routing_table"); | 161 | ACPI_FUNCTION_TRACE(rs_create_pci_routing_table); |
159 | 162 | ||
160 | /* Params already validated, so we don't re-validate here */ | 163 | /* Params already validated, so we don't re-validate here */ |
161 | 164 | ||
@@ -167,7 +170,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
167 | return_ACPI_STATUS(status); | 170 | return_ACPI_STATUS(status); |
168 | } | 171 | } |
169 | 172 | ||
170 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "buffer_size_needed = %X\n", | 173 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", |
171 | (u32) buffer_size_needed)); | 174 | (u32) buffer_size_needed)); |
172 | 175 | ||
173 | /* Validate/Allocate/Clear caller buffer */ | 176 | /* Validate/Allocate/Clear caller buffer */ |
@@ -332,7 +335,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
332 | /* Now align the current length */ | 335 | /* Now align the current length */ |
333 | 336 | ||
334 | user_prt->length = | 337 | user_prt->length = |
335 | (u32) ACPI_ROUND_UP_to_64_bITS(user_prt->length); | 338 | (u32) ACPI_ROUND_UP_TO_64BIT(user_prt->length); |
336 | 339 | ||
337 | /* 4) Fourth subobject: Dereference the PRT.source_index */ | 340 | /* 4) Fourth subobject: Dereference the PRT.source_index */ |
338 | 341 | ||
@@ -341,7 +344,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
341 | user_prt->source_index = (u32) obj_desc->integer.value; | 344 | user_prt->source_index = (u32) obj_desc->integer.value; |
342 | } else { | 345 | } else { |
343 | ACPI_ERROR((AE_INFO, | 346 | ACPI_ERROR((AE_INFO, |
344 | "(PRT[%X].source_index) Need Integer, found %s", | 347 | "(PRT[%X].SourceIndex) Need Integer, found %s", |
345 | index, | 348 | index, |
346 | acpi_ut_get_object_type_name(obj_desc))); | 349 | acpi_ut_get_object_type_name(obj_desc))); |
347 | return_ACPI_STATUS(AE_BAD_DATA); | 350 | return_ACPI_STATUS(AE_BAD_DATA); |
@@ -352,7 +355,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
352 | top_object_list++; | 355 | top_object_list++; |
353 | } | 356 | } |
354 | 357 | ||
355 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 358 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
356 | output_buffer->pointer, (u32) output_buffer->length)); | 359 | output_buffer->pointer, (u32) output_buffer->length)); |
357 | return_ACPI_STATUS(AE_OK); | 360 | return_ACPI_STATUS(AE_OK); |
358 | } | 361 | } |
@@ -382,9 +385,9 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
382 | acpi_status status; | 385 | acpi_status status; |
383 | acpi_size aml_size_needed = 0; | 386 | acpi_size aml_size_needed = 0; |
384 | 387 | ||
385 | ACPI_FUNCTION_TRACE("rs_create_aml_resources"); | 388 | ACPI_FUNCTION_TRACE(rs_create_aml_resources); |
386 | 389 | ||
387 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "linked_list_buffer = %p\n", | 390 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n", |
388 | linked_list_buffer)); | 391 | linked_list_buffer)); |
389 | 392 | ||
390 | /* | 393 | /* |
@@ -395,7 +398,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
395 | */ | 398 | */ |
396 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); | 399 | status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); |
397 | 400 | ||
398 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "aml_size_needed=%X, %s\n", | 401 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", |
399 | (u32) aml_size_needed, | 402 | (u32) aml_size_needed, |
400 | acpi_format_exception(status))); | 403 | acpi_format_exception(status))); |
401 | if (ACPI_FAILURE(status)) { | 404 | if (ACPI_FAILURE(status)) { |
@@ -419,7 +422,7 @@ acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, | |||
419 | return_ACPI_STATUS(status); | 422 | return_ACPI_STATUS(status); |
420 | } | 423 | } |
421 | 424 | ||
422 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "output_buffer %p Length %X\n", | 425 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", |
423 | output_buffer->pointer, (u32) output_buffer->length)); | 426 | output_buffer->pointer, (u32) output_buffer->length)); |
424 | return_ACPI_STATUS(AE_OK); | 427 | return_ACPI_STATUS(AE_OK); |
425 | } | 428 | } |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index e7de061cf883..9c99a723a860 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -91,11 +91,11 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); | |||
91 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { | 91 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { |
92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, | 92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, |
93 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", | 93 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", |
94 | acpi_gbl_HEdecode}, | 94 | acpi_gbl_he_decode}, |
95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", | 95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", |
96 | acpi_gbl_LLdecode}, | 96 | acpi_gbl_ll_decode}, |
97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", | 97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", |
98 | acpi_gbl_SHRdecode}, | 98 | acpi_gbl_shr_decode}, |
99 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), | 99 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), |
100 | "Interrupt Count", NULL}, | 100 | "Interrupt Count", NULL}, |
101 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), | 101 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), |
@@ -105,11 +105,11 @@ struct acpi_rsdump_info acpi_rs_dump_irq[6] = { | |||
105 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { | 105 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { |
106 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, | 106 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, |
107 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", | 107 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", |
108 | acpi_gbl_TYPdecode}, | 108 | acpi_gbl_typ_decode}, |
109 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", | 109 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", |
110 | acpi_gbl_BMdecode}, | 110 | acpi_gbl_bm_decode}, |
111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", | 111 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", |
112 | acpi_gbl_SIZdecode}, | 112 | acpi_gbl_siz_decode}, |
113 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", | 113 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", |
114 | NULL}, | 114 | NULL}, |
115 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", | 115 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", |
@@ -158,7 +158,7 @@ struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { | |||
158 | }; | 158 | }; |
159 | 159 | ||
160 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { | 160 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { |
161 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag", | 161 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag", |
162 | NULL} | 162 | NULL} |
163 | }; | 163 | }; |
164 | 164 | ||
@@ -166,7 +166,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { | |||
166 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), | 166 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), |
167 | "24-Bit Memory Range", NULL}, | 167 | "24-Bit Memory Range", NULL}, |
168 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), | 168 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), |
169 | "Write Protect", acpi_gbl_RWdecode}, | 169 | "Write Protect", acpi_gbl_rw_decode}, |
170 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", | 170 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", |
171 | NULL}, | 171 | NULL}, |
172 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", | 172 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", |
@@ -181,7 +181,7 @@ struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { | |||
181 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), | 181 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), |
182 | "32-Bit Memory Range", NULL}, | 182 | "32-Bit Memory Range", NULL}, |
183 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), | 183 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), |
184 | "Write Protect", acpi_gbl_RWdecode}, | 184 | "Write Protect", acpi_gbl_rw_decode}, |
185 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", | 185 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", |
186 | NULL}, | 186 | NULL}, |
187 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", | 187 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", |
@@ -196,7 +196,7 @@ struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { | |||
196 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), | 196 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), |
197 | "32-Bit Fixed Memory Range", NULL}, | 197 | "32-Bit Fixed Memory Range", NULL}, |
198 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), | 198 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), |
199 | "Write Protect", acpi_gbl_RWdecode}, | 199 | "Write Protect", acpi_gbl_rw_decode}, |
200 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", | 200 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", |
201 | NULL}, | 201 | NULL}, |
202 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), | 202 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), |
@@ -278,11 +278,11 @@ struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { | |||
278 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), | 278 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), |
279 | "Type", acpi_gbl_consume_decode}, | 279 | "Type", acpi_gbl_consume_decode}, |
280 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), | 280 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), |
281 | "Triggering", acpi_gbl_HEdecode}, | 281 | "Triggering", acpi_gbl_he_decode}, |
282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", | 282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", |
283 | acpi_gbl_LLdecode}, | 283 | acpi_gbl_ll_decode}, |
284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", | 284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", |
285 | acpi_gbl_SHRdecode}, | 285 | acpi_gbl_shr_decode}, |
286 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, | 286 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, |
287 | NULL}, | 287 | NULL}, |
288 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), | 288 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), |
@@ -314,7 +314,7 @@ static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { | |||
314 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), | 314 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), |
315 | "Consumer/Producer", acpi_gbl_consume_decode}, | 315 | "Consumer/Producer", acpi_gbl_consume_decode}, |
316 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", | 316 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", |
317 | acpi_gbl_DECdecode}, | 317 | acpi_gbl_dec_decode}, |
318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), | 318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), |
319 | "Min Relocatability", acpi_gbl_min_decode}, | 319 | "Min Relocatability", acpi_gbl_min_decode}, |
320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), | 320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), |
@@ -325,24 +325,24 @@ static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { | |||
325 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), | 325 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), |
326 | "Resource Type", (void *)"Memory Range"}, | 326 | "Resource Type", (void *)"Memory Range"}, |
327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), | 327 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), |
328 | "Write Protect", acpi_gbl_RWdecode}, | 328 | "Write Protect", acpi_gbl_rw_decode}, |
329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), | 329 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), |
330 | "Caching", acpi_gbl_MEMdecode}, | 330 | "Caching", acpi_gbl_mem_decode}, |
331 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), | 331 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), |
332 | "Range Type", acpi_gbl_MTPdecode}, | 332 | "Range Type", acpi_gbl_mtp_decode}, |
333 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), | 333 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), |
334 | "Translation", acpi_gbl_TTPdecode} | 334 | "Translation", acpi_gbl_ttp_decode} |
335 | }; | 335 | }; |
336 | 336 | ||
337 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { | 337 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { |
338 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), | 338 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), |
339 | "Resource Type", (void *)"I/O Range"}, | 339 | "Resource Type", (void *)"I/O Range"}, |
340 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), | 340 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), |
341 | "Range Type", acpi_gbl_RNGdecode}, | 341 | "Range Type", acpi_gbl_rng_decode}, |
342 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), | 342 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), |
343 | "Translation", acpi_gbl_TTPdecode}, | 343 | "Translation", acpi_gbl_ttp_decode}, |
344 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), | 344 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), |
345 | "Translation Type", acpi_gbl_TRSdecode} | 345 | "Translation Type", acpi_gbl_trs_decode} |
346 | }; | 346 | }; |
347 | 347 | ||
348 | /* | 348 | /* |
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index d9ae64b77bd9..9e7ae2f8a1d3 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c | |||
@@ -141,6 +141,7 @@ struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[] = { | |||
141 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ | 141 | acpi_rs_dump_generic_reg, /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */ |
142 | }; | 142 | }; |
143 | #endif | 143 | #endif |
144 | |||
144 | #endif /* ACPI_FUTURE_USAGE */ | 145 | #endif /* ACPI_FUTURE_USAGE */ |
145 | /* | 146 | /* |
146 | * Base sizes for external AML resource descriptors, indexed by internal type. | 147 | * Base sizes for external AML resource descriptors, indexed by internal type. |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index 1434e786477e..29423ce030ca 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -51,76 +51,62 @@ ACPI_MODULE_NAME("rslist") | |||
51 | * | 51 | * |
52 | * FUNCTION: acpi_rs_convert_aml_to_resources | 52 | * FUNCTION: acpi_rs_convert_aml_to_resources |
53 | * | 53 | * |
54 | * PARAMETERS: Aml - Pointer to the resource byte stream | 54 | * PARAMETERS: acpi_walk_aml_callback |
55 | * aml_length - Length of Aml | 55 | * resource_ptr - Pointer to the buffer that will |
56 | * output_buffer - Pointer to the buffer that will | 56 | * contain the output structures |
57 | * contain the output structures | ||
58 | * | 57 | * |
59 | * RETURN: Status | 58 | * RETURN: Status |
60 | * | 59 | * |
61 | * DESCRIPTION: Takes the resource byte stream and parses it, creating a | 60 | * DESCRIPTION: Convert an AML resource to an internal representation of the |
62 | * linked list of resources in the caller's output buffer | 61 | * resource that is aligned and easier to access. |
63 | * | 62 | * |
64 | ******************************************************************************/ | 63 | ******************************************************************************/ |
65 | acpi_status | 64 | acpi_status |
66 | acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) | 65 | acpi_rs_convert_aml_to_resources(u8 * aml, |
66 | u32 length, | ||
67 | u32 offset, u8 resource_index, void **context) | ||
67 | { | 68 | { |
68 | struct acpi_resource *resource = (void *)output_buffer; | 69 | struct acpi_resource **resource_ptr = |
70 | ACPI_CAST_INDIRECT_PTR(struct acpi_resource, context); | ||
71 | struct acpi_resource *resource; | ||
69 | acpi_status status; | 72 | acpi_status status; |
70 | u8 resource_index; | ||
71 | u8 *end_aml; | ||
72 | |||
73 | ACPI_FUNCTION_TRACE("rs_convert_aml_to_resources"); | ||
74 | |||
75 | end_aml = aml + aml_length; | ||
76 | |||
77 | /* Loop until end-of-buffer or an end_tag is found */ | ||
78 | |||
79 | while (aml < end_aml) { | ||
80 | /* Validate the Resource Type and Resource Length */ | ||
81 | |||
82 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
83 | if (ACPI_FAILURE(status)) { | ||
84 | return_ACPI_STATUS(status); | ||
85 | } | ||
86 | 73 | ||
87 | /* Convert the AML byte stream resource to a local resource struct */ | 74 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resources); |
88 | |||
89 | status = | ||
90 | acpi_rs_convert_aml_to_resource(resource, | ||
91 | ACPI_CAST_PTR(union | ||
92 | aml_resource, | ||
93 | aml), | ||
94 | acpi_gbl_get_resource_dispatch | ||
95 | [resource_index]); | ||
96 | if (ACPI_FAILURE(status)) { | ||
97 | ACPI_EXCEPTION((AE_INFO, status, | ||
98 | "Could not convert AML resource (Type %X)", | ||
99 | *aml)); | ||
100 | return_ACPI_STATUS(status); | ||
101 | } | ||
102 | 75 | ||
103 | /* Normal exit on completion of an end_tag resource descriptor */ | 76 | /* |
104 | 77 | * Check that the input buffer and all subsequent pointers into it | |
105 | if (acpi_ut_get_resource_type(aml) == | 78 | * are aligned on a native word boundary. Most important on IA64 |
106 | ACPI_RESOURCE_NAME_END_TAG) { | 79 | */ |
107 | return_ACPI_STATUS(AE_OK); | 80 | resource = *resource_ptr; |
108 | } | 81 | if (ACPI_IS_MISALIGNED(resource)) { |
109 | 82 | ACPI_WARNING((AE_INFO, | |
110 | /* Point to the next input AML resource */ | 83 | "Misaligned resource pointer %p", resource)); |
111 | 84 | } | |
112 | aml += acpi_ut_get_descriptor_length(aml); | ||
113 | |||
114 | /* Point to the next structure in the output buffer */ | ||
115 | 85 | ||
116 | resource = | 86 | /* Convert the AML byte stream resource to a local resource struct */ |
117 | ACPI_ADD_PTR(struct acpi_resource, resource, | 87 | |
118 | resource->length); | 88 | status = |
89 | acpi_rs_convert_aml_to_resource(resource, | ||
90 | ACPI_CAST_PTR(union aml_resource, | ||
91 | aml), | ||
92 | acpi_gbl_get_resource_dispatch | ||
93 | [resource_index]); | ||
94 | if (ACPI_FAILURE(status)) { | ||
95 | ACPI_EXCEPTION((AE_INFO, status, | ||
96 | "Could not convert AML resource (Type %X)", | ||
97 | *aml)); | ||
98 | return_ACPI_STATUS(status); | ||
119 | } | 99 | } |
120 | 100 | ||
121 | /* Did not find an end_tag resource descriptor */ | 101 | ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, |
102 | "Type %.2X, AmlLength %.2X InternalLength %.2X\n", | ||
103 | acpi_ut_get_resource_type(aml), length, | ||
104 | resource->length)); | ||
122 | 105 | ||
123 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 106 | /* Point to the next structure in the output buffer */ |
107 | |||
108 | *resource_ptr = ACPI_ADD_PTR(void, resource, resource->length); | ||
109 | return_ACPI_STATUS(AE_OK); | ||
124 | } | 110 | } |
125 | 111 | ||
126 | /******************************************************************************* | 112 | /******************************************************************************* |
@@ -150,11 +136,12 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
150 | u8 *end_aml = output_buffer + aml_size_needed; | 136 | u8 *end_aml = output_buffer + aml_size_needed; |
151 | acpi_status status; | 137 | acpi_status status; |
152 | 138 | ||
153 | ACPI_FUNCTION_TRACE("rs_convert_resources_to_aml"); | 139 | ACPI_FUNCTION_TRACE(rs_convert_resources_to_aml); |
154 | 140 | ||
155 | /* Walk the resource descriptor list, convert each descriptor */ | 141 | /* Walk the resource descriptor list, convert each descriptor */ |
156 | 142 | ||
157 | while (aml < end_aml) { | 143 | while (aml < end_aml) { |
144 | |||
158 | /* Validate the (internal) Resource Type */ | 145 | /* Validate the (internal) Resource Type */ |
159 | 146 | ||
160 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 147 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
@@ -191,6 +178,7 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
191 | /* Check for end-of-list, normal exit */ | 178 | /* Check for end-of-list, normal exit */ |
192 | 179 | ||
193 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | 180 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { |
181 | |||
194 | /* An End Tag indicates the end of the input Resource Template */ | 182 | /* An End Tag indicates the end of the input Resource Template */ |
195 | 183 | ||
196 | return_ACPI_STATUS(AE_OK); | 184 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index ed866cf1c6d2..faf6e106b785 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -81,9 +81,10 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
81 | u16 item_count = 0; | 81 | u16 item_count = 0; |
82 | u16 temp16 = 0; | 82 | u16 temp16 = 0; |
83 | 83 | ||
84 | ACPI_FUNCTION_TRACE("rs_get_resource"); | 84 | ACPI_FUNCTION_TRACE(rs_convert_aml_to_resource); |
85 | 85 | ||
86 | if (((acpi_native_uint) resource) & 0x3) { | 86 | if (((acpi_native_uint) resource) & 0x3) { |
87 | |||
87 | /* Each internal resource struct is expected to be 32-bit aligned */ | 88 | /* Each internal resource struct is expected to be 32-bit aligned */ |
88 | 89 | ||
89 | ACPI_WARNING((AE_INFO, | 90 | ACPI_WARNING((AE_INFO, |
@@ -295,9 +296,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
295 | 296 | ||
296 | exit: | 297 | exit: |
297 | if (!flags_mode) { | 298 | if (!flags_mode) { |
298 | /* Round the resource struct length up to the next 32-bit boundary */ | ||
299 | 299 | ||
300 | resource->length = ACPI_ROUND_UP_to_32_bITS(resource->length); | 300 | /* Round the resource struct length up to the next boundary (32 or 64) */ |
301 | |||
302 | resource->length = | ||
303 | (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); | ||
301 | } | 304 | } |
302 | return_ACPI_STATUS(AE_OK); | 305 | return_ACPI_STATUS(AE_OK); |
303 | } | 306 | } |
@@ -329,7 +332,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
329 | u16 temp16 = 0; | 332 | u16 temp16 = 0; |
330 | u16 item_count = 0; | 333 | u16 item_count = 0; |
331 | 334 | ||
332 | ACPI_FUNCTION_TRACE("rs_convert_resource_to_aml"); | 335 | ACPI_FUNCTION_TRACE(rs_convert_resource_to_aml); |
333 | 336 | ||
334 | /* | 337 | /* |
335 | * First table entry must be ACPI_RSC_INITxxx and must contain the | 338 | * First table entry must be ACPI_RSC_INITxxx and must contain the |
@@ -535,6 +538,7 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { | |||
535 | 538 | ||
536 | resource->data.extended_irq.interrupt_count = temp8; | 539 | resource->data.extended_irq.interrupt_count = temp8; |
537 | if (temp8 < 1) { | 540 | if (temp8 < 1) { |
541 | |||
538 | /* Must have at least one IRQ */ | 542 | /* Must have at least one IRQ */ |
539 | 543 | ||
540 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); | 544 | return_ACPI_STATUS(AE_AML_BAD_RESOURCE_LENGTH); |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 25b5aedd6612..a9cbee8e8b44 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -205,6 +205,7 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, | |||
205 | /* Length is stored differently for large and small descriptors */ | 205 | /* Length is stored differently for large and small descriptors */ |
206 | 206 | ||
207 | if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { | 207 | if (aml->small_header.descriptor_type & ACPI_RESOURCE_NAME_LARGE) { |
208 | |||
208 | /* Large descriptor -- bytes 1-2 contain the 16-bit length */ | 209 | /* Large descriptor -- bytes 1-2 contain the 16-bit length */ |
209 | 210 | ||
210 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, | 211 | ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, |
@@ -298,7 +299,8 @@ static u16 acpi_rs_strcpy(char *destination, char *source) | |||
298 | * string_ptr - (optional) where to store the actual | 299 | * string_ptr - (optional) where to store the actual |
299 | * resource_source string | 300 | * resource_source string |
300 | * | 301 | * |
301 | * RETURN: Length of the string plus NULL terminator, rounded up to 32 bit | 302 | * RETURN: Length of the string plus NULL terminator, rounded up to native |
303 | * word boundary | ||
302 | * | 304 | * |
303 | * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor | 305 | * DESCRIPTION: Copy the optional resource_source data from a raw AML descriptor |
304 | * to an internal resource descriptor | 306 | * to an internal resource descriptor |
@@ -328,6 +330,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
328 | * we add 1 to the minimum length. | 330 | * we add 1 to the minimum length. |
329 | */ | 331 | */ |
330 | if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { | 332 | if (total_length > (acpi_rsdesc_size) (minimum_length + 1)) { |
333 | |||
331 | /* Get the resource_source_index */ | 334 | /* Get the resource_source_index */ |
332 | 335 | ||
333 | resource_source->index = aml_resource_source[0]; | 336 | resource_source->index = aml_resource_source[0]; |
@@ -344,23 +347,26 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, | |||
344 | } | 347 | } |
345 | 348 | ||
346 | /* | 349 | /* |
347 | * In order for the struct_size to fall on a 32-bit boundary, calculate | 350 | * In order for the Resource length to be a multiple of the native |
348 | * the length of the string (+1 for the NULL terminator) and expand the | 351 | * word, calculate the length of the string (+1 for NULL terminator) |
349 | * struct_size to the next 32-bit boundary. | 352 | * and expand to the next word multiple. |
350 | * | 353 | * |
351 | * Zero the entire area of the buffer. | 354 | * Zero the entire area of the buffer. |
352 | */ | 355 | */ |
353 | total_length = | 356 | total_length = |
354 | ACPI_ROUND_UP_to_32_bITS(ACPI_STRLEN | 357 | (u32) |
355 | ((char *)&aml_resource_source[1]) + | 358 | ACPI_STRLEN(ACPI_CAST_PTR(char, &aml_resource_source[1])) + |
356 | 1); | 359 | 1; |
360 | total_length = (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); | ||
361 | |||
357 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); | 362 | ACPI_MEMSET(resource_source->string_ptr, 0, total_length); |
358 | 363 | ||
359 | /* Copy the resource_source string to the destination */ | 364 | /* Copy the resource_source string to the destination */ |
360 | 365 | ||
361 | resource_source->string_length = | 366 | resource_source->string_length = |
362 | acpi_rs_strcpy(resource_source->string_ptr, | 367 | acpi_rs_strcpy(resource_source->string_ptr, |
363 | (char *)&aml_resource_source[1]); | 368 | ACPI_CAST_PTR(char, |
369 | &aml_resource_source[1])); | ||
364 | 370 | ||
365 | return ((acpi_rs_length) total_length); | 371 | return ((acpi_rs_length) total_length); |
366 | } | 372 | } |
@@ -405,6 +411,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
405 | /* Non-zero string length indicates presence of a resource_source */ | 411 | /* Non-zero string length indicates presence of a resource_source */ |
406 | 412 | ||
407 | if (resource_source->string_length) { | 413 | if (resource_source->string_length) { |
414 | |||
408 | /* Point to the end of the AML descriptor */ | 415 | /* Point to the end of the AML descriptor */ |
409 | 416 | ||
410 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); | 417 | aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); |
@@ -415,7 +422,7 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
415 | 422 | ||
416 | /* Copy the resource_source string */ | 423 | /* Copy the resource_source string */ |
417 | 424 | ||
418 | ACPI_STRCPY((char *)&aml_resource_source[1], | 425 | ACPI_STRCPY(ACPI_CAST_PTR(char, &aml_resource_source[1]), |
419 | resource_source->string_ptr); | 426 | resource_source->string_ptr); |
420 | 427 | ||
421 | /* | 428 | /* |
@@ -435,9 +442,9 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
435 | * | 442 | * |
436 | * FUNCTION: acpi_rs_get_prt_method_data | 443 | * FUNCTION: acpi_rs_get_prt_method_data |
437 | * | 444 | * |
438 | * PARAMETERS: Handle - a handle to the containing object | 445 | * PARAMETERS: Node - Device node |
439 | * ret_buffer - a pointer to a buffer structure for the | 446 | * ret_buffer - Pointer to a buffer structure for the |
440 | * results | 447 | * results |
441 | * | 448 | * |
442 | * RETURN: Status | 449 | * RETURN: Status |
443 | * | 450 | * |
@@ -450,18 +457,19 @@ acpi_rs_set_resource_source(union aml_resource * aml, | |||
450 | ******************************************************************************/ | 457 | ******************************************************************************/ |
451 | 458 | ||
452 | acpi_status | 459 | acpi_status |
453 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | 460 | acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, |
461 | struct acpi_buffer * ret_buffer) | ||
454 | { | 462 | { |
455 | union acpi_operand_object *obj_desc; | 463 | union acpi_operand_object *obj_desc; |
456 | acpi_status status; | 464 | acpi_status status; |
457 | 465 | ||
458 | ACPI_FUNCTION_TRACE("rs_get_prt_method_data"); | 466 | ACPI_FUNCTION_TRACE(rs_get_prt_method_data); |
459 | 467 | ||
460 | /* Parameters guaranteed valid by caller */ | 468 | /* Parameters guaranteed valid by caller */ |
461 | 469 | ||
462 | /* Execute the method, no parameters */ | 470 | /* Execute the method, no parameters */ |
463 | 471 | ||
464 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRT, | 472 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT, |
465 | ACPI_BTYPE_PACKAGE, &obj_desc); | 473 | ACPI_BTYPE_PACKAGE, &obj_desc); |
466 | if (ACPI_FAILURE(status)) { | 474 | if (ACPI_FAILURE(status)) { |
467 | return_ACPI_STATUS(status); | 475 | return_ACPI_STATUS(status); |
@@ -483,9 +491,9 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
483 | * | 491 | * |
484 | * FUNCTION: acpi_rs_get_crs_method_data | 492 | * FUNCTION: acpi_rs_get_crs_method_data |
485 | * | 493 | * |
486 | * PARAMETERS: Handle - a handle to the containing object | 494 | * PARAMETERS: Node - Device node |
487 | * ret_buffer - a pointer to a buffer structure for the | 495 | * ret_buffer - Pointer to a buffer structure for the |
488 | * results | 496 | * results |
489 | * | 497 | * |
490 | * RETURN: Status | 498 | * RETURN: Status |
491 | * | 499 | * |
@@ -498,18 +506,19 @@ acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer * ret_buffer) | |||
498 | ******************************************************************************/ | 506 | ******************************************************************************/ |
499 | 507 | ||
500 | acpi_status | 508 | acpi_status |
501 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 509 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, |
510 | struct acpi_buffer *ret_buffer) | ||
502 | { | 511 | { |
503 | union acpi_operand_object *obj_desc; | 512 | union acpi_operand_object *obj_desc; |
504 | acpi_status status; | 513 | acpi_status status; |
505 | 514 | ||
506 | ACPI_FUNCTION_TRACE("rs_get_crs_method_data"); | 515 | ACPI_FUNCTION_TRACE(rs_get_crs_method_data); |
507 | 516 | ||
508 | /* Parameters guaranteed valid by caller */ | 517 | /* Parameters guaranteed valid by caller */ |
509 | 518 | ||
510 | /* Execute the method, no parameters */ | 519 | /* Execute the method, no parameters */ |
511 | 520 | ||
512 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__CRS, | 521 | status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS, |
513 | ACPI_BTYPE_BUFFER, &obj_desc); | 522 | ACPI_BTYPE_BUFFER, &obj_desc); |
514 | if (ACPI_FAILURE(status)) { | 523 | if (ACPI_FAILURE(status)) { |
515 | return_ACPI_STATUS(status); | 524 | return_ACPI_STATUS(status); |
@@ -522,7 +531,7 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
522 | */ | 531 | */ |
523 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); | 532 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); |
524 | 533 | ||
525 | /* on exit, we must delete the object returned by evaluate_object */ | 534 | /* On exit, we must delete the object returned by evaluate_object */ |
526 | 535 | ||
527 | acpi_ut_remove_reference(obj_desc); | 536 | acpi_ut_remove_reference(obj_desc); |
528 | return_ACPI_STATUS(status); | 537 | return_ACPI_STATUS(status); |
@@ -532,9 +541,9 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
532 | * | 541 | * |
533 | * FUNCTION: acpi_rs_get_prs_method_data | 542 | * FUNCTION: acpi_rs_get_prs_method_data |
534 | * | 543 | * |
535 | * PARAMETERS: Handle - a handle to the containing object | 544 | * PARAMETERS: Node - Device node |
536 | * ret_buffer - a pointer to a buffer structure for the | 545 | * ret_buffer - Pointer to a buffer structure for the |
537 | * results | 546 | * results |
538 | * | 547 | * |
539 | * RETURN: Status | 548 | * RETURN: Status |
540 | * | 549 | * |
@@ -548,18 +557,19 @@ acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
548 | 557 | ||
549 | #ifdef ACPI_FUTURE_USAGE | 558 | #ifdef ACPI_FUTURE_USAGE |
550 | acpi_status | 559 | acpi_status |
551 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | 560 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, |
561 | struct acpi_buffer *ret_buffer) | ||
552 | { | 562 | { |
553 | union acpi_operand_object *obj_desc; | 563 | union acpi_operand_object *obj_desc; |
554 | acpi_status status; | 564 | acpi_status status; |
555 | 565 | ||
556 | ACPI_FUNCTION_TRACE("rs_get_prs_method_data"); | 566 | ACPI_FUNCTION_TRACE(rs_get_prs_method_data); |
557 | 567 | ||
558 | /* Parameters guaranteed valid by caller */ | 568 | /* Parameters guaranteed valid by caller */ |
559 | 569 | ||
560 | /* Execute the method, no parameters */ | 570 | /* Execute the method, no parameters */ |
561 | 571 | ||
562 | status = acpi_ut_evaluate_object(handle, METHOD_NAME__PRS, | 572 | status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS, |
563 | ACPI_BTYPE_BUFFER, &obj_desc); | 573 | ACPI_BTYPE_BUFFER, &obj_desc); |
564 | if (ACPI_FAILURE(status)) { | 574 | if (ACPI_FAILURE(status)) { |
565 | return_ACPI_STATUS(status); | 575 | return_ACPI_STATUS(status); |
@@ -572,7 +582,7 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
572 | */ | 582 | */ |
573 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); | 583 | status = acpi_rs_create_resource_list(obj_desc, ret_buffer); |
574 | 584 | ||
575 | /* on exit, we must delete the object returned by evaluate_object */ | 585 | /* On exit, we must delete the object returned by evaluate_object */ |
576 | 586 | ||
577 | acpi_ut_remove_reference(obj_desc); | 587 | acpi_ut_remove_reference(obj_desc); |
578 | return_ACPI_STATUS(status); | 588 | return_ACPI_STATUS(status); |
@@ -583,10 +593,10 @@ acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer) | |||
583 | * | 593 | * |
584 | * FUNCTION: acpi_rs_get_method_data | 594 | * FUNCTION: acpi_rs_get_method_data |
585 | * | 595 | * |
586 | * PARAMETERS: Handle - a handle to the containing object | 596 | * PARAMETERS: Handle - Handle to the containing object |
587 | * Path - Path to method, relative to Handle | 597 | * Path - Path to method, relative to Handle |
588 | * ret_buffer - a pointer to a buffer structure for the | 598 | * ret_buffer - Pointer to a buffer structure for the |
589 | * results | 599 | * results |
590 | * | 600 | * |
591 | * RETURN: Status | 601 | * RETURN: Status |
592 | * | 602 | * |
@@ -605,7 +615,7 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
605 | union acpi_operand_object *obj_desc; | 615 | union acpi_operand_object *obj_desc; |
606 | acpi_status status; | 616 | acpi_status status; |
607 | 617 | ||
608 | ACPI_FUNCTION_TRACE("rs_get_method_data"); | 618 | ACPI_FUNCTION_TRACE(rs_get_method_data); |
609 | 619 | ||
610 | /* Parameters guaranteed valid by caller */ | 620 | /* Parameters guaranteed valid by caller */ |
611 | 621 | ||
@@ -634,9 +644,9 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
634 | * | 644 | * |
635 | * FUNCTION: acpi_rs_set_srs_method_data | 645 | * FUNCTION: acpi_rs_set_srs_method_data |
636 | * | 646 | * |
637 | * PARAMETERS: Handle - a handle to the containing object | 647 | * PARAMETERS: Node - Device node |
638 | * in_buffer - a pointer to a buffer structure of the | 648 | * in_buffer - Pointer to a buffer structure of the |
639 | * parameter | 649 | * parameter |
640 | * | 650 | * |
641 | * RETURN: Status | 651 | * RETURN: Status |
642 | * | 652 | * |
@@ -646,23 +656,37 @@ acpi_rs_get_method_data(acpi_handle handle, | |||
646 | * If the function fails an appropriate status will be returned | 656 | * If the function fails an appropriate status will be returned |
647 | * and the contents of the callers buffer is undefined. | 657 | * and the contents of the callers buffer is undefined. |
648 | * | 658 | * |
659 | * Note: Parameters guaranteed valid by caller | ||
660 | * | ||
649 | ******************************************************************************/ | 661 | ******************************************************************************/ |
650 | 662 | ||
651 | acpi_status | 663 | acpi_status |
652 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | 664 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, |
665 | struct acpi_buffer *in_buffer) | ||
653 | { | 666 | { |
654 | struct acpi_parameter_info info; | 667 | struct acpi_evaluate_info *info; |
655 | union acpi_operand_object *params[2]; | 668 | union acpi_operand_object *args[2]; |
656 | acpi_status status; | 669 | acpi_status status; |
657 | struct acpi_buffer buffer; | 670 | struct acpi_buffer buffer; |
658 | 671 | ||
659 | ACPI_FUNCTION_TRACE("rs_set_srs_method_data"); | 672 | ACPI_FUNCTION_TRACE(rs_set_srs_method_data); |
660 | 673 | ||
661 | /* Parameters guaranteed valid by caller */ | 674 | /* Allocate and initialize the evaluation information block */ |
675 | |||
676 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); | ||
677 | if (!info) { | ||
678 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
679 | } | ||
680 | |||
681 | info->prefix_node = node; | ||
682 | info->pathname = METHOD_NAME__SRS; | ||
683 | info->parameters = args; | ||
684 | info->parameter_type = ACPI_PARAM_ARGS; | ||
685 | info->flags = ACPI_IGNORE_RETURN_VALUE; | ||
662 | 686 | ||
663 | /* | 687 | /* |
664 | * The in_buffer parameter will point to a linked list of | 688 | * The in_buffer parameter will point to a linked list of |
665 | * resource parameters. It needs to be formatted into a | 689 | * resource parameters. It needs to be formatted into a |
666 | * byte stream to be sent in as an input parameter to _SRS | 690 | * byte stream to be sent in as an input parameter to _SRS |
667 | * | 691 | * |
668 | * Convert the linked list into a byte stream | 692 | * Convert the linked list into a byte stream |
@@ -670,41 +694,36 @@ acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *in_buffer) | |||
670 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 694 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
671 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); | 695 | status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); |
672 | if (ACPI_FAILURE(status)) { | 696 | if (ACPI_FAILURE(status)) { |
673 | return_ACPI_STATUS(status); | 697 | goto cleanup; |
674 | } | 698 | } |
675 | 699 | ||
676 | /* Init the param object */ | 700 | /* Create and initialize the method parameter object */ |
677 | 701 | ||
678 | params[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); | 702 | args[0] = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); |
679 | if (!params[0]) { | 703 | if (!args[0]) { |
680 | acpi_os_free(buffer.pointer); | 704 | /* |
681 | return_ACPI_STATUS(AE_NO_MEMORY); | 705 | * Must free the buffer allocated above (otherwise it is freed |
706 | * later) | ||
707 | */ | ||
708 | ACPI_FREE(buffer.pointer); | ||
709 | status = AE_NO_MEMORY; | ||
710 | goto cleanup; | ||
682 | } | 711 | } |
683 | 712 | ||
684 | /* Set up the parameter object */ | 713 | args[0]->buffer.length = (u32) buffer.length; |
685 | 714 | args[0]->buffer.pointer = buffer.pointer; | |
686 | params[0]->buffer.length = (u32) buffer.length; | 715 | args[0]->common.flags = AOPOBJ_DATA_VALID; |
687 | params[0]->buffer.pointer = buffer.pointer; | 716 | args[1] = NULL; |
688 | params[0]->common.flags = AOPOBJ_DATA_VALID; | ||
689 | params[1] = NULL; | ||
690 | |||
691 | info.node = handle; | ||
692 | info.parameters = params; | ||
693 | info.parameter_type = ACPI_PARAM_ARGS; | ||
694 | 717 | ||
695 | /* Execute the method, no return value */ | 718 | /* Execute the method, no return value is expected */ |
696 | 719 | ||
697 | status = acpi_ns_evaluate_relative(METHOD_NAME__SRS, &info); | 720 | status = acpi_ns_evaluate(info); |
698 | if (ACPI_SUCCESS(status)) { | ||
699 | /* Delete any return object (especially if implicit_return is enabled) */ | ||
700 | 721 | ||
701 | if (info.return_object) { | 722 | /* Clean up and return the status from acpi_ns_evaluate */ |
702 | acpi_ut_remove_reference(info.return_object); | ||
703 | } | ||
704 | } | ||
705 | 723 | ||
706 | /* Clean up and return the status from acpi_ns_evaluate_relative */ | 724 | acpi_ut_remove_reference(args[0]); |
707 | 725 | ||
708 | acpi_ut_remove_reference(params[0]); | 726 | cleanup: |
727 | ACPI_FREE(info); | ||
709 | return_ACPI_STATUS(status); | 728 | return_ACPI_STATUS(status); |
710 | } | 729 | } |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 88b67077aeeb..1999e2ab7daa 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -41,10 +41,9 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acresrc.h> | 45 | #include <acpi/acresrc.h> |
46 | #include <acpi/acnamesp.h> | ||
48 | 47 | ||
49 | #define _COMPONENT ACPI_RESOURCES | 48 | #define _COMPONENT ACPI_RESOURCES |
50 | ACPI_MODULE_NAME("rsxface") | 49 | ACPI_MODULE_NAME("rsxface") |
@@ -68,312 +67,262 @@ ACPI_MODULE_NAME("rsxface") | |||
68 | static acpi_status | 67 | static acpi_status |
69 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); | 68 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context); |
70 | 69 | ||
70 | static acpi_status | ||
71 | acpi_rs_validate_parameters(acpi_handle device_handle, | ||
72 | struct acpi_buffer *buffer, | ||
73 | struct acpi_namespace_node **return_node); | ||
74 | |||
71 | /******************************************************************************* | 75 | /******************************************************************************* |
72 | * | 76 | * |
73 | * FUNCTION: acpi_get_irq_routing_table | 77 | * FUNCTION: acpi_rs_validate_parameters |
74 | * | 78 | * |
75 | * PARAMETERS: device_handle - a handle to the Bus device we are querying | 79 | * PARAMETERS: device_handle - Handle to a device |
76 | * ret_buffer - a pointer to a buffer to receive the | 80 | * Buffer - Pointer to a data buffer |
77 | * current resources for the device | 81 | * return_node - Pointer to where the device node is returned |
78 | * | 82 | * |
79 | * RETURN: Status | 83 | * RETURN: Status |
80 | * | 84 | * |
81 | * DESCRIPTION: This function is called to get the IRQ routing table for a | 85 | * DESCRIPTION: Common parameter validation for resource interfaces |
82 | * specific bus. The caller must first acquire a handle for the | ||
83 | * desired bus. The routine table is placed in the buffer pointed | ||
84 | * to by the ret_buffer variable parameter. | ||
85 | * | ||
86 | * If the function fails an appropriate status will be returned | ||
87 | * and the value of ret_buffer is undefined. | ||
88 | * | ||
89 | * This function attempts to execute the _PRT method contained in | ||
90 | * the object indicated by the passed device_handle. | ||
91 | * | 86 | * |
92 | ******************************************************************************/ | 87 | ******************************************************************************/ |
93 | 88 | ||
94 | acpi_status | 89 | static acpi_status |
95 | acpi_get_irq_routing_table(acpi_handle device_handle, | 90 | acpi_rs_validate_parameters(acpi_handle device_handle, |
96 | struct acpi_buffer *ret_buffer) | 91 | struct acpi_buffer *buffer, |
92 | struct acpi_namespace_node **return_node) | ||
97 | { | 93 | { |
98 | acpi_status status; | 94 | acpi_status status; |
95 | struct acpi_namespace_node *node; | ||
99 | 96 | ||
100 | ACPI_FUNCTION_TRACE("acpi_get_irq_routing_table "); | 97 | ACPI_FUNCTION_TRACE(rs_validate_parameters); |
101 | 98 | ||
102 | /* | 99 | /* |
103 | * Must have a valid handle and buffer, So we have to have a handle | 100 | * Must have a valid handle to an ACPI device |
104 | * and a return buffer structure, and if there is a non-zero buffer length | ||
105 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
106 | * we'll be returning the needed buffer size, so keep going. | ||
107 | */ | 101 | */ |
108 | if (!device_handle) { | 102 | if (!device_handle) { |
109 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 103 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
110 | } | 104 | } |
111 | 105 | ||
112 | status = acpi_ut_validate_buffer(ret_buffer); | 106 | node = acpi_ns_map_handle_to_node(device_handle); |
107 | if (!node) { | ||
108 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
109 | } | ||
110 | |||
111 | if (node->type != ACPI_TYPE_DEVICE) { | ||
112 | return_ACPI_STATUS(AE_TYPE); | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * Validate the user buffer object | ||
117 | * | ||
118 | * if there is a non-zero buffer length we also need a valid pointer in | ||
119 | * the buffer. If it's a zero buffer length, we'll be returning the | ||
120 | * needed buffer size (later), so keep going. | ||
121 | */ | ||
122 | status = acpi_ut_validate_buffer(buffer); | ||
113 | if (ACPI_FAILURE(status)) { | 123 | if (ACPI_FAILURE(status)) { |
114 | return_ACPI_STATUS(status); | 124 | return_ACPI_STATUS(status); |
115 | } | 125 | } |
116 | 126 | ||
117 | status = acpi_rs_get_prt_method_data(device_handle, ret_buffer); | 127 | *return_node = node; |
118 | return_ACPI_STATUS(status); | 128 | return_ACPI_STATUS(AE_OK); |
119 | } | 129 | } |
120 | 130 | ||
121 | /******************************************************************************* | 131 | /******************************************************************************* |
122 | * | 132 | * |
123 | * FUNCTION: acpi_get_current_resources | 133 | * FUNCTION: acpi_get_irq_routing_table |
124 | * | 134 | * |
125 | * PARAMETERS: device_handle - a handle to the device object for the | 135 | * PARAMETERS: device_handle - Handle to the Bus device we are querying |
126 | * device we are querying | 136 | * ret_buffer - Pointer to a buffer to receive the |
127 | * ret_buffer - a pointer to a buffer to receive the | ||
128 | * current resources for the device | 137 | * current resources for the device |
129 | * | 138 | * |
130 | * RETURN: Status | 139 | * RETURN: Status |
131 | * | 140 | * |
132 | * DESCRIPTION: This function is called to get the current resources for a | 141 | * DESCRIPTION: This function is called to get the IRQ routing table for a |
133 | * specific device. The caller must first acquire a handle for | 142 | * specific bus. The caller must first acquire a handle for the |
134 | * the desired device. The resource data is placed in the buffer | 143 | * desired bus. The routine table is placed in the buffer pointed |
135 | * pointed to by the ret_buffer variable parameter. | 144 | * to by the ret_buffer variable parameter. |
136 | * | 145 | * |
137 | * If the function fails an appropriate status will be returned | 146 | * If the function fails an appropriate status will be returned |
138 | * and the value of ret_buffer is undefined. | 147 | * and the value of ret_buffer is undefined. |
139 | * | 148 | * |
140 | * This function attempts to execute the _CRS method contained in | 149 | * This function attempts to execute the _PRT method contained in |
141 | * the object indicated by the passed device_handle. | 150 | * the object indicated by the passed device_handle. |
142 | * | 151 | * |
143 | ******************************************************************************/ | 152 | ******************************************************************************/ |
144 | 153 | ||
145 | acpi_status | 154 | acpi_status |
146 | acpi_get_current_resources(acpi_handle device_handle, | 155 | acpi_get_irq_routing_table(acpi_handle device_handle, |
147 | struct acpi_buffer *ret_buffer) | 156 | struct acpi_buffer *ret_buffer) |
148 | { | 157 | { |
149 | acpi_status status; | 158 | acpi_status status; |
159 | struct acpi_namespace_node *node; | ||
150 | 160 | ||
151 | ACPI_FUNCTION_TRACE("acpi_get_current_resources"); | 161 | ACPI_FUNCTION_TRACE(acpi_get_irq_routing_table); |
152 | 162 | ||
153 | /* | 163 | /* Validate parameters then dispatch to internal routine */ |
154 | * Must have a valid handle and buffer, So we have to have a handle | ||
155 | * and a return buffer structure, and if there is a non-zero buffer length | ||
156 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
157 | * we'll be returning the needed buffer size, so keep going. | ||
158 | */ | ||
159 | if (!device_handle) { | ||
160 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
161 | } | ||
162 | 164 | ||
163 | status = acpi_ut_validate_buffer(ret_buffer); | 165 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
164 | if (ACPI_FAILURE(status)) { | 166 | if (ACPI_FAILURE(status)) { |
165 | return_ACPI_STATUS(status); | 167 | return_ACPI_STATUS(status); |
166 | } | 168 | } |
167 | 169 | ||
168 | status = acpi_rs_get_crs_method_data(device_handle, ret_buffer); | 170 | status = acpi_rs_get_prt_method_data(node, ret_buffer); |
169 | return_ACPI_STATUS(status); | 171 | return_ACPI_STATUS(status); |
170 | } | 172 | } |
171 | 173 | ||
172 | EXPORT_SYMBOL(acpi_get_current_resources); | 174 | ACPI_EXPORT_SYMBOL(acpi_get_irq_routing_table) |
173 | 175 | ||
174 | /******************************************************************************* | 176 | /******************************************************************************* |
175 | * | 177 | * |
176 | * FUNCTION: acpi_get_possible_resources | 178 | * FUNCTION: acpi_get_current_resources |
177 | * | 179 | * |
178 | * PARAMETERS: device_handle - a handle to the device object for the | 180 | * PARAMETERS: device_handle - Handle to the device object for the |
179 | * device we are querying | 181 | * device we are querying |
180 | * ret_buffer - a pointer to a buffer to receive the | 182 | * ret_buffer - Pointer to a buffer to receive the |
181 | * resources for the device | 183 | * current resources for the device |
182 | * | 184 | * |
183 | * RETURN: Status | 185 | * RETURN: Status |
184 | * | 186 | * |
185 | * DESCRIPTION: This function is called to get a list of the possible resources | 187 | * DESCRIPTION: This function is called to get the current resources for a |
186 | * for a specific device. The caller must first acquire a handle | 188 | * specific device. The caller must first acquire a handle for |
187 | * for the desired device. The resource data is placed in the | 189 | * the desired device. The resource data is placed in the buffer |
188 | * buffer pointed to by the ret_buffer variable. | 190 | * pointed to by the ret_buffer variable parameter. |
189 | * | 191 | * |
190 | * If the function fails an appropriate status will be returned | 192 | * If the function fails an appropriate status will be returned |
191 | * and the value of ret_buffer is undefined. | 193 | * and the value of ret_buffer is undefined. |
192 | * | 194 | * |
195 | * This function attempts to execute the _CRS method contained in | ||
196 | * the object indicated by the passed device_handle. | ||
197 | * | ||
193 | ******************************************************************************/ | 198 | ******************************************************************************/ |
194 | |||
195 | #ifdef ACPI_FUTURE_USAGE | ||
196 | acpi_status | 199 | acpi_status |
197 | acpi_get_possible_resources(acpi_handle device_handle, | 200 | acpi_get_current_resources(acpi_handle device_handle, |
198 | struct acpi_buffer *ret_buffer) | 201 | struct acpi_buffer *ret_buffer) |
199 | { | 202 | { |
200 | acpi_status status; | 203 | acpi_status status; |
204 | struct acpi_namespace_node *node; | ||
201 | 205 | ||
202 | ACPI_FUNCTION_TRACE("acpi_get_possible_resources"); | 206 | ACPI_FUNCTION_TRACE(acpi_get_current_resources); |
203 | 207 | ||
204 | /* | 208 | /* Validate parameters then dispatch to internal routine */ |
205 | * Must have a valid handle and buffer, So we have to have a handle | ||
206 | * and a return buffer structure, and if there is a non-zero buffer length | ||
207 | * we also need a valid pointer in the buffer. If it's a zero buffer length, | ||
208 | * we'll be returning the needed buffer size, so keep going. | ||
209 | */ | ||
210 | if (!device_handle) { | ||
211 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
212 | } | ||
213 | 209 | ||
214 | status = acpi_ut_validate_buffer(ret_buffer); | 210 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
215 | if (ACPI_FAILURE(status)) { | 211 | if (ACPI_FAILURE(status)) { |
216 | return_ACPI_STATUS(status); | 212 | return_ACPI_STATUS(status); |
217 | } | 213 | } |
218 | 214 | ||
219 | status = acpi_rs_get_prs_method_data(device_handle, ret_buffer); | 215 | status = acpi_rs_get_crs_method_data(node, ret_buffer); |
220 | return_ACPI_STATUS(status); | 216 | return_ACPI_STATUS(status); |
221 | } | 217 | } |
222 | 218 | ||
223 | EXPORT_SYMBOL(acpi_get_possible_resources); | 219 | ACPI_EXPORT_SYMBOL(acpi_get_current_resources) |
224 | #endif /* ACPI_FUTURE_USAGE */ | ||
225 | 220 | ||
221 | #ifdef ACPI_FUTURE_USAGE | ||
226 | /******************************************************************************* | 222 | /******************************************************************************* |
227 | * | 223 | * |
228 | * FUNCTION: acpi_walk_resources | 224 | * FUNCTION: acpi_get_possible_resources |
229 | * | 225 | * |
230 | * PARAMETERS: device_handle - Handle to the device object for the | 226 | * PARAMETERS: device_handle - Handle to the device object for the |
231 | * device we are querying | 227 | * device we are querying |
232 | * Name - Method name of the resources we want | 228 | * ret_buffer - Pointer to a buffer to receive the |
233 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | 229 | * resources for the device |
234 | * user_function - Called for each resource | ||
235 | * Context - Passed to user_function | ||
236 | * | 230 | * |
237 | * RETURN: Status | 231 | * RETURN: Status |
238 | * | 232 | * |
239 | * DESCRIPTION: Retrieves the current or possible resource list for the | 233 | * DESCRIPTION: This function is called to get a list of the possible resources |
240 | * specified device. The user_function is called once for | 234 | * for a specific device. The caller must first acquire a handle |
241 | * each resource in the list. | 235 | * for the desired device. The resource data is placed in the |
236 | * buffer pointed to by the ret_buffer variable. | ||
237 | * | ||
238 | * If the function fails an appropriate status will be returned | ||
239 | * and the value of ret_buffer is undefined. | ||
242 | * | 240 | * |
243 | ******************************************************************************/ | 241 | ******************************************************************************/ |
244 | |||
245 | acpi_status | 242 | acpi_status |
246 | acpi_walk_resources(acpi_handle device_handle, | 243 | acpi_get_possible_resources(acpi_handle device_handle, |
247 | char *name, | 244 | struct acpi_buffer *ret_buffer) |
248 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context) | ||
249 | { | 245 | { |
250 | acpi_status status; | 246 | acpi_status status; |
251 | struct acpi_buffer buffer; | 247 | struct acpi_namespace_node *node; |
252 | struct acpi_resource *resource; | ||
253 | struct acpi_resource *resource_end; | ||
254 | |||
255 | ACPI_FUNCTION_TRACE("acpi_walk_resources"); | ||
256 | |||
257 | /* Parameter validation */ | ||
258 | 248 | ||
259 | if (!device_handle || !user_function || !name || | 249 | ACPI_FUNCTION_TRACE(acpi_get_possible_resources); |
260 | (ACPI_STRNCMP(name, METHOD_NAME__CRS, sizeof(METHOD_NAME__CRS)) && | ||
261 | ACPI_STRNCMP(name, METHOD_NAME__PRS, sizeof(METHOD_NAME__PRS)))) { | ||
262 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
263 | } | ||
264 | 250 | ||
265 | /* Get the _CRS or _PRS resource list */ | 251 | /* Validate parameters then dispatch to internal routine */ |
266 | 252 | ||
267 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 253 | status = acpi_rs_validate_parameters(device_handle, ret_buffer, &node); |
268 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
269 | if (ACPI_FAILURE(status)) { | 254 | if (ACPI_FAILURE(status)) { |
270 | return_ACPI_STATUS(status); | 255 | return_ACPI_STATUS(status); |
271 | } | 256 | } |
272 | 257 | ||
273 | /* Buffer now contains the resource list */ | 258 | status = acpi_rs_get_prs_method_data(node, ret_buffer); |
274 | |||
275 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); | ||
276 | resource_end = | ||
277 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); | ||
278 | |||
279 | /* Walk the resource list until the end_tag is found (or buffer end) */ | ||
280 | |||
281 | while (resource < resource_end) { | ||
282 | /* Sanity check the resource */ | ||
283 | |||
284 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | ||
285 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
286 | break; | ||
287 | } | ||
288 | |||
289 | /* Invoke the user function, abort on any error returned */ | ||
290 | |||
291 | status = user_function(resource, context); | ||
292 | if (ACPI_FAILURE(status)) { | ||
293 | if (status == AE_CTRL_TERMINATE) { | ||
294 | /* This is an OK termination by the user function */ | ||
295 | |||
296 | status = AE_OK; | ||
297 | } | ||
298 | break; | ||
299 | } | ||
300 | |||
301 | /* end_tag indicates end-of-list */ | ||
302 | |||
303 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | ||
304 | break; | ||
305 | } | ||
306 | |||
307 | /* Get the next resource descriptor */ | ||
308 | |||
309 | resource = | ||
310 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
311 | resource->length); | ||
312 | } | ||
313 | |||
314 | ACPI_MEM_FREE(buffer.pointer); | ||
315 | return_ACPI_STATUS(status); | 259 | return_ACPI_STATUS(status); |
316 | } | 260 | } |
317 | 261 | ||
318 | EXPORT_SYMBOL(acpi_walk_resources); | 262 | ACPI_EXPORT_SYMBOL(acpi_get_possible_resources) |
263 | #endif /* ACPI_FUTURE_USAGE */ | ||
319 | 264 | ||
320 | /******************************************************************************* | 265 | /******************************************************************************* |
321 | * | 266 | * |
322 | * FUNCTION: acpi_set_current_resources | 267 | * FUNCTION: acpi_set_current_resources |
323 | * | 268 | * |
324 | * PARAMETERS: device_handle - a handle to the device object for the | 269 | * PARAMETERS: device_handle - Handle to the device object for the |
325 | * device we are changing the resources of | 270 | * device we are setting resources |
326 | * in_buffer - a pointer to a buffer containing the | 271 | * in_buffer - Pointer to a buffer containing the |
327 | * resources to be set for the device | 272 | * resources to be set for the device |
328 | * | 273 | * |
329 | * RETURN: Status | 274 | * RETURN: Status |
330 | * | 275 | * |
331 | * DESCRIPTION: This function is called to set the current resources for a | 276 | * DESCRIPTION: This function is called to set the current resources for a |
332 | * specific device. The caller must first acquire a handle for | 277 | * specific device. The caller must first acquire a handle for |
333 | * the desired device. The resource data is passed to the routine | 278 | * the desired device. The resource data is passed to the routine |
334 | * the buffer pointed to by the in_buffer variable. | 279 | * the buffer pointed to by the in_buffer variable. |
335 | * | 280 | * |
336 | ******************************************************************************/ | 281 | ******************************************************************************/ |
337 | |||
338 | acpi_status | 282 | acpi_status |
339 | acpi_set_current_resources(acpi_handle device_handle, | 283 | acpi_set_current_resources(acpi_handle device_handle, |
340 | struct acpi_buffer *in_buffer) | 284 | struct acpi_buffer *in_buffer) |
341 | { | 285 | { |
342 | acpi_status status; | 286 | acpi_status status; |
287 | struct acpi_namespace_node *node; | ||
343 | 288 | ||
344 | ACPI_FUNCTION_TRACE("acpi_set_current_resources"); | 289 | ACPI_FUNCTION_TRACE(acpi_set_current_resources); |
345 | 290 | ||
346 | /* Must have a valid handle and buffer */ | 291 | /* Validate the buffer, don't allow zero length */ |
347 | 292 | ||
348 | if ((!device_handle) || | 293 | if ((!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { |
349 | (!in_buffer) || (!in_buffer->pointer) || (!in_buffer->length)) { | ||
350 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 294 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
351 | } | 295 | } |
352 | 296 | ||
353 | status = acpi_rs_set_srs_method_data(device_handle, in_buffer); | 297 | /* Validate parameters then dispatch to internal routine */ |
298 | |||
299 | status = acpi_rs_validate_parameters(device_handle, in_buffer, &node); | ||
300 | if (ACPI_FAILURE(status)) { | ||
301 | return_ACPI_STATUS(status); | ||
302 | } | ||
303 | |||
304 | status = acpi_rs_set_srs_method_data(node, in_buffer); | ||
354 | return_ACPI_STATUS(status); | 305 | return_ACPI_STATUS(status); |
355 | } | 306 | } |
356 | 307 | ||
357 | EXPORT_SYMBOL(acpi_set_current_resources); | 308 | ACPI_EXPORT_SYMBOL(acpi_set_current_resources) |
358 | 309 | ||
359 | /****************************************************************************** | 310 | /****************************************************************************** |
360 | * | 311 | * |
361 | * FUNCTION: acpi_resource_to_address64 | 312 | * FUNCTION: acpi_resource_to_address64 |
362 | * | 313 | * |
363 | * PARAMETERS: Resource - Pointer to a resource | 314 | * PARAMETERS: Resource - Pointer to a resource |
364 | * Out - Pointer to the users's return | 315 | * Out - Pointer to the users's return buffer |
365 | * buffer (a struct | 316 | * (a struct acpi_resource_address64) |
366 | * struct acpi_resource_address64) | ||
367 | * | 317 | * |
368 | * RETURN: Status | 318 | * RETURN: Status |
369 | * | 319 | * |
370 | * DESCRIPTION: If the resource is an address16, address32, or address64, | 320 | * DESCRIPTION: If the resource is an address16, address32, or address64, |
371 | * copy it to the address64 return buffer. This saves the | 321 | * copy it to the address64 return buffer. This saves the |
372 | * caller from having to duplicate code for different-sized | 322 | * caller from having to duplicate code for different-sized |
373 | * addresses. | 323 | * addresses. |
374 | * | 324 | * |
375 | ******************************************************************************/ | 325 | ******************************************************************************/ |
376 | |||
377 | acpi_status | 326 | acpi_status |
378 | acpi_resource_to_address64(struct acpi_resource *resource, | 327 | acpi_resource_to_address64(struct acpi_resource *resource, |
379 | struct acpi_resource_address64 *out) | 328 | struct acpi_resource_address64 *out) |
@@ -415,18 +364,18 @@ acpi_resource_to_address64(struct acpi_resource *resource, | |||
415 | return (AE_OK); | 364 | return (AE_OK); |
416 | } | 365 | } |
417 | 366 | ||
418 | EXPORT_SYMBOL(acpi_resource_to_address64); | 367 | ACPI_EXPORT_SYMBOL(acpi_resource_to_address64) |
419 | 368 | ||
420 | /******************************************************************************* | 369 | /******************************************************************************* |
421 | * | 370 | * |
422 | * FUNCTION: acpi_get_vendor_resource | 371 | * FUNCTION: acpi_get_vendor_resource |
423 | * | 372 | * |
424 | * PARAMETERS: device_handle - Handle for the parent device object | 373 | * PARAMETERS: device_handle - Handle for the parent device object |
425 | * Name - Method name for the parent resource | 374 | * Name - Method name for the parent resource |
426 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | 375 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) |
427 | * Uuid - Pointer to the UUID to be matched. | 376 | * Uuid - Pointer to the UUID to be matched. |
428 | * includes both subtype and 16-byte UUID | 377 | * includes both subtype and 16-byte UUID |
429 | * ret_buffer - Where the vendor resource is returned | 378 | * ret_buffer - Where the vendor resource is returned |
430 | * | 379 | * |
431 | * RETURN: Status | 380 | * RETURN: Status |
432 | * | 381 | * |
@@ -435,7 +384,6 @@ EXPORT_SYMBOL(acpi_resource_to_address64); | |||
435 | * UUID subtype. Returns a struct acpi_resource of type Vendor. | 384 | * UUID subtype. Returns a struct acpi_resource of type Vendor. |
436 | * | 385 | * |
437 | ******************************************************************************/ | 386 | ******************************************************************************/ |
438 | |||
439 | acpi_status | 387 | acpi_status |
440 | acpi_get_vendor_resource(acpi_handle device_handle, | 388 | acpi_get_vendor_resource(acpi_handle device_handle, |
441 | char *name, | 389 | char *name, |
@@ -467,18 +415,19 @@ acpi_get_vendor_resource(acpi_handle device_handle, | |||
467 | return (info.status); | 415 | return (info.status); |
468 | } | 416 | } |
469 | 417 | ||
418 | ACPI_EXPORT_SYMBOL(acpi_get_vendor_resource) | ||
419 | |||
470 | /******************************************************************************* | 420 | /******************************************************************************* |
471 | * | 421 | * |
472 | * FUNCTION: acpi_rs_match_vendor_resource | 422 | * FUNCTION: acpi_rs_match_vendor_resource |
473 | * | 423 | * |
474 | * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK | 424 | * PARAMETERS: acpi_walk_resource_callback |
475 | * | 425 | * |
476 | * RETURN: Status | 426 | * RETURN: Status |
477 | * | 427 | * |
478 | * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID | 428 | * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID |
479 | * | 429 | * |
480 | ******************************************************************************/ | 430 | ******************************************************************************/ |
481 | |||
482 | static acpi_status | 431 | static acpi_status |
483 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | 432 | acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) |
484 | { | 433 | { |
@@ -526,3 +475,101 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context) | |||
526 | info->status = AE_OK; | 475 | info->status = AE_OK; |
527 | return (AE_CTRL_TERMINATE); | 476 | return (AE_CTRL_TERMINATE); |
528 | } | 477 | } |
478 | |||
479 | ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource) | ||
480 | |||
481 | /******************************************************************************* | ||
482 | * | ||
483 | * FUNCTION: acpi_walk_resources | ||
484 | * | ||
485 | * PARAMETERS: device_handle - Handle to the device object for the | ||
486 | * device we are querying | ||
487 | * Name - Method name of the resources we want | ||
488 | * (METHOD_NAME__CRS or METHOD_NAME__PRS) | ||
489 | * user_function - Called for each resource | ||
490 | * Context - Passed to user_function | ||
491 | * | ||
492 | * RETURN: Status | ||
493 | * | ||
494 | * DESCRIPTION: Retrieves the current or possible resource list for the | ||
495 | * specified device. The user_function is called once for | ||
496 | * each resource in the list. | ||
497 | * | ||
498 | ******************************************************************************/ | ||
499 | |||
500 | acpi_status | ||
501 | acpi_walk_resources(acpi_handle device_handle, | ||
502 | char *name, | ||
503 | acpi_walk_resource_callback user_function, void *context) | ||
504 | { | ||
505 | acpi_status status; | ||
506 | struct acpi_buffer buffer; | ||
507 | struct acpi_resource *resource; | ||
508 | struct acpi_resource *resource_end; | ||
509 | |||
510 | ACPI_FUNCTION_TRACE(acpi_walk_resources); | ||
511 | |||
512 | /* Parameter validation */ | ||
513 | |||
514 | if (!device_handle || !user_function || !name || | ||
515 | (!ACPI_COMPARE_NAME(name, METHOD_NAME__CRS) && | ||
516 | !ACPI_COMPARE_NAME(name, METHOD_NAME__PRS))) { | ||
517 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
518 | } | ||
519 | |||
520 | /* Get the _CRS or _PRS resource list */ | ||
521 | |||
522 | buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; | ||
523 | status = acpi_rs_get_method_data(device_handle, name, &buffer); | ||
524 | if (ACPI_FAILURE(status)) { | ||
525 | return_ACPI_STATUS(status); | ||
526 | } | ||
527 | |||
528 | /* Buffer now contains the resource list */ | ||
529 | |||
530 | resource = ACPI_CAST_PTR(struct acpi_resource, buffer.pointer); | ||
531 | resource_end = | ||
532 | ACPI_ADD_PTR(struct acpi_resource, buffer.pointer, buffer.length); | ||
533 | |||
534 | /* Walk the resource list until the end_tag is found (or buffer end) */ | ||
535 | |||
536 | while (resource < resource_end) { | ||
537 | |||
538 | /* Sanity check the resource */ | ||
539 | |||
540 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | ||
541 | status = AE_AML_INVALID_RESOURCE_TYPE; | ||
542 | break; | ||
543 | } | ||
544 | |||
545 | /* Invoke the user function, abort on any error returned */ | ||
546 | |||
547 | status = user_function(resource, context); | ||
548 | if (ACPI_FAILURE(status)) { | ||
549 | if (status == AE_CTRL_TERMINATE) { | ||
550 | |||
551 | /* This is an OK termination by the user function */ | ||
552 | |||
553 | status = AE_OK; | ||
554 | } | ||
555 | break; | ||
556 | } | ||
557 | |||
558 | /* end_tag indicates end-of-list */ | ||
559 | |||
560 | if (resource->type == ACPI_RESOURCE_TYPE_END_TAG) { | ||
561 | break; | ||
562 | } | ||
563 | |||
564 | /* Get the next resource descriptor */ | ||
565 | |||
566 | resource = | ||
567 | ACPI_ADD_PTR(struct acpi_resource, resource, | ||
568 | resource->length); | ||
569 | } | ||
570 | |||
571 | ACPI_FREE(buffer.pointer); | ||
572 | return_ACPI_STATUS(status); | ||
573 | } | ||
574 | |||
575 | ACPI_EXPORT_SYMBOL(acpi_walk_resources) | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index a0ab828b2cc5..f8316a05ede7 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -142,7 +142,7 @@ static void acpi_device_register(struct acpi_device *device, | |||
142 | create_sysfs_device_files(device); | 142 | create_sysfs_device_files(device); |
143 | } | 143 | } |
144 | 144 | ||
145 | static int acpi_device_unregister(struct acpi_device *device, int type) | 145 | static void acpi_device_unregister(struct acpi_device *device, int type) |
146 | { | 146 | { |
147 | spin_lock(&acpi_device_lock); | 147 | spin_lock(&acpi_device_lock); |
148 | if (device->parent) { | 148 | if (device->parent) { |
@@ -158,7 +158,6 @@ static int acpi_device_unregister(struct acpi_device *device, int type) | |||
158 | acpi_detach_data(device->handle, acpi_bus_data_handler); | 158 | acpi_detach_data(device->handle, acpi_bus_data_handler); |
159 | remove_sysfs_device_files(device); | 159 | remove_sysfs_device_files(device); |
160 | kobject_unregister(&device->kobj); | 160 | kobject_unregister(&device->kobj); |
161 | return 0; | ||
162 | } | 161 | } |
163 | 162 | ||
164 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) | 163 | void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) |
@@ -234,12 +233,9 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
234 | 233 | ||
235 | int acpi_match_ids(struct acpi_device *device, char *ids) | 234 | int acpi_match_ids(struct acpi_device *device, char *ids) |
236 | { | 235 | { |
237 | int error = 0; | ||
238 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
239 | |||
240 | if (device->flags.hardware_id) | 236 | if (device->flags.hardware_id) |
241 | if (strstr(ids, device->pnp.hardware_id)) | 237 | if (strstr(ids, device->pnp.hardware_id)) |
242 | goto Done; | 238 | return 0; |
243 | 239 | ||
244 | if (device->flags.compatible_ids) { | 240 | if (device->flags.compatible_ids) { |
245 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; | 241 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; |
@@ -248,15 +244,10 @@ int acpi_match_ids(struct acpi_device *device, char *ids) | |||
248 | /* compare multiple _CID entries against driver ids */ | 244 | /* compare multiple _CID entries against driver ids */ |
249 | for (i = 0; i < cid_list->count; i++) { | 245 | for (i = 0; i < cid_list->count; i++) { |
250 | if (strstr(ids, cid_list->id[i].value)) | 246 | if (strstr(ids, cid_list->id[i].value)) |
251 | goto Done; | 247 | return 0; |
252 | } | 248 | } |
253 | } | 249 | } |
254 | error = -ENOENT; | 250 | return -ENOENT; |
255 | |||
256 | Done: | ||
257 | if (buffer.pointer) | ||
258 | acpi_os_free(buffer.pointer); | ||
259 | return error; | ||
260 | } | 251 | } |
261 | 252 | ||
262 | static acpi_status | 253 | static acpi_status |
@@ -441,10 +432,7 @@ acpi_eject_store(struct acpi_device *device, const char *buf, size_t count) | |||
441 | islockable = device->flags.lockable; | 432 | islockable = device->flags.lockable; |
442 | handle = device->handle; | 433 | handle = device->handle; |
443 | 434 | ||
444 | if (type == ACPI_TYPE_PROCESSOR) | 435 | result = acpi_bus_trim(device, 1); |
445 | result = acpi_bus_trim(device, 0); | ||
446 | else | ||
447 | result = acpi_bus_trim(device, 1); | ||
448 | 436 | ||
449 | if (!result) | 437 | if (!result) |
450 | result = acpi_eject_operation(handle, islockable); | 438 | result = acpi_eject_operation(handle, islockable); |
@@ -471,7 +459,6 @@ static int acpi_bus_get_perf_flags(struct acpi_device *device) | |||
471 | -------------------------------------------------------------------------- */ | 459 | -------------------------------------------------------------------------- */ |
472 | 460 | ||
473 | static LIST_HEAD(acpi_bus_drivers); | 461 | static LIST_HEAD(acpi_bus_drivers); |
474 | static DECLARE_MUTEX(acpi_bus_drivers_lock); | ||
475 | 462 | ||
476 | /** | 463 | /** |
477 | * acpi_bus_match - match device IDs to driver's supported IDs | 464 | * acpi_bus_match - match device IDs to driver's supported IDs |
@@ -548,10 +535,9 @@ static int acpi_start_single_object(struct acpi_device *device) | |||
548 | return_VALUE(result); | 535 | return_VALUE(result); |
549 | } | 536 | } |
550 | 537 | ||
551 | static int acpi_driver_attach(struct acpi_driver *drv) | 538 | static void acpi_driver_attach(struct acpi_driver *drv) |
552 | { | 539 | { |
553 | struct list_head *node, *next; | 540 | struct list_head *node, *next; |
554 | int count = 0; | ||
555 | 541 | ||
556 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); | 542 | ACPI_FUNCTION_TRACE("acpi_driver_attach"); |
557 | 543 | ||
@@ -568,7 +554,6 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
568 | if (!acpi_bus_driver_init(dev, drv)) { | 554 | if (!acpi_bus_driver_init(dev, drv)) { |
569 | acpi_start_single_object(dev); | 555 | acpi_start_single_object(dev); |
570 | atomic_inc(&drv->references); | 556 | atomic_inc(&drv->references); |
571 | count++; | ||
572 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 557 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
573 | "Found driver [%s] for device [%s]\n", | 558 | "Found driver [%s] for device [%s]\n", |
574 | drv->name, dev->pnp.bus_id)); | 559 | drv->name, dev->pnp.bus_id)); |
@@ -577,10 +562,9 @@ static int acpi_driver_attach(struct acpi_driver *drv) | |||
577 | spin_lock(&acpi_device_lock); | 562 | spin_lock(&acpi_device_lock); |
578 | } | 563 | } |
579 | spin_unlock(&acpi_device_lock); | 564 | spin_unlock(&acpi_device_lock); |
580 | return_VALUE(count); | ||
581 | } | 565 | } |
582 | 566 | ||
583 | static int acpi_driver_detach(struct acpi_driver *drv) | 567 | static void acpi_driver_detach(struct acpi_driver *drv) |
584 | { | 568 | { |
585 | struct list_head *node, *next; | 569 | struct list_head *node, *next; |
586 | 570 | ||
@@ -602,7 +586,6 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
602 | } | 586 | } |
603 | } | 587 | } |
604 | spin_unlock(&acpi_device_lock); | 588 | spin_unlock(&acpi_device_lock); |
605 | return_VALUE(0); | ||
606 | } | 589 | } |
607 | 590 | ||
608 | /** | 591 | /** |
@@ -610,28 +593,22 @@ static int acpi_driver_detach(struct acpi_driver *drv) | |||
610 | * @driver: driver being registered | 593 | * @driver: driver being registered |
611 | * | 594 | * |
612 | * Registers a driver with the ACPI bus. Searches the namespace for all | 595 | * Registers a driver with the ACPI bus. Searches the namespace for all |
613 | * devices that match the driver's criteria and binds. Returns the | 596 | * devices that match the driver's criteria and binds. Returns zero for |
614 | * number of devices that were claimed by the driver, or a negative | 597 | * success or a negative error status for failure. |
615 | * error status for failure. | ||
616 | */ | 598 | */ |
617 | int acpi_bus_register_driver(struct acpi_driver *driver) | 599 | int acpi_bus_register_driver(struct acpi_driver *driver) |
618 | { | 600 | { |
619 | int count; | ||
620 | |||
621 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); | 601 | ACPI_FUNCTION_TRACE("acpi_bus_register_driver"); |
622 | 602 | ||
623 | if (acpi_disabled) | 603 | if (acpi_disabled) |
624 | return_VALUE(-ENODEV); | 604 | return_VALUE(-ENODEV); |
625 | 605 | ||
626 | if (!driver) | ||
627 | return_VALUE(-EINVAL); | ||
628 | |||
629 | spin_lock(&acpi_device_lock); | 606 | spin_lock(&acpi_device_lock); |
630 | list_add_tail(&driver->node, &acpi_bus_drivers); | 607 | list_add_tail(&driver->node, &acpi_bus_drivers); |
631 | spin_unlock(&acpi_device_lock); | 608 | spin_unlock(&acpi_device_lock); |
632 | count = acpi_driver_attach(driver); | 609 | acpi_driver_attach(driver); |
633 | 610 | ||
634 | return_VALUE(count); | 611 | return_VALUE(0); |
635 | } | 612 | } |
636 | 613 | ||
637 | EXPORT_SYMBOL(acpi_bus_register_driver); | 614 | EXPORT_SYMBOL(acpi_bus_register_driver); |
@@ -643,23 +620,16 @@ EXPORT_SYMBOL(acpi_bus_register_driver); | |||
643 | * Unregisters a driver with the ACPI bus. Searches the namespace for all | 620 | * Unregisters a driver with the ACPI bus. Searches the namespace for all |
644 | * devices that match the driver's criteria and unbinds. | 621 | * devices that match the driver's criteria and unbinds. |
645 | */ | 622 | */ |
646 | int acpi_bus_unregister_driver(struct acpi_driver *driver) | 623 | void acpi_bus_unregister_driver(struct acpi_driver *driver) |
647 | { | 624 | { |
648 | int error = 0; | 625 | acpi_driver_detach(driver); |
649 | 626 | ||
650 | ACPI_FUNCTION_TRACE("acpi_bus_unregister_driver"); | 627 | if (!atomic_read(&driver->references)) { |
651 | 628 | spin_lock(&acpi_device_lock); | |
652 | if (driver) { | 629 | list_del_init(&driver->node); |
653 | acpi_driver_detach(driver); | 630 | spin_unlock(&acpi_device_lock); |
654 | 631 | } | |
655 | if (!atomic_read(&driver->references)) { | 632 | return; |
656 | spin_lock(&acpi_device_lock); | ||
657 | list_del_init(&driver->node); | ||
658 | spin_unlock(&acpi_device_lock); | ||
659 | } | ||
660 | } else | ||
661 | error = -EINVAL; | ||
662 | return_VALUE(error); | ||
663 | } | 633 | } |
664 | 634 | ||
665 | EXPORT_SYMBOL(acpi_bus_unregister_driver); | 635 | EXPORT_SYMBOL(acpi_bus_unregister_driver); |
@@ -1371,6 +1341,100 @@ static int acpi_bus_scan_fixed(struct acpi_device *root) | |||
1371 | return_VALUE(result); | 1341 | return_VALUE(result); |
1372 | } | 1342 | } |
1373 | 1343 | ||
1344 | |||
1345 | static inline struct acpi_device * to_acpi_dev(struct device * dev) | ||
1346 | { | ||
1347 | return container_of(dev, struct acpi_device, dev); | ||
1348 | } | ||
1349 | |||
1350 | |||
1351 | static int root_suspend(struct acpi_device * acpi_dev, pm_message_t state) | ||
1352 | { | ||
1353 | struct acpi_device * dev, * next; | ||
1354 | int result; | ||
1355 | |||
1356 | spin_lock(&acpi_device_lock); | ||
1357 | list_for_each_entry_safe_reverse(dev, next, &acpi_device_list, g_list) { | ||
1358 | if (dev->driver && dev->driver->ops.suspend) { | ||
1359 | spin_unlock(&acpi_device_lock); | ||
1360 | result = dev->driver->ops.suspend(dev, 0); | ||
1361 | if (result) { | ||
1362 | printk(KERN_ERR PREFIX "[%s - %s] Suspend failed: %d\n", | ||
1363 | acpi_device_name(dev), | ||
1364 | acpi_device_bid(dev), result); | ||
1365 | } | ||
1366 | spin_lock(&acpi_device_lock); | ||
1367 | } | ||
1368 | } | ||
1369 | spin_unlock(&acpi_device_lock); | ||
1370 | return 0; | ||
1371 | } | ||
1372 | |||
1373 | |||
1374 | static int acpi_device_suspend(struct device * dev, pm_message_t state) | ||
1375 | { | ||
1376 | struct acpi_device * acpi_dev = to_acpi_dev(dev); | ||
1377 | |||
1378 | /* | ||
1379 | * For now, we should only register 1 generic device - | ||
1380 | * the ACPI root device - and from there, we walk the | ||
1381 | * tree of ACPI devices to suspend each one using the | ||
1382 | * ACPI driver methods. | ||
1383 | */ | ||
1384 | if (acpi_dev->handle == ACPI_ROOT_OBJECT) | ||
1385 | root_suspend(acpi_dev, state); | ||
1386 | return 0; | ||
1387 | } | ||
1388 | |||
1389 | |||
1390 | |||
1391 | static int root_resume(struct acpi_device * acpi_dev) | ||
1392 | { | ||
1393 | struct acpi_device * dev, * next; | ||
1394 | int result; | ||
1395 | |||
1396 | spin_lock(&acpi_device_lock); | ||
1397 | list_for_each_entry_safe(dev, next, &acpi_device_list, g_list) { | ||
1398 | if (dev->driver && dev->driver->ops.resume) { | ||
1399 | spin_unlock(&acpi_device_lock); | ||
1400 | result = dev->driver->ops.resume(dev, 0); | ||
1401 | if (result) { | ||
1402 | printk(KERN_ERR PREFIX "[%s - %s] resume failed: %d\n", | ||
1403 | acpi_device_name(dev), | ||
1404 | acpi_device_bid(dev), result); | ||
1405 | } | ||
1406 | spin_lock(&acpi_device_lock); | ||
1407 | } | ||
1408 | } | ||
1409 | spin_unlock(&acpi_device_lock); | ||
1410 | return 0; | ||
1411 | } | ||
1412 | |||
1413 | |||
1414 | static int acpi_device_resume(struct device * dev) | ||
1415 | { | ||
1416 | struct acpi_device * acpi_dev = to_acpi_dev(dev); | ||
1417 | |||
1418 | /* | ||
1419 | * For now, we should only register 1 generic device - | ||
1420 | * the ACPI root device - and from there, we walk the | ||
1421 | * tree of ACPI devices to resume each one using the | ||
1422 | * ACPI driver methods. | ||
1423 | */ | ||
1424 | if (acpi_dev->handle == ACPI_ROOT_OBJECT) | ||
1425 | root_resume(acpi_dev); | ||
1426 | return 0; | ||
1427 | } | ||
1428 | |||
1429 | |||
1430 | struct bus_type acpi_bus_type = { | ||
1431 | .name = "acpi", | ||
1432 | .suspend = acpi_device_suspend, | ||
1433 | .resume = acpi_device_resume, | ||
1434 | }; | ||
1435 | |||
1436 | |||
1437 | |||
1374 | static int __init acpi_scan_init(void) | 1438 | static int __init acpi_scan_init(void) |
1375 | { | 1439 | { |
1376 | int result; | 1440 | int result; |
@@ -1383,6 +1447,12 @@ static int __init acpi_scan_init(void) | |||
1383 | 1447 | ||
1384 | kset_register(&acpi_namespace_kset); | 1448 | kset_register(&acpi_namespace_kset); |
1385 | 1449 | ||
1450 | result = bus_register(&acpi_bus_type); | ||
1451 | if (result) { | ||
1452 | /* We don't want to quit even if we failed to add suspend/resume */ | ||
1453 | printk(KERN_ERR PREFIX "Could not register bus type\n"); | ||
1454 | } | ||
1455 | |||
1386 | /* | 1456 | /* |
1387 | * Create the root device in the bus's device tree | 1457 | * Create the root device in the bus's device tree |
1388 | */ | 1458 | */ |
@@ -1392,6 +1462,16 @@ static int __init acpi_scan_init(void) | |||
1392 | goto Done; | 1462 | goto Done; |
1393 | 1463 | ||
1394 | result = acpi_start_single_object(acpi_root); | 1464 | result = acpi_start_single_object(acpi_root); |
1465 | if (result) | ||
1466 | goto Done; | ||
1467 | |||
1468 | acpi_root->dev.bus = &acpi_bus_type; | ||
1469 | snprintf(acpi_root->dev.bus_id, BUS_ID_SIZE, "%s", acpi_bus_type.name); | ||
1470 | result = device_register(&acpi_root->dev); | ||
1471 | if (result) { | ||
1472 | /* We don't want to quit even if we failed to add suspend/resume */ | ||
1473 | printk(KERN_ERR PREFIX "Could not register device\n"); | ||
1474 | } | ||
1395 | 1475 | ||
1396 | /* | 1476 | /* |
1397 | * Enumerate devices in the ACPI namespace. | 1477 | * Enumerate devices in the ACPI namespace. |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 930427fc0c4b..62ce87d71651 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -105,6 +105,14 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
105 | default: | 105 | default: |
106 | return -EINVAL; | 106 | return -EINVAL; |
107 | } | 107 | } |
108 | |||
109 | /* ACPI 3.0 specs (P62) says that it's the responsabilty | ||
110 | * of the OSPM to clear the status bit [ implying that the | ||
111 | * POWER_BUTTON event should not reach userspace ] | ||
112 | */ | ||
113 | if (ACPI_SUCCESS(status) && (acpi_state == ACPI_STATE_S3)) | ||
114 | acpi_clear_event(ACPI_EVENT_POWER_BUTTON); | ||
115 | |||
108 | local_irq_restore(flags); | 116 | local_irq_restore(flags); |
109 | printk(KERN_DEBUG "Back to C!\n"); | 117 | printk(KERN_DEBUG "Back to C!\n"); |
110 | 118 | ||
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index 85df0ceda2a9..af1dbabaf0b1 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -155,7 +155,6 @@ static int __init acpi_wakeup_device_init(void) | |||
155 | 155 | ||
156 | if (acpi_disabled) | 156 | if (acpi_disabled) |
157 | return 0; | 157 | return 0; |
158 | printk("ACPI wakeup devices: \n"); | ||
159 | 158 | ||
160 | spin_lock(&acpi_device_lock); | 159 | spin_lock(&acpi_device_lock); |
161 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { | 160 | list_for_each_safe(node, next, &acpi_wakeup_device_list) { |
@@ -174,10 +173,8 @@ static int __init acpi_wakeup_device_init(void) | |||
174 | dev->wakeup.state.enabled = 1; | 173 | dev->wakeup.state.enabled = 1; |
175 | spin_lock(&acpi_device_lock); | 174 | spin_lock(&acpi_device_lock); |
176 | } | 175 | } |
177 | printk("%4s ", dev->pnp.bus_id); | ||
178 | } | 176 | } |
179 | spin_unlock(&acpi_device_lock); | 177 | spin_unlock(&acpi_device_lock); |
180 | printk("\n"); | ||
181 | 178 | ||
182 | return 0; | 179 | return 0; |
183 | } | 180 | } |
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c index e4308c7a6743..a934ac42178d 100644 --- a/drivers/acpi/system.c +++ b/drivers/acpi/system.c | |||
@@ -39,7 +39,7 @@ ACPI_MODULE_NAME("acpi_system") | |||
39 | #define ACPI_SYSTEM_FILE_EVENT "event" | 39 | #define ACPI_SYSTEM_FILE_EVENT "event" |
40 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" | 40 | #define ACPI_SYSTEM_FILE_DSDT "dsdt" |
41 | #define ACPI_SYSTEM_FILE_FADT "fadt" | 41 | #define ACPI_SYSTEM_FILE_FADT "fadt" |
42 | extern FADT_DESCRIPTOR acpi_fadt; | 42 | extern struct fadt_descriptor acpi_fadt; |
43 | 43 | ||
44 | /* -------------------------------------------------------------------------- | 44 | /* -------------------------------------------------------------------------- |
45 | FS Interface (/proc) | 45 | FS Interface (/proc) |
@@ -82,7 +82,7 @@ acpi_system_read_dsdt(struct file *file, | |||
82 | 82 | ||
83 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); | 83 | ACPI_FUNCTION_TRACE("acpi_system_read_dsdt"); |
84 | 84 | ||
85 | status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); | 85 | status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt); |
86 | if (ACPI_FAILURE(status)) | 86 | if (ACPI_FAILURE(status)) |
87 | return_VALUE(-ENODEV); | 87 | return_VALUE(-ENODEV); |
88 | 88 | ||
@@ -110,7 +110,7 @@ acpi_system_read_fadt(struct file *file, | |||
110 | 110 | ||
111 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); | 111 | ACPI_FUNCTION_TRACE("acpi_system_read_fadt"); |
112 | 112 | ||
113 | status = acpi_get_table(ACPI_TABLE_FADT, 1, &fadt); | 113 | status = acpi_get_table(ACPI_TABLE_ID_FADT, 1, &fadt); |
114 | if (ACPI_FAILURE(status)) | 114 | if (ACPI_FAILURE(status)) |
115 | return_VALUE(-ENODEV); | 115 | return_VALUE(-ENODEV); |
116 | 116 | ||
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 7f37c7cc5ef1..ed5e8816d83d 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -282,8 +282,8 @@ acpi_get_table_header_early(enum acpi_table_id id, | |||
282 | 282 | ||
283 | /* Map the DSDT header via the pointer in the FADT */ | 283 | /* Map the DSDT header via the pointer in the FADT */ |
284 | if (id == ACPI_DSDT) { | 284 | if (id == ACPI_DSDT) { |
285 | struct fadt_descriptor_rev2 *fadt = | 285 | struct fadt_descriptor *fadt = |
286 | (struct fadt_descriptor_rev2 *)*header; | 286 | (struct fadt_descriptor *)*header; |
287 | 287 | ||
288 | if (fadt->revision == 3 && fadt->Xdsdt) { | 288 | if (fadt->revision == 3 && fadt->Xdsdt) { |
289 | *header = (void *)__acpi_map_table(fadt->Xdsdt, | 289 | *header = (void *)__acpi_map_table(fadt->Xdsdt, |
diff --git a/drivers/acpi/tables/tbconvrt.c b/drivers/acpi/tables/tbconvrt.c index 03b37d2223bc..d697fcb35d52 100644 --- a/drivers/acpi/tables/tbconvrt.c +++ b/drivers/acpi/tables/tbconvrt.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
48 | 46 | ||
@@ -56,15 +54,15 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | |||
56 | acpi_physical_address address); | 54 | acpi_physical_address address); |
57 | 55 | ||
58 | static void | 56 | static void |
59 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | 57 | acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, |
60 | struct fadt_descriptor_rev1 *original_fadt); | 58 | struct fadt_descriptor_rev1 *original_fadt); |
61 | 59 | ||
62 | static void | 60 | static void |
63 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | 61 | acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, |
64 | struct fadt_descriptor_rev2 *original_fadt); | 62 | struct fadt_descriptor *original_fadt); |
65 | 63 | ||
66 | u8 acpi_fadt_is_v1; | 64 | u8 acpi_fadt_is_v1; |
67 | EXPORT_SYMBOL(acpi_fadt_is_v1); | 65 | ACPI_EXPORT_SYMBOL(acpi_fadt_is_v1) |
68 | 66 | ||
69 | /******************************************************************************* | 67 | /******************************************************************************* |
70 | * | 68 | * |
@@ -122,7 +120,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
122 | { | 120 | { |
123 | acpi_size table_size; | 121 | acpi_size table_size; |
124 | u32 i; | 122 | u32 i; |
125 | XSDT_DESCRIPTOR *new_table; | 123 | struct xsdt_descriptor *new_table; |
126 | 124 | ||
127 | ACPI_FUNCTION_ENTRY(); | 125 | ACPI_FUNCTION_ENTRY(); |
128 | 126 | ||
@@ -133,7 +131,7 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
133 | 131 | ||
134 | /* Allocate an XSDT */ | 132 | /* Allocate an XSDT */ |
135 | 133 | ||
136 | new_table = ACPI_MEM_CALLOCATE(table_size); | 134 | new_table = ACPI_ALLOCATE_ZEROED(table_size); |
137 | if (!new_table) { | 135 | if (!new_table) { |
138 | return (AE_NO_MEMORY); | 136 | return (AE_NO_MEMORY); |
139 | } | 137 | } |
@@ -147,17 +145,18 @@ acpi_status acpi_tb_convert_to_xsdt(struct acpi_table_desc *table_info) | |||
147 | /* Copy the table pointers */ | 145 | /* Copy the table pointers */ |
148 | 146 | ||
149 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 147 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
148 | |||
150 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ | 149 | /* RSDT pointers are 32 bits, XSDT pointers are 64 bits */ |
151 | 150 | ||
152 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 151 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
153 | ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], | 152 | ACPI_STORE_ADDRESS(new_table->table_offset_entry[i], |
154 | (ACPI_CAST_PTR | 153 | (ACPI_CAST_PTR |
155 | (struct rsdt_descriptor_rev1, | 154 | (struct rsdt_descriptor, |
156 | table_info->pointer))-> | 155 | table_info->pointer))-> |
157 | table_offset_entry[i]); | 156 | table_offset_entry[i]); |
158 | } else { | 157 | } else { |
159 | new_table->table_offset_entry[i] = | 158 | new_table->table_offset_entry[i] = |
160 | (ACPI_CAST_PTR(XSDT_DESCRIPTOR, | 159 | (ACPI_CAST_PTR(struct xsdt_descriptor, |
161 | table_info->pointer))-> | 160 | table_info->pointer))-> |
162 | table_offset_entry[i]; | 161 | table_offset_entry[i]; |
163 | } | 162 | } |
@@ -219,7 +218,7 @@ acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, | |||
219 | ******************************************************************************/ | 218 | ******************************************************************************/ |
220 | 219 | ||
221 | static void | 220 | static void |
222 | acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | 221 | acpi_tb_convert_fadt1(struct fadt_descriptor *local_fadt, |
223 | struct fadt_descriptor_rev1 *original_fadt) | 222 | struct fadt_descriptor_rev1 *original_fadt) |
224 | { | 223 | { |
225 | 224 | ||
@@ -365,14 +364,13 @@ acpi_tb_convert_fadt1(struct fadt_descriptor_rev2 *local_fadt, | |||
365 | ******************************************************************************/ | 364 | ******************************************************************************/ |
366 | 365 | ||
367 | static void | 366 | static void |
368 | acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | 367 | acpi_tb_convert_fadt2(struct fadt_descriptor *local_fadt, |
369 | struct fadt_descriptor_rev2 *original_fadt) | 368 | struct fadt_descriptor *original_fadt) |
370 | { | 369 | { |
371 | 370 | ||
372 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ | 371 | /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ |
373 | 372 | ||
374 | ACPI_MEMCPY(local_fadt, original_fadt, | 373 | ACPI_MEMCPY(local_fadt, original_fadt, sizeof(struct fadt_descriptor)); |
375 | sizeof(struct fadt_descriptor_rev2)); | ||
376 | 374 | ||
377 | /* | 375 | /* |
378 | * "X" fields are optional extensions to the original V1.0 fields, so | 376 | * "X" fields are optional extensions to the original V1.0 fields, so |
@@ -491,10 +489,10 @@ acpi_tb_convert_fadt2(struct fadt_descriptor_rev2 *local_fadt, | |||
491 | 489 | ||
492 | acpi_status acpi_tb_convert_table_fadt(void) | 490 | acpi_status acpi_tb_convert_table_fadt(void) |
493 | { | 491 | { |
494 | struct fadt_descriptor_rev2 *local_fadt; | 492 | struct fadt_descriptor *local_fadt; |
495 | struct acpi_table_desc *table_desc; | 493 | struct acpi_table_desc *table_desc; |
496 | 494 | ||
497 | ACPI_FUNCTION_TRACE("tb_convert_table_fadt"); | 495 | ACPI_FUNCTION_TRACE(tb_convert_table_fadt); |
498 | 496 | ||
499 | /* | 497 | /* |
500 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be | 498 | * acpi_gbl_FADT is valid. Validate the FADT length. The table must be |
@@ -508,13 +506,14 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
508 | 506 | ||
509 | /* Allocate buffer for the ACPI 2.0(+) FADT */ | 507 | /* Allocate buffer for the ACPI 2.0(+) FADT */ |
510 | 508 | ||
511 | local_fadt = ACPI_MEM_CALLOCATE(sizeof(struct fadt_descriptor_rev2)); | 509 | local_fadt = ACPI_ALLOCATE_ZEROED(sizeof(struct fadt_descriptor)); |
512 | if (!local_fadt) { | 510 | if (!local_fadt) { |
513 | return_ACPI_STATUS(AE_NO_MEMORY); | 511 | return_ACPI_STATUS(AE_NO_MEMORY); |
514 | } | 512 | } |
515 | 513 | ||
516 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { | 514 | if (acpi_gbl_FADT->revision >= FADT2_REVISION_ID) { |
517 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor_rev2)) { | 515 | if (acpi_gbl_FADT->length < sizeof(struct fadt_descriptor)) { |
516 | |||
518 | /* Length is too short to be a V2.0 table */ | 517 | /* Length is too short to be a V2.0 table */ |
519 | 518 | ||
520 | ACPI_WARNING((AE_INFO, | 519 | ACPI_WARNING((AE_INFO, |
@@ -538,11 +537,11 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
538 | /* Global FADT pointer will point to the new common V2.0 FADT */ | 537 | /* Global FADT pointer will point to the new common V2.0 FADT */ |
539 | 538 | ||
540 | acpi_gbl_FADT = local_fadt; | 539 | acpi_gbl_FADT = local_fadt; |
541 | acpi_gbl_FADT->length = sizeof(FADT_DESCRIPTOR); | 540 | acpi_gbl_FADT->length = sizeof(struct fadt_descriptor); |
542 | 541 | ||
543 | /* Free the original table */ | 542 | /* Free the original table */ |
544 | 543 | ||
545 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_FADT].next; | 544 | table_desc = acpi_gbl_table_lists[ACPI_TABLE_ID_FADT].next; |
546 | acpi_tb_delete_single_table(table_desc); | 545 | acpi_tb_delete_single_table(table_desc); |
547 | 546 | ||
548 | /* Install the new table */ | 547 | /* Install the new table */ |
@@ -550,7 +549,7 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
550 | table_desc->pointer = | 549 | table_desc->pointer = |
551 | ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); | 550 | ACPI_CAST_PTR(struct acpi_table_header, acpi_gbl_FADT); |
552 | table_desc->allocation = ACPI_MEM_ALLOCATED; | 551 | table_desc->allocation = ACPI_MEM_ALLOCATED; |
553 | table_desc->length = sizeof(struct fadt_descriptor_rev2); | 552 | table_desc->length = sizeof(struct fadt_descriptor); |
554 | 553 | ||
555 | /* Dump the entire FADT */ | 554 | /* Dump the entire FADT */ |
556 | 555 | ||
@@ -580,7 +579,7 @@ acpi_status acpi_tb_convert_table_fadt(void) | |||
580 | acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) | 579 | acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) |
581 | { | 580 | { |
582 | 581 | ||
583 | ACPI_FUNCTION_TRACE("tb_build_common_facs"); | 582 | ACPI_FUNCTION_TRACE(tb_build_common_facs); |
584 | 583 | ||
585 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ | 584 | /* Absolute minimum length is 24, but the ACPI spec says 64 */ |
586 | 585 | ||
@@ -603,6 +602,7 @@ acpi_status acpi_tb_build_common_facs(struct acpi_table_desc *table_info) | |||
603 | if ((acpi_gbl_RSDP->revision < 2) || | 602 | if ((acpi_gbl_RSDP->revision < 2) || |
604 | (acpi_gbl_FACS->length < 32) || | 603 | (acpi_gbl_FACS->length < 32) || |
605 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { | 604 | (!(acpi_gbl_FACS->xfirmware_waking_vector))) { |
605 | |||
606 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ | 606 | /* ACPI 1.0 FACS or short table or optional X_ field is zero */ |
607 | 607 | ||
608 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, | 608 | acpi_gbl_common_fACS.firmware_waking_vector = ACPI_CAST_PTR(u64, |
diff --git a/drivers/acpi/tables/tbget.c b/drivers/acpi/tables/tbget.c index 09b4ee6dfd60..99eacceff563 100644 --- a/drivers/acpi/tables/tbget.c +++ b/drivers/acpi/tables/tbget.c | |||
@@ -78,7 +78,7 @@ acpi_tb_get_table(struct acpi_pointer *address, | |||
78 | acpi_status status; | 78 | acpi_status status; |
79 | struct acpi_table_header header; | 79 | struct acpi_table_header header; |
80 | 80 | ||
81 | ACPI_FUNCTION_TRACE("tb_get_table"); | 81 | ACPI_FUNCTION_TRACE(tb_get_table); |
82 | 82 | ||
83 | /* Get the header in order to get signature and table size */ | 83 | /* Get the header in order to get signature and table size */ |
84 | 84 | ||
@@ -124,7 +124,7 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
124 | acpi_status status = AE_OK; | 124 | acpi_status status = AE_OK; |
125 | struct acpi_table_header *header = NULL; | 125 | struct acpi_table_header *header = NULL; |
126 | 126 | ||
127 | ACPI_FUNCTION_TRACE("tb_get_table_header"); | 127 | ACPI_FUNCTION_TRACE(tb_get_table_header); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * Flags contains the current processor mode (Virtual or Physical | 130 | * Flags contains the current processor mode (Virtual or Physical |
@@ -148,6 +148,10 @@ acpi_tb_get_table_header(struct acpi_pointer *address, | |||
148 | sizeof(struct acpi_table_header), | 148 | sizeof(struct acpi_table_header), |
149 | (void *)&header); | 149 | (void *)&header); |
150 | if (ACPI_FAILURE(status)) { | 150 | if (ACPI_FAILURE(status)) { |
151 | ACPI_ERROR((AE_INFO, | ||
152 | "Could not map memory at %8.8X%8.8X for table header", | ||
153 | ACPI_FORMAT_UINT64(address->pointer. | ||
154 | physical))); | ||
151 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
152 | } | 156 | } |
153 | 157 | ||
@@ -198,7 +202,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
198 | { | 202 | { |
199 | acpi_status status; | 203 | acpi_status status; |
200 | 204 | ||
201 | ACPI_FUNCTION_TRACE("tb_get_table_body"); | 205 | ACPI_FUNCTION_TRACE(tb_get_table_body); |
202 | 206 | ||
203 | if (!table_info || !address) { | 207 | if (!table_info || !address) { |
204 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 208 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -208,6 +212,7 @@ acpi_tb_get_table_body(struct acpi_pointer *address, | |||
208 | 212 | ||
209 | status = acpi_tb_table_override(header, table_info); | 213 | status = acpi_tb_table_override(header, table_info); |
210 | if (ACPI_SUCCESS(status)) { | 214 | if (ACPI_SUCCESS(status)) { |
215 | |||
211 | /* Table was overridden by the host OS */ | 216 | /* Table was overridden by the host OS */ |
212 | 217 | ||
213 | return_ACPI_STATUS(status); | 218 | return_ACPI_STATUS(status); |
@@ -241,7 +246,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
241 | acpi_status status; | 246 | acpi_status status; |
242 | struct acpi_pointer address; | 247 | struct acpi_pointer address; |
243 | 248 | ||
244 | ACPI_FUNCTION_TRACE("tb_table_override"); | 249 | ACPI_FUNCTION_TRACE(tb_table_override); |
245 | 250 | ||
246 | /* | 251 | /* |
247 | * The OSL will examine the header and decide whether to override this | 252 | * The OSL will examine the header and decide whether to override this |
@@ -250,6 +255,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
250 | */ | 255 | */ |
251 | status = acpi_os_table_override(header, &new_table); | 256 | status = acpi_os_table_override(header, &new_table); |
252 | if (ACPI_FAILURE(status)) { | 257 | if (ACPI_FAILURE(status)) { |
258 | |||
253 | /* Some severe error from the OSL, but we basically ignore it */ | 259 | /* Some severe error from the OSL, but we basically ignore it */ |
254 | 260 | ||
255 | ACPI_EXCEPTION((AE_INFO, status, | 261 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -258,6 +264,7 @@ acpi_tb_table_override(struct acpi_table_header *header, | |||
258 | } | 264 | } |
259 | 265 | ||
260 | if (!new_table) { | 266 | if (!new_table) { |
267 | |||
261 | /* No table override */ | 268 | /* No table override */ |
262 | 269 | ||
263 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | 270 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); |
@@ -311,7 +318,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
311 | u8 allocation; | 318 | u8 allocation; |
312 | acpi_status status = AE_OK; | 319 | acpi_status status = AE_OK; |
313 | 320 | ||
314 | ACPI_FUNCTION_TRACE("tb_get_this_table"); | 321 | ACPI_FUNCTION_TRACE(tb_get_this_table); |
315 | 322 | ||
316 | /* | 323 | /* |
317 | * Flags contains the current processor mode (Virtual or Physical | 324 | * Flags contains the current processor mode (Virtual or Physical |
@@ -323,7 +330,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
323 | 330 | ||
324 | /* Pointer matches processor mode, copy the table to a new buffer */ | 331 | /* Pointer matches processor mode, copy the table to a new buffer */ |
325 | 332 | ||
326 | full_table = ACPI_MEM_ALLOCATE(header->length); | 333 | full_table = ACPI_ALLOCATE(header->length); |
327 | if (!full_table) { | 334 | if (!full_table) { |
328 | ACPI_ERROR((AE_INFO, | 335 | ACPI_ERROR((AE_INFO, |
329 | "Could not allocate table memory for [%4.4s] length %X", | 336 | "Could not allocate table memory for [%4.4s] length %X", |
@@ -376,11 +383,12 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
376 | * Validate checksum for _most_ tables, | 383 | * Validate checksum for _most_ tables, |
377 | * even the ones whose signature we don't recognize | 384 | * even the ones whose signature we don't recognize |
378 | */ | 385 | */ |
379 | if (table_info->type != ACPI_TABLE_FACS) { | 386 | if (table_info->type != ACPI_TABLE_ID_FACS) { |
380 | status = acpi_tb_verify_table_checksum(full_table); | 387 | status = acpi_tb_verify_table_checksum(full_table); |
381 | 388 | ||
382 | #if (!ACPI_CHECKSUM_ABORT) | 389 | #if (!ACPI_CHECKSUM_ABORT) |
383 | if (ACPI_FAILURE(status)) { | 390 | if (ACPI_FAILURE(status)) { |
391 | |||
384 | /* Ignore the error if configuration says so */ | 392 | /* Ignore the error if configuration says so */ |
385 | 393 | ||
386 | status = AE_OK; | 394 | status = AE_OK; |
@@ -409,7 +417,7 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
409 | * | 417 | * |
410 | * PARAMETERS: table_type - one of the defined table types | 418 | * PARAMETERS: table_type - one of the defined table types |
411 | * Instance - Which table of this type | 419 | * Instance - Which table of this type |
412 | * table_ptr_loc - pointer to location to place the pointer for | 420 | * return_table - pointer to location to place the pointer for |
413 | * return | 421 | * return |
414 | * | 422 | * |
415 | * RETURN: Status | 423 | * RETURN: Status |
@@ -420,57 +428,34 @@ acpi_tb_get_this_table(struct acpi_pointer *address, | |||
420 | 428 | ||
421 | acpi_status | 429 | acpi_status |
422 | acpi_tb_get_table_ptr(acpi_table_type table_type, | 430 | acpi_tb_get_table_ptr(acpi_table_type table_type, |
423 | u32 instance, struct acpi_table_header **table_ptr_loc) | 431 | u32 instance, struct acpi_table_header **return_table) |
424 | { | 432 | { |
425 | struct acpi_table_desc *table_desc; | 433 | struct acpi_table_desc *table_desc; |
426 | u32 i; | 434 | u32 i; |
427 | 435 | ||
428 | ACPI_FUNCTION_TRACE("tb_get_table_ptr"); | 436 | ACPI_FUNCTION_TRACE(tb_get_table_ptr); |
429 | |||
430 | if (!acpi_gbl_DSDT) { | ||
431 | return_ACPI_STATUS(AE_NO_ACPI_TABLES); | ||
432 | } | ||
433 | 437 | ||
434 | if (table_type > ACPI_TABLE_MAX) { | 438 | if (table_type > ACPI_TABLE_ID_MAX) { |
435 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 439 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
436 | } | 440 | } |
437 | 441 | ||
438 | /* | 442 | /* Check for instance out of range of the current table count */ |
439 | * For all table types (Single/Multiple), the first | ||
440 | * instance is always in the list head. | ||
441 | */ | ||
442 | if (instance == 1) { | ||
443 | /* Get the first */ | ||
444 | |||
445 | *table_ptr_loc = NULL; | ||
446 | if (acpi_gbl_table_lists[table_type].next) { | ||
447 | *table_ptr_loc = | ||
448 | acpi_gbl_table_lists[table_type].next->pointer; | ||
449 | } | ||
450 | return_ACPI_STATUS(AE_OK); | ||
451 | } | ||
452 | |||
453 | /* Check for instance out of range */ | ||
454 | 443 | ||
455 | if (instance > acpi_gbl_table_lists[table_type].count) { | 444 | if (instance > acpi_gbl_table_lists[table_type].count) { |
456 | return_ACPI_STATUS(AE_NOT_EXIST); | 445 | return_ACPI_STATUS(AE_NOT_EXIST); |
457 | } | 446 | } |
458 | 447 | ||
459 | /* Walk the list to get the desired table | 448 | /* |
460 | * Since the if (Instance == 1) check above checked for the | 449 | * Walk the list to get the desired table |
461 | * first table, setting table_desc equal to the .Next member | 450 | * Note: Instance is one-based |
462 | * is actually pointing to the second table. Therefore, we | ||
463 | * need to walk from the 2nd table until we reach the Instance | ||
464 | * that the user is looking for and return its table pointer. | ||
465 | */ | 451 | */ |
466 | table_desc = acpi_gbl_table_lists[table_type].next; | 452 | table_desc = acpi_gbl_table_lists[table_type].next; |
467 | for (i = 2; i < instance; i++) { | 453 | for (i = 1; i < instance; i++) { |
468 | table_desc = table_desc->next; | 454 | table_desc = table_desc->next; |
469 | } | 455 | } |
470 | 456 | ||
471 | /* We are now pointing to the requested table's descriptor */ | 457 | /* We are now pointing to the requested table's descriptor */ |
472 | 458 | ||
473 | *table_ptr_loc = table_desc->pointer; | 459 | *return_table = table_desc->pointer; |
474 | |||
475 | return_ACPI_STATUS(AE_OK); | 460 | return_ACPI_STATUS(AE_OK); |
476 | } | 461 | } |
diff --git a/drivers/acpi/tables/tbgetall.c b/drivers/acpi/tables/tbgetall.c index 134e5dce0bc1..ad982112e4c6 100644 --- a/drivers/acpi/tables/tbgetall.c +++ b/drivers/acpi/tables/tbgetall.c | |||
@@ -77,7 +77,7 @@ acpi_tb_get_primary_table(struct acpi_pointer *address, | |||
77 | acpi_status status; | 77 | acpi_status status; |
78 | struct acpi_table_header header; | 78 | struct acpi_table_header header; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("tb_get_primary_table"); | 80 | ACPI_FUNCTION_TRACE(tb_get_primary_table); |
81 | 81 | ||
82 | /* Ignore a NULL address in the RSDT */ | 82 | /* Ignore a NULL address in the RSDT */ |
83 | 83 | ||
@@ -140,7 +140,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, | |||
140 | acpi_status status; | 140 | acpi_status status; |
141 | struct acpi_table_header header; | 141 | struct acpi_table_header header; |
142 | 142 | ||
143 | ACPI_FUNCTION_TRACE_STR("tb_get_secondary_table", signature); | 143 | ACPI_FUNCTION_TRACE_STR(tb_get_secondary_table, signature); |
144 | 144 | ||
145 | /* Get the header in order to match the signature */ | 145 | /* Get the header in order to match the signature */ |
146 | 146 | ||
@@ -151,7 +151,7 @@ acpi_tb_get_secondary_table(struct acpi_pointer *address, | |||
151 | 151 | ||
152 | /* Signature must match request */ | 152 | /* Signature must match request */ |
153 | 153 | ||
154 | if (ACPI_STRNCMP(header.signature, signature, ACPI_NAME_SIZE)) { | 154 | if (!ACPI_COMPARE_NAME(header.signature, signature)) { |
155 | ACPI_ERROR((AE_INFO, | 155 | ACPI_ERROR((AE_INFO, |
156 | "Incorrect table signature - wanted [%s] found [%4.4s]", | 156 | "Incorrect table signature - wanted [%s] found [%4.4s]", |
157 | signature, header.signature)); | 157 | signature, header.signature)); |
@@ -207,7 +207,7 @@ acpi_status acpi_tb_get_required_tables(void) | |||
207 | struct acpi_table_desc table_info; | 207 | struct acpi_table_desc table_info; |
208 | struct acpi_pointer address; | 208 | struct acpi_pointer address; |
209 | 209 | ||
210 | ACPI_FUNCTION_TRACE("tb_get_required_tables"); | 210 | ACPI_FUNCTION_TRACE(tb_get_required_tables); |
211 | 211 | ||
212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", | 212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%d ACPI tables in RSDT\n", |
213 | acpi_gbl_rsdt_table_count)); | 213 | acpi_gbl_rsdt_table_count)); |
@@ -223,6 +223,7 @@ acpi_status acpi_tb_get_required_tables(void) | |||
223 | * any SSDTs. | 223 | * any SSDTs. |
224 | */ | 224 | */ |
225 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { | 225 | for (i = 0; i < acpi_gbl_rsdt_table_count; i++) { |
226 | |||
226 | /* Get the table address from the common internal XSDT */ | 227 | /* Get the table address from the common internal XSDT */ |
227 | 228 | ||
228 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; | 229 | address.pointer.value = acpi_gbl_XSDT->table_offset_entry[i]; |
@@ -305,6 +306,6 @@ acpi_status acpi_tb_get_required_tables(void) | |||
305 | 306 | ||
306 | /* Always delete the RSDP mapping, we are done with it */ | 307 | /* Always delete the RSDP mapping, we are done with it */ |
307 | 308 | ||
308 | acpi_tb_delete_tables_by_type(ACPI_TABLE_RSDP); | 309 | acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_RSDP); |
309 | return_ACPI_STATUS(status); | 310 | return_ACPI_STATUS(status); |
310 | } | 311 | } |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 7ffd0fddb4e5..7ca2df75bb11 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -73,17 +73,18 @@ acpi_tb_match_signature(char *signature, | |||
73 | { | 73 | { |
74 | acpi_native_uint i; | 74 | acpi_native_uint i; |
75 | 75 | ||
76 | ACPI_FUNCTION_TRACE("tb_match_signature"); | 76 | ACPI_FUNCTION_TRACE(tb_match_signature); |
77 | 77 | ||
78 | /* Search for a signature match among the known table types */ | 78 | /* Search for a signature match among the known table types */ |
79 | 79 | ||
80 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 80 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
81 | if (!(acpi_gbl_table_data[i].flags & search_type)) { | 81 | if (!(acpi_gbl_table_data[i].flags & search_type)) { |
82 | continue; | 82 | continue; |
83 | } | 83 | } |
84 | 84 | ||
85 | if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, | 85 | if (!ACPI_STRNCMP(signature, acpi_gbl_table_data[i].signature, |
86 | acpi_gbl_table_data[i].sig_length)) { | 86 | acpi_gbl_table_data[i].sig_length)) { |
87 | |||
87 | /* Found a signature match, return index if requested */ | 88 | /* Found a signature match, return index if requested */ |
88 | 89 | ||
89 | if (table_info) { | 90 | if (table_info) { |
@@ -122,7 +123,7 @@ acpi_status acpi_tb_install_table(struct acpi_table_desc *table_info) | |||
122 | { | 123 | { |
123 | acpi_status status; | 124 | acpi_status status; |
124 | 125 | ||
125 | ACPI_FUNCTION_TRACE("tb_install_table"); | 126 | ACPI_FUNCTION_TRACE(tb_install_table); |
126 | 127 | ||
127 | /* Lock tables while installing */ | 128 | /* Lock tables while installing */ |
128 | 129 | ||
@@ -187,7 +188,7 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) | |||
187 | struct acpi_table_header *table_header; | 188 | struct acpi_table_header *table_header; |
188 | acpi_status status; | 189 | acpi_status status; |
189 | 190 | ||
190 | ACPI_FUNCTION_TRACE("tb_recognize_table"); | 191 | ACPI_FUNCTION_TRACE(tb_recognize_table); |
191 | 192 | ||
192 | /* Ensure that we have a valid table pointer */ | 193 | /* Ensure that we have a valid table pointer */ |
193 | 194 | ||
@@ -218,7 +219,6 @@ acpi_tb_recognize_table(struct acpi_table_desc *table_info, u8 search_type) | |||
218 | /* Return the table type and length via the info struct */ | 219 | /* Return the table type and length via the info struct */ |
219 | 220 | ||
220 | table_info->length = (acpi_size) table_header->length; | 221 | table_info->length = (acpi_size) table_header->length; |
221 | |||
222 | return_ACPI_STATUS(status); | 222 | return_ACPI_STATUS(status); |
223 | } | 223 | } |
224 | 224 | ||
@@ -243,11 +243,11 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
243 | struct acpi_table_desc *table_desc; | 243 | struct acpi_table_desc *table_desc; |
244 | acpi_status status; | 244 | acpi_status status; |
245 | 245 | ||
246 | ACPI_FUNCTION_TRACE_U32("tb_init_table_descriptor", table_type); | 246 | ACPI_FUNCTION_TRACE_U32(tb_init_table_descriptor, table_type); |
247 | 247 | ||
248 | /* Allocate a descriptor for this table */ | 248 | /* Allocate a descriptor for this table */ |
249 | 249 | ||
250 | table_desc = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); | 250 | table_desc = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); |
251 | if (!table_desc) { | 251 | if (!table_desc) { |
252 | return_ACPI_STATUS(AE_NO_MEMORY); | 252 | return_ACPI_STATUS(AE_NO_MEMORY); |
253 | } | 253 | } |
@@ -274,7 +274,7 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
274 | * at this location, so return an error. | 274 | * at this location, so return an error. |
275 | */ | 275 | */ |
276 | if (list_head->next) { | 276 | if (list_head->next) { |
277 | ACPI_MEM_FREE(table_desc); | 277 | ACPI_FREE(table_desc); |
278 | return_ACPI_STATUS(AE_ALREADY_EXISTS); | 278 | return_ACPI_STATUS(AE_ALREADY_EXISTS); |
279 | } | 279 | } |
280 | 280 | ||
@@ -312,15 +312,14 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
312 | 312 | ||
313 | /* Finish initialization of the table descriptor */ | 313 | /* Finish initialization of the table descriptor */ |
314 | 314 | ||
315 | table_desc->loaded_into_namespace = FALSE; | ||
315 | table_desc->type = (u8) table_type; | 316 | table_desc->type = (u8) table_type; |
316 | table_desc->pointer = table_info->pointer; | 317 | table_desc->pointer = table_info->pointer; |
317 | table_desc->length = table_info->length; | 318 | table_desc->length = table_info->length; |
318 | table_desc->allocation = table_info->allocation; | 319 | table_desc->allocation = table_info->allocation; |
319 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), | 320 | table_desc->aml_start = (u8 *) (table_desc->pointer + 1), |
320 | table_desc->aml_length = (u32) (table_desc->length - | 321 | table_desc->aml_length = (u32) |
321 | (u32) sizeof(struct | 322 | (table_desc->length - (u32) sizeof(struct acpi_table_header)); |
322 | acpi_table_header)); | ||
323 | table_desc->loaded_into_namespace = FALSE; | ||
324 | 323 | ||
325 | /* | 324 | /* |
326 | * Set the appropriate global pointer (if there is one) to point to the | 325 | * Set the appropriate global pointer (if there is one) to point to the |
@@ -335,7 +334,6 @@ acpi_tb_init_table_descriptor(acpi_table_type table_type, | |||
335 | 334 | ||
336 | table_info->owner_id = table_desc->owner_id; | 335 | table_info->owner_id = table_desc->owner_id; |
337 | table_info->installed_desc = table_desc; | 336 | table_info->installed_desc = table_desc; |
338 | |||
339 | return_ACPI_STATUS(AE_OK); | 337 | return_ACPI_STATUS(AE_OK); |
340 | } | 338 | } |
341 | 339 | ||
@@ -359,7 +357,7 @@ void acpi_tb_delete_all_tables(void) | |||
359 | * Free memory allocated for ACPI tables | 357 | * Free memory allocated for ACPI tables |
360 | * Memory can either be mapped or allocated | 358 | * Memory can either be mapped or allocated |
361 | */ | 359 | */ |
362 | for (type = 0; type < NUM_ACPI_TABLE_TYPES; type++) { | 360 | for (type = 0; type < (ACPI_TABLE_ID_MAX + 1); type++) { |
363 | acpi_tb_delete_tables_by_type(type); | 361 | acpi_tb_delete_tables_by_type(type); |
364 | } | 362 | } |
365 | } | 363 | } |
@@ -383,9 +381,9 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) | |||
383 | u32 count; | 381 | u32 count; |
384 | u32 i; | 382 | u32 i; |
385 | 383 | ||
386 | ACPI_FUNCTION_TRACE_U32("tb_delete_tables_by_type", type); | 384 | ACPI_FUNCTION_TRACE_U32(tb_delete_tables_by_type, type); |
387 | 385 | ||
388 | if (type > ACPI_TABLE_MAX) { | 386 | if (type > ACPI_TABLE_ID_MAX) { |
389 | return_VOID; | 387 | return_VOID; |
390 | } | 388 | } |
391 | 389 | ||
@@ -396,28 +394,28 @@ void acpi_tb_delete_tables_by_type(acpi_table_type type) | |||
396 | /* Clear the appropriate "typed" global table pointer */ | 394 | /* Clear the appropriate "typed" global table pointer */ |
397 | 395 | ||
398 | switch (type) { | 396 | switch (type) { |
399 | case ACPI_TABLE_RSDP: | 397 | case ACPI_TABLE_ID_RSDP: |
400 | acpi_gbl_RSDP = NULL; | 398 | acpi_gbl_RSDP = NULL; |
401 | break; | 399 | break; |
402 | 400 | ||
403 | case ACPI_TABLE_DSDT: | 401 | case ACPI_TABLE_ID_DSDT: |
404 | acpi_gbl_DSDT = NULL; | 402 | acpi_gbl_DSDT = NULL; |
405 | break; | 403 | break; |
406 | 404 | ||
407 | case ACPI_TABLE_FADT: | 405 | case ACPI_TABLE_ID_FADT: |
408 | acpi_gbl_FADT = NULL; | 406 | acpi_gbl_FADT = NULL; |
409 | break; | 407 | break; |
410 | 408 | ||
411 | case ACPI_TABLE_FACS: | 409 | case ACPI_TABLE_ID_FACS: |
412 | acpi_gbl_FACS = NULL; | 410 | acpi_gbl_FACS = NULL; |
413 | break; | 411 | break; |
414 | 412 | ||
415 | case ACPI_TABLE_XSDT: | 413 | case ACPI_TABLE_ID_XSDT: |
416 | acpi_gbl_XSDT = NULL; | 414 | acpi_gbl_XSDT = NULL; |
417 | break; | 415 | break; |
418 | 416 | ||
419 | case ACPI_TABLE_SSDT: | 417 | case ACPI_TABLE_ID_SSDT: |
420 | case ACPI_TABLE_PSDT: | 418 | case ACPI_TABLE_ID_PSDT: |
421 | default: | 419 | default: |
422 | break; | 420 | break; |
423 | } | 421 | } |
@@ -471,7 +469,7 @@ void acpi_tb_delete_single_table(struct acpi_table_desc *table_desc) | |||
471 | 469 | ||
472 | case ACPI_MEM_ALLOCATED: | 470 | case ACPI_MEM_ALLOCATED: |
473 | 471 | ||
474 | ACPI_MEM_FREE(table_desc->pointer); | 472 | ACPI_FREE(table_desc->pointer); |
475 | break; | 473 | break; |
476 | 474 | ||
477 | case ACPI_MEM_MAPPED: | 475 | case ACPI_MEM_MAPPED: |
@@ -503,7 +501,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc | |||
503 | { | 501 | { |
504 | struct acpi_table_desc *next_desc; | 502 | struct acpi_table_desc *next_desc; |
505 | 503 | ||
506 | ACPI_FUNCTION_TRACE_PTR("tb_uninstall_table", table_desc); | 504 | ACPI_FUNCTION_TRACE_PTR(tb_uninstall_table, table_desc); |
507 | 505 | ||
508 | if (!table_desc) { | 506 | if (!table_desc) { |
509 | return_PTR(NULL); | 507 | return_PTR(NULL); |
@@ -530,7 +528,7 @@ struct acpi_table_desc *acpi_tb_uninstall_table(struct acpi_table_desc | |||
530 | /* Free the table descriptor */ | 528 | /* Free the table descriptor */ |
531 | 529 | ||
532 | next_desc = table_desc->next; | 530 | next_desc = table_desc->next; |
533 | ACPI_MEM_FREE(table_desc); | 531 | ACPI_FREE(table_desc); |
534 | 532 | ||
535 | /* Return pointer to the next descriptor */ | 533 | /* Return pointer to the next descriptor */ |
536 | 534 | ||
diff --git a/drivers/acpi/tables/tbrsdt.c b/drivers/acpi/tables/tbrsdt.c index 4d308220225d..abcb08c2592a 100644 --- a/drivers/acpi/tables/tbrsdt.c +++ b/drivers/acpi/tables/tbrsdt.c | |||
@@ -64,7 +64,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
64 | acpi_status status; | 64 | acpi_status status; |
65 | struct rsdp_descriptor *rsdp; | 65 | struct rsdp_descriptor *rsdp; |
66 | 66 | ||
67 | ACPI_FUNCTION_TRACE("tb_verify_rsdp"); | 67 | ACPI_FUNCTION_TRACE(tb_verify_rsdp); |
68 | 68 | ||
69 | switch (address->pointer_type) { | 69 | switch (address->pointer_type) { |
70 | case ACPI_LOGICAL_POINTER: | 70 | case ACPI_LOGICAL_POINTER: |
@@ -78,7 +78,7 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
78 | */ | 78 | */ |
79 | status = acpi_os_map_memory(address->pointer.physical, | 79 | status = acpi_os_map_memory(address->pointer.physical, |
80 | sizeof(struct rsdp_descriptor), | 80 | sizeof(struct rsdp_descriptor), |
81 | (void *)&rsdp); | 81 | ACPI_CAST_PTR(void, &rsdp)); |
82 | if (ACPI_FAILURE(status)) { | 82 | if (ACPI_FAILURE(status)) { |
83 | return_ACPI_STATUS(status); | 83 | return_ACPI_STATUS(status); |
84 | } | 84 | } |
@@ -95,15 +95,20 @@ acpi_status acpi_tb_verify_rsdp(struct acpi_pointer *address) | |||
95 | goto cleanup; | 95 | goto cleanup; |
96 | } | 96 | } |
97 | 97 | ||
98 | /* The RSDP supplied is OK */ | 98 | /* RSDP is ok. Init the table info */ |
99 | 99 | ||
100 | table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); | 100 | table_info.pointer = ACPI_CAST_PTR(struct acpi_table_header, rsdp); |
101 | table_info.length = sizeof(struct rsdp_descriptor); | 101 | table_info.length = sizeof(struct rsdp_descriptor); |
102 | table_info.allocation = ACPI_MEM_MAPPED; | 102 | |
103 | if (address->pointer_type == ACPI_PHYSICAL_POINTER) { | ||
104 | table_info.allocation = ACPI_MEM_MAPPED; | ||
105 | } else { | ||
106 | table_info.allocation = ACPI_MEM_NOT_ALLOCATED; | ||
107 | } | ||
103 | 108 | ||
104 | /* Save the table pointers and allocation info */ | 109 | /* Save the table pointers and allocation info */ |
105 | 110 | ||
106 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_RSDP, &table_info); | 111 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_RSDP, &table_info); |
107 | if (ACPI_FAILURE(status)) { | 112 | if (ACPI_FAILURE(status)) { |
108 | goto cleanup; | 113 | goto cleanup; |
109 | } | 114 | } |
@@ -174,22 +179,20 @@ void acpi_tb_get_rsdt_address(struct acpi_pointer *out_address) | |||
174 | 179 | ||
175 | acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | 180 | acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) |
176 | { | 181 | { |
177 | int no_match; | 182 | char *signature; |
178 | 183 | ||
179 | ACPI_FUNCTION_ENTRY(); | 184 | ACPI_FUNCTION_ENTRY(); |
180 | 185 | ||
181 | /* | 186 | /* Search for appropriate signature, RSDT or XSDT */ |
182 | * Search for appropriate signature, RSDT or XSDT | 187 | |
183 | */ | ||
184 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 188 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
185 | no_match = ACPI_STRNCMP((char *)table_ptr, RSDT_SIG, | 189 | signature = RSDT_SIG; |
186 | sizeof(RSDT_SIG) - 1); | ||
187 | } else { | 190 | } else { |
188 | no_match = ACPI_STRNCMP((char *)table_ptr, XSDT_SIG, | 191 | signature = XSDT_SIG; |
189 | sizeof(XSDT_SIG) - 1); | ||
190 | } | 192 | } |
191 | 193 | ||
192 | if (no_match) { | 194 | if (!ACPI_COMPARE_NAME(table_ptr->signature, signature)) { |
195 | |||
193 | /* Invalid RSDT or XSDT signature */ | 196 | /* Invalid RSDT or XSDT signature */ |
194 | 197 | ||
195 | ACPI_ERROR((AE_INFO, | 198 | ACPI_ERROR((AE_INFO, |
@@ -198,10 +201,8 @@ acpi_status acpi_tb_validate_rsdt(struct acpi_table_header *table_ptr) | |||
198 | ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); | 201 | ACPI_DUMP_BUFFER(acpi_gbl_RSDP, 20); |
199 | 202 | ||
200 | ACPI_ERROR((AE_INFO, | 203 | ACPI_ERROR((AE_INFO, |
201 | "RSDT/XSDT signature at %X (%p) is invalid", | 204 | "RSDT/XSDT signature at %X is invalid", |
202 | acpi_gbl_RSDP->rsdt_physical_address, | 205 | acpi_gbl_RSDP->rsdt_physical_address)); |
203 | (void *)(acpi_native_uint) acpi_gbl_RSDP-> | ||
204 | rsdt_physical_address)); | ||
205 | 206 | ||
206 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 207 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
207 | ACPI_ERROR((AE_INFO, "Looking for RSDT")); | 208 | ACPI_ERROR((AE_INFO, "Looking for RSDT")); |
@@ -234,13 +235,13 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
234 | acpi_status status; | 235 | acpi_status status; |
235 | struct acpi_pointer address; | 236 | struct acpi_pointer address; |
236 | 237 | ||
237 | ACPI_FUNCTION_TRACE("tb_get_table_rsdt"); | 238 | ACPI_FUNCTION_TRACE(tb_get_table_rsdt); |
238 | 239 | ||
239 | /* Get the RSDT/XSDT via the RSDP */ | 240 | /* Get the RSDT/XSDT via the RSDP */ |
240 | 241 | ||
241 | acpi_tb_get_rsdt_address(&address); | 242 | acpi_tb_get_rsdt_address(&address); |
242 | 243 | ||
243 | table_info.type = ACPI_TABLE_XSDT; | 244 | table_info.type = ACPI_TABLE_ID_XSDT; |
244 | status = acpi_tb_get_table(&address, &table_info); | 245 | status = acpi_tb_get_table(&address, &table_info); |
245 | if (ACPI_FAILURE(status)) { | 246 | if (ACPI_FAILURE(status)) { |
246 | ACPI_EXCEPTION((AE_INFO, status, | 247 | ACPI_EXCEPTION((AE_INFO, status, |
@@ -274,12 +275,13 @@ acpi_status acpi_tb_get_table_rsdt(void) | |||
274 | 275 | ||
275 | /* Save the table pointers and allocation info */ | 276 | /* Save the table pointers and allocation info */ |
276 | 277 | ||
277 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_XSDT, &table_info); | 278 | status = acpi_tb_init_table_descriptor(ACPI_TABLE_ID_XSDT, &table_info); |
278 | if (ACPI_FAILURE(status)) { | 279 | if (ACPI_FAILURE(status)) { |
279 | return_ACPI_STATUS(status); | 280 | return_ACPI_STATUS(status); |
280 | } | 281 | } |
281 | 282 | ||
282 | acpi_gbl_XSDT = ACPI_CAST_PTR(XSDT_DESCRIPTOR, table_info.pointer); | 283 | acpi_gbl_XSDT = |
284 | ACPI_CAST_PTR(struct xsdt_descriptor, table_info.pointer); | ||
283 | 285 | ||
284 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); | 286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT)); |
285 | return_ACPI_STATUS(status); | 287 | return_ACPI_STATUS(status); |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index bc571592f087..209a401801e3 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -71,7 +71,7 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
71 | { | 71 | { |
72 | struct acpi_table_desc *table_desc; | 72 | struct acpi_table_desc *table_desc; |
73 | 73 | ||
74 | ACPI_FUNCTION_TRACE("tb_is_table_installed"); | 74 | ACPI_FUNCTION_TRACE(tb_is_table_installed); |
75 | 75 | ||
76 | /* Get the list descriptor and first table descriptor */ | 76 | /* Get the list descriptor and first table descriptor */ |
77 | 77 | ||
@@ -96,10 +96,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
96 | (!ACPI_MEMCMP | 96 | (!ACPI_MEMCMP |
97 | (table_desc->pointer, new_table_desc->pointer, | 97 | (table_desc->pointer, new_table_desc->pointer, |
98 | new_table_desc->pointer->length))) { | 98 | new_table_desc->pointer->length))) { |
99 | |||
99 | /* Match: this table is already installed */ | 100 | /* Match: this table is already installed */ |
100 | 101 | ||
101 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 102 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
102 | "Table [%4.4s] already installed: Rev %X oem_table_id [%8.8s]\n", | 103 | "Table [%4.4s] already installed: Rev %X OemTableId [%8.8s]\n", |
103 | new_table_desc->pointer->signature, | 104 | new_table_desc->pointer->signature, |
104 | new_table_desc->pointer->revision, | 105 | new_table_desc->pointer->revision, |
105 | new_table_desc->pointer-> | 106 | new_table_desc->pointer-> |
@@ -159,12 +160,8 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
159 | 160 | ||
160 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); | 161 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); |
161 | if (!acpi_ut_valid_acpi_name(signature)) { | 162 | if (!acpi_ut_valid_acpi_name(signature)) { |
162 | ACPI_ERROR((AE_INFO, | 163 | ACPI_ERROR((AE_INFO, "Invalid table signature 0x%8.8X", |
163 | "Table signature at %p [%p] has invalid characters", | 164 | signature)); |
164 | table_header, &signature)); | ||
165 | |||
166 | ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]", | ||
167 | ACPI_CAST_PTR(char, &signature))); | ||
168 | 165 | ||
169 | ACPI_DUMP_BUFFER(table_header, | 166 | ACPI_DUMP_BUFFER(table_header, |
170 | sizeof(struct acpi_table_header)); | 167 | sizeof(struct acpi_table_header)); |
@@ -175,12 +172,9 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
175 | 172 | ||
176 | if (table_header->length < sizeof(struct acpi_table_header)) { | 173 | if (table_header->length < sizeof(struct acpi_table_header)) { |
177 | ACPI_ERROR((AE_INFO, | 174 | ACPI_ERROR((AE_INFO, |
178 | "Invalid length in table header %p name %4.4s", | 175 | "Invalid length 0x%X in table with signature %4.4s", |
179 | table_header, (char *)&signature)); | 176 | (u32) table_header->length, |
180 | 177 | ACPI_CAST_PTR(char, &signature))); | |
181 | ACPI_WARNING((AE_INFO, | ||
182 | "Invalid table header length (0x%X) found", | ||
183 | (u32) table_header->length)); | ||
184 | 178 | ||
185 | ACPI_DUMP_BUFFER(table_header, | 179 | ACPI_DUMP_BUFFER(table_header, |
186 | sizeof(struct acpi_table_header)); | 180 | sizeof(struct acpi_table_header)); |
@@ -192,72 +186,119 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
192 | 186 | ||
193 | /******************************************************************************* | 187 | /******************************************************************************* |
194 | * | 188 | * |
195 | * FUNCTION: acpi_tb_verify_table_checksum | 189 | * FUNCTION: acpi_tb_sum_table |
196 | * | 190 | * |
197 | * PARAMETERS: *table_header - ACPI table to verify | 191 | * PARAMETERS: Buffer - Buffer to sum |
192 | * Length - Size of the buffer | ||
198 | * | 193 | * |
199 | * RETURN: 8 bit checksum of table | 194 | * RETURN: 8 bit sum of buffer |
200 | * | 195 | * |
201 | * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct | 196 | * DESCRIPTION: Computes an 8 bit sum of the buffer(length) and returns it. |
202 | * table should have a checksum of 0. | ||
203 | * | 197 | * |
204 | ******************************************************************************/ | 198 | ******************************************************************************/ |
205 | 199 | ||
206 | acpi_status | 200 | u8 acpi_tb_sum_table(void *buffer, u32 length) |
207 | acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) | 201 | { |
202 | acpi_native_uint i; | ||
203 | u8 sum = 0; | ||
204 | |||
205 | if (!buffer || !length) { | ||
206 | return (0); | ||
207 | } | ||
208 | |||
209 | for (i = 0; i < length; i++) { | ||
210 | sum = (u8) (sum + ((u8 *) buffer)[i]); | ||
211 | } | ||
212 | return (sum); | ||
213 | } | ||
214 | |||
215 | /******************************************************************************* | ||
216 | * | ||
217 | * FUNCTION: acpi_tb_generate_checksum | ||
218 | * | ||
219 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a | ||
220 | * standard ACPI header) | ||
221 | * | ||
222 | * RETURN: 8 bit checksum of buffer | ||
223 | * | ||
224 | * DESCRIPTION: Computes an 8 bit checksum of the table. | ||
225 | * | ||
226 | ******************************************************************************/ | ||
227 | |||
228 | u8 acpi_tb_generate_checksum(struct acpi_table_header * table) | ||
208 | { | 229 | { |
209 | u8 checksum; | 230 | u8 checksum; |
210 | acpi_status status = AE_OK; | ||
211 | 231 | ||
212 | ACPI_FUNCTION_TRACE("tb_verify_table_checksum"); | 232 | /* Sum the entire table as-is */ |
213 | 233 | ||
214 | /* Compute the checksum on the table */ | 234 | checksum = acpi_tb_sum_table(table, table->length); |
215 | 235 | ||
216 | checksum = | 236 | /* Subtract off the existing checksum value in the table */ |
217 | acpi_tb_generate_checksum(table_header, table_header->length); | ||
218 | 237 | ||
219 | /* Return the appropriate exception */ | 238 | checksum = (u8) (checksum - table->checksum); |
220 | 239 | ||
221 | if (checksum) { | 240 | /* Compute the final checksum */ |
222 | ACPI_WARNING((AE_INFO, | ||
223 | "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)", | ||
224 | table_header->signature, | ||
225 | (u32) table_header->checksum, (u32) checksum)); | ||
226 | 241 | ||
227 | status = AE_BAD_CHECKSUM; | 242 | checksum = (u8) (0 - checksum); |
228 | } | 243 | return (checksum); |
229 | return_ACPI_STATUS(status); | ||
230 | } | 244 | } |
231 | 245 | ||
232 | /******************************************************************************* | 246 | /******************************************************************************* |
233 | * | 247 | * |
234 | * FUNCTION: acpi_tb_generate_checksum | 248 | * FUNCTION: acpi_tb_set_checksum |
235 | * | 249 | * |
236 | * PARAMETERS: Buffer - Buffer to checksum | 250 | * PARAMETERS: Table - Pointer to a valid ACPI table (with a |
237 | * Length - Size of the buffer | 251 | * standard ACPI header) |
238 | * | 252 | * |
239 | * RETURN: 8 bit checksum of buffer | 253 | * RETURN: None. Sets the table checksum field |
240 | * | 254 | * |
241 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. | 255 | * DESCRIPTION: Computes an 8 bit checksum of the table and inserts the |
256 | * checksum into the table header. | ||
242 | * | 257 | * |
243 | ******************************************************************************/ | 258 | ******************************************************************************/ |
244 | 259 | ||
245 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) | 260 | void acpi_tb_set_checksum(struct acpi_table_header *table) |
246 | { | 261 | { |
247 | u8 *end_buffer; | ||
248 | u8 *rover; | ||
249 | u8 sum = 0; | ||
250 | 262 | ||
251 | if (buffer && length) { | 263 | table->checksum = acpi_tb_generate_checksum(table); |
252 | /* Buffer and Length are valid */ | 264 | } |
253 | 265 | ||
254 | end_buffer = ACPI_ADD_PTR(u8, buffer, length); | 266 | /******************************************************************************* |
267 | * | ||
268 | * FUNCTION: acpi_tb_verify_table_checksum | ||
269 | * | ||
270 | * PARAMETERS: *table_header - ACPI table to verify | ||
271 | * | ||
272 | * RETURN: 8 bit checksum of table | ||
273 | * | ||
274 | * DESCRIPTION: Generates an 8 bit checksum of table and returns and compares | ||
275 | * it to the existing checksum value. | ||
276 | * | ||
277 | ******************************************************************************/ | ||
255 | 278 | ||
256 | for (rover = buffer; rover < end_buffer; rover++) { | 279 | acpi_status |
257 | sum = (u8) (sum + *rover); | 280 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header) |
258 | } | 281 | { |
282 | u8 checksum; | ||
283 | |||
284 | ACPI_FUNCTION_TRACE(tb_verify_table_checksum); | ||
285 | |||
286 | /* Compute the checksum on the table */ | ||
287 | |||
288 | checksum = acpi_tb_generate_checksum(table_header); | ||
289 | |||
290 | /* Checksum ok? */ | ||
291 | |||
292 | if (checksum == table_header->checksum) { | ||
293 | return_ACPI_STATUS(AE_OK); | ||
259 | } | 294 | } |
260 | return (sum); | 295 | |
296 | ACPI_WARNING((AE_INFO, | ||
297 | "Incorrect checksum in table [%4.4s] - is %2.2X, should be %2.2X", | ||
298 | table_header->signature, table_header->checksum, | ||
299 | checksum)); | ||
300 | |||
301 | return_ACPI_STATUS(AE_BAD_CHECKSUM); | ||
261 | } | 302 | } |
262 | 303 | ||
263 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 304 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
@@ -276,12 +317,12 @@ u8 acpi_tb_generate_checksum(void *buffer, u32 length) | |||
276 | 317 | ||
277 | acpi_status | 318 | acpi_status |
278 | acpi_tb_handle_to_object(u16 table_id, | 319 | acpi_tb_handle_to_object(u16 table_id, |
279 | struct acpi_table_desc ** return_table_desc) | 320 | struct acpi_table_desc **return_table_desc) |
280 | { | 321 | { |
281 | u32 i; | 322 | u32 i; |
282 | struct acpi_table_desc *table_desc; | 323 | struct acpi_table_desc *table_desc; |
283 | 324 | ||
284 | ACPI_FUNCTION_NAME("tb_handle_to_object"); | 325 | ACPI_FUNCTION_NAME(tb_handle_to_object); |
285 | 326 | ||
286 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | 327 | for (i = 0; i < ACPI_TABLE_MAX; i++) { |
287 | table_desc = acpi_gbl_table_lists[i].next; | 328 | table_desc = acpi_gbl_table_lists[i].next; |
@@ -295,7 +336,7 @@ acpi_tb_handle_to_object(u16 table_id, | |||
295 | } | 336 | } |
296 | } | 337 | } |
297 | 338 | ||
298 | ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id)); | 339 | ACPI_ERROR((AE_INFO, "TableId=%X does not exist", table_id)); |
299 | return (AE_BAD_PARAMETER); | 340 | return (AE_BAD_PARAMETER); |
300 | } | 341 | } |
301 | #endif | 342 | #endif |
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index 9fe53c9d5b9a..4e91f2984815 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -42,8 +42,6 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/module.h> | ||
46 | |||
47 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
49 | #include <acpi/actables.h> | 47 | #include <acpi/actables.h> |
@@ -68,7 +66,7 @@ acpi_status acpi_load_tables(void) | |||
68 | struct acpi_pointer rsdp_address; | 66 | struct acpi_pointer rsdp_address; |
69 | acpi_status status; | 67 | acpi_status status; |
70 | 68 | ||
71 | ACPI_FUNCTION_TRACE("acpi_load_tables"); | 69 | ACPI_FUNCTION_TRACE(acpi_load_tables); |
72 | 70 | ||
73 | /* Get the RSDP */ | 71 | /* Get the RSDP */ |
74 | 72 | ||
@@ -123,6 +121,8 @@ acpi_status acpi_load_tables(void) | |||
123 | return_ACPI_STATUS(status); | 121 | return_ACPI_STATUS(status); |
124 | } | 122 | } |
125 | 123 | ||
124 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | ||
125 | |||
126 | #ifdef ACPI_FUTURE_USAGE | 126 | #ifdef ACPI_FUTURE_USAGE |
127 | /******************************************************************************* | 127 | /******************************************************************************* |
128 | * | 128 | * |
@@ -139,14 +139,13 @@ acpi_status acpi_load_tables(void) | |||
139 | * is determined that the table is invalid, the call will fail. | 139 | * is determined that the table is invalid, the call will fail. |
140 | * | 140 | * |
141 | ******************************************************************************/ | 141 | ******************************************************************************/ |
142 | |||
143 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | 142 | acpi_status acpi_load_table(struct acpi_table_header *table_ptr) |
144 | { | 143 | { |
145 | acpi_status status; | 144 | acpi_status status; |
146 | struct acpi_table_desc table_info; | 145 | struct acpi_table_desc table_info; |
147 | struct acpi_pointer address; | 146 | struct acpi_pointer address; |
148 | 147 | ||
149 | ACPI_FUNCTION_TRACE("acpi_load_table"); | 148 | ACPI_FUNCTION_TRACE(acpi_load_table); |
150 | 149 | ||
151 | if (!table_ptr) { | 150 | if (!table_ptr) { |
152 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 151 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -174,6 +173,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
174 | status = acpi_tb_install_table(&table_info); | 173 | status = acpi_tb_install_table(&table_info); |
175 | if (ACPI_FAILURE(status)) { | 174 | if (ACPI_FAILURE(status)) { |
176 | if (status == AE_ALREADY_EXISTS) { | 175 | if (status == AE_ALREADY_EXISTS) { |
176 | |||
177 | /* Table already exists, no error */ | 177 | /* Table already exists, no error */ |
178 | 178 | ||
179 | status = AE_OK; | 179 | status = AE_OK; |
@@ -188,12 +188,12 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
188 | /* Convert the table to common format if necessary */ | 188 | /* Convert the table to common format if necessary */ |
189 | 189 | ||
190 | switch (table_info.type) { | 190 | switch (table_info.type) { |
191 | case ACPI_TABLE_FADT: | 191 | case ACPI_TABLE_ID_FADT: |
192 | 192 | ||
193 | status = acpi_tb_convert_table_fadt(); | 193 | status = acpi_tb_convert_table_fadt(); |
194 | break; | 194 | break; |
195 | 195 | ||
196 | case ACPI_TABLE_FACS: | 196 | case ACPI_TABLE_ID_FACS: |
197 | 197 | ||
198 | status = acpi_tb_build_common_facs(&table_info); | 198 | status = acpi_tb_build_common_facs(&table_info); |
199 | break; | 199 | break; |
@@ -208,6 +208,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | if (ACPI_FAILURE(status)) { | 210 | if (ACPI_FAILURE(status)) { |
211 | |||
211 | /* Uninstall table and free the buffer */ | 212 | /* Uninstall table and free the buffer */ |
212 | 213 | ||
213 | (void)acpi_tb_uninstall_table(table_info.installed_desc); | 214 | (void)acpi_tb_uninstall_table(table_info.installed_desc); |
@@ -216,6 +217,8 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
216 | return_ACPI_STATUS(status); | 217 | return_ACPI_STATUS(status); |
217 | } | 218 | } |
218 | 219 | ||
220 | ACPI_EXPORT_SYMBOL(acpi_load_table) | ||
221 | |||
219 | /******************************************************************************* | 222 | /******************************************************************************* |
220 | * | 223 | * |
221 | * FUNCTION: acpi_unload_table | 224 | * FUNCTION: acpi_unload_table |
@@ -227,16 +230,15 @@ acpi_status acpi_load_table(struct acpi_table_header *table_ptr) | |||
227 | * DESCRIPTION: This routine is used to force the unload of a table | 230 | * DESCRIPTION: This routine is used to force the unload of a table |
228 | * | 231 | * |
229 | ******************************************************************************/ | 232 | ******************************************************************************/ |
230 | |||
231 | acpi_status acpi_unload_table(acpi_table_type table_type) | 233 | acpi_status acpi_unload_table(acpi_table_type table_type) |
232 | { | 234 | { |
233 | struct acpi_table_desc *table_desc; | 235 | struct acpi_table_desc *table_desc; |
234 | 236 | ||
235 | ACPI_FUNCTION_TRACE("acpi_unload_table"); | 237 | ACPI_FUNCTION_TRACE(acpi_unload_table); |
236 | 238 | ||
237 | /* Parameter validation */ | 239 | /* Parameter validation */ |
238 | 240 | ||
239 | if (table_type > ACPI_TABLE_MAX) { | 241 | if (table_type > ACPI_TABLE_ID_MAX) { |
240 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 242 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
241 | } | 243 | } |
242 | 244 | ||
@@ -261,6 +263,8 @@ acpi_status acpi_unload_table(acpi_table_type table_type) | |||
261 | return_ACPI_STATUS(AE_OK); | 263 | return_ACPI_STATUS(AE_OK); |
262 | } | 264 | } |
263 | 265 | ||
266 | ACPI_EXPORT_SYMBOL(acpi_unload_table) | ||
267 | |||
264 | /******************************************************************************* | 268 | /******************************************************************************* |
265 | * | 269 | * |
266 | * FUNCTION: acpi_get_table_header | 270 | * FUNCTION: acpi_get_table_header |
@@ -281,7 +285,6 @@ acpi_status acpi_unload_table(acpi_table_type table_type) | |||
281 | * have a standard header and is fixed length. | 285 | * have a standard header and is fixed length. |
282 | * | 286 | * |
283 | ******************************************************************************/ | 287 | ******************************************************************************/ |
284 | |||
285 | acpi_status | 288 | acpi_status |
286 | acpi_get_table_header(acpi_table_type table_type, | 289 | acpi_get_table_header(acpi_table_type table_type, |
287 | u32 instance, struct acpi_table_header *out_table_header) | 290 | u32 instance, struct acpi_table_header *out_table_header) |
@@ -289,16 +292,16 @@ acpi_get_table_header(acpi_table_type table_type, | |||
289 | struct acpi_table_header *tbl_ptr; | 292 | struct acpi_table_header *tbl_ptr; |
290 | acpi_status status; | 293 | acpi_status status; |
291 | 294 | ||
292 | ACPI_FUNCTION_TRACE("acpi_get_table_header"); | 295 | ACPI_FUNCTION_TRACE(acpi_get_table_header); |
293 | 296 | ||
294 | if ((instance == 0) || | 297 | if ((instance == 0) || |
295 | (table_type == ACPI_TABLE_RSDP) || (!out_table_header)) { | 298 | (table_type == ACPI_TABLE_ID_RSDP) || (!out_table_header)) { |
296 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 299 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
297 | } | 300 | } |
298 | 301 | ||
299 | /* Check the table type and instance */ | 302 | /* Check the table type and instance */ |
300 | 303 | ||
301 | if ((table_type > ACPI_TABLE_MAX) || | 304 | if ((table_type > ACPI_TABLE_ID_MAX) || |
302 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && | 305 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && |
303 | instance > 1)) { | 306 | instance > 1)) { |
304 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 307 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -325,6 +328,7 @@ acpi_get_table_header(acpi_table_type table_type, | |||
325 | return_ACPI_STATUS(status); | 328 | return_ACPI_STATUS(status); |
326 | } | 329 | } |
327 | 330 | ||
331 | ACPI_EXPORT_SYMBOL(acpi_get_table_header) | ||
328 | #endif /* ACPI_FUTURE_USAGE */ | 332 | #endif /* ACPI_FUTURE_USAGE */ |
329 | 333 | ||
330 | /******************************************************************************* | 334 | /******************************************************************************* |
@@ -349,7 +353,6 @@ acpi_get_table_header(acpi_table_type table_type, | |||
349 | * a complete table including the header. | 353 | * a complete table including the header. |
350 | * | 354 | * |
351 | ******************************************************************************/ | 355 | ******************************************************************************/ |
352 | |||
353 | acpi_status | 356 | acpi_status |
354 | acpi_get_table(acpi_table_type table_type, | 357 | acpi_get_table(acpi_table_type table_type, |
355 | u32 instance, struct acpi_buffer *ret_buffer) | 358 | u32 instance, struct acpi_buffer *ret_buffer) |
@@ -358,7 +361,7 @@ acpi_get_table(acpi_table_type table_type, | |||
358 | acpi_status status; | 361 | acpi_status status; |
359 | acpi_size table_length; | 362 | acpi_size table_length; |
360 | 363 | ||
361 | ACPI_FUNCTION_TRACE("acpi_get_table"); | 364 | ACPI_FUNCTION_TRACE(acpi_get_table); |
362 | 365 | ||
363 | /* Parameter validation */ | 366 | /* Parameter validation */ |
364 | 367 | ||
@@ -373,7 +376,7 @@ acpi_get_table(acpi_table_type table_type, | |||
373 | 376 | ||
374 | /* Check the table type and instance */ | 377 | /* Check the table type and instance */ |
375 | 378 | ||
376 | if ((table_type > ACPI_TABLE_MAX) || | 379 | if ((table_type > ACPI_TABLE_ID_MAX) || |
377 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && | 380 | (ACPI_IS_SINGLE_TABLE(acpi_gbl_table_data[table_type].flags) && |
378 | instance > 1)) { | 381 | instance > 1)) { |
379 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 382 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
@@ -396,7 +399,8 @@ acpi_get_table(acpi_table_type table_type, | |||
396 | 399 | ||
397 | /* Get the table length */ | 400 | /* Get the table length */ |
398 | 401 | ||
399 | if (table_type == ACPI_TABLE_RSDP) { | 402 | if (table_type == ACPI_TABLE_ID_RSDP) { |
403 | |||
400 | /* RSD PTR is the only "table" without a header */ | 404 | /* RSD PTR is the only "table" without a header */ |
401 | 405 | ||
402 | table_length = sizeof(struct rsdp_descriptor); | 406 | table_length = sizeof(struct rsdp_descriptor); |
@@ -417,4 +421,4 @@ acpi_get_table(acpi_table_type table_type, | |||
417 | return_ACPI_STATUS(AE_OK); | 421 | return_ACPI_STATUS(AE_OK); |
418 | } | 422 | } |
419 | 423 | ||
420 | EXPORT_SYMBOL(acpi_get_table); | 424 | ACPI_EXPORT_SYMBOL(acpi_get_table) |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index a62db6af83c9..da2648bbdbc0 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/actables.h> | 45 | #include <acpi/actables.h> |
48 | 46 | ||
@@ -75,6 +73,7 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
75 | * The signature and checksum must both be correct | 73 | * The signature and checksum must both be correct |
76 | */ | 74 | */ |
77 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { | 75 | if (ACPI_STRNCMP((char *)rsdp, RSDP_SIG, sizeof(RSDP_SIG) - 1) != 0) { |
76 | |||
78 | /* Nope, BAD Signature */ | 77 | /* Nope, BAD Signature */ |
79 | 78 | ||
80 | return (AE_BAD_SIGNATURE); | 79 | return (AE_BAD_SIGNATURE); |
@@ -82,15 +81,14 @@ acpi_status acpi_tb_validate_rsdp(struct rsdp_descriptor *rsdp) | |||
82 | 81 | ||
83 | /* Check the standard checksum */ | 82 | /* Check the standard checksum */ |
84 | 83 | ||
85 | if (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | 84 | if (acpi_tb_sum_table(rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { |
86 | return (AE_BAD_CHECKSUM); | 85 | return (AE_BAD_CHECKSUM); |
87 | } | 86 | } |
88 | 87 | ||
89 | /* Check extended checksum if table version >= 2 */ | 88 | /* Check extended checksum if table version >= 2 */ |
90 | 89 | ||
91 | if ((rsdp->revision >= 2) && | 90 | if ((rsdp->revision >= 2) && |
92 | (acpi_tb_generate_checksum(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != | 91 | (acpi_tb_sum_table(rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0)) { |
93 | 0)) { | ||
94 | return (AE_BAD_CHECKSUM); | 92 | return (AE_BAD_CHECKSUM); |
95 | } | 93 | } |
96 | 94 | ||
@@ -121,7 +119,7 @@ acpi_tb_find_table(char *signature, | |||
121 | acpi_status status; | 119 | acpi_status status; |
122 | struct acpi_table_header *table; | 120 | struct acpi_table_header *table; |
123 | 121 | ||
124 | ACPI_FUNCTION_TRACE("tb_find_table"); | 122 | ACPI_FUNCTION_TRACE(tb_find_table); |
125 | 123 | ||
126 | /* Validate string lengths */ | 124 | /* Validate string lengths */ |
127 | 125 | ||
@@ -131,7 +129,7 @@ acpi_tb_find_table(char *signature, | |||
131 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); | 129 | return_ACPI_STATUS(AE_AML_STRING_LIMIT); |
132 | } | 130 | } |
133 | 131 | ||
134 | if (!ACPI_STRNCMP(signature, DSDT_SIG, ACPI_NAME_SIZE)) { | 132 | if (ACPI_COMPARE_NAME(signature, DSDT_SIG)) { |
135 | /* | 133 | /* |
136 | * The DSDT pointer is contained in the FADT, not the RSDT. | 134 | * The DSDT pointer is contained in the FADT, not the RSDT. |
137 | * This code should suffice, because the only code that would perform | 135 | * This code should suffice, because the only code that would perform |
@@ -156,10 +154,12 @@ acpi_tb_find_table(char *signature, | |||
156 | 154 | ||
157 | /* Check oem_id and oem_table_id */ | 155 | /* Check oem_id and oem_table_id */ |
158 | 156 | ||
159 | if ((oem_id[0] && ACPI_STRNCMP(oem_id, table->oem_id, | 157 | if ((oem_id[0] && |
160 | sizeof(table->oem_id))) || | 158 | ACPI_STRNCMP(oem_id, table->oem_id, |
161 | (oem_table_id[0] && ACPI_STRNCMP(oem_table_id, table->oem_table_id, | 159 | sizeof(table->oem_id))) || |
162 | sizeof(table->oem_table_id)))) { | 160 | (oem_table_id[0] && |
161 | ACPI_STRNCMP(oem_table_id, table->oem_table_id, | ||
162 | sizeof(table->oem_table_id)))) { | ||
163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); | 163 | return_ACPI_STATUS(AE_AML_NAME_NOT_FOUND); |
164 | } | 164 | } |
165 | 165 | ||
@@ -203,7 +203,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
203 | u32 i; | 203 | u32 i; |
204 | u32 j; | 204 | u32 j; |
205 | 205 | ||
206 | ACPI_FUNCTION_TRACE("acpi_get_firmware_table"); | 206 | ACPI_FUNCTION_TRACE(acpi_get_firmware_table); |
207 | 207 | ||
208 | /* | 208 | /* |
209 | * Ensure that at least the table manager is initialized. We don't | 209 | * Ensure that at least the table manager is initialized. We don't |
@@ -217,6 +217,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
217 | /* Ensure that we have a RSDP */ | 217 | /* Ensure that we have a RSDP */ |
218 | 218 | ||
219 | if (!acpi_gbl_RSDP) { | 219 | if (!acpi_gbl_RSDP) { |
220 | |||
220 | /* Get the RSDP */ | 221 | /* Get the RSDP */ |
221 | 222 | ||
222 | status = acpi_os_get_root_pointer(flags, &address); | 223 | status = acpi_os_get_root_pointer(flags, &address); |
@@ -261,7 +262,7 @@ acpi_get_firmware_table(acpi_string signature, | |||
261 | 262 | ||
262 | /* Get and validate the RSDT */ | 263 | /* Get and validate the RSDT */ |
263 | 264 | ||
264 | rsdt_info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_table_desc)); | 265 | rsdt_info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_table_desc)); |
265 | if (!rsdt_info) { | 266 | if (!rsdt_info) { |
266 | return_ACPI_STATUS(AE_NO_MEMORY); | 267 | return_ACPI_STATUS(AE_NO_MEMORY); |
267 | } | 268 | } |
@@ -278,13 +279,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
278 | 279 | ||
279 | /* Allocate a scratch table header and table descriptor */ | 280 | /* Allocate a scratch table header and table descriptor */ |
280 | 281 | ||
281 | header = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_header)); | 282 | header = ACPI_ALLOCATE(sizeof(struct acpi_table_header)); |
282 | if (!header) { | 283 | if (!header) { |
283 | status = AE_NO_MEMORY; | 284 | status = AE_NO_MEMORY; |
284 | goto cleanup; | 285 | goto cleanup; |
285 | } | 286 | } |
286 | 287 | ||
287 | table_info = ACPI_MEM_ALLOCATE(sizeof(struct acpi_table_desc)); | 288 | table_info = ACPI_ALLOCATE(sizeof(struct acpi_table_desc)); |
288 | if (!table_info) { | 289 | if (!table_info) { |
289 | status = AE_NO_MEMORY; | 290 | status = AE_NO_MEMORY; |
290 | goto cleanup; | 291 | goto cleanup; |
@@ -308,12 +309,12 @@ acpi_get_firmware_table(acpi_string signature, | |||
308 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | 309 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { |
309 | address.pointer.value = | 310 | address.pointer.value = |
310 | (ACPI_CAST_PTR | 311 | (ACPI_CAST_PTR |
311 | (RSDT_DESCRIPTOR, | 312 | (struct rsdt_descriptor, |
312 | rsdt_info->pointer))->table_offset_entry[i]; | 313 | rsdt_info->pointer))->table_offset_entry[i]; |
313 | } else { | 314 | } else { |
314 | address.pointer.value = | 315 | address.pointer.value = |
315 | (ACPI_CAST_PTR | 316 | (ACPI_CAST_PTR |
316 | (XSDT_DESCRIPTOR, | 317 | (struct xsdt_descriptor, |
317 | rsdt_info->pointer))->table_offset_entry[i]; | 318 | rsdt_info->pointer))->table_offset_entry[i]; |
318 | } | 319 | } |
319 | 320 | ||
@@ -326,11 +327,13 @@ acpi_get_firmware_table(acpi_string signature, | |||
326 | 327 | ||
327 | /* Compare table signatures and table instance */ | 328 | /* Compare table signatures and table instance */ |
328 | 329 | ||
329 | if (!ACPI_STRNCMP(header->signature, signature, ACPI_NAME_SIZE)) { | 330 | if (ACPI_COMPARE_NAME(header->signature, signature)) { |
331 | |||
330 | /* An instance of the table was found */ | 332 | /* An instance of the table was found */ |
331 | 333 | ||
332 | j++; | 334 | j++; |
333 | if (j >= instance) { | 335 | if (j >= instance) { |
336 | |||
334 | /* Found the correct instance, get the entire table */ | 337 | /* Found the correct instance, get the entire table */ |
335 | 338 | ||
336 | status = | 339 | status = |
@@ -355,23 +358,21 @@ acpi_get_firmware_table(acpi_string signature, | |||
355 | acpi_os_unmap_memory(rsdt_info->pointer, | 358 | acpi_os_unmap_memory(rsdt_info->pointer, |
356 | (acpi_size) rsdt_info->pointer->length); | 359 | (acpi_size) rsdt_info->pointer->length); |
357 | } | 360 | } |
358 | ACPI_MEM_FREE(rsdt_info); | 361 | ACPI_FREE(rsdt_info); |
359 | 362 | ||
360 | if (header) { | 363 | if (header) { |
361 | ACPI_MEM_FREE(header); | 364 | ACPI_FREE(header); |
362 | } | 365 | } |
363 | if (table_info) { | 366 | if (table_info) { |
364 | ACPI_MEM_FREE(table_info); | 367 | ACPI_FREE(table_info); |
365 | } | 368 | } |
366 | return_ACPI_STATUS(status); | 369 | return_ACPI_STATUS(status); |
367 | } | 370 | } |
368 | 371 | ||
369 | EXPORT_SYMBOL(acpi_get_firmware_table); | 372 | ACPI_EXPORT_SYMBOL(acpi_get_firmware_table) |
370 | 373 | ||
371 | /* TBD: Move to a new file */ | 374 | /* TBD: Move to a new file */ |
372 | |||
373 | #if ACPI_MACHINE_WIDTH != 16 | 375 | #if ACPI_MACHINE_WIDTH != 16 |
374 | |||
375 | /******************************************************************************* | 376 | /******************************************************************************* |
376 | * | 377 | * |
377 | * FUNCTION: acpi_find_root_pointer | 378 | * FUNCTION: acpi_find_root_pointer |
@@ -384,13 +385,12 @@ EXPORT_SYMBOL(acpi_get_firmware_table); | |||
384 | * DESCRIPTION: Find the RSDP | 385 | * DESCRIPTION: Find the RSDP |
385 | * | 386 | * |
386 | ******************************************************************************/ | 387 | ******************************************************************************/ |
387 | |||
388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | 388 | acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) |
389 | { | 389 | { |
390 | struct acpi_table_desc table_info; | 390 | struct acpi_table_desc table_info; |
391 | acpi_status status; | 391 | acpi_status status; |
392 | 392 | ||
393 | ACPI_FUNCTION_TRACE("acpi_find_root_pointer"); | 393 | ACPI_FUNCTION_TRACE(acpi_find_root_pointer); |
394 | 394 | ||
395 | /* Get the RSDP */ | 395 | /* Get the RSDP */ |
396 | 396 | ||
@@ -407,6 +407,8 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
407 | return_ACPI_STATUS(AE_OK); | 407 | return_ACPI_STATUS(AE_OK); |
408 | } | 408 | } |
409 | 409 | ||
410 | ACPI_EXPORT_SYMBOL(acpi_find_root_pointer) | ||
411 | |||
410 | /******************************************************************************* | 412 | /******************************************************************************* |
411 | * | 413 | * |
412 | * FUNCTION: acpi_tb_scan_memory_for_rsdp | 414 | * FUNCTION: acpi_tb_scan_memory_for_rsdp |
@@ -419,14 +421,13 @@ acpi_status acpi_find_root_pointer(u32 flags, struct acpi_pointer *rsdp_address) | |||
419 | * DESCRIPTION: Search a block of memory for the RSDP signature | 421 | * DESCRIPTION: Search a block of memory for the RSDP signature |
420 | * | 422 | * |
421 | ******************************************************************************/ | 423 | ******************************************************************************/ |
422 | |||
423 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | 424 | static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) |
424 | { | 425 | { |
425 | acpi_status status; | 426 | acpi_status status; |
426 | u8 *mem_rover; | 427 | u8 *mem_rover; |
427 | u8 *end_address; | 428 | u8 *end_address; |
428 | 429 | ||
429 | ACPI_FUNCTION_TRACE("tb_scan_memory_for_rsdp"); | 430 | ACPI_FUNCTION_TRACE(tb_scan_memory_for_rsdp); |
430 | 431 | ||
431 | end_address = start_address + length; | 432 | end_address = start_address + length; |
432 | 433 | ||
@@ -434,12 +435,14 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
434 | 435 | ||
435 | for (mem_rover = start_address; mem_rover < end_address; | 436 | for (mem_rover = start_address; mem_rover < end_address; |
436 | mem_rover += ACPI_RSDP_SCAN_STEP) { | 437 | mem_rover += ACPI_RSDP_SCAN_STEP) { |
438 | |||
437 | /* The RSDP signature and checksum must both be correct */ | 439 | /* The RSDP signature and checksum must both be correct */ |
438 | 440 | ||
439 | status = | 441 | status = |
440 | acpi_tb_validate_rsdp(ACPI_CAST_PTR | 442 | acpi_tb_validate_rsdp(ACPI_CAST_PTR |
441 | (struct rsdp_descriptor, mem_rover)); | 443 | (struct rsdp_descriptor, mem_rover)); |
442 | if (ACPI_SUCCESS(status)) { | 444 | if (ACPI_SUCCESS(status)) { |
445 | |||
443 | /* Sig and checksum valid, we have found a real RSDP */ | 446 | /* Sig and checksum valid, we have found a real RSDP */ |
444 | 447 | ||
445 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 448 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -469,10 +472,10 @@ static u8 *acpi_tb_scan_memory_for_rsdp(u8 * start_address, u32 length) | |||
469 | * | 472 | * |
470 | * RETURN: Status, RSDP physical address | 473 | * RETURN: Status, RSDP physical address |
471 | * | 474 | * |
472 | * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor | 475 | * DESCRIPTION: Search lower 1_mbyte of memory for the root system descriptor |
473 | * pointer structure. If it is found, set *RSDP to point to it. | 476 | * pointer structure. If it is found, set *RSDP to point to it. |
474 | * | 477 | * |
475 | * NOTE1: The RSDp must be either in the first 1_k of the Extended | 478 | * NOTE1: The RSDP must be either in the first 1_k of the Extended |
476 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) | 479 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) |
477 | * Only a 32-bit physical address is necessary. | 480 | * Only a 32-bit physical address is necessary. |
478 | * | 481 | * |
@@ -489,12 +492,13 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
489 | u32 physical_address; | 492 | u32 physical_address; |
490 | acpi_status status; | 493 | acpi_status status; |
491 | 494 | ||
492 | ACPI_FUNCTION_TRACE("tb_find_rsdp"); | 495 | ACPI_FUNCTION_TRACE(tb_find_rsdp); |
493 | 496 | ||
494 | /* | 497 | /* |
495 | * Scan supports either logical addressing or physical addressing | 498 | * Scan supports either logical addressing or physical addressing |
496 | */ | 499 | */ |
497 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | 500 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { |
501 | |||
498 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ | 502 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
499 | 503 | ||
500 | status = acpi_os_map_memory((acpi_physical_address) | 504 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -521,7 +525,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
521 | 525 | ||
522 | if (physical_address > 0x400) { | 526 | if (physical_address > 0x400) { |
523 | /* | 527 | /* |
524 | * 1b) Search EBDA paragraphs (EBDa is required to be a | 528 | * 1b) Search EBDA paragraphs (EBDA is required to be a |
525 | * minimum of 1_k length) | 529 | * minimum of 1_k length) |
526 | */ | 530 | */ |
527 | status = acpi_os_map_memory((acpi_physical_address) | 531 | status = acpi_os_map_memory((acpi_physical_address) |
@@ -542,10 +546,11 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
542 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); | 546 | acpi_os_unmap_memory(table_ptr, ACPI_EBDA_WINDOW_SIZE); |
543 | 547 | ||
544 | if (mem_rover) { | 548 | if (mem_rover) { |
549 | |||
545 | /* Return the physical address */ | 550 | /* Return the physical address */ |
546 | 551 | ||
547 | physical_address += | 552 | physical_address += |
548 | ACPI_PTR_DIFF(mem_rover, table_ptr); | 553 | (u32) ACPI_PTR_DIFF(mem_rover, table_ptr); |
549 | 554 | ||
550 | table_info->physical_address = | 555 | table_info->physical_address = |
551 | (acpi_physical_address) physical_address; | 556 | (acpi_physical_address) physical_address; |
@@ -576,11 +581,12 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
576 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | 581 | acpi_os_unmap_memory(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); |
577 | 582 | ||
578 | if (mem_rover) { | 583 | if (mem_rover) { |
584 | |||
579 | /* Return the physical address */ | 585 | /* Return the physical address */ |
580 | 586 | ||
581 | physical_address = | 587 | physical_address = (u32) |
582 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF(mem_rover, | 588 | (ACPI_HI_RSDP_WINDOW_BASE + |
583 | table_ptr); | 589 | ACPI_PTR_DIFF(mem_rover, table_ptr)); |
584 | 590 | ||
585 | table_info->physical_address = | 591 | table_info->physical_address = |
586 | (acpi_physical_address) physical_address; | 592 | (acpi_physical_address) physical_address; |
@@ -601,7 +607,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
601 | 607 | ||
602 | if (physical_address > 0x400) { | 608 | if (physical_address > 0x400) { |
603 | /* | 609 | /* |
604 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of | 610 | * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of |
605 | * 1_k length) | 611 | * 1_k length) |
606 | */ | 612 | */ |
607 | mem_rover = | 613 | mem_rover = |
@@ -609,6 +615,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
609 | (physical_address), | 615 | (physical_address), |
610 | ACPI_EBDA_WINDOW_SIZE); | 616 | ACPI_EBDA_WINDOW_SIZE); |
611 | if (mem_rover) { | 617 | if (mem_rover) { |
618 | |||
612 | /* Return the physical address */ | 619 | /* Return the physical address */ |
613 | 620 | ||
614 | table_info->physical_address = | 621 | table_info->physical_address = |
@@ -624,6 +631,7 @@ acpi_tb_find_rsdp(struct acpi_table_desc *table_info, u32 flags) | |||
624 | (ACPI_HI_RSDP_WINDOW_BASE), | 631 | (ACPI_HI_RSDP_WINDOW_BASE), |
625 | ACPI_HI_RSDP_WINDOW_SIZE); | 632 | ACPI_HI_RSDP_WINDOW_SIZE); |
626 | if (mem_rover) { | 633 | if (mem_rover) { |
634 | |||
627 | /* Found it, return the physical address */ | 635 | /* Found it, return the physical address */ |
628 | 636 | ||
629 | table_info->physical_address = | 637 | table_info->physical_address = |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 19f3ea48475e..e7fe3a14fdaf 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -82,6 +82,7 @@ MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); | |||
82 | 82 | ||
83 | static int acpi_thermal_add(struct acpi_device *device); | 83 | static int acpi_thermal_add(struct acpi_device *device); |
84 | static int acpi_thermal_remove(struct acpi_device *device, int type); | 84 | static int acpi_thermal_remove(struct acpi_device *device, int type); |
85 | static int acpi_thermal_resume(struct acpi_device *device, int state); | ||
85 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); | 86 | static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); |
86 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); | 87 | static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); |
87 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); | 88 | static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); |
@@ -103,6 +104,7 @@ static struct acpi_driver acpi_thermal_driver = { | |||
103 | .ops = { | 104 | .ops = { |
104 | .add = acpi_thermal_add, | 105 | .add = acpi_thermal_add, |
105 | .remove = acpi_thermal_remove, | 106 | .remove = acpi_thermal_remove, |
107 | .resume = acpi_thermal_resume, | ||
106 | }, | 108 | }, |
107 | }; | 109 | }; |
108 | 110 | ||
@@ -684,8 +686,7 @@ static void acpi_thermal_run(unsigned long data) | |||
684 | { | 686 | { |
685 | struct acpi_thermal *tz = (struct acpi_thermal *)data; | 687 | struct acpi_thermal *tz = (struct acpi_thermal *)data; |
686 | if (!tz->zombie) | 688 | if (!tz->zombie) |
687 | acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 689 | acpi_os_execute(OSL_GPE_HANDLER, acpi_thermal_check, (void *)data); |
688 | acpi_thermal_check, (void *)data); | ||
689 | } | 690 | } |
690 | 691 | ||
691 | static void acpi_thermal_check(void *data) | 692 | static void acpi_thermal_check(void *data) |
@@ -942,8 +943,10 @@ acpi_thermal_write_trip_points(struct file *file, | |||
942 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); | 943 | memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN); |
943 | 944 | ||
944 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); | 945 | active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL); |
945 | if (!active) | 946 | if (!active) { |
947 | kfree(limit_string); | ||
946 | return_VALUE(-ENOMEM); | 948 | return_VALUE(-ENOMEM); |
949 | } | ||
947 | 950 | ||
948 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { | 951 | if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) { |
949 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); | 952 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n")); |
@@ -1342,7 +1345,7 @@ static int acpi_thermal_add(struct acpi_device *device) | |||
1342 | 1345 | ||
1343 | result = acpi_thermal_add_fs(device); | 1346 | result = acpi_thermal_add_fs(device); |
1344 | if (result) | 1347 | if (result) |
1345 | return_VALUE(result); | 1348 | goto end; |
1346 | 1349 | ||
1347 | init_timer(&tz->timer); | 1350 | init_timer(&tz->timer); |
1348 | 1351 | ||
@@ -1416,6 +1419,20 @@ static int acpi_thermal_remove(struct acpi_device *device, int type) | |||
1416 | return_VALUE(0); | 1419 | return_VALUE(0); |
1417 | } | 1420 | } |
1418 | 1421 | ||
1422 | static int acpi_thermal_resume(struct acpi_device *device, int state) | ||
1423 | { | ||
1424 | struct acpi_thermal *tz = NULL; | ||
1425 | |||
1426 | if (!device || !acpi_driver_data(device)) | ||
1427 | return_VALUE(-EINVAL); | ||
1428 | |||
1429 | tz = (struct acpi_thermal *)acpi_driver_data(device); | ||
1430 | |||
1431 | acpi_thermal_check(tz); | ||
1432 | |||
1433 | return AE_OK; | ||
1434 | } | ||
1435 | |||
1419 | static int __init acpi_thermal_init(void) | 1436 | static int __init acpi_thermal_init(void) |
1420 | { | 1437 | { |
1421 | int result = 0; | 1438 | int result = 0; |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 03b0044974c2..7940fc1bd69e 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -46,24 +46,6 @@ | |||
46 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
47 | ACPI_MODULE_NAME("utalloc") | 47 | ACPI_MODULE_NAME("utalloc") |
48 | 48 | ||
49 | /* Local prototypes */ | ||
50 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
51 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation); | ||
52 | |||
53 | static acpi_status | ||
54 | acpi_ut_track_allocation(struct acpi_debug_mem_block *address, | ||
55 | acpi_size size, | ||
56 | u8 alloc_type, u32 component, char *module, u32 line); | ||
57 | |||
58 | static acpi_status | ||
59 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *address, | ||
60 | u32 component, char *module, u32 line); | ||
61 | |||
62 | static acpi_status | ||
63 | acpi_ut_create_list(char *list_name, | ||
64 | u16 object_size, struct acpi_memory_list **return_cache); | ||
65 | #endif | ||
66 | |||
67 | /******************************************************************************* | 49 | /******************************************************************************* |
68 | * | 50 | * |
69 | * FUNCTION: acpi_ut_create_caches | 51 | * FUNCTION: acpi_ut_create_caches |
@@ -75,33 +57,23 @@ acpi_ut_create_list(char *list_name, | |||
75 | * DESCRIPTION: Create all local caches | 57 | * DESCRIPTION: Create all local caches |
76 | * | 58 | * |
77 | ******************************************************************************/ | 59 | ******************************************************************************/ |
78 | |||
79 | acpi_status acpi_ut_create_caches(void) | 60 | acpi_status acpi_ut_create_caches(void) |
80 | { | 61 | { |
81 | acpi_status status; | 62 | acpi_status status; |
82 | 63 | ||
83 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 64 | /* Object Caches, for frequently used objects */ |
84 | |||
85 | /* Memory allocation lists */ | ||
86 | |||
87 | status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); | ||
88 | if (ACPI_FAILURE(status)) { | ||
89 | return (status); | ||
90 | } | ||
91 | 65 | ||
92 | status = | 66 | status = |
93 | acpi_ut_create_list("Acpi-Namespace", | 67 | acpi_os_create_cache("Acpi-Namespace", |
94 | sizeof(struct acpi_namespace_node), | 68 | sizeof(struct acpi_namespace_node), |
95 | &acpi_gbl_ns_node_list); | 69 | ACPI_MAX_NAMESPACE_CACHE_DEPTH, |
70 | &acpi_gbl_namespace_cache); | ||
96 | if (ACPI_FAILURE(status)) { | 71 | if (ACPI_FAILURE(status)) { |
97 | return (status); | 72 | return (status); |
98 | } | 73 | } |
99 | #endif | ||
100 | |||
101 | /* Object Caches, for frequently used objects */ | ||
102 | 74 | ||
103 | status = | 75 | status = |
104 | acpi_os_create_cache("acpi_state", sizeof(union acpi_generic_state), | 76 | acpi_os_create_cache("Acpi-State", sizeof(union acpi_generic_state), |
105 | ACPI_MAX_STATE_CACHE_DEPTH, | 77 | ACPI_MAX_STATE_CACHE_DEPTH, |
106 | &acpi_gbl_state_cache); | 78 | &acpi_gbl_state_cache); |
107 | if (ACPI_FAILURE(status)) { | 79 | if (ACPI_FAILURE(status)) { |
@@ -109,7 +81,7 @@ acpi_status acpi_ut_create_caches(void) | |||
109 | } | 81 | } |
110 | 82 | ||
111 | status = | 83 | status = |
112 | acpi_os_create_cache("acpi_parse", | 84 | acpi_os_create_cache("Acpi-Parse", |
113 | sizeof(struct acpi_parse_obj_common), | 85 | sizeof(struct acpi_parse_obj_common), |
114 | ACPI_MAX_PARSE_CACHE_DEPTH, | 86 | ACPI_MAX_PARSE_CACHE_DEPTH, |
115 | &acpi_gbl_ps_node_cache); | 87 | &acpi_gbl_ps_node_cache); |
@@ -118,7 +90,7 @@ acpi_status acpi_ut_create_caches(void) | |||
118 | } | 90 | } |
119 | 91 | ||
120 | status = | 92 | status = |
121 | acpi_os_create_cache("acpi_parse_ext", | 93 | acpi_os_create_cache("Acpi-ParseExt", |
122 | sizeof(struct acpi_parse_obj_named), | 94 | sizeof(struct acpi_parse_obj_named), |
123 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, | 95 | ACPI_MAX_EXTPARSE_CACHE_DEPTH, |
124 | &acpi_gbl_ps_node_ext_cache); | 96 | &acpi_gbl_ps_node_ext_cache); |
@@ -127,7 +99,7 @@ acpi_status acpi_ut_create_caches(void) | |||
127 | } | 99 | } |
128 | 100 | ||
129 | status = | 101 | status = |
130 | acpi_os_create_cache("acpi_operand", | 102 | acpi_os_create_cache("Acpi-Operand", |
131 | sizeof(union acpi_operand_object), | 103 | sizeof(union acpi_operand_object), |
132 | ACPI_MAX_OBJECT_CACHE_DEPTH, | 104 | ACPI_MAX_OBJECT_CACHE_DEPTH, |
133 | &acpi_gbl_operand_cache); | 105 | &acpi_gbl_operand_cache); |
@@ -135,6 +107,24 @@ acpi_status acpi_ut_create_caches(void) | |||
135 | return (status); | 107 | return (status); |
136 | } | 108 | } |
137 | 109 | ||
110 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
111 | |||
112 | /* Memory allocation lists */ | ||
113 | |||
114 | status = acpi_ut_create_list("Acpi-Global", 0, &acpi_gbl_global_list); | ||
115 | if (ACPI_FAILURE(status)) { | ||
116 | return (status); | ||
117 | } | ||
118 | |||
119 | status = | ||
120 | acpi_ut_create_list("Acpi-Namespace", | ||
121 | sizeof(struct acpi_namespace_node), | ||
122 | &acpi_gbl_ns_node_list); | ||
123 | if (ACPI_FAILURE(status)) { | ||
124 | return (status); | ||
125 | } | ||
126 | #endif | ||
127 | |||
138 | return (AE_OK); | 128 | return (AE_OK); |
139 | } | 129 | } |
140 | 130 | ||
@@ -153,6 +143,9 @@ acpi_status acpi_ut_create_caches(void) | |||
153 | acpi_status acpi_ut_delete_caches(void) | 143 | acpi_status acpi_ut_delete_caches(void) |
154 | { | 144 | { |
155 | 145 | ||
146 | (void)acpi_os_delete_cache(acpi_gbl_namespace_cache); | ||
147 | acpi_gbl_namespace_cache = NULL; | ||
148 | |||
156 | (void)acpi_os_delete_cache(acpi_gbl_state_cache); | 149 | (void)acpi_os_delete_cache(acpi_gbl_state_cache); |
157 | acpi_gbl_state_cache = NULL; | 150 | acpi_gbl_state_cache = NULL; |
158 | 151 | ||
@@ -165,6 +158,21 @@ acpi_status acpi_ut_delete_caches(void) | |||
165 | (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); | 158 | (void)acpi_os_delete_cache(acpi_gbl_ps_node_ext_cache); |
166 | acpi_gbl_ps_node_ext_cache = NULL; | 159 | acpi_gbl_ps_node_ext_cache = NULL; |
167 | 160 | ||
161 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
162 | |||
163 | /* Debug only - display leftover memory allocation, if any */ | ||
164 | |||
165 | acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); | ||
166 | |||
167 | /* Free memory lists */ | ||
168 | |||
169 | acpi_os_free(acpi_gbl_global_list); | ||
170 | acpi_gbl_global_list = NULL; | ||
171 | |||
172 | acpi_os_free(acpi_gbl_ns_node_list); | ||
173 | acpi_gbl_ns_node_list = NULL; | ||
174 | #endif | ||
175 | |||
168 | return (AE_OK); | 176 | return (AE_OK); |
169 | } | 177 | } |
170 | 178 | ||
@@ -252,7 +260,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
252 | 260 | ||
253 | /* Allocate a new buffer with local interface to allow tracking */ | 261 | /* Allocate a new buffer with local interface to allow tracking */ |
254 | 262 | ||
255 | buffer->pointer = ACPI_MEM_CALLOCATE(required_length); | 263 | buffer->pointer = ACPI_ALLOCATE_ZEROED(required_length); |
256 | if (!buffer->pointer) { | 264 | if (!buffer->pointer) { |
257 | return (AE_NO_MEMORY); | 265 | return (AE_NO_MEMORY); |
258 | } | 266 | } |
@@ -288,7 +296,7 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, | |||
288 | * | 296 | * |
289 | * RETURN: Address of the allocated memory on success, NULL on failure. | 297 | * RETURN: Address of the allocated memory on success, NULL on failure. |
290 | * | 298 | * |
291 | * DESCRIPTION: The subsystem's equivalent of malloc. | 299 | * DESCRIPTION: Subsystem equivalent of malloc. |
292 | * | 300 | * |
293 | ******************************************************************************/ | 301 | ******************************************************************************/ |
294 | 302 | ||
@@ -296,23 +304,23 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
296 | { | 304 | { |
297 | void *allocation; | 305 | void *allocation; |
298 | 306 | ||
299 | ACPI_FUNCTION_TRACE_U32("ut_allocate", size); | 307 | ACPI_FUNCTION_TRACE_U32(ut_allocate, size); |
300 | 308 | ||
301 | /* Check for an inadvertent size of zero bytes */ | 309 | /* Check for an inadvertent size of zero bytes */ |
302 | 310 | ||
303 | if (!size) { | 311 | if (!size) { |
304 | ACPI_ERROR((module, line, | 312 | ACPI_WARNING((module, line, |
305 | "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte")); | 313 | "Attempt to allocate zero bytes, allocating 1 byte")); |
306 | size = 1; | 314 | size = 1; |
307 | } | 315 | } |
308 | 316 | ||
309 | allocation = acpi_os_allocate(size); | 317 | allocation = acpi_os_allocate(size); |
310 | if (!allocation) { | 318 | if (!allocation) { |
319 | |||
311 | /* Report allocation error */ | 320 | /* Report allocation error */ |
312 | 321 | ||
313 | ACPI_ERROR((module, line, | 322 | ACPI_WARNING((module, line, |
314 | "ut_allocate: Could not allocate size %X", | 323 | "Could not allocate size %X", (u32) size)); |
315 | (u32) size)); | ||
316 | 324 | ||
317 | return_PTR(NULL); | 325 | return_PTR(NULL); |
318 | } | 326 | } |
@@ -322,7 +330,7 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
322 | 330 | ||
323 | /******************************************************************************* | 331 | /******************************************************************************* |
324 | * | 332 | * |
325 | * FUNCTION: acpi_ut_callocate | 333 | * FUNCTION: acpi_ut_allocate_zeroed |
326 | * | 334 | * |
327 | * PARAMETERS: Size - Size of the allocation | 335 | * PARAMETERS: Size - Size of the allocation |
328 | * Component - Component type of caller | 336 | * Component - Component type of caller |
@@ -331,542 +339,24 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line) | |||
331 | * | 339 | * |
332 | * RETURN: Address of the allocated memory on success, NULL on failure. | 340 | * RETURN: Address of the allocated memory on success, NULL on failure. |
333 | * | 341 | * |
334 | * DESCRIPTION: Subsystem equivalent of calloc. | 342 | * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. |
335 | * | 343 | * |
336 | ******************************************************************************/ | 344 | ******************************************************************************/ |
337 | 345 | ||
338 | void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line) | 346 | void *acpi_ut_allocate_zeroed(acpi_size size, |
347 | u32 component, char *module, u32 line) | ||
339 | { | 348 | { |
340 | void *allocation; | 349 | void *allocation; |
341 | 350 | ||
342 | ACPI_FUNCTION_TRACE_U32("ut_callocate", size); | ||
343 | |||
344 | /* Check for an inadvertent size of zero bytes */ | ||
345 | |||
346 | if (!size) { | ||
347 | ACPI_ERROR((module, line, | ||
348 | "Attempt to allocate zero bytes, allocating 1 byte")); | ||
349 | size = 1; | ||
350 | } | ||
351 | |||
352 | allocation = acpi_os_allocate(size); | ||
353 | if (!allocation) { | ||
354 | /* Report allocation error */ | ||
355 | |||
356 | ACPI_ERROR((module, line, | ||
357 | "Could not allocate size %X", (u32) size)); | ||
358 | return_PTR(NULL); | ||
359 | } | ||
360 | |||
361 | /* Clear the memory block */ | ||
362 | |||
363 | ACPI_MEMSET(allocation, 0, size); | ||
364 | return_PTR(allocation); | ||
365 | } | ||
366 | |||
367 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
368 | /* | ||
369 | * These procedures are used for tracking memory leaks in the subsystem, and | ||
370 | * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set. | ||
371 | * | ||
372 | * Each memory allocation is tracked via a doubly linked list. Each | ||
373 | * element contains the caller's component, module name, function name, and | ||
374 | * line number. acpi_ut_allocate and acpi_ut_callocate call | ||
375 | * acpi_ut_track_allocation to add an element to the list; deletion | ||
376 | * occurs in the body of acpi_ut_free. | ||
377 | */ | ||
378 | |||
379 | /******************************************************************************* | ||
380 | * | ||
381 | * FUNCTION: acpi_ut_create_list | ||
382 | * | ||
383 | * PARAMETERS: cache_name - Ascii name for the cache | ||
384 | * object_size - Size of each cached object | ||
385 | * return_cache - Where the new cache object is returned | ||
386 | * | ||
387 | * RETURN: Status | ||
388 | * | ||
389 | * DESCRIPTION: Create a local memory list for tracking purposed | ||
390 | * | ||
391 | ******************************************************************************/ | ||
392 | |||
393 | static acpi_status | ||
394 | acpi_ut_create_list(char *list_name, | ||
395 | u16 object_size, struct acpi_memory_list **return_cache) | ||
396 | { | ||
397 | struct acpi_memory_list *cache; | ||
398 | |||
399 | cache = acpi_os_allocate(sizeof(struct acpi_memory_list)); | ||
400 | if (!cache) { | ||
401 | return (AE_NO_MEMORY); | ||
402 | } | ||
403 | |||
404 | ACPI_MEMSET(cache, 0, sizeof(struct acpi_memory_list)); | ||
405 | |||
406 | cache->list_name = list_name; | ||
407 | cache->object_size = object_size; | ||
408 | |||
409 | *return_cache = cache; | ||
410 | return (AE_OK); | ||
411 | } | ||
412 | |||
413 | /******************************************************************************* | ||
414 | * | ||
415 | * FUNCTION: acpi_ut_allocate_and_track | ||
416 | * | ||
417 | * PARAMETERS: Size - Size of the allocation | ||
418 | * Component - Component type of caller | ||
419 | * Module - Source file name of caller | ||
420 | * Line - Line number of caller | ||
421 | * | ||
422 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
423 | * | ||
424 | * DESCRIPTION: The subsystem's equivalent of malloc. | ||
425 | * | ||
426 | ******************************************************************************/ | ||
427 | |||
428 | void *acpi_ut_allocate_and_track(acpi_size size, | ||
429 | u32 component, char *module, u32 line) | ||
430 | { | ||
431 | struct acpi_debug_mem_block *allocation; | ||
432 | acpi_status status; | ||
433 | |||
434 | allocation = | ||
435 | acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), | ||
436 | component, module, line); | ||
437 | if (!allocation) { | ||
438 | return (NULL); | ||
439 | } | ||
440 | |||
441 | status = acpi_ut_track_allocation(allocation, size, | ||
442 | ACPI_MEM_MALLOC, component, module, | ||
443 | line); | ||
444 | if (ACPI_FAILURE(status)) { | ||
445 | acpi_os_free(allocation); | ||
446 | return (NULL); | ||
447 | } | ||
448 | |||
449 | acpi_gbl_global_list->total_allocated++; | ||
450 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
451 | |||
452 | return ((void *)&allocation->user_space); | ||
453 | } | ||
454 | |||
455 | /******************************************************************************* | ||
456 | * | ||
457 | * FUNCTION: acpi_ut_callocate_and_track | ||
458 | * | ||
459 | * PARAMETERS: Size - Size of the allocation | ||
460 | * Component - Component type of caller | ||
461 | * Module - Source file name of caller | ||
462 | * Line - Line number of caller | ||
463 | * | ||
464 | * RETURN: Address of the allocated memory on success, NULL on failure. | ||
465 | * | ||
466 | * DESCRIPTION: Subsystem equivalent of calloc. | ||
467 | * | ||
468 | ******************************************************************************/ | ||
469 | |||
470 | void *acpi_ut_callocate_and_track(acpi_size size, | ||
471 | u32 component, char *module, u32 line) | ||
472 | { | ||
473 | struct acpi_debug_mem_block *allocation; | ||
474 | acpi_status status; | ||
475 | |||
476 | allocation = | ||
477 | acpi_ut_callocate(size + sizeof(struct acpi_debug_mem_header), | ||
478 | component, module, line); | ||
479 | if (!allocation) { | ||
480 | /* Report allocation error */ | ||
481 | |||
482 | ACPI_ERROR((module, line, | ||
483 | "Could not allocate size %X", (u32) size)); | ||
484 | return (NULL); | ||
485 | } | ||
486 | |||
487 | status = acpi_ut_track_allocation(allocation, size, | ||
488 | ACPI_MEM_CALLOC, component, module, | ||
489 | line); | ||
490 | if (ACPI_FAILURE(status)) { | ||
491 | acpi_os_free(allocation); | ||
492 | return (NULL); | ||
493 | } | ||
494 | |||
495 | acpi_gbl_global_list->total_allocated++; | ||
496 | acpi_gbl_global_list->current_total_size += (u32) size; | ||
497 | |||
498 | return ((void *)&allocation->user_space); | ||
499 | } | ||
500 | |||
501 | /******************************************************************************* | ||
502 | * | ||
503 | * FUNCTION: acpi_ut_free_and_track | ||
504 | * | ||
505 | * PARAMETERS: Allocation - Address of the memory to deallocate | ||
506 | * Component - Component type of caller | ||
507 | * Module - Source file name of caller | ||
508 | * Line - Line number of caller | ||
509 | * | ||
510 | * RETURN: None | ||
511 | * | ||
512 | * DESCRIPTION: Frees the memory at Allocation | ||
513 | * | ||
514 | ******************************************************************************/ | ||
515 | |||
516 | void | ||
517 | acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line) | ||
518 | { | ||
519 | struct acpi_debug_mem_block *debug_block; | ||
520 | acpi_status status; | ||
521 | |||
522 | ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); | ||
523 | |||
524 | if (NULL == allocation) { | ||
525 | ACPI_ERROR((module, line, "Attempt to delete a NULL address")); | ||
526 | |||
527 | return_VOID; | ||
528 | } | ||
529 | |||
530 | debug_block = ACPI_CAST_PTR(struct acpi_debug_mem_block, | ||
531 | (((char *)allocation) - | ||
532 | sizeof(struct acpi_debug_mem_header))); | ||
533 | |||
534 | acpi_gbl_global_list->total_freed++; | ||
535 | acpi_gbl_global_list->current_total_size -= debug_block->size; | ||
536 | |||
537 | status = acpi_ut_remove_allocation(debug_block, | ||
538 | component, module, line); | ||
539 | if (ACPI_FAILURE(status)) { | ||
540 | ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); | ||
541 | } | ||
542 | |||
543 | acpi_os_free(debug_block); | ||
544 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); | ||
545 | return_VOID; | ||
546 | } | ||
547 | |||
548 | /******************************************************************************* | ||
549 | * | ||
550 | * FUNCTION: acpi_ut_find_allocation | ||
551 | * | ||
552 | * PARAMETERS: Allocation - Address of allocated memory | ||
553 | * | ||
554 | * RETURN: A list element if found; NULL otherwise. | ||
555 | * | ||
556 | * DESCRIPTION: Searches for an element in the global allocation tracking list. | ||
557 | * | ||
558 | ******************************************************************************/ | ||
559 | |||
560 | static struct acpi_debug_mem_block *acpi_ut_find_allocation(void *allocation) | ||
561 | { | ||
562 | struct acpi_debug_mem_block *element; | ||
563 | |||
564 | ACPI_FUNCTION_ENTRY(); | 351 | ACPI_FUNCTION_ENTRY(); |
565 | 352 | ||
566 | element = acpi_gbl_global_list->list_head; | 353 | allocation = acpi_ut_allocate(size, component, module, line); |
567 | 354 | if (allocation) { | |
568 | /* Search for the address. */ | ||
569 | |||
570 | while (element) { | ||
571 | if (element == allocation) { | ||
572 | return (element); | ||
573 | } | ||
574 | |||
575 | element = element->next; | ||
576 | } | ||
577 | |||
578 | return (NULL); | ||
579 | } | ||
580 | |||
581 | /******************************************************************************* | ||
582 | * | ||
583 | * FUNCTION: acpi_ut_track_allocation | ||
584 | * | ||
585 | * PARAMETERS: Allocation - Address of allocated memory | ||
586 | * Size - Size of the allocation | ||
587 | * alloc_type - MEM_MALLOC or MEM_CALLOC | ||
588 | * Component - Component type of caller | ||
589 | * Module - Source file name of caller | ||
590 | * Line - Line number of caller | ||
591 | * | ||
592 | * RETURN: None. | ||
593 | * | ||
594 | * DESCRIPTION: Inserts an element into the global allocation tracking list. | ||
595 | * | ||
596 | ******************************************************************************/ | ||
597 | |||
598 | static acpi_status | ||
599 | acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, | ||
600 | acpi_size size, | ||
601 | u8 alloc_type, u32 component, char *module, u32 line) | ||
602 | { | ||
603 | struct acpi_memory_list *mem_list; | ||
604 | struct acpi_debug_mem_block *element; | ||
605 | acpi_status status = AE_OK; | ||
606 | |||
607 | ACPI_FUNCTION_TRACE_PTR("ut_track_allocation", allocation); | ||
608 | |||
609 | mem_list = acpi_gbl_global_list; | ||
610 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
611 | if (ACPI_FAILURE(status)) { | ||
612 | return_ACPI_STATUS(status); | ||
613 | } | ||
614 | |||
615 | /* | ||
616 | * Search list for this address to make sure it is not already on the list. | ||
617 | * This will catch several kinds of problems. | ||
618 | */ | ||
619 | element = acpi_ut_find_allocation(allocation); | ||
620 | if (element) { | ||
621 | ACPI_ERROR((AE_INFO, | ||
622 | "ut_track_allocation: Allocation already present in list! (%p)", | ||
623 | allocation)); | ||
624 | |||
625 | ACPI_ERROR((AE_INFO, "Element %p Address %p", | ||
626 | element, allocation)); | ||
627 | |||
628 | goto unlock_and_exit; | ||
629 | } | ||
630 | |||
631 | /* Fill in the instance data. */ | ||
632 | |||
633 | allocation->size = (u32) size; | ||
634 | allocation->alloc_type = alloc_type; | ||
635 | allocation->component = component; | ||
636 | allocation->line = line; | ||
637 | |||
638 | ACPI_STRNCPY(allocation->module, module, ACPI_MAX_MODULE_NAME); | ||
639 | allocation->module[ACPI_MAX_MODULE_NAME - 1] = 0; | ||
640 | |||
641 | /* Insert at list head */ | ||
642 | |||
643 | if (mem_list->list_head) { | ||
644 | ((struct acpi_debug_mem_block *)(mem_list->list_head))-> | ||
645 | previous = allocation; | ||
646 | } | ||
647 | |||
648 | allocation->next = mem_list->list_head; | ||
649 | allocation->previous = NULL; | ||
650 | |||
651 | mem_list->list_head = allocation; | ||
652 | |||
653 | unlock_and_exit: | ||
654 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
655 | return_ACPI_STATUS(status); | ||
656 | } | ||
657 | |||
658 | /******************************************************************************* | ||
659 | * | ||
660 | * FUNCTION: acpi_ut_remove_allocation | ||
661 | * | ||
662 | * PARAMETERS: Allocation - Address of allocated memory | ||
663 | * Component - Component type of caller | ||
664 | * Module - Source file name of caller | ||
665 | * Line - Line number of caller | ||
666 | * | ||
667 | * RETURN: | ||
668 | * | ||
669 | * DESCRIPTION: Deletes an element from the global allocation tracking list. | ||
670 | * | ||
671 | ******************************************************************************/ | ||
672 | |||
673 | static acpi_status | ||
674 | acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation, | ||
675 | u32 component, char *module, u32 line) | ||
676 | { | ||
677 | struct acpi_memory_list *mem_list; | ||
678 | acpi_status status; | ||
679 | |||
680 | ACPI_FUNCTION_TRACE("ut_remove_allocation"); | ||
681 | |||
682 | mem_list = acpi_gbl_global_list; | ||
683 | if (NULL == mem_list->list_head) { | ||
684 | /* No allocations! */ | ||
685 | |||
686 | ACPI_ERROR((module, line, | ||
687 | "Empty allocation list, nothing to free!")); | ||
688 | |||
689 | return_ACPI_STATUS(AE_OK); | ||
690 | } | ||
691 | |||
692 | status = acpi_ut_acquire_mutex(ACPI_MTX_MEMORY); | ||
693 | if (ACPI_FAILURE(status)) { | ||
694 | return_ACPI_STATUS(status); | ||
695 | } | ||
696 | |||
697 | /* Unlink */ | ||
698 | |||
699 | if (allocation->previous) { | ||
700 | (allocation->previous)->next = allocation->next; | ||
701 | } else { | ||
702 | mem_list->list_head = allocation->next; | ||
703 | } | ||
704 | |||
705 | if (allocation->next) { | ||
706 | (allocation->next)->previous = allocation->previous; | ||
707 | } | ||
708 | |||
709 | /* Mark the segment as deleted */ | ||
710 | |||
711 | ACPI_MEMSET(&allocation->user_space, 0xEA, allocation->size); | ||
712 | |||
713 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", | ||
714 | allocation->size)); | ||
715 | 355 | ||
716 | status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); | 356 | /* Clear the memory block */ |
717 | return_ACPI_STATUS(status); | ||
718 | } | ||
719 | |||
720 | /******************************************************************************* | ||
721 | * | ||
722 | * FUNCTION: acpi_ut_dump_allocation_info | ||
723 | * | ||
724 | * PARAMETERS: | ||
725 | * | ||
726 | * RETURN: None | ||
727 | * | ||
728 | * DESCRIPTION: Print some info about the outstanding allocations. | ||
729 | * | ||
730 | ******************************************************************************/ | ||
731 | 357 | ||
732 | #ifdef ACPI_FUTURE_USAGE | 358 | ACPI_MEMSET(allocation, 0, size); |
733 | void acpi_ut_dump_allocation_info(void) | ||
734 | { | ||
735 | /* | ||
736 | struct acpi_memory_list *mem_list; | ||
737 | */ | ||
738 | |||
739 | ACPI_FUNCTION_TRACE("ut_dump_allocation_info"); | ||
740 | |||
741 | /* | ||
742 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
743 | ("%30s: %4d (%3d Kb)\n", "Current allocations", | ||
744 | mem_list->current_count, | ||
745 | ROUND_UP_TO_1K (mem_list->current_size))); | ||
746 | |||
747 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
748 | ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", | ||
749 | mem_list->max_concurrent_count, | ||
750 | ROUND_UP_TO_1K (mem_list->max_concurrent_size))); | ||
751 | |||
752 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
753 | ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", | ||
754 | running_object_count, | ||
755 | ROUND_UP_TO_1K (running_object_size))); | ||
756 | |||
757 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
758 | ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", | ||
759 | running_alloc_count, | ||
760 | ROUND_UP_TO_1K (running_alloc_size))); | ||
761 | |||
762 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
763 | ("%30s: %4d (%3d Kb)\n", "Current Nodes", | ||
764 | acpi_gbl_current_node_count, | ||
765 | ROUND_UP_TO_1K (acpi_gbl_current_node_size))); | ||
766 | |||
767 | ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, | ||
768 | ("%30s: %4d (%3d Kb)\n", "Max Nodes", | ||
769 | acpi_gbl_max_concurrent_node_count, | ||
770 | ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * | ||
771 | sizeof (struct acpi_namespace_node))))); | ||
772 | */ | ||
773 | return_VOID; | ||
774 | } | ||
775 | #endif /* ACPI_FUTURE_USAGE */ | ||
776 | |||
777 | /******************************************************************************* | ||
778 | * | ||
779 | * FUNCTION: acpi_ut_dump_allocations | ||
780 | * | ||
781 | * PARAMETERS: Component - Component(s) to dump info for. | ||
782 | * Module - Module to dump info for. NULL means all. | ||
783 | * | ||
784 | * RETURN: None | ||
785 | * | ||
786 | * DESCRIPTION: Print a list of all outstanding allocations. | ||
787 | * | ||
788 | ******************************************************************************/ | ||
789 | |||
790 | void acpi_ut_dump_allocations(u32 component, char *module) | ||
791 | { | ||
792 | struct acpi_debug_mem_block *element; | ||
793 | union acpi_descriptor *descriptor; | ||
794 | u32 num_outstanding = 0; | ||
795 | |||
796 | ACPI_FUNCTION_TRACE("ut_dump_allocations"); | ||
797 | |||
798 | /* | ||
799 | * Walk the allocation list. | ||
800 | */ | ||
801 | if (ACPI_FAILURE(acpi_ut_acquire_mutex(ACPI_MTX_MEMORY))) { | ||
802 | return; | ||
803 | } | 359 | } |
804 | 360 | ||
805 | element = acpi_gbl_global_list->list_head; | 361 | return (allocation); |
806 | while (element) { | ||
807 | if ((element->component & component) && | ||
808 | ((module == NULL) | ||
809 | || (0 == ACPI_STRCMP(module, element->module)))) { | ||
810 | /* Ignore allocated objects that are in a cache */ | ||
811 | |||
812 | descriptor = | ||
813 | ACPI_CAST_PTR(union acpi_descriptor, | ||
814 | &element->user_space); | ||
815 | if (descriptor->descriptor_id != ACPI_DESC_TYPE_CACHED) { | ||
816 | acpi_os_printf("%p Len %04X %9.9s-%d [%s] ", | ||
817 | descriptor, element->size, | ||
818 | element->module, element->line, | ||
819 | acpi_ut_get_descriptor_name | ||
820 | (descriptor)); | ||
821 | |||
822 | /* Most of the elements will be Operand objects. */ | ||
823 | |||
824 | switch (ACPI_GET_DESCRIPTOR_TYPE(descriptor)) { | ||
825 | case ACPI_DESC_TYPE_OPERAND: | ||
826 | acpi_os_printf("%12.12s R%hd", | ||
827 | acpi_ut_get_type_name | ||
828 | (descriptor->object. | ||
829 | common.type), | ||
830 | descriptor->object. | ||
831 | common.reference_count); | ||
832 | break; | ||
833 | |||
834 | case ACPI_DESC_TYPE_PARSER: | ||
835 | acpi_os_printf("aml_opcode %04hX", | ||
836 | descriptor->op.asl. | ||
837 | aml_opcode); | ||
838 | break; | ||
839 | |||
840 | case ACPI_DESC_TYPE_NAMED: | ||
841 | acpi_os_printf("%4.4s", | ||
842 | acpi_ut_get_node_name | ||
843 | (&descriptor->node)); | ||
844 | break; | ||
845 | |||
846 | default: | ||
847 | break; | ||
848 | } | ||
849 | |||
850 | acpi_os_printf("\n"); | ||
851 | num_outstanding++; | ||
852 | } | ||
853 | } | ||
854 | element = element->next; | ||
855 | } | ||
856 | |||
857 | (void)acpi_ut_release_mutex(ACPI_MTX_MEMORY); | ||
858 | |||
859 | /* Print summary */ | ||
860 | |||
861 | if (!num_outstanding) { | ||
862 | ACPI_INFO((AE_INFO, "No outstanding allocations")); | ||
863 | } else { | ||
864 | ACPI_ERROR((AE_INFO, | ||
865 | "%d(%X) Outstanding allocations", | ||
866 | num_outstanding, num_outstanding)); | ||
867 | } | ||
868 | |||
869 | return_VOID; | ||
870 | } | 362 | } |
871 | |||
872 | #endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */ | ||
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 2177cb1ef2c4..56270a30718a 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c | |||
@@ -118,13 +118,14 @@ acpi_status acpi_os_purge_cache(struct acpi_memory_list * cache) | |||
118 | /* Walk the list of objects in this cache */ | 118 | /* Walk the list of objects in this cache */ |
119 | 119 | ||
120 | while (cache->list_head) { | 120 | while (cache->list_head) { |
121 | |||
121 | /* Delete and unlink one cached state object */ | 122 | /* Delete and unlink one cached state object */ |
122 | 123 | ||
123 | next = *(ACPI_CAST_INDIRECT_PTR(char, | 124 | next = *(ACPI_CAST_INDIRECT_PTR(char, |
124 | &(((char *)cache-> | 125 | &(((char *)cache-> |
125 | list_head)[cache-> | 126 | list_head)[cache-> |
126 | link_offset]))); | 127 | link_offset]))); |
127 | ACPI_MEM_FREE(cache->list_head); | 128 | ACPI_FREE(cache->list_head); |
128 | 129 | ||
129 | cache->list_head = next; | 130 | cache->list_head = next; |
130 | cache->current_depth--; | 131 | cache->current_depth--; |
@@ -193,7 +194,7 @@ acpi_os_release_object(struct acpi_memory_list * cache, void *object) | |||
193 | /* If cache is full, just free this object */ | 194 | /* If cache is full, just free this object */ |
194 | 195 | ||
195 | if (cache->current_depth >= cache->max_depth) { | 196 | if (cache->current_depth >= cache->max_depth) { |
196 | ACPI_MEM_FREE(object); | 197 | ACPI_FREE(object); |
197 | ACPI_MEM_TRACKING(cache->total_freed++); | 198 | ACPI_MEM_TRACKING(cache->total_freed++); |
198 | } | 199 | } |
199 | 200 | ||
@@ -243,7 +244,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
243 | acpi_status status; | 244 | acpi_status status; |
244 | void *object; | 245 | void *object; |
245 | 246 | ||
246 | ACPI_FUNCTION_NAME("os_acquire_object"); | 247 | ACPI_FUNCTION_NAME(os_acquire_object); |
247 | 248 | ||
248 | if (!cache) { | 249 | if (!cache) { |
249 | return (NULL); | 250 | return (NULL); |
@@ -259,6 +260,7 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
259 | /* Check the cache first */ | 260 | /* Check the cache first */ |
260 | 261 | ||
261 | if (cache->list_head) { | 262 | if (cache->list_head) { |
263 | |||
262 | /* There is an object available, use it */ | 264 | /* There is an object available, use it */ |
263 | 265 | ||
264 | object = cache->list_head; | 266 | object = cache->list_head; |
@@ -270,9 +272,9 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
270 | cache->current_depth--; | 272 | cache->current_depth--; |
271 | 273 | ||
272 | ACPI_MEM_TRACKING(cache->hits++); | 274 | ACPI_MEM_TRACKING(cache->hits++); |
273 | ACPI_MEM_TRACKING(ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 275 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
274 | "Object %p from %s cache\n", | 276 | "Object %p from %s cache\n", object, |
275 | object, cache->list_name))); | 277 | cache->list_name)); |
276 | 278 | ||
277 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 279 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
278 | if (ACPI_FAILURE(status)) { | 280 | if (ACPI_FAILURE(status)) { |
@@ -287,14 +289,14 @@ void *acpi_os_acquire_object(struct acpi_memory_list *cache) | |||
287 | 289 | ||
288 | ACPI_MEM_TRACKING(cache->total_allocated++); | 290 | ACPI_MEM_TRACKING(cache->total_allocated++); |
289 | 291 | ||
290 | /* Avoid deadlock with ACPI_MEM_CALLOCATE */ | 292 | /* Avoid deadlock with ACPI_ALLOCATE_ZEROED */ |
291 | 293 | ||
292 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); | 294 | status = acpi_ut_release_mutex(ACPI_MTX_CACHES); |
293 | if (ACPI_FAILURE(status)) { | 295 | if (ACPI_FAILURE(status)) { |
294 | return (NULL); | 296 | return (NULL); |
295 | } | 297 | } |
296 | 298 | ||
297 | object = ACPI_MEM_CALLOCATE(cache->object_size); | 299 | object = ACPI_ALLOCATE_ZEROED(cache->object_size); |
298 | if (!object) { | 300 | if (!object) { |
299 | return (NULL); | 301 | return (NULL); |
300 | } | 302 | } |
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index df2d32096b72..5e1a80d1bc36 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -109,7 +109,7 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, | |||
109 | { | 109 | { |
110 | acpi_status status = AE_OK; | 110 | acpi_status status = AE_OK; |
111 | 111 | ||
112 | ACPI_FUNCTION_TRACE("ut_copy_isimple_to_esimple"); | 112 | ACPI_FUNCTION_TRACE(ut_copy_isimple_to_esimple); |
113 | 113 | ||
114 | *buffer_space_used = 0; | 114 | *buffer_space_used = 0; |
115 | 115 | ||
@@ -325,7 +325,7 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, | |||
325 | acpi_status status; | 325 | acpi_status status; |
326 | struct acpi_pkg_info info; | 326 | struct acpi_pkg_info info; |
327 | 327 | ||
328 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_epackage"); | 328 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_epackage); |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * First package at head of the buffer | 331 | * First package at head of the buffer |
@@ -383,7 +383,7 @@ acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *internal_object, | |||
383 | { | 383 | { |
384 | acpi_status status; | 384 | acpi_status status; |
385 | 385 | ||
386 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_eobject"); | 386 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_eobject); |
387 | 387 | ||
388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { | 388 | if (ACPI_GET_OBJECT_TYPE(internal_object) == ACPI_TYPE_PACKAGE) { |
389 | /* | 389 | /* |
@@ -442,7 +442,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
442 | { | 442 | { |
443 | union acpi_operand_object *internal_object; | 443 | union acpi_operand_object *internal_object; |
444 | 444 | ||
445 | ACPI_FUNCTION_TRACE("ut_copy_esimple_to_isimple"); | 445 | ACPI_FUNCTION_TRACE(ut_copy_esimple_to_isimple); |
446 | 446 | ||
447 | /* | 447 | /* |
448 | * Simple types supported are: String, Buffer, Integer | 448 | * Simple types supported are: String, Buffer, Integer |
@@ -472,8 +472,8 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
472 | case ACPI_TYPE_STRING: | 472 | case ACPI_TYPE_STRING: |
473 | 473 | ||
474 | internal_object->string.pointer = | 474 | internal_object->string.pointer = |
475 | ACPI_MEM_CALLOCATE((acpi_size) external_object->string. | 475 | ACPI_ALLOCATE_ZEROED((acpi_size) external_object->string. |
476 | length + 1); | 476 | length + 1); |
477 | if (!internal_object->string.pointer) { | 477 | if (!internal_object->string.pointer) { |
478 | goto error_exit; | 478 | goto error_exit; |
479 | } | 479 | } |
@@ -488,7 +488,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
488 | case ACPI_TYPE_BUFFER: | 488 | case ACPI_TYPE_BUFFER: |
489 | 489 | ||
490 | internal_object->buffer.pointer = | 490 | internal_object->buffer.pointer = |
491 | ACPI_MEM_CALLOCATE(external_object->buffer.length); | 491 | ACPI_ALLOCATE_ZEROED(external_object->buffer.length); |
492 | if (!internal_object->buffer.pointer) { | 492 | if (!internal_object->buffer.pointer) { |
493 | goto error_exit; | 493 | goto error_exit; |
494 | } | 494 | } |
@@ -552,7 +552,7 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_operand_object *internal_object, | |||
552 | union acpi_operand_object *this_internal_obj; | 552 | union acpi_operand_object *this_internal_obj; |
553 | union acpi_object *this_external_obj; | 553 | union acpi_object *this_external_obj; |
554 | 554 | ||
555 | ACPI_FUNCTION_TRACE("ut_copy_epackage_to_ipackage"); | 555 | ACPI_FUNCTION_TRACE(ut_copy_epackage_to_ipackage); |
556 | 556 | ||
557 | /* | 557 | /* |
558 | * First package at head of the buffer | 558 | * First package at head of the buffer |
@@ -600,7 +600,7 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, | |||
600 | { | 600 | { |
601 | acpi_status status; | 601 | acpi_status status; |
602 | 602 | ||
603 | ACPI_FUNCTION_TRACE("ut_copy_eobject_to_iobject"); | 603 | ACPI_FUNCTION_TRACE(ut_copy_eobject_to_iobject); |
604 | 604 | ||
605 | if (external_object->type == ACPI_TYPE_PACKAGE) { | 605 | if (external_object->type == ACPI_TYPE_PACKAGE) { |
606 | /* | 606 | /* |
@@ -676,7 +676,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
676 | if ((source_desc->buffer.pointer) && | 676 | if ((source_desc->buffer.pointer) && |
677 | (source_desc->buffer.length)) { | 677 | (source_desc->buffer.length)) { |
678 | dest_desc->buffer.pointer = | 678 | dest_desc->buffer.pointer = |
679 | ACPI_MEM_ALLOCATE(source_desc->buffer.length); | 679 | ACPI_ALLOCATE(source_desc->buffer.length); |
680 | if (!dest_desc->buffer.pointer) { | 680 | if (!dest_desc->buffer.pointer) { |
681 | return (AE_NO_MEMORY); | 681 | return (AE_NO_MEMORY); |
682 | } | 682 | } |
@@ -697,8 +697,8 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
697 | */ | 697 | */ |
698 | if (source_desc->string.pointer) { | 698 | if (source_desc->string.pointer) { |
699 | dest_desc->string.pointer = | 699 | dest_desc->string.pointer = |
700 | ACPI_MEM_ALLOCATE((acpi_size) source_desc->string. | 700 | ACPI_ALLOCATE((acpi_size) source_desc->string. |
701 | length + 1); | 701 | length + 1); |
702 | if (!dest_desc->string.pointer) { | 702 | if (!dest_desc->string.pointer) { |
703 | return (AE_NO_MEMORY); | 703 | return (AE_NO_MEMORY); |
704 | } | 704 | } |
@@ -805,9 +805,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, | |||
805 | /* | 805 | /* |
806 | * Create the object array | 806 | * Create the object array |
807 | */ | 807 | */ |
808 | target_object->package.elements = | 808 | target_object->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) source_object->package.count + 1) * sizeof(void *)); |
809 | ACPI_MEM_CALLOCATE(((acpi_size) source_object->package. | ||
810 | count + 1) * sizeof(void *)); | ||
811 | if (!target_object->package.elements) { | 809 | if (!target_object->package.elements) { |
812 | status = AE_NO_MEMORY; | 810 | status = AE_NO_MEMORY; |
813 | goto error_exit; | 811 | goto error_exit; |
@@ -856,7 +854,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
856 | { | 854 | { |
857 | acpi_status status = AE_OK; | 855 | acpi_status status = AE_OK; |
858 | 856 | ||
859 | ACPI_FUNCTION_TRACE("ut_copy_ipackage_to_ipackage"); | 857 | ACPI_FUNCTION_TRACE(ut_copy_ipackage_to_ipackage); |
860 | 858 | ||
861 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); | 859 | dest_obj->common.type = ACPI_GET_OBJECT_TYPE(source_obj); |
862 | dest_obj->common.flags = source_obj->common.flags; | 860 | dest_obj->common.flags = source_obj->common.flags; |
@@ -865,10 +863,10 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
865 | /* | 863 | /* |
866 | * Create the object array and walk the source package tree | 864 | * Create the object array and walk the source package tree |
867 | */ | 865 | */ |
868 | dest_obj->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) | 866 | dest_obj->package.elements = ACPI_ALLOCATE_ZEROED(((acpi_size) |
869 | source_obj->package. | 867 | source_obj->package. |
870 | count + | 868 | count + |
871 | 1) * sizeof(void *)); | 869 | 1) * sizeof(void *)); |
872 | if (!dest_obj->package.elements) { | 870 | if (!dest_obj->package.elements) { |
873 | ACPI_ERROR((AE_INFO, "Package allocation failure")); | 871 | ACPI_ERROR((AE_INFO, "Package allocation failure")); |
874 | return_ACPI_STATUS(AE_NO_MEMORY); | 872 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -882,6 +880,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj, | |||
882 | acpi_ut_copy_ielement_to_ielement, | 880 | acpi_ut_copy_ielement_to_ielement, |
883 | walk_state); | 881 | walk_state); |
884 | if (ACPI_FAILURE(status)) { | 882 | if (ACPI_FAILURE(status)) { |
883 | |||
885 | /* On failure, delete the destination package object */ | 884 | /* On failure, delete the destination package object */ |
886 | 885 | ||
887 | acpi_ut_remove_reference(dest_obj); | 886 | acpi_ut_remove_reference(dest_obj); |
@@ -911,7 +910,7 @@ acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc, | |||
911 | { | 910 | { |
912 | acpi_status status = AE_OK; | 911 | acpi_status status = AE_OK; |
913 | 912 | ||
914 | ACPI_FUNCTION_TRACE("ut_copy_iobject_to_iobject"); | 913 | ACPI_FUNCTION_TRACE(ut_copy_iobject_to_iobject); |
915 | 914 | ||
916 | /* Create the top level object */ | 915 | /* Create the top level object */ |
917 | 916 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 35f3d581e034..5ec1cfcc611d 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | 45 | ||
48 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
@@ -123,12 +121,14 @@ static const char *acpi_ut_trim_function_name(const char *function_name) | |||
123 | /* All Function names are longer than 4 chars, check is safe */ | 121 | /* All Function names are longer than 4 chars, check is safe */ |
124 | 122 | ||
125 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { | 123 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_MIXED) { |
124 | |||
126 | /* This is the case where the original source has not been modified */ | 125 | /* This is the case where the original source has not been modified */ |
127 | 126 | ||
128 | return (function_name + 4); | 127 | return (function_name + 4); |
129 | } | 128 | } |
130 | 129 | ||
131 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { | 130 | if (*(ACPI_CAST_PTR(u32, function_name)) == ACPI_PREFIX_LOWER) { |
131 | |||
132 | /* This is the case where the source has been 'linuxized' */ | 132 | /* This is the case where the source has been 'linuxized' */ |
133 | 133 | ||
134 | return (function_name + 5); | 134 | return (function_name + 5); |
@@ -162,7 +162,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
162 | const char *function_name, | 162 | const char *function_name, |
163 | char *module_name, u32 component_id, char *format, ...) | 163 | char *module_name, u32 component_id, char *format, ...) |
164 | { | 164 | { |
165 | u32 thread_id; | 165 | acpi_thread_id thread_id; |
166 | va_list args; | 166 | va_list args; |
167 | 167 | ||
168 | /* | 168 | /* |
@@ -177,7 +177,6 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
177 | * Thread tracking and context switch notification | 177 | * Thread tracking and context switch notification |
178 | */ | 178 | */ |
179 | thread_id = acpi_os_get_thread_id(); | 179 | thread_id = acpi_os_get_thread_id(); |
180 | |||
181 | if (thread_id != acpi_gbl_prev_thread_id) { | 180 | if (thread_id != acpi_gbl_prev_thread_id) { |
182 | if (ACPI_LV_THREADS & acpi_dbg_level) { | 181 | if (ACPI_LV_THREADS & acpi_dbg_level) { |
183 | acpi_os_printf | 182 | acpi_os_printf |
@@ -206,7 +205,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
206 | acpi_os_vprintf(format, args); | 205 | acpi_os_vprintf(format, args); |
207 | } | 206 | } |
208 | 207 | ||
209 | EXPORT_SYMBOL(acpi_ut_debug_print); | 208 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) |
210 | 209 | ||
211 | /******************************************************************************* | 210 | /******************************************************************************* |
212 | * | 211 | * |
@@ -226,7 +225,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print); | |||
226 | * debug_print so that the same macros can be used. | 225 | * debug_print so that the same macros can be used. |
227 | * | 226 | * |
228 | ******************************************************************************/ | 227 | ******************************************************************************/ |
229 | |||
230 | void ACPI_INTERNAL_VAR_XFACE | 228 | void ACPI_INTERNAL_VAR_XFACE |
231 | acpi_ut_debug_print_raw(u32 requested_debug_level, | 229 | acpi_ut_debug_print_raw(u32 requested_debug_level, |
232 | u32 line_number, | 230 | u32 line_number, |
@@ -244,7 +242,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, | |||
244 | acpi_os_vprintf(format, args); | 242 | acpi_os_vprintf(format, args); |
245 | } | 243 | } |
246 | 244 | ||
247 | EXPORT_SYMBOL(acpi_ut_debug_print_raw); | 245 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) |
248 | 246 | ||
249 | /******************************************************************************* | 247 | /******************************************************************************* |
250 | * | 248 | * |
@@ -261,7 +259,6 @@ EXPORT_SYMBOL(acpi_ut_debug_print_raw); | |||
261 | * set in debug_level | 259 | * set in debug_level |
262 | * | 260 | * |
263 | ******************************************************************************/ | 261 | ******************************************************************************/ |
264 | |||
265 | void | 262 | void |
266 | acpi_ut_trace(u32 line_number, | 263 | acpi_ut_trace(u32 line_number, |
267 | const char *function_name, char *module_name, u32 component_id) | 264 | const char *function_name, char *module_name, u32 component_id) |
@@ -275,7 +272,7 @@ acpi_ut_trace(u32 line_number, | |||
275 | component_id, "%s\n", acpi_gbl_fn_entry_str); | 272 | component_id, "%s\n", acpi_gbl_fn_entry_str); |
276 | } | 273 | } |
277 | 274 | ||
278 | EXPORT_SYMBOL(acpi_ut_trace); | 275 | ACPI_EXPORT_SYMBOL(acpi_ut_trace) |
279 | 276 | ||
280 | /******************************************************************************* | 277 | /******************************************************************************* |
281 | * | 278 | * |
@@ -293,7 +290,6 @@ EXPORT_SYMBOL(acpi_ut_trace); | |||
293 | * set in debug_level | 290 | * set in debug_level |
294 | * | 291 | * |
295 | ******************************************************************************/ | 292 | ******************************************************************************/ |
296 | |||
297 | void | 293 | void |
298 | acpi_ut_trace_ptr(u32 line_number, | 294 | acpi_ut_trace_ptr(u32 line_number, |
299 | const char *function_name, | 295 | const char *function_name, |
@@ -400,7 +396,7 @@ acpi_ut_exit(u32 line_number, | |||
400 | acpi_gbl_nesting_level--; | 396 | acpi_gbl_nesting_level--; |
401 | } | 397 | } |
402 | 398 | ||
403 | EXPORT_SYMBOL(acpi_ut_exit); | 399 | ACPI_EXPORT_SYMBOL(acpi_ut_exit) |
404 | 400 | ||
405 | /******************************************************************************* | 401 | /******************************************************************************* |
406 | * | 402 | * |
@@ -418,7 +414,6 @@ EXPORT_SYMBOL(acpi_ut_exit); | |||
418 | * set in debug_level. Prints exit status also. | 414 | * set in debug_level. Prints exit status also. |
419 | * | 415 | * |
420 | ******************************************************************************/ | 416 | ******************************************************************************/ |
421 | |||
422 | void | 417 | void |
423 | acpi_ut_status_exit(u32 line_number, | 418 | acpi_ut_status_exit(u32 line_number, |
424 | const char *function_name, | 419 | const char *function_name, |
@@ -442,7 +437,7 @@ acpi_ut_status_exit(u32 line_number, | |||
442 | acpi_gbl_nesting_level--; | 437 | acpi_gbl_nesting_level--; |
443 | } | 438 | } |
444 | 439 | ||
445 | EXPORT_SYMBOL(acpi_ut_status_exit); | 440 | ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) |
446 | 441 | ||
447 | /******************************************************************************* | 442 | /******************************************************************************* |
448 | * | 443 | * |
@@ -460,7 +455,6 @@ EXPORT_SYMBOL(acpi_ut_status_exit); | |||
460 | * set in debug_level. Prints exit value also. | 455 | * set in debug_level. Prints exit value also. |
461 | * | 456 | * |
462 | ******************************************************************************/ | 457 | ******************************************************************************/ |
463 | |||
464 | void | 458 | void |
465 | acpi_ut_value_exit(u32 line_number, | 459 | acpi_ut_value_exit(u32 line_number, |
466 | const char *function_name, | 460 | const char *function_name, |
@@ -475,7 +469,7 @@ acpi_ut_value_exit(u32 line_number, | |||
475 | acpi_gbl_nesting_level--; | 469 | acpi_gbl_nesting_level--; |
476 | } | 470 | } |
477 | 471 | ||
478 | EXPORT_SYMBOL(acpi_ut_value_exit); | 472 | ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) |
479 | 473 | ||
480 | /******************************************************************************* | 474 | /******************************************************************************* |
481 | * | 475 | * |
@@ -493,7 +487,6 @@ EXPORT_SYMBOL(acpi_ut_value_exit); | |||
493 | * set in debug_level. Prints exit value also. | 487 | * set in debug_level. Prints exit value also. |
494 | * | 488 | * |
495 | ******************************************************************************/ | 489 | ******************************************************************************/ |
496 | |||
497 | void | 490 | void |
498 | acpi_ut_ptr_exit(u32 line_number, | 491 | acpi_ut_ptr_exit(u32 line_number, |
499 | const char *function_name, | 492 | const char *function_name, |
@@ -524,20 +517,13 @@ acpi_ut_ptr_exit(u32 line_number, | |||
524 | * | 517 | * |
525 | ******************************************************************************/ | 518 | ******************************************************************************/ |
526 | 519 | ||
527 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | 520 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) |
528 | { | 521 | { |
529 | acpi_native_uint i = 0; | 522 | acpi_native_uint i = 0; |
530 | acpi_native_uint j; | 523 | acpi_native_uint j; |
531 | u32 temp32; | 524 | u32 temp32; |
532 | u8 buf_char; | 525 | u8 buf_char; |
533 | 526 | ||
534 | /* Only dump the buffer if tracing is enabled */ | ||
535 | |||
536 | if (!((ACPI_LV_TABLES & acpi_dbg_level) && | ||
537 | (component_id & acpi_dbg_layer))) { | ||
538 | return; | ||
539 | } | ||
540 | |||
541 | if ((count < 4) || (count & 0x01)) { | 527 | if ((count < 4) || (count & 0x01)) { |
542 | display = DB_BYTE_DISPLAY; | 528 | display = DB_BYTE_DISPLAY; |
543 | } | 529 | } |
@@ -545,6 +531,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
545 | /* Nasty little dump buffer routine! */ | 531 | /* Nasty little dump buffer routine! */ |
546 | 532 | ||
547 | while (i < count) { | 533 | while (i < count) { |
534 | |||
548 | /* Print current offset */ | 535 | /* Print current offset */ |
549 | 536 | ||
550 | acpi_os_printf("%6.4X: ", (u32) i); | 537 | acpi_os_printf("%6.4X: ", (u32) i); |
@@ -553,6 +540,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
553 | 540 | ||
554 | for (j = 0; j < 16;) { | 541 | for (j = 0; j < 16;) { |
555 | if (i + j >= count) { | 542 | if (i + j >= count) { |
543 | |||
556 | /* Dump fill spaces */ | 544 | /* Dump fill spaces */ |
557 | 545 | ||
558 | acpi_os_printf("%*s", ((display * 2) + 1), " "); | 546 | acpi_os_printf("%*s", ((display * 2) + 1), " "); |
@@ -561,6 +549,7 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
561 | } | 549 | } |
562 | 550 | ||
563 | switch (display) { | 551 | switch (display) { |
552 | case DB_BYTE_DISPLAY: | ||
564 | default: /* Default is BYTE display */ | 553 | default: /* Default is BYTE display */ |
565 | 554 | ||
566 | acpi_os_printf("%02X ", buffer[i + j]); | 555 | acpi_os_printf("%02X ", buffer[i + j]); |
@@ -618,3 +607,31 @@ void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | |||
618 | 607 | ||
619 | return; | 608 | return; |
620 | } | 609 | } |
610 | |||
611 | /******************************************************************************* | ||
612 | * | ||
613 | * FUNCTION: acpi_ut_dump_buffer | ||
614 | * | ||
615 | * PARAMETERS: Buffer - Buffer to dump | ||
616 | * Count - Amount to dump, in bytes | ||
617 | * Display - BYTE, WORD, DWORD, or QWORD display | ||
618 | * component_iD - Caller's component ID | ||
619 | * | ||
620 | * RETURN: None | ||
621 | * | ||
622 | * DESCRIPTION: Generic dump buffer in both hex and ascii. | ||
623 | * | ||
624 | ******************************************************************************/ | ||
625 | |||
626 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id) | ||
627 | { | ||
628 | |||
629 | /* Only dump the buffer if tracing is enabled */ | ||
630 | |||
631 | if (!((ACPI_LV_TABLES & acpi_dbg_level) && | ||
632 | (component_id & acpi_dbg_layer))) { | ||
633 | return; | ||
634 | } | ||
635 | |||
636 | acpi_ut_dump_buffer2(buffer, count, display); | ||
637 | } | ||
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index 1db9695b0029..67b9f325c6fa 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -76,7 +76,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
76 | union acpi_operand_object *second_desc; | 76 | union acpi_operand_object *second_desc; |
77 | union acpi_operand_object *next_desc; | 77 | union acpi_operand_object *next_desc; |
78 | 78 | ||
79 | ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); | 79 | ACPI_FUNCTION_TRACE_PTR(ut_delete_internal_obj, object); |
80 | 80 | ||
81 | if (!object) { | 81 | if (!object) { |
82 | return_VOID; | 82 | return_VOID; |
@@ -96,6 +96,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
96 | /* Free the actual string buffer */ | 96 | /* Free the actual string buffer */ |
97 | 97 | ||
98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 98 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
99 | |||
99 | /* But only if it is NOT a pointer into an ACPI table */ | 100 | /* But only if it is NOT a pointer into an ACPI table */ |
100 | 101 | ||
101 | obj_pointer = object->string.pointer; | 102 | obj_pointer = object->string.pointer; |
@@ -111,6 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
111 | /* Free the actual buffer */ | 112 | /* Free the actual buffer */ |
112 | 113 | ||
113 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { | 114 | if (!(object->common.flags & AOPOBJ_STATIC_POINTER)) { |
115 | |||
114 | /* But only if it is NOT a pointer into an ACPI table */ | 116 | /* But only if it is NOT a pointer into an ACPI table */ |
115 | 117 | ||
116 | obj_pointer = object->buffer.pointer; | 118 | obj_pointer = object->buffer.pointer; |
@@ -198,11 +200,22 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
198 | */ | 200 | */ |
199 | handler_desc = object->region.handler; | 201 | handler_desc = object->region.handler; |
200 | if (handler_desc) { | 202 | if (handler_desc) { |
201 | if (handler_desc->address_space. | 203 | if (handler_desc->address_space.handler_flags & |
202 | hflags & | ||
203 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | 204 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { |
204 | obj_pointer = | 205 | |
205 | second_desc->extra.region_context; | 206 | /* Deactivate region and free region context */ |
207 | |||
208 | if (handler_desc->address_space.setup) { | ||
209 | (void)handler_desc-> | ||
210 | address_space.setup(object, | ||
211 | ACPI_REGION_DEACTIVATE, | ||
212 | handler_desc-> | ||
213 | address_space. | ||
214 | context, | ||
215 | &second_desc-> | ||
216 | extra. | ||
217 | region_context); | ||
218 | } | ||
206 | } | 219 | } |
207 | 220 | ||
208 | acpi_ut_remove_reference(handler_desc); | 221 | acpi_ut_remove_reference(handler_desc); |
@@ -234,7 +247,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
234 | if (obj_pointer) { | 247 | if (obj_pointer) { |
235 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | 248 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
236 | "Deleting Object Subptr %p\n", obj_pointer)); | 249 | "Deleting Object Subptr %p\n", obj_pointer)); |
237 | ACPI_MEM_FREE(obj_pointer); | 250 | ACPI_FREE(obj_pointer); |
238 | } | 251 | } |
239 | 252 | ||
240 | /* Now the object can be safely deleted */ | 253 | /* Now the object can be safely deleted */ |
@@ -263,7 +276,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
263 | { | 276 | { |
264 | union acpi_operand_object **internal_obj; | 277 | union acpi_operand_object **internal_obj; |
265 | 278 | ||
266 | ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); | 279 | ACPI_FUNCTION_TRACE(ut_delete_internal_object_list); |
267 | 280 | ||
268 | /* Walk the null-terminated internal list */ | 281 | /* Walk the null-terminated internal list */ |
269 | 282 | ||
@@ -273,7 +286,7 @@ void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) | |||
273 | 286 | ||
274 | /* Free the combined parameter pointer list and object array */ | 287 | /* Free the combined parameter pointer list and object array */ |
275 | 288 | ||
276 | ACPI_MEM_FREE(obj_list); | 289 | ACPI_FREE(obj_list); |
277 | return_VOID; | 290 | return_VOID; |
278 | } | 291 | } |
279 | 292 | ||
@@ -296,7 +309,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
296 | u16 count; | 309 | u16 count; |
297 | u16 new_count; | 310 | u16 new_count; |
298 | 311 | ||
299 | ACPI_FUNCTION_NAME("ut_update_ref_count"); | 312 | ACPI_FUNCTION_NAME(ut_update_ref_count); |
300 | 313 | ||
301 | if (!object) { | 314 | if (!object) { |
302 | return; | 315 | return; |
@@ -306,11 +319,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
306 | new_count = count; | 319 | new_count = count; |
307 | 320 | ||
308 | /* | 321 | /* |
309 | * Perform the reference count action | 322 | * Perform the reference count action (increment, decrement, force delete) |
310 | * (increment, decrement, or force delete) | ||
311 | */ | 323 | */ |
312 | switch (action) { | 324 | switch (action) { |
313 | |||
314 | case REF_INCREMENT: | 325 | case REF_INCREMENT: |
315 | 326 | ||
316 | new_count++; | 327 | new_count++; |
@@ -347,7 +358,6 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
347 | if (new_count == 0) { | 358 | if (new_count == 0) { |
348 | acpi_ut_delete_internal_obj(object); | 359 | acpi_ut_delete_internal_obj(object); |
349 | } | 360 | } |
350 | |||
351 | break; | 361 | break; |
352 | 362 | ||
353 | case REF_FORCE_DELETE: | 363 | case REF_FORCE_DELETE: |
@@ -372,13 +382,10 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
372 | * (A deleted object will have a huge reference count) | 382 | * (A deleted object will have a huge reference count) |
373 | */ | 383 | */ |
374 | if (count > ACPI_MAX_REFERENCE_COUNT) { | 384 | if (count > ACPI_MAX_REFERENCE_COUNT) { |
375 | |||
376 | ACPI_WARNING((AE_INFO, | 385 | ACPI_WARNING((AE_INFO, |
377 | "Large Reference Count (%X) in object %p", | 386 | "Large Reference Count (%X) in object %p", count, |
378 | count, object)); | 387 | object)); |
379 | } | 388 | } |
380 | |||
381 | return; | ||
382 | } | 389 | } |
383 | 390 | ||
384 | /******************************************************************************* | 391 | /******************************************************************************* |
@@ -404,7 +411,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) | |||
404 | ******************************************************************************/ | 411 | ******************************************************************************/ |
405 | 412 | ||
406 | acpi_status | 413 | acpi_status |
407 | acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | 414 | acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) |
408 | { | 415 | { |
409 | acpi_status status = AE_OK; | 416 | acpi_status status = AE_OK; |
410 | union acpi_generic_state *state_list = NULL; | 417 | union acpi_generic_state *state_list = NULL; |
@@ -412,9 +419,10 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
412 | union acpi_generic_state *state; | 419 | union acpi_generic_state *state; |
413 | acpi_native_uint i; | 420 | acpi_native_uint i; |
414 | 421 | ||
415 | ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); | 422 | ACPI_FUNCTION_TRACE_PTR(ut_update_object_reference, object); |
416 | 423 | ||
417 | while (object) { | 424 | while (object) { |
425 | |||
418 | /* Make sure that this isn't a namespace handle */ | 426 | /* Make sure that this isn't a namespace handle */ |
419 | 427 | ||
420 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { | 428 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { |
@@ -507,11 +515,11 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
507 | 515 | ||
508 | case ACPI_TYPE_REGION: | 516 | case ACPI_TYPE_REGION: |
509 | default: | 517 | default: |
510 | break; /* No subobjects */ | 518 | break; /* No subobjects for all other types */ |
511 | } | 519 | } |
512 | 520 | ||
513 | /* | 521 | /* |
514 | * Now we can update the count in the main object. This can only | 522 | * Now we can update the count in the main object. This can only |
515 | * happen after we update the sub-objects in case this causes the | 523 | * happen after we update the sub-objects in case this causes the |
516 | * main object to be deleted. | 524 | * main object to be deleted. |
517 | */ | 525 | */ |
@@ -556,7 +564,7 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) | |||
556 | void acpi_ut_add_reference(union acpi_operand_object *object) | 564 | void acpi_ut_add_reference(union acpi_operand_object *object) |
557 | { | 565 | { |
558 | 566 | ||
559 | ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); | 567 | ACPI_FUNCTION_TRACE_PTR(ut_add_reference, object); |
560 | 568 | ||
561 | /* Ensure that we have a valid object */ | 569 | /* Ensure that we have a valid object */ |
562 | 570 | ||
@@ -589,11 +597,11 @@ void acpi_ut_add_reference(union acpi_operand_object *object) | |||
589 | void acpi_ut_remove_reference(union acpi_operand_object *object) | 597 | void acpi_ut_remove_reference(union acpi_operand_object *object) |
590 | { | 598 | { |
591 | 599 | ||
592 | ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); | 600 | ACPI_FUNCTION_TRACE_PTR(ut_remove_reference, object); |
593 | 601 | ||
594 | /* | 602 | /* |
595 | * Allow a NULL pointer to be passed in, just ignore it. This saves | 603 | * Allow a NULL pointer to be passed in, just ignore it. This saves |
596 | * each caller from having to check. Also, ignore NS nodes. | 604 | * each caller from having to check. Also, ignore NS nodes. |
597 | * | 605 | * |
598 | */ | 606 | */ |
599 | if (!object || | 607 | if (!object || |
@@ -613,7 +621,7 @@ void acpi_ut_remove_reference(union acpi_operand_object *object) | |||
613 | 621 | ||
614 | /* | 622 | /* |
615 | * Decrement the reference count, and only actually delete the object | 623 | * Decrement the reference count, and only actually delete the object |
616 | * if the reference count becomes 0. (Must also decrement the ref count | 624 | * if the reference count becomes 0. (Must also decrement the ref count |
617 | * of all subobjects!) | 625 | * of all subobjects!) |
618 | */ | 626 | */ |
619 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); | 627 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 106cc97cb4af..d6d7121583c0 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -56,6 +56,34 @@ static acpi_status | |||
56 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | 56 | acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, |
57 | struct acpi_compatible_id *one_cid); | 57 | struct acpi_compatible_id *one_cid); |
58 | 58 | ||
59 | /* | ||
60 | * Strings supported by the _OSI predefined (internal) method. | ||
61 | */ | ||
62 | static const char *acpi_interfaces_supported[] = { | ||
63 | /* Operating System Vendor Strings */ | ||
64 | |||
65 | "Linux", | ||
66 | "Windows 2000", | ||
67 | "Windows 2001", | ||
68 | "Windows 2001 SP0", | ||
69 | "Windows 2001 SP1", | ||
70 | "Windows 2001 SP2", | ||
71 | "Windows 2001 SP3", | ||
72 | "Windows 2001 SP4", | ||
73 | "Windows 2001.1", | ||
74 | "Windows 2001.1 SP1", /* Added 03/2006 */ | ||
75 | "Windows 2006", /* Added 03/2006 */ | ||
76 | |||
77 | /* Feature Group Strings */ | ||
78 | |||
79 | "Extended Address Space Descriptor" | ||
80 | /* | ||
81 | * All "optional" feature group strings (features that are implemented | ||
82 | * by the host) should be implemented in the host version of | ||
83 | * acpi_os_validate_interface and should not be added here. | ||
84 | */ | ||
85 | }; | ||
86 | |||
59 | /******************************************************************************* | 87 | /******************************************************************************* |
60 | * | 88 | * |
61 | * FUNCTION: acpi_ut_osi_implementation | 89 | * FUNCTION: acpi_ut_osi_implementation |
@@ -64,18 +92,18 @@ acpi_ut_translate_one_cid(union acpi_operand_object *obj_desc, | |||
64 | * | 92 | * |
65 | * RETURN: Status | 93 | * RETURN: Status |
66 | * | 94 | * |
67 | * DESCRIPTION: Implementation of _OSI predefined control method | 95 | * DESCRIPTION: Implementation of the _OSI predefined control method |
68 | * Supported = _OSI (String) | ||
69 | * | 96 | * |
70 | ******************************************************************************/ | 97 | ******************************************************************************/ |
71 | 98 | ||
72 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | 99 | acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) |
73 | { | 100 | { |
101 | acpi_status status; | ||
74 | union acpi_operand_object *string_desc; | 102 | union acpi_operand_object *string_desc; |
75 | union acpi_operand_object *return_desc; | 103 | union acpi_operand_object *return_desc; |
76 | acpi_native_uint i; | 104 | acpi_native_uint i; |
77 | 105 | ||
78 | ACPI_FUNCTION_TRACE("ut_osi_implementation"); | 106 | ACPI_FUNCTION_TRACE(ut_osi_implementation); |
79 | 107 | ||
80 | /* Validate the string input argument */ | 108 | /* Validate the string input argument */ |
81 | 109 | ||
@@ -84,28 +112,47 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state) | |||
84 | return_ACPI_STATUS(AE_TYPE); | 112 | return_ACPI_STATUS(AE_TYPE); |
85 | } | 113 | } |
86 | 114 | ||
87 | /* Create a return object (Default value = 0) */ | 115 | /* Create a return object */ |
88 | 116 | ||
89 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); | 117 | return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER); |
90 | if (!return_desc) { | 118 | if (!return_desc) { |
91 | return_ACPI_STATUS(AE_NO_MEMORY); | 119 | return_ACPI_STATUS(AE_NO_MEMORY); |
92 | } | 120 | } |
93 | 121 | ||
94 | /* Compare input string to table of supported strings */ | 122 | /* Default return value is SUPPORTED */ |
123 | |||
124 | return_desc->integer.value = ACPI_UINT32_MAX; | ||
125 | walk_state->return_desc = return_desc; | ||
126 | |||
127 | /* Compare input string to static table of supported interfaces */ | ||
95 | 128 | ||
96 | for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) { | 129 | for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_interfaces_supported); i++) { |
97 | if (!ACPI_STRCMP(string_desc->string.pointer, | 130 | if (!ACPI_STRCMP |
98 | ACPI_CAST_PTR(char, | 131 | (string_desc->string.pointer, |
99 | acpi_gbl_valid_osi_strings[i]))) | 132 | acpi_interfaces_supported[i])) { |
100 | { | ||
101 | /* This string is supported */ | ||
102 | 133 | ||
103 | return_desc->integer.value = 0xFFFFFFFF; | 134 | /* The interface is supported */ |
104 | break; | 135 | |
136 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | ||
105 | } | 137 | } |
106 | } | 138 | } |
107 | 139 | ||
108 | walk_state->return_desc = return_desc; | 140 | /* |
141 | * Did not match the string in the static table, call the host OSL to | ||
142 | * check for a match with one of the optional strings (such as | ||
143 | * "Module Device", "3.0 Thermal Model", etc.) | ||
144 | */ | ||
145 | status = acpi_os_validate_interface(string_desc->string.pointer); | ||
146 | if (ACPI_SUCCESS(status)) { | ||
147 | |||
148 | /* The interface is supported */ | ||
149 | |||
150 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | ||
151 | } | ||
152 | |||
153 | /* The interface is not supported */ | ||
154 | |||
155 | return_desc->integer.value = 0; | ||
109 | return_ACPI_STATUS(AE_CTRL_TERMINATE); | 156 | return_ACPI_STATUS(AE_CTRL_TERMINATE); |
110 | } | 157 | } |
111 | 158 | ||
@@ -134,19 +181,26 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
134 | u32 expected_return_btypes, | 181 | u32 expected_return_btypes, |
135 | union acpi_operand_object **return_desc) | 182 | union acpi_operand_object **return_desc) |
136 | { | 183 | { |
137 | struct acpi_parameter_info info; | 184 | struct acpi_evaluate_info *info; |
138 | acpi_status status; | 185 | acpi_status status; |
139 | u32 return_btype; | 186 | u32 return_btype; |
140 | 187 | ||
141 | ACPI_FUNCTION_TRACE("ut_evaluate_object"); | 188 | ACPI_FUNCTION_TRACE(ut_evaluate_object); |
142 | 189 | ||
143 | info.node = prefix_node; | 190 | /* Allocate the evaluation information block */ |
144 | info.parameters = NULL; | 191 | |
145 | info.parameter_type = ACPI_PARAM_ARGS; | 192 | info = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_evaluate_info)); |
193 | if (!info) { | ||
194 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
195 | } | ||
196 | |||
197 | info->prefix_node = prefix_node; | ||
198 | info->pathname = path; | ||
199 | info->parameter_type = ACPI_PARAM_ARGS; | ||
146 | 200 | ||
147 | /* Evaluate the object/method */ | 201 | /* Evaluate the object/method */ |
148 | 202 | ||
149 | status = acpi_ns_evaluate_relative(path, &info); | 203 | status = acpi_ns_evaluate(info); |
150 | if (ACPI_FAILURE(status)) { | 204 | if (ACPI_FAILURE(status)) { |
151 | if (status == AE_NOT_FOUND) { | 205 | if (status == AE_NOT_FOUND) { |
152 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 206 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
@@ -158,25 +212,25 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
158 | prefix_node, path, status); | 212 | prefix_node, path, status); |
159 | } | 213 | } |
160 | 214 | ||
161 | return_ACPI_STATUS(status); | 215 | goto cleanup; |
162 | } | 216 | } |
163 | 217 | ||
164 | /* Did we get a return object? */ | 218 | /* Did we get a return object? */ |
165 | 219 | ||
166 | if (!info.return_object) { | 220 | if (!info->return_object) { |
167 | if (expected_return_btypes) { | 221 | if (expected_return_btypes) { |
168 | ACPI_ERROR_METHOD("No object was returned from", | 222 | ACPI_ERROR_METHOD("No object was returned from", |
169 | prefix_node, path, AE_NOT_EXIST); | 223 | prefix_node, path, AE_NOT_EXIST); |
170 | 224 | ||
171 | return_ACPI_STATUS(AE_NOT_EXIST); | 225 | status = AE_NOT_EXIST; |
172 | } | 226 | } |
173 | 227 | ||
174 | return_ACPI_STATUS(AE_OK); | 228 | goto cleanup; |
175 | } | 229 | } |
176 | 230 | ||
177 | /* Map the return object type to the bitmapped type */ | 231 | /* Map the return object type to the bitmapped type */ |
178 | 232 | ||
179 | switch (ACPI_GET_OBJECT_TYPE(info.return_object)) { | 233 | switch (ACPI_GET_OBJECT_TYPE(info->return_object)) { |
180 | case ACPI_TYPE_INTEGER: | 234 | case ACPI_TYPE_INTEGER: |
181 | return_btype = ACPI_BTYPE_INTEGER; | 235 | return_btype = ACPI_BTYPE_INTEGER; |
182 | break; | 236 | break; |
@@ -204,8 +258,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
204 | * happen frequently if the "implicit return" feature is enabled. | 258 | * happen frequently if the "implicit return" feature is enabled. |
205 | * Just delete the return object and return AE_OK. | 259 | * Just delete the return object and return AE_OK. |
206 | */ | 260 | */ |
207 | acpi_ut_remove_reference(info.return_object); | 261 | acpi_ut_remove_reference(info->return_object); |
208 | return_ACPI_STATUS(AE_OK); | 262 | goto cleanup; |
209 | } | 263 | } |
210 | 264 | ||
211 | /* Is the return object one of the expected types? */ | 265 | /* Is the return object one of the expected types? */ |
@@ -217,19 +271,23 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, | |||
217 | ACPI_ERROR((AE_INFO, | 271 | ACPI_ERROR((AE_INFO, |
218 | "Type returned from %s was incorrect: %s, expected Btypes: %X", | 272 | "Type returned from %s was incorrect: %s, expected Btypes: %X", |
219 | path, | 273 | path, |
220 | acpi_ut_get_object_type_name(info.return_object), | 274 | acpi_ut_get_object_type_name(info->return_object), |
221 | expected_return_btypes)); | 275 | expected_return_btypes)); |
222 | 276 | ||
223 | /* On error exit, we must delete the return object */ | 277 | /* On error exit, we must delete the return object */ |
224 | 278 | ||
225 | acpi_ut_remove_reference(info.return_object); | 279 | acpi_ut_remove_reference(info->return_object); |
226 | return_ACPI_STATUS(AE_TYPE); | 280 | status = AE_TYPE; |
281 | goto cleanup; | ||
227 | } | 282 | } |
228 | 283 | ||
229 | /* Object type is OK, return it */ | 284 | /* Object type is OK, return it */ |
230 | 285 | ||
231 | *return_desc = info.return_object; | 286 | *return_desc = info->return_object; |
232 | return_ACPI_STATUS(AE_OK); | 287 | |
288 | cleanup: | ||
289 | ACPI_FREE(info); | ||
290 | return_ACPI_STATUS(status); | ||
233 | } | 291 | } |
234 | 292 | ||
235 | /******************************************************************************* | 293 | /******************************************************************************* |
@@ -257,7 +315,7 @@ acpi_ut_evaluate_numeric_object(char *object_name, | |||
257 | union acpi_operand_object *obj_desc; | 315 | union acpi_operand_object *obj_desc; |
258 | acpi_status status; | 316 | acpi_status status; |
259 | 317 | ||
260 | ACPI_FUNCTION_TRACE("ut_evaluate_numeric_object"); | 318 | ACPI_FUNCTION_TRACE(ut_evaluate_numeric_object); |
261 | 319 | ||
262 | status = acpi_ut_evaluate_object(device_node, object_name, | 320 | status = acpi_ut_evaluate_object(device_node, object_name, |
263 | ACPI_BTYPE_INTEGER, &obj_desc); | 321 | ACPI_BTYPE_INTEGER, &obj_desc); |
@@ -333,7 +391,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
333 | union acpi_operand_object *obj_desc; | 391 | union acpi_operand_object *obj_desc; |
334 | acpi_status status; | 392 | acpi_status status; |
335 | 393 | ||
336 | ACPI_FUNCTION_TRACE("ut_execute_HID"); | 394 | ACPI_FUNCTION_TRACE(ut_execute_HID); |
337 | 395 | ||
338 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, | 396 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__HID, |
339 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | 397 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, |
@@ -343,6 +401,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | |||
343 | } | 401 | } |
344 | 402 | ||
345 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 403 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
404 | |||
346 | /* Convert the Numeric HID to string */ | 405 | /* Convert the Numeric HID to string */ |
347 | 406 | ||
348 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, | 407 | acpi_ex_eisa_id_to_string((u32) obj_desc->integer.value, |
@@ -436,7 +495,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
436 | struct acpi_compatible_id_list *cid_list; | 495 | struct acpi_compatible_id_list *cid_list; |
437 | acpi_native_uint i; | 496 | acpi_native_uint i; |
438 | 497 | ||
439 | ACPI_FUNCTION_TRACE("ut_execute_CID"); | 498 | ACPI_FUNCTION_TRACE(ut_execute_CID); |
440 | 499 | ||
441 | /* Evaluate the _CID method for this device */ | 500 | /* Evaluate the _CID method for this device */ |
442 | 501 | ||
@@ -459,7 +518,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
459 | size = (((count - 1) * sizeof(struct acpi_compatible_id)) + | 518 | size = (((count - 1) * sizeof(struct acpi_compatible_id)) + |
460 | sizeof(struct acpi_compatible_id_list)); | 519 | sizeof(struct acpi_compatible_id_list)); |
461 | 520 | ||
462 | cid_list = ACPI_MEM_CALLOCATE((acpi_size) size); | 521 | cid_list = ACPI_ALLOCATE_ZEROED((acpi_size) size); |
463 | if (!cid_list) { | 522 | if (!cid_list) { |
464 | return_ACPI_STATUS(AE_NO_MEMORY); | 523 | return_ACPI_STATUS(AE_NO_MEMORY); |
465 | } | 524 | } |
@@ -479,6 +538,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
479 | /* The _CID object can be either a single CID or a package (list) of CIDs */ | 538 | /* The _CID object can be either a single CID or a package (list) of CIDs */ |
480 | 539 | ||
481 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { | 540 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) { |
541 | |||
482 | /* Translate each package element */ | 542 | /* Translate each package element */ |
483 | 543 | ||
484 | for (i = 0; i < count; i++) { | 544 | for (i = 0; i < count; i++) { |
@@ -499,7 +559,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
499 | /* Cleanup on error */ | 559 | /* Cleanup on error */ |
500 | 560 | ||
501 | if (ACPI_FAILURE(status)) { | 561 | if (ACPI_FAILURE(status)) { |
502 | ACPI_MEM_FREE(cid_list); | 562 | ACPI_FREE(cid_list); |
503 | } else { | 563 | } else { |
504 | *return_cid_list = cid_list; | 564 | *return_cid_list = cid_list; |
505 | } | 565 | } |
@@ -533,7 +593,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
533 | union acpi_operand_object *obj_desc; | 593 | union acpi_operand_object *obj_desc; |
534 | acpi_status status; | 594 | acpi_status status; |
535 | 595 | ||
536 | ACPI_FUNCTION_TRACE("ut_execute_UID"); | 596 | ACPI_FUNCTION_TRACE(ut_execute_UID); |
537 | 597 | ||
538 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, | 598 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__UID, |
539 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, | 599 | ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, |
@@ -543,6 +603,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | |||
543 | } | 603 | } |
544 | 604 | ||
545 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 605 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
606 | |||
546 | /* Convert the Numeric UID to string */ | 607 | /* Convert the Numeric UID to string */ |
547 | 608 | ||
548 | acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, | 609 | acpi_ex_unsigned_integer_to_string(obj_desc->integer.value, |
@@ -582,7 +643,7 @@ acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 * flags) | |||
582 | union acpi_operand_object *obj_desc; | 643 | union acpi_operand_object *obj_desc; |
583 | acpi_status status; | 644 | acpi_status status; |
584 | 645 | ||
585 | ACPI_FUNCTION_TRACE("ut_execute_STA"); | 646 | ACPI_FUNCTION_TRACE(ut_execute_STA); |
586 | 647 | ||
587 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, | 648 | status = acpi_ut_evaluate_object(device_node, METHOD_NAME__STA, |
588 | ACPI_BTYPE_INTEGER, &obj_desc); | 649 | ACPI_BTYPE_INTEGER, &obj_desc); |
@@ -632,7 +693,7 @@ acpi_ut_execute_sxds(struct acpi_namespace_node *device_node, u8 * highest) | |||
632 | acpi_status status; | 693 | acpi_status status; |
633 | u32 i; | 694 | u32 i; |
634 | 695 | ||
635 | ACPI_FUNCTION_TRACE("ut_execute_Sxds"); | 696 | ACPI_FUNCTION_TRACE(ut_execute_sxds); |
636 | 697 | ||
637 | for (i = 0; i < 4; i++) { | 698 | for (i = 0; i < 4; i++) { |
638 | highest[i] = 0xFF; | 699 | highest[i] = 0xFF; |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index ffd13383a325..e5999c65c0b8 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -43,7 +43,6 @@ | |||
43 | 43 | ||
44 | #define DEFINE_ACPI_GLOBALS | 44 | #define DEFINE_ACPI_GLOBALS |
45 | 45 | ||
46 | #include <linux/module.h> | ||
47 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
48 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
49 | 48 | ||
@@ -119,6 +118,7 @@ const char *acpi_format_exception(acpi_status status) | |||
119 | } | 118 | } |
120 | 119 | ||
121 | if (!exception) { | 120 | if (!exception) { |
121 | |||
122 | /* Exception code was not recognized */ | 122 | /* Exception code was not recognized */ |
123 | 123 | ||
124 | ACPI_ERROR((AE_INFO, | 124 | ACPI_ERROR((AE_INFO, |
@@ -143,12 +143,10 @@ const char *acpi_format_exception(acpi_status status) | |||
143 | 143 | ||
144 | /* Debug switch - level and trace mask */ | 144 | /* Debug switch - level and trace mask */ |
145 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; | 145 | u32 acpi_dbg_level = ACPI_DEBUG_DEFAULT; |
146 | EXPORT_SYMBOL(acpi_dbg_level); | ||
147 | 146 | ||
148 | /* Debug switch - layer (component) mask */ | 147 | /* Debug switch - layer (component) mask */ |
149 | 148 | ||
150 | u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; | 149 | u32 acpi_dbg_layer = ACPI_COMPONENT_DEFAULT | ACPI_ALL_DRIVERS; |
151 | EXPORT_SYMBOL(acpi_dbg_layer); | ||
152 | u32 acpi_gbl_nesting_level = 0; | 150 | u32 acpi_gbl_nesting_level = 0; |
153 | 151 | ||
154 | /* Debugger globals */ | 152 | /* Debugger globals */ |
@@ -183,28 +181,6 @@ const char *acpi_gbl_highest_dstate_names[4] = { | |||
183 | "_S4D" | 181 | "_S4D" |
184 | }; | 182 | }; |
185 | 183 | ||
186 | /* | ||
187 | * Strings supported by the _OSI predefined (internal) method. | ||
188 | * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS. | ||
189 | */ | ||
190 | const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = { | ||
191 | /* Operating System Vendor Strings */ | ||
192 | |||
193 | "Linux", | ||
194 | "Windows 2000", | ||
195 | "Windows 2001", | ||
196 | "Windows 2001.1", | ||
197 | "Windows 2001 SP0", | ||
198 | "Windows 2001 SP1", | ||
199 | "Windows 2001 SP2", | ||
200 | "Windows 2001 SP3", | ||
201 | "Windows 2001 SP4", | ||
202 | |||
203 | /* Feature Group Strings */ | ||
204 | |||
205 | "Extended Address Space Descriptor" | ||
206 | }; | ||
207 | |||
208 | /******************************************************************************* | 184 | /******************************************************************************* |
209 | * | 185 | * |
210 | * Namespace globals | 186 | * Namespace globals |
@@ -317,9 +293,9 @@ char acpi_ut_hex_to_ascii_char(acpi_integer integer, u32 position) | |||
317 | * | 293 | * |
318 | ******************************************************************************/ | 294 | ******************************************************************************/ |
319 | 295 | ||
320 | struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; | 296 | struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; |
321 | 297 | ||
322 | struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES] = { | 298 | struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1] = { |
323 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ | 299 | /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */ |
324 | 300 | ||
325 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, | 301 | /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof(RSDP_SIG) - 1, |
@@ -467,7 +443,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = | |||
467 | /* Region type decoding */ | 443 | /* Region type decoding */ |
468 | 444 | ||
469 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | 445 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { |
470 | /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ | ||
471 | "SystemMemory", | 446 | "SystemMemory", |
472 | "SystemIO", | 447 | "SystemIO", |
473 | "PCI_Config", | 448 | "PCI_Config", |
@@ -476,16 +451,15 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | |||
476 | "CMOS", | 451 | "CMOS", |
477 | "PCIBARTarget", | 452 | "PCIBARTarget", |
478 | "DataTable" | 453 | "DataTable" |
479 | /*! [End] no source code translation !*/ | ||
480 | }; | 454 | }; |
481 | 455 | ||
482 | char *acpi_ut_get_region_name(u8 space_id) | 456 | char *acpi_ut_get_region_name(u8 space_id) |
483 | { | 457 | { |
484 | 458 | ||
485 | if (space_id >= ACPI_USER_REGION_BEGIN) { | 459 | if (space_id >= ACPI_USER_REGION_BEGIN) { |
486 | return ("user_defined_region"); | 460 | return ("UserDefinedRegion"); |
487 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { | 461 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { |
488 | return ("invalid_space_id"); | 462 | return ("InvalidSpaceId"); |
489 | } | 463 | } |
490 | 464 | ||
491 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); | 465 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); |
@@ -506,20 +480,18 @@ char *acpi_ut_get_region_name(u8 space_id) | |||
506 | /* Event type decoding */ | 480 | /* Event type decoding */ |
507 | 481 | ||
508 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { | 482 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { |
509 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
510 | "PM_Timer", | 483 | "PM_Timer", |
511 | "GlobalLock", | 484 | "GlobalLock", |
512 | "PowerButton", | 485 | "PowerButton", |
513 | "SleepButton", | 486 | "SleepButton", |
514 | "RealTimeClock", | 487 | "RealTimeClock", |
515 | /*! [End] no source code translation !*/ | ||
516 | }; | 488 | }; |
517 | 489 | ||
518 | char *acpi_ut_get_event_name(u32 event_id) | 490 | char *acpi_ut_get_event_name(u32 event_id) |
519 | { | 491 | { |
520 | 492 | ||
521 | if (event_id > ACPI_EVENT_MAX) { | 493 | if (event_id > ACPI_EVENT_MAX) { |
522 | return ("invalid_event_iD"); | 494 | return ("InvalidEventID"); |
523 | } | 495 | } |
524 | 496 | ||
525 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); | 497 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); |
@@ -550,7 +522,6 @@ static const char acpi_gbl_bad_type[] = "UNDEFINED"; | |||
550 | /* Printable names of the ACPI object types */ | 522 | /* Printable names of the ACPI object types */ |
551 | 523 | ||
552 | static const char *acpi_gbl_ns_type_names[] = { | 524 | static const char *acpi_gbl_ns_type_names[] = { |
553 | /*! [Begin] no source code translation (keep these strings as-is) */ | ||
554 | /* 00 */ "Untyped", | 525 | /* 00 */ "Untyped", |
555 | /* 01 */ "Integer", | 526 | /* 01 */ "Integer", |
556 | /* 02 */ "String", | 527 | /* 02 */ "String", |
@@ -582,7 +553,6 @@ static const char *acpi_gbl_ns_type_names[] = { | |||
582 | /* 28 */ "Extra", | 553 | /* 28 */ "Extra", |
583 | /* 29 */ "Data", | 554 | /* 29 */ "Data", |
584 | /* 30 */ "Invalid" | 555 | /* 30 */ "Invalid" |
585 | /*! [End] no source code translation !*/ | ||
586 | }; | 556 | }; |
587 | 557 | ||
588 | char *acpi_ut_get_type_name(acpi_object_type type) | 558 | char *acpi_ut_get_type_name(acpi_object_type type) |
@@ -635,14 +605,14 @@ char *acpi_ut_get_node_name(void *object) | |||
635 | 605 | ||
636 | /* Descriptor must be a namespace node */ | 606 | /* Descriptor must be a namespace node */ |
637 | 607 | ||
638 | if (node->descriptor != ACPI_DESC_TYPE_NAMED) { | 608 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { |
639 | return ("####"); | 609 | return ("####"); |
640 | } | 610 | } |
641 | 611 | ||
642 | /* Name must be a valid ACPI name */ | 612 | /* Name must be a valid ACPI name */ |
643 | 613 | ||
644 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { | 614 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { |
645 | return ("????"); | 615 | node->name.integer = acpi_ut_repair_name(node->name.integer); |
646 | } | 616 | } |
647 | 617 | ||
648 | /* Return the name */ | 618 | /* Return the name */ |
@@ -665,7 +635,6 @@ char *acpi_ut_get_node_name(void *object) | |||
665 | /* Printable names of object descriptor types */ | 635 | /* Printable names of object descriptor types */ |
666 | 636 | ||
667 | static const char *acpi_gbl_desc_type_names[] = { | 637 | static const char *acpi_gbl_desc_type_names[] = { |
668 | /*! [Begin] no source code translation (keep these ASL Keywords as-is) */ | ||
669 | /* 00 */ "Invalid", | 638 | /* 00 */ "Invalid", |
670 | /* 01 */ "Cached", | 639 | /* 01 */ "Cached", |
671 | /* 02 */ "State-Generic", | 640 | /* 02 */ "State-Generic", |
@@ -682,7 +651,6 @@ static const char *acpi_gbl_desc_type_names[] = { | |||
682 | /* 13 */ "Parser", | 651 | /* 13 */ "Parser", |
683 | /* 14 */ "Operand", | 652 | /* 14 */ "Operand", |
684 | /* 15 */ "Node" | 653 | /* 15 */ "Node" |
685 | /*! [End] no source code translation !*/ | ||
686 | }; | 654 | }; |
687 | 655 | ||
688 | char *acpi_ut_get_descriptor_name(void *object) | 656 | char *acpi_ut_get_descriptor_name(void *object) |
@@ -723,7 +691,7 @@ char *acpi_ut_get_descriptor_name(void *object) | |||
723 | char *acpi_ut_get_mutex_name(u32 mutex_id) | 691 | char *acpi_ut_get_mutex_name(u32 mutex_id) |
724 | { | 692 | { |
725 | 693 | ||
726 | if (mutex_id > MAX_MUTEX) { | 694 | if (mutex_id > ACPI_MAX_MUTEX) { |
727 | return ("Invalid Mutex ID"); | 695 | return ("Invalid Mutex ID"); |
728 | } | 696 | } |
729 | 697 | ||
@@ -747,6 +715,7 @@ u8 acpi_ut_valid_object_type(acpi_object_type type) | |||
747 | { | 715 | { |
748 | 716 | ||
749 | if (type > ACPI_TYPE_LOCAL_MAX) { | 717 | if (type > ACPI_TYPE_LOCAL_MAX) { |
718 | |||
750 | /* Note: Assumes all TYPEs are contiguous (external/local) */ | 719 | /* Note: Assumes all TYPEs are contiguous (external/local) */ |
751 | 720 | ||
752 | return (FALSE); | 721 | return (FALSE); |
@@ -773,7 +742,7 @@ void acpi_ut_init_globals(void) | |||
773 | acpi_status status; | 742 | acpi_status status; |
774 | u32 i; | 743 | u32 i; |
775 | 744 | ||
776 | ACPI_FUNCTION_TRACE("ut_init_globals"); | 745 | ACPI_FUNCTION_TRACE(ut_init_globals); |
777 | 746 | ||
778 | /* Create all memory caches */ | 747 | /* Create all memory caches */ |
779 | 748 | ||
@@ -784,14 +753,14 @@ void acpi_ut_init_globals(void) | |||
784 | 753 | ||
785 | /* ACPI table structure */ | 754 | /* ACPI table structure */ |
786 | 755 | ||
787 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 756 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
788 | acpi_gbl_table_lists[i].next = NULL; | 757 | acpi_gbl_table_lists[i].next = NULL; |
789 | acpi_gbl_table_lists[i].count = 0; | 758 | acpi_gbl_table_lists[i].count = 0; |
790 | } | 759 | } |
791 | 760 | ||
792 | /* Mutex locked flags */ | 761 | /* Mutex locked flags */ |
793 | 762 | ||
794 | for (i = 0; i < NUM_MUTEX; i++) { | 763 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
795 | acpi_gbl_mutex_info[i].mutex = NULL; | 764 | acpi_gbl_mutex_info[i].mutex = NULL; |
796 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; | 765 | acpi_gbl_mutex_info[i].thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
797 | acpi_gbl_mutex_info[i].use_count = 0; | 766 | acpi_gbl_mutex_info[i].use_count = 0; |
@@ -856,7 +825,7 @@ void acpi_ut_init_globals(void) | |||
856 | 825 | ||
857 | acpi_gbl_root_node = NULL; | 826 | acpi_gbl_root_node = NULL; |
858 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; | 827 | acpi_gbl_root_node_struct.name.integer = ACPI_ROOT_NAME; |
859 | acpi_gbl_root_node_struct.descriptor = ACPI_DESC_TYPE_NAMED; | 828 | acpi_gbl_root_node_struct.descriptor_type = ACPI_DESC_TYPE_NAMED; |
860 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; | 829 | acpi_gbl_root_node_struct.type = ACPI_TYPE_DEVICE; |
861 | acpi_gbl_root_node_struct.child = NULL; | 830 | acpi_gbl_root_node_struct.child = NULL; |
862 | acpi_gbl_root_node_struct.peer = NULL; | 831 | acpi_gbl_root_node_struct.peer = NULL; |
@@ -869,3 +838,6 @@ void acpi_ut_init_globals(void) | |||
869 | 838 | ||
870 | return_VOID; | 839 | return_VOID; |
871 | } | 840 | } |
841 | |||
842 | ACPI_EXPORT_SYMBOL(acpi_dbg_level) | ||
843 | ACPI_EXPORT_SYMBOL(acpi_dbg_layer) | ||
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index ba771b4f39bc..ff76055eb7d6 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -50,7 +50,7 @@ ACPI_MODULE_NAME("utinit") | |||
50 | 50 | ||
51 | /* Local prototypes */ | 51 | /* Local prototypes */ |
52 | static void | 52 | static void |
53 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset); | 53 | acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset); |
54 | 54 | ||
55 | static void acpi_ut_terminate(void); | 55 | static void acpi_ut_terminate(void); |
56 | 56 | ||
@@ -69,12 +69,12 @@ static void acpi_ut_terminate(void); | |||
69 | ******************************************************************************/ | 69 | ******************************************************************************/ |
70 | 70 | ||
71 | static void | 71 | static void |
72 | acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) | 72 | acpi_ut_fadt_register_error(char *register_name, u32 value, u8 offset) |
73 | { | 73 | { |
74 | 74 | ||
75 | ACPI_WARNING((AE_INFO, | 75 | ACPI_WARNING((AE_INFO, |
76 | "Invalid FADT value %s=%X at offset %X FADT=%p", | 76 | "Invalid FADT value %s=%X at offset %X FADT=%p", |
77 | register_name, value, (u32) offset, acpi_gbl_FADT)); | 77 | register_name, value, offset, acpi_gbl_FADT)); |
78 | } | 78 | } |
79 | 79 | ||
80 | /****************************************************************************** | 80 | /****************************************************************************** |
@@ -176,7 +176,7 @@ static void acpi_ut_terminate(void) | |||
176 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; | 176 | struct acpi_gpe_xrupt_info *gpe_xrupt_info; |
177 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; | 177 | struct acpi_gpe_xrupt_info *next_gpe_xrupt_info; |
178 | 178 | ||
179 | ACPI_FUNCTION_TRACE("ut_terminate"); | 179 | ACPI_FUNCTION_TRACE(ut_terminate); |
180 | 180 | ||
181 | /* Free global tables, etc. */ | 181 | /* Free global tables, etc. */ |
182 | /* Free global GPE blocks and related info structures */ | 182 | /* Free global GPE blocks and related info structures */ |
@@ -186,14 +186,14 @@ static void acpi_ut_terminate(void) | |||
186 | gpe_block = gpe_xrupt_info->gpe_block_list_head; | 186 | gpe_block = gpe_xrupt_info->gpe_block_list_head; |
187 | while (gpe_block) { | 187 | while (gpe_block) { |
188 | next_gpe_block = gpe_block->next; | 188 | next_gpe_block = gpe_block->next; |
189 | ACPI_MEM_FREE(gpe_block->event_info); | 189 | ACPI_FREE(gpe_block->event_info); |
190 | ACPI_MEM_FREE(gpe_block->register_info); | 190 | ACPI_FREE(gpe_block->register_info); |
191 | ACPI_MEM_FREE(gpe_block); | 191 | ACPI_FREE(gpe_block); |
192 | 192 | ||
193 | gpe_block = next_gpe_block; | 193 | gpe_block = next_gpe_block; |
194 | } | 194 | } |
195 | next_gpe_xrupt_info = gpe_xrupt_info->next; | 195 | next_gpe_xrupt_info = gpe_xrupt_info->next; |
196 | ACPI_MEM_FREE(gpe_xrupt_info); | 196 | ACPI_FREE(gpe_xrupt_info); |
197 | gpe_xrupt_info = next_gpe_xrupt_info; | 197 | gpe_xrupt_info = next_gpe_xrupt_info; |
198 | } | 198 | } |
199 | 199 | ||
@@ -216,7 +216,7 @@ static void acpi_ut_terminate(void) | |||
216 | void acpi_ut_subsystem_shutdown(void) | 216 | void acpi_ut_subsystem_shutdown(void) |
217 | { | 217 | { |
218 | 218 | ||
219 | ACPI_FUNCTION_TRACE("ut_subsystem_shutdown"); | 219 | ACPI_FUNCTION_TRACE(ut_subsystem_shutdown); |
220 | 220 | ||
221 | /* Just exit if subsystem is already shutdown */ | 221 | /* Just exit if subsystem is already shutdown */ |
222 | 222 | ||
@@ -228,6 +228,7 @@ void acpi_ut_subsystem_shutdown(void) | |||
228 | /* Subsystem appears active, go ahead and shut it down */ | 228 | /* Subsystem appears active, go ahead and shut it down */ |
229 | 229 | ||
230 | acpi_gbl_shutdown = TRUE; | 230 | acpi_gbl_shutdown = TRUE; |
231 | acpi_gbl_startup_flags = 0; | ||
231 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); | 232 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); |
232 | 233 | ||
233 | /* Close the acpi_event Handling */ | 234 | /* Close the acpi_event Handling */ |
@@ -245,12 +246,5 @@ void acpi_ut_subsystem_shutdown(void) | |||
245 | /* Purge the local caches */ | 246 | /* Purge the local caches */ |
246 | 247 | ||
247 | (void)acpi_ut_delete_caches(); | 248 | (void)acpi_ut_delete_caches(); |
248 | |||
249 | /* Debug only - display leftover memory allocation, if any */ | ||
250 | |||
251 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | ||
252 | acpi_ut_dump_allocations(ACPI_UINT32_MAX, NULL); | ||
253 | #endif | ||
254 | |||
255 | return_VOID; | 249 | return_VOID; |
256 | } | 250 | } |
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 4a3360484e72..19d74bedce27 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c | |||
@@ -77,7 +77,7 @@ acpi_ut_short_divide(acpi_integer dividend, | |||
77 | union uint64_overlay quotient; | 77 | union uint64_overlay quotient; |
78 | u32 remainder32; | 78 | u32 remainder32; |
79 | 79 | ||
80 | ACPI_FUNCTION_TRACE("ut_short_divide"); | 80 | ACPI_FUNCTION_TRACE(ut_short_divide); |
81 | 81 | ||
82 | /* Always check for a zero divisor */ | 82 | /* Always check for a zero divisor */ |
83 | 83 | ||
@@ -139,7 +139,7 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
139 | union uint64_overlay partial2; | 139 | union uint64_overlay partial2; |
140 | union uint64_overlay partial3; | 140 | union uint64_overlay partial3; |
141 | 141 | ||
142 | ACPI_FUNCTION_TRACE("ut_divide"); | 142 | ACPI_FUNCTION_TRACE(ut_divide); |
143 | 143 | ||
144 | /* Always check for a zero divisor */ | 144 | /* Always check for a zero divisor */ |
145 | 145 | ||
@@ -261,7 +261,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
261 | acpi_integer * out_quotient, u32 * out_remainder) | 261 | acpi_integer * out_quotient, u32 * out_remainder) |
262 | { | 262 | { |
263 | 263 | ||
264 | ACPI_FUNCTION_TRACE("ut_short_divide"); | 264 | ACPI_FUNCTION_TRACE(ut_short_divide); |
265 | 265 | ||
266 | /* Always check for a zero divisor */ | 266 | /* Always check for a zero divisor */ |
267 | 267 | ||
@@ -287,7 +287,7 @@ acpi_ut_divide(acpi_integer in_dividend, | |||
287 | acpi_integer in_divisor, | 287 | acpi_integer in_divisor, |
288 | acpi_integer * out_quotient, acpi_integer * out_remainder) | 288 | acpi_integer * out_quotient, acpi_integer * out_remainder) |
289 | { | 289 | { |
290 | ACPI_FUNCTION_TRACE("ut_divide"); | 290 | ACPI_FUNCTION_TRACE(ut_divide); |
291 | 291 | ||
292 | /* Always check for a zero divisor */ | 292 | /* Always check for a zero divisor */ |
293 | 293 | ||
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 7364f5f8c9cd..5c75d35ad1cd 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -49,6 +49,33 @@ ACPI_MODULE_NAME("utmisc") | |||
49 | 49 | ||
50 | /******************************************************************************* | 50 | /******************************************************************************* |
51 | * | 51 | * |
52 | * FUNCTION: acpi_ut_is_aml_table | ||
53 | * | ||
54 | * PARAMETERS: Table - An ACPI table | ||
55 | * | ||
56 | * RETURN: TRUE if table contains executable AML; FALSE otherwise | ||
57 | * | ||
58 | * DESCRIPTION: Check ACPI Signature for a table that contains AML code. | ||
59 | * Currently, these are DSDT,SSDT,PSDT. All other table types are | ||
60 | * data tables that do not contain AML code. | ||
61 | * | ||
62 | ******************************************************************************/ | ||
63 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) | ||
64 | { | ||
65 | |||
66 | /* Ignore tables that contain AML */ | ||
67 | |||
68 | if (ACPI_COMPARE_NAME(table->signature, DSDT_SIG) || | ||
69 | ACPI_COMPARE_NAME(table->signature, PSDT_SIG) || | ||
70 | ACPI_COMPARE_NAME(table->signature, SSDT_SIG)) { | ||
71 | return (TRUE); | ||
72 | } | ||
73 | |||
74 | return (FALSE); | ||
75 | } | ||
76 | |||
77 | /******************************************************************************* | ||
78 | * | ||
52 | * FUNCTION: acpi_ut_allocate_owner_id | 79 | * FUNCTION: acpi_ut_allocate_owner_id |
53 | * | 80 | * |
54 | * PARAMETERS: owner_id - Where the new owner ID is returned | 81 | * PARAMETERS: owner_id - Where the new owner ID is returned |
@@ -60,6 +87,7 @@ ACPI_MODULE_NAME("utmisc") | |||
60 | * when the method exits or the table is unloaded. | 87 | * when the method exits or the table is unloaded. |
61 | * | 88 | * |
62 | ******************************************************************************/ | 89 | ******************************************************************************/ |
90 | |||
63 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | 91 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) |
64 | { | 92 | { |
65 | acpi_native_uint i; | 93 | acpi_native_uint i; |
@@ -67,7 +95,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
67 | acpi_native_uint k; | 95 | acpi_native_uint k; |
68 | acpi_status status; | 96 | acpi_status status; |
69 | 97 | ||
70 | ACPI_FUNCTION_TRACE("ut_allocate_owner_id"); | 98 | ACPI_FUNCTION_TRACE(ut_allocate_owner_id); |
71 | 99 | ||
72 | /* Guard against multiple allocations of ID to the same location */ | 100 | /* Guard against multiple allocations of ID to the same location */ |
73 | 101 | ||
@@ -97,6 +125,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
97 | 125 | ||
98 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { | 126 | for (k = acpi_gbl_next_owner_id_offset; k < 32; k++) { |
99 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { | 127 | if (acpi_gbl_owner_id_mask[j] == ACPI_UINT32_MAX) { |
128 | |||
100 | /* There are no free IDs in this mask */ | 129 | /* There are no free IDs in this mask */ |
101 | 130 | ||
102 | break; | 131 | break; |
@@ -123,7 +152,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
123 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); | 152 | (acpi_owner_id) ((k + 1) + ACPI_MUL_32(j)); |
124 | 153 | ||
125 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, | 154 | ACPI_DEBUG_PRINT((ACPI_DB_VALUES, |
126 | "Allocated owner_id: %2.2X\n", | 155 | "Allocated OwnerId: %2.2X\n", |
127 | (unsigned int)*owner_id)); | 156 | (unsigned int)*owner_id)); |
128 | goto exit; | 157 | goto exit; |
129 | } | 158 | } |
@@ -144,7 +173,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) | |||
144 | */ | 173 | */ |
145 | status = AE_OWNER_ID_LIMIT; | 174 | status = AE_OWNER_ID_LIMIT; |
146 | ACPI_ERROR((AE_INFO, | 175 | ACPI_ERROR((AE_INFO, |
147 | "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT")); | 176 | "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); |
148 | 177 | ||
149 | exit: | 178 | exit: |
150 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); | 179 | (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); |
@@ -172,7 +201,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
172 | acpi_native_uint index; | 201 | acpi_native_uint index; |
173 | u32 bit; | 202 | u32 bit; |
174 | 203 | ||
175 | ACPI_FUNCTION_TRACE_U32("ut_release_owner_id", owner_id); | 204 | ACPI_FUNCTION_TRACE_U32(ut_release_owner_id, owner_id); |
176 | 205 | ||
177 | /* Always clear the input owner_id (zero is an invalid ID) */ | 206 | /* Always clear the input owner_id (zero is an invalid ID) */ |
178 | 207 | ||
@@ -181,7 +210,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
181 | /* Zero is not a valid owner_iD */ | 210 | /* Zero is not a valid owner_iD */ |
182 | 211 | ||
183 | if (owner_id == 0) { | 212 | if (owner_id == 0) { |
184 | ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id)); | 213 | ACPI_ERROR((AE_INFO, "Invalid OwnerId: %2.2X", owner_id)); |
185 | return_VOID; | 214 | return_VOID; |
186 | } | 215 | } |
187 | 216 | ||
@@ -207,7 +236,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr) | |||
207 | acpi_gbl_owner_id_mask[index] ^= bit; | 236 | acpi_gbl_owner_id_mask[index] ^= bit; |
208 | } else { | 237 | } else { |
209 | ACPI_ERROR((AE_INFO, | 238 | ACPI_ERROR((AE_INFO, |
210 | "Release of non-allocated owner_id: %2.2X", | 239 | "Release of non-allocated OwnerId: %2.2X", |
211 | owner_id + 1)); | 240 | owner_id + 1)); |
212 | } | 241 | } |
213 | 242 | ||
@@ -273,6 +302,7 @@ void acpi_ut_print_string(char *string, u8 max_length) | |||
273 | 302 | ||
274 | acpi_os_printf("\""); | 303 | acpi_os_printf("\""); |
275 | for (i = 0; string[i] && (i < max_length); i++) { | 304 | for (i = 0; string[i] && (i < max_length); i++) { |
305 | |||
276 | /* Escape sequences */ | 306 | /* Escape sequences */ |
277 | 307 | ||
278 | switch (string[i]) { | 308 | switch (string[i]) { |
@@ -461,12 +491,47 @@ acpi_ut_display_init_pathname(u8 type, | |||
461 | } | 491 | } |
462 | acpi_os_printf("\n"); | 492 | acpi_os_printf("\n"); |
463 | 493 | ||
464 | ACPI_MEM_FREE(buffer.pointer); | 494 | ACPI_FREE(buffer.pointer); |
465 | } | 495 | } |
466 | #endif | 496 | #endif |
467 | 497 | ||
468 | /******************************************************************************* | 498 | /******************************************************************************* |
469 | * | 499 | * |
500 | * FUNCTION: acpi_ut_valid_acpi_char | ||
501 | * | ||
502 | * PARAMETERS: Char - The character to be examined | ||
503 | * | ||
504 | * RETURN: TRUE if the character is valid, FALSE otherwise | ||
505 | * | ||
506 | * DESCRIPTION: Check for a valid ACPI character. Must be one of: | ||
507 | * 1) Upper case alpha | ||
508 | * 2) numeric | ||
509 | * 3) underscore | ||
510 | * | ||
511 | * We allow a '!' as the last character because of the ASF! table | ||
512 | * | ||
513 | ******************************************************************************/ | ||
514 | |||
515 | u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position) | ||
516 | { | ||
517 | |||
518 | if (!((character >= 'A' && character <= 'Z') || | ||
519 | (character >= '0' && character <= '9') || (character == '_'))) { | ||
520 | |||
521 | /* Allow a '!' in the last position */ | ||
522 | |||
523 | if (character == '!' && position == 3) { | ||
524 | return (TRUE); | ||
525 | } | ||
526 | |||
527 | return (FALSE); | ||
528 | } | ||
529 | |||
530 | return (TRUE); | ||
531 | } | ||
532 | |||
533 | /******************************************************************************* | ||
534 | * | ||
470 | * FUNCTION: acpi_ut_valid_acpi_name | 535 | * FUNCTION: acpi_ut_valid_acpi_name |
471 | * | 536 | * |
472 | * PARAMETERS: Name - The name to be examined | 537 | * PARAMETERS: Name - The name to be examined |
@@ -482,19 +547,13 @@ acpi_ut_display_init_pathname(u8 type, | |||
482 | 547 | ||
483 | u8 acpi_ut_valid_acpi_name(u32 name) | 548 | u8 acpi_ut_valid_acpi_name(u32 name) |
484 | { | 549 | { |
485 | char *name_ptr = (char *)&name; | ||
486 | char character; | ||
487 | acpi_native_uint i; | 550 | acpi_native_uint i; |
488 | 551 | ||
489 | ACPI_FUNCTION_ENTRY(); | 552 | ACPI_FUNCTION_ENTRY(); |
490 | 553 | ||
491 | for (i = 0; i < ACPI_NAME_SIZE; i++) { | 554 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
492 | character = *name_ptr; | 555 | if (!acpi_ut_valid_acpi_char |
493 | name_ptr++; | 556 | ((ACPI_CAST_PTR(char, &name))[i], i)) { |
494 | |||
495 | if (!((character == '_') || | ||
496 | (character >= 'A' && character <= 'Z') || | ||
497 | (character >= '0' && character <= '9'))) { | ||
498 | return (FALSE); | 557 | return (FALSE); |
499 | } | 558 | } |
500 | } | 559 | } |
@@ -504,24 +563,37 @@ u8 acpi_ut_valid_acpi_name(u32 name) | |||
504 | 563 | ||
505 | /******************************************************************************* | 564 | /******************************************************************************* |
506 | * | 565 | * |
507 | * FUNCTION: acpi_ut_valid_acpi_character | 566 | * FUNCTION: acpi_ut_repair_name |
508 | * | 567 | * |
509 | * PARAMETERS: Character - The character to be examined | 568 | * PARAMETERS: Name - The ACPI name to be repaired |
510 | * | 569 | * |
511 | * RETURN: 1 if Character may appear in a name, else 0 | 570 | * RETURN: Repaired version of the name |
512 | * | 571 | * |
513 | * DESCRIPTION: Check for a printable character | 572 | * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and |
573 | * return the new name. | ||
514 | * | 574 | * |
515 | ******************************************************************************/ | 575 | ******************************************************************************/ |
516 | 576 | ||
517 | u8 acpi_ut_valid_acpi_character(char character) | 577 | acpi_name acpi_ut_repair_name(acpi_name name) |
518 | { | 578 | { |
579 | char *name_ptr = ACPI_CAST_PTR(char, &name); | ||
580 | char new_name[ACPI_NAME_SIZE]; | ||
581 | acpi_native_uint i; | ||
519 | 582 | ||
520 | ACPI_FUNCTION_ENTRY(); | 583 | for (i = 0; i < ACPI_NAME_SIZE; i++) { |
584 | new_name[i] = name_ptr[i]; | ||
521 | 585 | ||
522 | return ((u8) ((character == '_') || | 586 | /* |
523 | (character >= 'A' && character <= 'Z') || | 587 | * Replace a bad character with something printable, yet technically |
524 | (character >= '0' && character <= '9'))); | 588 | * still invalid. This prevents any collisions with existing "good" |
589 | * names in the namespace. | ||
590 | */ | ||
591 | if (!acpi_ut_valid_acpi_char(name_ptr[i], i)) { | ||
592 | new_name[i] = '*'; | ||
593 | } | ||
594 | } | ||
595 | |||
596 | return (*ACPI_CAST_PTR(u32, new_name)); | ||
525 | } | 597 | } |
526 | 598 | ||
527 | /******************************************************************************* | 599 | /******************************************************************************* |
@@ -529,7 +601,8 @@ u8 acpi_ut_valid_acpi_character(char character) | |||
529 | * FUNCTION: acpi_ut_strtoul64 | 601 | * FUNCTION: acpi_ut_strtoul64 |
530 | * | 602 | * |
531 | * PARAMETERS: String - Null terminated string | 603 | * PARAMETERS: String - Null terminated string |
532 | * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE | 604 | * Base - Radix of the string: 16 or ACPI_ANY_BASE; |
605 | * ACPI_ANY_BASE means 'in behalf of to_integer' | ||
533 | * ret_integer - Where the converted integer is returned | 606 | * ret_integer - Where the converted integer is returned |
534 | * | 607 | * |
535 | * RETURN: Status and Converted value | 608 | * RETURN: Status and Converted value |
@@ -545,16 +618,17 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
545 | u32 this_digit = 0; | 618 | u32 this_digit = 0; |
546 | acpi_integer return_value = 0; | 619 | acpi_integer return_value = 0; |
547 | acpi_integer quotient; | 620 | acpi_integer quotient; |
621 | acpi_integer dividend; | ||
622 | u32 to_integer_op = (base == ACPI_ANY_BASE); | ||
623 | u32 mode32 = (acpi_gbl_integer_byte_width == 4); | ||
624 | u8 valid_digits = 0; | ||
625 | u8 sign_of0x = 0; | ||
626 | u8 term = 0; | ||
548 | 627 | ||
549 | ACPI_FUNCTION_TRACE("ut_stroul64"); | 628 | ACPI_FUNCTION_TRACE(ut_stroul64); |
550 | |||
551 | if ((!string) || !(*string)) { | ||
552 | goto error_exit; | ||
553 | } | ||
554 | 629 | ||
555 | switch (base) { | 630 | switch (base) { |
556 | case ACPI_ANY_BASE: | 631 | case ACPI_ANY_BASE: |
557 | case 10: | ||
558 | case 16: | 632 | case 16: |
559 | break; | 633 | break; |
560 | 634 | ||
@@ -563,76 +637,110 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
563 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 637 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
564 | } | 638 | } |
565 | 639 | ||
640 | if (!string) { | ||
641 | goto error_exit; | ||
642 | } | ||
643 | |||
566 | /* Skip over any white space in the buffer */ | 644 | /* Skip over any white space in the buffer */ |
567 | 645 | ||
568 | while (ACPI_IS_SPACE(*string) || *string == '\t') { | 646 | while ((*string) && (ACPI_IS_SPACE(*string) || *string == '\t')) { |
569 | string++; | 647 | string++; |
570 | } | 648 | } |
571 | 649 | ||
572 | /* | 650 | if (to_integer_op) { |
573 | * If the input parameter Base is zero, then we need to | 651 | /* |
574 | * determine if it is decimal or hexadecimal: | 652 | * Base equal to ACPI_ANY_BASE means 'to_integer operation case'. |
575 | */ | 653 | * We need to determine if it is decimal or hexadecimal. |
576 | if (base == 0) { | 654 | */ |
577 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | 655 | if ((*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { |
656 | sign_of0x = 1; | ||
578 | base = 16; | 657 | base = 16; |
658 | |||
659 | /* Skip over the leading '0x' */ | ||
579 | string += 2; | 660 | string += 2; |
580 | } else { | 661 | } else { |
581 | base = 10; | 662 | base = 10; |
582 | } | 663 | } |
583 | } | 664 | } |
584 | 665 | ||
585 | /* | 666 | /* Any string left? Check that '0x' is not followed by white space. */ |
586 | * For hexadecimal base, skip over the leading | 667 | |
587 | * 0 or 0x, if they are present. | 668 | if (!(*string) || ACPI_IS_SPACE(*string) || *string == '\t') { |
588 | */ | 669 | if (to_integer_op) { |
589 | if ((base == 16) && | 670 | goto error_exit; |
590 | (*string == '0') && (ACPI_TOLOWER(*(string + 1)) == 'x')) { | 671 | } else { |
591 | string += 2; | 672 | goto all_done; |
673 | } | ||
592 | } | 674 | } |
593 | 675 | ||
594 | /* Any string left? */ | 676 | dividend = (mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX; |
595 | 677 | ||
596 | if (!(*string)) { | 678 | /* At least one character in the string here */ |
597 | goto error_exit; | ||
598 | } | ||
599 | 679 | ||
600 | /* Main loop: convert the string to a 64-bit integer */ | 680 | /* Main loop: convert the string to a 64-bit integer */ |
601 | 681 | ||
602 | while (*string) { | 682 | while (*string) { |
603 | if (ACPI_IS_DIGIT(*string)) { | 683 | if (ACPI_IS_DIGIT(*string)) { |
684 | |||
604 | /* Convert ASCII 0-9 to Decimal value */ | 685 | /* Convert ASCII 0-9 to Decimal value */ |
605 | 686 | ||
606 | this_digit = ((u8) * string) - '0'; | 687 | this_digit = ((u8) * string) - '0'; |
607 | } else { | 688 | } else if (base == 10) { |
608 | if (base == 10) { | ||
609 | /* Digit is out of range */ | ||
610 | 689 | ||
611 | goto error_exit; | 690 | /* Digit is out of range; possible in to_integer case only */ |
612 | } | ||
613 | 691 | ||
692 | term = 1; | ||
693 | } else { | ||
614 | this_digit = (u8) ACPI_TOUPPER(*string); | 694 | this_digit = (u8) ACPI_TOUPPER(*string); |
615 | if (ACPI_IS_XDIGIT((char)this_digit)) { | 695 | if (ACPI_IS_XDIGIT((char)this_digit)) { |
696 | |||
616 | /* Convert ASCII Hex char to value */ | 697 | /* Convert ASCII Hex char to value */ |
617 | 698 | ||
618 | this_digit = this_digit - 'A' + 10; | 699 | this_digit = this_digit - 'A' + 10; |
619 | } else { | 700 | } else { |
620 | /* | 701 | term = 1; |
621 | * We allow non-hex chars, just stop now, same as end-of-string. | 702 | } |
622 | * See ACPI spec, string-to-integer conversion. | 703 | } |
623 | */ | 704 | |
705 | if (term) { | ||
706 | if (to_integer_op) { | ||
707 | goto error_exit; | ||
708 | } else { | ||
624 | break; | 709 | break; |
625 | } | 710 | } |
711 | } else if ((valid_digits == 0) && (this_digit == 0) | ||
712 | && !sign_of0x) { | ||
713 | |||
714 | /* Skip zeros */ | ||
715 | string++; | ||
716 | continue; | ||
717 | } | ||
718 | |||
719 | valid_digits++; | ||
720 | |||
721 | if (sign_of0x | ||
722 | && ((valid_digits > 16) | ||
723 | || ((valid_digits > 8) && mode32))) { | ||
724 | /* | ||
725 | * This is to_integer operation case. | ||
726 | * No any restrictions for string-to-integer conversion, | ||
727 | * see ACPI spec. | ||
728 | */ | ||
729 | goto error_exit; | ||
626 | } | 730 | } |
627 | 731 | ||
628 | /* Divide the digit into the correct position */ | 732 | /* Divide the digit into the correct position */ |
629 | 733 | ||
630 | (void) | 734 | (void) |
631 | acpi_ut_short_divide((ACPI_INTEGER_MAX - | 735 | acpi_ut_short_divide((dividend - (acpi_integer) this_digit), |
632 | (acpi_integer) this_digit), base, | 736 | base, "ient, NULL); |
633 | "ient, NULL); | 737 | |
634 | if (return_value > quotient) { | 738 | if (return_value > quotient) { |
635 | goto error_exit; | 739 | if (to_integer_op) { |
740 | goto error_exit; | ||
741 | } else { | ||
742 | break; | ||
743 | } | ||
636 | } | 744 | } |
637 | 745 | ||
638 | return_value *= base; | 746 | return_value *= base; |
@@ -642,6 +750,8 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer) | |||
642 | 750 | ||
643 | /* All done, normal exit */ | 751 | /* All done, normal exit */ |
644 | 752 | ||
753 | all_done: | ||
754 | |||
645 | *ret_integer = return_value; | 755 | *ret_integer = return_value; |
646 | return_ACPI_STATUS(AE_OK); | 756 | return_ACPI_STATUS(AE_OK); |
647 | 757 | ||
@@ -719,7 +829,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
719 | u32 this_index; | 829 | u32 this_index; |
720 | union acpi_operand_object *this_source_obj; | 830 | union acpi_operand_object *this_source_obj; |
721 | 831 | ||
722 | ACPI_FUNCTION_TRACE("ut_walk_package_tree"); | 832 | ACPI_FUNCTION_TRACE(ut_walk_package_tree); |
723 | 833 | ||
724 | state = acpi_ut_create_pkg_state(source_object, target_object, 0); | 834 | state = acpi_ut_create_pkg_state(source_object, target_object, 0); |
725 | if (!state) { | 835 | if (!state) { |
@@ -727,6 +837,7 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
727 | } | 837 | } |
728 | 838 | ||
729 | while (state) { | 839 | while (state) { |
840 | |||
730 | /* Get one element of the package */ | 841 | /* Get one element of the package */ |
731 | 842 | ||
732 | this_index = state->pkg.index; | 843 | this_index = state->pkg.index; |
@@ -814,31 +925,6 @@ acpi_ut_walk_package_tree(union acpi_operand_object * source_object, | |||
814 | 925 | ||
815 | /******************************************************************************* | 926 | /******************************************************************************* |
816 | * | 927 | * |
817 | * FUNCTION: acpi_ut_generate_checksum | ||
818 | * | ||
819 | * PARAMETERS: Buffer - Buffer to be scanned | ||
820 | * Length - number of bytes to examine | ||
821 | * | ||
822 | * RETURN: The generated checksum | ||
823 | * | ||
824 | * DESCRIPTION: Generate a checksum on a raw buffer | ||
825 | * | ||
826 | ******************************************************************************/ | ||
827 | |||
828 | u8 acpi_ut_generate_checksum(u8 * buffer, u32 length) | ||
829 | { | ||
830 | u32 i; | ||
831 | signed char sum = 0; | ||
832 | |||
833 | for (i = 0; i < length; i++) { | ||
834 | sum = (signed char)(sum + buffer[i]); | ||
835 | } | ||
836 | |||
837 | return ((u8) (0 - sum)); | ||
838 | } | ||
839 | |||
840 | /******************************************************************************* | ||
841 | * | ||
842 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info | 928 | * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info |
843 | * | 929 | * |
844 | * PARAMETERS: module_name - Caller's module name (for error output) | 930 | * PARAMETERS: module_name - Caller's module name (for error output) |
@@ -900,36 +986,3 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) | |||
900 | acpi_os_vprintf(format, args); | 986 | acpi_os_vprintf(format, args); |
901 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 987 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
902 | } | 988 | } |
903 | |||
904 | /******************************************************************************* | ||
905 | * | ||
906 | * FUNCTION: acpi_ut_report_error, Warning, Info | ||
907 | * | ||
908 | * PARAMETERS: module_name - Caller's module name (for error output) | ||
909 | * line_number - Caller's line number (for error output) | ||
910 | * | ||
911 | * RETURN: None | ||
912 | * | ||
913 | * DESCRIPTION: Print error message | ||
914 | * | ||
915 | * Note: Legacy only, should be removed when no longer used by drivers. | ||
916 | * | ||
917 | ******************************************************************************/ | ||
918 | |||
919 | void acpi_ut_report_error(char *module_name, u32 line_number) | ||
920 | { | ||
921 | |||
922 | acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); | ||
923 | } | ||
924 | |||
925 | void acpi_ut_report_warning(char *module_name, u32 line_number) | ||
926 | { | ||
927 | |||
928 | acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); | ||
929 | } | ||
930 | |||
931 | void acpi_ut_report_info(char *module_name, u32 line_number) | ||
932 | { | ||
933 | |||
934 | acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number); | ||
935 | } | ||
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 45a7244df924..25eb34369afa 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -68,19 +68,26 @@ acpi_status acpi_ut_mutex_initialize(void) | |||
68 | u32 i; | 68 | u32 i; |
69 | acpi_status status; | 69 | acpi_status status; |
70 | 70 | ||
71 | ACPI_FUNCTION_TRACE("ut_mutex_initialize"); | 71 | ACPI_FUNCTION_TRACE(ut_mutex_initialize); |
72 | 72 | ||
73 | /* | 73 | /* |
74 | * Create each of the predefined mutex objects | 74 | * Create each of the predefined mutex objects |
75 | */ | 75 | */ |
76 | for (i = 0; i < NUM_MUTEX; i++) { | 76 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
77 | status = acpi_ut_create_mutex(i); | 77 | status = acpi_ut_create_mutex(i); |
78 | if (ACPI_FAILURE(status)) { | 78 | if (ACPI_FAILURE(status)) { |
79 | return_ACPI_STATUS(status); | 79 | return_ACPI_STATUS(status); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | /* Create the spinlocks for use at interrupt level */ | ||
84 | |||
83 | status = acpi_os_create_lock(&acpi_gbl_gpe_lock); | 85 | status = acpi_os_create_lock(&acpi_gbl_gpe_lock); |
86 | if (ACPI_FAILURE(status)) { | ||
87 | return_ACPI_STATUS(status); | ||
88 | } | ||
89 | |||
90 | status = acpi_os_create_lock(&acpi_gbl_hardware_lock); | ||
84 | return_ACPI_STATUS(status); | 91 | return_ACPI_STATUS(status); |
85 | } | 92 | } |
86 | 93 | ||
@@ -100,16 +107,19 @@ void acpi_ut_mutex_terminate(void) | |||
100 | { | 107 | { |
101 | u32 i; | 108 | u32 i; |
102 | 109 | ||
103 | ACPI_FUNCTION_TRACE("ut_mutex_terminate"); | 110 | ACPI_FUNCTION_TRACE(ut_mutex_terminate); |
104 | 111 | ||
105 | /* | 112 | /* |
106 | * Delete each predefined mutex object | 113 | * Delete each predefined mutex object |
107 | */ | 114 | */ |
108 | for (i = 0; i < NUM_MUTEX; i++) { | 115 | for (i = 0; i < ACPI_NUM_MUTEX; i++) { |
109 | (void)acpi_ut_delete_mutex(i); | 116 | (void)acpi_ut_delete_mutex(i); |
110 | } | 117 | } |
111 | 118 | ||
119 | /* Delete the spinlocks */ | ||
120 | |||
112 | acpi_os_delete_lock(acpi_gbl_gpe_lock); | 121 | acpi_os_delete_lock(acpi_gbl_gpe_lock); |
122 | acpi_os_delete_lock(acpi_gbl_hardware_lock); | ||
113 | return_VOID; | 123 | return_VOID; |
114 | } | 124 | } |
115 | 125 | ||
@@ -129,9 +139,9 @@ static acpi_status acpi_ut_create_mutex(acpi_mutex_handle mutex_id) | |||
129 | { | 139 | { |
130 | acpi_status status = AE_OK; | 140 | acpi_status status = AE_OK; |
131 | 141 | ||
132 | ACPI_FUNCTION_TRACE_U32("ut_create_mutex", mutex_id); | 142 | ACPI_FUNCTION_TRACE_U32(ut_create_mutex, mutex_id); |
133 | 143 | ||
134 | if (mutex_id > MAX_MUTEX) { | 144 | if (mutex_id > ACPI_MAX_MUTEX) { |
135 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 145 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
136 | } | 146 | } |
137 | 147 | ||
@@ -163,9 +173,9 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | |||
163 | { | 173 | { |
164 | acpi_status status; | 174 | acpi_status status; |
165 | 175 | ||
166 | ACPI_FUNCTION_TRACE_U32("ut_delete_mutex", mutex_id); | 176 | ACPI_FUNCTION_TRACE_U32(ut_delete_mutex, mutex_id); |
167 | 177 | ||
168 | if (mutex_id > MAX_MUTEX) { | 178 | if (mutex_id > ACPI_MAX_MUTEX) { |
169 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 179 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
170 | } | 180 | } |
171 | 181 | ||
@@ -192,11 +202,11 @@ static acpi_status acpi_ut_delete_mutex(acpi_mutex_handle mutex_id) | |||
192 | acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | 202 | acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) |
193 | { | 203 | { |
194 | acpi_status status; | 204 | acpi_status status; |
195 | u32 this_thread_id; | 205 | acpi_thread_id this_thread_id; |
196 | 206 | ||
197 | ACPI_FUNCTION_NAME("ut_acquire_mutex"); | 207 | ACPI_FUNCTION_NAME(ut_acquire_mutex); |
198 | 208 | ||
199 | if (mutex_id > MAX_MUTEX) { | 209 | if (mutex_id > ACPI_MAX_MUTEX) { |
200 | return (AE_BAD_PARAMETER); | 210 | return (AE_BAD_PARAMETER); |
201 | } | 211 | } |
202 | 212 | ||
@@ -213,7 +223,7 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
213 | * the mutex ordering rule. This indicates a coding error somewhere in | 223 | * the mutex ordering rule. This indicates a coding error somewhere in |
214 | * the ACPI subsystem code. | 224 | * the ACPI subsystem code. |
215 | */ | 225 | */ |
216 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 226 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { |
217 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 227 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
218 | if (i == mutex_id) { | 228 | if (i == mutex_id) { |
219 | ACPI_ERROR((AE_INFO, | 229 | ACPI_ERROR((AE_INFO, |
@@ -275,16 +285,16 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) | |||
275 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | 285 | acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) |
276 | { | 286 | { |
277 | acpi_status status; | 287 | acpi_status status; |
278 | u32 this_thread_id; | 288 | acpi_thread_id this_thread_id; |
279 | 289 | ||
280 | ACPI_FUNCTION_NAME("ut_release_mutex"); | 290 | ACPI_FUNCTION_NAME(ut_release_mutex); |
281 | 291 | ||
282 | this_thread_id = acpi_os_get_thread_id(); | 292 | this_thread_id = acpi_os_get_thread_id(); |
283 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, | 293 | ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, |
284 | "Thread %X releasing Mutex [%s]\n", this_thread_id, | 294 | "Thread %X releasing Mutex [%s]\n", this_thread_id, |
285 | acpi_ut_get_mutex_name(mutex_id))); | 295 | acpi_ut_get_mutex_name(mutex_id))); |
286 | 296 | ||
287 | if (mutex_id > MAX_MUTEX) { | 297 | if (mutex_id > ACPI_MAX_MUTEX) { |
288 | return (AE_BAD_PARAMETER); | 298 | return (AE_BAD_PARAMETER); |
289 | } | 299 | } |
290 | 300 | ||
@@ -309,7 +319,7 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id) | |||
309 | * ordering rule. This indicates a coding error somewhere in | 319 | * ordering rule. This indicates a coding error somewhere in |
310 | * the ACPI subsystem code. | 320 | * the ACPI subsystem code. |
311 | */ | 321 | */ |
312 | for (i = mutex_id; i < MAX_MUTEX; i++) { | 322 | for (i = mutex_id; i < ACPI_MAX_MUTEX; i++) { |
313 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { | 323 | if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { |
314 | if (i == mutex_id) { | 324 | if (i == mutex_id) { |
315 | continue; | 325 | continue; |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index 7ee2d1d98071..ba7d8ac702df 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -92,7 +92,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, | |||
92 | union acpi_operand_object *object; | 92 | union acpi_operand_object *object; |
93 | union acpi_operand_object *second_object; | 93 | union acpi_operand_object *second_object; |
94 | 94 | ||
95 | ACPI_FUNCTION_TRACE_STR("ut_create_internal_object_dbg", | 95 | ACPI_FUNCTION_TRACE_STR(ut_create_internal_object_dbg, |
96 | acpi_ut_get_type_name(type)); | 96 | acpi_ut_get_type_name(type)); |
97 | 97 | ||
98 | /* Allocate the raw object descriptor */ | 98 | /* Allocate the raw object descriptor */ |
@@ -161,7 +161,7 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) | |||
161 | union acpi_operand_object *buffer_desc; | 161 | union acpi_operand_object *buffer_desc; |
162 | u8 *buffer = NULL; | 162 | u8 *buffer = NULL; |
163 | 163 | ||
164 | ACPI_FUNCTION_TRACE_U32("ut_create_buffer_object", buffer_size); | 164 | ACPI_FUNCTION_TRACE_U32(ut_create_buffer_object, buffer_size); |
165 | 165 | ||
166 | /* Create a new Buffer object */ | 166 | /* Create a new Buffer object */ |
167 | 167 | ||
@@ -173,9 +173,10 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) | |||
173 | /* Create an actual buffer only if size > 0 */ | 173 | /* Create an actual buffer only if size > 0 */ |
174 | 174 | ||
175 | if (buffer_size > 0) { | 175 | if (buffer_size > 0) { |
176 | |||
176 | /* Allocate the actual buffer */ | 177 | /* Allocate the actual buffer */ |
177 | 178 | ||
178 | buffer = ACPI_MEM_CALLOCATE(buffer_size); | 179 | buffer = ACPI_ALLOCATE_ZEROED(buffer_size); |
179 | if (!buffer) { | 180 | if (!buffer) { |
180 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", | 181 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", |
181 | (u32) buffer_size)); | 182 | (u32) buffer_size)); |
@@ -214,7 +215,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
214 | union acpi_operand_object *string_desc; | 215 | union acpi_operand_object *string_desc; |
215 | char *string; | 216 | char *string; |
216 | 217 | ||
217 | ACPI_FUNCTION_TRACE_U32("ut_create_string_object", string_size); | 218 | ACPI_FUNCTION_TRACE_U32(ut_create_string_object, string_size); |
218 | 219 | ||
219 | /* Create a new String object */ | 220 | /* Create a new String object */ |
220 | 221 | ||
@@ -227,7 +228,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
227 | * Allocate the actual string buffer -- (Size + 1) for NULL terminator. | 228 | * Allocate the actual string buffer -- (Size + 1) for NULL terminator. |
228 | * NOTE: Zero-length strings are NULL terminated | 229 | * NOTE: Zero-length strings are NULL terminated |
229 | */ | 230 | */ |
230 | string = ACPI_MEM_CALLOCATE(string_size + 1); | 231 | string = ACPI_ALLOCATE_ZEROED(string_size + 1); |
231 | if (!string) { | 232 | if (!string) { |
232 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", | 233 | ACPI_ERROR((AE_INFO, "Could not allocate size %X", |
233 | (u32) string_size)); | 234 | (u32) string_size)); |
@@ -260,7 +261,7 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) | |||
260 | u8 acpi_ut_valid_internal_object(void *object) | 261 | u8 acpi_ut_valid_internal_object(void *object) |
261 | { | 262 | { |
262 | 263 | ||
263 | ACPI_FUNCTION_NAME("ut_valid_internal_object"); | 264 | ACPI_FUNCTION_NAME(ut_valid_internal_object); |
264 | 265 | ||
265 | /* Check for a null pointer */ | 266 | /* Check for a null pointer */ |
266 | 267 | ||
@@ -308,7 +309,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
308 | { | 309 | { |
309 | union acpi_operand_object *object; | 310 | union acpi_operand_object *object; |
310 | 311 | ||
311 | ACPI_FUNCTION_TRACE("ut_allocate_object_desc_dbg"); | 312 | ACPI_FUNCTION_TRACE(ut_allocate_object_desc_dbg); |
312 | 313 | ||
313 | object = acpi_os_acquire_object(acpi_gbl_operand_cache); | 314 | object = acpi_os_acquire_object(acpi_gbl_operand_cache); |
314 | if (!object) { | 315 | if (!object) { |
@@ -319,6 +320,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
319 | } | 320 | } |
320 | 321 | ||
321 | /* Mark the descriptor type */ | 322 | /* Mark the descriptor type */ |
323 | |||
322 | memset(object, 0, sizeof(union acpi_operand_object)); | 324 | memset(object, 0, sizeof(union acpi_operand_object)); |
323 | ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); | 325 | ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); |
324 | 326 | ||
@@ -342,7 +344,7 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name, | |||
342 | 344 | ||
343 | void acpi_ut_delete_object_desc(union acpi_operand_object *object) | 345 | void acpi_ut_delete_object_desc(union acpi_operand_object *object) |
344 | { | 346 | { |
345 | ACPI_FUNCTION_TRACE_PTR("ut_delete_object_desc", object); | 347 | ACPI_FUNCTION_TRACE_PTR(ut_delete_object_desc, object); |
346 | 348 | ||
347 | /* Object must be an union acpi_operand_object */ | 349 | /* Object must be an union acpi_operand_object */ |
348 | 350 | ||
@@ -381,7 +383,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
381 | acpi_size length; | 383 | acpi_size length; |
382 | acpi_status status = AE_OK; | 384 | acpi_status status = AE_OK; |
383 | 385 | ||
384 | ACPI_FUNCTION_TRACE_PTR("ut_get_simple_object_size", internal_object); | 386 | ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); |
385 | 387 | ||
386 | /* | 388 | /* |
387 | * Handle a null object (Could be a uninitialized package | 389 | * Handle a null object (Could be a uninitialized package |
@@ -397,6 +399,7 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
397 | length = sizeof(union acpi_object); | 399 | length = sizeof(union acpi_object); |
398 | 400 | ||
399 | if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { | 401 | if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { |
402 | |||
400 | /* Object is a named object (reference), just return the length */ | 403 | /* Object is a named object (reference), just return the length */ |
401 | 404 | ||
402 | *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); | 405 | *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); |
@@ -559,7 +562,7 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, | |||
559 | acpi_status status; | 562 | acpi_status status; |
560 | struct acpi_pkg_info info; | 563 | struct acpi_pkg_info info; |
561 | 564 | ||
562 | ACPI_FUNCTION_TRACE_PTR("ut_get_package_object_size", internal_object); | 565 | ACPI_FUNCTION_TRACE_PTR(ut_get_package_object_size, internal_object); |
563 | 566 | ||
564 | info.length = 0; | 567 | info.length = 0; |
565 | info.object_space = 0; | 568 | info.object_space = 0; |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index 16461317113f..5a2de92831d3 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -45,113 +45,113 @@ | |||
45 | #include <acpi/amlresrc.h> | 45 | #include <acpi/amlresrc.h> |
46 | 46 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 47 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utmisc") | 48 | ACPI_MODULE_NAME("utresrc") |
49 | 49 | ||
50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 50 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) |
51 | /* | 51 | /* |
52 | * Strings used to decode resource descriptors. | 52 | * Strings used to decode resource descriptors. |
53 | * Used by both the disasssembler and the debugger resource dump routines | 53 | * Used by both the disasssembler and the debugger resource dump routines |
54 | */ | 54 | */ |
55 | const char *acpi_gbl_BMdecode[2] = { | 55 | const char *acpi_gbl_bm_decode[] = { |
56 | "not_bus_master", | 56 | "NotBusMaster", |
57 | "bus_master" | 57 | "BusMaster" |
58 | }; | 58 | }; |
59 | 59 | ||
60 | const char *acpi_gbl_config_decode[4] = { | 60 | const char *acpi_gbl_config_decode[] = { |
61 | "0 - Good Configuration", | 61 | "0 - Good Configuration", |
62 | "1 - Acceptable Configuration", | 62 | "1 - Acceptable Configuration", |
63 | "2 - Suboptimal Configuration", | 63 | "2 - Suboptimal Configuration", |
64 | "3 - ***Invalid Configuration***", | 64 | "3 - ***Invalid Configuration***", |
65 | }; | 65 | }; |
66 | 66 | ||
67 | const char *acpi_gbl_consume_decode[2] = { | 67 | const char *acpi_gbl_consume_decode[] = { |
68 | "resource_producer", | 68 | "ResourceProducer", |
69 | "resource_consumer" | 69 | "ResourceConsumer" |
70 | }; | 70 | }; |
71 | 71 | ||
72 | const char *acpi_gbl_DECdecode[2] = { | 72 | const char *acpi_gbl_dec_decode[] = { |
73 | "pos_decode", | 73 | "PosDecode", |
74 | "sub_decode" | 74 | "SubDecode" |
75 | }; | 75 | }; |
76 | 76 | ||
77 | const char *acpi_gbl_HEdecode[2] = { | 77 | const char *acpi_gbl_he_decode[] = { |
78 | "Level", | 78 | "Level", |
79 | "Edge" | 79 | "Edge" |
80 | }; | 80 | }; |
81 | 81 | ||
82 | const char *acpi_gbl_io_decode[2] = { | 82 | const char *acpi_gbl_io_decode[] = { |
83 | "Decode10", | 83 | "Decode10", |
84 | "Decode16" | 84 | "Decode16" |
85 | }; | 85 | }; |
86 | 86 | ||
87 | const char *acpi_gbl_LLdecode[2] = { | 87 | const char *acpi_gbl_ll_decode[] = { |
88 | "active_high", | 88 | "ActiveHigh", |
89 | "active_low" | 89 | "ActiveLow" |
90 | }; | 90 | }; |
91 | 91 | ||
92 | const char *acpi_gbl_max_decode[2] = { | 92 | const char *acpi_gbl_max_decode[] = { |
93 | "max_not_fixed", | 93 | "MaxNotFixed", |
94 | "max_fixed" | 94 | "MaxFixed" |
95 | }; | 95 | }; |
96 | 96 | ||
97 | const char *acpi_gbl_MEMdecode[4] = { | 97 | const char *acpi_gbl_mem_decode[] = { |
98 | "non_cacheable", | 98 | "NonCacheable", |
99 | "Cacheable", | 99 | "Cacheable", |
100 | "write_combining", | 100 | "WriteCombining", |
101 | "Prefetchable" | 101 | "Prefetchable" |
102 | }; | 102 | }; |
103 | 103 | ||
104 | const char *acpi_gbl_min_decode[2] = { | 104 | const char *acpi_gbl_min_decode[] = { |
105 | "min_not_fixed", | 105 | "MinNotFixed", |
106 | "min_fixed" | 106 | "MinFixed" |
107 | }; | 107 | }; |
108 | 108 | ||
109 | const char *acpi_gbl_MTPdecode[4] = { | 109 | const char *acpi_gbl_mtp_decode[] = { |
110 | "address_range_memory", | 110 | "AddressRangeMemory", |
111 | "address_range_reserved", | 111 | "AddressRangeReserved", |
112 | "address_range_aCPI", | 112 | "AddressRangeACPI", |
113 | "address_range_nVS" | 113 | "AddressRangeNVS" |
114 | }; | 114 | }; |
115 | 115 | ||
116 | const char *acpi_gbl_RNGdecode[4] = { | 116 | const char *acpi_gbl_rng_decode[] = { |
117 | "invalid_ranges", | 117 | "InvalidRanges", |
118 | "non_iSAonly_ranges", | 118 | "NonISAOnlyRanges", |
119 | "ISAonly_ranges", | 119 | "ISAOnlyRanges", |
120 | "entire_range" | 120 | "EntireRange" |
121 | }; | 121 | }; |
122 | 122 | ||
123 | const char *acpi_gbl_RWdecode[2] = { | 123 | const char *acpi_gbl_rw_decode[] = { |
124 | "read_only", | 124 | "ReadOnly", |
125 | "read_write" | 125 | "ReadWrite" |
126 | }; | 126 | }; |
127 | 127 | ||
128 | const char *acpi_gbl_SHRdecode[2] = { | 128 | const char *acpi_gbl_shr_decode[] = { |
129 | "Exclusive", | 129 | "Exclusive", |
130 | "Shared" | 130 | "Shared" |
131 | }; | 131 | }; |
132 | 132 | ||
133 | const char *acpi_gbl_SIZdecode[4] = { | 133 | const char *acpi_gbl_siz_decode[] = { |
134 | "Transfer8", | 134 | "Transfer8", |
135 | "Transfer8_16", | 135 | "Transfer8_16", |
136 | "Transfer16", | 136 | "Transfer16", |
137 | "invalid_size" | 137 | "InvalidSize" |
138 | }; | 138 | }; |
139 | 139 | ||
140 | const char *acpi_gbl_TRSdecode[2] = { | 140 | const char *acpi_gbl_trs_decode[] = { |
141 | "dense_translation", | 141 | "DenseTranslation", |
142 | "sparse_translation" | 142 | "SparseTranslation" |
143 | }; | 143 | }; |
144 | 144 | ||
145 | const char *acpi_gbl_TTPdecode[2] = { | 145 | const char *acpi_gbl_ttp_decode[] = { |
146 | "type_static", | 146 | "TypeStatic", |
147 | "type_translation" | 147 | "TypeTranslation" |
148 | }; | 148 | }; |
149 | 149 | ||
150 | const char *acpi_gbl_TYPdecode[4] = { | 150 | const char *acpi_gbl_typ_decode[] = { |
151 | "Compatibility", | 151 | "Compatibility", |
152 | "type_a", | 152 | "TypeA", |
153 | "type_b", | 153 | "TypeB", |
154 | "type_f" | 154 | "TypeF" |
155 | }; | 155 | }; |
156 | 156 | ||
157 | #endif | 157 | #endif |
@@ -240,6 +240,104 @@ static const u8 acpi_gbl_resource_types[] = { | |||
240 | 240 | ||
241 | /******************************************************************************* | 241 | /******************************************************************************* |
242 | * | 242 | * |
243 | * FUNCTION: acpi_ut_walk_aml_resources | ||
244 | * | ||
245 | * PARAMETERS: Aml - Pointer to the raw AML resource template | ||
246 | * aml_length - Length of the entire template | ||
247 | * user_function - Called once for each descriptor found. If | ||
248 | * NULL, a pointer to the end_tag is returned | ||
249 | * Context - Passed to user_function | ||
250 | * | ||
251 | * RETURN: Status | ||
252 | * | ||
253 | * DESCRIPTION: Walk a raw AML resource list(buffer). User function called | ||
254 | * once for each resource found. | ||
255 | * | ||
256 | ******************************************************************************/ | ||
257 | |||
258 | acpi_status | ||
259 | acpi_ut_walk_aml_resources(u8 * aml, | ||
260 | acpi_size aml_length, | ||
261 | acpi_walk_aml_callback user_function, void **context) | ||
262 | { | ||
263 | acpi_status status; | ||
264 | u8 *end_aml; | ||
265 | u8 resource_index; | ||
266 | u32 length; | ||
267 | u32 offset = 0; | ||
268 | |||
269 | ACPI_FUNCTION_TRACE(ut_walk_aml_resources); | ||
270 | |||
271 | /* The absolute minimum resource template is one end_tag descriptor */ | ||
272 | |||
273 | if (aml_length < sizeof(struct aml_resource_end_tag)) { | ||
274 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
275 | } | ||
276 | |||
277 | /* Point to the end of the resource template buffer */ | ||
278 | |||
279 | end_aml = aml + aml_length; | ||
280 | |||
281 | /* Walk the byte list, abort on any invalid descriptor type or length */ | ||
282 | |||
283 | while (aml < end_aml) { | ||
284 | |||
285 | /* Validate the Resource Type and Resource Length */ | ||
286 | |||
287 | status = acpi_ut_validate_resource(aml, &resource_index); | ||
288 | if (ACPI_FAILURE(status)) { | ||
289 | return_ACPI_STATUS(status); | ||
290 | } | ||
291 | |||
292 | /* Get the length of this descriptor */ | ||
293 | |||
294 | length = acpi_ut_get_descriptor_length(aml); | ||
295 | |||
296 | /* Invoke the user function */ | ||
297 | |||
298 | if (user_function) { | ||
299 | status = | ||
300 | user_function(aml, length, offset, resource_index, | ||
301 | context); | ||
302 | if (ACPI_FAILURE(status)) { | ||
303 | return (status); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | /* An end_tag descriptor terminates this resource template */ | ||
308 | |||
309 | if (acpi_ut_get_resource_type(aml) == | ||
310 | ACPI_RESOURCE_NAME_END_TAG) { | ||
311 | /* | ||
312 | * There must be at least one more byte in the buffer for | ||
313 | * the 2nd byte of the end_tag | ||
314 | */ | ||
315 | if ((aml + 1) >= end_aml) { | ||
316 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
317 | } | ||
318 | |||
319 | /* Return the pointer to the end_tag if requested */ | ||
320 | |||
321 | if (!user_function) { | ||
322 | *context = aml; | ||
323 | } | ||
324 | |||
325 | /* Normal exit */ | ||
326 | |||
327 | return_ACPI_STATUS(AE_OK); | ||
328 | } | ||
329 | |||
330 | aml += length; | ||
331 | offset += length; | ||
332 | } | ||
333 | |||
334 | /* Did not find an end_tag descriptor */ | ||
335 | |||
336 | return (AE_AML_NO_RESOURCE_END_TAG); | ||
337 | } | ||
338 | |||
339 | /******************************************************************************* | ||
340 | * | ||
243 | * FUNCTION: acpi_ut_validate_resource | 341 | * FUNCTION: acpi_ut_validate_resource |
244 | * | 342 | * |
245 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor | 343 | * PARAMETERS: Aml - Pointer to the raw AML resource descriptor |
@@ -273,6 +371,7 @@ acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index) | |||
273 | * Examine the large/small bit in the resource header | 371 | * Examine the large/small bit in the resource header |
274 | */ | 372 | */ |
275 | if (resource_type & ACPI_RESOURCE_NAME_LARGE) { | 373 | if (resource_type & ACPI_RESOURCE_NAME_LARGE) { |
374 | |||
276 | /* Verify the large resource type (name) against the max */ | 375 | /* Verify the large resource type (name) against the max */ |
277 | 376 | ||
278 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { | 377 | if (resource_type > ACPI_RESOURCE_NAME_LARGE_MAX) { |
@@ -376,6 +475,7 @@ u8 acpi_ut_get_resource_type(void *aml) | |||
376 | * Examine the large/small bit in the resource header | 475 | * Examine the large/small bit in the resource header |
377 | */ | 476 | */ |
378 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | 477 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { |
478 | |||
379 | /* Large Resource Type -- bits 6:0 contain the name */ | 479 | /* Large Resource Type -- bits 6:0 contain the name */ |
380 | 480 | ||
381 | return (ACPI_GET8(aml)); | 481 | return (ACPI_GET8(aml)); |
@@ -411,6 +511,7 @@ u16 acpi_ut_get_resource_length(void *aml) | |||
411 | * Examine the large/small bit in the resource header | 511 | * Examine the large/small bit in the resource header |
412 | */ | 512 | */ |
413 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { | 513 | if (ACPI_GET8(aml) & ACPI_RESOURCE_NAME_LARGE) { |
514 | |||
414 | /* Large Resource type -- bytes 1-2 contain the 16-bit length */ | 515 | /* Large Resource type -- bytes 1-2 contain the 16-bit length */ |
415 | 516 | ||
416 | ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); | 517 | ACPI_MOVE_16_TO_16(&resource_length, ACPI_ADD_PTR(u8, aml, 1)); |
@@ -495,60 +596,21 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc, | |||
495 | u8 ** end_tag) | 596 | u8 ** end_tag) |
496 | { | 597 | { |
497 | acpi_status status; | 598 | acpi_status status; |
498 | u8 *aml; | ||
499 | u8 *end_aml; | ||
500 | |||
501 | ACPI_FUNCTION_TRACE("ut_get_resource_end_tag"); | ||
502 | 599 | ||
503 | /* Get start and end pointers */ | 600 | ACPI_FUNCTION_TRACE(ut_get_resource_end_tag); |
504 | |||
505 | aml = obj_desc->buffer.pointer; | ||
506 | end_aml = aml + obj_desc->buffer.length; | ||
507 | 601 | ||
508 | /* Allow a buffer length of zero */ | 602 | /* Allow a buffer length of zero */ |
509 | 603 | ||
510 | if (!obj_desc->buffer.length) { | 604 | if (!obj_desc->buffer.length) { |
511 | *end_tag = aml; | 605 | *end_tag = obj_desc->buffer.pointer; |
512 | return_ACPI_STATUS(AE_OK); | 606 | return_ACPI_STATUS(AE_OK); |
513 | } | 607 | } |
514 | 608 | ||
515 | /* Walk the resource template, one descriptor per iteration */ | 609 | /* Validate the template and get a pointer to the end_tag */ |
516 | |||
517 | while (aml < end_aml) { | ||
518 | /* Validate the Resource Type and Resource Length */ | ||
519 | |||
520 | status = acpi_ut_validate_resource(aml, NULL); | ||
521 | if (ACPI_FAILURE(status)) { | ||
522 | return_ACPI_STATUS(status); | ||
523 | } | ||
524 | |||
525 | /* end_tag resource indicates the end of the resource template */ | ||
526 | |||
527 | if (acpi_ut_get_resource_type(aml) == | ||
528 | ACPI_RESOURCE_NAME_END_TAG) { | ||
529 | /* | ||
530 | * There must be at least one more byte in the buffer for | ||
531 | * the 2nd byte of the end_tag | ||
532 | */ | ||
533 | if ((aml + 1) >= end_aml) { | ||
534 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | ||
535 | } | ||
536 | |||
537 | /* Return the pointer to the end_tag */ | ||
538 | |||
539 | *end_tag = aml; | ||
540 | return_ACPI_STATUS(AE_OK); | ||
541 | } | ||
542 | |||
543 | /* | ||
544 | * Point to the next resource descriptor in the AML buffer. The | ||
545 | * descriptor length is guaranteed to be non-zero by resource | ||
546 | * validation above. | ||
547 | */ | ||
548 | aml += acpi_ut_get_descriptor_length(aml); | ||
549 | } | ||
550 | 610 | ||
551 | /* Did not find an end_tag resource descriptor */ | 611 | status = acpi_ut_walk_aml_resources(obj_desc->buffer.pointer, |
612 | obj_desc->buffer.length, NULL, | ||
613 | (void **)end_tag); | ||
552 | 614 | ||
553 | return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG); | 615 | return_ACPI_STATUS(status); |
554 | } | 616 | } |
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 4b134a722907..0f5c5bb5deff 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -96,7 +96,7 @@ void | |||
96 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, | 96 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, |
97 | union acpi_generic_state *state) | 97 | union acpi_generic_state *state) |
98 | { | 98 | { |
99 | ACPI_FUNCTION_TRACE("ut_push_generic_state"); | 99 | ACPI_FUNCTION_TRACE(ut_push_generic_state); |
100 | 100 | ||
101 | /* Push the state object onto the front of the list (stack) */ | 101 | /* Push the state object onto the front of the list (stack) */ |
102 | 102 | ||
@@ -123,12 +123,13 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state | |||
123 | { | 123 | { |
124 | union acpi_generic_state *state; | 124 | union acpi_generic_state *state; |
125 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ut_pop_generic_state"); | 126 | ACPI_FUNCTION_TRACE(ut_pop_generic_state); |
127 | 127 | ||
128 | /* Remove the state object at the head of the list (stack) */ | 128 | /* Remove the state object at the head of the list (stack) */ |
129 | 129 | ||
130 | state = *list_head; | 130 | state = *list_head; |
131 | if (state) { | 131 | if (state) { |
132 | |||
132 | /* Update the list head */ | 133 | /* Update the list head */ |
133 | 134 | ||
134 | *list_head = state->common.next; | 135 | *list_head = state->common.next; |
@@ -158,9 +159,10 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) | |||
158 | 159 | ||
159 | state = acpi_os_acquire_object(acpi_gbl_state_cache); | 160 | state = acpi_os_acquire_object(acpi_gbl_state_cache); |
160 | if (state) { | 161 | if (state) { |
162 | |||
161 | /* Initialize */ | 163 | /* Initialize */ |
162 | memset(state, 0, sizeof(union acpi_generic_state)); | 164 | memset(state, 0, sizeof(union acpi_generic_state)); |
163 | state->common.data_type = ACPI_DESC_TYPE_STATE; | 165 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE; |
164 | } | 166 | } |
165 | 167 | ||
166 | return (state); | 168 | return (state); |
@@ -183,7 +185,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
183 | { | 185 | { |
184 | union acpi_generic_state *state; | 186 | union acpi_generic_state *state; |
185 | 187 | ||
186 | ACPI_FUNCTION_TRACE("ut_create_thread_state"); | 188 | ACPI_FUNCTION_TRACE(ut_create_thread_state); |
187 | 189 | ||
188 | /* Create the generic state object */ | 190 | /* Create the generic state object */ |
189 | 191 | ||
@@ -194,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void) | |||
194 | 196 | ||
195 | /* Init fields specific to the update struct */ | 197 | /* Init fields specific to the update struct */ |
196 | 198 | ||
197 | state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; | 199 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD; |
198 | state->thread.thread_id = acpi_os_get_thread_id(); | 200 | state->thread.thread_id = acpi_os_get_thread_id(); |
199 | 201 | ||
200 | return_PTR((struct acpi_thread_state *)state); | 202 | return_PTR((struct acpi_thread_state *)state); |
@@ -220,7 +222,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
220 | { | 222 | { |
221 | union acpi_generic_state *state; | 223 | union acpi_generic_state *state; |
222 | 224 | ||
223 | ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); | 225 | ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object); |
224 | 226 | ||
225 | /* Create the generic state object */ | 227 | /* Create the generic state object */ |
226 | 228 | ||
@@ -231,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object | |||
231 | 233 | ||
232 | /* Init fields specific to the update struct */ | 234 | /* Init fields specific to the update struct */ |
233 | 235 | ||
234 | state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; | 236 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE; |
235 | state->update.object = object; | 237 | state->update.object = object; |
236 | state->update.value = action; | 238 | state->update.value = action; |
237 | 239 | ||
@@ -257,7 +259,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
257 | { | 259 | { |
258 | union acpi_generic_state *state; | 260 | union acpi_generic_state *state; |
259 | 261 | ||
260 | ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); | 262 | ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object); |
261 | 263 | ||
262 | /* Create the generic state object */ | 264 | /* Create the generic state object */ |
263 | 265 | ||
@@ -268,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, | |||
268 | 270 | ||
269 | /* Init fields specific to the update struct */ | 271 | /* Init fields specific to the update struct */ |
270 | 272 | ||
271 | state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; | 273 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE; |
272 | state->pkg.source_object = (union acpi_operand_object *)internal_object; | 274 | state->pkg.source_object = (union acpi_operand_object *)internal_object; |
273 | state->pkg.dest_object = external_object; | 275 | state->pkg.dest_object = external_object; |
274 | state->pkg.index = index; | 276 | state->pkg.index = index; |
@@ -294,7 +296,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
294 | { | 296 | { |
295 | union acpi_generic_state *state; | 297 | union acpi_generic_state *state; |
296 | 298 | ||
297 | ACPI_FUNCTION_TRACE("ut_create_control_state"); | 299 | ACPI_FUNCTION_TRACE(ut_create_control_state); |
298 | 300 | ||
299 | /* Create the generic state object */ | 301 | /* Create the generic state object */ |
300 | 302 | ||
@@ -305,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
305 | 307 | ||
306 | /* Init fields specific to the control struct */ | 308 | /* Init fields specific to the control struct */ |
307 | 309 | ||
308 | state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; | 310 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; |
309 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; | 311 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
310 | 312 | ||
311 | return_PTR(state); | 313 | return_PTR(state); |
@@ -319,15 +321,19 @@ union acpi_generic_state *acpi_ut_create_control_state(void) | |||
319 | * | 321 | * |
320 | * RETURN: None | 322 | * RETURN: None |
321 | * | 323 | * |
322 | * DESCRIPTION: Put a state object back into the global state cache. The object | 324 | * DESCRIPTION: Release a state object to the state cache. NULL state objects |
323 | * is not actually freed at this time. | 325 | * are ignored. |
324 | * | 326 | * |
325 | ******************************************************************************/ | 327 | ******************************************************************************/ |
326 | 328 | ||
327 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) | 329 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) |
328 | { | 330 | { |
329 | ACPI_FUNCTION_TRACE("ut_delete_generic_state"); | 331 | ACPI_FUNCTION_TRACE(ut_delete_generic_state); |
332 | |||
333 | /* Ignore null state */ | ||
330 | 334 | ||
331 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | 335 | if (state) { |
336 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | ||
337 | } | ||
332 | return_VOID; | 338 | return_VOID; |
333 | } | 339 | } |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 308a960871be..3538f69c82a1 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -41,8 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <linux/module.h> | ||
45 | |||
46 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
47 | #include <acpi/acevents.h> | 45 | #include <acpi/acevents.h> |
48 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
@@ -67,7 +65,7 @@ acpi_status acpi_initialize_subsystem(void) | |||
67 | { | 65 | { |
68 | acpi_status status; | 66 | acpi_status status; |
69 | 67 | ||
70 | ACPI_FUNCTION_TRACE("acpi_initialize_subsystem"); | 68 | ACPI_FUNCTION_TRACE(acpi_initialize_subsystem); |
71 | 69 | ||
72 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); | 70 | ACPI_DEBUG_EXEC(acpi_ut_init_stack_ptr_trace()); |
73 | 71 | ||
@@ -109,6 +107,8 @@ acpi_status acpi_initialize_subsystem(void) | |||
109 | return_ACPI_STATUS(status); | 107 | return_ACPI_STATUS(status); |
110 | } | 108 | } |
111 | 109 | ||
110 | ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) | ||
111 | |||
112 | /******************************************************************************* | 112 | /******************************************************************************* |
113 | * | 113 | * |
114 | * FUNCTION: acpi_enable_subsystem | 114 | * FUNCTION: acpi_enable_subsystem |
@@ -121,12 +121,11 @@ acpi_status acpi_initialize_subsystem(void) | |||
121 | * Puts system into ACPI mode if it isn't already. | 121 | * Puts system into ACPI mode if it isn't already. |
122 | * | 122 | * |
123 | ******************************************************************************/ | 123 | ******************************************************************************/ |
124 | |||
125 | acpi_status acpi_enable_subsystem(u32 flags) | 124 | acpi_status acpi_enable_subsystem(u32 flags) |
126 | { | 125 | { |
127 | acpi_status status = AE_OK; | 126 | acpi_status status = AE_OK; |
128 | 127 | ||
129 | ACPI_FUNCTION_TRACE("acpi_enable_subsystem"); | 128 | ACPI_FUNCTION_TRACE(acpi_enable_subsystem); |
130 | 129 | ||
131 | /* | 130 | /* |
132 | * We must initialize the hardware before we can enable ACPI. | 131 | * We must initialize the hardware before we can enable ACPI. |
@@ -152,7 +151,7 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
152 | 151 | ||
153 | status = acpi_enable(); | 152 | status = acpi_enable(); |
154 | if (ACPI_FAILURE(status)) { | 153 | if (ACPI_FAILURE(status)) { |
155 | ACPI_WARNING((AE_INFO, "acpi_enable failed")); | 154 | ACPI_WARNING((AE_INFO, "AcpiEnable failed")); |
156 | return_ACPI_STATUS(status); | 155 | return_ACPI_STATUS(status); |
157 | } | 156 | } |
158 | } | 157 | } |
@@ -229,6 +228,8 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
229 | return_ACPI_STATUS(status); | 228 | return_ACPI_STATUS(status); |
230 | } | 229 | } |
231 | 230 | ||
231 | ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) | ||
232 | |||
232 | /******************************************************************************* | 233 | /******************************************************************************* |
233 | * | 234 | * |
234 | * FUNCTION: acpi_initialize_objects | 235 | * FUNCTION: acpi_initialize_objects |
@@ -241,12 +242,11 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
241 | * objects and executing AML code for Regions, buffers, etc. | 242 | * objects and executing AML code for Regions, buffers, etc. |
242 | * | 243 | * |
243 | ******************************************************************************/ | 244 | ******************************************************************************/ |
244 | |||
245 | acpi_status acpi_initialize_objects(u32 flags) | 245 | acpi_status acpi_initialize_objects(u32 flags) |
246 | { | 246 | { |
247 | acpi_status status = AE_OK; | 247 | acpi_status status = AE_OK; |
248 | 248 | ||
249 | ACPI_FUNCTION_TRACE("acpi_initialize_objects"); | 249 | ACPI_FUNCTION_TRACE(acpi_initialize_objects); |
250 | 250 | ||
251 | /* | 251 | /* |
252 | * Run all _REG methods | 252 | * Run all _REG methods |
@@ -257,7 +257,7 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
257 | */ | 257 | */ |
258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { | 258 | if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { |
259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 259 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
260 | "[Init] Executing _REG op_region methods\n")); | 260 | "[Init] Executing _REG OpRegion methods\n")); |
261 | 261 | ||
262 | status = acpi_ev_initialize_op_regions(); | 262 | status = acpi_ev_initialize_op_regions(); |
263 | if (ACPI_FAILURE(status)) { | 263 | if (ACPI_FAILURE(status)) { |
@@ -305,6 +305,8 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
305 | return_ACPI_STATUS(status); | 305 | return_ACPI_STATUS(status); |
306 | } | 306 | } |
307 | 307 | ||
308 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | ||
309 | |||
308 | /******************************************************************************* | 310 | /******************************************************************************* |
309 | * | 311 | * |
310 | * FUNCTION: acpi_terminate | 312 | * FUNCTION: acpi_terminate |
@@ -316,12 +318,11 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
316 | * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. | 318 | * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. |
317 | * | 319 | * |
318 | ******************************************************************************/ | 320 | ******************************************************************************/ |
319 | |||
320 | acpi_status acpi_terminate(void) | 321 | acpi_status acpi_terminate(void) |
321 | { | 322 | { |
322 | acpi_status status; | 323 | acpi_status status; |
323 | 324 | ||
324 | ACPI_FUNCTION_TRACE("acpi_terminate"); | 325 | ACPI_FUNCTION_TRACE(acpi_terminate); |
325 | 326 | ||
326 | /* Terminate the AML Debugger if present */ | 327 | /* Terminate the AML Debugger if present */ |
327 | 328 | ||
@@ -348,6 +349,8 @@ acpi_status acpi_terminate(void) | |||
348 | return_ACPI_STATUS(status); | 349 | return_ACPI_STATUS(status); |
349 | } | 350 | } |
350 | 351 | ||
352 | ACPI_EXPORT_SYMBOL(acpi_terminate) | ||
353 | |||
351 | #ifdef ACPI_FUTURE_USAGE | 354 | #ifdef ACPI_FUTURE_USAGE |
352 | /******************************************************************************* | 355 | /******************************************************************************* |
353 | * | 356 | * |
@@ -362,7 +365,6 @@ acpi_status acpi_terminate(void) | |||
362 | * initialized successfully. | 365 | * initialized successfully. |
363 | * | 366 | * |
364 | ******************************************************************************/ | 367 | ******************************************************************************/ |
365 | |||
366 | acpi_status acpi_subsystem_status(void) | 368 | acpi_status acpi_subsystem_status(void) |
367 | { | 369 | { |
368 | 370 | ||
@@ -373,6 +375,8 @@ acpi_status acpi_subsystem_status(void) | |||
373 | } | 375 | } |
374 | } | 376 | } |
375 | 377 | ||
378 | ACPI_EXPORT_SYMBOL(acpi_subsystem_status) | ||
379 | |||
376 | /******************************************************************************* | 380 | /******************************************************************************* |
377 | * | 381 | * |
378 | * FUNCTION: acpi_get_system_info | 382 | * FUNCTION: acpi_get_system_info |
@@ -390,14 +394,13 @@ acpi_status acpi_subsystem_status(void) | |||
390 | * and the value of out_buffer is undefined. | 394 | * and the value of out_buffer is undefined. |
391 | * | 395 | * |
392 | ******************************************************************************/ | 396 | ******************************************************************************/ |
393 | |||
394 | acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) | 397 | acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) |
395 | { | 398 | { |
396 | struct acpi_system_info *info_ptr; | 399 | struct acpi_system_info *info_ptr; |
397 | acpi_status status; | 400 | acpi_status status; |
398 | u32 i; | 401 | u32 i; |
399 | 402 | ||
400 | ACPI_FUNCTION_TRACE("acpi_get_system_info"); | 403 | ACPI_FUNCTION_TRACE(acpi_get_system_info); |
401 | 404 | ||
402 | /* Parameter validation */ | 405 | /* Parameter validation */ |
403 | 406 | ||
@@ -448,15 +451,15 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) | |||
448 | 451 | ||
449 | /* Current status of the ACPI tables, per table type */ | 452 | /* Current status of the ACPI tables, per table type */ |
450 | 453 | ||
451 | info_ptr->num_table_types = NUM_ACPI_TABLE_TYPES; | 454 | info_ptr->num_table_types = ACPI_TABLE_ID_MAX + 1; |
452 | for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++) { | 455 | for (i = 0; i < (ACPI_TABLE_ID_MAX + 1); i++) { |
453 | info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; | 456 | info_ptr->table_info[i].count = acpi_gbl_table_lists[i].count; |
454 | } | 457 | } |
455 | 458 | ||
456 | return_ACPI_STATUS(AE_OK); | 459 | return_ACPI_STATUS(AE_OK); |
457 | } | 460 | } |
458 | 461 | ||
459 | EXPORT_SYMBOL(acpi_get_system_info); | 462 | ACPI_EXPORT_SYMBOL(acpi_get_system_info) |
460 | 463 | ||
461 | /***************************************************************************** | 464 | /***************************************************************************** |
462 | * | 465 | * |
@@ -472,7 +475,6 @@ EXPORT_SYMBOL(acpi_get_system_info); | |||
472 | * TBD: When a second function is added, must save the Function also. | 475 | * TBD: When a second function is added, must save the Function also. |
473 | * | 476 | * |
474 | ****************************************************************************/ | 477 | ****************************************************************************/ |
475 | |||
476 | acpi_status | 478 | acpi_status |
477 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | 479 | acpi_install_initialization_handler(acpi_init_handler handler, u32 function) |
478 | { | 480 | { |
@@ -489,6 +491,7 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
489 | return AE_OK; | 491 | return AE_OK; |
490 | } | 492 | } |
491 | 493 | ||
494 | ACPI_EXPORT_SYMBOL(acpi_install_initialization_handler) | ||
492 | #endif /* ACPI_FUTURE_USAGE */ | 495 | #endif /* ACPI_FUTURE_USAGE */ |
493 | 496 | ||
494 | /***************************************************************************** | 497 | /***************************************************************************** |
@@ -502,10 +505,9 @@ acpi_install_initialization_handler(acpi_init_handler handler, u32 function) | |||
502 | * DESCRIPTION: Empty all caches (delete the cached objects) | 505 | * DESCRIPTION: Empty all caches (delete the cached objects) |
503 | * | 506 | * |
504 | ****************************************************************************/ | 507 | ****************************************************************************/ |
505 | |||
506 | acpi_status acpi_purge_cached_objects(void) | 508 | acpi_status acpi_purge_cached_objects(void) |
507 | { | 509 | { |
508 | ACPI_FUNCTION_TRACE("acpi_purge_cached_objects"); | 510 | ACPI_FUNCTION_TRACE(acpi_purge_cached_objects); |
509 | 511 | ||
510 | (void)acpi_os_purge_cache(acpi_gbl_state_cache); | 512 | (void)acpi_os_purge_cache(acpi_gbl_state_cache); |
511 | (void)acpi_os_purge_cache(acpi_gbl_operand_cache); | 513 | (void)acpi_os_purge_cache(acpi_gbl_operand_cache); |
@@ -513,3 +515,5 @@ acpi_status acpi_purge_cached_objects(void) | |||
513 | (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); | 515 | (void)acpi_os_purge_cache(acpi_gbl_ps_node_ext_cache); |
514 | return_ACPI_STATUS(AE_OK); | 516 | return_ACPI_STATUS(AE_OK); |
515 | } | 517 | } |
518 | |||
519 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) | ||
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 6458c47f7ac2..6b516852ac12 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -273,11 +273,13 @@ acpi_evaluate_integer(acpi_handle handle, | |||
273 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); | 273 | status = acpi_evaluate_object(handle, pathname, arguments, &buffer); |
274 | if (ACPI_FAILURE(status)) { | 274 | if (ACPI_FAILURE(status)) { |
275 | acpi_util_eval_error(handle, pathname, status); | 275 | acpi_util_eval_error(handle, pathname, status); |
276 | kfree(element); | ||
276 | return_ACPI_STATUS(status); | 277 | return_ACPI_STATUS(status); |
277 | } | 278 | } |
278 | 279 | ||
279 | if (element->type != ACPI_TYPE_INTEGER) { | 280 | if (element->type != ACPI_TYPE_INTEGER) { |
280 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); | 281 | acpi_util_eval_error(handle, pathname, AE_BAD_DATA); |
282 | kfree(element); | ||
281 | return_ACPI_STATUS(AE_BAD_DATA); | 283 | return_ACPI_STATUS(AE_BAD_DATA); |
282 | } | 284 | } |
283 | 285 | ||
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bd4887518373..86531ab4ee55 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -323,7 +323,7 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device, | |||
323 | if (!ACPI_SUCCESS(status)) | 323 | if (!ACPI_SUCCESS(status)) |
324 | return_VALUE(status); | 324 | return_VALUE(status); |
325 | obj = (union acpi_object *)buffer.pointer; | 325 | obj = (union acpi_object *)buffer.pointer; |
326 | if (!obj && (obj->type != ACPI_TYPE_PACKAGE)) { | 326 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { |
327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); | 327 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _BCL data\n")); |
328 | status = -EFAULT; | 328 | status = -EFAULT; |
329 | goto err; | 329 | goto err; |
@@ -1294,7 +1294,7 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1294 | struct acpi_video_bus *video) | 1294 | struct acpi_video_bus *video) |
1295 | { | 1295 | { |
1296 | unsigned long device_id; | 1296 | unsigned long device_id; |
1297 | int status, result; | 1297 | int status; |
1298 | struct acpi_video_device *data; | 1298 | struct acpi_video_device *data; |
1299 | 1299 | ||
1300 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); | 1300 | ACPI_FUNCTION_TRACE("acpi_video_bus_get_one_device"); |
@@ -1346,8 +1346,11 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1346 | if (ACPI_FAILURE(status)) { | 1346 | if (ACPI_FAILURE(status)) { |
1347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1347 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1348 | "Error installing notify handler\n")); | 1348 | "Error installing notify handler\n")); |
1349 | result = -ENODEV; | 1349 | if(data->brightness) |
1350 | goto end; | 1350 | kfree(data->brightness->levels); |
1351 | kfree(data->brightness); | ||
1352 | kfree(data); | ||
1353 | return -ENODEV; | ||
1351 | } | 1354 | } |
1352 | 1355 | ||
1353 | down(&video->sem); | 1356 | down(&video->sem); |
@@ -1359,7 +1362,6 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1359 | return_VALUE(0); | 1362 | return_VALUE(0); |
1360 | } | 1363 | } |
1361 | 1364 | ||
1362 | end: | ||
1363 | return_VALUE(-ENOENT); | 1365 | return_VALUE(-ENOENT); |
1364 | } | 1366 | } |
1365 | 1367 | ||
@@ -1643,8 +1645,9 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | |||
1643 | printk(KERN_WARNING PREFIX | 1645 | printk(KERN_WARNING PREFIX |
1644 | "hhuuhhuu bug in acpi video driver.\n"); | 1646 | "hhuuhhuu bug in acpi video driver.\n"); |
1645 | 1647 | ||
1648 | if (data->brightness); | ||
1649 | kfree(data->brightness->levels); | ||
1646 | kfree(data->brightness); | 1650 | kfree(data->brightness); |
1647 | |||
1648 | kfree(data); | 1651 | kfree(data); |
1649 | } | 1652 | } |
1650 | 1653 | ||
@@ -1785,6 +1788,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1785 | if (ACPI_FAILURE(status)) { | 1788 | if (ACPI_FAILURE(status)) { |
1786 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1789 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1787 | "Error installing notify handler\n")); | 1790 | "Error installing notify handler\n")); |
1791 | acpi_video_bus_stop_devices(video); | ||
1792 | acpi_video_bus_put_devices(video); | ||
1793 | kfree(video->attached_array); | ||
1794 | acpi_video_bus_remove_fs(device); | ||
1788 | result = -ENODEV; | 1795 | result = -ENODEV; |
1789 | goto end; | 1796 | goto end; |
1790 | } | 1797 | } |
@@ -1796,10 +1803,8 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1796 | video->flags.post ? "yes" : "no"); | 1803 | video->flags.post ? "yes" : "no"); |
1797 | 1804 | ||
1798 | end: | 1805 | end: |
1799 | if (result) { | 1806 | if (result) |
1800 | acpi_video_bus_remove_fs(device); | ||
1801 | kfree(video); | 1807 | kfree(video); |
1802 | } | ||
1803 | 1808 | ||
1804 | return_VALUE(result); | 1809 | return_VALUE(result); |
1805 | } | 1810 | } |
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 8c4c6ef748ec..907fb66ec4a9 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -497,7 +497,7 @@ zx1_gart_probe (acpi_handle obj, u32 depth, void *context, void **ret) | |||
497 | info = buffer.pointer; | 497 | info = buffer.pointer; |
498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; | 498 | info->hardware_id.value[sizeof(info->hardware_id)-1] = '\0'; |
499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); | 499 | match = (strcmp(info->hardware_id.value, "HWP0001") == 0); |
500 | ACPI_MEM_FREE(info); | 500 | kfree(info); |
501 | if (match) { | 501 | if (match) { |
502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); | 502 | status = hp_acpi_csr_space(handle, &sba_hpa, &length); |
503 | if (ACPI_SUCCESS(status)) | 503 | if (ACPI_SUCCESS(status)) |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index ef140ebde117..07473cd84121 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -925,11 +925,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) | |||
925 | status = acpi_resource_to_address64(res, &addr); | 925 | status = acpi_resource_to_address64(res, &addr); |
926 | 926 | ||
927 | if (ACPI_SUCCESS(status)) { | 927 | if (ACPI_SUCCESS(status)) { |
928 | unsigned long size; | ||
929 | |||
930 | size = addr.maximum - addr.minimum + 1; | ||
931 | hdp->hd_phys_address = addr.minimum; | 928 | hdp->hd_phys_address = addr.minimum; |
932 | hdp->hd_address = ioremap(addr.minimum, size); | 929 | hdp->hd_address = ioremap(addr.minimum, addr.address_length); |
933 | 930 | ||
934 | if (hpet_is_known(hdp)) { | 931 | if (hpet_is_known(hdp)) { |
935 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", | 932 | printk(KERN_DEBUG "%s: 0x%lx is busy\n", |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index a90f5d97df35..43dfd8689dce 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -512,7 +512,7 @@ static struct sonypi_device { | |||
512 | 512 | ||
513 | #ifdef CONFIG_ACPI | 513 | #ifdef CONFIG_ACPI |
514 | static struct acpi_device *sonypi_acpi_device; | 514 | static struct acpi_device *sonypi_acpi_device; |
515 | static int acpi_enabled; | 515 | static int acpi_driver_registered; |
516 | #endif | 516 | #endif |
517 | 517 | ||
518 | static int sonypi_ec_write(u8 addr, u8 value) | 518 | static int sonypi_ec_write(u8 addr, u8 value) |
@@ -869,7 +869,7 @@ found: | |||
869 | sonypi_report_input_event(event); | 869 | sonypi_report_input_event(event); |
870 | 870 | ||
871 | #ifdef CONFIG_ACPI | 871 | #ifdef CONFIG_ACPI |
872 | if (acpi_enabled) | 872 | if (sonypi_acpi_device) |
873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); | 873 | acpi_bus_generate_event(sonypi_acpi_device, 1, event); |
874 | #endif | 874 | #endif |
875 | 875 | ||
@@ -1551,8 +1551,8 @@ static int __init sonypi_init(void) | |||
1551 | goto err_free_device; | 1551 | goto err_free_device; |
1552 | 1552 | ||
1553 | #ifdef CONFIG_ACPI | 1553 | #ifdef CONFIG_ACPI |
1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) > 0) | 1554 | if (acpi_bus_register_driver(&sonypi_acpi_driver) >= 0) |
1555 | acpi_enabled = 1; | 1555 | acpi_driver_registered = 1; |
1556 | #endif | 1556 | #endif |
1557 | 1557 | ||
1558 | return 0; | 1558 | return 0; |
@@ -1567,7 +1567,7 @@ static int __init sonypi_init(void) | |||
1567 | static void __exit sonypi_exit(void) | 1567 | static void __exit sonypi_exit(void) |
1568 | { | 1568 | { |
1569 | #ifdef CONFIG_ACPI | 1569 | #ifdef CONFIG_ACPI |
1570 | if (acpi_enabled) | 1570 | if (acpi_driver_registered) |
1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); | 1571 | acpi_bus_unregister_driver(&sonypi_acpi_driver); |
1572 | #endif | 1572 | #endif |
1573 | platform_device_unregister(sonypi_platform_device); | 1573 | platform_device_unregister(sonypi_platform_device); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 407b4eaddcbf..3a4a644c2686 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -36,13 +36,13 @@ static int irq_flags(int triggering, int polarity) | |||
36 | { | 36 | { |
37 | int flag; | 37 | int flag; |
38 | if (triggering == ACPI_LEVEL_SENSITIVE) { | 38 | if (triggering == ACPI_LEVEL_SENSITIVE) { |
39 | if(polarity == ACPI_ACTIVE_LOW) | 39 | if (polarity == ACPI_ACTIVE_LOW) |
40 | flag = IORESOURCE_IRQ_LOWLEVEL; | 40 | flag = IORESOURCE_IRQ_LOWLEVEL; |
41 | else | 41 | else |
42 | flag = IORESOURCE_IRQ_HIGHLEVEL; | 42 | flag = IORESOURCE_IRQ_HIGHLEVEL; |
43 | } | 43 | } |
44 | else { | 44 | else { |
45 | if(polarity == ACPI_ACTIVE_LOW) | 45 | if (polarity == ACPI_ACTIVE_LOW) |
46 | flag = IORESOURCE_IRQ_LOWEDGE; | 46 | flag = IORESOURCE_IRQ_LOWEDGE; |
47 | else | 47 | else |
48 | flag = IORESOURCE_IRQ_HIGHEDGE; | 48 | flag = IORESOURCE_IRQ_HIGHEDGE; |
@@ -57,7 +57,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
57 | *triggering = ACPI_LEVEL_SENSITIVE; | 57 | *triggering = ACPI_LEVEL_SENSITIVE; |
58 | *polarity = ACPI_ACTIVE_LOW; | 58 | *polarity = ACPI_ACTIVE_LOW; |
59 | break; | 59 | break; |
60 | case IORESOURCE_IRQ_HIGHLEVEL: | 60 | case IORESOURCE_IRQ_HIGHLEVEL: |
61 | *triggering = ACPI_LEVEL_SENSITIVE; | 61 | *triggering = ACPI_LEVEL_SENSITIVE; |
62 | *polarity = ACPI_ACTIVE_HIGH; | 62 | *polarity = ACPI_ACTIVE_HIGH; |
63 | break; | 63 | break; |
@@ -73,7 +73,7 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity) | |||
73 | } | 73 | } |
74 | 74 | ||
75 | static void | 75 | static void |
76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | 76 | pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi, |
77 | int triggering, int polarity) | 77 | int triggering, int polarity) |
78 | { | 78 | { |
79 | int i = 0; | 79 | int i = 0; |
@@ -101,7 +101,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table * res, u32 gsi, | |||
101 | } | 101 | } |
102 | 102 | ||
103 | static void | 103 | static void |
104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | 104 | pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma) |
105 | { | 105 | { |
106 | int i = 0; | 106 | int i = 0; |
107 | while (i < PNP_MAX_DMA && | 107 | while (i < PNP_MAX_DMA && |
@@ -119,8 +119,8 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table * res, u32 dma) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | static void | 121 | static void |
122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | 122 | pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, |
123 | u32 io, u32 len) | 123 | u64 io, u64 len) |
124 | { | 124 | { |
125 | int i = 0; | 125 | int i = 0; |
126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && | 126 | while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && |
@@ -138,7 +138,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table * res, | |||
138 | } | 138 | } |
139 | 139 | ||
140 | static void | 140 | static void |
141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | 141 | pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, |
142 | u64 mem, u64 len) | 142 | u64 mem, u64 len) |
143 | { | 143 | { |
144 | int i = 0; | 144 | int i = 0; |
@@ -156,11 +156,32 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table * res, | |||
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | static void | ||
160 | pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table, | ||
161 | struct acpi_resource *res) | ||
162 | { | ||
163 | struct acpi_resource_address64 addr, *p = &addr; | ||
164 | acpi_status status; | ||
165 | |||
166 | status = acpi_resource_to_address64(res, p); | ||
167 | if (!ACPI_SUCCESS(status)) { | ||
168 | pnp_warn("PnPACPI: failed to convert resource type %d", | ||
169 | res->type); | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | if (p->resource_type == ACPI_MEMORY_RANGE) | ||
174 | pnpacpi_parse_allocated_memresource(res_table, | ||
175 | p->minimum, p->address_length); | ||
176 | else if (p->resource_type == ACPI_IO_RANGE) | ||
177 | pnpacpi_parse_allocated_ioresource(res_table, | ||
178 | p->minimum, p->address_length); | ||
179 | } | ||
159 | 180 | ||
160 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 181 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |
161 | void *data) | 182 | void *data) |
162 | { | 183 | { |
163 | struct pnp_resource_table * res_table = (struct pnp_resource_table *)data; | 184 | struct pnp_resource_table *res_table = (struct pnp_resource_table *)data; |
164 | int i; | 185 | int i; |
165 | 186 | ||
166 | switch (res->type) { | 187 | switch (res->type) { |
@@ -221,19 +242,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
221 | res->data.fixed_memory32.address_length); | 242 | res->data.fixed_memory32.address_length); |
222 | break; | 243 | break; |
223 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 244 | case ACPI_RESOURCE_TYPE_ADDRESS16: |
224 | pnpacpi_parse_allocated_memresource(res_table, | ||
225 | res->data.address16.minimum, | ||
226 | res->data.address16.address_length); | ||
227 | break; | ||
228 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 245 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
229 | pnpacpi_parse_allocated_memresource(res_table, | ||
230 | res->data.address32.minimum, | ||
231 | res->data.address32.address_length); | ||
232 | break; | ||
233 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 246 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
234 | pnpacpi_parse_allocated_memresource(res_table, | 247 | pnpacpi_parse_allocated_address_space(res_table, res); |
235 | res->data.address64.minimum, | ||
236 | res->data.address64.address_length); | ||
237 | break; | 248 | break; |
238 | 249 | ||
239 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: | 250 | case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: |
@@ -255,11 +266,11 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | |||
255 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 266 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
256 | return AE_ERROR; | 267 | return AE_ERROR; |
257 | } | 268 | } |
258 | 269 | ||
259 | return AE_OK; | 270 | return AE_OK; |
260 | } | 271 | } |
261 | 272 | ||
262 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table * res) | 273 | acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res) |
263 | { | 274 | { |
264 | /* Blank the resource table values */ | 275 | /* Blank the resource table values */ |
265 | pnp_init_resource_table(res); | 276 | pnp_init_resource_table(res); |
@@ -317,17 +328,17 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso | |||
317 | pnp_err("Invalid DMA transfer type"); | 328 | pnp_err("Invalid DMA transfer type"); |
318 | } | 329 | } |
319 | 330 | ||
320 | pnp_register_dma_resource(option,dma); | 331 | pnp_register_dma_resource(option, dma); |
321 | return; | 332 | return; |
322 | } | 333 | } |
323 | 334 | ||
324 | 335 | ||
325 | static void pnpacpi_parse_irq_option(struct pnp_option *option, | 336 | static void pnpacpi_parse_irq_option(struct pnp_option *option, |
326 | struct acpi_resource_irq *p) | 337 | struct acpi_resource_irq *p) |
327 | { | 338 | { |
328 | int i; | 339 | int i; |
329 | struct pnp_irq * irq; | 340 | struct pnp_irq *irq; |
330 | 341 | ||
331 | if (p->interrupt_count == 0) | 342 | if (p->interrupt_count == 0) |
332 | return; | 343 | return; |
333 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); | 344 | irq = kcalloc(1, sizeof(struct pnp_irq), GFP_KERNEL); |
@@ -347,7 +358,7 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option, | |||
347 | struct acpi_resource_extended_irq *p) | 358 | struct acpi_resource_extended_irq *p) |
348 | { | 359 | { |
349 | int i; | 360 | int i; |
350 | struct pnp_irq * irq; | 361 | struct pnp_irq *irq; |
351 | 362 | ||
352 | if (p->interrupt_count == 0) | 363 | if (p->interrupt_count == 0) |
353 | return; | 364 | return; |
@@ -368,7 +379,7 @@ static void | |||
368 | pnpacpi_parse_port_option(struct pnp_option *option, | 379 | pnpacpi_parse_port_option(struct pnp_option *option, |
369 | struct acpi_resource_io *io) | 380 | struct acpi_resource_io *io) |
370 | { | 381 | { |
371 | struct pnp_port * port; | 382 | struct pnp_port *port; |
372 | 383 | ||
373 | if (io->address_length == 0) | 384 | if (io->address_length == 0) |
374 | return; | 385 | return; |
@@ -381,7 +392,7 @@ pnpacpi_parse_port_option(struct pnp_option *option, | |||
381 | port->size = io->address_length; | 392 | port->size = io->address_length; |
382 | port->flags = ACPI_DECODE_16 == io->io_decode ? | 393 | port->flags = ACPI_DECODE_16 == io->io_decode ? |
383 | PNP_PORT_FLAG_16BITADDR : 0; | 394 | PNP_PORT_FLAG_16BITADDR : 0; |
384 | pnp_register_port_resource(option,port); | 395 | pnp_register_port_resource(option, port); |
385 | return; | 396 | return; |
386 | } | 397 | } |
387 | 398 | ||
@@ -389,7 +400,7 @@ static void | |||
389 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, | 400 | pnpacpi_parse_fixed_port_option(struct pnp_option *option, |
390 | struct acpi_resource_fixed_io *io) | 401 | struct acpi_resource_fixed_io *io) |
391 | { | 402 | { |
392 | struct pnp_port * port; | 403 | struct pnp_port *port; |
393 | 404 | ||
394 | if (io->address_length == 0) | 405 | if (io->address_length == 0) |
395 | return; | 406 | return; |
@@ -400,7 +411,7 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option, | |||
400 | port->size = io->address_length; | 411 | port->size = io->address_length; |
401 | port->align = 0; | 412 | port->align = 0; |
402 | port->flags = PNP_PORT_FLAG_FIXED; | 413 | port->flags = PNP_PORT_FLAG_FIXED; |
403 | pnp_register_port_resource(option,port); | 414 | pnp_register_port_resource(option, port); |
404 | return; | 415 | return; |
405 | } | 416 | } |
406 | 417 | ||
@@ -408,7 +419,7 @@ static void | |||
408 | pnpacpi_parse_mem24_option(struct pnp_option *option, | 419 | pnpacpi_parse_mem24_option(struct pnp_option *option, |
409 | struct acpi_resource_memory24 *p) | 420 | struct acpi_resource_memory24 *p) |
410 | { | 421 | { |
411 | struct pnp_mem * mem; | 422 | struct pnp_mem *mem; |
412 | 423 | ||
413 | if (p->address_length == 0) | 424 | if (p->address_length == 0) |
414 | return; | 425 | return; |
@@ -423,7 +434,7 @@ pnpacpi_parse_mem24_option(struct pnp_option *option, | |||
423 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 434 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
424 | IORESOURCE_MEM_WRITEABLE : 0; | 435 | IORESOURCE_MEM_WRITEABLE : 0; |
425 | 436 | ||
426 | pnp_register_mem_resource(option,mem); | 437 | pnp_register_mem_resource(option, mem); |
427 | return; | 438 | return; |
428 | } | 439 | } |
429 | 440 | ||
@@ -431,7 +442,7 @@ static void | |||
431 | pnpacpi_parse_mem32_option(struct pnp_option *option, | 442 | pnpacpi_parse_mem32_option(struct pnp_option *option, |
432 | struct acpi_resource_memory32 *p) | 443 | struct acpi_resource_memory32 *p) |
433 | { | 444 | { |
434 | struct pnp_mem * mem; | 445 | struct pnp_mem *mem; |
435 | 446 | ||
436 | if (p->address_length == 0) | 447 | if (p->address_length == 0) |
437 | return; | 448 | return; |
@@ -446,7 +457,7 @@ pnpacpi_parse_mem32_option(struct pnp_option *option, | |||
446 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 457 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
447 | IORESOURCE_MEM_WRITEABLE : 0; | 458 | IORESOURCE_MEM_WRITEABLE : 0; |
448 | 459 | ||
449 | pnp_register_mem_resource(option,mem); | 460 | pnp_register_mem_resource(option, mem); |
450 | return; | 461 | return; |
451 | } | 462 | } |
452 | 463 | ||
@@ -454,7 +465,7 @@ static void | |||
454 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | 465 | pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, |
455 | struct acpi_resource_fixed_memory32 *p) | 466 | struct acpi_resource_fixed_memory32 *p) |
456 | { | 467 | { |
457 | struct pnp_mem * mem; | 468 | struct pnp_mem *mem; |
458 | 469 | ||
459 | if (p->address_length == 0) | 470 | if (p->address_length == 0) |
460 | return; | 471 | return; |
@@ -468,7 +479,7 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option, | |||
468 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? | 479 | mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ? |
469 | IORESOURCE_MEM_WRITEABLE : 0; | 480 | IORESOURCE_MEM_WRITEABLE : 0; |
470 | 481 | ||
471 | pnp_register_mem_resource(option,mem); | 482 | pnp_register_mem_resource(option, mem); |
472 | return; | 483 | return; |
473 | } | 484 | } |
474 | 485 | ||
@@ -477,8 +488,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
477 | { | 488 | { |
478 | struct acpi_resource_address64 addr, *p = &addr; | 489 | struct acpi_resource_address64 addr, *p = &addr; |
479 | acpi_status status; | 490 | acpi_status status; |
480 | struct pnp_mem * mem; | 491 | struct pnp_mem *mem; |
481 | struct pnp_port * port; | 492 | struct pnp_port *port; |
482 | 493 | ||
483 | status = acpi_resource_to_address64(r, p); | 494 | status = acpi_resource_to_address64(r, p); |
484 | if (!ACPI_SUCCESS(status)) { | 495 | if (!ACPI_SUCCESS(status)) { |
@@ -498,7 +509,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
498 | mem->align = 0; | 509 | mem->align = 0; |
499 | mem->flags = (p->info.mem.write_protect == | 510 | mem->flags = (p->info.mem.write_protect == |
500 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; | 511 | ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0; |
501 | pnp_register_mem_resource(option,mem); | 512 | pnp_register_mem_resource(option, mem); |
502 | } else if (p->resource_type == ACPI_IO_RANGE) { | 513 | } else if (p->resource_type == ACPI_IO_RANGE) { |
503 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); | 514 | port = kcalloc(1, sizeof(struct pnp_port), GFP_KERNEL); |
504 | if (!port) | 515 | if (!port) |
@@ -507,7 +518,7 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r) | |||
507 | port->size = p->address_length; | 518 | port->size = p->address_length; |
508 | port->align = 0; | 519 | port->align = 0; |
509 | port->flags = PNP_PORT_FLAG_FIXED; | 520 | port->flags = PNP_PORT_FLAG_FIXED; |
510 | pnp_register_port_resource(option,port); | 521 | pnp_register_port_resource(option, port); |
511 | } | 522 | } |
512 | } | 523 | } |
513 | 524 | ||
@@ -531,7 +542,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
531 | break; | 542 | break; |
532 | 543 | ||
533 | case ACPI_RESOURCE_TYPE_DMA: | 544 | case ACPI_RESOURCE_TYPE_DMA: |
534 | pnpacpi_parse_dma_option(option, &res->data.dma); | 545 | pnpacpi_parse_dma_option(option, &res->data.dma); |
535 | break; | 546 | break; |
536 | 547 | ||
537 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | 548 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: |
@@ -539,7 +550,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
539 | case ACPI_GOOD_CONFIGURATION: | 550 | case ACPI_GOOD_CONFIGURATION: |
540 | priority = PNP_RES_PRIORITY_PREFERRED; | 551 | priority = PNP_RES_PRIORITY_PREFERRED; |
541 | break; | 552 | break; |
542 | 553 | ||
543 | case ACPI_ACCEPTABLE_CONFIGURATION: | 554 | case ACPI_ACCEPTABLE_CONFIGURATION: |
544 | priority = PNP_RES_PRIORITY_ACCEPTABLE; | 555 | priority = PNP_RES_PRIORITY_ACCEPTABLE; |
545 | break; | 556 | break; |
@@ -555,7 +566,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
555 | option = pnp_register_dependent_option(dev, priority); | 566 | option = pnp_register_dependent_option(dev, priority); |
556 | if (!option) | 567 | if (!option) |
557 | return AE_ERROR; | 568 | return AE_ERROR; |
558 | parse_data->option = option; | 569 | parse_data->option = option; |
559 | break; | 570 | break; |
560 | 571 | ||
561 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | 572 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: |
@@ -615,7 +626,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res, | |||
615 | pnp_warn("PnPACPI: unknown resource type %d", res->type); | 626 | pnp_warn("PnPACPI: unknown resource type %d", res->type); |
616 | return AE_ERROR; | 627 | return AE_ERROR; |
617 | } | 628 | } |
618 | 629 | ||
619 | return AE_OK; | 630 | return AE_OK; |
620 | } | 631 | } |
621 | 632 | ||
@@ -636,13 +647,8 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle, | |||
636 | return status; | 647 | return status; |
637 | } | 648 | } |
638 | 649 | ||
639 | /* | 650 | static int pnpacpi_supported_resource(struct acpi_resource *res) |
640 | * Set resource | ||
641 | */ | ||
642 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
643 | void *data) | ||
644 | { | 651 | { |
645 | int *res_cnt = (int *)data; | ||
646 | switch (res->type) { | 652 | switch (res->type) { |
647 | case ACPI_RESOURCE_TYPE_IRQ: | 653 | case ACPI_RESOURCE_TYPE_IRQ: |
648 | case ACPI_RESOURCE_TYPE_DMA: | 654 | case ACPI_RESOURCE_TYPE_DMA: |
@@ -655,43 +661,32 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | |||
655 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 661 | case ACPI_RESOURCE_TYPE_ADDRESS32: |
656 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 662 | case ACPI_RESOURCE_TYPE_ADDRESS64: |
657 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 663 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
658 | (*res_cnt) ++; | 664 | return 1; |
659 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
660 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
661 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
662 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
663 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
664 | default: | ||
665 | return AE_OK; | ||
666 | } | 665 | } |
667 | return AE_OK; | 666 | return 0; |
668 | } | 667 | } |
669 | 668 | ||
670 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, | 669 | /* |
670 | * Set resource | ||
671 | */ | ||
672 | static acpi_status pnpacpi_count_resources(struct acpi_resource *res, | ||
671 | void *data) | 673 | void *data) |
672 | { | 674 | { |
673 | struct acpi_resource **resource = (struct acpi_resource **)data; | 675 | int *res_cnt = (int *)data; |
674 | switch (res->type) { | 676 | |
675 | case ACPI_RESOURCE_TYPE_IRQ: | 677 | if (pnpacpi_supported_resource(res)) |
676 | case ACPI_RESOURCE_TYPE_DMA: | 678 | (*res_cnt)++; |
677 | case ACPI_RESOURCE_TYPE_IO: | 679 | return AE_OK; |
678 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 680 | } |
679 | case ACPI_RESOURCE_TYPE_MEMORY24: | 681 | |
680 | case ACPI_RESOURCE_TYPE_MEMORY32: | 682 | static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) |
681 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 683 | { |
682 | case ACPI_RESOURCE_TYPE_ADDRESS16: | 684 | struct acpi_resource **resource = (struct acpi_resource **)data; |
683 | case ACPI_RESOURCE_TYPE_ADDRESS32: | 685 | |
684 | case ACPI_RESOURCE_TYPE_ADDRESS64: | 686 | if (pnpacpi_supported_resource(res)) { |
685 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | ||
686 | (*resource)->type = res->type; | 687 | (*resource)->type = res->type; |
688 | (*resource)->length = sizeof(struct acpi_resource); | ||
687 | (*resource)++; | 689 | (*resource)++; |
688 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
689 | case ACPI_RESOURCE_TYPE_END_DEPENDENT: | ||
690 | case ACPI_RESOURCE_TYPE_VENDOR: | ||
691 | case ACPI_RESOURCE_TYPE_END_TAG: | ||
692 | case ACPI_RESOURCE_TYPE_GENERIC_REGISTER: | ||
693 | default: | ||
694 | return AE_OK; | ||
695 | } | 690 | } |
696 | 691 | ||
697 | return AE_OK; | 692 | return AE_OK; |
@@ -735,11 +730,8 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource, | |||
735 | struct resource *p) | 730 | struct resource *p) |
736 | { | 731 | { |
737 | int triggering, polarity; | 732 | int triggering, polarity; |
738 | 733 | ||
739 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 734 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
740 | &polarity); | ||
741 | resource->type = ACPI_RESOURCE_TYPE_IRQ; | ||
742 | resource->length = sizeof(struct acpi_resource); | ||
743 | resource->data.irq.triggering = triggering; | 735 | resource->data.irq.triggering = triggering; |
744 | resource->data.irq.polarity = polarity; | 736 | resource->data.irq.polarity = polarity; |
745 | if (triggering == ACPI_EDGE_SENSITIVE) | 737 | if (triggering == ACPI_EDGE_SENSITIVE) |
@@ -754,11 +746,8 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
754 | struct resource *p) | 746 | struct resource *p) |
755 | { | 747 | { |
756 | int triggering, polarity; | 748 | int triggering, polarity; |
757 | 749 | ||
758 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, | 750 | decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); |
759 | &polarity); | ||
760 | resource->type = ACPI_RESOURCE_TYPE_EXTENDED_IRQ; | ||
761 | resource->length = sizeof(struct acpi_resource); | ||
762 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; | 751 | resource->data.extended_irq.producer_consumer = ACPI_CONSUMER; |
763 | resource->data.extended_irq.triggering = triggering; | 752 | resource->data.extended_irq.triggering = triggering; |
764 | resource->data.extended_irq.polarity = polarity; | 753 | resource->data.extended_irq.polarity = polarity; |
@@ -773,8 +762,6 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource, | |||
773 | static void pnpacpi_encode_dma(struct acpi_resource *resource, | 762 | static void pnpacpi_encode_dma(struct acpi_resource *resource, |
774 | struct resource *p) | 763 | struct resource *p) |
775 | { | 764 | { |
776 | resource->type = ACPI_RESOURCE_TYPE_DMA; | ||
777 | resource->length = sizeof(struct acpi_resource); | ||
778 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ | 765 | /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */ |
779 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) | 766 | if (p->flags & IORESOURCE_DMA_COMPATIBLE) |
780 | resource->data.dma.type = ACPI_COMPATIBILITY; | 767 | resource->data.dma.type = ACPI_COMPATIBILITY; |
@@ -798,8 +785,6 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource, | |||
798 | static void pnpacpi_encode_io(struct acpi_resource *resource, | 785 | static void pnpacpi_encode_io(struct acpi_resource *resource, |
799 | struct resource *p) | 786 | struct resource *p) |
800 | { | 787 | { |
801 | resource->type = ACPI_RESOURCE_TYPE_IO; | ||
802 | resource->length = sizeof(struct acpi_resource); | ||
803 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ | 788 | /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */ |
804 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? | 789 | resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)? |
805 | ACPI_DECODE_16 : ACPI_DECODE_10; | 790 | ACPI_DECODE_16 : ACPI_DECODE_10; |
@@ -812,8 +797,6 @@ static void pnpacpi_encode_io(struct acpi_resource *resource, | |||
812 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | 797 | static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, |
813 | struct resource *p) | 798 | struct resource *p) |
814 | { | 799 | { |
815 | resource->type = ACPI_RESOURCE_TYPE_FIXED_IO; | ||
816 | resource->length = sizeof(struct acpi_resource); | ||
817 | resource->data.fixed_io.address = p->start; | 800 | resource->data.fixed_io.address = p->start; |
818 | resource->data.fixed_io.address_length = p->end - p->start + 1; | 801 | resource->data.fixed_io.address_length = p->end - p->start + 1; |
819 | } | 802 | } |
@@ -821,8 +804,6 @@ static void pnpacpi_encode_fixed_io(struct acpi_resource *resource, | |||
821 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, | 804 | static void pnpacpi_encode_mem24(struct acpi_resource *resource, |
822 | struct resource *p) | 805 | struct resource *p) |
823 | { | 806 | { |
824 | resource->type = ACPI_RESOURCE_TYPE_MEMORY24; | ||
825 | resource->length = sizeof(struct acpi_resource); | ||
826 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ | 807 | /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */ |
827 | resource->data.memory24.write_protect = | 808 | resource->data.memory24.write_protect = |
828 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 809 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
@@ -836,8 +817,6 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource, | |||
836 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, | 817 | static void pnpacpi_encode_mem32(struct acpi_resource *resource, |
837 | struct resource *p) | 818 | struct resource *p) |
838 | { | 819 | { |
839 | resource->type = ACPI_RESOURCE_TYPE_MEMORY32; | ||
840 | resource->length = sizeof(struct acpi_resource); | ||
841 | resource->data.memory32.write_protect = | 820 | resource->data.memory32.write_protect = |
842 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 821 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
843 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 822 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
@@ -850,8 +829,6 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource, | |||
850 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, | 829 | static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource, |
851 | struct resource *p) | 830 | struct resource *p) |
852 | { | 831 | { |
853 | resource->type = ACPI_RESOURCE_TYPE_FIXED_MEMORY32; | ||
854 | resource->length = sizeof(struct acpi_resource); | ||
855 | resource->data.fixed_memory32.write_protect = | 832 | resource->data.fixed_memory32.write_protect = |
856 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? | 833 | (p->flags & IORESOURCE_MEM_WRITEABLE) ? |
857 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; | 834 | ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY; |
@@ -882,37 +859,37 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
882 | pnp_dbg("Encode dma"); | 859 | pnp_dbg("Encode dma"); |
883 | pnpacpi_encode_dma(resource, | 860 | pnpacpi_encode_dma(resource, |
884 | &res_table->dma_resource[dma]); | 861 | &res_table->dma_resource[dma]); |
885 | dma ++; | 862 | dma++; |
886 | break; | 863 | break; |
887 | case ACPI_RESOURCE_TYPE_IO: | 864 | case ACPI_RESOURCE_TYPE_IO: |
888 | pnp_dbg("Encode io"); | 865 | pnp_dbg("Encode io"); |
889 | pnpacpi_encode_io(resource, | 866 | pnpacpi_encode_io(resource, |
890 | &res_table->port_resource[port]); | 867 | &res_table->port_resource[port]); |
891 | port ++; | 868 | port++; |
892 | break; | 869 | break; |
893 | case ACPI_RESOURCE_TYPE_FIXED_IO: | 870 | case ACPI_RESOURCE_TYPE_FIXED_IO: |
894 | pnp_dbg("Encode fixed io"); | 871 | pnp_dbg("Encode fixed io"); |
895 | pnpacpi_encode_fixed_io(resource, | 872 | pnpacpi_encode_fixed_io(resource, |
896 | &res_table->port_resource[port]); | 873 | &res_table->port_resource[port]); |
897 | port ++; | 874 | port++; |
898 | break; | 875 | break; |
899 | case ACPI_RESOURCE_TYPE_MEMORY24: | 876 | case ACPI_RESOURCE_TYPE_MEMORY24: |
900 | pnp_dbg("Encode mem24"); | 877 | pnp_dbg("Encode mem24"); |
901 | pnpacpi_encode_mem24(resource, | 878 | pnpacpi_encode_mem24(resource, |
902 | &res_table->mem_resource[mem]); | 879 | &res_table->mem_resource[mem]); |
903 | mem ++; | 880 | mem++; |
904 | break; | 881 | break; |
905 | case ACPI_RESOURCE_TYPE_MEMORY32: | 882 | case ACPI_RESOURCE_TYPE_MEMORY32: |
906 | pnp_dbg("Encode mem32"); | 883 | pnp_dbg("Encode mem32"); |
907 | pnpacpi_encode_mem32(resource, | 884 | pnpacpi_encode_mem32(resource, |
908 | &res_table->mem_resource[mem]); | 885 | &res_table->mem_resource[mem]); |
909 | mem ++; | 886 | mem++; |
910 | break; | 887 | break; |
911 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: | 888 | case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: |
912 | pnp_dbg("Encode fixed mem32"); | 889 | pnp_dbg("Encode fixed mem32"); |
913 | pnpacpi_encode_fixed_mem32(resource, | 890 | pnpacpi_encode_fixed_mem32(resource, |
914 | &res_table->mem_resource[mem]); | 891 | &res_table->mem_resource[mem]); |
915 | mem ++; | 892 | mem++; |
916 | break; | 893 | break; |
917 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: | 894 | case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: |
918 | pnp_dbg("Encode ext irq"); | 895 | pnp_dbg("Encode ext irq"); |
@@ -933,8 +910,8 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table, | |||
933 | pnp_warn("unknown resource type %d", resource->type); | 910 | pnp_warn("unknown resource type %d", resource->type); |
934 | return -EINVAL; | 911 | return -EINVAL; |
935 | } | 912 | } |
936 | resource ++; | 913 | resource++; |
937 | i ++; | 914 | i++; |
938 | } | 915 | } |
939 | return 0; | 916 | return 0; |
940 | } | 917 | } |
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h index e27dc8f29972..b9beceb33141 100644 --- a/include/acpi/acconfig.h +++ b/include/acpi/acconfig.h | |||
@@ -63,7 +63,7 @@ | |||
63 | 63 | ||
64 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 64 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
65 | 65 | ||
66 | #define ACPI_CA_VERSION 0x20060127 | 66 | #define ACPI_CA_VERSION 0x20060608 |
67 | 67 | ||
68 | /* | 68 | /* |
69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, | 69 | * OS name, used for the _OS object. The _OS object is essentially obsolete, |
@@ -81,6 +81,7 @@ | |||
81 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ | 81 | #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
82 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ | 82 | #define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ |
83 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ | 83 | #define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ |
84 | #define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */ | ||
84 | 85 | ||
85 | /* | 86 | /* |
86 | * Should the subsystem abort the loading of an ACPI table if the | 87 | * Should the subsystem abort the loading of an ACPI table if the |
@@ -102,9 +103,9 @@ | |||
102 | 103 | ||
103 | #define ACPI_MAX_SEMAPHORE_COUNT 256 | 104 | #define ACPI_MAX_SEMAPHORE_COUNT 256 |
104 | 105 | ||
105 | /* Max reference count (for debug only) */ | 106 | /* Maximum object reference count (detects object deletion issues) */ |
106 | 107 | ||
107 | #define ACPI_MAX_REFERENCE_COUNT 0x400 | 108 | #define ACPI_MAX_REFERENCE_COUNT 0x800 |
108 | 109 | ||
109 | /* Size of cached memory mapping for system memory operation region */ | 110 | /* Size of cached memory mapping for system memory operation region */ |
110 | 111 | ||
@@ -171,12 +172,7 @@ | |||
171 | 172 | ||
172 | /* Array sizes. Used for range checking also */ | 173 | /* Array sizes. Used for range checking also */ |
173 | 174 | ||
174 | #define ACPI_NUM_ACCESS_TYPES 6 | 175 | #define ACPI_MAX_MATCH_OPCODE 5 |
175 | #define ACPI_NUM_UPDATE_RULES 3 | ||
176 | #define ACPI_NUM_LOCK_RULES 2 | ||
177 | #define ACPI_NUM_MATCH_OPS 6 | ||
178 | #define ACPI_NUM_OPCODES 256 | ||
179 | #define ACPI_NUM_FIELD_NAMES 2 | ||
180 | 176 | ||
181 | /* RSDP checksums */ | 177 | /* RSDP checksums */ |
182 | 178 | ||
@@ -187,10 +183,6 @@ | |||
187 | 183 | ||
188 | #define ACPI_SMBUS_BUFFER_SIZE 34 | 184 | #define ACPI_SMBUS_BUFFER_SIZE 34 |
189 | 185 | ||
190 | /* Number of strings associated with the _OSI reserved method */ | ||
191 | |||
192 | #define ACPI_NUM_OSI_STRINGS 10 | ||
193 | |||
194 | /****************************************************************************** | 186 | /****************************************************************************** |
195 | * | 187 | * |
196 | * ACPI AML Debugger | 188 | * ACPI AML Debugger |
diff --git a/include/acpi/acdisasm.h b/include/acpi/acdisasm.h index 11a8fe39cb04..9a7d6921f534 100644 --- a/include/acpi/acdisasm.h +++ b/include/acpi/acdisasm.h | |||
@@ -50,26 +50,72 @@ | |||
50 | #define BLOCK_PAREN 1 | 50 | #define BLOCK_PAREN 1 |
51 | #define BLOCK_BRACE 2 | 51 | #define BLOCK_BRACE 2 |
52 | #define BLOCK_COMMA_LIST 4 | 52 | #define BLOCK_COMMA_LIST 4 |
53 | #define ACPI_DEFAULT_RESNAME *(u32 *) "__RD" | ||
53 | 54 | ||
54 | struct acpi_external_list { | 55 | struct acpi_external_list { |
55 | char *path; | 56 | char *path; |
57 | char *internal_path; | ||
56 | struct acpi_external_list *next; | 58 | struct acpi_external_list *next; |
59 | u32 value; | ||
60 | u16 length; | ||
61 | u8 type; | ||
57 | }; | 62 | }; |
58 | 63 | ||
59 | extern struct acpi_external_list *acpi_gbl_external_list; | 64 | extern struct acpi_external_list *acpi_gbl_external_list; |
60 | 65 | ||
61 | /* Strings used for decoding flags to ASL keywords */ | 66 | typedef const struct acpi_dmtable_info { |
67 | u8 opcode; | ||
68 | u8 offset; | ||
69 | char *name; | ||
70 | |||
71 | } acpi_dmtable_info; | ||
72 | |||
73 | /* | ||
74 | * Values for Opcode above. | ||
75 | * Note: 0-7 must not change, used as a flag shift value | ||
76 | */ | ||
77 | #define ACPI_DMT_FLAG0 0 | ||
78 | #define ACPI_DMT_FLAG1 1 | ||
79 | #define ACPI_DMT_FLAG2 2 | ||
80 | #define ACPI_DMT_FLAG3 3 | ||
81 | #define ACPI_DMT_FLAG4 4 | ||
82 | #define ACPI_DMT_FLAG5 5 | ||
83 | #define ACPI_DMT_FLAG6 6 | ||
84 | #define ACPI_DMT_FLAG7 7 | ||
85 | #define ACPI_DMT_FLAGS0 8 | ||
86 | #define ACPI_DMT_FLAGS2 9 | ||
87 | #define ACPI_DMT_UINT8 10 | ||
88 | #define ACPI_DMT_UINT16 11 | ||
89 | #define ACPI_DMT_UINT24 12 | ||
90 | #define ACPI_DMT_UINT32 13 | ||
91 | #define ACPI_DMT_UINT56 14 | ||
92 | #define ACPI_DMT_UINT64 15 | ||
93 | #define ACPI_DMT_STRING 16 | ||
94 | #define ACPI_DMT_NAME4 17 | ||
95 | #define ACPI_DMT_NAME6 18 | ||
96 | #define ACPI_DMT_NAME8 19 | ||
97 | #define ACPI_DMT_CHKSUM 20 | ||
98 | #define ACPI_DMT_SPACEID 21 | ||
99 | #define ACPI_DMT_GAS 22 | ||
100 | #define ACPI_DMT_MADT 23 | ||
101 | #define ACPI_DMT_SRAT 24 | ||
102 | #define ACPI_DMT_EXIT 25 | ||
62 | 103 | ||
63 | extern const char *acpi_gbl_word_decode[4]; | 104 | typedef |
64 | extern const char *acpi_gbl_irq_decode[2]; | 105 | void (*ACPI_TABLE_HANDLER) (struct acpi_table_header * table); |
65 | extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES]; | 106 | |
66 | extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES]; | 107 | struct acpi_dmtable_data { |
67 | extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES]; | 108 | char *signature; |
68 | extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS]; | 109 | struct acpi_dmtable_info *table_info; |
110 | ACPI_TABLE_HANDLER table_handler; | ||
111 | }; | ||
69 | 112 | ||
70 | struct acpi_op_walk_info { | 113 | struct acpi_op_walk_info { |
71 | u32 level; | 114 | u32 level; |
115 | u32 last_level; | ||
116 | u32 count; | ||
72 | u32 bit_offset; | 117 | u32 bit_offset; |
118 | u32 flags; | ||
73 | struct acpi_walk_state *walk_state; | 119 | struct acpi_walk_state *walk_state; |
74 | }; | 120 | }; |
75 | 121 | ||
@@ -77,6 +123,100 @@ typedef | |||
77 | acpi_status(*asl_walk_callback) (union acpi_parse_object * op, | 123 | acpi_status(*asl_walk_callback) (union acpi_parse_object * op, |
78 | u32 level, void *context); | 124 | u32 level, void *context); |
79 | 125 | ||
126 | struct acpi_resource_tag { | ||
127 | u32 bit_index; | ||
128 | char *tag; | ||
129 | }; | ||
130 | |||
131 | /* Strings used for decoding flags to ASL keywords */ | ||
132 | |||
133 | extern const char *acpi_gbl_word_decode[]; | ||
134 | extern const char *acpi_gbl_irq_decode[]; | ||
135 | extern const char *acpi_gbl_lock_rule[]; | ||
136 | extern const char *acpi_gbl_access_types[]; | ||
137 | extern const char *acpi_gbl_update_rules[]; | ||
138 | extern const char *acpi_gbl_match_ops[]; | ||
139 | |||
140 | extern struct acpi_dmtable_info acpi_dm_table_info_asf0[]; | ||
141 | extern struct acpi_dmtable_info acpi_dm_table_info_asf1[]; | ||
142 | extern struct acpi_dmtable_info acpi_dm_table_info_asf2[]; | ||
143 | extern struct acpi_dmtable_info acpi_dm_table_info_asf3[]; | ||
144 | extern struct acpi_dmtable_info acpi_dm_table_info_asf4[]; | ||
145 | extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[]; | ||
146 | extern struct acpi_dmtable_info acpi_dm_table_info_boot[]; | ||
147 | extern struct acpi_dmtable_info acpi_dm_table_info_cpep[]; | ||
148 | extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[]; | ||
149 | extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[]; | ||
150 | extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[]; | ||
151 | extern struct acpi_dmtable_info acpi_dm_table_info_facs[]; | ||
152 | extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[]; | ||
153 | extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[]; | ||
154 | extern struct acpi_dmtable_info acpi_dm_table_info_gas[]; | ||
155 | extern struct acpi_dmtable_info acpi_dm_table_info_header[]; | ||
156 | extern struct acpi_dmtable_info acpi_dm_table_info_hpet[]; | ||
157 | extern struct acpi_dmtable_info acpi_dm_table_info_madt[]; | ||
158 | extern struct acpi_dmtable_info acpi_dm_table_info_madt0[]; | ||
159 | extern struct acpi_dmtable_info acpi_dm_table_info_madt1[]; | ||
160 | extern struct acpi_dmtable_info acpi_dm_table_info_madt2[]; | ||
161 | extern struct acpi_dmtable_info acpi_dm_table_info_madt3[]; | ||
162 | extern struct acpi_dmtable_info acpi_dm_table_info_madt4[]; | ||
163 | extern struct acpi_dmtable_info acpi_dm_table_info_madt5[]; | ||
164 | extern struct acpi_dmtable_info acpi_dm_table_info_madt6[]; | ||
165 | extern struct acpi_dmtable_info acpi_dm_table_info_madt7[]; | ||
166 | extern struct acpi_dmtable_info acpi_dm_table_info_madt8[]; | ||
167 | extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[]; | ||
168 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[]; | ||
169 | extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[]; | ||
170 | extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[]; | ||
171 | extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[]; | ||
172 | extern struct acpi_dmtable_info acpi_dm_table_info_sbst[]; | ||
173 | extern struct acpi_dmtable_info acpi_dm_table_info_slit[]; | ||
174 | extern struct acpi_dmtable_info acpi_dm_table_info_spcr[]; | ||
175 | extern struct acpi_dmtable_info acpi_dm_table_info_spmi[]; | ||
176 | extern struct acpi_dmtable_info acpi_dm_table_info_srat[]; | ||
177 | extern struct acpi_dmtable_info acpi_dm_table_info_srat0[]; | ||
178 | extern struct acpi_dmtable_info acpi_dm_table_info_srat1[]; | ||
179 | extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[]; | ||
180 | extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[]; | ||
181 | |||
182 | /* | ||
183 | * dmtable | ||
184 | */ | ||
185 | void acpi_dm_dump_data_table(struct acpi_table_header *table); | ||
186 | |||
187 | void | ||
188 | acpi_dm_dump_table(u32 table_length, | ||
189 | u32 table_offset, | ||
190 | void *table, | ||
191 | u32 sub_table_length, struct acpi_dmtable_info *info); | ||
192 | |||
193 | void acpi_dm_line_header(u32 offset, u32 byte_length, char *name); | ||
194 | |||
195 | void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value); | ||
196 | |||
197 | /* | ||
198 | * dmtbdump | ||
199 | */ | ||
200 | void acpi_dm_dump_asf(struct acpi_table_header *table); | ||
201 | |||
202 | void acpi_dm_dump_cpep(struct acpi_table_header *table); | ||
203 | |||
204 | void acpi_dm_dump_fadt(struct acpi_table_header *table); | ||
205 | |||
206 | void acpi_dm_dump_srat(struct acpi_table_header *table); | ||
207 | |||
208 | void acpi_dm_dump_mcfg(struct acpi_table_header *table); | ||
209 | |||
210 | void acpi_dm_dump_madt(struct acpi_table_header *table); | ||
211 | |||
212 | u32 acpi_dm_dump_rsdp(struct acpi_table_header *table); | ||
213 | |||
214 | void acpi_dm_dump_rsdt(struct acpi_table_header *table); | ||
215 | |||
216 | void acpi_dm_dump_slit(struct acpi_table_header *table); | ||
217 | |||
218 | void acpi_dm_dump_xsdt(struct acpi_table_header *table); | ||
219 | |||
80 | /* | 220 | /* |
81 | * dmwalk | 221 | * dmwalk |
82 | */ | 222 | */ |
@@ -84,6 +224,11 @@ void | |||
84 | acpi_dm_disassemble(struct acpi_walk_state *walk_state, | 224 | acpi_dm_disassemble(struct acpi_walk_state *walk_state, |
85 | union acpi_parse_object *origin, u32 num_opcodes); | 225 | union acpi_parse_object *origin, u32 num_opcodes); |
86 | 226 | ||
227 | void | ||
228 | acpi_dm_walk_parse_tree(union acpi_parse_object *op, | ||
229 | asl_walk_callback descending_callback, | ||
230 | asl_walk_callback ascending_callback, void *context); | ||
231 | |||
87 | /* | 232 | /* |
88 | * dmopcode | 233 | * dmopcode |
89 | */ | 234 | */ |
@@ -166,6 +311,7 @@ void acpi_dm_dump_integer64(u64 value, char *name); | |||
166 | 311 | ||
167 | void | 312 | void |
168 | acpi_dm_resource_template(struct acpi_op_walk_info *info, | 313 | acpi_dm_resource_template(struct acpi_op_walk_info *info, |
314 | union acpi_parse_object *op, | ||
169 | u8 * byte_data, u32 byte_count); | 315 | u8 * byte_data, u32 byte_count); |
170 | 316 | ||
171 | u8 acpi_dm_is_resource_template(union acpi_parse_object *op); | 317 | u8 acpi_dm_is_resource_template(union acpi_parse_object *op); |
@@ -176,6 +322,8 @@ void acpi_dm_bit_list(u16 mask); | |||
176 | 322 | ||
177 | void acpi_dm_decode_attribute(u8 attribute); | 323 | void acpi_dm_decode_attribute(u8 attribute); |
178 | 324 | ||
325 | void acpi_dm_descriptor_name(void); | ||
326 | |||
179 | /* | 327 | /* |
180 | * dmresrcl | 328 | * dmresrcl |
181 | */ | 329 | */ |
@@ -248,6 +396,15 @@ acpi_dm_vendor_small_descriptor(union aml_resource *resource, | |||
248 | /* | 396 | /* |
249 | * dmutils | 397 | * dmutils |
250 | */ | 398 | */ |
251 | void acpi_dm_add_to_external_list(char *path); | 399 | void acpi_dm_add_to_external_list(char *path, u8 type, u32 value); |
400 | |||
401 | /* | ||
402 | * dmrestag | ||
403 | */ | ||
404 | void acpi_dm_find_resources(union acpi_parse_object *root); | ||
405 | |||
406 | void | ||
407 | acpi_dm_check_resource_reference(union acpi_parse_object *op, | ||
408 | struct acpi_walk_state *walk_state); | ||
252 | 409 | ||
253 | #endif /* __ACDISASM_H__ */ | 410 | #endif /* __ACDISASM_H__ */ |
diff --git a/include/acpi/acdispat.h b/include/acpi/acdispat.h index c41a926ff317..288f84903af7 100644 --- a/include/acpi/acdispat.h +++ b/include/acpi/acdispat.h | |||
@@ -194,7 +194,9 @@ acpi_status | |||
194 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, | 194 | acpi_ds_restart_control_method(struct acpi_walk_state *walk_state, |
195 | union acpi_operand_object *return_desc); | 195 | union acpi_operand_object *return_desc); |
196 | 196 | ||
197 | void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state); | 197 | void |
198 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | ||
199 | struct acpi_walk_state *walk_state); | ||
198 | 200 | ||
199 | acpi_status | 201 | acpi_status |
200 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | 202 | acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, |
@@ -302,7 +304,7 @@ acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state, | |||
302 | struct acpi_namespace_node *method_node, | 304 | struct acpi_namespace_node *method_node, |
303 | u8 * aml_start, | 305 | u8 * aml_start, |
304 | u32 aml_length, | 306 | u32 aml_length, |
305 | struct acpi_parameter_info *info, u8 pass_number); | 307 | struct acpi_evaluate_info *info, u8 pass_number); |
306 | 308 | ||
307 | acpi_status | 309 | acpi_status |
308 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | 310 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, |
diff --git a/include/acpi/acevents.h b/include/acpi/acevents.h index f2717be4fe0d..234142828e1a 100644 --- a/include/acpi/acevents.h +++ b/include/acpi/acevents.h | |||
@@ -93,7 +93,7 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device, | |||
93 | */ | 93 | */ |
94 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); | 94 | u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info); |
95 | 95 | ||
96 | acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback); | 96 | acpi_status acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback); |
97 | 97 | ||
98 | acpi_status | 98 | acpi_status |
99 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, | 99 | acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, |
@@ -138,7 +138,7 @@ acpi_status | |||
138 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | 138 | acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, |
139 | u32 function, | 139 | u32 function, |
140 | acpi_physical_address address, | 140 | acpi_physical_address address, |
141 | u32 bit_width, void *value); | 141 | u32 bit_width, acpi_integer * value); |
142 | 142 | ||
143 | acpi_status | 143 | acpi_status |
144 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, | 144 | acpi_ev_attach_region(union acpi_operand_object *handler_obj, |
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index dc768aa580e4..797ca1ea5214 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
@@ -160,8 +160,9 @@ | |||
160 | #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) | 160 | #define AE_AML_BAD_RESOURCE_VALUE (acpi_status) (0x001F | AE_CODE_AML) |
161 | #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) | 161 | #define AE_AML_CIRCULAR_REFERENCE (acpi_status) (0x0020 | AE_CODE_AML) |
162 | #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) | 162 | #define AE_AML_BAD_RESOURCE_LENGTH (acpi_status) (0x0021 | AE_CODE_AML) |
163 | #define AE_AML_ILLEGAL_ADDRESS (acpi_status) (0x0022 | AE_CODE_AML) | ||
163 | 164 | ||
164 | #define AE_CODE_AML_MAX 0x0021 | 165 | #define AE_CODE_AML_MAX 0x0022 |
165 | 166 | ||
166 | /* | 167 | /* |
167 | * Internal exceptions used for control | 168 | * Internal exceptions used for control |
@@ -275,7 +276,8 @@ char const *acpi_gbl_exception_names_aml[] = { | |||
275 | "AE_AML_NO_RESOURCE_END_TAG", | 276 | "AE_AML_NO_RESOURCE_END_TAG", |
276 | "AE_AML_BAD_RESOURCE_VALUE", | 277 | "AE_AML_BAD_RESOURCE_VALUE", |
277 | "AE_AML_CIRCULAR_REFERENCE", | 278 | "AE_AML_CIRCULAR_REFERENCE", |
278 | "AE_AML_BAD_RESOURCE_LENGTH" | 279 | "AE_AML_BAD_RESOURCE_LENGTH", |
280 | "AE_AML_ILLEGAL_ADDRESS" | ||
279 | }; | 281 | }; |
280 | 282 | ||
281 | char const *acpi_gbl_exception_names_ctrl[] = { | 283 | char const *acpi_gbl_exception_names_ctrl[] = { |
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h index 734cc77bf2c7..14531d48f6b6 100644 --- a/include/acpi/acglobal.h +++ b/include/acpi/acglobal.h | |||
@@ -107,6 +107,7 @@ ACPI_EXTERN u32 acpi_gbl_trace_flags; | |||
107 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) | 107 | * 3) Allow access to uninitialized locals/args (auto-init to integer 0) |
108 | * 4) Allow ANY object type to be a source operand for the Store() operator | 108 | * 4) Allow ANY object type to be a source operand for the Store() operator |
109 | * 5) Allow unresolved references (invalid target name) in package objects | 109 | * 5) Allow unresolved references (invalid target name) in package objects |
110 | * 6) Enable warning messages for behavior that is not ACPI spec compliant | ||
110 | */ | 111 | */ |
111 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | 112 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); |
112 | 113 | ||
@@ -114,7 +115,7 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE); | |||
114 | * Automatically serialize ALL control methods? Default is FALSE, meaning | 115 | * Automatically serialize ALL control methods? Default is FALSE, meaning |
115 | * to use the Serialized/not_serialized method flags on a per method basis. | 116 | * to use the Serialized/not_serialized method flags on a per method basis. |
116 | * Only change this if the ASL code is poorly written and cannot handle | 117 | * Only change this if the ASL code is poorly written and cannot handle |
117 | * reentrancy even though methods are marked "not_serialized". | 118 | * reentrancy even though methods are marked "NotSerialized". |
118 | */ | 119 | */ |
119 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); | 120 | ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE); |
120 | 121 | ||
@@ -149,10 +150,10 @@ ACPI_EXTERN u8 ACPI_INIT_GLOBAL(acpi_gbl_leave_wake_gpes_disabled, TRUE); | |||
149 | ACPI_EXTERN u32 acpi_gbl_table_flags; | 150 | ACPI_EXTERN u32 acpi_gbl_table_flags; |
150 | ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; | 151 | ACPI_EXTERN u32 acpi_gbl_rsdt_table_count; |
151 | ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; | 152 | ACPI_EXTERN struct rsdp_descriptor *acpi_gbl_RSDP; |
152 | ACPI_EXTERN XSDT_DESCRIPTOR *acpi_gbl_XSDT; | 153 | ACPI_EXTERN struct xsdt_descriptor *acpi_gbl_XSDT; |
153 | ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT; | 154 | ACPI_EXTERN struct fadt_descriptor *acpi_gbl_FADT; |
154 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; | 155 | ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT; |
155 | ACPI_EXTERN FACS_DESCRIPTOR *acpi_gbl_FACS; | 156 | ACPI_EXTERN struct facs_descriptor *acpi_gbl_FACS; |
156 | ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; | 157 | ACPI_EXTERN struct acpi_common_facs acpi_gbl_common_fACS; |
157 | /* | 158 | /* |
158 | * Since there may be multiple SSDTs and PSDTs, a single pointer is not | 159 | * Since there may be multiple SSDTs and PSDTs, a single pointer is not |
@@ -177,15 +178,15 @@ ACPI_EXTERN u8 acpi_gbl_integer_nybble_width; | |||
177 | /* | 178 | /* |
178 | * ACPI Table info arrays | 179 | * ACPI Table info arrays |
179 | */ | 180 | */ |
180 | extern struct acpi_table_list acpi_gbl_table_lists[NUM_ACPI_TABLE_TYPES]; | 181 | extern struct acpi_table_list acpi_gbl_table_lists[ACPI_TABLE_ID_MAX + 1]; |
181 | extern struct acpi_table_support acpi_gbl_table_data[NUM_ACPI_TABLE_TYPES]; | 182 | extern struct acpi_table_support acpi_gbl_table_data[ACPI_TABLE_ID_MAX + 1]; |
182 | 183 | ||
183 | /* | 184 | /* |
184 | * Predefined mutex objects. This array contains the | 185 | * Predefined mutex objects. This array contains the |
185 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. | 186 | * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. |
186 | * (The table maps local handles to the real OS handles) | 187 | * (The table maps local handles to the real OS handles) |
187 | */ | 188 | */ |
188 | ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[NUM_MUTEX]; | 189 | ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX]; |
189 | 190 | ||
190 | /***************************************************************************** | 191 | /***************************************************************************** |
191 | * | 192 | * |
@@ -203,6 +204,7 @@ ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list; | |||
203 | 204 | ||
204 | /* Object caches */ | 205 | /* Object caches */ |
205 | 206 | ||
207 | ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache; | ||
206 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; | 208 | ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache; |
207 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; | 209 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache; |
208 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; | 210 | ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache; |
@@ -244,7 +246,6 @@ extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT]; | |||
244 | extern const char *acpi_gbl_highest_dstate_names[4]; | 246 | extern const char *acpi_gbl_highest_dstate_names[4]; |
245 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; | 247 | extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; |
246 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | 248 | extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; |
247 | extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS]; | ||
248 | 249 | ||
249 | /***************************************************************************** | 250 | /***************************************************************************** |
250 | * | 251 | * |
@@ -291,14 +292,6 @@ ACPI_EXTERN u8 acpi_gbl_cm_single_step; | |||
291 | 292 | ||
292 | /***************************************************************************** | 293 | /***************************************************************************** |
293 | * | 294 | * |
294 | * Parser globals | ||
295 | * | ||
296 | ****************************************************************************/ | ||
297 | |||
298 | ACPI_EXTERN union acpi_parse_object *acpi_gbl_parsed_namespace_root; | ||
299 | |||
300 | /***************************************************************************** | ||
301 | * | ||
302 | * Hardware globals | 295 | * Hardware globals |
303 | * | 296 | * |
304 | ****************************************************************************/ | 297 | ****************************************************************************/ |
@@ -321,7 +314,11 @@ ACPI_EXTERN struct acpi_fixed_event_handler | |||
321 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; | 314 | ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head; |
322 | ACPI_EXTERN struct acpi_gpe_block_info | 315 | ACPI_EXTERN struct acpi_gpe_block_info |
323 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; | 316 | *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]; |
317 | |||
318 | /* Spinlocks */ | ||
319 | |||
324 | ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; | 320 | ACPI_EXTERN acpi_handle acpi_gbl_gpe_lock; |
321 | ACPI_EXTERN acpi_handle acpi_gbl_hardware_lock; | ||
325 | 322 | ||
326 | /***************************************************************************** | 323 | /***************************************************************************** |
327 | * | 324 | * |
diff --git a/include/acpi/aclocal.h b/include/acpi/aclocal.h index 8361820d2970..1eeca7adca95 100644 --- a/include/acpi/aclocal.h +++ b/include/acpi/aclocal.h | |||
@@ -44,7 +44,10 @@ | |||
44 | #ifndef __ACLOCAL_H__ | 44 | #ifndef __ACLOCAL_H__ |
45 | #define __ACLOCAL_H__ | 45 | #define __ACLOCAL_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ | 49 | #define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */ |
50 | #define ACPI_INFINITE_CONCURRENCY 0xFF | ||
48 | 51 | ||
49 | typedef void *acpi_mutex; | 52 | typedef void *acpi_mutex; |
50 | typedef u32 acpi_mutex_handle; | 53 | typedef u32 acpi_mutex_handle; |
@@ -69,52 +72,55 @@ union acpi_parse_object; | |||
69 | * Predefined handles for the mutex objects used within the subsystem | 72 | * Predefined handles for the mutex objects used within the subsystem |
70 | * All mutex objects are automatically created by acpi_ut_mutex_initialize. | 73 | * All mutex objects are automatically created by acpi_ut_mutex_initialize. |
71 | * | 74 | * |
72 | * The acquire/release ordering protocol is implied via this list. Mutexes | 75 | * The acquire/release ordering protocol is implied via this list. Mutexes |
73 | * with a lower value must be acquired before mutexes with a higher value. | 76 | * with a lower value must be acquired before mutexes with a higher value. |
74 | * | 77 | * |
75 | * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names table also! | 78 | * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names |
79 | * table below also! | ||
76 | */ | 80 | */ |
77 | #define ACPI_MTX_EXECUTE 0 | 81 | #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ |
78 | #define ACPI_MTX_INTERPRETER 1 | 82 | #define ACPI_MTX_CONTROL_METHOD 1 /* Control method termination [TBD: may no longer be necessary] */ |
79 | #define ACPI_MTX_PARSER 2 | 83 | #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ |
80 | #define ACPI_MTX_DISPATCHER 3 | 84 | #define ACPI_MTX_NAMESPACE 3 /* ACPI Namespace */ |
81 | #define ACPI_MTX_TABLES 4 | 85 | #define ACPI_MTX_EVENTS 4 /* Data for ACPI events */ |
82 | #define ACPI_MTX_OP_REGIONS 5 | 86 | #define ACPI_MTX_CACHES 5 /* Internal caches, general purposes */ |
83 | #define ACPI_MTX_NAMESPACE 6 | 87 | #define ACPI_MTX_MEMORY 6 /* Debug memory tracking lists */ |
84 | #define ACPI_MTX_EVENTS 7 | 88 | #define ACPI_MTX_DEBUG_CMD_COMPLETE 7 /* AML debugger */ |
85 | #define ACPI_MTX_HARDWARE 8 | 89 | #define ACPI_MTX_DEBUG_CMD_READY 8 /* AML debugger */ |
86 | #define ACPI_MTX_CACHES 9 | 90 | |
87 | #define ACPI_MTX_MEMORY 10 | 91 | #define ACPI_MAX_MUTEX 8 |
88 | #define ACPI_MTX_DEBUG_CMD_COMPLETE 11 | 92 | #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 |
89 | #define ACPI_MTX_DEBUG_CMD_READY 12 | ||
90 | |||
91 | #define MAX_MUTEX 12 | ||
92 | #define NUM_MUTEX MAX_MUTEX+1 | ||
93 | 93 | ||
94 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | 94 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
95 | #ifdef DEFINE_ACPI_GLOBALS | 95 | #ifdef DEFINE_ACPI_GLOBALS |
96 | 96 | ||
97 | /* Names for the mutexes used in the subsystem */ | 97 | /* Debug names for the mutexes above */ |
98 | 98 | ||
99 | static char *acpi_gbl_mutex_names[] = { | 99 | static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { |
100 | "ACPI_MTX_Execute", | ||
101 | "ACPI_MTX_Interpreter", | 100 | "ACPI_MTX_Interpreter", |
102 | "ACPI_MTX_Parser", | 101 | "ACPI_MTX_Method", |
103 | "ACPI_MTX_Dispatcher", | ||
104 | "ACPI_MTX_Tables", | 102 | "ACPI_MTX_Tables", |
105 | "ACPI_MTX_op_regions", | ||
106 | "ACPI_MTX_Namespace", | 103 | "ACPI_MTX_Namespace", |
107 | "ACPI_MTX_Events", | 104 | "ACPI_MTX_Events", |
108 | "ACPI_MTX_Hardware", | ||
109 | "ACPI_MTX_Caches", | 105 | "ACPI_MTX_Caches", |
110 | "ACPI_MTX_Memory", | 106 | "ACPI_MTX_Memory", |
111 | "ACPI_MTX_debug_cmd_complete", | 107 | "ACPI_MTX_DebugCmdComplete", |
112 | "ACPI_MTX_debug_cmd_ready", | 108 | "ACPI_MTX_DebugCmdReady" |
113 | }; | 109 | }; |
114 | 110 | ||
115 | #endif | 111 | #endif |
116 | #endif | 112 | #endif |
117 | 113 | ||
114 | /* | ||
115 | * Predefined handles for spinlocks used within the subsystem. | ||
116 | * These spinlocks are created by acpi_ut_mutex_initialize | ||
117 | */ | ||
118 | #define ACPI_LOCK_GPES 0 | ||
119 | #define ACPI_LOCK_HARDWARE 1 | ||
120 | |||
121 | #define ACPI_MAX_LOCK 1 | ||
122 | #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 | ||
123 | |||
118 | /* Owner IDs are used to track namespace nodes for selective deletion */ | 124 | /* Owner IDs are used to track namespace nodes for selective deletion */ |
119 | 125 | ||
120 | typedef u8 acpi_owner_id; | 126 | typedef u8 acpi_owner_id; |
@@ -129,7 +135,7 @@ typedef u8 acpi_owner_id; | |||
129 | struct acpi_mutex_info { | 135 | struct acpi_mutex_info { |
130 | acpi_mutex mutex; | 136 | acpi_mutex mutex; |
131 | u32 use_count; | 137 | u32 use_count; |
132 | u32 thread_id; | 138 | acpi_thread_id thread_id; |
133 | }; | 139 | }; |
134 | 140 | ||
135 | /* Lock flag parameter for various interfaces */ | 141 | /* Lock flag parameter for various interfaces */ |
@@ -144,6 +150,8 @@ struct acpi_mutex_info { | |||
144 | #define ACPI_FIELD_DWORD_GRANULARITY 4 | 150 | #define ACPI_FIELD_DWORD_GRANULARITY 4 |
145 | #define ACPI_FIELD_QWORD_GRANULARITY 8 | 151 | #define ACPI_FIELD_QWORD_GRANULARITY 8 |
146 | 152 | ||
153 | #define ACPI_ENTRY_NOT_FOUND NULL | ||
154 | |||
147 | /***************************************************************************** | 155 | /***************************************************************************** |
148 | * | 156 | * |
149 | * Namespace typedefs and structs | 157 | * Namespace typedefs and structs |
@@ -158,49 +166,55 @@ typedef enum { | |||
158 | ACPI_IMODE_EXECUTE = 0x0E | 166 | ACPI_IMODE_EXECUTE = 0x0E |
159 | } acpi_interpreter_mode; | 167 | } acpi_interpreter_mode; |
160 | 168 | ||
161 | /* | ||
162 | * The Node describes a named object that appears in the AML | ||
163 | * An acpi_node is used to store Nodes. | ||
164 | * | ||
165 | * data_type is used to differentiate between internal descriptors, and MUST | ||
166 | * be the first byte in this structure. | ||
167 | */ | ||
168 | union acpi_name_union { | 169 | union acpi_name_union { |
169 | u32 integer; | 170 | u32 integer; |
170 | char ascii[4]; | 171 | char ascii[4]; |
171 | }; | 172 | }; |
172 | 173 | ||
174 | /* | ||
175 | * The Namespace Node describes a named object that appears in the AML. | ||
176 | * descriptor_type is used to differentiate between internal descriptors. | ||
177 | * | ||
178 | * The node is optimized for both 32-bit and 64-bit platforms: | ||
179 | * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. | ||
180 | * | ||
181 | * Note: The descriptor_type and Type fields must appear in the identical | ||
182 | * position in both the struct acpi_namespace_node and union acpi_operand_object | ||
183 | * structures. | ||
184 | */ | ||
173 | struct acpi_namespace_node { | 185 | struct acpi_namespace_node { |
174 | u8 descriptor; /* Used to differentiate object descriptor types */ | 186 | union acpi_operand_object *object; /* Interpreter object */ |
175 | u8 type; /* Type associated with this name */ | 187 | u8 descriptor_type; /* Differentiate object descriptor types */ |
176 | u16 reference_count; /* Current count of references and children */ | 188 | u8 type; /* ACPI Type associated with this name */ |
189 | u8 flags; /* Miscellaneous flags */ | ||
190 | acpi_owner_id owner_id; /* Node creator */ | ||
177 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ | 191 | union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ |
178 | union acpi_operand_object *object; /* Pointer to attached ACPI object (optional) */ | ||
179 | struct acpi_namespace_node *child; /* First child */ | 192 | struct acpi_namespace_node *child; /* First child */ |
180 | struct acpi_namespace_node *peer; /* Next peer */ | 193 | struct acpi_namespace_node *peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */ |
181 | u8 owner_id; /* Who created this node */ | ||
182 | u8 flags; | ||
183 | |||
184 | /* Fields used by the ASL compiler only */ | ||
185 | 194 | ||
186 | #ifdef ACPI_ASL_COMPILER | 195 | /* |
187 | u32 value; | 196 | * The following fields are used by the ASL compiler and disassembler only |
197 | */ | ||
198 | #ifdef ACPI_LARGE_NAMESPACE_NODE | ||
188 | union acpi_parse_object *op; | 199 | union acpi_parse_object *op; |
200 | u32 value; | ||
201 | u32 length; | ||
189 | #endif | 202 | #endif |
190 | }; | 203 | }; |
191 | 204 | ||
192 | #define ACPI_ENTRY_NOT_FOUND NULL | 205 | /* Namespace Node flags */ |
193 | 206 | ||
194 | /* Node flags */ | 207 | #define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */ |
208 | #define ANOBJ_DATA_WIDTH_32 0x02 /* Parent table uses 32-bit math */ | ||
209 | #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ | ||
210 | #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ | ||
211 | #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ | ||
195 | 212 | ||
196 | #define ANOBJ_RESERVED 0x01 | 213 | #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ |
197 | #define ANOBJ_END_OF_PEER_LIST 0x02 | 214 | #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ |
198 | #define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ | 215 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ |
199 | #define ANOBJ_METHOD_ARG 0x08 | 216 | #define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ |
200 | #define ANOBJ_METHOD_LOCAL 0x10 | 217 | #define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ |
201 | #define ANOBJ_METHOD_NO_RETVAL 0x20 | ||
202 | #define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 | ||
203 | #define ANOBJ_IS_BIT_OFFSET 0x80 | ||
204 | 218 | ||
205 | /* | 219 | /* |
206 | * ACPI Table Descriptor. One per ACPI table | 220 | * ACPI Table Descriptor. One per ACPI table |
@@ -212,8 +226,8 @@ struct acpi_table_desc { | |||
212 | struct acpi_table_header *pointer; | 226 | struct acpi_table_header *pointer; |
213 | u8 *aml_start; | 227 | u8 *aml_start; |
214 | u64 physical_address; | 228 | u64 physical_address; |
215 | u32 aml_length; | ||
216 | acpi_size length; | 229 | acpi_size length; |
230 | u32 aml_length; | ||
217 | acpi_owner_id owner_id; | 231 | acpi_owner_id owner_id; |
218 | u8 type; | 232 | u8 type; |
219 | u8 allocation; | 233 | u8 allocation; |
@@ -276,6 +290,9 @@ struct acpi_create_field_info { | |||
276 | u8 field_type; | 290 | u8 field_type; |
277 | }; | 291 | }; |
278 | 292 | ||
293 | typedef | ||
294 | acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | ||
295 | |||
279 | /* | 296 | /* |
280 | * Bitmapped ACPI types. Used internally only | 297 | * Bitmapped ACPI types. Used internally only |
281 | */ | 298 | */ |
@@ -377,7 +394,7 @@ struct acpi_gpe_walk_info { | |||
377 | struct acpi_gpe_block_info *gpe_block; | 394 | struct acpi_gpe_block_info *gpe_block; |
378 | }; | 395 | }; |
379 | 396 | ||
380 | typedef acpi_status(*ACPI_GPE_CALLBACK) (struct acpi_gpe_xrupt_info * | 397 | typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info * |
381 | gpe_xrupt_info, | 398 | gpe_xrupt_info, |
382 | struct acpi_gpe_block_info * | 399 | struct acpi_gpe_block_info * |
383 | gpe_block); | 400 | gpe_block); |
@@ -416,13 +433,14 @@ struct acpi_field_info { | |||
416 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 | 433 | #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 |
417 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 | 434 | #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 |
418 | 435 | ||
419 | #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ | 436 | #define ACPI_STATE_COMMON \ |
420 | u8 data_type; /* To differentiate various internal objs */\ | 437 | void *next; \ |
421 | u8 flags; \ | 438 | u8 descriptor_type; /* To differentiate various internal objs */\ |
422 | u16 value; \ | 439 | u8 flags; \ |
423 | u16 state; \ | 440 | u16 value; \ |
424 | u16 reserved; \ | 441 | u16 state; |
425 | void *next; | 442 | |
443 | /* There are 2 bytes available here until the next natural alignment boundary */ | ||
426 | 444 | ||
427 | struct acpi_common_state { | 445 | struct acpi_common_state { |
428 | ACPI_STATE_COMMON}; | 446 | ACPI_STATE_COMMON}; |
@@ -438,12 +456,12 @@ struct acpi_update_state { | |||
438 | * Pkg state - used to traverse nested package structures | 456 | * Pkg state - used to traverse nested package structures |
439 | */ | 457 | */ |
440 | struct acpi_pkg_state { | 458 | struct acpi_pkg_state { |
441 | ACPI_STATE_COMMON union acpi_operand_object *source_object; | 459 | ACPI_STATE_COMMON u16 index; |
460 | union acpi_operand_object *source_object; | ||
442 | union acpi_operand_object *dest_object; | 461 | union acpi_operand_object *dest_object; |
443 | struct acpi_walk_state *walk_state; | 462 | struct acpi_walk_state *walk_state; |
444 | void *this_target_obj; | 463 | void *this_target_obj; |
445 | u32 num_packages; | 464 | u32 num_packages; |
446 | u16 index; | ||
447 | }; | 465 | }; |
448 | 466 | ||
449 | /* | 467 | /* |
@@ -451,10 +469,10 @@ struct acpi_pkg_state { | |||
451 | * Allows nesting of these constructs | 469 | * Allows nesting of these constructs |
452 | */ | 470 | */ |
453 | struct acpi_control_state { | 471 | struct acpi_control_state { |
454 | ACPI_STATE_COMMON union acpi_parse_object *predicate_op; | 472 | ACPI_STATE_COMMON u16 opcode; |
473 | union acpi_parse_object *predicate_op; | ||
455 | u8 *aml_predicate_start; /* Start of if/while predicate */ | 474 | u8 *aml_predicate_start; /* Start of if/while predicate */ |
456 | u8 *package_end; /* End of if/while block */ | 475 | u8 *package_end; /* End of if/while block */ |
457 | u16 opcode; | ||
458 | }; | 476 | }; |
459 | 477 | ||
460 | /* | 478 | /* |
@@ -465,11 +483,11 @@ struct acpi_scope_state { | |||
465 | }; | 483 | }; |
466 | 484 | ||
467 | struct acpi_pscope_state { | 485 | struct acpi_pscope_state { |
468 | ACPI_STATE_COMMON union acpi_parse_object *op; /* Current op being parsed */ | 486 | ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */ |
487 | union acpi_parse_object *op; /* Current op being parsed */ | ||
469 | u8 *arg_end; /* Current argument end */ | 488 | u8 *arg_end; /* Current argument end */ |
470 | u8 *pkg_end; /* Current package end */ | 489 | u8 *pkg_end; /* Current package end */ |
471 | u32 arg_list; /* Next argument to parse */ | 490 | u32 arg_list; /* Next argument to parse */ |
472 | u32 arg_count; /* Number of fixed arguments */ | ||
473 | }; | 491 | }; |
474 | 492 | ||
475 | /* | 493 | /* |
@@ -477,10 +495,10 @@ struct acpi_pscope_state { | |||
477 | * states are created when there are nested control methods executing. | 495 | * states are created when there are nested control methods executing. |
478 | */ | 496 | */ |
479 | struct acpi_thread_state { | 497 | struct acpi_thread_state { |
480 | ACPI_STATE_COMMON struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | 498 | ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */ |
499 | struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ | ||
481 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ | 500 | union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ |
482 | u32 thread_id; /* Running thread ID */ | 501 | acpi_thread_id thread_id; /* Running thread ID */ |
483 | u8 current_sync_level; /* Mutex Sync (nested acquire) level */ | ||
484 | }; | 502 | }; |
485 | 503 | ||
486 | /* | 504 | /* |
@@ -488,10 +506,9 @@ struct acpi_thread_state { | |||
488 | * AML arguments | 506 | * AML arguments |
489 | */ | 507 | */ |
490 | struct acpi_result_values { | 508 | struct acpi_result_values { |
491 | ACPI_STATE_COMMON | 509 | ACPI_STATE_COMMON u8 num_results; |
492 | union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; | ||
493 | u8 num_results; | ||
494 | u8 last_insert; | 510 | u8 last_insert; |
511 | union acpi_operand_object *obj_desc[ACPI_OBJ_NUM_OPERANDS]; | ||
495 | }; | 512 | }; |
496 | 513 | ||
497 | typedef | 514 | typedef |
@@ -546,7 +563,7 @@ struct acpi_opcode_info { | |||
546 | #endif | 563 | #endif |
547 | u32 parse_args; /* Grammar/Parse time arguments */ | 564 | u32 parse_args; /* Grammar/Parse time arguments */ |
548 | u32 runtime_args; /* Interpret time arguments */ | 565 | u32 runtime_args; /* Interpret time arguments */ |
549 | u32 flags; /* Misc flags */ | 566 | u16 flags; /* Misc flags */ |
550 | u8 object_type; /* Corresponding internal object type */ | 567 | u8 object_type; /* Corresponding internal object type */ |
551 | u8 class; /* Opcode class */ | 568 | u8 class; /* Opcode class */ |
552 | u8 type; /* Opcode type */ | 569 | u8 type; /* Opcode type */ |
@@ -563,29 +580,31 @@ union acpi_parse_value { | |||
563 | }; | 580 | }; |
564 | 581 | ||
565 | #define ACPI_PARSE_COMMON \ | 582 | #define ACPI_PARSE_COMMON \ |
566 | u8 data_type; /* To differentiate various internal objs */\ | 583 | union acpi_parse_object *parent; /* Parent op */\ |
567 | u8 flags; /* Type of Op */\ | 584 | u8 descriptor_type; /* To differentiate various internal objs */\ |
568 | u16 aml_opcode; /* AML opcode */\ | 585 | u8 flags; /* Type of Op */\ |
569 | u32 aml_offset; /* Offset of declaration in AML */\ | 586 | u16 aml_opcode; /* AML opcode */\ |
570 | union acpi_parse_object *parent; /* Parent op */\ | 587 | u32 aml_offset; /* Offset of declaration in AML */\ |
571 | union acpi_parse_object *next; /* Next op */\ | 588 | union acpi_parse_object *next; /* Next op */\ |
589 | struct acpi_namespace_node *node; /* For use by interpreter */\ | ||
590 | union acpi_parse_value value; /* Value or args associated with the opcode */\ | ||
572 | ACPI_DISASM_ONLY_MEMBERS (\ | 591 | ACPI_DISASM_ONLY_MEMBERS (\ |
573 | u8 disasm_flags; /* Used during AML disassembly */\ | 592 | u8 disasm_flags; /* Used during AML disassembly */\ |
574 | u8 disasm_opcode; /* Subtype used for disassembly */\ | 593 | u8 disasm_opcode; /* Subtype used for disassembly */\ |
575 | char aml_op_name[16]) /* Op name (debug only) */\ | 594 | char aml_op_name[16]) /* Op name (debug only) */ |
576 | /* NON-DEBUG members below: */\ | 595 | |
577 | struct acpi_namespace_node *node; /* For use by interpreter */\ | 596 | #define ACPI_DASM_BUFFER 0x00 |
578 | union acpi_parse_value value; /* Value or args associated with the opcode */ | 597 | #define ACPI_DASM_RESOURCE 0x01 |
579 | 598 | #define ACPI_DASM_STRING 0x02 | |
580 | #define ACPI_DASM_BUFFER 0x00 | 599 | #define ACPI_DASM_UNICODE 0x03 |
581 | #define ACPI_DASM_RESOURCE 0x01 | 600 | #define ACPI_DASM_EISAID 0x04 |
582 | #define ACPI_DASM_STRING 0x02 | 601 | #define ACPI_DASM_MATCHOP 0x05 |
583 | #define ACPI_DASM_UNICODE 0x03 | 602 | #define ACPI_DASM_LNOT_PREFIX 0x06 |
584 | #define ACPI_DASM_EISAID 0x04 | 603 | #define ACPI_DASM_LNOT_SUFFIX 0x07 |
585 | #define ACPI_DASM_MATCHOP 0x05 | 604 | #define ACPI_DASM_IGNORE 0x08 |
586 | 605 | ||
587 | /* | 606 | /* |
588 | * generic operation (for example: If, While, Store) | 607 | * Generic operation (for example: If, While, Store) |
589 | */ | 608 | */ |
590 | struct acpi_parse_obj_common { | 609 | struct acpi_parse_obj_common { |
591 | ACPI_PARSE_COMMON}; | 610 | ACPI_PARSE_COMMON}; |
@@ -601,7 +620,7 @@ struct acpi_parse_obj_named { | |||
601 | u32 name; /* 4-byte name or zero if no name */ | 620 | u32 name; /* 4-byte name or zero if no name */ |
602 | }; | 621 | }; |
603 | 622 | ||
604 | /* The parse node is the fundamental element of the parse tree */ | 623 | /* This version is used by the i_aSL compiler only */ |
605 | 624 | ||
606 | #define ACPI_MAX_PARSEOP_NAME 20 | 625 | #define ACPI_MAX_PARSEOP_NAME 20 |
607 | 626 | ||
@@ -643,7 +662,6 @@ union acpi_parse_object { | |||
643 | * method. | 662 | * method. |
644 | */ | 663 | */ |
645 | struct acpi_parse_state { | 664 | struct acpi_parse_state { |
646 | u32 aml_size; | ||
647 | u8 *aml_start; /* First AML byte */ | 665 | u8 *aml_start; /* First AML byte */ |
648 | u8 *aml; /* Next AML byte */ | 666 | u8 *aml; /* Next AML byte */ |
649 | u8 *aml_end; /* (last + 1) AML byte */ | 667 | u8 *aml_end; /* (last + 1) AML byte */ |
@@ -653,22 +671,23 @@ struct acpi_parse_state { | |||
653 | struct acpi_namespace_node *start_node; | 671 | struct acpi_namespace_node *start_node; |
654 | union acpi_generic_state *scope; /* Current scope */ | 672 | union acpi_generic_state *scope; /* Current scope */ |
655 | union acpi_parse_object *start_scope; | 673 | union acpi_parse_object *start_scope; |
674 | u32 aml_size; | ||
656 | }; | 675 | }; |
657 | 676 | ||
658 | /* Parse object flags */ | 677 | /* Parse object flags */ |
659 | 678 | ||
660 | #define ACPI_PARSEOP_GENERIC 0x01 | 679 | #define ACPI_PARSEOP_GENERIC 0x01 |
661 | #define ACPI_PARSEOP_NAMED 0x02 | 680 | #define ACPI_PARSEOP_NAMED 0x02 |
662 | #define ACPI_PARSEOP_DEFERRED 0x04 | 681 | #define ACPI_PARSEOP_DEFERRED 0x04 |
663 | #define ACPI_PARSEOP_BYTELIST 0x08 | 682 | #define ACPI_PARSEOP_BYTELIST 0x08 |
664 | #define ACPI_PARSEOP_IN_CACHE 0x80 | 683 | #define ACPI_PARSEOP_IN_CACHE 0x80 |
665 | 684 | ||
666 | /* Parse object disasm_flags */ | 685 | /* Parse object disasm_flags */ |
667 | 686 | ||
668 | #define ACPI_PARSEOP_IGNORE 0x01 | 687 | #define ACPI_PARSEOP_IGNORE 0x01 |
669 | #define ACPI_PARSEOP_PARAMLIST 0x02 | 688 | #define ACPI_PARSEOP_PARAMLIST 0x02 |
670 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 | 689 | #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 |
671 | #define ACPI_PARSEOP_SPECIAL 0x10 | 690 | #define ACPI_PARSEOP_SPECIAL 0x10 |
672 | 691 | ||
673 | /***************************************************************************** | 692 | /***************************************************************************** |
674 | * | 693 | * |
@@ -676,8 +695,8 @@ struct acpi_parse_state { | |||
676 | * | 695 | * |
677 | ****************************************************************************/ | 696 | ****************************************************************************/ |
678 | 697 | ||
679 | #define PCI_ROOT_HID_STRING "PNP0A03" | 698 | #define PCI_ROOT_HID_STRING "PNP0A03" |
680 | #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" | 699 | #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08" |
681 | 700 | ||
682 | struct acpi_bit_register_info { | 701 | struct acpi_bit_register_info { |
683 | u8 parent_register; | 702 | u8 parent_register; |
@@ -710,13 +729,14 @@ struct acpi_bit_register_info { | |||
710 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ | 729 | #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ |
711 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 | 730 | #define ACPI_BITMASK_WAKE_STATUS 0x8000 |
712 | 731 | ||
713 | #define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \ | 732 | #define ACPI_BITMASK_ALL_FIXED_STATUS (\ |
714 | ACPI_BITMASK_BUS_MASTER_STATUS | \ | 733 | ACPI_BITMASK_TIMER_STATUS | \ |
715 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ | 734 | ACPI_BITMASK_BUS_MASTER_STATUS | \ |
716 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ | 735 | ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ |
717 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ | 736 | ACPI_BITMASK_POWER_BUTTON_STATUS | \ |
718 | ACPI_BITMASK_RT_CLOCK_STATUS | \ | 737 | ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ |
719 | ACPI_BITMASK_WAKE_STATUS) | 738 | ACPI_BITMASK_RT_CLOCK_STATUS | \ |
739 | ACPI_BITMASK_WAKE_STATUS) | ||
720 | 740 | ||
721 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 | 741 | #define ACPI_BITMASK_TIMER_ENABLE 0x0001 |
722 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 | 742 | #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 |
@@ -820,7 +840,7 @@ struct acpi_bit_register_info { | |||
820 | * | 840 | * |
821 | ****************************************************************************/ | 841 | ****************************************************************************/ |
822 | 842 | ||
823 | #define ACPI_ASCII_ZERO 0x30 | 843 | #define ACPI_ASCII_ZERO 0x30 |
824 | 844 | ||
825 | /***************************************************************************** | 845 | /***************************************************************************** |
826 | * | 846 | * |
@@ -842,9 +862,9 @@ struct acpi_integrity_info { | |||
842 | u32 objects; | 862 | u32 objects; |
843 | }; | 863 | }; |
844 | 864 | ||
845 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 | 865 | #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 |
846 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 | 866 | #define ACPI_DB_CONSOLE_OUTPUT 0x02 |
847 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 | 867 | #define ACPI_DB_DUPLICATE_OUTPUT 0x03 |
848 | 868 | ||
849 | /***************************************************************************** | 869 | /***************************************************************************** |
850 | * | 870 | * |
@@ -854,18 +874,18 @@ struct acpi_integrity_info { | |||
854 | 874 | ||
855 | /* Entry for a memory allocation (debug only) */ | 875 | /* Entry for a memory allocation (debug only) */ |
856 | 876 | ||
857 | #define ACPI_MEM_MALLOC 0 | 877 | #define ACPI_MEM_MALLOC 0 |
858 | #define ACPI_MEM_CALLOC 1 | 878 | #define ACPI_MEM_CALLOC 1 |
859 | #define ACPI_MAX_MODULE_NAME 16 | 879 | #define ACPI_MAX_MODULE_NAME 16 |
860 | 880 | ||
861 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ | 881 | #define ACPI_COMMON_DEBUG_MEM_HEADER \ |
862 | struct acpi_debug_mem_block *previous; \ | 882 | struct acpi_debug_mem_block *previous; \ |
863 | struct acpi_debug_mem_block *next; \ | 883 | struct acpi_debug_mem_block *next; \ |
864 | u32 size; \ | 884 | u32 size; \ |
865 | u32 component; \ | 885 | u32 component; \ |
866 | u32 line; \ | 886 | u32 line; \ |
867 | char module[ACPI_MAX_MODULE_NAME]; \ | 887 | char module[ACPI_MAX_MODULE_NAME]; \ |
868 | u8 alloc_type; | 888 | u8 alloc_type; |
869 | 889 | ||
870 | struct acpi_debug_mem_header { | 890 | struct acpi_debug_mem_header { |
871 | ACPI_COMMON_DEBUG_MEM_HEADER}; | 891 | ACPI_COMMON_DEBUG_MEM_HEADER}; |
diff --git a/include/acpi/acmacros.h b/include/acpi/acmacros.h index f2be2a881730..38f9aa4bef00 100644 --- a/include/acpi/acmacros.h +++ b/include/acpi/acmacros.h | |||
@@ -56,6 +56,10 @@ | |||
56 | #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) | 56 | #define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) |
57 | #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) | 57 | #define ACPI_MIN(a,b) (((a)<(b))?(a):(b)) |
58 | 58 | ||
59 | /* Size calculation */ | ||
60 | |||
61 | #define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0])) | ||
62 | |||
59 | #if ACPI_MACHINE_WIDTH == 16 | 63 | #if ACPI_MACHINE_WIDTH == 16 |
60 | 64 | ||
61 | /* | 65 | /* |
@@ -99,7 +103,7 @@ | |||
99 | * printf() format helpers | 103 | * printf() format helpers |
100 | */ | 104 | */ |
101 | 105 | ||
102 | /* Split 64-bit integer into two 32-bit values. Use with %8.8X%8.8X */ | 106 | /* Split 64-bit integer into two 32-bit values. Use with %8.8_x%8.8_x */ |
103 | 107 | ||
104 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) | 108 | #define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i) |
105 | 109 | ||
@@ -130,7 +134,6 @@ | |||
130 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) | 134 | #define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(acpi_native_uint) i) |
131 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) | 135 | #define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) |
132 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) | 136 | #define ACPI_OFFSET(d,f) (acpi_size) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) |
133 | #define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) | ||
134 | 137 | ||
135 | #if ACPI_MACHINE_WIDTH == 16 | 138 | #if ACPI_MACHINE_WIDTH == 16 |
136 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) | 139 | #define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s) |
@@ -141,6 +144,12 @@ | |||
141 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) | 144 | #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) |
142 | #endif | 145 | #endif |
143 | 146 | ||
147 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | ||
148 | #define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (u32,(a)) == *ACPI_CAST_PTR (u32,(b))) | ||
149 | #else | ||
150 | #define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE)) | ||
151 | #endif | ||
152 | |||
144 | /* | 153 | /* |
145 | * Macros for moving data around to/from buffers that are possibly unaligned. | 154 | * Macros for moving data around to/from buffers that are possibly unaligned. |
146 | * If the hardware supports the transfer of unaligned data, just do the store. | 155 | * If the hardware supports the transfer of unaligned data, just do the store. |
@@ -341,29 +350,33 @@ | |||
341 | /* | 350 | /* |
342 | * Rounding macros (Power of two boundaries only) | 351 | * Rounding macros (Power of two boundaries only) |
343 | */ | 352 | */ |
344 | #define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ | 353 | #define ACPI_ROUND_DOWN(value,boundary) (((acpi_native_uint)(value)) & \ |
345 | (~(((acpi_native_uint) boundary)-1))) | 354 | (~(((acpi_native_uint) boundary)-1))) |
346 | 355 | ||
347 | #define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ | 356 | #define ACPI_ROUND_UP(value,boundary) ((((acpi_native_uint)(value)) + \ |
348 | (((acpi_native_uint) boundary)-1)) & \ | 357 | (((acpi_native_uint) boundary)-1)) & \ |
349 | (~(((acpi_native_uint) boundary)-1))) | 358 | (~(((acpi_native_uint) boundary)-1))) |
350 | 359 | ||
351 | #define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) | 360 | /* Note: sizeof(acpi_native_uint) evaluates to either 2, 4, or 8 */ |
352 | #define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) | 361 | |
353 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY) | 362 | #define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4) |
363 | #define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8) | ||
364 | #define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(acpi_native_uint)) | ||
354 | 365 | ||
355 | #define ACPI_ROUND_UP_to_32_bITS(a) ACPI_ROUND_UP(a,4) | 366 | #define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4) |
356 | #define ACPI_ROUND_UP_to_64_bITS(a) ACPI_ROUND_UP(a,8) | 367 | #define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8) |
357 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY) | 368 | #define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(acpi_native_uint)) |
358 | 369 | ||
359 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) | 370 | #define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7) |
360 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) | 371 | #define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a)) |
361 | 372 | ||
362 | #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) | 373 | #define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) |
363 | 374 | ||
364 | /* Generic (non-power-of-two) rounding */ | 375 | /* Generic (non-power-of-two) rounding */ |
365 | 376 | ||
366 | #define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) | 377 | #define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) |
378 | |||
379 | #define ACPI_IS_MISALIGNED(value) (((acpi_native_uint)value) & (sizeof(acpi_native_uint)-1)) | ||
367 | 380 | ||
368 | /* | 381 | /* |
369 | * Bitmask creation | 382 | * Bitmask creation |
@@ -371,10 +384,10 @@ | |||
371 | * MASK_BITS_ABOVE creates a mask starting AT the position and above | 384 | * MASK_BITS_ABOVE creates a mask starting AT the position and above |
372 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position | 385 | * MASK_BITS_BELOW creates a mask starting one bit BELOW the position |
373 | */ | 386 | */ |
374 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) | 387 | #define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((u32) (position)))) |
375 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) | 388 | #define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((u32) (position))) |
376 | 389 | ||
377 | #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) | 390 | #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) |
378 | 391 | ||
379 | /* Bitfields within ACPI registers */ | 392 | /* Bitfields within ACPI registers */ |
380 | 393 | ||
@@ -396,8 +409,8 @@ | |||
396 | * | 409 | * |
397 | * The "Descriptor" field is the first field in both structures. | 410 | * The "Descriptor" field is the first field in both structures. |
398 | */ | 411 | */ |
399 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->descriptor_id) | 412 | #define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type) |
400 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->descriptor_id = t) | 413 | #define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t) |
401 | 414 | ||
402 | /* Macro to test the object type */ | 415 | /* Macro to test the object type */ |
403 | 416 | ||
@@ -486,7 +499,6 @@ | |||
486 | #define ACPI_ERROR(plist) | 499 | #define ACPI_ERROR(plist) |
487 | #define ACPI_ERROR_NAMESPACE(s,e) | 500 | #define ACPI_ERROR_NAMESPACE(s,e) |
488 | #define ACPI_ERROR_METHOD(s,n,p,e) | 501 | #define ACPI_ERROR_METHOD(s,n,p,e) |
489 | |||
490 | #endif | 502 | #endif |
491 | 503 | ||
492 | /* | 504 | /* |
@@ -514,12 +526,12 @@ | |||
514 | #define ACPI_GET_FUNCTION_NAME _acpi_function_name | 526 | #define ACPI_GET_FUNCTION_NAME _acpi_function_name |
515 | /* | 527 | /* |
516 | * The Name parameter should be the procedure name as a quoted string. | 528 | * The Name parameter should be the procedure name as a quoted string. |
517 | * This is declared as a local string ("my_function_name") so that it can | 529 | * This is declared as a local string ("MyFunctionName") so that it can |
518 | * be also used by the function exit macros below. | 530 | * be also used by the function exit macros below. |
519 | * Note: (const char) is used to be compatible with the debug interfaces | 531 | * Note: (const char) is used to be compatible with the debug interfaces |
520 | * and macros such as __FUNCTION__. | 532 | * and macros such as __FUNCTION__. |
521 | */ | 533 | */ |
522 | #define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = name; | 534 | #define ACPI_FUNCTION_NAME(name) const char *_acpi_function_name = #name; |
523 | 535 | ||
524 | #else | 536 | #else |
525 | /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ | 537 | /* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */ |
@@ -528,13 +540,13 @@ | |||
528 | #endif | 540 | #endif |
529 | 541 | ||
530 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ | 542 | #define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \ |
531 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) | 543 | acpi_ut_trace(ACPI_DEBUG_PARAMETERS) |
532 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ | 544 | #define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \ |
533 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) | 545 | acpi_ut_trace_ptr(ACPI_DEBUG_PARAMETERS,(void *)b) |
534 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ | 546 | #define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \ |
535 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) | 547 | acpi_ut_trace_u32(ACPI_DEBUG_PARAMETERS,(u32)b) |
536 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ | 548 | #define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \ |
537 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) | 549 | acpi_ut_trace_str(ACPI_DEBUG_PARAMETERS,(char *)b) |
538 | 550 | ||
539 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() | 551 | #define ACPI_FUNCTION_ENTRY() acpi_ut_track_stack_ptr() |
540 | 552 | ||
@@ -543,7 +555,7 @@ | |||
543 | * WARNING: These macros include a return statement. This is usually considered | 555 | * WARNING: These macros include a return statement. This is usually considered |
544 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. | 556 | * bad form, but having a separate exit macro is very ugly and difficult to maintain. |
545 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros | 557 | * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros |
546 | * so that "_acpi_function_name" is defined. | 558 | * so that "_AcpiFunctionName" is defined. |
547 | * | 559 | * |
548 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining | 560 | * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining |
549 | * about these constructs. | 561 | * about these constructs. |
@@ -654,6 +666,7 @@ | |||
654 | #define ACPI_DUMP_STACK_ENTRY(a) | 666 | #define ACPI_DUMP_STACK_ENTRY(a) |
655 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) | 667 | #define ACPI_DUMP_OPERANDS(a,b,c,d,e) |
656 | #define ACPI_DUMP_ENTRY(a,b) | 668 | #define ACPI_DUMP_ENTRY(a,b) |
669 | #define ACPI_DUMP_TABLES(a,b) | ||
657 | #define ACPI_DUMP_PATHNAME(a,b,c,d) | 670 | #define ACPI_DUMP_PATHNAME(a,b,c,d) |
658 | #define ACPI_DUMP_RESOURCE_LIST(a) | 671 | #define ACPI_DUMP_RESOURCE_LIST(a) |
659 | #define ACPI_DUMP_BUFFER(a,b) | 672 | #define ACPI_DUMP_BUFFER(a,b) |
@@ -709,19 +722,19 @@ | |||
709 | 722 | ||
710 | /* Memory allocation */ | 723 | /* Memory allocation */ |
711 | 724 | ||
712 | #define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 725 | #define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) |
713 | #define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 726 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) |
714 | #define ACPI_MEM_FREE(a) acpi_os_free(a) | 727 | #define ACPI_FREE(a) acpi_os_free(a) |
715 | #define ACPI_MEM_TRACKING(a) | 728 | #define ACPI_MEM_TRACKING(a) |
716 | 729 | ||
717 | #else | 730 | #else |
718 | 731 | ||
719 | /* Memory allocation */ | 732 | /* Memory allocation */ |
720 | 733 | ||
721 | #define ACPI_MEM_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) | 734 | #define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size)(a),_COMPONENT,_acpi_module_name,__LINE__) |
722 | #define ACPI_MEM_CALLOCATE(a) acpi_ut_callocate_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) | 735 | #define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size)(a), _COMPONENT,_acpi_module_name,__LINE__) |
723 | #define ACPI_MEM_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) | 736 | #define ACPI_FREE(a) acpi_ut_free_and_track(a,_COMPONENT,_acpi_module_name,__LINE__) |
724 | #define ACPI_MEM_TRACKING(a) a | 737 | #define ACPI_MEM_TRACKING(a) a |
725 | 738 | ||
726 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ | 739 | #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ |
727 | 740 | ||
diff --git a/include/acpi/acnamesp.h b/include/acpi/acnamesp.h index b667a804fc8a..83b52f9f899a 100644 --- a/include/acpi/acnamesp.h +++ b/include/acpi/acnamesp.h | |||
@@ -63,6 +63,8 @@ | |||
63 | #define ACPI_NS_DONT_OPEN_SCOPE 0x02 | 63 | #define ACPI_NS_DONT_OPEN_SCOPE 0x02 |
64 | #define ACPI_NS_NO_PEER_SEARCH 0x04 | 64 | #define ACPI_NS_NO_PEER_SEARCH 0x04 |
65 | #define ACPI_NS_ERROR_IF_FOUND 0x08 | 65 | #define ACPI_NS_ERROR_IF_FOUND 0x08 |
66 | #define ACPI_NS_PREFIX_IS_SCOPE 0x10 | ||
67 | #define ACPI_NS_EXTERNAL 0x20 | ||
66 | 68 | ||
67 | #define ACPI_NS_WALK_UNLOCK TRUE | 69 | #define ACPI_NS_WALK_UNLOCK TRUE |
68 | #define ACPI_NS_WALK_NO_UNLOCK FALSE | 70 | #define ACPI_NS_WALK_NO_UNLOCK FALSE |
@@ -171,19 +173,17 @@ acpi_ns_dump_objects(acpi_object_type type, | |||
171 | /* | 173 | /* |
172 | * nseval - Namespace evaluation functions | 174 | * nseval - Namespace evaluation functions |
173 | */ | 175 | */ |
174 | acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info); | 176 | acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info); |
175 | |||
176 | acpi_status | ||
177 | acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info); | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info); | ||
181 | 177 | ||
182 | /* | 178 | /* |
183 | * nsnames - Name and Scope manipulation | 179 | * nsnames - Name and Scope manipulation |
184 | */ | 180 | */ |
185 | u32 acpi_ns_opens_scope(acpi_object_type type); | 181 | u32 acpi_ns_opens_scope(acpi_object_type type); |
186 | 182 | ||
183 | void | ||
184 | acpi_ns_build_external_path(struct acpi_namespace_node *node, | ||
185 | acpi_size size, char *name_buffer); | ||
186 | |||
187 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); | 187 | char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node); |
188 | 188 | ||
189 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); | 189 | char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state); |
@@ -196,9 +196,9 @@ u8 | |||
196 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); | 196 | acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for); |
197 | 197 | ||
198 | acpi_status | 198 | acpi_status |
199 | acpi_ns_get_node_by_path(char *external_pathname, | 199 | acpi_ns_get_node(struct acpi_namespace_node *prefix_node, |
200 | struct acpi_namespace_node *in_prefix_node, | 200 | char *external_pathname, |
201 | u32 flags, struct acpi_namespace_node **out_node); | 201 | u32 flags, struct acpi_namespace_node **out_node); |
202 | 202 | ||
203 | acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); | 203 | acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node); |
204 | 204 | ||
@@ -241,10 +241,10 @@ acpi_ns_search_and_enter(u32 entry_name, | |||
241 | u32 flags, struct acpi_namespace_node **ret_node); | 241 | u32 flags, struct acpi_namespace_node **ret_node); |
242 | 242 | ||
243 | acpi_status | 243 | acpi_status |
244 | acpi_ns_search_node(u32 entry_name, | 244 | acpi_ns_search_one_scope(u32 entry_name, |
245 | struct acpi_namespace_node *node, | 245 | struct acpi_namespace_node *node, |
246 | acpi_object_type type, | 246 | acpi_object_type type, |
247 | struct acpi_namespace_node **ret_node); | 247 | struct acpi_namespace_node **ret_node); |
248 | 248 | ||
249 | void | 249 | void |
250 | acpi_ns_install_node(struct acpi_walk_state *walk_state, | 250 | acpi_ns_install_node(struct acpi_walk_state *walk_state, |
diff --git a/include/acpi/acobject.h b/include/acpi/acobject.h index d130cfed8d55..1747d94084d8 100644 --- a/include/acpi/acobject.h +++ b/include/acpi/acobject.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /****************************************************************************** | 2 | /****************************************************************************** |
3 | * | 3 | * |
4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) | 4 | * Name: acobject.h - Definition of union acpi_operand_object (Internal object only) |
5 | * | 5 | * |
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
@@ -45,10 +45,12 @@ | |||
45 | #ifndef _ACOBJECT_H | 45 | #ifndef _ACOBJECT_H |
46 | #define _ACOBJECT_H | 46 | #define _ACOBJECT_H |
47 | 47 | ||
48 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
49 | |||
48 | /* | 50 | /* |
49 | * The union acpi_operand_object is used to pass AML operands from the dispatcher | 51 | * The union acpi_operand_object is used to pass AML operands from the dispatcher |
50 | * to the interpreter, and to keep track of the various handlers such as | 52 | * to the interpreter, and to keep track of the various handlers such as |
51 | * address space handlers and notify handlers. The object is a constant | 53 | * address space handlers and notify handlers. The object is a constant |
52 | * size in order to allow it to be cached and reused. | 54 | * size in order to allow it to be cached and reused. |
53 | */ | 55 | */ |
54 | 56 | ||
@@ -61,17 +63,25 @@ | |||
61 | /* | 63 | /* |
62 | * Common area for all objects. | 64 | * Common area for all objects. |
63 | * | 65 | * |
64 | * data_type is used to differentiate between internal descriptors, and MUST | 66 | * descriptor_type is used to differentiate between internal descriptors, and |
65 | * be the first byte in this structure. | 67 | * must be in the same place across all descriptors |
68 | * | ||
69 | * Note: The descriptor_type and Type fields must appear in the identical | ||
70 | * position in both the struct acpi_namespace_node and union acpi_operand_object | ||
71 | * structures. | ||
66 | */ | 72 | */ |
67 | #define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\ | 73 | #define ACPI_OBJECT_COMMON_HEADER \ |
68 | u8 descriptor; /* To differentiate various internal objs */\ | 74 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ |
69 | u8 type; /* acpi_object_type */\ | 75 | u8 descriptor_type; /* To differentiate various internal objs */\ |
70 | u16 reference_count; /* For object deletion management */\ | 76 | u8 type; /* acpi_object_type */\ |
71 | union acpi_operand_object *next_object; /* Objects linked to parent NS node */\ | 77 | u16 reference_count; /* For object deletion management */\ |
72 | u8 flags; | 78 | u8 flags; |
73 | 79 | /* | |
74 | /* Values for flag byte above */ | 80 | * Note: There are 3 bytes available here before the |
81 | * next natural alignment boundary (for both 32/64 cases) | ||
82 | */ | ||
83 | |||
84 | /* Values for Flag byte above */ | ||
75 | 85 | ||
76 | #define AOPOBJ_AML_CONSTANT 0x01 | 86 | #define AOPOBJ_AML_CONSTANT 0x01 |
77 | #define AOPOBJ_STATIC_POINTER 0x02 | 87 | #define AOPOBJ_STATIC_POINTER 0x02 |
@@ -79,36 +89,7 @@ | |||
79 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 | 89 | #define AOPOBJ_OBJECT_INITIALIZED 0x08 |
80 | #define AOPOBJ_SETUP_COMPLETE 0x10 | 90 | #define AOPOBJ_SETUP_COMPLETE 0x10 |
81 | #define AOPOBJ_SINGLE_DATUM 0x20 | 91 | #define AOPOBJ_SINGLE_DATUM 0x20 |
82 | 92 | #define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ | |
83 | /* | ||
84 | * Common bitfield for the field objects | ||
85 | * "Field Datum" -- a datum from the actual field object | ||
86 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
87 | */ | ||
88 | #define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ | ||
89 | u8 field_flags; /* Access, update, and lock bits */\ | ||
90 | u8 attribute; /* From access_as keyword */\ | ||
91 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
92 | u32 bit_length; /* Length of field in bits */\ | ||
93 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
94 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
95 | u8 access_bit_width; /* Read/Write size in bits (8-64) */\ | ||
96 | u32 value; /* Value to store into the Bank or Index register */\ | ||
97 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
98 | |||
99 | /* | ||
100 | * Fields common to both Strings and Buffers | ||
101 | */ | ||
102 | #define ACPI_COMMON_BUFFER_INFO \ | ||
103 | u32 length; | ||
104 | |||
105 | /* | ||
106 | * Common fields for objects that support ASL notifications | ||
107 | */ | ||
108 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
109 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
110 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
111 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
112 | 93 | ||
113 | /****************************************************************************** | 94 | /****************************************************************************** |
114 | * | 95 | * |
@@ -125,25 +106,31 @@ struct acpi_object_integer { | |||
125 | 106 | ||
126 | /* | 107 | /* |
127 | * Note: The String and Buffer object must be identical through the Pointer | 108 | * Note: The String and Buffer object must be identical through the Pointer |
128 | * element. There is code that depends on this. | 109 | * and length elements. There is code that depends on this. |
110 | * | ||
111 | * Fields common to both Strings and Buffers | ||
129 | */ | 112 | */ |
113 | #define ACPI_COMMON_BUFFER_INFO(_type) \ | ||
114 | _type *pointer; \ | ||
115 | u32 length; | ||
116 | |||
130 | struct acpi_object_string { /* Null terminated, ASCII characters only */ | 117 | struct acpi_object_string { /* Null terminated, ASCII characters only */ |
131 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO char *pointer; /* String in AML stream or allocated string */ | 118 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */ |
132 | }; | 119 | }; |
133 | 120 | ||
134 | struct acpi_object_buffer { | 121 | struct acpi_object_buffer { |
135 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO u8 * pointer; /* Buffer in AML stream or allocated buffer */ | 122 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */ |
136 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
137 | u8 *aml_start; | ||
138 | u32 aml_length; | 123 | u32 aml_length; |
124 | u8 *aml_start; | ||
125 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
139 | }; | 126 | }; |
140 | 127 | ||
141 | struct acpi_object_package { | 128 | struct acpi_object_package { |
142 | ACPI_OBJECT_COMMON_HEADER u32 count; /* # of elements in package */ | 129 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */ |
143 | u32 aml_length; | ||
144 | u8 *aml_start; | ||
145 | struct acpi_namespace_node *node; /* Link back to parent node */ | ||
146 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ | 130 | union acpi_operand_object **elements; /* Array of pointers to acpi_objects */ |
131 | u8 *aml_start; | ||
132 | u32 aml_length; | ||
133 | u32 count; /* # of elements in package */ | ||
147 | }; | 134 | }; |
148 | 135 | ||
149 | /****************************************************************************** | 136 | /****************************************************************************** |
@@ -156,23 +143,6 @@ struct acpi_object_event { | |||
156 | ACPI_OBJECT_COMMON_HEADER void *semaphore; | 143 | ACPI_OBJECT_COMMON_HEADER void *semaphore; |
157 | }; | 144 | }; |
158 | 145 | ||
159 | #define ACPI_INFINITE_CONCURRENCY 0xFF | ||
160 | |||
161 | typedef | ||
162 | acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); | ||
163 | |||
164 | struct acpi_object_method { | ||
165 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
166 | u8 param_count; | ||
167 | u32 aml_length; | ||
168 | void *semaphore; | ||
169 | u8 *aml_start; | ||
170 | ACPI_INTERNAL_METHOD implementation; | ||
171 | u8 concurrency; | ||
172 | u8 thread_count; | ||
173 | acpi_owner_id owner_id; | ||
174 | }; | ||
175 | |||
176 | struct acpi_object_mutex { | 146 | struct acpi_object_mutex { |
177 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ | 147 | ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */ |
178 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ | 148 | u16 acquisition_depth; /* Allow multiple Acquires, same thread */ |
@@ -186,11 +156,23 @@ struct acpi_object_mutex { | |||
186 | 156 | ||
187 | struct acpi_object_region { | 157 | struct acpi_object_region { |
188 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 158 | ACPI_OBJECT_COMMON_HEADER u8 space_id; |
189 | union acpi_operand_object *handler; /* Handler for region access */ | ||
190 | struct acpi_namespace_node *node; /* Containing namespace node */ | 159 | struct acpi_namespace_node *node; /* Containing namespace node */ |
160 | union acpi_operand_object *handler; /* Handler for region access */ | ||
191 | union acpi_operand_object *next; | 161 | union acpi_operand_object *next; |
192 | u32 length; | ||
193 | acpi_physical_address address; | 162 | acpi_physical_address address; |
163 | u32 length; | ||
164 | }; | ||
165 | |||
166 | struct acpi_object_method { | ||
167 | ACPI_OBJECT_COMMON_HEADER u8 method_flags; | ||
168 | u8 param_count; | ||
169 | u8 concurrency; | ||
170 | void *semaphore; | ||
171 | u8 *aml_start; | ||
172 | ACPI_INTERNAL_METHOD implementation; | ||
173 | u32 aml_length; | ||
174 | u8 thread_count; | ||
175 | acpi_owner_id owner_id; | ||
194 | }; | 176 | }; |
195 | 177 | ||
196 | /****************************************************************************** | 178 | /****************************************************************************** |
@@ -199,6 +181,14 @@ struct acpi_object_region { | |||
199 | * | 181 | * |
200 | *****************************************************************************/ | 182 | *****************************************************************************/ |
201 | 183 | ||
184 | /* | ||
185 | * Common fields for objects that support ASL notifications | ||
186 | */ | ||
187 | #define ACPI_COMMON_NOTIFY_INFO \ | ||
188 | union acpi_operand_object *system_notify; /* Handler for system notifies */\ | ||
189 | union acpi_operand_object *device_notify; /* Handler for driver notifies */\ | ||
190 | union acpi_operand_object *handler; /* Handler for Address space */ | ||
191 | |||
202 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ | 192 | struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */ |
203 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | 193 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; |
204 | 194 | ||
@@ -213,9 +203,9 @@ struct acpi_object_power_resource { | |||
213 | }; | 203 | }; |
214 | 204 | ||
215 | struct acpi_object_processor { | 205 | struct acpi_object_processor { |
216 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 proc_id; | 206 | ACPI_OBJECT_COMMON_HEADER u8 proc_id; |
217 | u32 length; | 207 | u8 length; |
218 | acpi_io_address address; | 208 | ACPI_COMMON_NOTIFY_INFO acpi_io_address address; |
219 | }; | 209 | }; |
220 | 210 | ||
221 | struct acpi_object_thermal_zone { | 211 | struct acpi_object_thermal_zone { |
@@ -227,9 +217,24 @@ ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO}; | |||
227 | * | 217 | * |
228 | *****************************************************************************/ | 218 | *****************************************************************************/ |
229 | 219 | ||
220 | /* | ||
221 | * Common bitfield for the field objects | ||
222 | * "Field Datum" -- a datum from the actual field object | ||
223 | * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field | ||
224 | */ | ||
225 | #define ACPI_COMMON_FIELD_INFO \ | ||
226 | u8 field_flags; /* Access, update, and lock bits */\ | ||
227 | u8 attribute; /* From access_as keyword */\ | ||
228 | u8 access_byte_width; /* Read/Write size in bytes */\ | ||
229 | struct acpi_namespace_node *node; /* Link back to parent node */\ | ||
230 | u32 bit_length; /* Length of field in bits */\ | ||
231 | u32 base_byte_offset; /* Byte offset within containing object */\ | ||
232 | u32 value; /* Value to store into the Bank or Index register */\ | ||
233 | u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\ | ||
234 | u8 access_bit_width; /* Read/Write size in bits (8-64) */ | ||
235 | |||
230 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ | 236 | struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ |
231 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing Operation Region object */ | 237 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */ |
232 | /* (REGION/BANK fields only) */ | ||
233 | }; | 238 | }; |
234 | 239 | ||
235 | struct acpi_object_region_field { | 240 | struct acpi_object_region_field { |
@@ -244,7 +249,7 @@ struct acpi_object_bank_field { | |||
244 | struct acpi_object_index_field { | 249 | struct acpi_object_index_field { |
245 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO | 250 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO |
246 | /* | 251 | /* |
247 | * No "region_obj" pointer needed since the Index and Data registers | 252 | * No "RegionObj" pointer needed since the Index and Data registers |
248 | * are each field definitions unto themselves. | 253 | * are each field definitions unto themselves. |
249 | */ | 254 | */ |
250 | union acpi_operand_object *index_obj; /* Index register */ | 255 | union acpi_operand_object *index_obj; /* Index register */ |
@@ -269,13 +274,9 @@ struct acpi_object_notify_handler { | |||
269 | void *context; | 274 | void *context; |
270 | }; | 275 | }; |
271 | 276 | ||
272 | /* Flags for address handler */ | ||
273 | |||
274 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1 | ||
275 | |||
276 | struct acpi_object_addr_handler { | 277 | struct acpi_object_addr_handler { |
277 | ACPI_OBJECT_COMMON_HEADER u8 space_id; | 278 | ACPI_OBJECT_COMMON_HEADER u8 space_id; |
278 | u16 hflags; | 279 | u8 handler_flags; |
279 | acpi_adr_space_handler handler; | 280 | acpi_adr_space_handler handler; |
280 | struct acpi_namespace_node *node; /* Parent device */ | 281 | struct acpi_namespace_node *node; /* Parent device */ |
281 | void *context; | 282 | void *context; |
@@ -284,6 +285,10 @@ struct acpi_object_addr_handler { | |||
284 | union acpi_operand_object *next; | 285 | union acpi_operand_object *next; |
285 | }; | 286 | }; |
286 | 287 | ||
288 | /* Flags for address handler (handler_flags) */ | ||
289 | |||
290 | #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01 | ||
291 | |||
287 | /****************************************************************************** | 292 | /****************************************************************************** |
288 | * | 293 | * |
289 | * Special internal objects | 294 | * Special internal objects |
@@ -297,10 +302,10 @@ struct acpi_object_addr_handler { | |||
297 | struct acpi_object_reference { | 302 | struct acpi_object_reference { |
298 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ | 303 | ACPI_OBJECT_COMMON_HEADER u8 target_type; /* Used for index_op */ |
299 | u16 opcode; | 304 | u16 opcode; |
300 | u32 offset; /* Used for arg_op, local_op, and index_op */ | 305 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ |
301 | void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */ | ||
302 | struct acpi_namespace_node *node; | 306 | struct acpi_namespace_node *node; |
303 | union acpi_operand_object **where; | 307 | union acpi_operand_object **where; |
308 | u32 offset; /* Used for arg_op, local_op, and index_op */ | ||
304 | }; | 309 | }; |
305 | 310 | ||
306 | /* | 311 | /* |
@@ -311,12 +316,10 @@ struct acpi_object_reference { | |||
311 | * Currently: Region and field_unit types | 316 | * Currently: Region and field_unit types |
312 | */ | 317 | */ |
313 | struct acpi_object_extra { | 318 | struct acpi_object_extra { |
314 | ACPI_OBJECT_COMMON_HEADER u8 byte_fill1; | 319 | ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ |
315 | u16 word_fill1; | ||
316 | u32 aml_length; | ||
317 | u8 *aml_start; | ||
318 | struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */ | ||
319 | void *region_context; /* Region-specific data */ | 320 | void *region_context; /* Region-specific data */ |
321 | u8 *aml_start; | ||
322 | u32 aml_length; | ||
320 | }; | 323 | }; |
321 | 324 | ||
322 | /* Additional data that can be attached to namespace nodes */ | 325 | /* Additional data that can be attached to namespace nodes */ |
@@ -391,8 +394,13 @@ union acpi_operand_object { | |||
391 | #define ACPI_DESC_TYPE_NAMED 0x0F | 394 | #define ACPI_DESC_TYPE_NAMED 0x0F |
392 | #define ACPI_DESC_TYPE_MAX 0x0F | 395 | #define ACPI_DESC_TYPE_MAX 0x0F |
393 | 396 | ||
397 | struct acpi_common_descriptor { | ||
398 | void *common_pointer; | ||
399 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
400 | }; | ||
401 | |||
394 | union acpi_descriptor { | 402 | union acpi_descriptor { |
395 | u8 descriptor_id; /* To differentiate various internal objs */ | 403 | struct acpi_common_descriptor common; |
396 | union acpi_operand_object object; | 404 | union acpi_operand_object object; |
397 | struct acpi_namespace_node node; | 405 | struct acpi_namespace_node node; |
398 | union acpi_parse_object op; | 406 | union acpi_parse_object op; |
diff --git a/include/acpi/acopcode.h b/include/acpi/acopcode.h index e6d78bd9e90a..7659a46bc432 100644 --- a/include/acpi/acopcode.h +++ b/include/acpi/acopcode.h | |||
@@ -94,7 +94,7 @@ | |||
94 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) | 94 | #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) |
95 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) | 95 | #define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) |
96 | #define ARGP_CONTINUE_OP ARG_NONE | 96 | #define ARGP_CONTINUE_OP ARG_NONE |
97 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME) | 97 | #define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) |
98 | #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | 98 | #define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) |
99 | #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | 99 | #define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) |
100 | #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) | 100 | #define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) |
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 7785d481dc3e..8d5039d0b430 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -50,7 +50,7 @@ | |||
50 | * component basis and a per-exception-type basis. | 50 | * component basis and a per-exception-type basis. |
51 | */ | 51 | */ |
52 | 52 | ||
53 | /* Component IDs are used in the global "debug_layer" */ | 53 | /* Component IDs are used in the global "DebugLayer" */ |
54 | 54 | ||
55 | #define ACPI_UTILITIES 0x00000001 | 55 | #define ACPI_UTILITIES 0x00000001 |
56 | #define ACPI_HARDWARE 0x00000002 | 56 | #define ACPI_HARDWARE 0x00000002 |
@@ -121,7 +121,7 @@ | |||
121 | #define ACPI_LV_INTERRUPTS 0x08000000 | 121 | #define ACPI_LV_INTERRUPTS 0x08000000 |
122 | #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 | 122 | #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 |
123 | 123 | ||
124 | /* Exceptionally verbose output -- also used in the global "debug_level" */ | 124 | /* Exceptionally verbose output -- also used in the global "DebugLevel" */ |
125 | 125 | ||
126 | #define ACPI_LV_AML_DISASSEMBLE 0x10000000 | 126 | #define ACPI_LV_AML_DISASSEMBLE 0x10000000 |
127 | #define ACPI_LV_VERBOSE_INFO 0x20000000 | 127 | #define ACPI_LV_VERBOSE_INFO 0x20000000 |
@@ -135,7 +135,7 @@ | |||
135 | */ | 135 | */ |
136 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS | 136 | #define ACPI_DEBUG_LEVEL(dl) (u32) dl,ACPI_DEBUG_PARAMETERS |
137 | 137 | ||
138 | /* Exception level -- used in the global "debug_level" */ | 138 | /* Exception level -- used in the global "DebugLevel" */ |
139 | 139 | ||
140 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) | 140 | #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) |
141 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) | 141 | #define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT) |
@@ -144,13 +144,13 @@ | |||
144 | 144 | ||
145 | /* | 145 | /* |
146 | * These two levels are essentially obsolete, all instances in the | 146 | * These two levels are essentially obsolete, all instances in the |
147 | * ACPICA core code have been replaced by REPORT_ERROR and REPORT_WARNING | 147 | * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING |
148 | * (Kept here because some drivers may still use them) | 148 | * (Kept here because some drivers may still use them) |
149 | */ | 149 | */ |
150 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) | 150 | #define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR) |
151 | #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) | 151 | #define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN) |
152 | 152 | ||
153 | /* Trace level -- also used in the global "debug_level" */ | 153 | /* Trace level -- also used in the global "DebugLevel" */ |
154 | 154 | ||
155 | #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) | 155 | #define ACPI_DB_INIT_NAMES ACPI_DEBUG_LEVEL (ACPI_LV_INIT_NAMES) |
156 | #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) | 156 | #define ACPI_DB_THREADS ACPI_DEBUG_LEVEL (ACPI_LV_THREADS) |
diff --git a/include/acpi/acparser.h b/include/acpi/acparser.h index 5a1ff484af33..9d49d3c41cd9 100644 --- a/include/acpi/acparser.h +++ b/include/acpi/acparser.h | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | #define OP_HAS_RETURN_VALUE 1 | 47 | #define OP_HAS_RETURN_VALUE 1 |
48 | 48 | ||
49 | /* variable # arguments */ | 49 | /* Variable number of arguments. This field must be 32 bits */ |
50 | 50 | ||
51 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX | 51 | #define ACPI_VAR_ARGS ACPI_UINT32_MAX |
52 | 52 | ||
@@ -71,7 +71,7 @@ | |||
71 | /* | 71 | /* |
72 | * psxface - Parser external interfaces | 72 | * psxface - Parser external interfaces |
73 | */ | 73 | */ |
74 | acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info); | 74 | acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info); |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * psargs - Parse AML opcode arguments | 77 | * psargs - Parse AML opcode arguments |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 6dca3d542080..a2b3e390a503 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #ifndef __ACPI_BUS_H__ | 26 | #ifndef __ACPI_BUS_H__ |
27 | #define __ACPI_BUS_H__ | 27 | #define __ACPI_BUS_H__ |
28 | 28 | ||
29 | #include <linux/kobject.h> | 29 | #include <linux/device.h> |
30 | 30 | ||
31 | #include <acpi/acpi.h> | 31 | #include <acpi/acpi.h> |
32 | 32 | ||
@@ -59,7 +59,7 @@ acpi_evaluate_reference(acpi_handle handle, | |||
59 | 59 | ||
60 | #define ACPI_BUS_FILE_ROOT "acpi" | 60 | #define ACPI_BUS_FILE_ROOT "acpi" |
61 | extern struct proc_dir_entry *acpi_root_dir; | 61 | extern struct proc_dir_entry *acpi_root_dir; |
62 | extern FADT_DESCRIPTOR acpi_fadt; | 62 | extern struct fadt_descriptor acpi_fadt; |
63 | 63 | ||
64 | enum acpi_bus_removal_type { | 64 | enum acpi_bus_removal_type { |
65 | ACPI_BUS_REMOVAL_NORMAL = 0, | 65 | ACPI_BUS_REMOVAL_NORMAL = 0, |
@@ -169,7 +169,8 @@ struct acpi_device_flags { | |||
169 | u32 power_manageable:1; | 169 | u32 power_manageable:1; |
170 | u32 performance_manageable:1; | 170 | u32 performance_manageable:1; |
171 | u32 wake_capable:1; /* Wakeup(_PRW) supported? */ | 171 | u32 wake_capable:1; /* Wakeup(_PRW) supported? */ |
172 | u32 reserved:20; | 172 | u32 force_power_state:1; |
173 | u32 reserved:19; | ||
173 | }; | 174 | }; |
174 | 175 | ||
175 | /* File System */ | 176 | /* File System */ |
@@ -296,6 +297,7 @@ struct acpi_device { | |||
296 | struct acpi_driver *driver; | 297 | struct acpi_driver *driver; |
297 | void *driver_data; | 298 | void *driver_data; |
298 | struct kobject kobj; | 299 | struct kobject kobj; |
300 | struct device dev; | ||
299 | }; | 301 | }; |
300 | 302 | ||
301 | #define acpi_driver_data(d) ((d)->driver_data) | 303 | #define acpi_driver_data(d) ((d)->driver_data) |
@@ -327,7 +329,7 @@ int acpi_bus_set_power(acpi_handle handle, int state); | |||
327 | int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); | 329 | int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data); |
328 | int acpi_bus_receive_event(struct acpi_bus_event *event); | 330 | int acpi_bus_receive_event(struct acpi_bus_event *event); |
329 | int acpi_bus_register_driver(struct acpi_driver *driver); | 331 | int acpi_bus_register_driver(struct acpi_driver *driver); |
330 | int acpi_bus_unregister_driver(struct acpi_driver *driver); | 332 | void acpi_bus_unregister_driver(struct acpi_driver *driver); |
331 | int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, | 333 | int acpi_bus_add(struct acpi_device **child, struct acpi_device *parent, |
332 | acpi_handle handle, int type); | 334 | acpi_handle handle, int type); |
333 | int acpi_bus_trim(struct acpi_device *start, int rmdevice); | 335 | int acpi_bus_trim(struct acpi_device *start, int rmdevice); |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 970e9a6372c3..8f473c83b7c4 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -50,12 +50,16 @@ | |||
50 | #include "platform/acenv.h" | 50 | #include "platform/acenv.h" |
51 | #include "actypes.h" | 51 | #include "actypes.h" |
52 | 52 | ||
53 | /* Priorities for acpi_os_queue_for_execution */ | 53 | /* Types for acpi_os_execute */ |
54 | 54 | ||
55 | #define OSD_PRIORITY_GPE 1 | 55 | typedef enum { |
56 | #define OSD_PRIORITY_HIGH 2 | 56 | OSL_GLOBAL_LOCK_HANDLER, |
57 | #define OSD_PRIORITY_MED 3 | 57 | OSL_NOTIFY_HANDLER, |
58 | #define OSD_PRIORITY_LO 4 | 58 | OSL_GPE_HANDLER, |
59 | OSL_DEBUGGER_THREAD, | ||
60 | OSL_EC_POLL_HANDLER, | ||
61 | OSL_EC_BURST_HANDLER | ||
62 | } acpi_execute_type; | ||
59 | 63 | ||
60 | #define ACPI_NO_UNIT_LIMIT ((u32) -1) | 64 | #define ACPI_NO_UNIT_LIMIT ((u32) -1) |
61 | #define ACPI_MUTEX_SEM 1 | 65 | #define ACPI_MUTEX_SEM 1 |
@@ -161,13 +165,11 @@ acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine); | |||
161 | /* | 165 | /* |
162 | * Threads and Scheduling | 166 | * Threads and Scheduling |
163 | */ | 167 | */ |
164 | u32 acpi_os_get_thread_id(void); | 168 | acpi_thread_id acpi_os_get_thread_id(void); |
165 | 169 | ||
166 | acpi_status | 170 | acpi_status |
167 | acpi_os_queue_for_execution(u32 priority, | 171 | acpi_os_execute(acpi_execute_type type, |
168 | acpi_osd_exec_callback function, void *context); | 172 | acpi_osd_exec_callback function, void *context); |
169 | |||
170 | void acpi_os_wait_events_complete(void *context); | ||
171 | 173 | ||
172 | void acpi_os_wait_events_complete(void *context); | 174 | void acpi_os_wait_events_complete(void *context); |
173 | 175 | ||
@@ -214,6 +216,12 @@ acpi_os_derive_pci_id(acpi_handle rhandle, | |||
214 | /* | 216 | /* |
215 | * Miscellaneous | 217 | * Miscellaneous |
216 | */ | 218 | */ |
219 | acpi_status acpi_os_validate_interface(char *interface); | ||
220 | |||
221 | acpi_status | ||
222 | acpi_os_validate_address(u8 space_id, | ||
223 | acpi_physical_address address, acpi_size length); | ||
224 | |||
217 | u8 acpi_os_readable(void *pointer, acpi_size length); | 225 | u8 acpi_os_readable(void *pointer, acpi_size length); |
218 | 226 | ||
219 | #ifdef ACPI_FUTURE_USAGE | 227 | #ifdef ACPI_FUTURE_USAGE |
@@ -255,11 +263,4 @@ char *acpi_os_get_next_filename(void *dir_handle); | |||
255 | 263 | ||
256 | void acpi_os_close_directory(void *dir_handle); | 264 | void acpi_os_close_directory(void *dir_handle); |
257 | 265 | ||
258 | /* | ||
259 | * Debug | ||
260 | */ | ||
261 | void | ||
262 | acpi_os_dbg_assert(void *failed_assertion, | ||
263 | void *file_name, u32 line_number, char *message); | ||
264 | |||
265 | #endif /* __ACPIOSXF_H__ */ | 266 | #endif /* __ACPIOSXF_H__ */ |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 66cf2ecef57a..049e9aa1b867 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -268,7 +268,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device); | |||
268 | * Resource interfaces | 268 | * Resource interfaces |
269 | */ | 269 | */ |
270 | typedef | 270 | typedef |
271 | acpi_status(*ACPI_WALK_RESOURCE_CALLBACK) (struct acpi_resource * resource, | 271 | acpi_status(*acpi_walk_resource_callback) (struct acpi_resource * resource, |
272 | void *context); | 272 | void *context); |
273 | 273 | ||
274 | acpi_status | 274 | acpi_status |
@@ -290,7 +290,7 @@ acpi_get_possible_resources(acpi_handle device_handle, | |||
290 | acpi_status | 290 | acpi_status |
291 | acpi_walk_resources(acpi_handle device_handle, | 291 | acpi_walk_resources(acpi_handle device_handle, |
292 | char *name, | 292 | char *name, |
293 | ACPI_WALK_RESOURCE_CALLBACK user_function, void *context); | 293 | acpi_walk_resource_callback user_function, void *context); |
294 | 294 | ||
295 | acpi_status | 295 | acpi_status |
296 | acpi_set_current_resources(acpi_handle device_handle, | 296 | acpi_set_current_resources(acpi_handle device_handle, |
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index fa02e8083381..ad11fc13fbef 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h | |||
@@ -164,23 +164,26 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
164 | /* | 164 | /* |
165 | * rsutils | 165 | * rsutils |
166 | */ | 166 | */ |
167 | |||
167 | acpi_status | 168 | acpi_status |
168 | acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 169 | acpi_rs_get_prt_method_data(struct acpi_namespace_node *node, |
170 | struct acpi_buffer *ret_buffer); | ||
169 | 171 | ||
170 | acpi_status | 172 | acpi_status |
171 | acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 173 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, |
174 | struct acpi_buffer *ret_buffer); | ||
172 | 175 | ||
173 | #ifdef ACPI_FUTURE_USAGE | ||
174 | acpi_status | 176 | acpi_status |
175 | acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 177 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, |
176 | #endif /* ACPI_FUTURE_USAGE */ | 178 | struct acpi_buffer *ret_buffer); |
177 | 179 | ||
178 | acpi_status | 180 | acpi_status |
179 | acpi_rs_get_method_data(acpi_handle handle, | 181 | acpi_rs_get_method_data(acpi_handle handle, |
180 | char *path, struct acpi_buffer *ret_buffer); | 182 | char *path, struct acpi_buffer *ret_buffer); |
181 | 183 | ||
182 | acpi_status | 184 | acpi_status |
183 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 185 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, |
186 | struct acpi_buffer *ret_buffer); | ||
184 | 187 | ||
185 | /* | 188 | /* |
186 | * rscalc | 189 | * rscalc |
@@ -198,8 +201,9 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | |||
198 | acpi_size * buffer_size_needed); | 201 | acpi_size * buffer_size_needed); |
199 | 202 | ||
200 | acpi_status | 203 | acpi_status |
201 | acpi_rs_convert_aml_to_resources(u8 * aml_buffer, | 204 | acpi_rs_convert_aml_to_resources(u8 * aml, |
202 | u32 aml_buffer_length, u8 * output_buffer); | 205 | u32 length, |
206 | u32 offset, u8 resource_index, void **context); | ||
203 | 207 | ||
204 | acpi_status | 208 | acpi_status |
205 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | 209 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, |
diff --git a/include/acpi/acstruct.h b/include/acpi/acstruct.h index d8c1c2cdac0c..5e8095f0f78f 100644 --- a/include/acpi/acstruct.h +++ b/include/acpi/acstruct.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #ifndef __ACSTRUCT_H__ | 44 | #ifndef __ACSTRUCT_H__ |
45 | #define __ACSTRUCT_H__ | 45 | #define __ACSTRUCT_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | /***************************************************************************** | 49 | /***************************************************************************** |
48 | * | 50 | * |
49 | * Tree walking typedefs and structs | 51 | * Tree walking typedefs and structs |
@@ -51,67 +53,76 @@ | |||
51 | ****************************************************************************/ | 53 | ****************************************************************************/ |
52 | 54 | ||
53 | /* | 55 | /* |
54 | * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through | 56 | * Walk state - current state of a parse tree walk. Used for both a leisurely |
55 | * the tree (for whatever reason), and for control method execution. | 57 | * stroll through the tree (for whatever reason), and for control method |
58 | * execution. | ||
56 | */ | 59 | */ |
57 | #define ACPI_NEXT_OP_DOWNWARD 1 | 60 | #define ACPI_NEXT_OP_DOWNWARD 1 |
58 | #define ACPI_NEXT_OP_UPWARD 2 | 61 | #define ACPI_NEXT_OP_UPWARD 2 |
59 | 62 | ||
63 | /* | ||
64 | * Groups of definitions for walk_type used for different implementations of | ||
65 | * walkers (never simultaneously) - flags for interpreter: | ||
66 | */ | ||
60 | #define ACPI_WALK_NON_METHOD 0 | 67 | #define ACPI_WALK_NON_METHOD 0 |
61 | #define ACPI_WALK_METHOD 1 | 68 | #define ACPI_WALK_METHOD 0x01 |
62 | #define ACPI_WALK_METHOD_RESTART 2 | 69 | #define ACPI_WALK_METHOD_RESTART 0x02 |
63 | #define ACPI_WALK_CONST_REQUIRED 3 | 70 | |
64 | #define ACPI_WALK_CONST_OPTIONAL 4 | 71 | /* Flags for i_aSL compiler only */ |
72 | |||
73 | #define ACPI_WALK_CONST_REQUIRED 0x10 | ||
74 | #define ACPI_WALK_CONST_OPTIONAL 0x20 | ||
65 | 75 | ||
66 | struct acpi_walk_state { | 76 | struct acpi_walk_state { |
67 | u8 data_type; /* To differentiate various internal objs MUST BE FIRST! */ | 77 | struct acpi_walk_state *next; /* Next walk_state in list */ |
78 | u8 descriptor_type; /* To differentiate various internal objs */ | ||
68 | u8 walk_type; | 79 | u8 walk_type; |
69 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | 80 | u16 opcode; /* Current AML opcode */ |
70 | u8 last_predicate; /* Result of last predicate */ | ||
71 | u8 current_result; /* */ | ||
72 | u8 next_op_info; /* Info about next_op */ | 81 | u8 next_op_info; /* Info about next_op */ |
73 | u8 num_operands; /* Stack pointer for Operands[] array */ | 82 | u8 num_operands; /* Stack pointer for Operands[] array */ |
83 | acpi_owner_id owner_id; /* Owner of objects created during the walk */ | ||
84 | u8 last_predicate; /* Result of last predicate */ | ||
85 | u8 current_result; | ||
74 | u8 return_used; | 86 | u8 return_used; |
75 | u16 opcode; /* Current AML opcode */ | ||
76 | u8 scope_depth; | 87 | u8 scope_depth; |
77 | u8 pass_number; /* Parse pass during table load */ | 88 | u8 pass_number; /* Parse pass during table load */ |
78 | u32 arg_count; /* push for fixed or var args */ | ||
79 | u32 aml_offset; | 89 | u32 aml_offset; |
80 | u32 arg_types; | 90 | u32 arg_types; |
81 | u32 method_breakpoint; /* For single stepping */ | 91 | u32 method_breakpoint; /* For single stepping */ |
82 | u32 user_breakpoint; /* User AML breakpoint */ | 92 | u32 user_breakpoint; /* User AML breakpoint */ |
83 | u32 parse_flags; | 93 | u32 parse_flags; |
94 | |||
95 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
84 | u32 prev_arg_types; | 96 | u32 prev_arg_types; |
97 | u32 arg_count; /* push for fixed or var args */ | ||
85 | 98 | ||
86 | u8 *aml_last_while; | ||
87 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ | 99 | struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */ |
100 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
101 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
102 | union acpi_operand_object **params; | ||
103 | |||
104 | u8 *aml_last_while; | ||
88 | union acpi_operand_object **caller_return_desc; | 105 | union acpi_operand_object **caller_return_desc; |
89 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ | 106 | union acpi_generic_state *control_state; /* List of control states (nested IFs) */ |
90 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ | 107 | struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */ |
91 | struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ | 108 | struct acpi_gpe_event_info *gpe_event_info; /* Info for GPE (_Lxx/_Exx methods only */ |
92 | union acpi_operand_object *implicit_return_obj; | 109 | union acpi_operand_object *implicit_return_obj; |
93 | struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */ | ||
94 | struct acpi_namespace_node *method_call_node; /* Called method Node */ | 110 | struct acpi_namespace_node *method_call_node; /* Called method Node */ |
95 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ | 111 | union acpi_parse_object *method_call_op; /* method_call Op if running a method */ |
96 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ | 112 | union acpi_operand_object *method_desc; /* Method descriptor if running a method */ |
97 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ | 113 | struct acpi_namespace_node *method_node; /* Method node if running a method. */ |
98 | union acpi_parse_object *op; /* Current parser op */ | 114 | union acpi_parse_object *op; /* Current parser op */ |
99 | union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */ | ||
100 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ | 115 | const struct acpi_opcode_info *op_info; /* Info on current opcode */ |
101 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ | 116 | union acpi_parse_object *origin; /* Start of walk [Obsolete] */ |
102 | union acpi_operand_object **params; | ||
103 | struct acpi_parse_state parser_state; /* Current state of parser */ | ||
104 | union acpi_operand_object *result_obj; | 117 | union acpi_operand_object *result_obj; |
105 | union acpi_generic_state *results; /* Stack of accumulated results */ | 118 | union acpi_generic_state *results; /* Stack of accumulated results */ |
106 | union acpi_operand_object *return_desc; /* Return object, if any */ | 119 | union acpi_operand_object *return_desc; /* Return object, if any */ |
107 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ | 120 | union acpi_generic_state *scope_info; /* Stack of nested scopes */ |
108 | |||
109 | union acpi_parse_object *prev_op; /* Last op that was processed */ | 121 | union acpi_parse_object *prev_op; /* Last op that was processed */ |
110 | union acpi_parse_object *next_op; /* next op to be processed */ | 122 | union acpi_parse_object *next_op; /* next op to be processed */ |
123 | struct acpi_thread_state *thread; | ||
111 | acpi_parse_downwards descending_callback; | 124 | acpi_parse_downwards descending_callback; |
112 | acpi_parse_upwards ascending_callback; | 125 | acpi_parse_upwards ascending_callback; |
113 | struct acpi_thread_state *thread; | ||
114 | struct acpi_walk_state *next; /* Next walk_state in list */ | ||
115 | }; | 126 | }; |
116 | 127 | ||
117 | /* Info used by acpi_ps_init_objects */ | 128 | /* Info used by acpi_ps_init_objects */ |
@@ -131,32 +142,6 @@ struct acpi_init_walk_info { | |||
131 | struct acpi_table_desc *table_desc; | 142 | struct acpi_table_desc *table_desc; |
132 | }; | 143 | }; |
133 | 144 | ||
134 | /* Info used by acpi_ns_initialize_devices */ | ||
135 | |||
136 | struct acpi_device_walk_info { | ||
137 | u16 device_count; | ||
138 | u16 num_STA; | ||
139 | u16 num_INI; | ||
140 | struct acpi_table_desc *table_desc; | ||
141 | }; | ||
142 | |||
143 | /* TBD: [Restructure] Merge with struct above */ | ||
144 | |||
145 | struct acpi_walk_info { | ||
146 | u32 debug_level; | ||
147 | u32 count; | ||
148 | acpi_owner_id owner_id; | ||
149 | u8 display_type; | ||
150 | }; | ||
151 | |||
152 | /* Display Types */ | ||
153 | |||
154 | #define ACPI_DISPLAY_SUMMARY (u8) 0 | ||
155 | #define ACPI_DISPLAY_OBJECTS (u8) 1 | ||
156 | #define ACPI_DISPLAY_MASK (u8) 1 | ||
157 | |||
158 | #define ACPI_DISPLAY_SHORT (u8) 2 | ||
159 | |||
160 | struct acpi_get_devices_info { | 145 | struct acpi_get_devices_info { |
161 | acpi_walk_callback user_function; | 146 | acpi_walk_callback user_function; |
162 | void *context; | 147 | void *context; |
@@ -189,16 +174,21 @@ union acpi_aml_operands { | |||
189 | } mid; | 174 | } mid; |
190 | }; | 175 | }; |
191 | 176 | ||
192 | /* Internal method parameter list */ | 177 | /* |
193 | 178 | * Structure used to pass object evaluation parameters. | |
194 | struct acpi_parameter_info { | 179 | * Purpose is to reduce CPU stack use. |
195 | struct acpi_namespace_node *node; | 180 | */ |
181 | struct acpi_evaluate_info { | ||
182 | struct acpi_namespace_node *prefix_node; | ||
183 | char *pathname; | ||
196 | union acpi_operand_object *obj_desc; | 184 | union acpi_operand_object *obj_desc; |
197 | union acpi_operand_object **parameters; | 185 | union acpi_operand_object **parameters; |
186 | struct acpi_namespace_node *resolved_node; | ||
198 | union acpi_operand_object *return_object; | 187 | union acpi_operand_object *return_object; |
199 | u8 pass_number; | 188 | u8 pass_number; |
200 | u8 parameter_type; | 189 | u8 parameter_type; |
201 | u8 return_object_type; | 190 | u8 return_object_type; |
191 | u8 flags; | ||
202 | }; | 192 | }; |
203 | 193 | ||
204 | /* Types for parameter_type above */ | 194 | /* Types for parameter_type above */ |
@@ -206,4 +196,35 @@ struct acpi_parameter_info { | |||
206 | #define ACPI_PARAM_ARGS 0 | 196 | #define ACPI_PARAM_ARGS 0 |
207 | #define ACPI_PARAM_GPE 1 | 197 | #define ACPI_PARAM_GPE 1 |
208 | 198 | ||
199 | /* Values for Flags above */ | ||
200 | |||
201 | #define ACPI_IGNORE_RETURN_VALUE 1 | ||
202 | |||
203 | /* Info used by acpi_ns_initialize_devices */ | ||
204 | |||
205 | struct acpi_device_walk_info { | ||
206 | u16 device_count; | ||
207 | u16 num_STA; | ||
208 | u16 num_INI; | ||
209 | struct acpi_table_desc *table_desc; | ||
210 | struct acpi_evaluate_info *evaluate_info; | ||
211 | }; | ||
212 | |||
213 | /* TBD: [Restructure] Merge with struct above */ | ||
214 | |||
215 | struct acpi_walk_info { | ||
216 | u32 debug_level; | ||
217 | u32 count; | ||
218 | acpi_owner_id owner_id; | ||
219 | u8 display_type; | ||
220 | }; | ||
221 | |||
222 | /* Display Types */ | ||
223 | |||
224 | #define ACPI_DISPLAY_SUMMARY (u8) 0 | ||
225 | #define ACPI_DISPLAY_OBJECTS (u8) 1 | ||
226 | #define ACPI_DISPLAY_MASK (u8) 1 | ||
227 | |||
228 | #define ACPI_DISPLAY_SHORT (u8) 2 | ||
229 | |||
209 | #endif | 230 | #endif |
diff --git a/include/acpi/actables.h b/include/acpi/actables.h index 30a47542e1c8..4dbaf02fe526 100644 --- a/include/acpi/actables.h +++ b/include/acpi/actables.h | |||
@@ -136,7 +136,11 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc); | |||
136 | acpi_status | 136 | acpi_status |
137 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); | 137 | acpi_tb_verify_table_checksum(struct acpi_table_header *table_header); |
138 | 138 | ||
139 | u8 acpi_tb_generate_checksum(void *buffer, u32 length); | 139 | u8 acpi_tb_sum_table(void *buffer, u32 length); |
140 | |||
141 | u8 acpi_tb_generate_checksum(struct acpi_table_header *table); | ||
142 | |||
143 | void acpi_tb_set_checksum(struct acpi_table_header *table); | ||
140 | 144 | ||
141 | acpi_status | 145 | acpi_status |
142 | acpi_tb_validate_table_header(struct acpi_table_header *table_header); | 146 | acpi_tb_validate_table_header(struct acpi_table_header *table_header); |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index ed53f842dad4..b125ceed9cb7 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Name: actbl.h - Table data structures defined in ACPI specification | 3 | * Name: actbl.h - Basic ACPI Table Definitions |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -45,66 +45,45 @@ | |||
45 | #define __ACTBL_H__ | 45 | #define __ACTBL_H__ |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. | 48 | * Values for description table header signatures. Useful because they make |
49 | * This is the only type that is even remotely portable. Anything else is not | 49 | * it more difficult to inadvertently type in the wrong signature. |
50 | * portable, so do not use any other bitfield types. | ||
51 | */ | ||
52 | |||
53 | /* | ||
54 | * Values for description table header signatures | ||
55 | */ | 50 | */ |
56 | #define RSDP_NAME "RSDP" | ||
57 | #define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */ | ||
58 | #define APIC_SIG "APIC" /* Multiple APIC Description Table */ | ||
59 | #define DSDT_SIG "DSDT" /* Differentiated System Description Table */ | 51 | #define DSDT_SIG "DSDT" /* Differentiated System Description Table */ |
60 | #define FADT_SIG "FACP" /* Fixed ACPI Description Table */ | 52 | #define FADT_SIG "FACP" /* Fixed ACPI Description Table */ |
61 | #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ | 53 | #define FACS_SIG "FACS" /* Firmware ACPI Control Structure */ |
62 | #define PSDT_SIG "PSDT" /* Persistent System Description Table */ | 54 | #define PSDT_SIG "PSDT" /* Persistent System Description Table */ |
55 | #define RSDP_SIG "RSD PTR " /* Root System Description Pointer */ | ||
63 | #define RSDT_SIG "RSDT" /* Root System Description Table */ | 56 | #define RSDT_SIG "RSDT" /* Root System Description Table */ |
64 | #define XSDT_SIG "XSDT" /* Extended System Description Table */ | 57 | #define XSDT_SIG "XSDT" /* Extended System Description Table */ |
65 | #define SSDT_SIG "SSDT" /* Secondary System Description Table */ | 58 | #define SSDT_SIG "SSDT" /* Secondary System Description Table */ |
66 | #define SBST_SIG "SBST" /* Smart Battery Specification Table */ | 59 | #define RSDP_NAME "RSDP" |
67 | #define SPIC_SIG "SPIC" /* IOSAPIC table */ | ||
68 | #define BOOT_SIG "BOOT" /* Boot table */ | ||
69 | |||
70 | #define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */ | ||
71 | 60 | ||
72 | /* | 61 | /* |
73 | * Common table types. The base code can remain | 62 | * All tables and structures must be byte-packed to match the ACPI |
74 | * constant if the underlying tables are changed | 63 | * specification, since the tables are provided by the system BIOS |
75 | */ | 64 | */ |
76 | #define RSDT_DESCRIPTOR struct rsdt_descriptor_rev2 | ||
77 | #define XSDT_DESCRIPTOR struct xsdt_descriptor_rev2 | ||
78 | #define FACS_DESCRIPTOR struct facs_descriptor_rev2 | ||
79 | #define FADT_DESCRIPTOR struct fadt_descriptor_rev2 | ||
80 | |||
81 | #pragma pack(1) | 65 | #pragma pack(1) |
82 | 66 | ||
83 | /* | 67 | /* |
84 | * ACPI Version-independent tables | 68 | * These are the ACPI tables that are directly consumed by the subsystem. |
69 | * | ||
70 | * The RSDP and FACS do not use the common ACPI table header. All other ACPI | ||
71 | * tables use the header. | ||
85 | * | 72 | * |
86 | * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.) | 73 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. |
87 | * are in separate files. | 74 | * This is the only type that is even remotely portable. Anything else is not |
75 | * portable, so do not use any other bitfield types. | ||
88 | */ | 76 | */ |
89 | struct rsdp_descriptor { /* Root System Descriptor Pointer */ | ||
90 | char signature[8]; /* ACPI signature, contains "RSD PTR " */ | ||
91 | u8 checksum; /* ACPI 1.0 checksum */ | ||
92 | char oem_id[6]; /* OEM identification */ | ||
93 | u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ | ||
94 | u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ | ||
95 | u32 length; /* XSDT Length in bytes, including header */ | ||
96 | u64 xsdt_physical_address; /* 64-bit physical address of the XSDT */ | ||
97 | u8 extended_checksum; /* Checksum of entire table (ACPI 2.0) */ | ||
98 | char reserved[3]; /* Reserved, must be zero */ | ||
99 | }; | ||
100 | 77 | ||
101 | struct acpi_common_facs { /* Common FACS for internal use */ | 78 | /******************************************************************************* |
102 | u32 *global_lock; | 79 | * |
103 | u64 *firmware_waking_vector; | 80 | * ACPI Table Header. This common header is used by all tables except the |
104 | u8 vector_width; | 81 | * RSDP and FACS. The define is used for direct inclusion of header into |
105 | }; | 82 | * other ACPI tables |
83 | * | ||
84 | ******************************************************************************/ | ||
106 | 85 | ||
107 | #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \ | 86 | #define ACPI_TABLE_HEADER_DEF \ |
108 | char signature[4]; /* ASCII table signature */\ | 87 | char signature[4]; /* ASCII table signature */\ |
109 | u32 length; /* Length of table in bytes, including this header */\ | 88 | u32 length; /* Length of table in bytes, including this header */\ |
110 | u8 revision; /* ACPI Specification minor version # */\ | 89 | u8 revision; /* ACPI Specification minor version # */\ |
@@ -112,154 +91,239 @@ struct acpi_common_facs { /* Common FACS for internal use */ | |||
112 | char oem_id[6]; /* ASCII OEM identification */\ | 91 | char oem_id[6]; /* ASCII OEM identification */\ |
113 | char oem_table_id[8]; /* ASCII OEM table identification */\ | 92 | char oem_table_id[8]; /* ASCII OEM table identification */\ |
114 | u32 oem_revision; /* OEM revision number */\ | 93 | u32 oem_revision; /* OEM revision number */\ |
115 | char asl_compiler_id [4]; /* ASCII ASL compiler vendor ID */\ | 94 | char asl_compiler_id[4]; /* ASCII ASL compiler vendor ID */\ |
116 | u32 asl_compiler_revision; /* ASL compiler version */ | 95 | u32 asl_compiler_revision; /* ASL compiler version */ |
117 | 96 | ||
118 | struct acpi_table_header { /* ACPI common table header */ | 97 | struct acpi_table_header { |
119 | ACPI_TABLE_HEADER_DEF}; | 98 | ACPI_TABLE_HEADER_DEF}; |
120 | 99 | ||
121 | /* | 100 | /* |
122 | * MADT values and structures | 101 | * GAS - Generic Address Structure (ACPI 2.0+) |
123 | */ | 102 | */ |
103 | struct acpi_generic_address { | ||
104 | u8 address_space_id; /* Address space where struct or register exists */ | ||
105 | u8 register_bit_width; /* Size in bits of given register */ | ||
106 | u8 register_bit_offset; /* Bit offset within the register */ | ||
107 | u8 access_width; /* Minimum Access size (ACPI 3.0) */ | ||
108 | u64 address; /* 64-bit address of struct or register */ | ||
109 | }; | ||
124 | 110 | ||
125 | /* Values for MADT PCATCompat */ | 111 | /******************************************************************************* |
112 | * | ||
113 | * RSDP - Root System Description Pointer (Signature is "RSD PTR ") | ||
114 | * | ||
115 | ******************************************************************************/ | ||
116 | |||
117 | struct rsdp_descriptor { | ||
118 | char signature[8]; /* ACPI signature, contains "RSD PTR " */ | ||
119 | u8 checksum; /* ACPI 1.0 checksum */ | ||
120 | char oem_id[6]; /* OEM identification */ | ||
121 | u8 revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */ | ||
122 | u32 rsdt_physical_address; /* 32-bit physical address of the RSDT */ | ||
123 | u32 length; /* Table length in bytes, including header (ACPI 2.0+) */ | ||
124 | u64 xsdt_physical_address; /* 64-bit physical address of the XSDT (ACPI 2.0+) */ | ||
125 | u8 extended_checksum; /* Checksum of entire table (ACPI 2.0+) */ | ||
126 | u8 reserved[3]; /* Reserved, must be zero */ | ||
127 | }; | ||
126 | 128 | ||
127 | #define DUAL_PIC 0 | 129 | #define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */ |
128 | #define MULTIPLE_APIC 1 | ||
129 | 130 | ||
130 | /* Master MADT */ | 131 | /******************************************************************************* |
132 | * | ||
133 | * RSDT/XSDT - Root System Description Tables | ||
134 | * | ||
135 | ******************************************************************************/ | ||
131 | 136 | ||
132 | struct multiple_apic_table { | 137 | struct rsdt_descriptor { |
133 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | 138 | ACPI_TABLE_HEADER_DEF u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ |
134 | u32 local_apic_address; /* Physical address of local APIC */ | 139 | }; |
140 | |||
141 | struct xsdt_descriptor { | ||
142 | ACPI_TABLE_HEADER_DEF u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | ||
143 | }; | ||
144 | |||
145 | /******************************************************************************* | ||
146 | * | ||
147 | * FACS - Firmware ACPI Control Structure (FACS) | ||
148 | * | ||
149 | ******************************************************************************/ | ||
150 | |||
151 | struct facs_descriptor { | ||
152 | char signature[4]; /* ASCII table signature */ | ||
153 | u32 length; /* Length of structure, in bytes */ | ||
154 | u32 hardware_signature; /* Hardware configuration signature */ | ||
155 | u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector */ | ||
156 | u32 global_lock; /* Global Lock for shared hardware resources */ | ||
135 | 157 | ||
136 | /* Flags (32 bits) */ | 158 | /* Flags (32 bits) */ |
137 | 159 | ||
138 | u8 PCATcompat:1; /* 00: System also has dual 8259s */ | 160 | u8 S4bios_f:1; /* 00: S4BIOS support is present */ |
139 | u8:7; /* 01-07: Reserved, must be zero */ | 161 | u8:7; /* 01-07: Reserved, must be zero */ |
140 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ | 162 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ |
141 | }; | ||
142 | 163 | ||
143 | /* Values for Type in APIC_HEADER_DEF */ | 164 | u64 xfirmware_waking_vector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */ |
165 | u8 version; /* Version of this table (ACPI 2.0+) */ | ||
166 | u8 reserved[31]; /* Reserved, must be zero */ | ||
167 | }; | ||
144 | 168 | ||
145 | #define APIC_PROCESSOR 0 | 169 | #define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */ |
146 | #define APIC_IO 1 | 170 | #define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */ |
147 | #define APIC_XRUPT_OVERRIDE 2 | ||
148 | #define APIC_NMI 3 | ||
149 | #define APIC_LOCAL_NMI 4 | ||
150 | #define APIC_ADDRESS_OVERRIDE 5 | ||
151 | #define APIC_IO_SAPIC 6 | ||
152 | #define APIC_LOCAL_SAPIC 7 | ||
153 | #define APIC_XRUPT_SOURCE 8 | ||
154 | #define APIC_RESERVED 9 /* 9 and greater are reserved */ | ||
155 | 171 | ||
156 | /* | 172 | /* |
157 | * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) | 173 | * Common FACS - This is a version-independent FACS structure used for internal use only |
158 | */ | 174 | */ |
159 | #define APIC_HEADER_DEF /* Common APIC sub-structure header */\ | 175 | struct acpi_common_facs { |
160 | u8 type; \ | 176 | u32 *global_lock; |
161 | u8 length; | 177 | u64 *firmware_waking_vector; |
162 | 178 | u8 vector_width; | |
163 | struct apic_header { | ||
164 | APIC_HEADER_DEF}; | ||
165 | |||
166 | /* Values for MPS INTI flags */ | ||
167 | |||
168 | #define POLARITY_CONFORMS 0 | ||
169 | #define POLARITY_ACTIVE_HIGH 1 | ||
170 | #define POLARITY_RESERVED 2 | ||
171 | #define POLARITY_ACTIVE_LOW 3 | ||
172 | |||
173 | #define TRIGGER_CONFORMS 0 | ||
174 | #define TRIGGER_EDGE 1 | ||
175 | #define TRIGGER_RESERVED 2 | ||
176 | #define TRIGGER_LEVEL 3 | ||
177 | |||
178 | /* Common flag definitions (16 bits each) */ | ||
179 | |||
180 | #define MPS_INTI_FLAGS \ | ||
181 | u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ | ||
182 | u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ | ||
183 | u8 : 4; /* 04-07: Reserved, must be zero */\ | ||
184 | u8 reserved1; /* 08-15: Reserved, must be zero */ | ||
185 | |||
186 | #define LOCAL_APIC_FLAGS \ | ||
187 | u8 processor_enabled: 1; /* 00: Processor is usable if set */\ | ||
188 | u8 : 7; /* 01-07: Reserved, must be zero */\ | ||
189 | u8 reserved2; /* 08-15: Reserved, must be zero */ | ||
190 | |||
191 | /* Sub-structures for MADT */ | ||
192 | |||
193 | struct madt_processor_apic { | ||
194 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | ||
195 | u8 local_apic_id; /* Processor's local APIC id */ | ||
196 | LOCAL_APIC_FLAGS}; | ||
197 | |||
198 | struct madt_io_apic { | ||
199 | APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ | ||
200 | u8 reserved; /* Reserved - must be zero */ | ||
201 | u32 address; /* APIC physical address */ | ||
202 | u32 interrupt; /* Global system interrupt where INTI | ||
203 | * lines start */ | ||
204 | }; | 179 | }; |
205 | 180 | ||
206 | struct madt_interrupt_override { | 181 | /******************************************************************************* |
207 | APIC_HEADER_DEF u8 bus; /* 0 - ISA */ | 182 | * |
208 | u8 source; /* Interrupt source (IRQ) */ | 183 | * FADT - Fixed ACPI Description Table (Signature "FACP") |
209 | u32 interrupt; /* Global system interrupt */ | 184 | * |
210 | MPS_INTI_FLAGS}; | 185 | ******************************************************************************/ |
186 | |||
187 | /* Fields common to all versions of the FADT */ | ||
188 | |||
189 | #define ACPI_FADT_COMMON \ | ||
190 | ACPI_TABLE_HEADER_DEF \ | ||
191 | u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ | ||
192 | u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ | ||
193 | u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ | ||
194 | u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ | ||
195 | u16 sci_int; /* System vector of SCI interrupt */ \ | ||
196 | u32 smi_cmd; /* Port address of SMI command port */ \ | ||
197 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ | ||
198 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ | ||
199 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ | ||
200 | u8 pstate_cnt; /* Processor performance state control*/ \ | ||
201 | u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a Event Reg Blk */ \ | ||
202 | u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b Event Reg Blk */ \ | ||
203 | u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ | ||
204 | u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ | ||
205 | u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ | ||
206 | u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ | ||
207 | u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ | ||
208 | u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ | ||
209 | u8 pm1_evt_len; /* Byte Length of ports at pm1_x_evt_blk */ \ | ||
210 | u8 pm1_cnt_len; /* Byte Length of ports at pm1_x_cnt_blk */ \ | ||
211 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ | ||
212 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ | ||
213 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ | ||
214 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ | ||
215 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ | ||
216 | u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ | ||
217 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ | ||
218 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ | ||
219 | u16 flush_size; /* Processor's memory cache line width, in bytes */ \ | ||
220 | u16 flush_stride; /* Number of flush strides that need to be read */ \ | ||
221 | u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ | ||
222 | u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ | ||
223 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ | ||
224 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ | ||
225 | u8 century; /* Index to century in RTC CMOS RAM */ \ | ||
226 | u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ \ | ||
227 | u8 reserved2; /* Reserved, must be zero */ | ||
211 | 228 | ||
212 | struct madt_nmi_source { | 229 | /* |
213 | APIC_HEADER_DEF MPS_INTI_FLAGS u32 interrupt; /* Global system interrupt */ | 230 | * ACPI 2.0+ FADT |
231 | */ | ||
232 | struct fadt_descriptor { | ||
233 | ACPI_FADT_COMMON | ||
234 | /* Flags (32 bits) */ | ||
235 | u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ | ||
236 | u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ | ||
237 | u8 proc_c1:1; /* 02: All processors support C1 state */ | ||
238 | u8 plvl2_up:1; /* 03: C2 state works on MP system */ | ||
239 | u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ | ||
240 | u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ | ||
241 | u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ | ||
242 | u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ | ||
243 | u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ | ||
244 | u8 dock_cap:1; /* 09: Docking supported */ | ||
245 | u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ | ||
246 | u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ | ||
247 | u8 headless:1; /* 12: No local video capabilities or local input devices */ | ||
248 | u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ | ||
249 | |||
250 | u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ | ||
251 | u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ | ||
252 | u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ | ||
253 | u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ | ||
254 | u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ | ||
255 | u8 force_apic_physical_destination_mode:1; /* 19: All local x_aPICs must use physical dest mode (ACPI 3.0) */ | ||
256 | u8:4; /* 20-23: Reserved, must be zero */ | ||
257 | u8 reserved3; /* 24-31: Reserved, must be zero */ | ||
258 | |||
259 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
260 | u8 reset_value; /* Value to write to the reset_register port to reset the system */ | ||
261 | u8 reserved4[3]; /* These three bytes must be zero */ | ||
262 | u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ | ||
263 | u64 Xdsdt; /* 64-bit physical address of DSDT */ | ||
264 | struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ | ||
265 | struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ | ||
266 | struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ | ||
267 | struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ | ||
268 | struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ | ||
269 | struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ | ||
270 | struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ | ||
271 | struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ | ||
214 | }; | 272 | }; |
215 | 273 | ||
216 | struct madt_local_apic_nmi { | 274 | /* |
217 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | 275 | * "Down-revved" ACPI 2.0 FADT descriptor |
218 | MPS_INTI_FLAGS u8 lint; /* LINTn to which NMI is connected */ | 276 | * Defined here to allow compiler to generate the length of the struct |
277 | */ | ||
278 | struct fadt_descriptor_rev2_minus { | ||
279 | ACPI_FADT_COMMON u32 flags; | ||
280 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
281 | u8 reset_value; /* Value to write to the reset_register port to reset the system. */ | ||
282 | u8 reserved7[3]; /* Reserved, must be zero */ | ||
219 | }; | 283 | }; |
220 | 284 | ||
221 | struct madt_address_override { | 285 | /* |
222 | APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ | 286 | * ACPI 1.0 FADT |
223 | u64 address; /* APIC physical address */ | 287 | * Defined here to allow compiler to generate the length of the struct |
288 | */ | ||
289 | struct fadt_descriptor_rev1 { | ||
290 | ACPI_FADT_COMMON u32 flags; | ||
224 | }; | 291 | }; |
225 | 292 | ||
226 | struct madt_io_sapic { | 293 | /* FADT: Prefered Power Management Profiles */ |
227 | APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ | ||
228 | u8 reserved; /* Reserved, must be zero */ | ||
229 | u32 interrupt_base; /* Glocal interrupt for SAPIC start */ | ||
230 | u64 address; /* SAPIC physical address */ | ||
231 | }; | ||
232 | 294 | ||
233 | struct madt_local_sapic { | 295 | #define PM_UNSPECIFIED 0 |
234 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | 296 | #define PM_DESKTOP 1 |
235 | u8 local_sapic_id; /* SAPIC ID */ | 297 | #define PM_MOBILE 2 |
236 | u8 local_sapic_eid; /* SAPIC EID */ | 298 | #define PM_WORKSTATION 3 |
237 | u8 reserved[3]; /* Reserved, must be zero */ | 299 | #define PM_ENTERPRISE_SERVER 4 |
238 | LOCAL_APIC_FLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ | 300 | #define PM_SOHO_SERVER 5 |
239 | char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ | 301 | #define PM_APPLIANCE_PC 6 |
240 | }; | ||
241 | 302 | ||
242 | struct madt_interrupt_source { | 303 | /* FADT: Boot Arch Flags */ |
243 | APIC_HEADER_DEF MPS_INTI_FLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ | ||
244 | u8 processor_id; /* Processor ID */ | ||
245 | u8 processor_eid; /* Processor EID */ | ||
246 | u8 io_sapic_vector; /* Vector value for PMI interrupts */ | ||
247 | u32 interrupt; /* Global system interrupt */ | ||
248 | u32 flags; /* Interrupt Source Flags */ | ||
249 | }; | ||
250 | 304 | ||
251 | /* | 305 | #define BAF_LEGACY_DEVICES 0x0001 |
252 | * Smart Battery | 306 | #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 |
253 | */ | 307 | |
254 | struct smart_battery_table { | 308 | #define FADT2_REVISION_ID 3 |
255 | ACPI_TABLE_HEADER_DEF u32 warning_level; | 309 | #define FADT2_MINUS_REVISION_ID 2 |
256 | u32 low_level; | 310 | |
257 | u32 critical_level; | 311 | /* Reset to default packing */ |
258 | }; | ||
259 | 312 | ||
260 | #pragma pack() | 313 | #pragma pack() |
261 | 314 | ||
262 | /* | 315 | /* |
316 | * This macro is temporary until the table bitfield flag definitions | ||
317 | * are removed and replaced by a Flags field. | ||
318 | */ | ||
319 | #define ACPI_FLAG_OFFSET(d,f,o) (u8) (ACPI_OFFSET (d,f) + \ | ||
320 | sizeof(((d *)0)->f) + o) | ||
321 | /* | ||
322 | * Get the remaining ACPI tables | ||
323 | */ | ||
324 | #include "actbl1.h" | ||
325 | |||
326 | /* | ||
263 | * ACPI Table information. We save the table address, length, | 327 | * ACPI Table information. We save the table address, length, |
264 | * and type of memory allocation (mapped or allocated) for each | 328 | * and type of memory allocation (mapped or allocated) for each |
265 | * table for 1) when we exit, and 2) if a new table is installed | 329 | * table for 1) when we exit, and 2) if a new table is installed |
@@ -290,27 +354,17 @@ struct acpi_table_support { | |||
290 | u8 flags; | 354 | u8 flags; |
291 | }; | 355 | }; |
292 | 356 | ||
293 | /* | ||
294 | * Get the ACPI version-specific tables | ||
295 | */ | ||
296 | #include "actbl1.h" /* Acpi 1.0 table definitions */ | ||
297 | #include "actbl2.h" /* Acpi 2.0 table definitions */ | ||
298 | |||
299 | extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, | 357 | extern u8 acpi_fadt_is_v1; /* is set to 1 if FADT is revision 1, |
300 | * needed for certain workarounds */ | 358 | * needed for certain workarounds */ |
359 | /* Macros used to generate offsets to specific table fields */ | ||
301 | 360 | ||
302 | #pragma pack(1) | 361 | #define ACPI_FACS_OFFSET(f) (u8) ACPI_OFFSET (struct facs_descriptor,f) |
303 | /* | 362 | #define ACPI_FADT_OFFSET(f) (u8) ACPI_OFFSET (struct fadt_descriptor, f) |
304 | * High performance timer | 363 | #define ACPI_GAS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_generic_address,f) |
305 | */ | 364 | #define ACPI_HDR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_header,f) |
306 | struct hpet_table { | 365 | #define ACPI_RSDP_OFFSET(f) (u8) ACPI_OFFSET (struct rsdp_descriptor,f) |
307 | ACPI_TABLE_HEADER_DEF u32 hardware_id; | ||
308 | struct acpi_generic_address base_address; | ||
309 | u8 hpet_number; | ||
310 | u16 clock_tick; | ||
311 | u8 attributes; | ||
312 | }; | ||
313 | 366 | ||
314 | #pragma pack() | 367 | #define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct fadt_descriptor,f,o) |
368 | #define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct facs_descriptor,f,o) | ||
315 | 369 | ||
316 | #endif /* __ACTBL_H__ */ | 370 | #endif /* __ACTBL_H__ */ |
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index cd428d57add0..745a6445a4f9 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Name: actbl1.h - ACPI 1.0 tables | 3 | * Name: actbl1.h - Additional ACPI table definitions |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -44,92 +44,599 @@ | |||
44 | #ifndef __ACTBL1_H__ | 44 | #ifndef __ACTBL1_H__ |
45 | #define __ACTBL1_H__ | 45 | #define __ACTBL1_H__ |
46 | 46 | ||
47 | /******************************************************************************* | ||
48 | * | ||
49 | * Additional ACPI Tables | ||
50 | * | ||
51 | * These tables are not consumed directly by the ACPICA subsystem, but are | ||
52 | * included here to support device drivers and the AML disassembler. | ||
53 | * | ||
54 | ******************************************************************************/ | ||
55 | |||
56 | /* | ||
57 | * Values for description table header signatures. Useful because they make | ||
58 | * it more difficult to inadvertently type in the wrong signature. | ||
59 | */ | ||
60 | #define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ | ||
61 | #define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ | ||
62 | #define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */ | ||
63 | #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ | ||
64 | #define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ | ||
65 | #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ | ||
66 | #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ | ||
67 | #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ | ||
68 | #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ | ||
69 | #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ | ||
70 | #define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */ | ||
71 | #define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */ | ||
72 | #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ | ||
73 | #define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */ | ||
74 | #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ | ||
75 | |||
76 | /* Legacy names */ | ||
77 | |||
78 | #define APIC_SIG "APIC" /* Multiple APIC Description Table */ | ||
79 | #define BOOT_SIG "BOOT" /* Simple Boot Flag Table */ | ||
80 | #define SBST_SIG "SBST" /* Smart Battery Specification Table */ | ||
81 | |||
82 | /* | ||
83 | * All tables must be byte-packed to match the ACPI specification, since | ||
84 | * the tables are provided by the system BIOS. | ||
85 | */ | ||
47 | #pragma pack(1) | 86 | #pragma pack(1) |
48 | 87 | ||
49 | /* | 88 | /* |
50 | * ACPI 1.0 Root System Description Table (RSDT) | 89 | * Note about bitfields: The u8 type is used for bitfields in ACPI tables. |
90 | * This is the only type that is even remotely portable. Anything else is not | ||
91 | * portable, so do not use any other bitfield types. | ||
51 | */ | 92 | */ |
52 | struct rsdt_descriptor_rev1 { | 93 | |
53 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | 94 | /******************************************************************************* |
54 | u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | 95 | * |
55 | }; | 96 | * ASF - Alert Standard Format table (Signature "ASF!") |
97 | * | ||
98 | ******************************************************************************/ | ||
99 | |||
100 | struct acpi_table_asf { | ||
101 | ACPI_TABLE_HEADER_DEF}; | ||
102 | |||
103 | #define ACPI_ASF_HEADER_DEF \ | ||
104 | u8 type; \ | ||
105 | u8 reserved; \ | ||
106 | u16 length; | ||
107 | |||
108 | struct acpi_asf_header { | ||
109 | ACPI_ASF_HEADER_DEF}; | ||
110 | |||
111 | /* Values for Type field */ | ||
112 | |||
113 | #define ASF_INFO 0 | ||
114 | #define ASF_ALERT 1 | ||
115 | #define ASF_CONTROL 2 | ||
116 | #define ASF_BOOT 3 | ||
117 | #define ASF_ADDRESS 4 | ||
118 | #define ASF_RESERVED 5 | ||
56 | 119 | ||
57 | /* | 120 | /* |
58 | * ACPI 1.0 Firmware ACPI Control Structure (FACS) | 121 | * ASF subtables |
59 | */ | 122 | */ |
60 | struct facs_descriptor_rev1 { | 123 | |
61 | char signature[4]; /* ASCII table signature */ | 124 | /* 0: ASF Information */ |
62 | u32 length; /* Length of structure in bytes */ | 125 | |
63 | u32 hardware_signature; /* Hardware configuration signature */ | 126 | struct acpi_asf_info { |
64 | u32 firmware_waking_vector; /* ACPI OS waking vector */ | 127 | ACPI_ASF_HEADER_DEF u8 min_reset_value; |
65 | u32 global_lock; /* Global Lock */ | 128 | u8 min_poll_interval; |
129 | u16 system_id; | ||
130 | u32 mfg_id; | ||
131 | u8 flags; | ||
132 | u8 reserved2[3]; | ||
133 | }; | ||
134 | |||
135 | /* 1: ASF Alerts */ | ||
136 | |||
137 | struct acpi_asf_alert { | ||
138 | ACPI_ASF_HEADER_DEF u8 assert_mask; | ||
139 | u8 deassert_mask; | ||
140 | u8 alerts; | ||
141 | u8 data_length; | ||
142 | u8 array[1]; | ||
143 | }; | ||
144 | |||
145 | /* 2: ASF Remote Control */ | ||
146 | |||
147 | struct acpi_asf_remote { | ||
148 | ACPI_ASF_HEADER_DEF u8 controls; | ||
149 | u8 data_length; | ||
150 | u16 reserved2; | ||
151 | u8 array[1]; | ||
152 | }; | ||
153 | |||
154 | /* 3: ASF RMCP Boot Options */ | ||
155 | |||
156 | struct acpi_asf_rmcp { | ||
157 | ACPI_ASF_HEADER_DEF u8 capabilities[7]; | ||
158 | u8 completion_code; | ||
159 | u32 enterprise_id; | ||
160 | u8 command; | ||
161 | u16 parameter; | ||
162 | u16 boot_options; | ||
163 | u16 oem_parameters; | ||
164 | }; | ||
165 | |||
166 | /* 4: ASF Address */ | ||
167 | |||
168 | struct acpi_asf_address { | ||
169 | ACPI_ASF_HEADER_DEF u8 eprom_address; | ||
170 | u8 devices; | ||
171 | u8 smbus_addresses[1]; | ||
172 | }; | ||
173 | |||
174 | /******************************************************************************* | ||
175 | * | ||
176 | * BOOT - Simple Boot Flag Table | ||
177 | * | ||
178 | ******************************************************************************/ | ||
179 | |||
180 | struct acpi_table_boot { | ||
181 | ACPI_TABLE_HEADER_DEF u8 cmos_index; /* Index in CMOS RAM for the boot register */ | ||
182 | u8 reserved[3]; | ||
183 | }; | ||
184 | |||
185 | /******************************************************************************* | ||
186 | * | ||
187 | * CPEP - Corrected Platform Error Polling table | ||
188 | * | ||
189 | ******************************************************************************/ | ||
190 | |||
191 | struct acpi_table_cpep { | ||
192 | ACPI_TABLE_HEADER_DEF u64 reserved; | ||
193 | }; | ||
194 | |||
195 | /* Subtable */ | ||
196 | |||
197 | struct acpi_cpep_polling { | ||
198 | u8 type; | ||
199 | u8 length; | ||
200 | u8 processor_id; /* Processor ID */ | ||
201 | u8 processor_eid; /* Processor EID */ | ||
202 | u32 polling_interval; /* Polling interval (msec) */ | ||
203 | }; | ||
204 | |||
205 | /******************************************************************************* | ||
206 | * | ||
207 | * DBGP - Debug Port table | ||
208 | * | ||
209 | ******************************************************************************/ | ||
210 | |||
211 | struct acpi_table_dbgp { | ||
212 | ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ | ||
213 | u8 reserved[3]; | ||
214 | struct acpi_generic_address debug_port; | ||
215 | }; | ||
216 | |||
217 | /******************************************************************************* | ||
218 | * | ||
219 | * ECDT - Embedded Controller Boot Resources Table | ||
220 | * | ||
221 | ******************************************************************************/ | ||
222 | |||
223 | struct ec_boot_resources { | ||
224 | ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ | ||
225 | struct acpi_generic_address ec_data; /* Address of EC data register */ | ||
226 | u32 uid; /* Unique ID - must be same as the EC _UID method */ | ||
227 | u8 gpe_bit; /* The GPE for the EC */ | ||
228 | u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ | ||
229 | }; | ||
230 | |||
231 | /******************************************************************************* | ||
232 | * | ||
233 | * HPET - High Precision Event Timer table | ||
234 | * | ||
235 | ******************************************************************************/ | ||
236 | |||
237 | struct acpi_hpet_table { | ||
238 | ACPI_TABLE_HEADER_DEF u32 hardware_id; /* Hardware ID of event timer block */ | ||
239 | struct acpi_generic_address base_address; /* Address of event timer block */ | ||
240 | u8 hpet_number; /* HPET sequence number */ | ||
241 | u16 clock_tick; /* Main counter min tick, periodic mode */ | ||
242 | u8 attributes; | ||
243 | }; | ||
244 | |||
245 | #if 0 /* HPET flags to be converted to macros */ | ||
246 | struct { /* Flags (8 bits) */ | ||
247 | u8 page_protect:1; /* 00: No page protection */ | ||
248 | u8 page_protect4:1; /* 01: 4_kB page protected */ | ||
249 | u8 page_protect64:1; /* 02: 64_kB page protected */ | ||
250 | u8:5; /* 03-07: Reserved, must be zero */ | ||
251 | } flags; | ||
252 | #endif | ||
253 | |||
254 | /******************************************************************************* | ||
255 | * | ||
256 | * MADT - Multiple APIC Description Table | ||
257 | * | ||
258 | ******************************************************************************/ | ||
259 | |||
260 | struct multiple_apic_table { | ||
261 | ACPI_TABLE_HEADER_DEF u32 local_apic_address; /* Physical address of local APIC */ | ||
66 | 262 | ||
67 | /* Flags (32 bits) */ | 263 | /* Flags (32 bits) */ |
68 | 264 | ||
69 | u8 S4bios_f:1; /* 00: S4BIOS support is present */ | 265 | u8 PCATcompat:1; /* 00: System also has dual 8259s */ |
70 | u8:7; /* 01-07: Reserved, must be zero */ | 266 | u8:7; /* 01-07: Reserved, must be zero */ |
71 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ | 267 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ |
72 | |||
73 | u8 reserved2[40]; /* Reserved, must be zero */ | ||
74 | }; | 268 | }; |
75 | 269 | ||
270 | /* Values for MADT PCATCompat */ | ||
271 | |||
272 | #define DUAL_PIC 0 | ||
273 | #define MULTIPLE_APIC 1 | ||
274 | |||
275 | /* Common MADT Sub-table header */ | ||
276 | |||
277 | #define APIC_HEADER_DEF \ | ||
278 | u8 type; \ | ||
279 | u8 length; | ||
280 | |||
281 | struct apic_header { | ||
282 | APIC_HEADER_DEF}; | ||
283 | |||
284 | /* Values for Type in struct apic_header */ | ||
285 | |||
286 | #define APIC_PROCESSOR 0 | ||
287 | #define APIC_IO 1 | ||
288 | #define APIC_XRUPT_OVERRIDE 2 | ||
289 | #define APIC_NMI 3 | ||
290 | #define APIC_LOCAL_NMI 4 | ||
291 | #define APIC_ADDRESS_OVERRIDE 5 | ||
292 | #define APIC_IO_SAPIC 6 | ||
293 | #define APIC_LOCAL_SAPIC 7 | ||
294 | #define APIC_XRUPT_SOURCE 8 | ||
295 | #define APIC_RESERVED 9 /* 9 and greater are reserved */ | ||
296 | |||
297 | /* Flag definitions for MADT sub-tables */ | ||
298 | |||
299 | #define ACPI_MADT_IFLAGS /* INTI flags (16 bits) */ \ | ||
300 | u8 polarity : 2; /* 00-01: Polarity of APIC I/O input signals */\ | ||
301 | u8 trigger_mode : 2; /* 02-03: Trigger mode of APIC input signals */\ | ||
302 | u8 : 4; /* 04-07: Reserved, must be zero */\ | ||
303 | u8 reserved1; /* 08-15: Reserved, must be zero */ | ||
304 | |||
305 | #define ACPI_MADT_LFLAGS /* Local Sapic flags (32 bits) */ \ | ||
306 | u8 processor_enabled: 1; /* 00: Processor is usable if set */\ | ||
307 | u8 : 7; /* 01-07: Reserved, must be zero */\ | ||
308 | u8 reserved2[3]; /* 08-31: Reserved, must be zero */ | ||
309 | |||
310 | /* Values for MPS INTI flags */ | ||
311 | |||
312 | #define POLARITY_CONFORMS 0 | ||
313 | #define POLARITY_ACTIVE_HIGH 1 | ||
314 | #define POLARITY_RESERVED 2 | ||
315 | #define POLARITY_ACTIVE_LOW 3 | ||
316 | |||
317 | #define TRIGGER_CONFORMS 0 | ||
318 | #define TRIGGER_EDGE 1 | ||
319 | #define TRIGGER_RESERVED 2 | ||
320 | #define TRIGGER_LEVEL 3 | ||
321 | |||
76 | /* | 322 | /* |
77 | * ACPI 1.0 Fixed ACPI Description Table (FADT) | 323 | * MADT Sub-tables, correspond to Type in struct apic_header |
78 | */ | 324 | */ |
79 | struct fadt_descriptor_rev1 { | 325 | |
80 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | 326 | /* 0: processor APIC */ |
81 | u32 firmware_ctrl; /* Physical address of FACS */ | 327 | |
82 | u32 dsdt; /* Physical address of DSDT */ | 328 | struct madt_processor_apic { |
83 | u8 model; /* System Interrupt Model */ | 329 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ |
84 | u8 reserved1; /* Reserved, must be zero */ | 330 | u8 local_apic_id; /* Processor's local APIC id */ |
85 | u16 sci_int; /* System vector of SCI interrupt */ | 331 | ACPI_MADT_LFLAGS}; |
86 | u32 smi_cmd; /* Port address of SMI command port */ | 332 | |
87 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ | 333 | /* 1: IO APIC */ |
88 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ | 334 | |
89 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ | 335 | struct madt_io_apic { |
90 | u8 reserved2; /* Reserved, must be zero */ | 336 | APIC_HEADER_DEF u8 io_apic_id; /* I/O APIC ID */ |
91 | u32 pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ | 337 | u8 reserved; /* Reserved - must be zero */ |
92 | u32 pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ | 338 | u32 address; /* APIC physical address */ |
93 | u32 pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ | 339 | u32 interrupt; /* Global system interrupt where INTI lines start */ |
94 | u32 pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ | 340 | }; |
95 | u32 pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ | 341 | |
96 | u32 pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ | 342 | /* 2: Interrupt Override */ |
97 | u32 gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ | 343 | |
98 | u32 gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ | 344 | struct madt_interrupt_override { |
99 | u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ | 345 | APIC_HEADER_DEF u8 bus; /* 0 - ISA */ |
100 | u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ | 346 | u8 source; /* Interrupt source (IRQ) */ |
101 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ | 347 | u32 interrupt; /* Global system interrupt */ |
102 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ | 348 | ACPI_MADT_IFLAGS}; |
103 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ | 349 | |
104 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ | 350 | /* 3: NMI Sources */ |
105 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ | 351 | |
106 | u8 reserved3; /* Reserved, must be zero */ | 352 | struct madt_nmi_source { |
107 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ | 353 | APIC_HEADER_DEF ACPI_MADT_IFLAGS u32 interrupt; /* Global system interrupt */ |
108 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ | 354 | }; |
109 | u16 flush_size; /* Size of area read to flush caches */ | 355 | |
110 | u16 flush_stride; /* Stride used in flushing caches */ | 356 | /* 4: Local APIC NMI */ |
111 | u8 duty_offset; /* Bit location of duty cycle field in p_cnt reg */ | 357 | |
112 | u8 duty_width; /* Bit width of duty cycle field in p_cnt reg */ | 358 | struct madt_local_apic_nmi { |
113 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ | 359 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ |
114 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ | 360 | ACPI_MADT_IFLAGS u8 lint; /* LINTn to which NMI is connected */ |
115 | u8 century; /* Index to century in RTC CMOS RAM */ | 361 | }; |
116 | u8 reserved4[3]; /* Reserved, must be zero */ | 362 | |
363 | /* 5: Address Override */ | ||
364 | |||
365 | struct madt_address_override { | ||
366 | APIC_HEADER_DEF u16 reserved; /* Reserved, must be zero */ | ||
367 | u64 address; /* APIC physical address */ | ||
368 | }; | ||
369 | |||
370 | /* 6: I/O Sapic */ | ||
371 | |||
372 | struct madt_io_sapic { | ||
373 | APIC_HEADER_DEF u8 io_sapic_id; /* I/O SAPIC ID */ | ||
374 | u8 reserved; /* Reserved, must be zero */ | ||
375 | u32 interrupt_base; /* Glocal interrupt for SAPIC start */ | ||
376 | u64 address; /* SAPIC physical address */ | ||
377 | }; | ||
378 | |||
379 | /* 7: Local Sapic */ | ||
380 | |||
381 | struct madt_local_sapic { | ||
382 | APIC_HEADER_DEF u8 processor_id; /* ACPI processor id */ | ||
383 | u8 local_sapic_id; /* SAPIC ID */ | ||
384 | u8 local_sapic_eid; /* SAPIC EID */ | ||
385 | u8 reserved[3]; /* Reserved, must be zero */ | ||
386 | ACPI_MADT_LFLAGS u32 processor_uID; /* Numeric UID - ACPI 3.0 */ | ||
387 | char processor_uIDstring[1]; /* String UID - ACPI 3.0 */ | ||
388 | }; | ||
389 | |||
390 | /* 8: Platform Interrupt Source */ | ||
391 | |||
392 | struct madt_interrupt_source { | ||
393 | APIC_HEADER_DEF ACPI_MADT_IFLAGS u8 interrupt_type; /* 1=PMI, 2=INIT, 3=corrected */ | ||
394 | u8 processor_id; /* Processor ID */ | ||
395 | u8 processor_eid; /* Processor EID */ | ||
396 | u8 io_sapic_vector; /* Vector value for PMI interrupts */ | ||
397 | u32 interrupt; /* Global system interrupt */ | ||
398 | u32 flags; /* Interrupt Source Flags */ | ||
399 | }; | ||
400 | |||
401 | #ifdef DUPLICATE_DEFINITION_WITH_LINUX_ACPI_H | ||
402 | /******************************************************************************* | ||
403 | * | ||
404 | * MCFG - PCI Memory Mapped Configuration table and sub-table | ||
405 | * | ||
406 | ******************************************************************************/ | ||
407 | |||
408 | struct acpi_table_mcfg { | ||
409 | ACPI_TABLE_HEADER_DEF u8 reserved[8]; | ||
410 | }; | ||
411 | |||
412 | struct acpi_mcfg_allocation { | ||
413 | u64 base_address; /* Base address, processor-relative */ | ||
414 | u16 pci_segment; /* PCI segment group number */ | ||
415 | u8 start_bus_number; /* Starting PCI Bus number */ | ||
416 | u8 end_bus_number; /* Final PCI Bus number */ | ||
417 | u32 reserved; | ||
418 | }; | ||
419 | #endif | ||
420 | |||
421 | /******************************************************************************* | ||
422 | * | ||
423 | * SBST - Smart Battery Specification Table | ||
424 | * | ||
425 | ******************************************************************************/ | ||
426 | |||
427 | struct smart_battery_table { | ||
428 | ACPI_TABLE_HEADER_DEF u32 warning_level; | ||
429 | u32 low_level; | ||
430 | u32 critical_level; | ||
431 | }; | ||
432 | |||
433 | /******************************************************************************* | ||
434 | * | ||
435 | * SLIT - System Locality Distance Information Table | ||
436 | * | ||
437 | ******************************************************************************/ | ||
438 | |||
439 | struct system_locality_info { | ||
440 | ACPI_TABLE_HEADER_DEF u64 locality_count; | ||
441 | u8 entry[1][1]; | ||
442 | }; | ||
443 | |||
444 | /******************************************************************************* | ||
445 | * | ||
446 | * SPCR - Serial Port Console Redirection table | ||
447 | * | ||
448 | ******************************************************************************/ | ||
449 | |||
450 | struct acpi_table_spcr { | ||
451 | ACPI_TABLE_HEADER_DEF u8 interface_type; /* 0=full 16550, 1=subset of 16550 */ | ||
452 | u8 reserved[3]; | ||
453 | struct acpi_generic_address serial_port; | ||
454 | u8 interrupt_type; | ||
455 | u8 pc_interrupt; | ||
456 | u32 interrupt; | ||
457 | u8 baud_rate; | ||
458 | u8 parity; | ||
459 | u8 stop_bits; | ||
460 | u8 flow_control; | ||
461 | u8 terminal_type; | ||
462 | u8 reserved2; | ||
463 | u16 pci_device_id; | ||
464 | u16 pci_vendor_id; | ||
465 | u8 pci_bus; | ||
466 | u8 pci_device; | ||
467 | u8 pci_function; | ||
468 | u32 pci_flags; | ||
469 | u8 pci_segment; | ||
470 | u32 reserved3; | ||
471 | }; | ||
472 | |||
473 | /******************************************************************************* | ||
474 | * | ||
475 | * SPMI - Server Platform Management Interface table | ||
476 | * | ||
477 | ******************************************************************************/ | ||
478 | |||
479 | struct acpi_table_spmi { | ||
480 | ACPI_TABLE_HEADER_DEF u8 reserved; | ||
481 | u8 interface_type; | ||
482 | u16 spec_revision; /* Version of IPMI */ | ||
483 | u8 interrupt_type; | ||
484 | u8 gpe_number; /* GPE assigned */ | ||
485 | u8 reserved2; | ||
486 | u8 pci_device_flag; | ||
487 | u32 interrupt; | ||
488 | struct acpi_generic_address ipmi_register; | ||
489 | u8 pci_segment; | ||
490 | u8 pci_bus; | ||
491 | u8 pci_device; | ||
492 | u8 pci_function; | ||
493 | }; | ||
494 | |||
495 | /******************************************************************************* | ||
496 | * | ||
497 | * SRAT - System Resource Affinity Table | ||
498 | * | ||
499 | ******************************************************************************/ | ||
500 | |||
501 | struct system_resource_affinity { | ||
502 | ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ | ||
503 | u64 reserved2; /* Reserved, must be zero */ | ||
504 | }; | ||
505 | |||
506 | /* SRAT common sub-table header */ | ||
507 | |||
508 | #define SRAT_SUBTABLE_HEADER \ | ||
509 | u8 type; \ | ||
510 | u8 length; | ||
511 | |||
512 | /* Values for Type above */ | ||
513 | |||
514 | #define SRAT_CPU_AFFINITY 0 | ||
515 | #define SRAT_MEMORY_AFFINITY 1 | ||
516 | #define SRAT_RESERVED 2 | ||
517 | |||
518 | /* SRAT sub-tables */ | ||
519 | |||
520 | struct static_resource_alloc { | ||
521 | SRAT_SUBTABLE_HEADER u8 proximity_domain_lo; | ||
522 | u8 apic_id; | ||
523 | |||
524 | /* Flags (32 bits) */ | ||
525 | |||
526 | u8 enabled:1; /* 00: Use affinity structure */ | ||
527 | u8:7; /* 01-07: Reserved, must be zero */ | ||
528 | u8 reserved3[3]; /* 08-31: Reserved, must be zero */ | ||
529 | |||
530 | u8 local_sapic_eid; | ||
531 | u8 proximity_domain_hi[3]; | ||
532 | u32 reserved4; /* Reserved, must be zero */ | ||
533 | }; | ||
534 | |||
535 | struct memory_affinity { | ||
536 | SRAT_SUBTABLE_HEADER u32 proximity_domain; | ||
537 | u16 reserved3; | ||
538 | u64 base_address; | ||
539 | u64 address_length; | ||
540 | u32 reserved4; | ||
117 | 541 | ||
118 | /* Flags (32 bits) */ | 542 | /* Flags (32 bits) */ |
119 | 543 | ||
120 | u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ | 544 | u8 enabled:1; /* 00: Use affinity structure */ |
121 | u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ | 545 | u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ |
122 | u8 proc_c1:1; /* 02: All processors support C1 state */ | 546 | u8 non_volatile:1; /* 02: Memory is non-volatile */ |
123 | u8 plvl2_up:1; /* 03: C2 state works on MP system */ | 547 | u8:5; /* 03-07: Reserved, must be zero */ |
124 | u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ | 548 | u8 reserved5[3]; /* 08-31: Reserved, must be zero */ |
125 | u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ | 549 | |
126 | u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ | 550 | u64 reserved6; /* Reserved, must be zero */ |
127 | u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ | 551 | }; |
128 | u8 tmr_val_ext:1; /* 08: tmr_val width is 32 bits (0 = 24 bits) */ | 552 | |
129 | u8:7; /* 09-15: Reserved, must be zero */ | 553 | /******************************************************************************* |
130 | u8 reserved5[2]; /* 16-31: Reserved, must be zero */ | 554 | * |
555 | * TCPA - Trusted Computing Platform Alliance table | ||
556 | * | ||
557 | ******************************************************************************/ | ||
558 | |||
559 | struct acpi_table_tcpa { | ||
560 | ACPI_TABLE_HEADER_DEF u16 reserved; | ||
561 | u32 max_log_length; /* Maximum length for the event log area */ | ||
562 | u64 log_address; /* Address of the event log area */ | ||
131 | }; | 563 | }; |
132 | 564 | ||
565 | /******************************************************************************* | ||
566 | * | ||
567 | * WDRT - Watchdog Resource Table | ||
568 | * | ||
569 | ******************************************************************************/ | ||
570 | |||
571 | struct acpi_table_wdrt { | ||
572 | ACPI_TABLE_HEADER_DEF u32 header_length; /* Watchdog Header Length */ | ||
573 | u8 pci_segment; /* PCI Segment number */ | ||
574 | u8 pci_bus; /* PCI Bus number */ | ||
575 | u8 pci_device; /* PCI Device number */ | ||
576 | u8 pci_function; /* PCI Function number */ | ||
577 | u32 timer_period; /* Period of one timer count (msec) */ | ||
578 | u32 max_count; /* Maximum counter value supported */ | ||
579 | u32 min_count; /* Minimum counter value */ | ||
580 | u8 flags; | ||
581 | u8 reserved[3]; | ||
582 | u32 entries; /* Number of watchdog entries that follow */ | ||
583 | }; | ||
584 | |||
585 | #if 0 /* Flags, will be converted to macros */ | ||
586 | u8 enabled:1; /* 00: Timer enabled */ | ||
587 | u8:6; /* 01-06: Reserved */ | ||
588 | u8 sleep_stop:1; /* 07: Timer stopped in sleep state */ | ||
589 | #endif | ||
590 | |||
591 | /* Macros used to generate offsets to specific table fields */ | ||
592 | |||
593 | #define ACPI_ASF0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_info,f) | ||
594 | #define ACPI_ASF1_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_alert,f) | ||
595 | #define ACPI_ASF2_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_remote,f) | ||
596 | #define ACPI_ASF3_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_rmcp,f) | ||
597 | #define ACPI_ASF4_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_asf_address,f) | ||
598 | #define ACPI_BOOT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_boot,f) | ||
599 | #define ACPI_CPEP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_cpep,f) | ||
600 | #define ACPI_CPEP0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_cpep_polling,f) | ||
601 | #define ACPI_DBGP_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_dbgp,f) | ||
602 | #define ACPI_ECDT_OFFSET(f) (u8) ACPI_OFFSET (struct ec_boot_resources,f) | ||
603 | #define ACPI_HPET_OFFSET(f) (u8) ACPI_OFFSET (struct hpet_table,f) | ||
604 | #define ACPI_MADT_OFFSET(f) (u8) ACPI_OFFSET (struct multiple_apic_table,f) | ||
605 | #define ACPI_MADT0_OFFSET(f) (u8) ACPI_OFFSET (struct madt_processor_apic,f) | ||
606 | #define ACPI_MADT1_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_apic,f) | ||
607 | #define ACPI_MADT2_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_override,f) | ||
608 | #define ACPI_MADT3_OFFSET(f) (u8) ACPI_OFFSET (struct madt_nmi_source,f) | ||
609 | #define ACPI_MADT4_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_apic_nmi,f) | ||
610 | #define ACPI_MADT5_OFFSET(f) (u8) ACPI_OFFSET (struct madt_address_override,f) | ||
611 | #define ACPI_MADT6_OFFSET(f) (u8) ACPI_OFFSET (struct madt_io_sapic,f) | ||
612 | #define ACPI_MADT7_OFFSET(f) (u8) ACPI_OFFSET (struct madt_local_sapic,f) | ||
613 | #define ACPI_MADT8_OFFSET(f) (u8) ACPI_OFFSET (struct madt_interrupt_source,f) | ||
614 | #define ACPI_MADTH_OFFSET(f) (u8) ACPI_OFFSET (struct apic_header,f) | ||
615 | #define ACPI_MCFG_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_mcfg,f) | ||
616 | #define ACPI_MCFG0_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_mcfg_allocation,f) | ||
617 | #define ACPI_SBST_OFFSET(f) (u8) ACPI_OFFSET (struct smart_battery_table,f) | ||
618 | #define ACPI_SLIT_OFFSET(f) (u8) ACPI_OFFSET (struct system_locality_info,f) | ||
619 | #define ACPI_SPCR_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spcr,f) | ||
620 | #define ACPI_SPMI_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_spmi,f) | ||
621 | #define ACPI_SRAT_OFFSET(f) (u8) ACPI_OFFSET (struct system_resource_affinity,f) | ||
622 | #define ACPI_SRAT0_OFFSET(f) (u8) ACPI_OFFSET (struct static_resource_alloc,f) | ||
623 | #define ACPI_SRAT1_OFFSET(f) (u8) ACPI_OFFSET (struct memory_affinity,f) | ||
624 | #define ACPI_TCPA_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_tcpa,f) | ||
625 | #define ACPI_WDRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_table_wdrt,f) | ||
626 | |||
627 | #define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct hpet_table,f,o) | ||
628 | #define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct static_resource_alloc,f,o) | ||
629 | #define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct memory_affinity,f,o) | ||
630 | #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct multiple_apic_table,f,o) | ||
631 | #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_processor_apic,f,o) | ||
632 | #define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_override,f,o) | ||
633 | #define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_nmi_source,f,o) | ||
634 | #define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_apic_nmi,f,o) | ||
635 | #define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_local_sapic,f,o) | ||
636 | #define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (struct madt_interrupt_source,f,o) | ||
637 | |||
638 | /* Reset to default packing */ | ||
639 | |||
133 | #pragma pack() | 640 | #pragma pack() |
134 | 641 | ||
135 | #endif /* __ACTBL1_H__ */ | 642 | #endif /* __ACTBL1_H__ */ |
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index dfc7ac1094bb..67efe6cad27b 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h | |||
@@ -44,234 +44,6 @@ | |||
44 | #ifndef __ACTBL2_H__ | 44 | #ifndef __ACTBL2_H__ |
45 | #define __ACTBL2_H__ | 45 | #define __ACTBL2_H__ |
46 | 46 | ||
47 | /* | 47 | /* Code moved to both actbl.h and actbl1.h */ |
48 | * Prefered Power Management Profiles | ||
49 | */ | ||
50 | #define PM_UNSPECIFIED 0 | ||
51 | #define PM_DESKTOP 1 | ||
52 | #define PM_MOBILE 2 | ||
53 | #define PM_WORKSTATION 3 | ||
54 | #define PM_ENTERPRISE_SERVER 4 | ||
55 | #define PM_SOHO_SERVER 5 | ||
56 | #define PM_APPLIANCE_PC 6 | ||
57 | |||
58 | /* | ||
59 | * ACPI Boot Arch Flags | ||
60 | */ | ||
61 | #define BAF_LEGACY_DEVICES 0x0001 | ||
62 | #define BAF_8042_KEYBOARD_CONTROLLER 0x0002 | ||
63 | |||
64 | #define FADT2_REVISION_ID 3 | ||
65 | #define FADT2_MINUS_REVISION_ID 2 | ||
66 | |||
67 | #pragma pack(1) | ||
68 | |||
69 | /* | ||
70 | * ACPI 2.0 Root System Description Table (RSDT) | ||
71 | */ | ||
72 | struct rsdt_descriptor_rev2 { | ||
73 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
74 | u32 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | ||
75 | }; | ||
76 | |||
77 | /* | ||
78 | * ACPI 2.0 Extended System Description Table (XSDT) | ||
79 | */ | ||
80 | struct xsdt_descriptor_rev2 { | ||
81 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
82 | u64 table_offset_entry[1]; /* Array of pointers to ACPI tables */ | ||
83 | }; | ||
84 | |||
85 | /* | ||
86 | * ACPI 2.0 Firmware ACPI Control Structure (FACS) | ||
87 | */ | ||
88 | struct facs_descriptor_rev2 { | ||
89 | char signature[4]; /* ASCII table signature */ | ||
90 | u32 length; /* Length of structure, in bytes */ | ||
91 | u32 hardware_signature; /* Hardware configuration signature */ | ||
92 | u32 firmware_waking_vector; /* 32-bit physical address of the Firmware Waking Vector. */ | ||
93 | u32 global_lock; /* Global Lock used to synchronize access to shared hardware resources */ | ||
94 | |||
95 | /* Flags (32 bits) */ | ||
96 | |||
97 | u8 S4bios_f:1; /* 00: S4BIOS support is present */ | ||
98 | u8:7; /* 01-07: Reserved, must be zero */ | ||
99 | u8 reserved1[3]; /* 08-31: Reserved, must be zero */ | ||
100 | |||
101 | u64 xfirmware_waking_vector; /* 64-bit physical address of the Firmware Waking Vector. */ | ||
102 | u8 version; /* Version of this table */ | ||
103 | u8 reserved3[31]; /* Reserved, must be zero */ | ||
104 | }; | ||
105 | |||
106 | /* | ||
107 | * ACPI 2.0+ Generic Address Structure (GAS) | ||
108 | */ | ||
109 | struct acpi_generic_address { | ||
110 | u8 address_space_id; /* Address space where struct or register exists. */ | ||
111 | u8 register_bit_width; /* Size in bits of given register */ | ||
112 | u8 register_bit_offset; /* Bit offset within the register */ | ||
113 | u8 access_width; /* Minimum Access size (ACPI 3.0) */ | ||
114 | u64 address; /* 64-bit address of struct or register */ | ||
115 | }; | ||
116 | |||
117 | #define FADT_REV2_COMMON \ | ||
118 | u32 V1_firmware_ctrl; /* 32-bit physical address of FACS */ \ | ||
119 | u32 V1_dsdt; /* 32-bit physical address of DSDT */ \ | ||
120 | u8 reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \ | ||
121 | u8 prefer_PM_profile; /* Conveys preferred power management profile to OSPM. */ \ | ||
122 | u16 sci_int; /* System vector of SCI interrupt */ \ | ||
123 | u32 smi_cmd; /* Port address of SMI command port */ \ | ||
124 | u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ \ | ||
125 | u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ \ | ||
126 | u8 S4bios_req; /* Value to write to SMI CMD to enter S4BIOS state */ \ | ||
127 | u8 pstate_cnt; /* Processor performance state control*/ \ | ||
128 | u32 V1_pm1a_evt_blk; /* Port address of Power Mgt 1a acpi_event Reg Blk */ \ | ||
129 | u32 V1_pm1b_evt_blk; /* Port address of Power Mgt 1b acpi_event Reg Blk */ \ | ||
130 | u32 V1_pm1a_cnt_blk; /* Port address of Power Mgt 1a Control Reg Blk */ \ | ||
131 | u32 V1_pm1b_cnt_blk; /* Port address of Power Mgt 1b Control Reg Blk */ \ | ||
132 | u32 V1_pm2_cnt_blk; /* Port address of Power Mgt 2 Control Reg Blk */ \ | ||
133 | u32 V1_pm_tmr_blk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \ | ||
134 | u32 V1_gpe0_blk; /* Port addr of General Purpose acpi_event 0 Reg Blk */ \ | ||
135 | u32 V1_gpe1_blk; /* Port addr of General Purpose acpi_event 1 Reg Blk */ \ | ||
136 | u8 pm1_evt_len; /* Byte length of ports at pm1_x_evt_blk */ \ | ||
137 | u8 pm1_cnt_len; /* Byte length of ports at pm1_x_cnt_blk */ \ | ||
138 | u8 pm2_cnt_len; /* Byte Length of ports at pm2_cnt_blk */ \ | ||
139 | u8 pm_tm_len; /* Byte Length of ports at pm_tm_blk */ \ | ||
140 | u8 gpe0_blk_len; /* Byte Length of ports at gpe0_blk */ \ | ||
141 | u8 gpe1_blk_len; /* Byte Length of ports at gpe1_blk */ \ | ||
142 | u8 gpe1_base; /* Offset in gpe model where gpe1 events start */ \ | ||
143 | u8 cst_cnt; /* Support for the _CST object and C States change notification.*/ \ | ||
144 | u16 plvl2_lat; /* Worst case HW latency to enter/exit C2 state */ \ | ||
145 | u16 plvl3_lat; /* Worst case HW latency to enter/exit C3 state */ \ | ||
146 | u16 flush_size; /* Number of flush strides that need to be read */ \ | ||
147 | u16 flush_stride; /* Processor's memory cache line width, in bytes */ \ | ||
148 | u8 duty_offset; /* Processor's duty cycle index in processor's P_CNT reg*/ \ | ||
149 | u8 duty_width; /* Processor's duty cycle value bit width in P_CNT register.*/ \ | ||
150 | u8 day_alrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \ | ||
151 | u8 mon_alrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \ | ||
152 | u8 century; /* Index to century in RTC CMOS RAM */ \ | ||
153 | u16 iapc_boot_arch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ | ||
154 | |||
155 | /* | ||
156 | * ACPI 2.0+ Fixed ACPI Description Table (FADT) | ||
157 | */ | ||
158 | struct fadt_descriptor_rev2 { | ||
159 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
160 | FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ | ||
161 | |||
162 | /* Flags (32 bits) */ | ||
163 | |||
164 | u8 wb_invd:1; /* 00: The wbinvd instruction works properly */ | ||
165 | u8 wb_invd_flush:1; /* 01: The wbinvd flushes but does not invalidate */ | ||
166 | u8 proc_c1:1; /* 02: All processors support C1 state */ | ||
167 | u8 plvl2_up:1; /* 03: C2 state works on MP system */ | ||
168 | u8 pwr_button:1; /* 04: Power button is handled as a generic feature */ | ||
169 | u8 sleep_button:1; /* 05: Sleep button is handled as a generic feature, or not present */ | ||
170 | u8 fixed_rTC:1; /* 06: RTC wakeup stat not in fixed register space */ | ||
171 | u8 rtcs4:1; /* 07: RTC wakeup stat not possible from S4 */ | ||
172 | u8 tmr_val_ext:1; /* 08: tmr_val is 32 bits 0=24-bits */ | ||
173 | u8 dock_cap:1; /* 09: Docking supported */ | ||
174 | u8 reset_reg_sup:1; /* 10: System reset via the FADT RESET_REG supported */ | ||
175 | u8 sealed_case:1; /* 11: No internal expansion capabilities and case is sealed */ | ||
176 | u8 headless:1; /* 12: No local video capabilities or local input devices */ | ||
177 | u8 cpu_sw_sleep:1; /* 13: Must execute native instruction after writing SLP_TYPx register */ | ||
178 | |||
179 | u8 pci_exp_wak:1; /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */ | ||
180 | u8 use_platform_clock:1; /* 15: OSPM should use platform-provided timer (ACPI 3.0) */ | ||
181 | u8 S4rtc_sts_valid:1; /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */ | ||
182 | u8 remote_power_on_capable:1; /* 17: System is compatible with remote power on (ACPI 3.0) */ | ||
183 | u8 force_apic_cluster_model:1; /* 18: All local APICs must use cluster model (ACPI 3.0) */ | ||
184 | u8 force_apic_physical_destination_mode:1; /* 19: all local x_aPICs must use physical dest mode (ACPI 3.0) */ | ||
185 | u8:4; /* 20-23: Reserved, must be zero */ | ||
186 | u8 reserved3; /* 24-31: Reserved, must be zero */ | ||
187 | |||
188 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
189 | u8 reset_value; /* Value to write to the reset_register port to reset the system */ | ||
190 | u8 reserved4[3]; /* These three bytes must be zero */ | ||
191 | u64 xfirmware_ctrl; /* 64-bit physical address of FACS */ | ||
192 | u64 Xdsdt; /* 64-bit physical address of DSDT */ | ||
193 | struct acpi_generic_address xpm1a_evt_blk; /* Extended Power Mgt 1a acpi_event Reg Blk address */ | ||
194 | struct acpi_generic_address xpm1b_evt_blk; /* Extended Power Mgt 1b acpi_event Reg Blk address */ | ||
195 | struct acpi_generic_address xpm1a_cnt_blk; /* Extended Power Mgt 1a Control Reg Blk address */ | ||
196 | struct acpi_generic_address xpm1b_cnt_blk; /* Extended Power Mgt 1b Control Reg Blk address */ | ||
197 | struct acpi_generic_address xpm2_cnt_blk; /* Extended Power Mgt 2 Control Reg Blk address */ | ||
198 | struct acpi_generic_address xpm_tmr_blk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ | ||
199 | struct acpi_generic_address xgpe0_blk; /* Extended General Purpose acpi_event 0 Reg Blk address */ | ||
200 | struct acpi_generic_address xgpe1_blk; /* Extended General Purpose acpi_event 1 Reg Blk address */ | ||
201 | }; | ||
202 | |||
203 | /* "Down-revved" ACPI 2.0 FADT descriptor */ | ||
204 | |||
205 | struct fadt_descriptor_rev2_minus { | ||
206 | ACPI_TABLE_HEADER_DEF /* ACPI common table header */ | ||
207 | FADT_REV2_COMMON u8 reserved2; /* Reserved, must be zero */ | ||
208 | u32 flags; | ||
209 | struct acpi_generic_address reset_register; /* Reset register address in GAS format */ | ||
210 | u8 reset_value; /* Value to write to the reset_register port to reset the system. */ | ||
211 | u8 reserved7[3]; /* Reserved, must be zero */ | ||
212 | }; | ||
213 | |||
214 | /* ECDT - Embedded Controller Boot Resources Table */ | ||
215 | |||
216 | struct ec_boot_resources { | ||
217 | ACPI_TABLE_HEADER_DEF struct acpi_generic_address ec_control; /* Address of EC command/status register */ | ||
218 | struct acpi_generic_address ec_data; /* Address of EC data register */ | ||
219 | u32 uid; /* Unique ID - must be same as the EC _UID method */ | ||
220 | u8 gpe_bit; /* The GPE for the EC */ | ||
221 | u8 ec_id[1]; /* Full namepath of the EC in the ACPI namespace */ | ||
222 | }; | ||
223 | |||
224 | /* SRAT - System Resource Affinity Table */ | ||
225 | |||
226 | struct static_resource_alloc { | ||
227 | u8 type; | ||
228 | u8 length; | ||
229 | u8 proximity_domain_lo; | ||
230 | u8 apic_id; | ||
231 | |||
232 | /* Flags (32 bits) */ | ||
233 | |||
234 | u8 enabled:1; /* 00: Use affinity structure */ | ||
235 | u8:7; /* 01-07: Reserved, must be zero */ | ||
236 | u8 reserved3[3]; /* 08-31: Reserved, must be zero */ | ||
237 | |||
238 | u8 local_sapic_eid; | ||
239 | u8 proximity_domain_hi[3]; | ||
240 | u32 reserved4; /* Reserved, must be zero */ | ||
241 | }; | ||
242 | |||
243 | struct memory_affinity { | ||
244 | u8 type; | ||
245 | u8 length; | ||
246 | u32 proximity_domain; | ||
247 | u16 reserved3; | ||
248 | u64 base_address; | ||
249 | u64 address_length; | ||
250 | u32 reserved4; | ||
251 | |||
252 | /* Flags (32 bits) */ | ||
253 | |||
254 | u8 enabled:1; /* 00: Use affinity structure */ | ||
255 | u8 hot_pluggable:1; /* 01: Memory region is hot pluggable */ | ||
256 | u8 non_volatile:1; /* 02: Memory is non-volatile */ | ||
257 | u8:5; /* 03-07: Reserved, must be zero */ | ||
258 | u8 reserved5[3]; /* 08-31: Reserved, must be zero */ | ||
259 | |||
260 | u64 reserved6; /* Reserved, must be zero */ | ||
261 | }; | ||
262 | |||
263 | struct system_resource_affinity { | ||
264 | ACPI_TABLE_HEADER_DEF u32 reserved1; /* Must be value '1' */ | ||
265 | u64 reserved2; /* Reserved, must be zero */ | ||
266 | }; | ||
267 | |||
268 | /* SLIT - System Locality Distance Information Table */ | ||
269 | |||
270 | struct system_locality_info { | ||
271 | ACPI_TABLE_HEADER_DEF u64 locality_count; | ||
272 | u8 entry[1][1]; | ||
273 | }; | ||
274 | |||
275 | #pragma pack() | ||
276 | 48 | ||
277 | #endif /* __ACTBL2_H__ */ | 49 | #endif /* __ACTBL2_H__ */ |
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h index 7ca89cde706e..77cf1236b05a 100644 --- a/include/acpi/actypes.h +++ b/include/acpi/actypes.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #ifndef __ACTYPES_H__ | 44 | #ifndef __ACTYPES_H__ |
45 | #define __ACTYPES_H__ | 45 | #define __ACTYPES_H__ |
46 | 46 | ||
47 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
48 | |||
47 | /* | 49 | /* |
48 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header | 50 | * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header |
49 | * and must be either 16, 32, or 64 | 51 | * and must be either 16, 32, or 64 |
@@ -154,7 +156,6 @@ typedef u64 acpi_physical_address; | |||
154 | #define ACPI_MAX_PTR ACPI_UINT64_MAX | 156 | #define ACPI_MAX_PTR ACPI_UINT64_MAX |
155 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX | 157 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX |
156 | 158 | ||
157 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 | ||
158 | #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ | 159 | #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */ |
159 | 160 | ||
160 | /* | 161 | /* |
@@ -195,8 +196,6 @@ typedef u64 acpi_physical_address; | |||
195 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | 196 | #define ACPI_MAX_PTR ACPI_UINT32_MAX |
196 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | 197 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX |
197 | 198 | ||
198 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | ||
199 | |||
200 | /******************************************************************************* | 199 | /******************************************************************************* |
201 | * | 200 | * |
202 | * Types specific to 16-bit targets | 201 | * Types specific to 16-bit targets |
@@ -223,7 +222,6 @@ typedef char *acpi_physical_address; | |||
223 | #define ACPI_MAX_PTR ACPI_UINT16_MAX | 222 | #define ACPI_MAX_PTR ACPI_UINT16_MAX |
224 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX | 223 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX |
225 | 224 | ||
226 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 | ||
227 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ | 225 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ |
228 | 226 | ||
229 | /* 64-bit integers cannot be supported */ | 227 | /* 64-bit integers cannot be supported */ |
@@ -254,7 +252,7 @@ typedef acpi_native_uint acpi_size; | |||
254 | /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ | 252 | /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */ |
255 | 253 | ||
256 | #ifndef acpi_uintptr_t | 254 | #ifndef acpi_uintptr_t |
257 | #define acpi_uintptr_t void * | 255 | #define acpi_uintptr_t void * |
258 | #endif | 256 | #endif |
259 | 257 | ||
260 | /* | 258 | /* |
@@ -263,7 +261,7 @@ typedef acpi_native_uint acpi_size; | |||
263 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) | 261 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) |
264 | */ | 262 | */ |
265 | #ifndef acpi_cache_t | 263 | #ifndef acpi_cache_t |
266 | #define acpi_cache_t struct acpi_memory_list | 264 | #define acpi_cache_t struct acpi_memory_list |
267 | #endif | 265 | #endif |
268 | 266 | ||
269 | /* | 267 | /* |
@@ -271,7 +269,7 @@ typedef acpi_native_uint acpi_size; | |||
271 | * lock and unlock OSL interfaces. | 269 | * lock and unlock OSL interfaces. |
272 | */ | 270 | */ |
273 | #ifndef acpi_cpu_flags | 271 | #ifndef acpi_cpu_flags |
274 | #define acpi_cpu_flags acpi_native_uint | 272 | #define acpi_cpu_flags acpi_native_uint |
275 | #endif | 273 | #endif |
276 | 274 | ||
277 | /* | 275 | /* |
@@ -292,6 +290,21 @@ typedef acpi_native_uint acpi_size; | |||
292 | #define ACPI_UNUSED_VAR | 290 | #define ACPI_UNUSED_VAR |
293 | #endif | 291 | #endif |
294 | 292 | ||
293 | /* | ||
294 | * All ACPICA functions that are available to the rest of the kernel are | ||
295 | * tagged with this macro which can be defined as appropriate for the host. | ||
296 | */ | ||
297 | #ifndef ACPI_EXPORT_SYMBOL | ||
298 | #define ACPI_EXPORT_SYMBOL(symbol) | ||
299 | #endif | ||
300 | |||
301 | /* | ||
302 | * thread_id is returned by acpi_os_get_thread_id. | ||
303 | */ | ||
304 | #ifndef acpi_thread_id | ||
305 | #define acpi_thread_id acpi_native_uint | ||
306 | #endif | ||
307 | |||
295 | /******************************************************************************* | 308 | /******************************************************************************* |
296 | * | 309 | * |
297 | * Independent types | 310 | * Independent types |
@@ -477,15 +490,15 @@ typedef u64 acpi_integer; | |||
477 | */ | 490 | */ |
478 | typedef u32 acpi_table_type; | 491 | typedef u32 acpi_table_type; |
479 | 492 | ||
480 | #define ACPI_TABLE_RSDP (acpi_table_type) 0 | 493 | #define ACPI_TABLE_ID_RSDP (acpi_table_type) 0 |
481 | #define ACPI_TABLE_DSDT (acpi_table_type) 1 | 494 | #define ACPI_TABLE_ID_DSDT (acpi_table_type) 1 |
482 | #define ACPI_TABLE_FADT (acpi_table_type) 2 | 495 | #define ACPI_TABLE_ID_FADT (acpi_table_type) 2 |
483 | #define ACPI_TABLE_FACS (acpi_table_type) 3 | 496 | #define ACPI_TABLE_ID_FACS (acpi_table_type) 3 |
484 | #define ACPI_TABLE_PSDT (acpi_table_type) 4 | 497 | #define ACPI_TABLE_ID_PSDT (acpi_table_type) 4 |
485 | #define ACPI_TABLE_SSDT (acpi_table_type) 5 | 498 | #define ACPI_TABLE_ID_SSDT (acpi_table_type) 5 |
486 | #define ACPI_TABLE_XSDT (acpi_table_type) 6 | 499 | #define ACPI_TABLE_ID_XSDT (acpi_table_type) 6 |
487 | #define ACPI_TABLE_MAX 6 | 500 | #define ACPI_TABLE_ID_MAX 6 |
488 | #define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1) | 501 | #define ACPI_NUM_TABLE_TYPES (ACPI_TABLE_ID_MAX+1) |
489 | 502 | ||
490 | /* | 503 | /* |
491 | * Types associated with ACPI names and objects. The first group of | 504 | * Types associated with ACPI names and objects. The first group of |
@@ -816,7 +829,7 @@ struct acpi_system_info { | |||
816 | u32 debug_level; | 829 | u32 debug_level; |
817 | u32 debug_layer; | 830 | u32 debug_layer; |
818 | u32 num_table_types; | 831 | u32 num_table_types; |
819 | struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; | 832 | struct acpi_table_info table_info[ACPI_TABLE_ID_MAX + 1]; |
820 | }; | 833 | }; |
821 | 834 | ||
822 | /* | 835 | /* |
@@ -858,7 +871,7 @@ acpi_status(*acpi_adr_space_handler) (u32 function, | |||
858 | void *handler_context, | 871 | void *handler_context, |
859 | void *region_context); | 872 | void *region_context); |
860 | 873 | ||
861 | #define ACPI_DEFAULT_HANDLER NULL | 874 | #define ACPI_DEFAULT_HANDLER NULL |
862 | 875 | ||
863 | typedef | 876 | typedef |
864 | acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, | 877 | acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, |
@@ -911,12 +924,13 @@ struct acpi_compatible_id_list { | |||
911 | #define ACPI_STA_DEVICE_PRESENT 0x01 | 924 | #define ACPI_STA_DEVICE_PRESENT 0x01 |
912 | #define ACPI_STA_DEVICE_ENABLED 0x02 | 925 | #define ACPI_STA_DEVICE_ENABLED 0x02 |
913 | #define ACPI_STA_DEVICE_UI 0x04 | 926 | #define ACPI_STA_DEVICE_UI 0x04 |
914 | #define ACPI_STA_DEVICE_OK 0x08 | 927 | #define ACPI_STA_DEVICE_FUNCTIONING 0x08 |
928 | #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */ | ||
915 | #define ACPI_STA_BATTERY_PRESENT 0x10 | 929 | #define ACPI_STA_BATTERY_PRESENT 0x10 |
916 | 930 | ||
917 | #define ACPI_COMMON_OBJ_INFO \ | 931 | #define ACPI_COMMON_OBJ_INFO \ |
918 | acpi_object_type type; /* ACPI object type */ \ | 932 | acpi_object_type type; /* ACPI object type */ \ |
919 | acpi_name name /* ACPI object Name */ | 933 | acpi_name name /* ACPI object Name */ |
920 | 934 | ||
921 | struct acpi_obj_info_header { | 935 | struct acpi_obj_info_header { |
922 | ACPI_COMMON_OBJ_INFO; | 936 | ACPI_COMMON_OBJ_INFO; |
@@ -957,7 +971,7 @@ struct acpi_mem_space_context { | |||
957 | * Definitions for Resource Attributes | 971 | * Definitions for Resource Attributes |
958 | */ | 972 | */ |
959 | typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ | 973 | typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */ |
960 | typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (64_k-1)+3 */ | 974 | typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */ |
961 | 975 | ||
962 | /* | 976 | /* |
963 | * Memory Attributes | 977 | * Memory Attributes |
@@ -972,8 +986,8 @@ typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (length+3) = (6 | |||
972 | 986 | ||
973 | /* | 987 | /* |
974 | * IO Attributes | 988 | * IO Attributes |
975 | * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. | 989 | * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh. |
976 | * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. | 990 | * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh. |
977 | */ | 991 | */ |
978 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 | 992 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 |
979 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 | 993 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 |
@@ -1171,12 +1185,12 @@ struct acpi_resource_source { | |||
1171 | /* Fields common to all address descriptors, 16/32/64 bit */ | 1185 | /* Fields common to all address descriptors, 16/32/64 bit */ |
1172 | 1186 | ||
1173 | #define ACPI_RESOURCE_ADDRESS_COMMON \ | 1187 | #define ACPI_RESOURCE_ADDRESS_COMMON \ |
1174 | u8 resource_type; \ | 1188 | u8 resource_type; \ |
1175 | u8 producer_consumer; \ | 1189 | u8 producer_consumer; \ |
1176 | u8 decode; \ | 1190 | u8 decode; \ |
1177 | u8 min_address_fixed; \ | 1191 | u8 min_address_fixed; \ |
1178 | u8 max_address_fixed; \ | 1192 | u8 max_address_fixed; \ |
1179 | union acpi_resource_attribute info; | 1193 | union acpi_resource_attribute info; |
1180 | 1194 | ||
1181 | struct acpi_resource_address { | 1195 | struct acpi_resource_address { |
1182 | ACPI_RESOURCE_ADDRESS_COMMON}; | 1196 | ACPI_RESOURCE_ADDRESS_COMMON}; |
@@ -1297,16 +1311,6 @@ struct acpi_resource { | |||
1297 | 1311 | ||
1298 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) | 1312 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) |
1299 | 1313 | ||
1300 | #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED | ||
1301 | #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) | ||
1302 | #else | ||
1303 | #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) | ||
1304 | #endif | ||
1305 | |||
1306 | /* | ||
1307 | * END: of definitions for Resource Attributes | ||
1308 | */ | ||
1309 | |||
1310 | struct acpi_pci_routing_table { | 1314 | struct acpi_pci_routing_table { |
1311 | u32 length; | 1315 | u32 length; |
1312 | u32 pin; | 1316 | u32 pin; |
@@ -1315,8 +1319,4 @@ struct acpi_pci_routing_table { | |||
1315 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ | 1319 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ |
1316 | }; | 1320 | }; |
1317 | 1321 | ||
1318 | /* | ||
1319 | * END: of definitions for PCI Routing tables | ||
1320 | */ | ||
1321 | |||
1322 | #endif /* __ACTYPES_H__ */ | 1322 | #endif /* __ACTYPES_H__ */ |
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h index 0927765df6aa..ba039ea1a057 100644 --- a/include/acpi/acutils.h +++ b/include/acpi/acutils.h | |||
@@ -50,24 +50,24 @@ extern const u8 acpi_gbl_resource_aml_sizes[]; | |||
50 | 50 | ||
51 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) | 51 | #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) |
52 | 52 | ||
53 | extern const char *acpi_gbl_BMdecode[2]; | 53 | extern const char *acpi_gbl_bm_decode[]; |
54 | extern const char *acpi_gbl_config_decode[4]; | 54 | extern const char *acpi_gbl_config_decode[]; |
55 | extern const char *acpi_gbl_consume_decode[2]; | 55 | extern const char *acpi_gbl_consume_decode[]; |
56 | extern const char *acpi_gbl_DECdecode[2]; | 56 | extern const char *acpi_gbl_dec_decode[]; |
57 | extern const char *acpi_gbl_HEdecode[2]; | 57 | extern const char *acpi_gbl_he_decode[]; |
58 | extern const char *acpi_gbl_io_decode[2]; | 58 | extern const char *acpi_gbl_io_decode[]; |
59 | extern const char *acpi_gbl_LLdecode[2]; | 59 | extern const char *acpi_gbl_ll_decode[]; |
60 | extern const char *acpi_gbl_max_decode[2]; | 60 | extern const char *acpi_gbl_max_decode[]; |
61 | extern const char *acpi_gbl_MEMdecode[4]; | 61 | extern const char *acpi_gbl_mem_decode[]; |
62 | extern const char *acpi_gbl_min_decode[2]; | 62 | extern const char *acpi_gbl_min_decode[]; |
63 | extern const char *acpi_gbl_MTPdecode[4]; | 63 | extern const char *acpi_gbl_mtp_decode[]; |
64 | extern const char *acpi_gbl_RNGdecode[4]; | 64 | extern const char *acpi_gbl_rng_decode[]; |
65 | extern const char *acpi_gbl_RWdecode[2]; | 65 | extern const char *acpi_gbl_rw_decode[]; |
66 | extern const char *acpi_gbl_SHRdecode[2]; | 66 | extern const char *acpi_gbl_shr_decode[]; |
67 | extern const char *acpi_gbl_SIZdecode[4]; | 67 | extern const char *acpi_gbl_siz_decode[]; |
68 | extern const char *acpi_gbl_TRSdecode[2]; | 68 | extern const char *acpi_gbl_trs_decode[]; |
69 | extern const char *acpi_gbl_TTPdecode[2]; | 69 | extern const char *acpi_gbl_ttp_decode[]; |
70 | extern const char *acpi_gbl_TYPdecode[4]; | 70 | extern const char *acpi_gbl_typ_decode[]; |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | /* Types for Resource descriptor entries */ | 73 | /* Types for Resource descriptor entries */ |
@@ -78,6 +78,12 @@ extern const char *acpi_gbl_TYPdecode[4]; | |||
78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 | 78 | #define ACPI_SMALL_VARIABLE_LENGTH 3 |
79 | 79 | ||
80 | typedef | 80 | typedef |
81 | acpi_status(*acpi_walk_aml_callback) (u8 * aml, | ||
82 | u32 length, | ||
83 | u32 offset, | ||
84 | u8 resource_index, void **context); | ||
85 | |||
86 | typedef | ||
81 | acpi_status(*acpi_pkg_callback) (u8 object_type, | 87 | acpi_status(*acpi_pkg_callback) (u8 object_type, |
82 | union acpi_operand_object * source_object, | 88 | union acpi_operand_object * source_object, |
83 | union acpi_generic_state * state, | 89 | union acpi_generic_state * state, |
@@ -277,6 +283,8 @@ acpi_ut_ptr_exit(u32 line_number, | |||
277 | 283 | ||
278 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); | 284 | void acpi_ut_dump_buffer(u8 * buffer, u32 count, u32 display, u32 component_id); |
279 | 285 | ||
286 | void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display); | ||
287 | |||
280 | void acpi_ut_report_error(char *module_name, u32 line_number); | 288 | void acpi_ut_report_error(char *module_name, u32 line_number); |
281 | 289 | ||
282 | void acpi_ut_report_info(char *module_name, u32 line_number); | 290 | void acpi_ut_report_info(char *module_name, u32 line_number); |
@@ -445,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
445 | /* | 453 | /* |
446 | * utmisc | 454 | * utmisc |
447 | */ | 455 | */ |
456 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table); | ||
457 | |||
448 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); | 458 | acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); |
449 | 459 | ||
450 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id); | 460 | void acpi_ut_release_owner_id(acpi_owner_id * owner_id); |
@@ -460,7 +470,9 @@ void acpi_ut_print_string(char *string, u8 max_length); | |||
460 | 470 | ||
461 | u8 acpi_ut_valid_acpi_name(u32 name); | 471 | u8 acpi_ut_valid_acpi_name(u32 name); |
462 | 472 | ||
463 | u8 acpi_ut_valid_acpi_character(char character); | 473 | acpi_name acpi_ut_repair_name(acpi_name name); |
474 | |||
475 | u8 acpi_ut_valid_acpi_char(char character, acpi_native_uint position); | ||
464 | 476 | ||
465 | acpi_status | 477 | acpi_status |
466 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | 478 | acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); |
@@ -469,6 +481,25 @@ acpi_ut_strtoul64(char *string, u32 base, acpi_integer * ret_integer); | |||
469 | 481 | ||
470 | #define ACPI_ANY_BASE 0 | 482 | #define ACPI_ANY_BASE 0 |
471 | 483 | ||
484 | u32 acpi_ut_dword_byte_swap(u32 value); | ||
485 | |||
486 | void acpi_ut_set_integer_width(u8 revision); | ||
487 | |||
488 | #ifdef ACPI_DEBUG_OUTPUT | ||
489 | void | ||
490 | acpi_ut_display_init_pathname(u8 type, | ||
491 | struct acpi_namespace_node *obj_handle, | ||
492 | char *path); | ||
493 | #endif | ||
494 | |||
495 | /* | ||
496 | * utresrc | ||
497 | */ | ||
498 | acpi_status | ||
499 | acpi_ut_walk_aml_resources(u8 * aml, | ||
500 | acpi_size aml_length, | ||
501 | acpi_walk_aml_callback user_function, void **context); | ||
502 | |||
472 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); | 503 | acpi_status acpi_ut_validate_resource(void *aml, u8 * return_index); |
473 | 504 | ||
474 | u32 acpi_ut_get_descriptor_length(void *aml); | 505 | u32 acpi_ut_get_descriptor_length(void *aml); |
@@ -483,20 +514,6 @@ acpi_status | |||
483 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, | 514 | acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, |
484 | u8 ** end_tag); | 515 | u8 ** end_tag); |
485 | 516 | ||
486 | u8 acpi_ut_generate_checksum(u8 * buffer, u32 length); | ||
487 | |||
488 | u32 acpi_ut_dword_byte_swap(u32 value); | ||
489 | |||
490 | void acpi_ut_set_integer_width(u8 revision); | ||
491 | |||
492 | #ifdef ACPI_DEBUG_OUTPUT | ||
493 | void | ||
494 | acpi_ut_display_init_pathname(u8 type, | ||
495 | struct acpi_namespace_node *obj_handle, | ||
496 | char *path); | ||
497 | |||
498 | #endif | ||
499 | |||
500 | /* | 517 | /* |
501 | * utmutex - mutex support | 518 | * utmutex - mutex support |
502 | */ | 519 | */ |
@@ -523,14 +540,15 @@ acpi_ut_initialize_buffer(struct acpi_buffer *buffer, | |||
523 | 540 | ||
524 | void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); | 541 | void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line); |
525 | 542 | ||
526 | void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line); | 543 | void *acpi_ut_allocate_zeroed(acpi_size size, |
544 | u32 component, char *module, u32 line); | ||
527 | 545 | ||
528 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 546 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
529 | void *acpi_ut_allocate_and_track(acpi_size size, | 547 | void *acpi_ut_allocate_and_track(acpi_size size, |
530 | u32 component, char *module, u32 line); | 548 | u32 component, char *module, u32 line); |
531 | 549 | ||
532 | void *acpi_ut_callocate_and_track(acpi_size size, | 550 | void *acpi_ut_allocate_zeroed_and_track(acpi_size size, |
533 | u32 component, char *module, u32 line); | 551 | u32 component, char *module, u32 line); |
534 | 552 | ||
535 | void | 553 | void |
536 | acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); | 554 | acpi_ut_free_and_track(void *address, u32 component, char *module, u32 line); |
@@ -540,6 +558,11 @@ void acpi_ut_dump_allocation_info(void); | |||
540 | #endif /* ACPI_FUTURE_USAGE */ | 558 | #endif /* ACPI_FUTURE_USAGE */ |
541 | 559 | ||
542 | void acpi_ut_dump_allocations(u32 component, char *module); | 560 | void acpi_ut_dump_allocations(u32 component, char *module); |
561 | |||
562 | acpi_status | ||
563 | acpi_ut_create_list(char *list_name, | ||
564 | u16 object_size, struct acpi_memory_list **return_cache); | ||
565 | |||
543 | #endif | 566 | #endif |
544 | 567 | ||
545 | #endif /* _ACUTILS_H */ | 568 | #endif /* _ACUTILS_H */ |
diff --git a/include/acpi/amlcode.h b/include/acpi/amlcode.h index 37964a59aef8..cf18426a87b1 100644 --- a/include/acpi/amlcode.h +++ b/include/acpi/amlcode.h | |||
@@ -180,8 +180,10 @@ | |||
180 | #define AML_BANK_FIELD_OP (u16) 0x5b87 | 180 | #define AML_BANK_FIELD_OP (u16) 0x5b87 |
181 | #define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ | 181 | #define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */ |
182 | 182 | ||
183 | /* Bogus opcodes (they are actually two separate opcodes) */ | 183 | /* |
184 | 184 | * Combination opcodes (actually two one-byte opcodes) | |
185 | * Used by the disassembler and i_aSL compiler | ||
186 | */ | ||
185 | #define AML_LGREATEREQUAL_OP (u16) 0x9295 | 187 | #define AML_LGREATEREQUAL_OP (u16) 0x9295 |
186 | #define AML_LLESSEQUAL_OP (u16) 0x9294 | 188 | #define AML_LLESSEQUAL_OP (u16) 0x9294 |
187 | #define AML_LNOTEQUAL_OP (u16) 0x9293 | 189 | #define AML_LNOTEQUAL_OP (u16) 0x9293 |
diff --git a/include/acpi/amlresrc.h b/include/acpi/amlresrc.h index fb4735315ad3..be03818af9d1 100644 --- a/include/acpi/amlresrc.h +++ b/include/acpi/amlresrc.h | |||
@@ -42,39 +42,45 @@ | |||
42 | * POSSIBILITY OF SUCH DAMAGES. | 42 | * POSSIBILITY OF SUCH DAMAGES. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /* acpisrc:struct_defs -- for acpisrc conversion */ | ||
46 | |||
45 | #ifndef __AMLRESRC_H | 47 | #ifndef __AMLRESRC_H |
46 | #define __AMLRESRC_H | 48 | #define __AMLRESRC_H |
47 | 49 | ||
48 | #define ASL_RESNAME_ADDRESS "_ADR" | 50 | /* |
49 | #define ASL_RESNAME_ALIGNMENT "_ALN" | 51 | * Resource descriptor tags, as defined in the ACPI specification. |
50 | #define ASL_RESNAME_ADDRESSSPACE "_ASI" | 52 | * Used to symbolically reference fields within a descriptor. |
51 | #define ASL_RESNAME_ACCESSSIZE "_ASZ" | 53 | */ |
52 | #define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT" | 54 | #define ACPI_RESTAG_ADDRESS "_ADR" |
53 | #define ASL_RESNAME_BASEADDRESS "_BAS" | 55 | #define ACPI_RESTAG_ALIGNMENT "_ALN" |
54 | #define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ | 56 | #define ACPI_RESTAG_ADDRESSSPACE "_ASI" |
55 | #define ASL_RESNAME_DECODE "_DEC" | 57 | #define ACPI_RESTAG_ACCESSSIZE "_ASZ" |
56 | #define ASL_RESNAME_DMA "_DMA" | 58 | #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT" |
57 | #define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ | 59 | #define ACPI_RESTAG_BASEADDRESS "_BAS" |
58 | #define ASL_RESNAME_GRANULARITY "_GRA" | 60 | #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */ |
59 | #define ASL_RESNAME_INTERRUPT "_INT" | 61 | #define ACPI_RESTAG_DECODE "_DEC" |
60 | #define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ | 62 | #define ACPI_RESTAG_DMA "_DMA" |
61 | #define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ | 63 | #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ |
62 | #define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ | 64 | #define ACPI_RESTAG_GRANULARITY "_GRA" |
63 | #define ASL_RESNAME_LENGTH "_LEN" | 65 | #define ACPI_RESTAG_INTERRUPT "_INT" |
64 | #define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ | 66 | #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */ |
65 | #define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ | 67 | #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */ |
66 | #define ASL_RESNAME_MAXADDR "_MAX" | 68 | #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ |
67 | #define ASL_RESNAME_MINADDR "_MIN" | 69 | #define ACPI_RESTAG_LENGTH "_LEN" |
68 | #define ASL_RESNAME_MAXTYPE "_MAF" | 70 | #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ |
69 | #define ASL_RESNAME_MINTYPE "_MIF" | 71 | #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ |
70 | #define ASL_RESNAME_REGISTERBITOFFSET "_RBO" | 72 | #define ACPI_RESTAG_MAXADDR "_MAX" |
71 | #define ASL_RESNAME_REGISTERBITWIDTH "_RBW" | 73 | #define ACPI_RESTAG_MINADDR "_MIN" |
72 | #define ASL_RESNAME_RANGETYPE "_RNG" | 74 | #define ACPI_RESTAG_MAXTYPE "_MAF" |
73 | #define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ | 75 | #define ACPI_RESTAG_MINTYPE "_MIF" |
74 | #define ASL_RESNAME_TRANSLATION "_TRA" | 76 | #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" |
75 | #define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ | 77 | #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" |
76 | #define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ | 78 | #define ACPI_RESTAG_RANGETYPE "_RNG" |
77 | #define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */ | 79 | #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ |
80 | #define ACPI_RESTAG_TRANSLATION "_TRA" | ||
81 | #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ | ||
82 | #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */ | ||
83 | #define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8_and16(1), 16(2) */ | ||
78 | 84 | ||
79 | /* Default sizes for "small" resource descriptors */ | 85 | /* Default sizes for "small" resource descriptors */ |
80 | 86 | ||
@@ -109,7 +115,7 @@ struct asl_resource_node { | |||
109 | * SMALL descriptors | 115 | * SMALL descriptors |
110 | */ | 116 | */ |
111 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ | 117 | #define AML_RESOURCE_SMALL_HEADER_COMMON \ |
112 | u8 descriptor_type; | 118 | u8 descriptor_type; |
113 | 119 | ||
114 | struct aml_resource_small_header { | 120 | struct aml_resource_small_header { |
115 | AML_RESOURCE_SMALL_HEADER_COMMON}; | 121 | AML_RESOURCE_SMALL_HEADER_COMMON}; |
@@ -162,8 +168,8 @@ struct aml_resource_end_tag { | |||
162 | * LARGE descriptors | 168 | * LARGE descriptors |
163 | */ | 169 | */ |
164 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ | 170 | #define AML_RESOURCE_LARGE_HEADER_COMMON \ |
165 | u8 descriptor_type;\ | 171 | u8 descriptor_type;\ |
166 | u16 resource_length; | 172 | u16 resource_length; |
167 | 173 | ||
168 | struct aml_resource_large_header { | 174 | struct aml_resource_large_header { |
169 | AML_RESOURCE_LARGE_HEADER_COMMON}; | 175 | AML_RESOURCE_LARGE_HEADER_COMMON}; |
@@ -194,9 +200,9 @@ struct aml_resource_fixed_memory32 { | |||
194 | }; | 200 | }; |
195 | 201 | ||
196 | #define AML_RESOURCE_ADDRESS_COMMON \ | 202 | #define AML_RESOURCE_ADDRESS_COMMON \ |
197 | u8 resource_type; \ | 203 | u8 resource_type; \ |
198 | u8 flags; \ | 204 | u8 flags; \ |
199 | u8 specific_flags; | 205 | u8 specific_flags; |
200 | 206 | ||
201 | struct aml_resource_address { | 207 | struct aml_resource_address { |
202 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; | 208 | AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON}; |
@@ -266,6 +272,7 @@ struct aml_resource_generic_register { | |||
266 | union aml_resource { | 272 | union aml_resource { |
267 | /* Descriptor headers */ | 273 | /* Descriptor headers */ |
268 | 274 | ||
275 | u8 descriptor_type; | ||
269 | struct aml_resource_small_header small_header; | 276 | struct aml_resource_small_header small_header; |
270 | struct aml_resource_large_header large_header; | 277 | struct aml_resource_large_header large_header; |
271 | 278 | ||
@@ -296,9 +303,9 @@ union aml_resource { | |||
296 | /* Utility overlays */ | 303 | /* Utility overlays */ |
297 | 304 | ||
298 | struct aml_resource_address address; | 305 | struct aml_resource_address address; |
299 | u32 u32_item; | 306 | u32 dword_item; |
300 | u16 u16_item; | 307 | u16 word_item; |
301 | u8 U8item; | 308 | u8 byte_item; |
302 | }; | 309 | }; |
303 | 310 | ||
304 | #endif | 311 | #endif |
diff --git a/include/acpi/pdc_intel.h b/include/acpi/pdc_intel.h index 3fa81d55cd0c..c5472be6f3a2 100644 --- a/include/acpi/pdc_intel.h +++ b/include/acpi/pdc_intel.h | |||
@@ -18,6 +18,11 @@ | |||
18 | ACPI_PDC_C_C1_HALT | \ | 18 | ACPI_PDC_C_C1_HALT | \ |
19 | ACPI_PDC_P_FFH) | 19 | ACPI_PDC_P_FFH) |
20 | 20 | ||
21 | #define ACPI_PDC_EST_CAPABILITY_SWSMP (ACPI_PDC_SMP_C1PT | \ | ||
22 | ACPI_PDC_C_C1_HALT | \ | ||
23 | ACPI_PDC_SMP_P_SWCOORD | \ | ||
24 | ACPI_PDC_P_FFH) | ||
25 | |||
21 | #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ | 26 | #define ACPI_PDC_C_CAPABILITY_SMP (ACPI_PDC_SMP_C2C3 | \ |
22 | ACPI_PDC_SMP_C1PT | \ | 27 | ACPI_PDC_SMP_C1PT | \ |
23 | ACPI_PDC_C_C1_HALT) | 28 | ACPI_PDC_C_C1_HALT) |
diff --git a/include/acpi/platform/acenv.h b/include/acpi/platform/acenv.h index 223ec6467108..453a469fd397 100644 --- a/include/acpi/platform/acenv.h +++ b/include/acpi/platform/acenv.h | |||
@@ -49,33 +49,41 @@ | |||
49 | */ | 49 | */ |
50 | 50 | ||
51 | #ifdef ACPI_LIBRARY | 51 | #ifdef ACPI_LIBRARY |
52 | /* | ||
53 | * Note: The non-debug version of the acpi_library does not contain any | ||
54 | * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG | ||
55 | */ | ||
52 | #define ACPI_USE_LOCAL_CACHE | 56 | #define ACPI_USE_LOCAL_CACHE |
53 | #endif | 57 | #endif |
54 | 58 | ||
55 | #ifdef ACPI_DUMP_APP | 59 | #ifdef ACPI_ASL_COMPILER |
56 | #ifndef MSDOS | ||
57 | #define ACPI_DEBUG_OUTPUT | 60 | #define ACPI_DEBUG_OUTPUT |
58 | #endif | ||
59 | #define ACPI_APPLICATION | 61 | #define ACPI_APPLICATION |
60 | #define ACPI_DISASSEMBLER | 62 | #define ACPI_DISASSEMBLER |
61 | #define ACPI_NO_METHOD_EXECUTION | 63 | #define ACPI_CONSTANT_EVAL_ONLY |
64 | #define ACPI_LARGE_NAMESPACE_NODE | ||
65 | #define ACPI_DATA_TABLE_DISASSEMBLY | ||
62 | #endif | 66 | #endif |
63 | 67 | ||
64 | #ifdef ACPI_EXEC_APP | 68 | #ifdef ACPI_EXEC_APP |
65 | #undef DEBUGGER_THREADING | 69 | #undef DEBUGGER_THREADING |
66 | #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED | 70 | #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED |
67 | #define ACPI_DEBUG_OUTPUT | 71 | #define ACPI_FULL_DEBUG |
68 | #define ACPI_APPLICATION | 72 | #define ACPI_APPLICATION |
69 | #define ACPI_DEBUGGER | 73 | #define ACPI_DEBUGGER |
70 | #define ACPI_DISASSEMBLER | ||
71 | #define ACPI_MUTEX_DEBUG | 74 | #define ACPI_MUTEX_DEBUG |
75 | #define ACPI_DBG_TRACK_ALLOCATIONS | ||
72 | #endif | 76 | #endif |
73 | 77 | ||
74 | #ifdef ACPI_ASL_COMPILER | 78 | #ifdef ACPI_DASM_APP |
79 | #ifndef MSDOS | ||
75 | #define ACPI_DEBUG_OUTPUT | 80 | #define ACPI_DEBUG_OUTPUT |
81 | #endif | ||
76 | #define ACPI_APPLICATION | 82 | #define ACPI_APPLICATION |
77 | #define ACPI_DISASSEMBLER | 83 | #define ACPI_DISASSEMBLER |
78 | #define ACPI_CONSTANT_EVAL_ONLY | 84 | #define ACPI_NO_METHOD_EXECUTION |
85 | #define ACPI_LARGE_NAMESPACE_NODE | ||
86 | #define ACPI_DATA_TABLE_DISASSEMBLY | ||
79 | #endif | 87 | #endif |
80 | 88 | ||
81 | #ifdef ACPI_APPLICATION | 89 | #ifdef ACPI_APPLICATION |
@@ -83,6 +91,12 @@ | |||
83 | #define ACPI_USE_LOCAL_CACHE | 91 | #define ACPI_USE_LOCAL_CACHE |
84 | #endif | 92 | #endif |
85 | 93 | ||
94 | #ifdef ACPI_FULL_DEBUG | ||
95 | #define ACPI_DEBUGGER | ||
96 | #define ACPI_DEBUG_OUTPUT | ||
97 | #define ACPI_DISASSEMBLER | ||
98 | #endif | ||
99 | |||
86 | /* | 100 | /* |
87 | * Environment configuration. The purpose of this file is to interface to the | 101 | * Environment configuration. The purpose of this file is to interface to the |
88 | * local generation environment. | 102 | * local generation environment. |
@@ -137,7 +151,7 @@ | |||
137 | #elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ | 151 | #elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ |
138 | #include "acdos16.h" | 152 | #include "acdos16.h" |
139 | 153 | ||
140 | #elif defined(__FreeBSD__) | 154 | #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
141 | #include "acfreebsd.h" | 155 | #include "acfreebsd.h" |
142 | 156 | ||
143 | #elif defined(__NetBSD__) | 157 | #elif defined(__NetBSD__) |
@@ -163,17 +177,6 @@ | |||
163 | 177 | ||
164 | #endif | 178 | #endif |
165 | 179 | ||
166 | /* | ||
167 | * Memory allocation tracking. Used only if | ||
168 | * 1) This is the debug version | ||
169 | * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) | ||
170 | */ | ||
171 | #ifdef ACPI_DEBUG_OUTPUT | ||
172 | #if ACPI_MACHINE_WIDTH != 16 | ||
173 | #define ACPI_DBG_TRACK_ALLOCATIONS | ||
174 | #endif | ||
175 | #endif | ||
176 | |||
177 | /*! [End] no source code translation !*/ | 180 | /*! [End] no source code translation !*/ |
178 | 181 | ||
179 | /* | 182 | /* |
@@ -271,8 +274,8 @@ typedef char *va_list; | |||
271 | /* | 274 | /* |
272 | * Storage alignment properties | 275 | * Storage alignment properties |
273 | */ | 276 | */ |
274 | #define _AUPBND (sizeof (acpi_native_uint) - 1) | 277 | #define _AUPBND (sizeof (acpi_native_int) - 1) |
275 | #define _ADNBND (sizeof (acpi_native_uint) - 1) | 278 | #define _ADNBND (sizeof (acpi_native_int) - 1) |
276 | 279 | ||
277 | /* | 280 | /* |
278 | * Variable argument list macro definitions | 281 | * Variable argument list macro definitions |
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index 3c6a6205853a..277d35bced03 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h | |||
@@ -51,27 +51,22 @@ | |||
51 | 51 | ||
52 | #include <linux/string.h> | 52 | #include <linux/string.h> |
53 | #include <linux/kernel.h> | 53 | #include <linux/kernel.h> |
54 | #include <linux/module.h> | ||
54 | #include <linux/ctype.h> | 55 | #include <linux/ctype.h> |
55 | #include <asm/system.h> | 56 | #include <asm/system.h> |
56 | #include <asm/atomic.h> | 57 | #include <asm/atomic.h> |
57 | #include <asm/div64.h> | 58 | #include <asm/div64.h> |
58 | #include <asm/acpi.h> | 59 | #include <asm/acpi.h> |
60 | #include <linux/slab.h> | ||
59 | 61 | ||
60 | #define strtoul simple_strtoul | 62 | /* Host-dependent types and defines */ |
61 | |||
62 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG | ||
63 | 63 | ||
64 | /* Type(s) for the OSL */ | 64 | #define ACPI_MACHINE_WIDTH BITS_PER_LONG |
65 | 65 | #define acpi_cache_t kmem_cache_t | |
66 | #ifdef ACPI_USE_LOCAL_CACHE | 66 | #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); |
67 | #define acpi_cache_t struct acpi_memory_list | 67 | #define strtoul simple_strtoul |
68 | #else | ||
69 | #include <linux/slab.h> | ||
70 | #define acpi_cache_t kmem_cache_t | ||
71 | #endif | ||
72 | 68 | ||
73 | /* Full namespace pathname length limit - arbitrary */ | 69 | /* Full namespace pathname length limit - arbitrary */ |
74 | |||
75 | #define ACPI_PATHNAME_MAX 256 | 70 | #define ACPI_PATHNAME_MAX 256 |
76 | 71 | ||
77 | #else /* !__KERNEL__ */ | 72 | #else /* !__KERNEL__ */ |
@@ -103,4 +98,8 @@ | |||
103 | 98 | ||
104 | #define acpi_cpu_flags unsigned long | 99 | #define acpi_cpu_flags unsigned long |
105 | 100 | ||
101 | #define acpi_thread_id u32 | ||
102 | |||
103 | static inline acpi_thread_id acpi_os_get_thread_id(void) { return 0; } | ||
104 | |||
106 | #endif /* __ACLINUX_H__ */ | 105 | #endif /* __ACLINUX_H__ */ |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index ef7d83a41470..77371b3cdc44 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ACPI_PROCESSOR_H | 2 | #define __ACPI_PROCESSOR_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/cpu.h> | ||
5 | 6 | ||
6 | #include <asm/acpi.h> | 7 | #include <asm/acpi.h> |
7 | 8 | ||
@@ -17,6 +18,17 @@ | |||
17 | 18 | ||
18 | #define ACPI_PDC_REVISION_ID 0x1 | 19 | #define ACPI_PDC_REVISION_ID 0x1 |
19 | 20 | ||
21 | #define ACPI_PSD_REV0_REVISION 0 /* Support for _PSD as in ACPI 3.0 */ | ||
22 | #define ACPI_PSD_REV0_ENTRIES 5 | ||
23 | |||
24 | /* | ||
25 | * Types of coordination defined in ACPI 3.0. Same macros can be used across | ||
26 | * P, C and T states | ||
27 | */ | ||
28 | #define DOMAIN_COORD_TYPE_SW_ALL 0xfc | ||
29 | #define DOMAIN_COORD_TYPE_SW_ANY 0xfd | ||
30 | #define DOMAIN_COORD_TYPE_HW_ALL 0xfe | ||
31 | |||
20 | /* Power Management */ | 32 | /* Power Management */ |
21 | 33 | ||
22 | struct acpi_processor_cx; | 34 | struct acpi_processor_cx; |
@@ -65,6 +77,14 @@ struct acpi_processor_power { | |||
65 | 77 | ||
66 | /* Performance Management */ | 78 | /* Performance Management */ |
67 | 79 | ||
80 | struct acpi_psd_package { | ||
81 | acpi_integer num_entries; | ||
82 | acpi_integer revision; | ||
83 | acpi_integer domain; | ||
84 | acpi_integer coord_type; | ||
85 | acpi_integer num_processors; | ||
86 | } __attribute__ ((packed)); | ||
87 | |||
68 | struct acpi_pct_register { | 88 | struct acpi_pct_register { |
69 | u8 descriptor; | 89 | u8 descriptor; |
70 | u16 length; | 90 | u16 length; |
@@ -91,7 +111,9 @@ struct acpi_processor_performance { | |||
91 | struct acpi_pct_register status_register; | 111 | struct acpi_pct_register status_register; |
92 | unsigned int state_count; | 112 | unsigned int state_count; |
93 | struct acpi_processor_px *states; | 113 | struct acpi_processor_px *states; |
94 | 114 | struct acpi_psd_package domain_info; | |
115 | cpumask_t shared_cpu_map; | ||
116 | unsigned int shared_type; | ||
95 | }; | 117 | }; |
96 | 118 | ||
97 | /* Throttling Control */ | 119 | /* Throttling Control */ |
@@ -160,6 +182,9 @@ struct acpi_processor_errata { | |||
160 | } piix4; | 182 | } piix4; |
161 | }; | 183 | }; |
162 | 184 | ||
185 | extern int acpi_processor_preregister_performance( | ||
186 | struct acpi_processor_performance **performance); | ||
187 | |||
163 | extern int acpi_processor_register_performance(struct acpi_processor_performance | 188 | extern int acpi_processor_register_performance(struct acpi_processor_performance |
164 | *performance, unsigned int cpu); | 189 | *performance, unsigned int cpu); |
165 | extern void acpi_processor_unregister_performance(struct | 190 | extern void acpi_processor_unregister_performance(struct |
diff --git a/include/asm-i386/apicdef.h b/include/asm-i386/apicdef.h index 5e4a35af2921..9f6995341fdc 100644 --- a/include/asm-i386/apicdef.h +++ b/include/asm-i386/apicdef.h | |||
@@ -121,7 +121,6 @@ | |||
121 | */ | 121 | */ |
122 | #define u32 unsigned int | 122 | #define u32 unsigned int |
123 | 123 | ||
124 | #define lapic ((volatile struct local_apic *)APIC_BASE) | ||
125 | 124 | ||
126 | struct local_apic { | 125 | struct local_apic { |
127 | 126 | ||
diff --git a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h index aa1c7b2e438c..2c95a319c056 100644 --- a/include/asm-x86_64/acpi.h +++ b/include/asm-x86_64/acpi.h | |||
@@ -162,6 +162,8 @@ extern int acpi_pci_disabled; | |||
162 | 162 | ||
163 | extern u8 x86_acpiid_to_apicid[]; | 163 | extern u8 x86_acpiid_to_apicid[]; |
164 | 164 | ||
165 | #define ARCH_HAS_POWER_INIT 1 | ||
166 | |||
165 | extern int acpi_skip_timer_override; | 167 | extern int acpi_skip_timer_override; |
166 | 168 | ||
167 | #endif /*__KERNEL__*/ | 169 | #endif /*__KERNEL__*/ |
diff --git a/include/asm-x86_64/apicdef.h b/include/asm-x86_64/apicdef.h index 5a48e9bcf218..1dd40067c67c 100644 --- a/include/asm-x86_64/apicdef.h +++ b/include/asm-x86_64/apicdef.h | |||
@@ -137,8 +137,6 @@ | |||
137 | */ | 137 | */ |
138 | #define u32 unsigned int | 138 | #define u32 unsigned int |
139 | 139 | ||
140 | #define lapic ((volatile struct local_apic *)APIC_BASE) | ||
141 | |||
142 | struct local_apic { | 140 | struct local_apic { |
143 | 141 | ||
144 | /*000*/ struct { u32 __reserved[4]; } __reserved_01; | 142 | /*000*/ struct { u32 __reserved[4]; } __reserved_01; |
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 5aa95011f7e6..466fbe9e4899 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -72,6 +72,8 @@ struct cpufreq_real_policy { | |||
72 | 72 | ||
73 | struct cpufreq_policy { | 73 | struct cpufreq_policy { |
74 | cpumask_t cpus; /* affected CPUs */ | 74 | cpumask_t cpus; /* affected CPUs */ |
75 | unsigned int shared_type; /* ANY or ALL affected CPUs | ||
76 | should set cpufreq */ | ||
75 | unsigned int cpu; /* cpu nr of registered CPU */ | 77 | unsigned int cpu; /* cpu nr of registered CPU */ |
76 | struct cpufreq_cpuinfo cpuinfo;/* see above */ | 78 | struct cpufreq_cpuinfo cpuinfo;/* see above */ |
77 | 79 | ||
@@ -98,6 +100,8 @@ struct cpufreq_policy { | |||
98 | #define CPUFREQ_INCOMPATIBLE (1) | 100 | #define CPUFREQ_INCOMPATIBLE (1) |
99 | #define CPUFREQ_NOTIFY (2) | 101 | #define CPUFREQ_NOTIFY (2) |
100 | 102 | ||
103 | #define CPUFREQ_SHARED_TYPE_ALL (0) /* All dependent CPUs should set freq */ | ||
104 | #define CPUFREQ_SHARED_TYPE_ANY (1) /* Freq can be set from any dependent CPU */ | ||
101 | 105 | ||
102 | /******************** cpufreq transition notifiers *******************/ | 106 | /******************** cpufreq transition notifiers *******************/ |
103 | 107 | ||